/* ════════════════════════════════════════════════════════════
   Мафия · Theatrical Poster (Style A)
   — mobile-first editorial redesign
   — Abril Fatface display · Archivo UI · JetBrains Mono meta
   — red (vermillion) is a typographic weapon, never a wash
   ════════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;

  --bg:          #f4efe7;   /* bone paper */
  --paper:       #faf6ed;   /* card surface */
  --ink:         #0f0d0c;   /* primary text */
  --ink-2:       #2a2621;   /* secondary text */
  --dim:         #6b6458;   /* meta, captions */
  --red:         #c8102e;   /* vermillion CTA / accent */
  --red-hot:     #ff2e49;   /* pulsing high */
  --red-ink:     #8c0c20;   /* red as small text */
  --maniac:      #7a4a1b;   /* sepia-brown for the lone-wolf role */
  --line:        rgba(15, 13, 12, 0.22);
  --line-soft:   rgba(15, 13, 12, 0.10);
  --overlay:     rgba(15, 13, 12, 0.06);

  --font-display: 'Abril Fatface', Georgia, 'Times New Roman', serif;
  --font-sans:    'Archivo', 'Inter', -apple-system, BlinkMacSystemFont,
                  'Segoe UI', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Noto Sans Symbols 2', ui-monospace,
                  Menlo, Consolas, monospace;
  --font-symbols: 'Noto Sans Symbols 2', 'Segoe UI Symbol', 'Apple Symbols';

  --ease-out:       cubic-bezier(.2, .7, .2, 1);
  --ease-overshoot: cubic-bezier(.2, .8, .2, 1);

  --bar-h:   54px;
}

:root[data-theme='dark'] {
  color-scheme: dark;

  --bg:        #0e0b0a;
  --paper:     #1a140f;
  --ink:       #f4efe7;
  --ink-2:     #d9d2c4;
  --dim:       #9a9184;
  --red:       #ef4b60;
  --red-hot:   #ff7a8d;
  --red-ink:   #ff6b7e;
  --maniac:    #c78a4e;
  --line:      rgba(244, 239, 231, 0.22);
  --line-soft: rgba(244, 239, 231, 0.10);
  --overlay:   rgba(244, 239, 231, 0.06);
}

/* ─── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

body {
  min-height: 100vh;
  padding-top: var(--bar-h);
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

input, textarea { user-select: text; -webkit-user-select: text; }

button {
  font-family: inherit;
  color: inherit;
}

input, textarea {
  font-family: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.t-center { text-align: center; }
.mb-16 { margin-bottom: 16px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ─── Top bar ───────────────────────────────────────────────── */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--bar-h);
  padding: 0 14px;
  padding-top: env(safe-area-inset-top, 0px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  z-index: 50;
  font-family: var(--font-sans);
}

.top-bar-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  min-width: 0;
}

.top-bar-brand .brand-mark {
  color: var(--red);
  flex-shrink: 0;
}

.top-bar-brand .brand-word {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.01em;
}

.top-bar-brand .brand-accent { color: var(--red); }

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

.locale-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--line);
  background: transparent;
  padding: 0;
  height: 32px;
}

.locale-btn {
  min-width: 32px;
  height: 30px;
  padding: 0 8px;
  border: none;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  line-height: 1;
  cursor: pointer;
}

.locale-btn:first-child { border-left: none; }

.locale-btn.active {
  color: #fff;
  background: var(--red);
}

.theme-toggle {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1;
  padding: 0;
}

/* ─── App container ─────────────────────────────────────────── */
.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 0;
}

.screen {
  padding: 20px 20px 24px;
  min-height: calc(100vh - var(--bar-h));
  display: flex;
  flex-direction: column;
}

/* ─── Typographic primitives ────────────────────────────────── */
.ornament {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.32em;
  color: var(--red);
  font-weight: 500;
  text-transform: uppercase;
  margin: 4px 0 8px;
}

.ornament span { display: inline-block; }

.hero-wrap { margin-top: 6px; }

.year {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--dim);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.hero {
  font-family: var(--font-display);
  font-size: clamp(64px, 22vw, 104px);
  line-height: 0.86;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin: 0;
  font-weight: 400;
}

.hero em {
  display: block;
  font-style: italic;
  font-size: 0.5em;
  color: var(--ink-2);
  line-height: 1;
  margin-top: 6px;
}

.tag { margin-top: 14px; }

.subtitle {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  line-height: 1.35;
  color: var(--ink-2);
  margin: 0;
}

/* ─── Sections ──────────────────────────────────────────────── */
.section { margin-top: 26px; }

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.section-head .num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--red);
  font-weight: 500;
  letter-spacing: 0.05em;
}

.section-head .label {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1;
}

