﻿@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Sora:wght@400;500;600;700;800&family=Syne:wght@500;700;800&display=swap');

:root {
  --bg: #f3efe7;
  --bg-deep: #e7ddcf;
  --surface: rgba(250, 248, 242, 0.96);
  --surface-strong: #fffdf8;
  --surface-soft: #efe9de;
  --surface-accent: rgba(206, 255, 0, 0.14);
  --border: rgba(22, 21, 18, 0.1);
  --border-strong: rgba(22, 21, 18, 0.22);
  --text: #12110f;
  --text-dim: #36322c;
  --text-muted: #6c665d;
  --primary: #12110f;
  --primary-2: #ceff00;
  --primary-glow: rgba(206, 255, 0, 0.2);
  --accent: #7f7a70;
  --accent-2: #12110f;
  --grad: linear-gradient(135deg, #12110f 0%, #35312b 100%);
  --grad-warm: linear-gradient(135deg, #ceff00 0%, #8bb300 100%);
  --ok: #4c6b00;
  --ok-bg: rgba(22, 163, 74, 0.12);
  --ko: #c24b32;
  --ko-bg: rgba(194, 75, 50, 0.12);
  --warn: #a56c00;
  --gold: #8e7b00;
  --gold-bg: rgba(142, 123, 0, 0.12);
  --shadow-lg: 0 0 0 rgba(0, 0, 0, 0);
  --shadow-md: 0 0 0 rgba(0, 0, 0, 0);
  --shadow-sm: 0 0 0 rgba(0, 0, 0, 0);
  --r-xs: 6px;
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 24px;
  --r-xl: 999px;
}

:root[data-theme='dark'] {
  --bg: #12110f;
  --bg-deep: #1b1916;
  --surface: rgba(22, 21, 18, 0.96);
  --surface-strong: #1f1d19;
  --surface-soft: #191714;
  --surface-accent: rgba(206, 255, 0, 0.12);
  --border: rgba(242, 237, 226, 0.12);
  --border-strong: rgba(242, 237, 226, 0.22);
  --text: #f2ede2;
  --text-dim: #d5ccbe;
  --text-muted: #9f978b;
  --primary: #f2ede2;
  --primary-2: #ceff00;
  --primary-glow: rgba(206, 255, 0, 0.18);
  --accent: #8f887b;
  --accent-2: #ceff00;
  --grad: linear-gradient(135deg, #f2ede2 0%, #b7ae9f 100%);
  --grad-warm: linear-gradient(135deg, #ceff00 0%, #8bb300 100%);
  --ok: #ceff00;
  --ok-bg: rgba(206, 255, 0, 0.11);
  --ko: #ff8c69;
  --ko-bg: rgba(255, 140, 105, 0.12);
  --warn: #d8b353;
  --gold: #ceff00;
  --gold-bg: rgba(206, 255, 0, 0.11);
  --shadow-lg: 0 0 0 rgba(0, 0, 0, 0);
  --shadow-md: 0 0 0 rgba(0, 0, 0, 0);
  --shadow-sm: 0 0 0 rgba(0, 0, 0, 0);
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Sora', system-ui, sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg) 14rem, var(--bg) 100%),
    repeating-linear-gradient(90deg, rgba(18, 17, 15, 0.03) 0 1px, transparent 1px 96px),
    repeating-linear-gradient(180deg, rgba(18, 17, 15, 0.02) 0 1px, transparent 1px 96px);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before,
body::after {
  content: none;
}

body::before {
  width: 22rem;
  height: 22rem;
  top: 7rem;
  right: -8rem;
  background: rgba(37, 99, 235, 0.15);
}

body::after {
  width: 18rem;
  height: 18rem;
  bottom: 4rem;
  left: -5rem;
  background: rgba(249, 115, 22, 0.12);
}

header,
#app,
footer {
  position: relative;
  z-index: 1;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.4rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.note {
  border: 1px solid rgba(37, 99, 235, 0.18);
  background: rgba(37, 99, 235, 0.07);
  color: var(--text-dim);
  border-radius: var(--r-sm);
  padding: 0.95rem 1rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 1.25rem 0.25rem;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  border-bottom: 1px solid var(--border);
}

.topbar-shell {
  width: min(1280px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.9rem 1.5rem;
  align-items: center;
  padding: 1rem 0 0.8rem;
  border: 1px solid var(--border);
  border-width: 0;
  border-radius: 0;
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  backdrop-filter: none;
  box-shadow: none;
}

.brand-block,
.topbar-meta,
.status-cluster {
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.logo {
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 0.9rem;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: var(--primary-2);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.15rem;
  font-weight: 800;
  box-shadow: none;
  flex-shrink: 0;
}

.brand h1,
.hero h2,
.quiz-header h2,
.handoff h2,
.waiting-card h2,
.online-header h2,
.final-slot h3,
.panel h3,
.history-block h3,
#online-result-title {
  font-family: 'Syne', sans-serif;
  letter-spacing: -0.03em;
}

.brand h1 {
  font-size: clamp(1.95rem, 2.7vw, 2.45rem);
  line-height: 0.92;
}

.tagline {
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.84rem;
  max-width: 40ch;
}

.topbar-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  flex-wrap: wrap;
}

.tab-btn {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-dim);
  padding: 0.5rem 0.9rem 0.7rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.18s ease;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  background: transparent;
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--primary-2);
}

.status-cluster,
.global-auth {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  min-height: 2.4rem;
  padding: 0.24rem 0.8rem 0.24rem 0.28rem;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
}

.theme-toggle-knob {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  background: var(--primary-2);
  box-shadow: none;
  position: relative;
}

.theme-toggle-knob::after {
  content: '';
  position: absolute;
  inset: 0.34rem;
  border-radius: 999px;
  background: var(--surface-strong);
}

:root[data-theme='dark'] .theme-toggle-knob::after {
  inset: 0.22rem 0.22rem 0.22rem 0.68rem;
  background: var(--surface-strong);
}

.theme-toggle-label {
  font-size: 0.76rem;
  font-weight: 600;
}

.btn,
.user-chip,
select,
input[type='text'] {
  border-radius: var(--r-sm);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border-strong);
  background: var(--surface-strong);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 700;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.btn:hover {
  border-color: var(--text);
}

.btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-2);
}

:root[data-theme='dark'] .btn.primary {
  border-color: var(--primary-2);
  background: var(--primary-2);
  color: #12110f;
}

.btn.ghost {
  background: transparent;
}

.btn.subtle {
  background: transparent;
  color: var(--text-muted);
}

.btn.subtle:hover {
  color: var(--ko);
  box-shadow: none;
}

.btn.full {
  width: 100%;
}

.user-chip {
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.user-chip:hover {
  border-color: var(--text);
}

.online-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.62rem 0.9rem;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid var(--border);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.online-indicator .dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--text-muted);
}

.online-indicator.online {
  color: var(--ok);
}

.online-indicator.online .dot {
  background: var(--ok);
  box-shadow: 0 0 12px rgba(22, 163, 74, 0.5);
}

.online-indicator.offline {
  color: var(--ko);
}

.online-indicator.offline .dot {
  background: var(--ko);
  box-shadow: 0 0 12px rgba(220, 38, 38, 0.45);
}

#app {
  flex: 1;
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 1.75rem 1.25rem 4rem;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: fade-up 0.28s ease both;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.hero,
.config-row,
.history-block,
#sim-history-detail,
.question-card,
.score-big,
.panel,
.duel-form,
.handoff,
.final-slot,
.profile-card,
.waiting-card,
.auth-panel,
.ranking-table,
.online-header,
.history-item,
.topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: none;
  backdrop-filter: none;
}

