:root {
  --bg: #f1e4cf;
  --bg-top: #fbf4ea;
  --panel: rgba(255, 249, 242, 0.88);
  --ink: #1b1713;
  --muted: #7c7267;
  --line: rgba(27, 23, 19, 0.08);
  --accent: #e36d33;
  --green: #2a8e82;
  --shadow: 0 24px 56px rgba(71, 45, 19, 0.1);
  --pattern: url("/img/pattern-light.png");
  --texture: url("/img/texture-light.webp");
}

body[data-theme="dark"] {
  --bg: #161b22;
  --bg-top: #1f2730;
  --panel: rgba(31, 37, 46, 0.9);
  --ink: #f6f0e7;
  --muted: #b8b0a7;
  --line: rgba(246, 240, 231, 0.1);
  --accent: #ff8d54;
  --green: #34a593;
  --shadow: 0 24px 56px rgba(0, 0, 0, 0.32);
  --pattern: url("/img/pattern-dark.png.png");
  --texture: url("/img/texture-dark.webp");
}

* { box-sizing: border-box; }

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(227, 109, 51, 0.12), transparent 24%),
    radial-gradient(circle at bottom right, rgba(42, 142, 130, 0.1), transparent 28%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 100%);
}

button, input { font: inherit; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }

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

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

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

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

.auth-view {
  display: grid;
  gap: 18px;
  padding: 16px;
}

.auth-shell {
  display: grid;
  gap: 16px;
}

.auth-hero,
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) 320px;
  gap: 18px;
  align-items: end;
  padding: 6px 4px 2px;
}

.auth-hero__copy, .hero__copy, .auth-hero__aside, .hero__aside, .auth-card__head, .panel--inner, .help-intro, .help-rule {
  display: grid;
  gap: 12px;
}

.auth-hero__copy h1,
.hero__copy h1 {
  font-size: clamp(2.3rem, 5vw, 4.4rem);
  line-height: 0.92;
  letter-spacing: -0.06em;
  max-width: 8ch;
}

.hero-note, .hero__note, .auth-card__head p:last-child, .auth-status, .topbar__note, .current-card__hint, .modal__body p, .help-list {
  color: var(--muted);
  line-height: 1.5;
}

.auth-hero__chips, .hero__chips, .topbar__line, .topbar__actions, .board-head__meta, .controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-hero__chips span,
.hero__chips span,
.ghost-link,
.code-chip,
.status-pill,
.icon-chip,
.ghost-button,
.primary-button,
.accent-button {
  border: 1px solid var(--line);
  border-radius: 16px;
}

.hero__chips span,
.ghost-link,
.status-pill,
.icon-chip,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  background: rgba(23, 20, 17, 0.06);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.auth-hero__aside,
.hero__aside {
  justify-items: end;
  text-align: right;
  align-self: center;
}

.auth-hero__aside p,
.hero__aside p {
  max-width: 30ch;
}

.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

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

.auth-card__head {
  gap: 8px;
}

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

.auth-card--leader {
  background: radial-gradient(circle at top right, rgba(227, 109, 51, 0.12), transparent 26%), var(--panel);
}

.auth-card--player {
  background: radial-gradient(circle at top right, rgba(42, 142, 130, 0.12), transparent 26%), var(--panel);
}

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

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

.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(23, 20, 17, 0.12);
  border-radius: 14px;
  outline: none;
  background: var(--field-bg);
  color: var(--ink);
}

.primary-button,
.accent-button,
.ghost-button {
  min-height: 52px;
  padding: 0 20px;
  border: 1px solid var(--line);
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  background: linear-gradient(135deg, #f16d34, #ff9f59);
  border-color: rgba(227, 109, 51, 0.28);
  color: #fff;
}

.accent-button {
  background: linear-gradient(135deg, #2ea795, #45c8b4);
  border-color: rgba(42, 142, 130, 0.28);
  color: #fff;
}

.ghost-button {
  background: rgba(27, 23, 19, 0.05);
  color: var(--ink);
}

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

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  margin-bottom: 14px;
}

.topbar > div:first-child {
  display: grid;
  gap: 6px;
}

.code-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  background: rgba(27, 23, 19, 0.05);
  font-weight: 800;
  font-size: 0.92rem;
}

.icon-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: rgba(27, 23, 19, 0.06);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(23, 20, 17, 0.04);
  overflow: hidden;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.icon-chip svg {
  width: 20px;
  height: 20px;
}