.section-head .line {
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ─── Home · counter ────────────────────────────────────────── */
.counter {
  border: 1px solid var(--line);
  background: var(--paper);
  display: flex;
  align-items: stretch;
}

.counter-btn {
  width: 72px;
  background: transparent;
  color: var(--ink-2);
  border: none;
  border-right: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 44px;
  line-height: 1;
  cursor: pointer;
}

.counter-btn:last-child {
  border-right: none;
  border-left: 1px solid var(--line);
  background: var(--red);
  color: #fff;
}

.counter-btn:disabled { opacity: 0.35; cursor: default; }

.counter > div {
  flex: 1;
  text-align: center;
  padding: 12px 0;
}

.counter-num {
  font-family: var(--font-display);
  font-size: 84px;
  line-height: 0.95;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.counter-label {
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 700;
  margin-top: 2px;
}

/* ─── Home · role distribution ──────────────────────────────── */
.role-dist {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.role-dist .cell {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  min-width: 0;
  border-top: 1px solid var(--line-soft);
}

.role-dist .cell:nth-child(-n + 2) { border-top: none; }

.role-dist .cell.muted { opacity: 0.45; }

.role-dist .role-icon {
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1;
  width: 24px;
  text-align: center;
  color: var(--ink);
  flex-shrink: 0;
}

.role-dist .role-icon.mafia,
.role-dist .role-icon.don { color: var(--red); }

.role-dist .role-icon.maniac { color: var(--maniac); }

.role-dist .txt { flex: 1; min-width: 0; }

.role-dist .role-name {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-dist .role-count {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--ink);
  min-width: 28px;
  text-align: right;
}

.role-dist .cell:has(.role-icon.mafia) .role-count,
.role-dist .cell:has(.role-icon.don) .role-count {
  color: var(--red);
}

.role-dist .cell:has(.role-icon.maniac) .role-count {
  color: var(--maniac);
}

/* ─── Home · role toggles ───────────────────────────────────── */
.role-toggle {
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}

.role-toggle:last-child { border-bottom: none; }

.role-toggle.disabled { opacity: 0.45; }

.role-toggle-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
  min-height: 48px;
}

.role-toggle .check {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border: 1.5px solid var(--line);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1;
  margin-top: 2px;
  transition: background 150ms var(--ease-out), border-color 150ms var(--ease-out);
}

.role-toggle.active .check {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.role-toggle.active .check::before { content: '✕'; }

.role-toggle .info { flex: 1; min-width: 0; }

.role-toggle .info .name {
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.15;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.role-toggle .info .name .role-icon {
  font-family: var(--font-display);
  color: var(--red);
  font-size: 18px;
}

.role-toggle .info .desc {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--dim);
  margin-top: 3px;
  line-height: 1.45;
}

.role-toggle .info .warn {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--red-ink);
  margin-top: 4px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.role-suboptions {
  margin-top: 14px;
  margin-left: 42px;
}

.suboption-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--dim);
  font-weight: 500;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.suboption-segmented {
  display: flex;
  border: 1px solid var(--line);
  background: var(--paper);
}

.seg-btn {
  flex: 1;
  padding: 10px 6px;
  min-height: 44px;
  background: transparent;
  color: var(--ink-2);
  border: none;
  border-left: 1px solid var(--line);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  line-height: 1.2;
}

.seg-btn:first-child { border-left: none; }

.seg-btn.active {
  background: var(--ink);
  color: var(--bg);
}

/* ─── Resume card ───────────────────────────────────────────── */
.resume-card {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 14px 16px;
  margin-top: 18px;
}

.resume-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  gap: 10px;
}

.resume-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--red);
  font-weight: 500;
  text-transform: uppercase;
}

.resume-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
}

.resume-desc {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--ink);
  line-height: 1.3;
}

.resume-btns {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.resume-card .btn-primary {
  flex: 1;
  min-height: 48px;
  padding: 12px 14px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1;
  width: auto;
  display: inline-block;
}

.resume-card .btn-primary::after { content: none; }

.resume-card .btn-ghost {
  padding: 12px 14px;
  min-height: 48px;
  width: auto;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* ─── Buttons ───────────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  display: block;
  padding: 18px 64px 18px 22px;
  min-height: 60px;
  background: var(--red);
  color: #fff;
  border: none;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: -0.005em;
  line-height: 1.1;
  text-align: left;
  cursor: pointer;
  position: relative;
}

.btn-primary::after {
  content: '→';
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1;
}

.btn-primary:disabled { opacity: 0.45; cursor: default; }

.btn-primary.no-arrow::after { content: none; }

.btn-secondary {
  width: 100%;
  padding: 14px 16px;
  min-height: 52px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
}

.btn-ghost {
  padding: 14px 16px;
  min-height: 48px;
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--line);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
}

