:root {
  --bg: #efe4d2;
  --bg-top: #fdf7ef;
  --panel: rgba(255, 250, 242, 0.9);
  --ink: #191510;
  --muted: #73695d;
  --line: rgba(40, 30, 18, 0.11);
  --accent: #e86635;
  --green: #16695e;
  --shadow: 0 18px 42px rgba(67, 42, 20, 0.1);
  --field-bg: rgba(255, 251, 246, 0.92);
  --pattern: url("/img/pattern-light.png");
  --texture: url("/img/texture-light.webp");
  --red: #e9534b;
  --blue: #58a8ff;
  --neutral: #faf6ef;
  --assassin: #221d19;
}

body[data-theme="dark"] {
  --bg: #171b21;
  --bg-top: #232831;
  --panel: rgba(30, 35, 43, 0.92);
  --ink: #f5efe6;
  --muted: #b9b1a6;
  --line: rgba(245, 239, 230, 0.12);
  --accent: #ff8a4c;
  --green: #2d9f90;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  --field-bg: rgba(18, 22, 29, 0.9);
  --pattern: url("/img/pattern-dark.png.png");
  --texture: url("/img/texture-dark.webp");
  --red: #df635d;
  --blue: #63a8ff;
  --neutral: #e8e1d6;
  --assassin: #0f1115;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    var(--pattern) 0 0 / 420px 420px repeat,
    var(--texture) 0 0 / 250px 250px repeat,
    radial-gradient(circle at top left, rgba(232, 102, 53, 0.2), transparent 28%),
    radial-gradient(circle at bottom right, rgba(22, 105, 94, 0.16), transparent 28%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 100%);
}

body:not([data-theme="dark"]) {
  background:
    linear-gradient(180deg, rgba(255, 250, 242, 0.82), rgba(243, 233, 216, 0.92)),
    radial-gradient(circle at top left, rgba(232, 102, 53, 0.1), transparent 30%),
    radial-gradient(circle at bottom right, rgba(22, 105, 94, 0.08), transparent 28%),
    var(--pattern) 0 0 / 420px 420px repeat,
    var(--texture) 0 0 / 250px 250px repeat,
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 100%);
}

.app-shell,
.codenames-shell {
  width: min(1280px, calc(100% - 24px));
  margin: 0 auto;
  padding: 72px 0 24px;
}

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

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

.auth-view,
.panel--inner,
.topbar,
.sidebar,
.board-panel {
  padding: 16px;
}

.eyebrow,
.panel__kicker {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
}

h1,h2,h3,p { margin: 0; }
h1 { font-family: "Rubik Mono One", monospace; font-size: clamp(1.8rem, 5vw, 3.2rem); line-height: 0.95; }

.auth-view { display: grid; gap: 18px; padding: 20px; }
.auth-shell { display: grid; gap: 16px; }
.auth-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.auth-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) 320px;
  gap: 18px;
  align-items: end;
  padding: 6px 4px 2px;
}
.auth-hero__copy,
.auth-card,
.team-box,
.clue-box {
  display: grid;
  gap: 12px;
}
.auth-hero__copy { gap: 12px; }
.auth-hero__copy h1 {
  font-size: clamp(2.3rem, 5vw, 4.4rem);
  line-height: 0.92;
  letter-spacing: -0.06em;
  max-width: 8ch;
}
.auth-hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.auth-hero__chips span,
.player-chip,
.role-pill,
.turn-chip,
.code-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(23, 20, 17, 0.06);
  font-weight: 800;
  font-size: 0.88rem;
}