.icon-chip::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  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; }
.icon-chip--active {
  background: rgba(42, 142, 130, 0.16);
  border-color: rgba(42, 142, 130, 0.28);
  color: var(--green);
}

.board-layout {
  display: block;
}

.board-panel,
.side-panel {
  padding: 16px;
}

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

.board-panel--wide {
  width: 100%;
}

.board-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 1fr;
  align-items: center;
  gap: 12px;
}

.board-head > div:first-child {
  display: grid;
  gap: 8px;
}

.board-head__meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: nowrap;
}

.board-head__actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: center;
}

.board-toolbar {
  display: none;
}

.board-actions {
  display: flex;
  justify-content: center;
  margin-top: -2px;
}

.board-toolbar__info,
.board-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.board-toolbar__actions {
  justify-content: center;
}

.board-toolbar__meta-chip {
  display: none !important;
}

.mini-chip,
.icon-action,
.action-button {
  min-height: 40px;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.mini-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  background: rgba(27, 23, 19, 0.05);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
}

.mini-chip--muted {
  color: var(--muted);
  font-weight: 700;
}

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: rgba(27, 23, 19, 0.05);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 800;
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
  padding: 0 16px;
  background: rgba(27, 23, 19, 0.05);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 800;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease, background 0.18s ease;
}

.action-button__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  line-height: 1;
}

.action-button__icon svg {
  width: 18px;
  height: 18px;
}

.icon-action--accent {
  background: linear-gradient(135deg, #2ea795, #45c8b4);
  border-color: rgba(42, 142, 130, 0.28);
  color: #fff;
}

.action-button--accent {
  background: linear-gradient(135deg, #2ea795, #45c8b4);
  border-color: rgba(42, 142, 130, 0.28);
  color: #fff;
}

.icon-action:disabled,
.action-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.action-button:not(:disabled):hover {
  filter: brightness(1.03);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.14);
}

.action-button:not(:disabled):active {
  transform: translateY(1px) scale(0.985);
}

.status-pill {
  min-height: 34px;
  padding: 0 12px;
  background: rgba(27, 23, 19, 0.05);
  font-size: 0.88rem;
}

.board-stage {
  position: relative;
  min-height: 0;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 20% 20%, rgba(116, 132, 158, 0.08), transparent 24%),
    radial-gradient(circle at 80% 75%, rgba(74, 84, 98, 0.08), transparent 26%),
    linear-gradient(180deg, rgba(27, 31, 38, 0.98), rgba(18, 21, 27, 0.98));
  overflow: visible;
}

.board-stage::before {
  content: "КТО Я?";
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  font-family: "Rubik Mono One", monospace;
  font-size: clamp(2.2rem, 8vw, 5.4rem);
  line-height: 1;
  letter-spacing: -0.06em;
  color: rgba(255, 255, 255, 0.04);
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}

.slots-grid {
  --seat-size: 220px;
  display: grid;
  grid-template-columns: repeat(var(--slot-columns, 4), var(--seat-size));
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  justify-content: center;
  justify-items: center;
  gap: 18px;
  min-height: 0;
  position: relative;
  z-index: 1;
}

.seat-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 156px auto;
  width: var(--seat-size);
  max-width: 100%;
  gap: 10px;
  min-height: 0;
  padding: 12px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.94), rgba(247, 239, 229, 0.88));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 16px 30px rgba(0, 0, 0, 0.12);
  transition: box-shadow 0.24s ease, border-color 0.24s ease;
  align-content: start;
}

.seat-card--empty {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 10px 24px rgba(0, 0, 0, 0.14);
}

.seat-card--active {
  border-color: rgba(255, 168, 95, 0.78);
  box-shadow:
    0 0 0 3px rgba(255, 153, 90, 0.34),
    0 0 26px rgba(255, 140, 76, 0.18),
    0 18px 34px rgba(0, 0, 0, 0.18);
  transform: translateY(-2px);
}

.seat-card--guessed {
  box-shadow: 0 0 0 2px rgba(69, 200, 180, 0.46), 0 16px 30px rgba(0, 0, 0, 0.16);
  border-color: rgba(69, 200, 180, 0.36);
}

.seat-card__word {
  min-height: 42px;
  padding: 4px 10px;
  border-radius: 16px;
  border: 1px solid rgba(27, 23, 19, 0.1);
  background: rgba(255, 244, 214, 0.96);
  color: #5a4632;
  font-weight: 800;
  text-align: center;
  display: grid;
  align-items: center;
}