/* ─── Names screen ──────────────────────────────────────────── */
.name-inputs { margin-top: 18px; }

.name-input-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 2px 0;
  border-bottom: 1px solid var(--line-soft);
  min-height: 52px;
}

.name-input-row .idx {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--red);
  width: 28px;
  font-weight: 500;
  flex-shrink: 0;
}

.name-input-row input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--ink);
  padding: 10px 0;
  min-height: 44px;
  letter-spacing: -0.005em;
}

.name-input-row input::placeholder {
  color: var(--dim);
  opacity: 1;
}

.roster-clear-row {
  display: flex;
  justify-content: flex-end;
  margin: 8px 0 0;
}

.roster-clear-link {
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  cursor: pointer;
  padding: 6px 0;
}

/* ─── Deal screen ───────────────────────────────────────────── */
/* CH-01 · sticky-bottom contract: .deal-screen is a flex column with
   min-height of the viewport, so the role-card-stage (flex:1) absorbs
   spare space. The bottom hint / action slot sticks to the screen
   floor via margin-top:auto + position:sticky, keeping the CTA in
   reach even if the content scrolls. */
.deal-screen {
  text-align: center;
  min-height: calc(100dvh - var(--bar-h));
}

/* Header is just a small progress kicker ("ИГРОК · 04 / 08") — player name
   lives on the card face itself (front + back), so the header stays static
   through the flip and the card never shifts vertically. */
.deal-header {
  margin-top: 4px;
}

.player-num {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--red);
  font-weight: 500;
  text-transform: uppercase;
  margin-top: 6px;
  transition: color 320ms ease;
}

.player-name-big {
  font-family: var(--font-display);
  font-size: 54px;
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin-top: 8px;
  color: var(--ink);
  transform-origin: center top;
}

.passing-hint {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: var(--dim);
  margin-top: auto;
  line-height: 1.3;
  position: sticky;
  bottom: 0;
  padding: 12px 0 calc(8px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line-soft);
}

.role-card-stage {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  perspective: 1400px;
  position: relative;
}

/* Rotation and lift are split across two layers to avoid the multi-
   keyframe "stall" where a single animation's ease-curve is applied per
   segment, producing a perceived pause at the 50 % midpoint:
     .role-card-lift    → Y-translate + scale (peaks at midpoint)
     .role-card-flipper → pure rotateY (one smooth ease, no midpoint) */
.role-card-lift {
  width: 100%;
  max-width: 320px;
  position: relative;
  z-index: 1;
  transform-style: preserve-3d;
  will-change: transform;
}

.deal-screen.is-flipping .role-card-lift {
  animation: deal-lift 900ms cubic-bezier(.4, 0, .2, 1);
}

@keyframes deal-lift {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-18px) scale(1.035); }
}

.role-card-flipper {
  width: 100%;
  min-height: 400px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 900ms cubic-bezier(.4, 0, .2, 1);
  will-change: transform;
  cursor: pointer;
}

.role-card-flipper.flipped {
  transform: rotateY(-180deg);
  cursor: default;
}

.role-card,
.role-card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.role-card {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 22px 22px 24px;
  transform: rotateY(-180deg);
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 0;
}

.role-card .kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--red);
  font-weight: 500;
  text-transform: uppercase;
}

.role-card .role-emblem {
  font-family: var(--font-display);
  font-size: 42px;
  line-height: 1;
  color: var(--red);
  margin-top: 10px;
}

.role-card .role-title {
  font-family: var(--font-display);
  font-size: 48px;
  line-height: 0.9;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-top: 2px;
}

.role-card .role-side {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--dim);
  font-weight: 500;
  text-transform: uppercase;
  margin-top: 8px;
}

.role-card .divider {
  height: 2px;
  width: 52px;
  background: var(--red);
  margin: 14px 0;
}

.role-card .role-desc {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  line-height: 1.4;
  color: var(--ink-2);
}

.role-card .team-list { margin-top: 16px; }

.role-card .team-list .t-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--dim);
  font-weight: 500;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.role-card .team-list .team-names {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.2;
  color: var(--ink);
}

/* ─── Card back ─────────────────────────────────────────────────
   Three-layer composition:
   (1) --ink base + radial vignette for depth
   (2) `.card-back-pattern` — SVG mask producing a harlequin grid of
       diamond outlines tinted with --red (theme-aware via currentColor).
   (3) `.card-back-medallion` — centered plate hosting "Ваша роль",
       divider, red `?` mark, and the tap-to-reveal hint, framed by two
       hairline insets (the ::before on the back is the outermost frame).
*/
.role-card-back {
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.role-card-back::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  pointer-events: none;
  z-index: 2;
}

.role-card-back::after {
  content: '';
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  pointer-events: none;
  z-index: 2;
}