.hero {
  position: relative;
  overflow: clip;
  display: grid;
  gap: 1.2rem;
  margin-bottom: 1.5rem;
  border-radius: var(--r-lg);
  padding: clamp(1.2rem, 2vw, 1.7rem);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 1.15rem auto 1.15rem 1.15rem;
  width: 2px;
  height: auto;
  border-radius: 0;
  background: var(--primary-2);
  filter: none;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.92;
  max-width: 10ch;
}

.hero p {
  max-width: 56ch;
  color: var(--text-dim);
  font-size: 0.98rem;
}

.hero-home {
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.95fr);
  align-items: stretch;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-left: 1.25rem;
}

.hero-stage {
  display: grid;
  gap: 0.8rem;
  align-content: start;
}

.hero-stage-card {
  padding: 1rem 1.05rem;
  border-radius: var(--r);
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.stage-label {
  display: inline-flex;
  margin-bottom: 0.6rem;
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hero-stage-card strong {
  display: block;
  font-size: 1.18rem;
  line-height: 1.12;
  margin-bottom: 0.55rem;
}

.hero-stage-card p {
  color: var(--text-dim);
  font-size: 0.88rem;
}

.hero-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--border);
}

.hero-metric {
  padding: 0.8rem 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.hero-metric span,
.config-row label,
.duel-form label,
.online-login-form label,
.lobby-grid .panel label.stack,
.profile-kpi span,
.round-info span {
  display: block;
  margin-bottom: 0.35rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hero-metric strong {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.96rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.topic-card {
  position: relative;
  overflow: hidden;
  text-align: left;
  color: var(--text);
  border-radius: var(--r);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.topic-card::before {
  content: none;
}

.topic-card:hover {
  border-color: var(--primary);
  background: var(--surface-strong);
}

.topic-card > * {
  position: relative;
  z-index: 1;
}

.topic-icon {
  font-size: 1.6rem;
}

.topic-name {
  font-weight: 800;
  font-size: 1rem;
}

.topic-meta,
.topic-state,
.topic-accuracy,
.chart-title,
.history-empty,
#ranking-source {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.topic-accuracy {
  color: var(--accent-2);
  font-weight: 700;
}

.topic-meter,
.progress-bar,
.timer-bar,
.chart-row .c-track,
.history-strip .bar {
  overflow: hidden;
  background: rgba(148, 163, 184, 0.22);
}

.topic-meter,
.progress-bar,
.timer-bar,
.chart-row .c-track {
  height: 0.65rem;
  border-radius: var(--r-xl);
}

.topic-meter > span,
.progress-bar > div,
.chart-row .c-fill,
.history-strip .bar .fill {
  display: block;
  height: 100%;
  background: var(--primary-2);
}

.topic-state {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

:root[data-theme='dark'] .topic-card,
:root[data-theme='dark'] .topic-card .topic-name,
:root[data-theme='dark'] .topic-card .topic-meta,
:root[data-theme='dark'] .topic-card .topic-state,
:root[data-theme='dark'] .topic-card .topic-accuracy {
  color: #ffffff !important;
}

:root[data-theme='dark'] .topic-card .topic-meta,
:root[data-theme='dark'] .topic-card .topic-state {
  color: #e6e1d8 !important;
}

.config-row,
.history-block,
#sim-history-detail,
.duel-form,
.profile-card,
.auth-panel {
  border-radius: var(--r-lg);
  padding: 1.25rem;
}

.config-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 1rem;
  align-items: end;
  margin-bottom: 0.65rem;
}

.question-count-control {
  display: grid;
  gap: 0.6rem;
}

.config-row label select,
select,
input[type='text'] {
  width: 100%;
}

select,
input[type='text'] {
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 0.92rem 1rem;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

select:focus,
input[type='text']:focus {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

input[type='number'] {
  width: 100%;
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 0.92rem 1rem;
  outline: none;
  border-radius: var(--r-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input[type='number']:focus {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

#sim-mode-note {
  margin: 0 0 1.25rem;
}

.history-block h3,
.panel h3,
.ranking-table th,
.ranking-subtitle,
.quiz-header h2,
.online-header h2,
.profile-head h3,
.auth-panel h2 {
  font-size: 1.05rem;
}

.ranking-section {
  margin-bottom: 0.7rem;
}

.ranking-section-gap {
  margin-top: 2rem;
}

.ranking-subtitle {
  margin-bottom: 0.35rem;
}

.history-summary,
.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
}

.history-item {
  display: grid;
  gap: 0.45rem;
}

.history-item .history-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.history-area-preview {
  list-style: none;
  display: grid;
  gap: 0.3rem;
  margin-top: 0.15rem;
}

.history-area-preview li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.history-area-preview li span {
  color: var(--text-dim);
}

.history-area-preview li strong {
  color: var(--text);
}


.chart-title {
  margin-bottom: 0.8rem;
  font-weight: 700;
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(110px, 180px) 1fr 3rem;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 0.65rem;
}

.chart-row .c-label,
.chart-row .c-val {
  font-size: 0.82rem;
}

.chart-row .c-label {
  color: var(--text-dim);
}

.chart-row .c-val {
  text-align: right;
  font-weight: 700;
}

.history-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(36px, 1fr));
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.history-strip .bar {
  position: relative;
  height: 4rem;
  border-radius: var(--r-sm);
}

.history-strip .bar::after {
  content: attr(data-pct);
  position: absolute;
  inset: 0.35rem auto auto 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-dim);
}

.detail-kpi {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.detail-kpi .badge,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.52rem 0.8rem;
  border-radius: var(--r-xl);
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.18);
  font-size: 0.78rem;
  font-weight: 700;
}

.progress-bar,
.timer-bar {
  margin-bottom: 1rem;
}

.timer-bar > div {
  height: 100%;
  width: 100%;
  background: var(--ok);
  transition: width 0.25s linear, background 0.4s ease;
}

.timer-bar > div.t-warn {
  background: var(--warn);
}

.timer-bar > div.t-urgent {
  background: var(--ko);
}

.quiz-header,
.quiz-footer,
.online-header,
.results-actions,
.profile-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.question-card {
  border-radius: var(--r-lg);
  padding: clamp(1.2rem, 2vw, 1.75rem);
  margin-bottom: 1rem;
}

.question-text {
  font-size: clamp(1.05rem, 2vw, 1.22rem);
  font-weight: 700;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.option-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 0.75rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-soft);
  color: var(--text);
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.option-btn:hover:not(:disabled) {
  transform: translateX(3px);
  border-color: rgba(37, 99, 235, 0.28);
}

.opt-letter {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
}

.option-btn.selected {
  border-color: rgba(37, 99, 235, 0.34);
  background: rgba(37, 99, 235, 0.08);
}

.option-btn.correct {
  border-color: rgba(22, 163, 74, 0.3);
  background: var(--ok-bg);
  color: var(--text);
}

.option-btn.correct .opt-letter {
  background: var(--ok);
  color: #fff;
}

.option-btn.wrong {
  border-color: rgba(220, 38, 38, 0.3);
  background: var(--ko-bg);
  color: var(--text);
}

.option-btn.wrong .opt-letter {
  background: var(--ko);
  color: #fff;
}

.explanation {
  margin-top: 1rem;
  padding: 1rem 1.05rem;
  border-radius: var(--r);
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.16);
  color: var(--text-dim);
}

.score-big {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  border-radius: var(--r-lg);
  padding: 1.4rem;
  margin-bottom: 1.25rem;
}

.score-circle {
  position: relative;
  width: 8.6rem;
  height: 8.6rem;
  flex-shrink: 0;
}

.score-circle svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-track {
  fill: none;
  stroke: rgba(148, 163, 184, 0.28);
  stroke-width: 9;
}

.score-fill {
  fill: none;
  stroke: url(#sg);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 283;
  transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-inner span {
  font-family: 'Syne', sans-serif;
  font-size: 1.6rem;
}

.two-col,
.lobby-grid,
.online-login-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.panel {
  border-radius: var(--r);
  padding: 1.15rem;
}

.panel.good {
  border-color: rgba(22, 163, 74, 0.22);
}

.panel.bad {
  border-color: rgba(220, 38, 38, 0.22);
}

.panel ul {
  list-style: none;
}

.panel li {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.panel li:last-child {
  border-bottom: 0;
}

#view-simulacros #history-detail-areas .panel,
#view-simulacros #sim-results .panel {
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

#view-simulacros .panel li span {
  color: var(--text-dim);
  font-weight: 600;
}

:root[data-theme='dark'] #view-simulacros .panel li span,
:root[data-theme='dark'] #view-simulacros .chart-row .c-label {
  color: var(--text);
}

:root[data-theme='dark'] #view-simulacros #sim-results .panel h3,
:root[data-theme='dark'] #view-simulacros #history-detail-areas .panel h3,
:root[data-theme='dark'] #view-simulacros #sim-results .panel li span,
:root[data-theme='dark'] #view-simulacros #sim-results .panel li strong,
:root[data-theme='dark'] #view-simulacros #history-detail-areas .panel li span,
:root[data-theme='dark'] #view-simulacros #history-detail-areas .panel li strong,
:root[data-theme='dark'] #view-simulacros #sim-results .chart-title,
:root[data-theme='dark'] #view-simulacros #sim-results .chart-row .c-label,
:root[data-theme='dark'] #view-simulacros #sim-results .chart-row .c-val,
:root[data-theme='dark'] #view-simulacros #global-areas-chart .chart-row .c-label,
:root[data-theme='dark'] #view-simulacros #global-areas-chart .chart-row .c-val,
:root[data-theme='dark'] #view-simulacros #sim-areas-chart .chart-row .c-label,
:root[data-theme='dark'] #view-simulacros #sim-areas-chart .chart-row .c-val,
:root[data-theme='dark'] #view-simulacros #strong-area-list li span,
:root[data-theme='dark'] #view-simulacros #weak-area-list li span,
:root[data-theme='dark'] #view-simulacros #strong-area-global-list li span,
:root[data-theme='dark'] #view-simulacros #weak-area-global-list li span,
:root[data-theme='dark'] #view-simulacros #general-area-summary {
  color: var(--text) !important;
}

:root[data-theme='dark'] #view-simulacros .panel li span,
:root[data-theme='dark'] #view-simulacros .panel li strong,
:root[data-theme='dark'] #view-simulacros .chart-row .c-label,
:root[data-theme='dark'] #view-simulacros .chart-row .c-val,
:root[data-theme='dark'] #view-simulacros .chart-title,
:root[data-theme='dark'] #view-simulacros .history-empty {
  color: #ffffff !important;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.review {
  margin-top: 1.25rem;
}

.review summary {
  list-style: none;
  cursor: pointer;
  padding: 0.95rem 1rem;
  border-radius: var(--r);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-weight: 700;
}

.review-item {
  margin-top: 0.75rem;
  padding: 1rem;
  border-radius: var(--r);
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.review-item.ok {
  border-left: 4px solid var(--ok);
}

.review-item.ko {
  border-left: 4px solid var(--ko);
}

.review-item .q {
  margin-bottom: 0.35rem;
  font-weight: 700;
}

.duel-form {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: end;
}

.duel-form .full {
  grid-column: 1 / -1;
}

.vs-badge,
.trophy {
  display: grid;
  place-items: center;
}

.vs-badge {
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  background: var(--grad-warm);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 16px 30px rgba(249, 115, 22, 0.22);
}

.scoreboard,
.duel-final {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: center;
}

.player-slot,
.final-slot {
  border-radius: var(--r);
  padding: 1rem 1.1rem;
}

.player-slot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
}

.player-slot.active {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.player-slot .p-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-slot .p-score,
.final-slot .final-score,
.profile-kpi strong {
  font-family: 'Syne', sans-serif;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1;
}

.handoff,
.waiting-card {
  border-radius: var(--r-lg);
  text-align: center;
  padding: 2rem 1.5rem;
}

.duel-final {
  margin: 1.4rem 0;
}

.final-slot {
  text-align: center;
}

.final-slot.winner {
  border-color: rgba(202, 138, 4, 0.32);
  background: var(--gold-bg);
}

.final-slot.loser {
  opacity: 0.68;
}

.final-slot .final-elo,
#elo-change,
#online-elo-change {
  color: var(--text-muted);
}

.trophy {
  font-size: 2.4rem;
}

.online-step,
.online-login-form,
.lobby-grid .panel {
  border-radius: var(--r);
}

.online-step,
.online-login-form {
  padding: 1.25rem;
}

.google-btn {
  background: #fff;
  color: #0f172a;
}

.google-render-slot {
  min-height: 44px;
  display: flex;
  align-items: center;
}

.online-header {
  border-radius: var(--r-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.spinner {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 50%;
  border: 4px solid rgba(148, 163, 184, 0.25);
  border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.room-code {
  font-family: 'Consolas', monospace;
  font-size: clamp(1.45rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.35em;
  padding: 0.95rem 1.25rem;
  border-radius: var(--r);
  background: rgba(37, 99, 235, 0.08);
  border: 1px dashed rgba(37, 99, 235, 0.4);
  color: var(--primary);
}

#online-locked {
  max-width: 42rem;
}

.ranking-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.8rem;
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: var(--r-lg);
}

.ranking-table th,
.ranking-table td {
  padding: 0.95rem 1rem;
  text-align: left;
}

.ranking-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.08);
}

.ranking-table td {
  font-size: 0.92rem;
  border-top: 1px solid var(--border);
}

.player-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: left;
}

