/* Hallmark · shape: app screen · genre: playful · theme: custom · redesign: full
 * paper: oklch(0.572 0.232 28) · accent: oklch(0.55 0.23 26) · display: Vazirmatn · body: Red Hat Text
 * nav: compact utility topbar · signature: move-up-to-reveal sliding sleeve card · states: setup, pass, discuss, vote, result, online-lobby
 * axes: mid/grotesk-heavy/chromatic-red · posture: drenched · contrast: pass · v2.0.0 */
/* Hallmark · pre-emit critique: P9 H9 E9 S9 R9 V9 · weakest: S, anchored every spacing token strictly on the 4px grid */
@import url("./tokens.css");
@import url("./base.css");

html,
body {
  overflow-x: clip;
}

body {
  background: var(--color-canvas);
  color: var(--color-on-canvas);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

body.burst-bg {
  background-color: var(--color-canvas);
  background-image: repeating-conic-gradient(
    from 0deg at 50% 42%,
    var(--color-canvas) 0deg 15deg,
    var(--color-canvas-deep) 15deg 30deg
  );
}

button {
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  padding: 0;
}

.app-shell {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  min-height: 100dvh;
  padding: max(var(--space-md), env(safe-area-inset-top)) var(--space-md) max(var(--space-xl), env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.noscript-fallback {
  margin-block: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* === Top Bar (on Vermilion Canvas) === */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  min-height: 44px;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-avatar);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-on-canvas);
  background: transparent;
  transition: background-color var(--dur-micro) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}

.icon-btn:hover {
  background: var(--color-on-canvas-dim);
}

.icon-btn:active {
  transform: scale(0.95);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--color-focus-canvas);
  outline-offset: 2px;
}

.lang-btn {
  min-height: 44px;
  padding: 0 var(--space-sm);
  border-radius: var(--radius-avatar);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-on-canvas);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--dur-micro) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}

.lang-btn:hover {
  background: var(--color-on-canvas-dim);
}

.lang-btn:active {
  transform: scale(0.96);
}

.lang-btn:focus-visible {
  outline: 2px solid var(--color-focus-canvas);
  outline-offset: 2px;
}

/* Mode Segmented Switch on Top Bar */
.mode-switch {
  display: inline-flex;
  padding: var(--space-2xs);
  border-radius: var(--radius-sub);
  background: var(--color-canvas-deep);
  gap: var(--space-2xs);
}

.mode-switch-btn {
  min-height: 36px;
  padding: 0 var(--space-sm);
  border-radius: var(--radius-avatar);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-on-canvas-soft);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  white-space: nowrap;
  transition: background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out);
}

.mode-switch-btn.active {
  background: var(--color-paper);
  color: var(--color-ink);
}

.mode-switch-btn:disabled {
  color: var(--color-on-canvas-dim-hover);
  cursor: not-allowed;
}

.mode-switch-btn:focus-visible {
  outline: 2px solid var(--color-focus-canvas);
  outline-offset: 2px;
}

/* Narrow phones (375px and below): keep the mode switch on one line */
@media (max-width: 400px) {
  .topbar-right {
    gap: var(--space-3xs);
  }

  .icon-btn {
    width: 40px;
  }

  .lang-btn {
    padding: 0 var(--space-xs);
  }

  .mode-switch-btn {
    padding: 0 var(--space-xs);
  }
}

@media (max-width: 350px) {
  .mode-switch-btn {
    font-size: var(--text-xs);
  }
}

/* === Bold Wordmark Header === */
.title-block {
  text-align: center;
  padding: var(--space-xs) var(--space-xs) var(--space-2xs);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2xs);
}

.wordmark {
  font-family: var(--font-display);
  font-size: var(--text-wordmark);
  font-weight: 900;
  line-height: 0.96;
  letter-spacing: var(--tracking-display);
  color: var(--color-on-canvas);
}

.wordmark-sub {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-on-canvas-soft);
}

.canvas-caption {
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-on-canvas-soft);
  line-height: 1.45;
  padding-inline: var(--space-md);
}