.card-back-pattern {
  position: absolute;
  inset: 18px;
  color: var(--red);
  opacity: 0.55;
  pointer-events: none;
  z-index: 1;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'><g fill='none' stroke='white' stroke-width='0.7'><path d='M11 1 L21 11 L11 21 L1 11 Z'/></g><circle cx='11' cy='11' r='1.1' fill='white'/><circle cx='0' cy='0' r='1' fill='white'/><circle cx='22' cy='0' r='1' fill='white'/><circle cx='0' cy='22' r='1' fill='white'/><circle cx='22' cy='22' r='1' fill='white'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'><g fill='none' stroke='white' stroke-width='0.7'><path d='M11 1 L21 11 L11 21 L1 11 Z'/></g><circle cx='11' cy='11' r='1.1' fill='white'/><circle cx='0' cy='0' r='1' fill='white'/><circle cx='22' cy='0' r='1' fill='white'/><circle cx='0' cy='22' r='1' fill='white'/><circle cx='22' cy='22' r='1' fill='white'/></svg>");
  -webkit-mask-repeat: repeat;
          mask-repeat: repeat;
  -webkit-mask-size: 22px 22px;
          mask-size: 22px 22px;
}

.card-back-medallion {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 20px 22px;
  min-width: 62%;
  background: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow:
    0 0 0 4px var(--ink),
    0 0 0 5px rgba(255, 255, 255, 0.10);
}

.card-back-name {
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.015em;
  color: var(--bg);
  text-align: center;
  word-break: break-word;
  max-width: 100%;
}

.card-back-divider {
  width: 48px;
  height: 2px;
  background: var(--red);
  margin: 14px 0 10px;
}

.card-back-mark {
  font-family: var(--font-display);
  font-size: 72px;
  line-height: 1;
  color: var(--red);
  margin: 2px 0 8px;
}

.card-back-hint {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 13px;
  color: var(--bg);
  opacity: 0.72;
  margin-top: 4px;
  letter-spacing: 0.01em;
}

/* Action slot is pinned to the viewport floor (like the top bar) so it
   never shifts the card layout when it fades in / out. The deal-screen
   reserves bottom padding for it — see the :not(.handoff-screen) rule
   below — so the card stays at the same center regardless of state. */
.deal-action-slot {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: 100%;
  max-width: 520px;
  padding: 14px 20px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(8px);
  transition:
    opacity 380ms ease,
    transform 420ms cubic-bezier(.4, 0, .2, 1);
  z-index: 5;
}

.deal-screen.revealed .deal-action-slot {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.deal-screen:not(.handoff-screen) {
  padding-bottom: 112px;
}

.deal-action-slot .instruction {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14px;
  color: var(--dim);
  margin: 0 0 14px;
  line-height: 1.4;
}

/* handoff screen — kicker + title vertically centered in the available
   space; the rule + hint + CTA stay pinned to the screen floor, mirroring
   the .deal-action-slot sticky-bottom contract used on the revealed card
   screen. */
.handoff-screen {
  justify-content: flex-start;
  align-items: stretch;
}

.handoff-head {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0;
}

.handoff-screen .player-name-big {
  font-size: clamp(44px, 13vw, 58px);
  line-height: 0.95;
}

.handoff-foot {
  margin-top: auto;
  position: sticky;
  bottom: 0;
  padding: 16px 0 calc(12px + env(safe-area-inset-bottom));
  background: var(--bg);
  text-align: center;
}

.handoff-rule {
  height: 2px;
  width: 56px;
  background: var(--ink);
  margin: 0 auto 16px;
}

.handoff-foot .passing-hint {
  position: static;
  margin: 0 0 18px;
  padding: 0;
  background: transparent;
  border-top: none;
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.handoff-cta {
  margin-top: 0;
}

/* ─── Host screen ───────────────────────────────────────────── */
.host-header {
  margin-top: 2px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--red);
  font-weight: 500;
  text-transform: uppercase;
  line-height: 1;
  margin-bottom: 10px;
}

.phase-badge .glyph {
  font-family: var(--font-symbols), var(--font-sans);
  font-size: 13px;
  line-height: 1;
}

.phase-title {
  font-family: var(--font-display);
  font-size: 38px;
  line-height: 0.98;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* step card — host speaks */
.step-card { margin-top: 16px; }

.step-num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--dim);
  font-weight: 500;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.step-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--dim);
  font-weight: 500;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.step-say {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 20px;
  line-height: 1.32;
  color: var(--ink);
  position: relative;
  padding-left: 34px;
  margin: 0;
}

.step-say::before {
  content: '«';
  position: absolute;
  left: 0;
  top: -10px;
  font-family: var(--font-display);
  font-size: 60px;
  line-height: 0.75;
  color: var(--red);
  font-style: normal;
}

