/* Ashig · Prediction Markets — Kalshi-style layout, Apple liquid-glass look */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", sans-serif;
  --radius: 20px;
  --radius-sm: 12px;
  --blue: #0a84ff;
  --green: #30d158;
  --red: #ff453a;

  --bg: #f2f3f7;
  --text: #1c1c1e;
  --text-2: rgba(28, 28, 30, .55);
  --glass: rgba(255, 255, 255, .58);
  --glass-strong: rgba(255, 255, 255, .78);
  --stroke: rgba(255, 255, 255, .65);
  --stroke-2: rgba(0, 0, 0, .07);
  --bar-track: rgba(0, 0, 0, .07);
  --shadow: 0 10px 30px rgba(30, 40, 70, .10);
  --blob1: #a8c8ff; --blob2: #ffc7d8; --blob3: #c5f2d8;
  --chart: #d9480f; /* validated: L-band + ≥3:1 on light surface */
}

[data-theme="dark"] {
  --bg: #0b0d12;
  --text: #f2f2f7;
  --text-2: rgba(235, 235, 245, .55);
  --glass: rgba(255, 255, 255, .065);
  --glass-strong: rgba(30, 34, 45, .82);
  --stroke: rgba(255, 255, 255, .12);
  --stroke-2: rgba(255, 255, 255, .08);
  --bar-track: rgba(255, 255, 255, .09);
  --shadow: 0 10px 34px rgba(0, 0, 0, .45);
  --blob1: #14336e; --blob2: #4a1440; --blob3: #0c3d2c;
  --chart: #d97706; /* validated: L-band + ≥3:1 on dark surface */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

body {
  font-family: var(--font);
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------- backdrop blobs */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .8; }
.b1 { width: 520px; height: 520px; background: var(--blob1); top: -160px; left: -120px; }
.b2 { width: 460px; height: 460px; background: var(--blob2); top: 20%; right: -140px; }
.b3 { width: 520px; height: 520px; background: var(--blob3); bottom: -180px; left: 30%; }

/* ---------------------------------------------- glass primitives */
.glass {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(1.7);
  -webkit-backdrop-filter: blur(24px) saturate(1.7);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}

/* ---------------------------------------------- nav */
.nav { position: sticky; top: 0; z-index: 20; border-left: 0; border-right: 0; border-top: 0; border-radius: 0; }
.nav-inner {
  max-width: 1180px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-logo { height: 28px; width: auto; display: block; }

.nav-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.seg {
  display: flex; background: var(--bar-track); border-radius: 999px; padding: 3px;
}
.seg-btn {
  border: 0; background: none; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600;
  padding: 4px 12px; border-radius: 999px; cursor: pointer;
}
.seg-btn.active { background: var(--glass-strong); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.15); }

.icon-btn {
  border: 1px solid var(--stroke-2); background: var(--glass); color: var(--text);
  width: 34px; height: 34px; border-radius: 999px; cursor: pointer; font-size: 15px;
}

.balance-chip {
  font-size: 13px; font-weight: 700; padding: 6px 14px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(48, 209, 88, .18), rgba(10, 132, 255, .14));
  border: 1px solid var(--stroke-2); color: var(--text);
  font-variant-numeric: tabular-nums;
}
.who { font-size: 14px; font-weight: 600; }

/* ---------------------------------------------- buttons */
.btn {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 8px 16px; border-radius: 999px; border: 1px solid transparent;
  transition: transform .1s ease, filter .15s ease;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 4px 14px rgba(10, 132, 255, .35); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--glass); border-color: var(--stroke-2); color: var(--text); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------------------------------------- layout */
main { max-width: 1180px; margin: 0 auto; padding: 28px 20px 70px; }

.hero { text-align: center; margin: 18px 0 26px; }
.hero h1 { font-size: clamp(28px, 4.5vw, 42px); font-weight: 800; letter-spacing: -.03em; }
.hero p { color: var(--text-2); margin-top: 8px; font-size: 17px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 26px; }
.chip {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 8px 16px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--stroke-2); color: var(--text-2);
  backdrop-filter: blur(18px);
}
.chip.active { background: var(--text); color: var(--bg); border-color: transparent; }

.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr));
}

/* ---------------------------------------------- market card */
.card { border-radius: var(--radius); padding: 20px; }

.market-card { display: flex; flex-direction: column; gap: 14px; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.event-tag {
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  display: flex; align-items: center; gap: 6px;
}
.event-tag .emoji { font-size: 15px; }
.status {
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 999px;
}
.status.open { color: var(--green); background: rgba(48, 209, 88, .12); }
.status.closed { color: var(--red); background: rgba(255, 69, 58, .12); }
.status.resolved { color: var(--blue); background: rgba(10, 132, 255, .12); }

.question { font-size: 18px; font-weight: 700; letter-spacing: -.015em; line-height: 1.3; }

.outcomes { display: flex; flex-direction: column; }
.outcome {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--stroke-2);
}
.outcome-main { min-width: 0; }
.outcome-label { font-size: 15px; font-weight: 600; }
.outcome:has(> .btn) { grid-template-columns: 1fr auto auto auto; }
.outcome.winner .outcome-label { font-weight: 800; color: var(--green); }
.result.win { color: var(--green); font-weight: 800; }
.result.loss { color: var(--text-2); font-weight: 600; }
.bar { height: 4px; border-radius: 2px; background: var(--bar-track); margin-top: 7px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--blue), #6c47ff); }