/* === Grouped White Settings Card === */
.sheet-card {
  background: var(--color-paper);
  color: var(--color-ink);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.sheet-card-padded {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.sheet-row {
  width: 100%;
  min-height: 60px;
  padding: var(--space-sm) var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  text-align: left;
  background: var(--color-paper);
  color: var(--color-ink);
  border-bottom: var(--rule-hair) solid var(--color-rule);
  transition: background-color var(--dur-micro) var(--ease-out);
}

.sheet-row:last-child {
  border-bottom: none;
}

button.sheet-row:hover:not(:disabled) {
  background: var(--color-paper-2);
}

button.sheet-row:active:not(:disabled) {
  background: var(--color-paper-3);
}

button.sheet-row:disabled {
  color: var(--color-muted);
  cursor: not-allowed;
}

button.sheet-row:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: -3px;
}

.row-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}

.row-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-avatar);
  background: var(--color-paper-2);
  color: var(--color-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.row-icon.icon-green {
  background: var(--color-success-soft);
  color: var(--color-success-deep);
}

.row-icon.icon-lore {
  background: var(--color-lore-bg);
  color: var(--color-lore);
}

.row-label {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-ink);
  line-height: 1.25;
}

.row-sub {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-muted);
  margin-top: var(--space-3xs);
}

.row-right {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--color-ink-2);
  font-size: var(--text-md);
  font-weight: 500;
  flex-shrink: 0;
  max-width: 52%;
}

.row-value-trunc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === Chunky Toggle Switch === */
.toggle-switch {
  position: relative;
  width: 56px;
  height: 32px;
  flex-shrink: 0;
  display: inline-block;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: var(--color-switch-off);
  border: 2px solid var(--color-switch-border);
  cursor: pointer;
  transition: background-color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out);
}

.toggle-track::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 20px;
  height: 20px;
  border-radius: 10px;
  background: var(--color-ink);
  transition: transform var(--dur-short) var(--ease-out);
}

.toggle-switch input:checked + .toggle-track {
  background: var(--color-success);
  border-color: var(--color-success);
}

.toggle-switch input:checked + .toggle-track::before {
  transform: translateX(24px);
}

.toggle-switch input:focus-visible + .toggle-track {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.toggle-switch input:disabled + .toggle-track {
  background: var(--color-paper-3);
  border-color: var(--color-rule);
  cursor: not-allowed;
}

/* === Buttons === */
.cta-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding-top: var(--space-xs);
}

.btn-cta {
  min-height: 56px;
  min-width: 200px;
  padding: 0 var(--space-xl);
  border-radius: var(--radius-pill);
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 800;
  box-shadow: var(--shadow-cta);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  transition: transform var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out);
}

.btn-cta:hover:not(:disabled) {
  background: var(--color-paper-2);
}

.btn-cta:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-cta:disabled {
  background: var(--color-paper-3);
  color: var(--color-muted);
  box-shadow: none;
  cursor: not-allowed;
}

.btn-cta:focus-visible {
  outline: 2px solid var(--color-focus-canvas);
  outline-offset: 3px;
}

.btn-cta-wide {
  width: 100%;
}

.btn-solid {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--space-lg);
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-accent-ink);
  font-size: var(--text-md);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  transition: background-color var(--dur-micro) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}

.btn-solid:hover:not(:disabled) {
  background: var(--color-accent-hover);
}

.btn-solid:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-solid:disabled {
  background: var(--color-paper-3);
  color: var(--color-muted);
  cursor: not-allowed;
}

.btn-solid:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.btn-ink {
  background: transparent;
  color: var(--color-ink);
  border: 2px solid var(--color-ink);
}

.btn-ink:hover:not(:disabled) {
  background: var(--color-paper-2);
}

.btn-green {
  background: transparent;
  color: var(--color-success-deep);
  border: 2px solid var(--color-success-deep);
}

.btn-green:hover:not(:disabled) {
  background: var(--color-success-soft);
}

.btn-quiet {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-md);
  border-radius: var(--radius-pill);
  background: var(--color-paper-2);
  color: var(--color-ink);
  border: var(--rule-hair) solid var(--color-rule);
  font-size: var(--text-sm);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  transition: background-color var(--dur-micro) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}

.btn-quiet:hover:not(:disabled) {
  background: var(--color-paper-3);
}

.btn-quiet:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-quiet:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.btn-quiet-canvas {
  min-height: 44px;
  padding: 0 var(--space-md);
  border-radius: var(--radius-pill);
  background: transparent;
  border: var(--rule-hair) solid var(--color-on-canvas-dim-hover);
  color: var(--color-on-canvas);
  font-size: var(--text-sm);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  transition: background-color var(--dur-micro) var(--ease-out);
}