.step-hint,
.step-rules,
.step-tips {
  margin-top: 10px;
  padding: 10px 12px 10px 14px;
  border-left: 3px solid var(--red);
  background: var(--paper);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
}

.step-hint { margin-top: 12px; }

.step-hint::before,
.step-rules::before,
.step-tips::before {
  display: inline-block;
  margin-right: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--red);
  font-weight: 700;
  text-transform: uppercase;
  vertical-align: baseline;
}

.step-hint::before { content: 'СКРИПТ'; }

.step-rules { border-left-color: var(--dim); }
.step-rules::before { content: 'ПРАВИЛО'; color: var(--dim); }

.step-tips::before { content: 'СОВЕТ'; }

/* nav row */
.nav-row {
  display: flex;
  gap: 0;
  margin: 18px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.nav-row-sticky {
  position: sticky;
  top: var(--bar-h);
  z-index: 10;
  background: var(--bg);
  margin: 12px 0 0;
}

.nav-btn {
  flex: 1;
  padding: 16px 10px;
  min-height: 56px;
  background: transparent;
  color: var(--dim);
  border: none;
  border-right: 1px solid var(--line);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
}

.nav-btn:last-child { border-right: none; }

.nav-btn.primary {
  flex: 2;
  background: var(--red);
  color: #fff;
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: -0.005em;
  text-transform: none;
  font-weight: 400;
}

.nav-btn:disabled,
.nav-btn.primary:disabled {
  opacity: 0.45;
  cursor: default;
}

.nav-btn.primary:disabled {
  background: var(--dim);
  color: var(--bg);
}

/* roster — two-column grid: number | (name / role stacked) */
.roster {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 18px;
  border-top: 1px solid var(--line);
}

.roster-row {
  display: grid;
  grid-template-columns: 24px 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 1px;
  align-items: baseline;
  padding: 8px 0;
  min-width: 0;
  border-top: 1px solid var(--line-soft);
}

/* First grid row (top-most two items) sits flush against the section border. */
.roster-row:nth-child(-n + 2) { border-top: none; }

.roster-row.dead { opacity: 0.55; }

.roster-row.dead .roster-name {
  text-decoration: line-through;
  text-decoration-color: var(--dim);
}

.roster-num {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  font-weight: 500;
}

.roster-name {
  grid-column: 2;
  grid-row: 1;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--ink);
  line-height: 1.1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-role {
  grid-column: 2;
  grid-row: 2;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.roster-role .role-icon {
  font-family: var(--font-display);
  font-size: 13px;
  line-height: 1;
  color: var(--ink);
  flex-shrink: 0;
}

.roster-row .role-icon.mafia,
.roster-row .role-icon.don { color: var(--red); }

.roster-row:has(.role-icon.mafia) .roster-role,
.roster-row:has(.role-icon.don)   .roster-role { color: var(--red); }

.roster-row .role-icon.maniac { color: var(--maniac); }

.roster-row:has(.role-icon.maniac) .roster-role { color: var(--maniac); }

/* ─── Actions · target rows ─────────────────────────────────── */
.action-card {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.action-card > .step-title { margin-bottom: 8px; }

.target-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--line-soft);
}

/* Two-column variant for night-action target selectors. Mirrors the roster
   layout so the host can map target cells to player rows at a glance. */
.target-grid.target-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 14px;
}

.target-grid.target-grid-2col .target-chip { gap: 10px; padding: 12px 8px; }
.target-grid.target-grid-2col .target-chip .chip-name { padding-right: 26px; }
.target-grid.target-grid-2col .chip-mark { right: 6px; gap: 0; }
.target-grid.target-grid-2col .chip-mark-label { display: none; }

.target-chip {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 10px;
  min-height: 52px;
  background: transparent;
  color: var(--ink);
  border: none;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: background 160ms var(--ease-out), color 160ms var(--ease-out);
}

.target-chip .chip-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--dim);
  font-weight: 500;
  width: 22px;
  flex-shrink: 0;
  text-align: left;
}

.target-chip .chip-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 116px;
}

.target-chip.selected {
  background: var(--overlay);
  color: var(--red);
}

.target-chip.selected .chip-num { color: var(--red); }

/* CH-04 · mark glyph + label sit on the right side of the chip, shown
   only when the chip is selected. Glyph carries the role semantics:
   deadly picks (mafia / maniac / vote / veteran-kill) paint red,
   neutral picks (sheriff / don / doctor / whore / veteran-save)
   paint ink so the host can tell them apart at a glance. */
.chip-mark {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.chip-mark-glyph {
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1;
  color: var(--red);
}

.chip-mark-label {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red);
}