.seat-card--active .seat-card__word {
  border-color: rgba(255, 171, 103, 0.9);
  background: linear-gradient(180deg, rgba(255, 244, 214, 0.98), rgba(255, 232, 186, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 10px 20px rgba(255, 153, 90, 0.16);
}

.seat-card--active .seat-card__name {
  border-color: rgba(255, 171, 103, 0.36);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 245, 231, 0.8));
}

.seat-card__word-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.seat-card__word-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding-left: 36px;
  padding-right: 36px;
}

.seat-card__word-label {
  min-width: 0;
  text-align: center;
  line-height: 1.3;
  display: block;
}

.seat-card__word--assignable {
  cursor: pointer;
  background: linear-gradient(135deg, rgba(255, 244, 214, 0.98), rgba(255, 235, 194, 0.98));
  border-color: rgba(255, 183, 122, 0.46);
}

.seat-card__word-row--assignable {
  cursor: pointer;
}

.seat-card__word-input {
  min-width: 0;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid rgba(27, 23, 19, 0.12);
  border-radius: 12px;
  outline: none;
  background: rgba(255, 255, 255, 0.82);
  color: #5a4632;
  font-size: 0.92rem;
  font-weight: 700;
}

.seat-card__word-save {
  min-width: 34px;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid rgba(27, 23, 19, 0.12);
  border-radius: 10px;
  background: rgba(227, 109, 51, 0.16);
  color: #5a4632;
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}

.seat-card__word-save:disabled {
  cursor: default;
}

.seat-card__word-save--saved {
  background: rgba(42, 142, 130, 0.16);
  color: #2a6d64;
}

.seat-card__word-save--dirty {
  background: rgba(227, 109, 51, 0.2);
  color: #7a461e;
}

.seat-card__word-edit {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 183, 122, 0.84);
  border-radius: 10px;
  background: linear-gradient(135deg, #ff9a57, #ffb777);
  color: #fff;
  box-shadow: 0 8px 18px rgba(227, 109, 51, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.seat-card__word-edit svg {
  width: 14px;
  height: 14px;
}

.seat-card__word-edit:hover {
  background: linear-gradient(135deg, #ffa869, #ffc58d);
  border-color: rgba(255, 198, 139, 0.92);
}

.seat-card__word-edit:active {
  transform: translateY(calc(-50% + 1px)) scale(0.98);
}

.seat-card__word--empty {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.64);
}

.seat-card__word--revealed {
  background: linear-gradient(135deg, rgba(66, 177, 132, 0.26), rgba(116, 232, 165, 0.2));
  border-color: rgba(66, 177, 132, 0.42);
  color: #1f5d46;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.seat-card__camera {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 156px;
  height: 156px;
  padding: 6px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background:
    radial-gradient(circle at 20% 18%, rgba(91, 161, 255, 0.16), transparent 35%),
    radial-gradient(circle at 82% 84%, rgba(255, 161, 93, 0.14), transparent 32%),
    rgba(19, 23, 31, 0.94);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 10px 22px rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.seat-card__media-frame {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  overflow: hidden;
  background: #13171f;
}

.seat-card__camera--empty {
  font-size: 2rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.72);
  background:
    radial-gradient(circle at 25% 20%, rgba(91, 161, 255, 0.2), transparent 30%),
    linear-gradient(180deg, rgba(18, 24, 33, 0.96), rgba(15, 20, 28, 0.98));
}

.seat-card__avatar {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 92px;
  height: 92px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(227, 109, 51, 0.18), rgba(42, 142, 130, 0.18));
  color: #fff4ea;
  font-size: 2rem;
  font-weight: 800;
}

.seat-card__image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  border-radius: 0;
  background: #13171f;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 10px 24px rgba(0, 0, 0, 0.2);
  user-select: none;
  -webkit-user-drag: none;
}

.seat-card__upload {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 183, 122, 0.76);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 154, 87, 0.92), rgba(255, 183, 119, 0.92));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(227, 109, 51, 0.2);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  backdrop-filter: blur(6px);
}

.seat-card__upload--notes {
  left: 12px;
  right: auto;
  background: linear-gradient(135deg, rgba(57, 125, 255, 0.92), rgba(103, 171, 255, 0.92));
  border-color: rgba(140, 195, 255, 0.76);
  box-shadow: 0 8px 18px rgba(57, 125, 255, 0.18);
}

.seat-card__upload--notes:hover {
  box-shadow: 0 10px 20px rgba(57, 125, 255, 0.22);
}

.seat-card__upload:hover {
  filter: brightness(1.05);
  box-shadow: 0 10px 20px rgba(227, 109, 51, 0.24);
}