#room-code {
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.turn-chip {
  min-height: 50px;
  min-width: 170px;
  padding: 0 18px;
  color: #fff8f0;
  background: rgba(18, 22, 29, 0.82);
  border-color: rgba(245, 239, 230, 0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  justify-content: center;
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

body:not([data-theme="dark"]) .turn-chip {
  background: rgba(255, 248, 236, 0.96);
  border-color: rgba(23, 20, 17, 0.1);
  color: var(--ink);
}

.turn-chip:hover:not(:disabled) {
  filter: brightness(1.05);
}

.turn-chip--red {
  background: linear-gradient(135deg, #c94e48, #de6a63);
  border-color: rgba(201, 78, 72, 0.38);
  color: #fff;
  box-shadow: 0 14px 28px rgba(201, 78, 72, 0.28);
}

.turn-chip--blue {
  background: linear-gradient(135deg, #457dde, #68a2ee);
  border-color: rgba(69, 125, 222, 0.38);
  color: #fff;
  box-shadow: 0 14px 28px rgba(69, 125, 222, 0.28);
}

.turn-chip--neutral {
  background: rgba(18, 22, 29, 0.82);
  color: #fff8f0;
}

body:not([data-theme="dark"]) .turn-chip--neutral {
  background: rgba(255, 248, 236, 0.96);
  color: var(--ink);
}

.auth-hero__aside {
  display: grid;
  gap: 12px;
  justify-items: end;
  text-align: right;
  color: var(--muted);
  align-self: center;
}

.auth-hero__aside p {
  max-width: 30ch;
  line-height: 1.5;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--muted);
}

.field input,
.clue-form input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(23, 20, 17, 0.12);
  background: var(--field-bg);
  color: var(--ink);
  font: inherit;
}

.primary-button,
.accent-button,
.ghost-button,
.ghost-link,
.icon-chip,
.team-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  font: inherit;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  background: rgba(255,255,255,0.06);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    filter 0.16s ease,
    background-color 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease;
}

.primary-button:hover,
.accent-button:hover,
.ghost-button:hover,
.ghost-link:hover,
.icon-chip:hover,
.team-action:hover,
.team-slot-action:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.1);
}