.target-chip.selected .chip-mark { display: flex; }

/* Neutral actions (checks, saves, blocks) tone the mark down to ink. */
[data-mark-kind="neutral"] .target-chip.selected { color: var(--ink); }
[data-mark-kind="neutral"] .target-chip.selected .chip-num { color: var(--dim); }
[data-mark-kind="neutral"] .chip-mark-glyph { color: var(--ink); }
[data-mark-kind="neutral"] .chip-mark-label { color: var(--ink-2); }

.target-skip {
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  min-height: 52px;
  background: transparent;
  color: var(--dim);
  border: 1px dashed var(--line);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
}

.target-skip.selected {
  background: var(--overlay);
  color: var(--red);
  border-color: var(--red);
  border-style: solid;
}

.action-result {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--paper);
  border-left: 3px solid var(--red);
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.3;
  color: var(--ink);
}

/* CH-05 · check-result banner. Rendered between the step-title and the
   target-grid for sheriff / don checks. Left border switches on verdict:
   red for an "alert" result (mafia found / sheriff found), ink
   otherwise. Glyph on the left carries the role semantics. */
.check-result {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 14px 0 16px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left-width: 3px;
}

.check-result-alert   { border-left-color: var(--red); }
.check-result-neutral { border-left-color: var(--ink); }

.check-result .check-glyph {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.check-result-alert   .check-glyph { color: var(--red); }
.check-result-neutral .check-glyph { color: var(--ink); }

.check-result .check-body { flex: 1; min-width: 0; }

.check-result .check-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 500;
  margin-bottom: 4px;
}

.check-result .check-verdict {
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.25;
  color: var(--ink);
}

.check-result .check-verdict strong { font-weight: 400; }

/* Whore alibi banner — shown during day / vote phases when the previous
   night's whoreTarget survived. Informational only; host enforces verbally. */
.alibi-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 14px 0 0;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink);
}

.alibi-banner .alibi-glyph {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
  color: var(--ink);
  flex-shrink: 0;
  margin-top: 2px;
}

.alibi-banner .alibi-body { flex: 1; min-width: 0; }

.alibi-banner .alibi-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 500;
  margin-bottom: 4px;
}

.alibi-banner .alibi-text {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
}

.alibi-banner .alibi-text strong { font-weight: 700; }

.action-warn {
  margin-top: 10px;
  padding: 8px 12px;
  color: var(--red-ink);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  background: var(--overlay);
}

/* blocked card */
.blocked-card {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 16px 18px;
  text-align: center;
}

.blocked-card .step-title {
  color: var(--red);
  letter-spacing: 0.22em;
  margin-bottom: 10px;
}

.blocked-note {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 14px;
}

.blocked-confirm {
  background: var(--ink);
  color: var(--bg);
  border: none;
  border-style: solid;
  border-color: var(--ink);
}

.blocked-confirm.selected {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

/* veteran */
.veteran-mode-row {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.veteran-mode-btn {
  flex: 1;
  padding: 14px 12px;
  min-height: 56px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  cursor: pointer;
  text-align: center;
}

.veteran-mode-btn.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.veteran-mode-btn:disabled { opacity: 0.4; cursor: default; }

.veteran-mode-label {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 1;
}

.veteran-mode-used {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--dim);
  margin-top: 4px;
  letter-spacing: 0.14em;
}

.veteran-mode-btn.active .veteran-mode-used { color: var(--bg); opacity: 0.7; }

.veteran-mode-skip { margin-top: 10px; }

.veteran-grid-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--dim);
  font-weight: 500;
  text-transform: uppercase;
  margin: 16px 0 6px;
}

/* resolve card */
.resolve-card {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 14px 16px;
}

.resolve-card > .step-title {
  color: var(--red);
  letter-spacing: 0.22em;
  margin-bottom: 4px;
}

.resolve-subtitle {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.resolve-section {
  margin-top: 12px;
}
.resolve-section:first-of-type { margin-top: 0; }

.resolve-section-head {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
}

.resolve-line {
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.35;
  color: var(--ink);
}

.resolve-section .resolve-line:last-child { border-bottom: none; }

.resolve-line strong { font-weight: 400; color: var(--red); }
.resolve-line em {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--dim);
  text-transform: uppercase;
}

.resolve-line.resolve-saved { color: var(--ink); }
.resolve-line.resolve-death { color: var(--red); }
.resolve-line.resolve-note  { color: var(--ink-2); font-style: italic; }
.resolve-line.resolve-note em { font-style: normal; }
.resolve-line.resolve-info  { color: var(--ink); }

/* ─── Timer ──────────────────────────────────────────────────── */
.timer-card {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 14px 16px;
  margin-top: 16px;
}

.timer-display {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 64px;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin: 4px 0 10px;
}

