:root {
  --bg: #070b14;
  --bg-soft: #0b1220;
  --panel: #111a2b;
  --panel-2: #172236;
  --line: #26344b;
  --text: #f8fafc;
  --muted: #94a3b8;
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, .14);
  --blue: #3b82f6;
  --green: #10b981;
  --red: #ef4444;
  --violet: #8b5cf6;
  --radius: 18px;
  --shadow: 0 18px 60px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -10%, rgba(59, 130, 246, .14), transparent 30rem),
    radial-gradient(circle at 88% 0%, rgba(245, 158, 11, .11), transparent 28rem),
    var(--bg);
  color: var(--text);
  font: 15px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.narrow { width: min(820px, calc(100% - 32px)); margin: 0 auto; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(148, 163, 184, .17);
  background: rgba(7, 11, 20, .86);
  backdrop-filter: blur(18px);
}
.topbar-inner {
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 900; letter-spacing: -.04em; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 11px;
  background: var(--amber);
  color: #111827;
  box-shadow: 0 0 28px rgba(245, 158, 11, .25);
}
.nav { display: flex; gap: 5px; margin-left: auto; overflow-x: auto; }
.nav a { padding: 8px 10px; border-radius: 9px; color: var(--muted); white-space: nowrap; font-size: 13px; }
.nav a:hover, .nav a.active { background: var(--panel-2); color: white; }
.page-kicker { color: var(--amber); text-transform: uppercase; letter-spacing: .16em; font-weight: 800; font-size: 11px; }