.btn-quiet-canvas:hover {
  background: var(--color-on-canvas-dim-hover);
}

.btn-quiet-canvas:focus-visible {
  outline: 2px solid var(--color-focus-canvas);
  outline-offset: 2px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  width: 100%;
}

.btn-row > button {
  flex: 1 1 auto;
  white-space: nowrap;
}

.btn-compact {
  width: auto;
  min-height: 44px;
  padding: 0 var(--space-md);
  flex-shrink: 0;
  white-space: nowrap;
}

/* === Inputs === */
.input-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  width: 100%;
}

.input-row > .field {
  flex: 1 1 9rem;
  width: auto;
  min-width: 0;
}

.input-row > .btn-compact {
  flex: 1 0 auto;
}

.field {
  width: 100%;
  min-height: 44px;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-input);
  background: var(--color-paper-2);
  border: var(--rule-hair) solid var(--color-rule);
  color: var(--color-ink);
  font-size: var(--text-md);
  outline: 2px solid transparent;
  outline-offset: 1px;
}

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

.field:focus-visible {
  outline-color: var(--color-focus);
  background: var(--color-paper);
}

.field-textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.45;
}

.field-code {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-xl);
  font-variant-numeric: tabular-nums;
}

/* === Stepper === */
.stepper {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--color-paper-2);
  border-radius: var(--radius-sub);
  padding: var(--space-2xs);
}

.stepper-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-avatar);
  background: var(--color-paper);
  color: var(--color-ink);
  border: var(--rule-hair) solid var(--color-rule);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--dur-micro) var(--ease-out);
}

.stepper-btn:hover:not(:disabled) {
  background: var(--color-paper-3);
}

.stepper-btn:disabled {
  background: var(--color-paper-2);
  color: var(--color-muted);
  border-color: var(--color-rule);
  cursor: not-allowed;
}

.stepper-btn:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.stepper-val {
  min-width: 24px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-ink);
}

/* === Signature: Move Up to Reveal Sliding Sleeve Card === */
.pass-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
}

.pass-progress {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-on-canvas-soft);
  background: var(--color-on-canvas-dim);
  padding: var(--space-2xs) var(--space-sm);
  border-radius: var(--radius-sub);
}

.reveal-stage {
  position: relative;
  width: 100%;
  max-width: 340px;
  height: 416px;
  border-radius: var(--radius-card);
  background: var(--color-paper);
  box-shadow: var(--shadow-sleeve);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.reveal-under {
  position: absolute;
  inset: 0;
  padding: var(--space-lg) var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  text-align: center;
  background: var(--color-paper);
  color: var(--color-ink);
}

.reveal-under-centered {
  justify-content: center;
}

.status-circle {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sub);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-paper);
}

.status-circle.is-impostor {
  background: var(--color-accent);
}

.status-circle.is-crew {
  background: var(--color-success-deep);
}

.reveal-role-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 900;
  color: var(--color-ink);
  line-height: 1.1;
  overflow-wrap: break-word;
  max-width: 100%;
}

.reveal-sub {
  font-size: var(--text-sm);
  color: var(--color-ink-2);
  max-width: 28ch;
}

.reveal-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-xs);
}

.meta-tag {
  padding: var(--space-2xs) var(--space-sm);
  border-radius: var(--radius-sub);
  background: var(--color-paper-2);
  color: var(--color-ink);
  font-size: var(--text-sm);
  font-weight: 600;
}

.meta-tag.tag-hint {
  background: var(--color-lore-bg);
  color: var(--color-lore);
}

.lore-box {
  width: 100%;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sub);
  background: var(--color-lore-bg);
  color: var(--color-ink);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: left;
  line-height: 1.4;
}

.lore-box strong {
  color: var(--color-lore);
}

/* Top Sliding Sleeve */
.reveal-sleeve {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
  border: 3px solid var(--color-sleeve-rim);
  background: linear-gradient(180deg, var(--color-sleeve-top) 0%, var(--color-sleeve-bottom) 100%);
  color: var(--color-on-canvas);
  padding: var(--space-lg) var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
  z-index: var(--z-raised);
  transition: transform var(--dur-long) var(--ease-out);
}

.reveal-sleeve.dragging {
  transition: none;
  cursor: grabbing;
}