.timer-display.caution { color: var(--red-ink); }
.timer-display.warning {
  color: var(--red);
  animation: a-pulse-red 1100ms ease-in-out infinite;
}

.timer-controls {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.timer-controls .nav-btn {
  border: 1px solid var(--line);
  color: var(--ink);
}

.timer-controls .nav-btn.primary {
  background: var(--overlay);
  color: var(--ink);
  border: 1px solid var(--ink);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* ─── Game over ─────────────────────────────────────────────── */
.game-over { padding-top: 22px; }

.game-over > .label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--red);
  font-weight: 500;
  text-transform: uppercase;
}

.verdict {
  font-family: var(--font-display);
  font-size: clamp(60px, 18vw, 84px);
  line-height: 0.88;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin: 10px 0 12px;
}

.verdict.city-wins { color: var(--ink); }
.verdict.city-wins br + * { color: var(--red); }
.verdict.mafia-wins { color: var(--red); }

.verdict-sub {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink-2);
  margin: 0 0 16px;
  padding-top: 10px;
  border-top: 2px solid var(--ink);
  max-width: 85%;
}

.final-list { border-top: 1px solid var(--line); }

.final-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}

.final-item:last-child { border-bottom: none; }

.final-item.dead { opacity: 0.55; }

.final-item.dead .name-col {
  text-decoration: line-through;
  text-decoration-color: var(--dim);
}

.final-item .name-col {
  font-family: var(--font-display);
  font-size: 19px;
  color: var(--ink);
  flex: 1;
  line-height: 1.1;
}

.final-item .role-col {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink);
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.final-item .role-col .role-icon {
  font-family: var(--font-display);
  font-size: 14px;
  line-height: 1;
  color: var(--ink);
  letter-spacing: 0;
}

.final-item .role-col .role-icon.mafia,
.final-item .role-col .role-icon.don { color: var(--red); }

.final-item:has(.role-icon.mafia) .role-col,
.final-item:has(.role-icon.don) .role-col { color: var(--red); }

/* night log */
.night-log { border-top: 1px solid var(--line-soft); }

.night-entry {
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

.night-entry:last-child { border-bottom: none; }

.night-entry-head {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--dim);
  font-weight: 500;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.night-entry-lines {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.night-entry-lines li {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--ink);
  line-height: 1.35;
  padding: 3px 0;
}

/* ─── Rules ─────────────────────────────────────────────────── */
.rules-screen h2,
.rules-screen h3,
.rules-screen .rules-body h3 {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 24px 0 10px;
  font-weight: 400;
}

.rules-screen .rules-body p,
.rules-screen .rules-body li {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-2);
}

.rules-screen .rules-body ul {
  padding-left: 18px;
  margin: 6px 0 0;
}

.rules-screen .rules-body strong {
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.005em;
}

.rules-screen .rules-body em {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--dim);
  font-size: 14px;
}

/* ─── Version footer ────────────────────────────────────────── */
.version-footer {
  text-align: center;
  padding: 12px 0 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
}

.version-footer-sep {
  margin: 0 0.5em;
  opacity: 0.55;
}

.install-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

.install-link:hover,
.install-link:focus-visible {
  color: var(--ink);
  outline: none;
}

/* ─── Install banner (PWA) ──────────────────────────────────── */
.install-banner {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  z-index: 60;
  display: none;
  max-width: 520px;
  margin: 0 auto;
}

.install-banner.visible { display: block; }

.install-banner .install-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.install-banner .install-title {
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.1;
  color: var(--ink);
}

.install-banner .install-desc {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-2);
}

.install-banner .install-actions {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.install-banner .install-btn {
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--red);
  background: var(--red);
  color: #fff;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
}

.install-banner .install-dismiss {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  cursor: pointer;
}

/* ════════════════════════════════════════════════════════════
   Animation library (Style A motion)
   ════════════════════════════════════════════════════════════ */
@keyframes a-fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes a-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes a-slide-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes a-scale-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes a-flip-in {
  /* CH-02 · role-reveal-smoother — removed the +6deg overshoot and
     the flat -180deg starting rotation. Start closer (-110deg) and
     ease softly to 0; opacity arrives by 55% so the reveal feels
     continuous, not snappy. */
  0%   {
    transform: perspective(1400px) rotateY(-110deg) scale(0.96);
    opacity: 0;
  }
  55%  { opacity: 1; }
  100% {
    transform: perspective(1400px) rotateY(0) scale(1);
    opacity: 1;
  }
}
@keyframes a-ink-sweep {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}
@keyframes a-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
@keyframes a-pulse-red {
  0%, 100% { transform: scale(1); color: var(--red); }
  50%      { transform: scale(1.04); color: var(--red-hot); }
}
@keyframes a-badge-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}
@keyframes a-strike {
  from { background-size: 0 2px; }
  to   { background-size: 100% 2px; }
}