.hero { padding: 78px 0 50px; }
.hero-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 50px; align-items: center; }
.hero h1 { margin: 12px 0 18px; max-width: 820px; font-size: clamp(42px, 7vw, 82px); line-height: .98; letter-spacing: -.065em; }
.hero p { max-width: 720px; color: #cbd5e1; font-size: 19px; }
.hero-card {
  position: relative;
  min-height: 390px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(145deg, #18243a, #0c1321);
  box-shadow: var(--shadow);
}
.hero-orbit { position: absolute; border: 1px solid rgba(245, 158, 11, .3); border-radius: 50%; }
.hero-orbit.one { inset: 45px; }
.hero-orbit.two { inset: 90px; border-color: rgba(59,130,246,.32); }
.hero-core {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}
.hero-core strong { display: block; color: var(--amber); font-size: 76px; line-height: 1; letter-spacing: -.08em; }
.hero-core span { margin-top: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .2em; font-size: 11px; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-2);
  color: white;
  font-weight: 750;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn.primary { border-color: var(--amber); background: var(--amber); color: #151922; }
.btn.blue { border-color: #2563eb; background: #2563eb; }
.btn.green { border-color: #059669; background: #059669; }
.btn.red { border-color: #dc2626; background: #dc2626; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 34px; padding: 7px 11px; font-size: 12px; }
.btn.large { min-height: 56px; padding: 14px 22px; border-radius: 14px; font-size: 17px; }

.section { padding: 34px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section h2 { margin: 0; font-size: clamp(26px, 4vw, 42px); line-height: 1.1; letter-spacing: -.04em; }
.section-lead { max-width: 710px; margin: 10px 0 0; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 26, 43, .88);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .13);
}
.card.pad { padding: 20px; }
.card h3 { margin: 0 0 8px; font-size: 17px; }
.card p { margin: 0; color: var(--muted); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.card-body { padding: 20px; }
.feature-number { color: var(--amber); font: 800 12px/1 monospace; }
.icon-tile { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 16px; border-radius: 12px; background: var(--amber-soft); color: var(--amber); font-size: 21px; }

.badge, .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .03em;
}
.badge.amber { border-color: rgba(245,158,11,.45); background: var(--amber-soft); color: #fbbf24; }
.badge.green { border-color: rgba(16,185,129,.4); background: rgba(16,185,129,.12); color: #34d399; }
.badge.red { border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.12); color: #f87171; }
.badge.blue { border-color: rgba(59,130,246,.4); background: rgba(59,130,246,.12); color: #60a5fa; }
.badge.violet { border-color: rgba(139,92,246,.4); background: rgba(139,92,246,.12); color: #a78bfa; }

.stat { padding: 18px; }
.stat strong { display: block; font-size: 30px; letter-spacing: -.04em; }
.stat span { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
.amber { color: var(--amber); }
.green { color: #34d399; }
.red { color: #f87171; }
.blue { color: #60a5fa; }
.small { font-size: 12px; }
.eyebrow { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: 10px; font-weight: 800; }
.divider { height: 1px; margin: 18px 0; background: var(--line); }

.page-title { padding: 36px 0 22px; }
.page-title h1 { margin: 7px 0 5px; font-size: clamp(32px, 5vw, 54px); line-height: 1.05; letter-spacing: -.05em; }
.page-title p { margin: 0; color: var(--muted); }
.screenbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.screenbar .spacer { flex: 1; }

.tabs { display: flex; gap: 5px; overflow-x: auto; }
.tab { padding: 8px 11px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); white-space: nowrap; }
.tab.active { background: var(--panel-2); color: white; }
.input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: #0b1321;
  color: white;
}
.input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(245, 158, 11, .12); }
.label { display: block; margin: 0 0 6px; color: var(--muted); font-size: 12px; }
.field + .field { margin-top: 14px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { color: var(--muted); font-size: 10px; text-align: left; text-transform: uppercase; letter-spacing: .09em; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:hover { background: rgba(148, 163, 184, .045); }
.rank { color: var(--muted); font-weight: 800; }
.score-cell { width: 34px; height: 30px; padding: 0; text-align: center; border-radius: 7px; background: #1f2b40; font-weight: 800; }
.score-cell.ok { background: rgba(16,185,129,.18); color: #6ee7b7; }
.score-cell.no { color: #64748b; }

.tournament-row { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; padding: 18px 20px; border-top: 1px solid var(--line); }
.tournament-row:first-child { border-top: 0; }
.tournament-title { font-weight: 800; font-size: 17px; }
.meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 7px; color: var(--muted); font-size: 12px; }
.row-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px; }

.roster-item { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #0c1422; }
.avatar { display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(145deg, #334155, #1e293b); color: #e2e8f0; font-weight: 900; }
.roster-item .name { font-weight: 750; }
.roster-item .role { margin-left: auto; }

.game-shell { width: min(980px, 100%); min-height: 100vh; margin: 0 auto; background: #0b111d; box-shadow: 0 0 80px rgba(0,0,0,.5); }
.game-head { position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; padding: 13px 20px; border-bottom: 1px solid var(--line); background: rgba(11,17,29,.94); backdrop-filter: blur(14px); }
.timer { color: var(--amber); font-size: 38px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.05em; }
.progress { height: 4px; background: #233047; }
.progress > span { display: block; width: 62%; height: 100%; background: linear-gradient(90deg, var(--amber), #fbbf24); }
.question { padding: 42px clamp(20px, 6vw, 72px) 24px; }
.question-number { color: var(--amber); text-transform: uppercase; letter-spacing: .15em; font-size: 11px; font-weight: 900; }
.question-text { margin: 16px 0 25px; font-size: clamp(20px, 3vw, 29px); line-height: 1.5; letter-spacing: -.015em; }
.answer-box { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.bottom-tabs { display: flex; gap: 3px; padding: 14px 18px; border-top: 1px solid var(--line); overflow-x: auto; }
.bottom-tabs a { padding: 9px 11px; border-radius: 9px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.bottom-tabs a.active { background: var(--amber-soft); color: var(--amber); }

.host-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.host-controls .btn { min-height: 58px; }
.answer-reveal { padding: 14px; border-radius: 12px; background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.25); }
.notice { padding: 13px 15px; border: 1px solid rgba(245,158,11,.4); border-radius: 12px; background: var(--amber-soft); color: #fde68a; }

.light {
  --bg: #f8fafc;
  --bg-soft: #f1f5f9;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --line: #dbe3ee;
  --text: #0f172a;
  --muted: #64748b;
  background: #f8fafc;
  color: var(--text);
}
.light .topbar { background: rgba(255,255,255,.9); }
.light .nav a:hover, .light .nav a.active { color: #0f172a; }
.light .card { background: white; box-shadow: 0 8px 28px rgba(15,23,42,.06); }
.light .input { background: white; color: #0f172a; }
.light .roster-item { background: #f8fafc; }
.waveform { display: flex; align-items: center; gap: 3px; height: 54px; padding: 0 12px; border-radius: 10px; background: #e2e8f0; overflow: hidden; }
.waveform i { display: block; width: 3px; border-radius: 2px; background: #f59e0b; }

.kpi-up { color: #34d399; font-size: 11px; }
.bar-row { display: grid; grid-template-columns: 145px 1fr 55px; align-items: center; gap: 10px; margin: 12px 0; }
.bar { height: 9px; border-radius: 99px; background: #243249; overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.architecture { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: stretch; }
.architecture .node { position: relative; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.architecture .node:not(:last-child)::after { content: "→"; position: absolute; right: -13px; top: 50%; z-index: 2; color: var(--amber); font-weight: 900; }
.node strong { display: block; margin-bottom: 6px; }
.node span { color: var(--muted); font-size: 12px; }

.portfolio-footer { margin-top: 52px; padding: 26px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.demo-note { position: fixed; right: 14px; bottom: 14px; z-index: 80; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: rgba(7,11,20,.84); color: var(--muted); backdrop-filter: blur(12px); font-size: 10px; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-card { min-height: 300px; }
  .grid.four, .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .architecture { grid-template-columns: repeat(2, 1fr); }
  .architecture .node::after { display: none; }
}

@media (max-width: 680px) {
  .shell, .narrow { width: min(100% - 22px, 1180px); }
  .topbar-inner { min-height: 58px; }
  .nav { max-width: 68vw; }
  .hero { padding-top: 45px; }
  .hero h1 { font-size: 44px; }
  .hero p { font-size: 16px; }
  .grid.two, .grid.three, .grid.four, .architecture { grid-template-columns: 1fr; }
  .section-head { align-items: start; flex-direction: column; }
  .tournament-row { grid-template-columns: 1fr; }
  .row-actions { justify-content: start; }
  .game-head { grid-template-columns: 1fr auto; }
  .game-head > :last-child { display: none; }
  .host-controls { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 100px 1fr 40px; }
}