.primary-button:active,
.accent-button:active,
.ghost-button:active,
.ghost-link:active,
.icon-chip:active,
.team-action:active,
.team-slot-action:active {
  transform: translateY(0) scale(0.985);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

.auth-card {
  gap: 16px;
  min-height: 280px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(23, 20, 17, 0.08);
  box-shadow: 0 18px 40px rgba(26, 19, 12, 0.08);
}

.auth-card__head {
  display: grid;
  gap: 8px;
}

.auth-card__head h2 {
  font-size: clamp(1.7rem, 2vw, 2.2rem);
  line-height: 1;
}

.panel--inner button {
  justify-self: start;
  min-width: 148px;
}

.auth-footer {
  display: grid;
  gap: 10px;
}

.primary-button { background: linear-gradient(135deg, #d45d2e, #e68f47); color: #fff; border: none; }
.accent-button { background: linear-gradient(135deg, #14695e, #39b7a1); color: #fff; border: none; }
.icon-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(23, 20, 17, 0.08);
  border-radius: 14px;
  background: rgba(23, 20, 17, 0.06);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(23, 20, 17, 0.04);
  font-size: 1.1rem;
  font-weight: 800;
  overflow: hidden;
  transition:
    transform 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}

.icon-chip svg {
  width: 20px;
  height: 20px;
  transition: transform 0.18s ease;
}

.icon-chip::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 900;
  color: #fff;
  opacity: 0;
  transform: scale(0.55);
}

.icon-chip--success {
  background: var(--green);
  border-color: rgba(22, 105, 94, 0.72);
  color: #fff;
  box-shadow:
    0 0 0 6px rgba(22, 105, 94, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  animation: icon-chip-pop 0.42s ease;
}

.icon-chip--success svg {
  animation: icon-chip-hide 1.2s ease forwards;
}

.icon-chip--success::after {
  animation: icon-chip-check 1.2s ease forwards;
}

@keyframes icon-chip-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes icon-chip-hide {
  0%, 18% { opacity: 1; transform: scale(1); }
  32%, 100% { opacity: 0; transform: scale(0.72); }
}

@keyframes icon-chip-check {
  0%, 24% { opacity: 0; transform: scale(0.55); }
  38%, 82% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.78); }
}

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

.topbar__actions {
  align-items: center;
}

.ghost-button--game-action {
  min-width: 176px;
}

.ghost-button--danger {
  background: linear-gradient(135deg, #d4544d, #ea756c);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 16px rgba(212, 84, 77, 0.14);
}

.ghost-button--restart {
  background: linear-gradient(135deg, var(--accent), #ffb15d);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 16px rgba(255, 138, 76, 0.12);
}

.ghost-button--pause {
  min-width: 144px;
}

.ghost-button--resume {
  background: linear-gradient(135deg, var(--green), #52cbb4);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 16px 30px rgba(45, 159, 144, 0.22);
}

.ghost-button--icon {
  min-width: 48px;
  width: 48px;
  padding: 0;
}

.ghost-button--icon span {
  display: none;
}

.ghost-button--icon svg {
  width: 18px;
  height: 18px;
}

.ghost-button--icon.ghost-button--danger:hover,
.ghost-button--icon.ghost-button--restart:hover,
.ghost-button--icon.ghost-button--danger:active,
.ghost-button--icon.ghost-button--restart:active {
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
}

.topbar__line,
.topbar__actions,
.panel__head,
.board-header,
.clue-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar > div:first-child { display: grid; gap: 6px; }
.topbar__subtitle, .hero-note, .auth-status, .sidebar-note, .team-box__meta, .clue-box__info span { color: var(--muted); }

.topbar__subtitle {
  font-size: 0.95rem;
  line-height: 1.35;
  max-width: 56ch;
  margin: 0;
}

.layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr) 290px;
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}

.team-column {
  display: grid;
  gap: 10px;
}

.sidebar--team {
  display: grid;
  gap: 12px;
  align-content: start;
}

.sidebar--team .panel__head {
  align-items: flex-start;
}

.team-box {
  position: relative;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.08);
  display: grid;
  gap: 12px;
  transition:
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.22s ease;
}

.team-box--red { box-shadow: inset 0 0 0 1px rgba(204,84,79,0.16); }
.team-box--blue { box-shadow: inset 0 0 0 1px rgba(79,124,207,0.16); }
.team-box--active {
  transform: translateY(-2px);
}
.team-box--active-red {
  border-color: rgba(201, 78, 72, 0.58);
  box-shadow:
    inset 0 0 0 1px rgba(201, 78, 72, 0.28),
    0 0 0 1px rgba(201, 78, 72, 0.34),
    0 0 24px rgba(201, 78, 72, 0.24),
    0 0 52px rgba(201, 78, 72, 0.14);
}
.team-box--active-blue {
  border-color: rgba(69, 125, 222, 0.58);
  box-shadow:
    inset 0 0 0 1px rgba(69, 125, 222, 0.28),
    0 0 0 1px rgba(69, 125, 222, 0.34),
    0 0 24px rgba(69, 125, 222, 0.24),
    0 0 52px rgba(69, 125, 222, 0.14);
}

.team-box--active::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  pointer-events: none;
}

.team-box--active-red::after {
  box-shadow: 0 0 0 2px rgba(201, 78, 72, 0.28);
}

.team-box--active-blue::after {
  box-shadow: 0 0 0 2px rgba(69, 125, 222, 0.28);
}

.team-box__head,
.team-box__player {
  display: flex;
  align-items: center;
  gap: 10px;
}

.team-box__head {
  justify-content: center;
  align-items: center;
}

.team-box__title {
  display: grid;
  gap: 10px;
}

.team-box__title strong {
  font-size: 1.2rem;
}

.sidebar--red .panel__head h3,
.team-box--red .team-box__title strong {
  color: #e37069;
}

.sidebar--blue .panel__head h3,
.team-box--blue .team-box__title strong {
  color: #76a0f5;
}

.team-box__players { display: grid; gap: 8px; }
.role-row { display: flex; gap: 8px; flex-wrap: wrap; }
.role-row--join { align-items: center; }
.team-action.is-active { border-color: var(--accent); }

.team-slot-action {
  width: 46px;
  min-width: 46px;
  min-height: 46px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.06);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    filter 0.16s ease,
    background-color 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease;
}

.team-slot-action svg {
  width: 20px;
  height: 20px;
}

.team-slot-action--join {
  background: rgba(20, 105, 94, 0.22);
  color: #0f7f71;
  border-color: rgba(20, 105, 94, 0.54);
  box-shadow: inset 0 0 0 1px rgba(20, 105, 94, 0.08);
}