/* CH-03 · entry animations are gated behind .screen-enter so they play only
   on fresh mounts — a role toggle on home or a target tap on host re-renders
   the DOM, but keeps the same anim key (see render.js), so .screen-enter is
   absent and these rules don't match. Infinite / stateful animations
   (a-pulse-red, a-badge-blink, a-shake, a-strike-line) are intentionally
   left unscoped: they don't signal "the screen just arrived". */
.screen-enter .a-fade-up,
.screen-enter.a-fade-up    { animation: a-fade-up 520ms var(--ease-out) both; }
.a-fade-up.d1 { animation-delay: 80ms; }
.a-fade-up.d2 { animation-delay: 160ms; }
.a-fade-up.d3 { animation-delay: 240ms; }
.a-fade-up.d4 { animation-delay: 320ms; }
.a-fade-up.d5 { animation-delay: 400ms; }

.screen-enter .a-fade-in,
.screen-enter.a-fade-in    { animation: a-fade-in 400ms ease-out both; }
.screen-enter .a-scale-in,
.screen-enter.a-scale-in   { animation: a-scale-in 380ms var(--ease-overshoot) both; }
.screen-enter .a-slide-in,
.screen-enter.a-slide-in   { animation: a-slide-in 420ms var(--ease-out) both; }
.screen-enter .a-ink-sweep,
.screen-enter.a-ink-sweep  { animation: a-ink-sweep 680ms cubic-bezier(.3,.7,.2,1) 200ms both; }
.a-shake      { animation: a-shake 460ms cubic-bezier(.36,.07,.19,.97) both; }
.a-pulse-red  { animation: a-pulse-red 1100ms ease-in-out infinite; }
.a-badge-blink { animation: a-badge-blink 1400ms ease-in-out infinite; }

.a-strike-line {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: left center;
  background-size: 100% 2px;
  animation: a-strike 600ms var(--ease-out) 300ms both;
}

/* staggered reveal — also gated behind .screen-enter so tapping a target
   chip doesn't hide then re-fade the whole list. */
.screen-enter .a-stagger > * {
  opacity: 0;
  animation: a-fade-up 460ms var(--ease-out) both;
}
.screen-enter .a-stagger > *:nth-child(1)  { animation-delay:  60ms; }
.screen-enter .a-stagger > *:nth-child(2)  { animation-delay: 110ms; }
.screen-enter .a-stagger > *:nth-child(3)  { animation-delay: 160ms; }
.screen-enter .a-stagger > *:nth-child(4)  { animation-delay: 210ms; }
.screen-enter .a-stagger > *:nth-child(5)  { animation-delay: 260ms; }
.screen-enter .a-stagger > *:nth-child(6)  { animation-delay: 310ms; }
.screen-enter .a-stagger > *:nth-child(7)  { animation-delay: 360ms; }
.screen-enter .a-stagger > *:nth-child(8)  { animation-delay: 410ms; }
.screen-enter .a-stagger > *:nth-child(9)  { animation-delay: 460ms; }
.screen-enter .a-stagger > *:nth-child(10) { animation-delay: 510ms; }
.screen-enter .a-stagger > *:nth-child(n+11) { animation-delay: 560ms; }

@media (prefers-reduced-motion: reduce) {
  .a-fade-up, .a-fade-in, .a-slide-in, .a-scale-in,
  .a-ink-sweep, .a-shake, .a-pulse-red, .a-badge-blink,
  .a-strike-line, .a-stagger > *,
  .screen-enter .a-fade-up, .screen-enter.a-fade-up,
  .screen-enter .a-fade-in, .screen-enter.a-fade-in,
  .screen-enter .a-slide-in, .screen-enter.a-slide-in,
  .screen-enter .a-scale-in, .screen-enter.a-scale-in,
  .screen-enter .a-ink-sweep, .screen-enter.a-ink-sweep,
  .screen-enter .a-stagger > *,
  .role-card-flipper, .timer-display.warning,
  .deal-header, .player-name-big, .passing-hint,
  .deal-action-slot,
  .deal-screen.is-flipping .role-card-flipper {
    animation: none !important;
    transition: none !important;
  }
  .a-stagger > *,
  .screen-enter .a-stagger > * { opacity: 1 !important; }
}

/* Small phone safety — 360px width */
@media (max-width: 360px) {
  .screen { padding: 16px 14px 22px; }
  .hero   { font-size: 64px; }
  .phase-title { font-size: 32px; }
  .verdict { font-size: 58px; }
  .counter-num { font-size: 72px; }
  .counter-btn { width: 60px; font-size: 36px; }
}