.reveal-sleeve.revealed {
  transform: translateY(-64%);
}

.reveal-sleeve:focus-visible {
  outline: 3px solid var(--color-focus-canvas);
  outline-offset: -6px;
}

.sleeve-name {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 900;
  letter-spacing: var(--tracking-display);
  line-height: 1;
  color: var(--color-on-canvas);
  text-align: center;
  overflow-wrap: break-word;
  max-width: 100%;
}

.sleeve-avatar-svg {
  width: 148px;
  height: 148px;
  color: var(--color-on-canvas);
}

.sleeve-cue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2xs);
  color: var(--color-on-canvas);
  font-size: var(--text-md);
  font-weight: 700;
}

/* === Discussion & Timer === */
.starter-card {
  background: var(--color-paper);
  color: var(--color-ink);
  border-radius: var(--radius-card);
  padding: var(--space-lg) var(--space-md);
  text-align: center;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.starter-heading {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 900;
  color: var(--color-ink);
}

.twist-banner {
  background: var(--color-lore-bg);
  color: var(--color-ink);
  border-radius: var(--radius-card);
  padding: var(--space-md);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.twist-label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-lore);
}

.twist-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--color-ink);
}

.timer-card {
  background: var(--color-paper);
  color: var(--color-ink);
  border-radius: var(--radius-card);
  padding: var(--space-lg) var(--space-md);
  text-align: center;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.timer-digits {
  font-family: var(--font-display);
  font-size: var(--text-wordmark);
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--color-ink);
}

.timer-digits.urgent {
  color: var(--color-accent);
}

.timer-track {
  width: 100%;
  height: 8px;
  border-radius: var(--radius-sub);
  background: var(--color-paper-3);
  overflow: hidden;
}

.timer-fill {
  width: 100%;
  height: 100%;
  background: var(--color-success);
  transform-origin: left center;
  transform: scaleX(1);
  transition: transform var(--dur-long) linear;
}

.timer-fill.urgent {
  background: var(--color-accent);
}

/* === Avatars, Player Lists, Categories & Voting === */
.avatar-badge {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-avatar);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--color-paper);
  flex-shrink: 0;
}

.avatar-0 { background: var(--avatar-0); }
.avatar-1 { background: var(--avatar-1); }
.avatar-2 { background: var(--avatar-2); }
.avatar-3 { background: var(--avatar-3); }
.avatar-4 { background: var(--avatar-4); }
.avatar-5 { background: var(--avatar-5); }

.vote-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-xs);
}

.vote-option {
  min-height: 84px;
  padding: var(--space-sm);
  border-radius: var(--radius-sub);
  background: var(--color-paper-2);
  color: var(--color-ink);
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  font-weight: 700;
  transition: background-color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}

.vote-option:hover {
  background: var(--color-paper-3);
}

.vote-option:active {
  transform: scale(0.97);
}

.vote-option.selected {
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
}

.vote-option:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-xs);
}

.cat-tile {
  min-height: 64px;
  padding: var(--space-sm);
  border-radius: var(--radius-sub);
  background: var(--color-paper-2);
  color: var(--color-ink);
  border: 2px solid transparent;
  text-align: left;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  transition: background-color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out);
}

.cat-tile:hover:not(:disabled) {
  background: var(--color-paper-3);
}

.cat-tile.selected {
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
}

.cat-tile:disabled {
  color: var(--color-muted);
  cursor: not-allowed;
}

.cat-tile:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.cat-tile-icon {
  color: var(--color-accent);
  flex-shrink: 0;
}

.cat-tile-name {
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.2;
}

.cat-tile-count {
  font-size: var(--text-xs);
  color: var(--color-muted);
}

/* === Result & Scoreboard === */
.result-card {
  background: var(--color-paper);
  color: var(--color-ink);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  text-align: center;
}

