:root {
  --bg: #0b0d12;
  --panel: #121620;
  --panel-2: #171c28;
  --text: #f3f5f7;
  --muted: #929aaa;
  --line: #252c3b;
  --accent: #1f9d8a;
  --accent-2: #f0b84a;
  --good: #35d07f;
  --bad: #ff5f6d;
  --warn: #ffc857;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body { min-height: 100vh; }

button, input, textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

input, textarea {
  width: 100%;
  margin-top: .5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0e121a;
  color: var(--text);
  padding: .9rem 1rem;
  outline: none;
  transition: border .15s, box-shadow .15s;
}

input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31,157,138,.16);
}

textarea { resize: vertical; }

label {
  display: block;
  margin: 1rem 0;
  color: #dce1e9;
  font-size: .92rem;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  align-items: center;
  gap: 64px;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: .98;
  letter-spacing: 0;
  margin: .8rem 0 1.4rem;
}

.hero p {
  max-width: 650px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.eyebrow {
  color: var(--accent-2);
  font-weight: 800;
  letter-spacing: .14em;
  font-size: .72rem;
}

.card {
  background: rgba(18,22,32,.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 20px 80px rgba(0,0,0,.28);
}

.login-card {
  max-width: 460px;
  width: 100%;
  justify-self: end;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #0d1119;
  border: 1px solid var(--line);
  padding: 6px;
  border-radius: 8px;
}

.tab {
  background: transparent;
  color: var(--muted);
  padding: .75rem;
  border-radius: 6px;
}

.tab.active {
  color: white;
  background: var(--panel-2);
}

.panel { display: none; margin-top: 1.25rem; }
.panel.active { display: block; }

.primary, .secondary, .danger, .ghost {
  padding: .82rem 1.05rem;
  border-radius: 8px;
  font-weight: 750;
}

.primary {
  color: #06110f;
  background: var(--accent-2);
}

.secondary {
  color: #15121e;
  background: var(--warn);
}

.danger {
  color: white;
  background: #9f3340;
}

.ghost {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
}

.danger-text { color: #ff8a94; }
.wide { width: 100%; margin-top: .8rem; }

.error, .notice {
  margin-top: 14px;
  padding: .85rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(255,95,109,.28);
  background: rgba(255,95,109,.08);
  color: #ffb8bf;
}

.notice {
  border-color: var(--line);
  background: #0f131c;
  color: var(--muted);
}

.notice.success {
  border-color: rgba(53,208,127,.25);
  background: rgba(53,208,127,.08);
  color: #8be9b5;
}

.notice.warning {
  border-color: rgba(255,200,87,.28);
  background: rgba(255,200,87,.07);
  color: #ffda8a;
}

.hidden { display: none !important; }

.topbar {
  min-height: 74px;
  padding: 0 max(20px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(11,13,18,.86);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.hub-shell {
  padding-top: 42px;
  padding-bottom: 48px;
}

.hub-head {
  max-width: 720px;
  margin-bottom: 24px;
}

.hub-head h1 {
  font-size: clamp(2rem, 5vw, 3.7rem);
  line-height: 1.05;
  letter-spacing: 0;
  margin: 0 0 12px;
}

.hub-head p {
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
}

.module-grid {
  display: grid;
  grid-template-columns: minmax(260px, 420px);
  gap: 16px;
}

.module-grid.two {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.module-card {
  min-height: 170px;
  color: var(--text);
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.module-card:hover,
.module-card:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.module-card strong {
  font-size: 1.35rem;
}

.module-card span:last-child {
  color: var(--muted);
  line-height: 1.55;
}

.module-kicker {
  color: var(--accent-2);
  font-size: .74rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1.25fr .9fr;
  gap: 20px;
  padding-top: 24px;
  padding-bottom: 40px;
}

.side-card {
  min-height: 250px;
}

.section-head, .list-head, .question-top, .player-meta, .actions, .cooldown {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-head {
  align-items: flex-start;
  margin-bottom: 18px;
}

.list-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.cooldown {
  margin-top: 18px;
  color: var(--muted);
}

.cooldown strong { color: var(--text); }

.muted { color: var(--muted); }

.room-code {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: .13em;
  margin-top: .25rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .42rem .65rem;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .06em;
}

.badge.active {
  color: #8be9b5;
  border-color: rgba(53,208,127,.25);
  background: rgba(53,208,127,.08);
}

.badge.ready {
  color: #a9f0e5;
  border-color: rgba(31,157,138,.32);
  background: rgba(31,157,138,.12);
}

.badge.paused {
  color: #ffda8a;
  border-color: rgba(255,200,87,.25);
  background: rgba(255,200,87,.08);
}

.timer {
  min-width: 68px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 1.1rem;
  font-weight: 850;
  border: 1px solid var(--line);
  background: #0d1119;
  padding: .55rem .65rem;
  border-radius: 8px;
}

h2 {
  margin: .45rem 0 0;
  font-size: 1.25rem;
  line-height: 1.35;
}

.answers, .player-list, .event-list {
  display: grid;
  gap: 9px;
}

.answer-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  background: #0f131c;
  border-radius: 8px;
  padding: 12px;
}

.answer-choice {
  width: 100%;
  color: var(--text);
  text-align: left;
}

.answer-choice.selected {
  border-color: var(--accent-2);
  background: rgba(240,184,74,.1);
}

.winner-mark {
  min-width: 74px;
  text-align: center;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 850;
}

.answer-choice.selected .winner-mark {
  color: var(--accent-2);
}

.place {
  color: var(--muted);
  font-weight: 900;
}

.answer-text {
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.incident {
  grid-column: 2;
  justify-self: start;
  max-width: 190px;
  text-align: left;
  color: var(--good);
  font-weight: 900;
  font-size: .78rem;
  line-height: 1.3;
}

.incident.bad { color: var(--bad); }

.winner-mark {
  grid-column: 2;
  justify-self: start;
}

.player-row, .event-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(37,44,59,.7);
  padding: 9px 2px;
}

.event-row {
  justify-content: space-between;
  align-items: flex-start;
  font-size: .9rem;
}

.event-row span {
  color: var(--muted);
  text-align: right;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--good);
  box-shadow: 0 0 15px rgba(53,208,127,.5);
}

.empty-state {
  color: var(--muted);
  padding: 18px 0;
}

.player-shell {
  max-width: 820px;
  padding-top: 48px;
  padding-bottom: 48px;
}

.player-card {
  min-height: 470px;
  display: grid;
  align-items: center;
}

.start-overlay {
  text-align: center;
  max-width: 620px;
  margin: auto;
}

.start-overlay h1 {
  font-size: 2.4rem;
  margin: .7rem 0;
}

.start-overlay p {
  color: var(--muted);
  line-height: 1.65;
}

.rules-box {
  margin: 18px 0;
  text-align: left;
  border: 1px solid var(--line);
  background: #0f131c;
  border-radius: 8px;
  padding: 16px;
}

.rules-box p {
  margin: 0 0 10px;
}

.rules-box ul {
  margin: 0;
  padding-left: 20px;
  color: #dce1e9;
  line-height: 1.55;
}

.rules-box li {
  margin: 6px 0;
}

.rules-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  border: 1px solid rgba(240,184,74,.25);
  background: rgba(240,184,74,.08);
  border-radius: 8px;
  padding: 12px;
}

.rules-check input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  flex: 0 0 auto;
}

.rules-check span {
  line-height: 1.4;
}

.shield {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  background: rgba(31,157,138,.12);
  border: 1px solid rgba(31,157,138,.3);
  margin: 0 auto;
  display: grid;
  place-items: center;
  font-size: 2rem;
  color: var(--accent-2);
}

.question-box {
  margin: 22px 0;
  min-height: 150px;
  padding: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.35;
  font-weight: 800;
  border: 1px solid var(--line);
  background: #0e121a;
}

.blind-card {
  align-items: stretch;
}

.result-panel {
  margin-top: 18px;
}

.result-box {
  display: grid;
  gap: 14px;
}

.winner-card {
  border: 1px solid rgba(240,184,74,.32);
  background: rgba(240,184,74,.09);
  border-radius: 8px;
  padding: 14px;
}

.winner-card span {
  color: var(--accent-2);
  font-size: .74rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.winner-card strong {
  display: block;
  margin-top: 5px;
  font-size: 1.2rem;
}

.winner-card p {
  margin: 8px 0 0;
  color: #f7e4b8;
  overflow-wrap: anywhere;
}

.winner-card small,
.compact-list small {
  display: inline-block;
  margin-left: 8px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.compact-list {
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.6;
}

.compact-list li {
  margin: 5px 0;
  overflow-wrap: anywhere;
}

.winner-history {
  display: grid;
  gap: 8px;
}

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  background: #0f131c;
  border-radius: 8px;
  padding: 10px 12px;
}

.history-row span {
  color: var(--muted);
  font-weight: 850;
}

.history-row strong {
  text-align: right;
  overflow-wrap: anywhere;
}

.no-copy {
  user-select: none;
  -webkit-user-select: none;
}

.footer-note {
  color: #6f7786;
  font-size: .78rem;
  text-align: center;
  line-height: 1.5;
  max-width: 680px;
  margin: 18px auto 0;
}

@media (max-width: 850px) {
  .login-shell {
    grid-template-columns: 1fr;
    padding: 60px 0;
    gap: 32px;
  }

  .login-card { justify-self: stretch; max-width: none; }
  .hero h1 { font-size: clamp(2.6rem, 12vw, 4rem); }
  .admin-grid { grid-template-columns: 1fr; }
  .module-grid.two { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 20px, 1180px); }
  .card { padding: 18px; border-radius: 8px; }
  .actions button { flex: 1 1 45%; }
  .answer-row { grid-template-columns: 36px 1fr; }
  .incident, .winner-mark { grid-column: 2; text-align: left; }
  .history-row { align-items: flex-start; }
  .room-code { font-size: 1.7rem; }
  .player-meta { flex-wrap: wrap; justify-content: flex-end; }
}