.chance { text-align: right; font-variant-numeric: tabular-nums; }
.chance b { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.chance span { display: block; font-size: 11.5px; color: var(--text-2); font-weight: 600; }

.odds-btn {
  font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer;
  padding: 8px 13px; border-radius: var(--radius-sm);
  background: rgba(10, 132, 255, .12); color: var(--blue); border: 1px solid transparent;
  font-variant-numeric: tabular-nums; transition: all .15s ease;
}
.odds-btn:hover { background: rgba(10, 132, 255, .2); }
.odds-btn.selected { background: var(--blue); color: #fff; box-shadow: 0 4px 12px rgba(10,132,255,.35); }
.odds-pill-closed {
  font-size: 13.5px; font-weight: 700; color: var(--text-2);
  padding: 8px 13px; font-variant-numeric: tabular-nums;
}

.meta-row { font-size: 12.5px; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; }

/* stake panel */
.stake {
  border-radius: var(--radius-sm); padding: 14px;
  background: var(--bar-track); border: 1px solid var(--stroke-2);
  display: flex; flex-direction: column; gap: 10px;
}
.stake-row { display: flex; gap: 10px; align-items: center; }
.stake input {
  flex: 1; min-width: 0; font: inherit; font-size: 16px; font-weight: 600;
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--stroke-2); background: var(--glass-strong); color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stake input:focus { outline: 2px solid var(--blue); border-color: transparent; }
.quick { display: flex; gap: 6px; }
.quick button {
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--stroke-2);
  background: transparent; color: var(--text-2);
}
.quick button:hover { color: var(--text); }
.payout { font-size: 13.5px; color: var(--text-2); font-weight: 600; }
.payout b { color: var(--green); font-size: 15px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------- weather market */
.weather { display: flex; flex-direction: column; gap: 10px; }

.weather-hero { display: flex; align-items: center; gap: 14px; }
.weather-emoji { font-size: 42px; line-height: 1; filter: drop-shadow(0 2px 6px rgba(0,0,0,.18)); }
.weather-now b, .weather-high b {
  display: block; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.weather-now b { font-size: 28px; }
.weather-high b { font-size: 17px; }
.weather-now span, .weather-high span { font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.weather-high { margin-left: auto; text-align: right; }

.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .08em; color: var(--green);
  padding: 4px 10px; border-radius: 999px; background: rgba(48, 209, 88, .12);
}
.live-badge i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.chart-wrap .grid { stroke: var(--stroke-2); stroke-width: 1; }
.chart-wrap .tick { font-size: 11px; font-weight: 600; fill: var(--text-2); font-variant-numeric: tabular-nums; }
.chart-wrap .tline { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart-wrap .tline.forecast { stroke-dasharray: 4 5; opacity: .55; }
.chart-wrap .crosshair { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-wrap .nowdot { fill: var(--chart); stroke: var(--glass-strong); stroke-width: 2; }
.chart-wrap .nowlabel { font-size: 12px; font-weight: 700; fill: var(--text); font-variant-numeric: tabular-nums; }
.chart-wrap .hover-zone { cursor: crosshair; touch-action: none; }

.chart-tip {
  position: absolute; top: 4px; transform: translateX(-50%);
  border-radius: 999px; padding: 5px 12px;
  font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  pointer-events: none; white-space: nowrap;
}
.chart-legend { display: flex; gap: 14px; justify-content: flex-end; }
.chart-legend .tick { font-size: 11px; color: var(--text-2); font-weight: 600; }

/* ---------------------------------------------- my bets */
.section-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 36px 0 14px; }
.bets-card { padding: 6px 20px; }
.bet-row {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline;
  padding: 13px 0; border-bottom: 1px solid var(--stroke-2); font-size: 14.5px;
}
.bet-row:last-child { border-bottom: 0; }
.bet-row .on { color: var(--text-2); }
.bet-row .pick { font-weight: 700; }
.bet-row .amt { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty-note { color: var(--text-2); padding: 14px 0; }

/* ---------------------------------------------- board (admin activity feed) */
.board-badge {
  display: inline-block; padding: 2px 9px; margin-right: 6px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: .02em; white-space: nowrap;
  border: 1px solid var(--stroke-2); color: var(--text-2);
}
.board-badge.bet { color: #2f7d4f; border-color: #2f7d4f55; }
.board-badge.user { color: #2b6cb0; border-color: #2b6cb055; }
.board-badge.market { color: #b7791f; border-color: #b7791f55; }
.board-time { color: var(--text-2); font-weight: 600; font-size: 12.5px; }

/* ---------------------------------------------- dialog & toast */
.glass-modal {
  border: 1px solid var(--stroke); border-radius: 24px;
  background: var(--glass-strong);
  backdrop-filter: blur(30px) saturate(1.7);
  -webkit-backdrop-filter: blur(30px) saturate(1.7);
  color: var(--text);
  padding: 28px; width: min(400px, 92vw);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.glass-modal::backdrop { background: rgba(10, 12, 18, .45); backdrop-filter: blur(6px); }
.glass-modal h3 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 18px; text-align: center; }
.glass-modal label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.glass-modal input {
  display: block; width: 100%; margin-top: 6px; font: inherit; font-size: 16px;
  padding: 11px 13px; border-radius: 12px;
  border: 1px solid var(--stroke-2); background: var(--glass); color: var(--text);
}
.glass-modal input:focus { outline: 2px solid var(--blue); border-color: transparent; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.form-error { color: var(--red); font-size: 13.5px; font-weight: 600; margin-top: 2px; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 13.5px; color: var(--text-2); }
.auth-switch a { color: var(--blue); font-weight: 600; cursor: pointer; text-decoration: none; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  border-radius: 999px; padding: 11px 22px; font-size: 14.5px; font-weight: 600; z-index: 50;
}
.toast.error { color: var(--red); }

footer { text-align: center; padding: 0 20px 40px; color: var(--text-2); font-size: 13px; }

@media (max-width: 640px) {
  .nav-inner { padding: 10px 14px; }
  .hero { margin-top: 6px; }
  .card { padding: 16px; }
}
