:root {
  color-scheme: light;
  --bg: #f4f1e8;
  --ink: #182026;
  --muted: #69747f;
  --panel: #fffdf8;
  --line: #d9d2c3;
  --accent: #1f7a6b;
  --accent-2: #d04f2f;
  --gold: #e2b44f;
  --shadow: 0 18px 40px rgba(36, 32, 22, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(31, 122, 107, 0.14), transparent 36%),
    linear-gradient(225deg, rgba(208, 79, 47, 0.12), transparent 34%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.is-speaking {
  background:
    linear-gradient(135deg, rgba(226, 180, 79, 0.35), transparent 38%),
    linear-gradient(225deg, rgba(208, 79, 47, 0.24), transparent 34%),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 800;
  min-height: 44px;
  padding: 0 18px;
}

.danger-btn,
.remove-player {
  background: var(--accent-2);
}

.icon-btn {
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: 1.1rem;
  min-height: 44px;
  padding: 0;
  width: 44px;
}

.icon-btn svg {
  display: block;
  fill: none;
  height: 22px;
  margin: auto;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 22px;
}

button:hover {
  filter: brightness(0.95);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  min-height: 44px;
  padding: 10px 12px;
}

input[type="checkbox"] {
  accent-color: var(--accent);
  min-height: 18px;
  width: 18px;
}

label {
  color: var(--muted);
  display: grid;
  gap: 7px;
  font-size: 0.9rem;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 0.95;
}

h2 {
  font-size: 1.25rem;
}

.shell {
  margin: 0 auto;
  max-width: 1050px;
  padding: 28px;
}

.topbar {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 24px;
}

.eyebrow {
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.game-code {
  background: var(--ink);
  border-radius: 8px;
  color: white;
  min-width: 145px;
  padding: 13px 16px;
  text-align: right;
}

.game-code span {
  color: rgba(255, 255, 255, 0.68);
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.game-code strong {
  font-size: 1.55rem;
  letter-spacing: 0.08em;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.home {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
  margin: 0 auto;
  max-width: 560px;
}

.stack {
  display: grid;
  gap: 16px;
}

.play {
  display: grid;
  gap: 18px;
}

.status {
  align-items: center;
  display: flex;
  gap: 20px;
  justify-content: space-between;
}

.status.your-turn {
  border-color: var(--gold);
  box-shadow: 0 0 0 5px rgba(226, 180, 79, 0.28), var(--shadow);
}

.turn-banner {
  background: var(--gold);
  border-radius: 999px;
  color: var(--ink);
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 900;
  margin: 0 0 10px;
  padding: 6px 10px;
  text-transform: uppercase;
}

#secretLabel {
  font-size: clamp(2rem, 7vw, 5rem);
  line-height: 1;
  overflow-wrap: anywhere;
}

.secret-line {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.word-toggle {
  background: var(--ink);
  color: white;
  flex: 0 0 auto;
}

#secretLabel.secret-revealed {
  color: var(--accent-2);
}

#messageLabel,
.hint,
.imposter-reveal {
  color: var(--muted);
  line-height: 1.45;
  margin-top: 8px;
}

.imposter-reveal {
  background: rgba(208, 79, 47, 0.12);
  border-radius: 8px;
  color: var(--accent-2);
  display: inline-block;
  font-weight: 900;
  padding: 10px 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
}

.settings-panel,
.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.settings-panel {
  background: rgba(24, 32, 38, 0.04);
}

.notice {
  background: rgba(31, 122, 107, 0.1);
  color: var(--accent);
  font-weight: 800;
  line-height: 1.35;
}

.check-row {
  align-items: center;
  color: var(--ink);
  display: flex;
  font-size: 0.95rem;
  gap: 10px;
}

.players {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}

.player {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 14px 1fr auto auto;
  min-height: 48px;
  padding: 10px 12px;
}

.remove-player {
  font-size: 0.72rem;
  min-height: 32px;
  padding: 0 10px;
}

.dot {
  background: #aab3ba;
  border-radius: 50%;
  height: 10px;
  width: 10px;
}

.player.connected .dot {
  background: var(--accent);
}

.player.speaking {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 2px var(--gold);
}

.player.eliminated {
  color: var(--muted);
  text-decoration: line-through;
}

.player.revealed-imposter {
  background: rgba(208, 79, 47, 0.1);
  border-color: var(--accent-2);
  box-shadow: inset 0 0 0 2px rgba(208, 79, 47, 0.28);
  color: var(--accent-2);
  text-decoration: none;
}

.player.revealed-imposter .dot {
  background: var(--accent-2);
}

.tag {
  border-radius: 999px;
  background: rgba(31, 122, 107, 0.11);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  padding: 5px 8px;
  text-transform: uppercase;
}

.tag.danger {
  background: rgba(208, 79, 47, 0.12);
  color: var(--accent-2);
}

.share input {
  margin-top: 12px;
}

.toast {
  background: var(--ink);
  border-radius: 8px;
  bottom: 20px;
  color: white;
  left: 50%;
  max-width: min(460px, calc(100vw - 32px));
  padding: 12px 14px;
  position: fixed;
  transform: translateX(-50%);
}

@media (max-width: 760px) {
  .shell {
    padding: 18px;
  }

  .topbar,
  .status {
    align-items: stretch;
    flex-direction: column;
  }

  .game-code {
    text-align: left;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .actions {
    justify-content: stretch;
  }

  .actions button {
    width: 100%;
  }

  .actions .icon-btn {
    width: 44px;
  }

  .player {
    grid-template-columns: 14px 1fr auto;
  }

  .remove-player {
    grid-column: 2 / -1;
    width: 100%;
  }
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
}

.theme-panel h2 {
  margin-bottom: 0;
}

.speaker-callout {
  background: rgba(226, 180, 79, 0.24);
  border: 2px solid var(--gold);
  border-radius: 8px;
  color: var(--ink);
  display: inline-block;
  font-size: 1.05rem;
  font-weight: 950;
  line-height: 1.25;
  margin-top: 12px;
  padding: 10px 12px;
}

#secretLabel.countdown {
  color: var(--gold);
  font-size: clamp(3.2rem, 14vw, 7rem);
}

body.is-speaking .status.your-turn {
  background: #fff8d8;
  border-color: var(--gold);
  box-shadow: 0 0 0 8px rgba(226, 180, 79, 0.36), var(--shadow);
}

body.is-speaking .turn-banner {
  font-size: 0.95rem;
  padding: 8px 12px;
}

body.is-speaking .speaker-callout {
  background: var(--gold);
}