.seat-card__upload:active {
  transform: translateY(1px) scale(0.98);
}

.seat-card__upload svg {
  width: 15px;
  height: 15px;
}

.seat-card__name {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.72);
  font-weight: 800;
  text-align: center;
  line-height: 1.2;
  align-self: end;
}

.seat-card__name-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  opacity: 0.9;
}

.seat-card__name-icon svg {
  width: 15px;
  height: 15px;
}

.seat-card__name-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.winner-banner {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(245, 214, 135, 0.3);
  border: 1px solid rgba(245, 214, 135, 0.6);
  font-weight: 800;
}

.winner-banner--inline {
  padding: 0 12px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-self: start;
}

.notes-sheet {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.48);
}

.notes-sheet__head {
  display: grid;
  gap: 6px;
}

.notes-sheet__head h4 {
  font-size: 1.15rem;
}

.notes-sheet__input {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  padding: 14px 16px;
  border: 1px solid rgba(27, 23, 19, 0.12);
  border-radius: 16px;
  outline: none;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  line-height: 1.5;
}

.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;
}

.notes-modal {
  inset: 0;
  display: block;
  padding: 0;
  pointer-events: none;
}

.notes-modal .modal__backdrop {
  display: none;
}

.notes-modal .notes-modal__card {
  position: fixed;
  top: var(--notes-y, 96px);
  left: var(--notes-x, calc(100vw - 244px));
  width: min(220px, calc(100vw - 24px)) !important;
  min-width: min(220px, calc(100vw - 24px)) !important;
  max-width: min(220px, calc(100vw - 24px)) !important;
  max-height: min(34vh, 216px);
  padding: 8px;
  border-radius: 14px;
  pointer-events: auto;
  overflow: hidden;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.24);
}

.notes-modal__head {
  cursor: grab;
  user-select: none;
  margin-bottom: 6px;
}

.notes-modal--dragging .notes-modal__head {
  cursor: grabbing;
}

.notes-modal .modal__body {
  max-height: min(24vh, 132px);
  overflow: hidden;
  padding-right: 0;
}

.notes-sheet__input {
  min-height: 116px;
  padding: 7px 9px;
  font-size: 0.82rem;
  border-radius: 12px;
  resize: none;
}

.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: "+";
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(23, 20, 17, 0.08);
}
.help-section[open] summary::after { content: "−"; }
.help-section__content { display: grid; gap: 14px; padding: 0 16px 16px; }
.help-rule strong { font-size: 15px; }
.help-list { margin: 0; padding-left: 22px; display: grid; gap: 8px; }

body[data-theme="dark"] input,
body[data-theme="dark"] .ghost-link,
body[data-theme="dark"] .ghost-button,
body[data-theme="dark"] .code-chip,
body[data-theme="dark"] .icon-chip,
body[data-theme="dark"] .icon-action,
body[data-theme="dark"] .action-button,
body[data-theme="dark"] .mini-chip,
body[data-theme="dark"] .status-pill,
body[data-theme="dark"] .hero__chips span,
body[data-theme="dark"] .seat-card,
body[data-theme="dark"] .seat-card__name,
body[data-theme="dark"] .modal__card,
body[data-theme="dark"] .help-section {
  background: rgba(34, 40, 49, 0.94);
  border-color: rgba(245, 239, 230, 0.1);
  color: #f5efe6;
  box-shadow: none;
}

body[data-theme="dark"] .board-stage {
  background:
    radial-gradient(circle at 20% 20%, rgba(114, 141, 184, 0.08), transparent 24%),
    radial-gradient(circle at 80% 75%, rgba(94, 106, 130, 0.08), transparent 26%),
    linear-gradient(180deg, rgba(24, 28, 36, 0.98), rgba(14, 17, 22, 0.98));
  border-color: rgba(245, 239, 230, 0.08);
}

body[data-theme="dark"] .seat-card--empty {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.025),
    0 12px 24px rgba(0, 0, 0, 0.18);
}

body[data-theme="dark"] .seat-card__word {
  background: rgba(255, 243, 211, 0.96);
  color: #5a4632;
}

body[data-theme="dark"] .seat-card--active {
  border-color: rgba(255, 145, 77, 0.68);
  box-shadow:
    0 0 0 3px rgba(255, 141, 84, 0.26),
    0 0 28px rgba(255, 141, 84, 0.16),
    0 16px 30px rgba(0, 0, 0, 0.28);
}

