/* RISK RADAR — light, modern, readable mobile design system.
   Theming via CSS custom properties → a dark theme later is just an override.
   No webfonts (fast on old Android): system UI stack only. */

:root {
  /* surfaces */
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --border: #e2e8f2;
  /* text */
  --ink: #0f1b2d;
  --ink-2: #43536b;
  --ink-3: #7c8aa0;
  /* brand */
  --brand: #3b5bfd;
  --brand-ink: #ffffff;
  /* dream (energetic) / reality (calm) */
  --dream: #7a3cff;
  --dream-2: #ff5db1;
  --reality: #1f8fff;
  /* risk scale */
  --risk-low: #16b364;
  --risk-medium: #eab308;
  --risk-high: #f97316;
  --risk-very_high: #ef4444;
  --risk-crazy: #7c3aed;
  /* geometry */
  --r-lg: 20px; --r-md: 14px; --r-sm: 10px;
  --pad: 16px;
  --shadow: 0 6px 20px rgba(20, 40, 80, .07);
  --shadow-sm: 0 2px 8px rgba(20, 40, 80, .06);
  --maxw: 480px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* --- app shell --- */
.app-shell { max-width: var(--maxw); margin: 0 auto; min-height: 100vh; position: relative; }
.screen {
  padding: var(--pad);
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px);
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* header */
.app-header {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 14px var(--pad); background: rgba(245,247,251,.92);
  backdrop-filter: saturate(1.2) blur(8px);
}
.app-header h1 { font-size: 1.05rem; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.app-header .back { font-size: 1.4rem; color: var(--ink-2); background: none; border: 0; padding: 0 4px; cursor: pointer; }
.app-header .spacer { flex: 1; }

/* bottom nav */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  max-width: var(--maxw); margin: 0 auto;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
}
.tabbar button {
  background: none; border: 0; color: var(--ink-3); font-size: .68rem; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer;
}
.tabbar button .ic { font-size: 1.25rem; line-height: 1; }
.tabbar button.active { color: var(--brand); }

/* --- typography --- */
h2.title { font-size: 1.4rem; margin: 4px 0 2px; letter-spacing: -.02em; }
.subtitle { color: var(--ink-2); margin: 0 0 18px; }
.muted { color: var(--ink-3); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 700; color: var(--ink-3); }

/* --- card --- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--pad); box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.card.tap { cursor: pointer; transition: transform .1s; }
.card.tap:active { transform: scale(.99); }
.card h3 { margin: 0 0 6px; font-size: 1.02rem; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack > * + * { margin-top: 10px; }

/* big number (dream payout) */
.bignum {
  font-size: 2.4rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.05;
  background: linear-gradient(100deg, var(--dream), var(--dream-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* score chip + bar */
.score-line { display: flex; align-items: baseline; gap: 8px; }
.score-line .val { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; }
.score-line .max { color: var(--ink-3); font-weight: 600; }
.bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; border-radius: 999px; transition: width .5s ease; }
.bar.dream > i { background: linear-gradient(90deg, var(--dream), var(--dream-2)); }
.bar.reality > i { background: linear-gradient(90deg, #1f8fff, #46c6ff); }

/* risk pill */
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: .82rem; }
.pill .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.risk-low { color: var(--risk-low); background: #e7f8ef; }
.risk-medium { color: #a8790a; background: #fdf6e3; }
.risk-high { color: #c2560f; background: #fef0e6; }
.risk-very_high { color: var(--risk-very_high); background: #fdeaea; }
.risk-crazy { color: var(--risk-crazy); background: #f1e9fe; }

/* --- buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px 18px; border-radius: var(--r-md); border: 0;
  font-size: 1rem; font-weight: 700; cursor: pointer; transition: transform .08s, filter .15s;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 8px 18px rgba(59,91,253,.28); }
.btn-primary:active { filter: brightness(.96); }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.btn-soft { background: var(--surface-2); color: var(--ink); }
.btn-sm { width: auto; padding: 9px 14px; font-size: .86rem; border-radius: var(--r-sm); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn:disabled { opacity: .5; }

/* --- inputs --- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; color: var(--ink-2); }
.input {
  width: 100%; padding: 14px 15px; font-size: 1.05rem; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,91,253,.12); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-weight: 600; font-size: .9rem; cursor: pointer;
}
.chip.sel { border-color: var(--brand); background: #eef2ff; color: var(--brand); }

/* selectable option card */
.opt {
  display: block; width: 100%; text-align: left; padding: 16px; margin-bottom: 10px;
  border-radius: var(--r-md); border: 1.5px solid var(--border); background: var(--surface); cursor: pointer;
}
.opt.sel { border-color: var(--brand); background: #f3f6ff; }
.opt .t { font-weight: 700; }
.opt .d { color: var(--ink-2); font-size: .9rem; margin-top: 2px; }

/* leg list */
.leg { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.leg:last-child { border-bottom: 0; }
.leg .mk { font-weight: 700; }
.leg .od { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; }
.leg.weak { background: #fef0e6; border-radius: var(--r-sm); padding: 12px; }

/* misc */
.center { text-align: center; }
.hero { padding: 26px 0 8px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.list-tap { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--surface-2); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 999px; font-size: .88rem; font-weight: 600;
  z-index: 50; box-shadow: var(--shadow); max-width: 90%; text-align: center;
}
.badge-note { font-size: .8rem; color: var(--ink-3); }
.warn { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: var(--r-md); padding: 14px; }

/* odds board */
.odds-market { margin-bottom: 14px; }
.odds-market:last-child { margin-bottom: 0; }
.odds-market .mname { font-weight: 700; font-size: .86rem; margin-bottom: 8px; color: var(--ink-2); }
.odds-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.odds-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; text-align: left; transition: transform .08s, border-color .12s; }
.odds-btn:active { transform: scale(.97); }
.odds-btn.picked { border-color: var(--brand); background: #eef2ff; }
.odds-btn .ol { font-size: .78rem; color: var(--ink-2); line-height: 1.15; }
.odds-btn .oo { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 1.02rem; }
.live-badge { display: inline-block; font-size: .64rem; font-weight: 800; letter-spacing: .06em; color: #fff; background: var(--risk-very_high); padding: 2px 6px; border-radius: 5px; margin-left: 6px; vertical-align: middle; }
.disclaimer { font-size: .78rem; color: var(--ink-3); text-align: center; margin-top: 18px; }
