:root {
  --bg: #080d12;
  --panel: #101820;
  --panel-2: #141f29;
  --line: rgba(157, 178, 196, .18);
  --text: #f5fbff;
  --muted: #8fa1b2;
  --green: #27c971;
  --green-2: #7cffb2;
  --red: #ff4e6a;
  --blue: #4aa3ff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(39, 201, 113, .18), transparent 28rem),
    radial-gradient(circle at 90% 10%, rgba(74, 163, 255, .12), transparent 24rem),
    linear-gradient(180deg, #080d12, #0c1218 34rem, #070b0f);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 22px;
  align-items: center;
  padding: 16px clamp(16px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 13, 18, .86);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 950;
}

.brand span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: var(--green);
  color: #07120c;
}

nav, .account, .actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

nav a {
  color: var(--muted);
  font-weight: 850;
}

main {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 80px;
}

.screen { animation: rise .24s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.hero > div,
.balance-card,
.market-sidebar,
.market-detail,
.auth-card,
.admin-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(20, 31, 41, .92), rgba(12, 18, 24, .92));
  box-shadow: 0 22px 70px rgba(0, 0, 0, .24);
}

.hero > div { padding: clamp(22px, 4vw, 42px); }
.kicker {
  margin: 0 0 10px;
  color: var(--green-2);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .08em;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 12px;
  font-size: clamp(44px, 8vw, 96px);
  line-height: .88;
  letter-spacing: -.06em;
}
h2 { font-size: 22px; }
p { color: var(--muted); line-height: 1.55; }

.primary, .ghost, .danger {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 0;
  padding: 0 16px;
  font-weight: 950;
  white-space: nowrap;
}

.primary { background: var(--green); color: #07120c; }
.ghost { background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--text); }
.danger { background: rgba(255, 78, 106, .16); color: #ff8ea0; }

.balance-card {
  display: grid;
  gap: 12px;
  align-content: center;
  padding: 22px;
}
.balance-card span { color: var(--muted); font-weight: 850; text-transform: uppercase; font-size: 12px; }
.balance-card strong { font-size: 46px; line-height: 1; }

.market-layout {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 18px;
}

.market-sidebar, .market-detail { padding: 18px; }
#market-list, #admin-market-list { display: grid; gap: 10px; }

.market-row {
  display: grid;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.035);
  padding: 14px;
  color: inherit;
  text-align: left;
}
.market-row:hover, .market-row.active { border-color: rgba(39, 201, 113, .8); background: rgba(39, 201, 113, .08); }
.market-row strong { overflow-wrap: anywhere; }
.market-meta { display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 12px; font-weight: 850; }
.chance-pill { color: var(--green-2); }

.market-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}
.market-title h2 { font-size: clamp(32px, 5vw, 64px); line-height: .95; letter-spacing: -.04em; overflow-wrap: anywhere; }
.probability-big { color: var(--green-2); font-size: clamp(52px, 8vw, 112px); font-weight: 950; line-height: .85; }

.probability-bar {
  height: 18px;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  overflow: hidden;
  margin: 20px 0;
}
.probability-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--green-2)); transition: width .25s ease; }

.chart-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,255,255,.035);
  padding: 16px;
  margin: 18px 0;
}

.chart-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 10px;
}

.chart-head h3 {
  margin-bottom: 0;
}

.chart-legend {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
}

.yes-dot,
.no-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.yes-dot { background: var(--green-2); box-shadow: 0 0 18px rgba(124,255,178,.6); }
.no-dot { background: #ff8ea0; box-shadow: 0 0 18px rgba(255,78,106,.6); }

.probability-chart {
  display: block;
  width: 100%;
  min-height: 230px;
  overflow: visible;
}

.chart-wrap {
  position: relative;
}

.chart-tooltip {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, calc(-100% - 14px));
  border: 1px solid rgba(124, 255, 178, .4);
  border-radius: 999px;
  background: rgba(8, 13, 18, .94);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .34);
  color: var(--text);
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
}

.chart-tooltip.show {
  opacity: 1;
}

.chart-grid {
  stroke: rgba(157, 178, 196, .14);
  stroke-width: 1;
}

.chart-axis {
  stroke: rgba(157, 178, 196, .28);
  stroke-width: 1.5;
}

.chart-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.chart-date-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-anchor: middle;
}

.chart-line {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 10px rgba(255,255,255,.12));
}