body[data-theme="dark"] .seat-card--active .seat-card__word {
  border-color: rgba(255, 171, 103, 0.72);
  background: linear-gradient(180deg, rgba(255, 243, 211, 0.98), rgba(255, 227, 175, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 10px 20px rgba(255, 141, 84, 0.14);
}

body[data-theme="dark"] .action-button--accent {
  background: linear-gradient(135deg, #2ea795, #45c8b4);
  color: #fff;
}

body[data-theme="dark"] .seat-card__word-input {
  background: rgba(255, 255, 255, 0.82);
  color: #5a4632;
  border-color: rgba(27, 23, 19, 0.12);
}

body[data-theme="dark"] .seat-card__word-save {
  background: rgba(227, 109, 51, 0.16);
  color: #5a4632;
  border-color: rgba(27, 23, 19, 0.12);
}

body[data-theme="dark"] .seat-card__word-save--saved {
  background: rgba(42, 142, 130, 0.2);
  color: #2a6d64;
}

body[data-theme="dark"] .seat-card__word-save--dirty {
  background: rgba(227, 109, 51, 0.22);
  color: #7a461e;
}

body[data-theme="dark"] .seat-card__word-edit {
  background: linear-gradient(135deg, #ff8d54, #ffb17d);
  border-color: rgba(255, 141, 84, 0.82);
  color: #fff;
  box-shadow: 0 12px 24px rgba(255, 141, 84, 0.18);
}

body[data-theme="dark"] .seat-card__word-edit:hover {
  background: linear-gradient(135deg, #ff9a67, #ffc093);
  border-color: rgba(255, 141, 84, 0.92);
}

body[data-theme="dark"] .seat-card__word--empty {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.05);
  color: #d0c7bc;
}

body[data-theme="dark"] .seat-card__camera--empty {
  background:
    radial-gradient(circle at 25% 18%, rgba(91, 161, 255, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(20, 26, 35, 0.98), rgba(15, 20, 28, 1));
}

body[data-theme="dark"] .seat-card__name {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.06);
}

body[data-theme="dark"] .seat-card__word--revealed {
  background: linear-gradient(135deg, rgba(52, 165, 147, 0.28), rgba(71, 200, 158, 0.18));
  border-color: rgba(71, 200, 158, 0.4);
  color: #d9fff0;
}

body[data-theme="dark"] .seat-card__word--assignable {
  background: linear-gradient(135deg, rgba(255, 241, 204, 0.96), rgba(255, 229, 180, 0.94));
  border-color: rgba(255, 171, 94, 0.5);
  color: #5a4632;
}

body[data-theme="dark"] .notes-sheet,
body[data-theme="dark"] .notes-sheet__input {
  background: rgba(34, 40, 49, 0.94);
  border-color: rgba(245, 239, 230, 0.1);
  color: #f5efe6;
}

body[data-theme="dark"] .notes-modal__card {
  background: rgba(31, 37, 46, 0.98);
  border-color: rgba(245, 239, 230, 0.1);
}

body[data-theme="dark"] .modal__backdrop {
  background: rgba(10, 12, 16, 0.56);
}

body[data-theme="dark"] .hero__note,
body[data-theme="dark"] .auth-card__head p:last-child,
body[data-theme="dark"] .auth-status,
body[data-theme="dark"] .current-card__hint,
body[data-theme="dark"] .modal__body p,
body[data-theme="dark"] .help-list {
  color: #b8b0a7;
}

@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); }
  30%, 100% { opacity: 0; transform: scale(0.4); }
}

@keyframes icon-chip-check {
  0%, 20% { opacity: 0; transform: scale(0.55); }
  34%, 78% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.75); }
}

@media (max-width: 1180px) {
  .slots-grid {
    grid-template-columns: repeat(3, var(--seat-size));
  }
}

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

  .hero__aside {
    justify-items: start;
    text-align: left;
  }

  .board-stage {
    min-height: 0;
  }

  .board-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .board-head__actions,
  .board-head__meta {
    justify-self: start;
  }
}

@media (max-width: 760px) {
  .whoami-shell {
    width: min(100% - 16px, 1280px);
    padding-top: 72px;
  }

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

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

  .topbar__actions {
    justify-content: flex-start;
  }

  .slots-grid {
    grid-template-columns: repeat(2, var(--seat-size));
    gap: 12px;
    min-height: 0;
  }

  .seat-card {
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .slots-grid {
    --seat-size: min(292px, calc(100vw - 84px));
    grid-template-columns: var(--seat-size);
  }
}

/* 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;
}