.team-slot-action--leave {
  background: rgba(201, 78, 72, 0.2);
  color: #cb4d46;
  border-color: rgba(201, 78, 72, 0.5);
  box-shadow: inset 0 0 0 1px rgba(201, 78, 72, 0.08);
}

.team-box__section {
  display: grid;
  gap: 8px;
}

.team-box__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.team-box__section-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.team-box__label {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.team-box__slot {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.team-box__clues {
  align-content: start;
  min-height: 76px;
}

.team-box__clue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.team-box__clue-word {
  min-width: 0;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-box__clue-count {
  flex: 0 0 auto;
  min-width: 30px;
  max-width: 60px;
  padding: 3px 8px;
  border-radius: 999px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

.team-box__player .is-self {
  font-weight: 800;
}

.team-box__player-name {
  min-width: 0;
}

.team-box__ready {
  margin-left: auto;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(58, 202, 133, 0.18);
  color: #43d686;
  box-shadow: inset 0 0 0 1px rgba(67, 214, 134, 0.32);
}

.team-box__ready svg {
  width: 12px;
  height: 12px;
}

.role-pill {
  padding-inline: 10px;
  text-align: center;
  justify-self: center;
  min-width: 0;
}

.team-role-icon {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.06);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.team-role-icon svg {
  width: 16px;
  height: 16px;
}

.team-role-icon.is-active {
  border-color: var(--accent);
  color: var(--accent);
}

.team-role-icon:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.board-panel { display: grid; gap: 14px; }

.clue-box {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.08);
  align-items: stretch;
  gap: 10px;
}

.clue-box--result {
  gap: 6px;
  padding: 18px 20px;
  background: rgba(255, 215, 128, 0.08);
  border-color: rgba(255, 215, 128, 0.24);
}

.clue-box--result-red {
  background: linear-gradient(180deg, rgba(219,84,79,0.12), rgba(219,84,79,0.04));
  border-color: rgba(219,84,79,0.28);
}

.clue-box--result-blue {
  background: linear-gradient(180deg, rgba(83,142,248,0.12), rgba(83,142,248,0.04));
  border-color: rgba(83,142,248,0.28);
}

.clue-box--result-neutral {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.10);
}

.clue-box__info { display: grid; gap: 4px; }
.clue-box__info strong {
  font-size: 0.98rem;
  line-height: 1.25;
}
.clue-box__info span {
  font-size: 0.92rem;
  line-height: 1.35;
}

.clue-box--result .clue-box__info {
  gap: 8px;
}

.clue-box--result .clue-box__info strong {
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  line-height: 1.05;
}

.clue-box--result .clue-box__info span {
  font-size: 0.98rem;
}
.clue-form {
  display: flex;
  gap: 10px;
  align-items: end;
}
.clue-form__field {
  display: grid;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
}
.clue-form__field--count {
  flex: 0 0 58px;
}
.clue-form__field span {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.clue-form input[type="number"] {
  width: 100%;
  text-align: center;
  padding-inline: 8px;
}

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

.lobby-start-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.08);
}

.lobby-start-box__copy {
  display: grid;
  gap: 6px;
}

.lobby-start-box__copy p {
  color: var(--muted);
  line-height: 1.5;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.card {
  position: relative;
  overflow: hidden;
  min-height: 108px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--field-bg);
  color: var(--ink);
  font: inherit;
  font-size: 1.02rem;
  font-weight: 800;
  cursor: default;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.card__word {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.card__vote-count {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  min-width: 34px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 138, 76, 0.16);
  color: #ffd1bc;
  font-size: 0.74rem;
  font-weight: 800;
  pointer-events: none;
}

.card__pending-track {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.card__pending-timer {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #ffbf7a);
  box-shadow: 0 0 10px rgba(255, 138, 76, 0.25);
  pointer-events: none;
}

.card.is-clickable { cursor: pointer; }
.card.is-clickable:hover { transform: translateY(-2px); }
.card.is-revealed {
  filter: brightness(0.48) saturate(0.58);
  color: rgba(255, 255, 255, 0.4);
  text-shadow: none;
}
.card.is-final-reveal {
  filter: none;
  opacity: 0.96;
}
.card.is-selected {
  transform: translateY(-2px);
  box-shadow: 0 0 0 2px rgba(255, 138, 76, 0.7);
}
.card.is-pending {
  box-shadow: 0 0 0 2px rgba(255, 138, 76, 0.88), 0 0 24px rgba(255, 138, 76, 0.18);
}
.card--red { background: color-mix(in srgb, var(--red) 88%, white 12%); color: #fff; }
.card--blue { background: color-mix(in srgb, var(--blue) 88%, white 12%); color: #fff; }
.card--neutral { background: var(--neutral); color: #1f1c19; }
.card--assassin { background: var(--assassin); color: #fff; }
.card--hidden-red { box-shadow: inset 0 0 0 2px rgba(204,84,79,0.55); }
.card--hidden-blue { box-shadow: inset 0 0 0 2px rgba(79,124,207,0.55); }
.card--hidden-neutral { box-shadow: inset 0 0 0 2px rgba(242, 238, 232, 0.65); }
.card--hidden-assassin { box-shadow: inset 0 0 0 2px rgba(34,29,25,0.8); }

.winner-banner {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 215, 128, 0.14);
  border: 1px solid rgba(255, 215, 128, 0.25);
}

.winner-banner--hero {
  display: grid;
  place-items: center;
  min-height: 220px;
  font-size: clamp(1.4rem, 2.8vw, 2.3rem);
  font-weight: 800;
  text-align: center;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 20, 17, 0.34);
  backdrop-filter: blur(3px);
}

.modal__card {
  position: relative;
  width: min(760px, 100%);
  max-height: min(85vh, 920px);
  padding: 20px;
  border-radius: 22px;
  border: 1px solid rgba(23, 20, 17, 0.1);
  background: rgba(255, 250, 242, 0.98);
  box-shadow: 0 24px 60px rgba(23, 20, 17, 0.2);
  overflow: hidden;
}

.modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.modal__body {
  display: grid;
  gap: 10px;
  max-height: calc(85vh - 110px);
  overflow-y: auto;
  padding-right: 4px;
}

.modal__body p {
  line-height: 1.45;
}

.help-intro {
  display: grid;
  gap: 8px;
}

.help-section {
  border: 1px solid rgba(23, 20, 17, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  overflow: hidden;
}

.help-section summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  font-weight: 800;
}

.help-section summary::-webkit-details-marker {
  display: none;
}

.help-section summary::after {
  content: "+";
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(23, 20, 17, 0.08);
  font-size: 18px;
  line-height: 1;
}

.help-section[open] summary::after {
  content: "−";
}

.help-section__content {
  display: grid;
  gap: 14px;
  padding: 0 16px 16px;
}

.help-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

#turn-chip:disabled {
  cursor: default;
  opacity: 1;
}

.turn-chip--restart {
  background: linear-gradient(135deg, var(--accent), #ffb15d);
  color: #fff;
  border-color: transparent;
}

.turn-chip--danger {
  background: linear-gradient(135deg, #d4544d, #ea756c);
  color: #fff;
  border-color: transparent;
}

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .auth-grid, .auth-hero { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .board-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .clue-box, .topbar, .board-header, .lobby-start-box { flex-direction: column; align-items: stretch; }
  .clue-form, .guess-actions { flex-direction: column; }
  .clue-form input[type="number"] { width: 100%; }
}

body[data-theme="dark"] .modal__card,
body[data-theme="dark"] .help-section {
  background: rgba(34, 40, 49, 0.92);
  border-color: rgba(245, 239, 230, 0.1);
  box-shadow: none;
}

body[data-theme="dark"] .modal__head h3 {
  color: #f5efe6;
}

body[data-theme="dark"] .modal__body p,
body[data-theme="dark"] .help-list {
  color: #b9b1a6;
}

body[data-theme="dark"] .help-section summary::after {
  background: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .code-chip,
body[data-theme="dark"] .icon-chip {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(245, 239, 230, 0.1);
  color: #f5efe6;
  box-shadow: none;
}

body:not([data-theme="dark"]) .panel,
body:not([data-theme="dark"]) .board-panel,
body:not([data-theme="dark"]) .sidebar,
body:not([data-theme="dark"]) .topbar {
  background: rgba(255, 250, 242, 0.84);
  border-color: rgba(58, 42, 24, 0.1);
  box-shadow: 0 18px 40px rgba(67, 42, 20, 0.09);
}

body:not([data-theme="dark"]) .team-box,
body:not([data-theme="dark"]) .clue-box,
body:not([data-theme="dark"]) .lobby-start-box {
  background: rgba(255, 252, 247, 0.88);
  border-color: rgba(64, 48, 30, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

body:not([data-theme="dark"]) .turn-chip--red {
  background: linear-gradient(135deg, #c94e48, #de6a63) !important;
  border-color: rgba(201, 78, 72, 0.38) !important;
  color: #fff !important;
  box-shadow: 0 14px 28px rgba(201, 78, 72, 0.28) !important;
}

body:not([data-theme="dark"]) .turn-chip--blue {
  background: linear-gradient(135deg, #457dde, #68a2ee) !important;
  border-color: rgba(69, 125, 222, 0.38) !important;
  color: #fff !important;
  box-shadow: 0 14px 28px rgba(69, 125, 222, 0.28) !important;
}

body:not([data-theme="dark"]) .team-box__slot,
body:not([data-theme="dark"]) .team-box__clue-item,
body:not([data-theme="dark"]) .winner-banner,
body:not([data-theme="dark"]) .turn-chip--neutral {
  background: rgba(255, 249, 241, 0.94);
  border-color: rgba(64, 48, 30, 0.1);
}

body:not([data-theme="dark"]) .clue-box--result {
  background: linear-gradient(180deg, rgba(255, 249, 239, 0.98), rgba(248, 240, 228, 0.96));
  border-color: rgba(188, 162, 116, 0.26);
}

body:not([data-theme="dark"]) .clue-box--result-red {
  background: linear-gradient(180deg, rgba(253, 235, 232, 0.96), rgba(250, 241, 238, 0.92));
  border-color: rgba(219, 84, 79, 0.24);
}

body:not([data-theme="dark"]) .clue-box--result-blue {
  background: linear-gradient(180deg, rgba(235, 243, 255, 0.96), rgba(241, 247, 255, 0.92));
  border-color: rgba(83, 142, 248, 0.24);
}

body:not([data-theme="dark"]) .card {
  border-color: rgba(58, 42, 24, 0.11);
  box-shadow: 0 10px 20px rgba(72, 46, 22, 0.05);
}

body:not([data-theme="dark"]) .card--red {
  background: linear-gradient(180deg, #e35e57, #cb4c46);
}

body:not([data-theme="dark"]) .card--blue {
  background: linear-gradient(180deg, #619ee8, #487fd3);
}

body:not([data-theme="dark"]) .card--neutral {
  background: linear-gradient(180deg, #fbf8f2, #f3ede3);
  color: #2b241d;
}

body:not([data-theme="dark"]) .card--assassin {
  background: linear-gradient(180deg, #1b1714, #100d0b);
}

body:not([data-theme="dark"]) .card.is-revealed {
  filter: brightness(0.62) saturate(0.7);
  color: rgba(255, 255, 255, 0.55);
}

body:not([data-theme="dark"]) .card--neutral.is-revealed {
  color: rgba(31, 28, 25, 0.42);
}

/* Shared auth hard sync */
.auth-view .auth-card,
.auth-view .panel--inner.auth-card {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
}

.auth-view .auth-card > .primary-button,
.auth-view .auth-card > .accent-button,
.auth-view .auth-card > button.primary-button,
.auth-view .auth-card > button.accent-button {
  display: inline-flex !important;
  align-self: stretch !important;
  justify-content: center !important;
  width: 100% !important;
  inline-size: 100% !important;
  min-inline-size: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin-top: auto !important;
  margin-bottom: 0 !important;
  flex: 0 0 auto !important;
}