.result-head {
  padding: var(--space-lg) var(--space-md);
  color: var(--color-paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.result-head.win-crew {
  background: var(--color-success-deep);
}

.result-head.win-imposter {
  background: var(--color-ink);
}

.result-head.win-chaos {
  background: var(--color-lore);
}

.result-headline {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 900;
  line-height: 1.1;
}

.result-body {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.secret-reveal-box {
  padding: var(--space-md);
  border-radius: var(--radius-sub);
  background: var(--color-paper-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.secret-reveal-word {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 900;
  color: var(--color-ink);
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: var(--rule-hair) solid var(--color-rule);
}

.score-row:last-child {
  border-bottom: none;
}

.score-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
  font-weight: 600;
}

.score-num {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--color-ink);
}

.score-delta {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-success-deep);
  margin-left: var(--space-2xs);
}

.role-chip {
  white-space: nowrap;
  font-size: var(--text-xs);
  font-weight: 700;
  padding: var(--space-3xs) var(--space-xs);
  border-radius: var(--radius-avatar);
  background: var(--color-paper-2);
  color: var(--color-ink-2);
}

.role-chip.is-imposter {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

.role-chip.is-undercover {
  background: var(--color-lore-bg);
  color: var(--color-lore);
}

.role-chip.is-host {
  background: var(--color-success-soft);
  color: var(--color-success-deep);
}

.role-chip.is-offline {
  background: var(--color-paper-3);
  color: var(--color-muted);
}

/* === Connection lost notice (live rooms) === */
.conn-banner {
  background: var(--color-ink);
  color: var(--color-paper);
  border-radius: var(--radius-sub);
  padding: var(--space-xs) var(--space-md);
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: center;
}

/* === Room Code Header Card === */
.room-bar {
  background: var(--color-paper);
  color: var(--color-ink);
  border-radius: var(--radius-card);
  padding: var(--space-sm) var(--space-md);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.room-code-text {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--color-ink);
  line-height: 1.1;
}

/* === Sheet Modal (Players, Categories, Lore, Rules, Extra Settings) === */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: var(--color-scrim);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: var(--space-md);
  z-index: var(--z-modal);
}

.sheet-dialog {
  width: 100%;
  max-width: var(--container);
  max-height: 86dvh;
  overflow-y: auto;
  background: var(--color-paper);
  color: var(--color-ink);
  border-radius: var(--radius-card);
  padding: var(--space-md);
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.dialog-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--color-ink);
}

.dialog-close {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-avatar);
  background: transparent;
  color: var(--color-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dialog-close:hover {
  background: var(--color-paper-2);
}

.dialog-close:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* Tabs & Preset Pills */
.tab-strip {
  display: flex;
  gap: var(--space-2xs);
  padding: var(--space-2xs);
  background: var(--color-paper-2);
  border-radius: var(--radius-sub);
}

.tab-item {
  flex: 1;
  min-height: 36px;
  padding: 0 var(--space-xs);
  border-radius: var(--radius-avatar);
  font-size: var(--text-sm);
  font-weight: 700;
  white-space: nowrap;
  color: var(--color-ink-2);
  transition: background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out);
}

.tab-item.active {
  background: var(--color-paper);
  color: var(--color-ink);
  box-shadow: var(--shadow-card);
}

.tab-item:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.preset-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.preset-btn {
  min-height: 36px;
  padding: 0 var(--space-sm);
  border-radius: var(--radius-pill);
  background: var(--color-paper-2);
  color: var(--color-ink);
  border: var(--rule-hair) solid var(--color-rule);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: background-color var(--dur-micro) var(--ease-out);
}

.preset-btn:hover {
  background: var(--color-paper-3);
}

.preset-btn.is-featured {
  background: var(--color-accent-soft);
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.preset-btn:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.list-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sub);
  background: var(--color-paper-2);
}

.icon-remove {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-avatar);
  background: transparent;
  color: var(--color-ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-remove:hover {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

.icon-remove:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.rules-list {
  margin: 0;
  padding-left: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  color: var(--color-ink);
  font-size: var(--text-md);
}

.section-heading {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--color-ink);
}

.muted-text {
  font-size: var(--text-sm);
  color: var(--color-ink-2);
}

.error-text {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-error);
}

/* === Toast === */
.toast-root {
  position: fixed;
  bottom: max(var(--space-md), env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  width: min(92vw, 380px);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  pointer-events: none;
}

.toast {
  background: var(--color-ink);
  color: var(--color-paper);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sub);
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow-modal);
}

.toast.error {
  background: var(--color-error);
  color: var(--color-paper);
}

@media (min-width: 640px) {
  .sheet-backdrop {
    align-items: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal-sleeve,
  .toggle-track,
  .toggle-track::before,
  .timer-fill,
  .btn-cta,
  .btn-solid,
  .btn-quiet,
  .icon-btn {
    transition: none;
  }
}