.chart-line-yes { stroke: url(#yesGlow); }
.chart-line-no { stroke: url(#noGlow); opacity: .85; }
.chart-point { stroke: #091016; stroke-width: 3; }
.yes-point { fill: var(--green-2); }
.no-point { fill: #ff8ea0; }
.chart-hit-area {
  fill: transparent;
  cursor: crosshair;
}
.chart-hover-point:hover .chart-point {
  filter: drop-shadow(0 0 12px rgba(124, 255, 178, .72));
  r: 7px;
}

.trade-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.trade-box {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,255,255,.04);
  padding: 16px;
}
.yes-box { border-color: rgba(39, 201, 113, .42); }
.no-box { border-color: rgba(255, 78, 106, .42); }
.price { font-size: 34px; font-weight: 950; }
.yes-box .price { color: var(--green-2); }
.no-box .price { color: #ff8ea0; }

.payout-preview {
  margin: -2px 0 0;
  color: var(--green-2);
  font-size: 13px;
  font-weight: 900;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  color: var(--text);
  padding: 12px;
}
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 900; }
select option { color: #111; }

.positions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.profile-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.trade-history,
.search-results {
  display: grid;
  gap: 12px;
}

.search-panel {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,255,.035);
  padding: 14px;
  margin-bottom: 18px;
}

.search-market-card,
.trade-history-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,255,255,.035);
  padding: 16px;
}

.search-market-card h2,
.trade-history-card h2 {
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.search-stat {
  display: grid;
  min-width: 94px;
  justify-items: end;
}

.search-stat strong {
  color: var(--green-2);
  font-size: 30px;
  line-height: 1;
}

.search-stat span,
.trade-history-stats span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.trade-history-stats {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 8px 18px;
}

.trade-history-stats strong {
  display: block;
  color: var(--text);
  font-size: 20px;
}

.profit-good { color: var(--green-2) !important; }
.profit-bad { color: #ff8ea0 !important; }

.position-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255,255,255,.035);
}
.position-card strong { display: block; font-size: 30px; }

.auth-screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px) minmax(280px, 420px);
  gap: 16px;
  align-items: start;
}
.auth-copy, .auth-card { padding: 22px; }
.auth-copy h1 { font-size: clamp(42px, 6vw, 82px); }
.auth-card { display: grid; gap: 14px; }
.verify-screen { display: grid; place-items: center; min-height: 70vh; }
.verify-card { width: min(520px, 100%); }
.dev-code { color: var(--green-2); font-weight: 900; }
.resend-button {
  justify-self: start;
}

.empty-market {
  display: grid;
  min-height: 360px;
  align-content: center;
  justify-items: center;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 22px;
  background: rgba(255,255,255,.025);
  padding: 28px;
}

.empty-market h2 {
  font-size: clamp(34px, 6vw, 76px);
  line-height: .9;
  letter-spacing: -.05em;
  margin-bottom: 12px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 16px;
}
.admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 480px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}
.admin-card { display: grid; gap: 14px; padding: 18px; align-self: start; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#admin-market-list {
  max-height: min(72vh, 820px);
  overflow: auto;
  padding-right: 4px;
}

.user-control-card {
  margin-top: 18px;
}

.compact-head {
  align-items: center;
  margin-bottom: 0;
}

.admin-search {
  min-width: min(360px, 100%);
}

.user-admin-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.user-admin-list {
  display: grid;
  gap: 10px;
  max-height: 680px;
  overflow: auto;
  padding-right: 4px;
}

.admin-user-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.035);
  color: var(--text);
  padding: 13px;
  text-align: left;
}

.admin-user-row:hover,
.admin-user-row.active {
  border-color: rgba(39, 201, 113, .72);
  background: rgba(39, 201, 113, .08);
}

.admin-user-row strong,
.admin-user-row small {
  display: block;
  overflow-wrap: anywhere;
}

.admin-user-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-top: 4px;
}

.admin-user-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-user-tags em {
  border: 1px solid rgba(124,255,178,.28);
  border-radius: 999px;
  color: var(--green-2);
  font-style: normal;
  font-size: 11px;
  font-weight: 950;
  padding: 4px 7px;
  white-space: nowrap;
}

.admin-user-tags .danger-tag {
  border-color: rgba(255,78,106,.42);
  color: #ff8ea0;
}

.user-admin-detail {
  min-width: 0;
}

.admin-user-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.admin-user-head h2 {
  margin-bottom: 4px;
  font-size: clamp(30px, 5vw, 56px);
  line-height: .9;
  letter-spacing: -.04em;
  overflow-wrap: anywhere;
}

.tight-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tight-summary .position-card strong {
  font-size: clamp(18px, 2.2vw, 28px);
  overflow-wrap: anywhere;
}

.admin-user-actions {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}

.mini-admin-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.025);
  padding: 12px;
}

.mini-admin-form > button:only-child {
  grid-column: 1 / -1;
  justify-self: start;
}

.admin-trades-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.compact-trades {
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
}

.compact-trades .trade-history-card {
  grid-template-columns: 1fr;
  align-items: start;
}

.compact-trades .ghost {
  justify-self: start;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 30;
  transform: translateX(-50%);
  max-width: min(620px, calc(100% - 32px));
  border-radius: 999px;
  background: var(--green);
  color: #07120c;
  padding: 10px 16px;
  font-weight: 950;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.toast.show { opacity: 1; }
.toast.error { background: var(--red); color: white; }

@media (max-width: 980px) {
  .topbar, .hero, .market-layout, .auth-screen, .admin-grid { grid-template-columns: 1fr; }
  nav, .account { overflow-x: auto; }
  .market-title, .trade-grid, .positions, .profile-summary, .search-panel, .search-market-card, .trade-history-card, .user-admin-grid, .admin-user-head, .mini-admin-form, .admin-trades-grid { grid-template-columns: 1fr; }
  h1 { font-size: clamp(42px, 14vw, 72px); }
}