.player-link:hover {
  color: var(--accent-2);
}

.player-link:focus-visible {
  outline: 2px solid var(--primary-2);
  outline-offset: 4px;
  border-radius: 4px;
}

.ranking-table tbody tr:hover td {
  background: rgba(37, 99, 235, 0.05);
}

.rank {
  font-weight: 800;
}

.rank-1 {
  color: var(--gold);
}

.rank-2 {
  color: #94a3b8;
}

.rank-3 {
  color: var(--accent);
}

.elo {
  color: var(--primary);
  font-weight: 700;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.profile-avatar {
  width: 4rem;
  height: 4rem;
  border-radius: 1.3rem;
  display: grid;
  place-items: center;
  background: var(--grad);
  color: #fff;
  font-family: 'Syne', sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
  box-shadow: 0 18px 36px var(--primary-glow);
}

.profile-kpi {
  padding: 1rem;
  border-radius: var(--r);
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.58);
  backdrop-filter: blur(10px);
}

.auth-panel {
  position: relative;
  width: min(640px, calc(100% - 1.4rem));
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.public-profile-panel {
  width: min(760px, calc(100% - 1.4rem));
}

.auth-close {
  position: absolute;
  top: 0.8rem;
  right: 0.85rem;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.7rem;
}

.footer {
  padding: 0 1.25rem 2rem;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.8rem;
}

@media (max-width: 1080px) {
  .topbar-shell,
  .hero-home,
  .config-row {
    grid-template-columns: 1fr;
  }

  .topbar-meta {
    justify-content: flex-start;
  }

  .tabs {
    order: 2;
  }
}

@media (max-width: 760px) {
  #app,
  .topbar,
  .footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .topbar-shell {
    padding: 0.9rem;
    border-radius: 1.5rem;
  }

  .brand {
    align-items: flex-start;
  }

  .topbar-meta {
    width: 100%;
    gap: 0.8rem;
  }

  .tabs {
    order: 1;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.45rem;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .status-cluster {
    order: 0;
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }

  .global-auth {
    width: auto;
    flex: 1 1 auto;
    justify-content: flex-end;
  }

  .theme-toggle {
    width: auto;
    min-width: 2.7rem;
    padding: 0.3rem;
    flex: 0 0 auto;
  }

  .theme-toggle-label {
    display: none;
  }

  #btn-global-login,
  #btn-global-profile {
    width: auto;
    flex: 0 1 auto;
  }

  .quiz-header,
  .quiz-footer,
  .online-header,
  .results-actions,
  .profile-actions {
    width: 100%;
  }

  .quiz-header,
  .quiz-footer,
  .online-header,
  .results-actions,
  .profile-actions {
    justify-content: flex-start;
  }

  .config-row,
  .two-col,
  .lobby-grid,
  .online-login-card,
  .duel-form,
  .scoreboard,
  .duel-final {
    grid-template-columns: 1fr;
  }

  .hero-metrics,
  .history-summary,
  .profile-stats {
    grid-template-columns: 1fr;
  }

  .vs-badge,
  .trophy {
    justify-self: center;
  }

  .ranking-table {
    display: block;
    overflow-x: auto;
  }

  .btn,
  .quiz-footer .btn,
  .results-actions .btn,
  .online-header .btn,
  .profile-actions .btn {
    width: 100%;
  }

  .global-auth .btn,
  .global-auth .user-chip,
  .online-indicator,
  .theme-toggle {
    width: auto;
  }
}