/* Satwat Al-Bunuk — v9 dark velvet noir.
   Local fonts only (no Google Fonts): Markazi Text for big Arabic
   headings, Playfair Display for Latin numbers/codes, IBM Plex Sans
   Arabic for UI text. Tokens are verbatim from the v9 mockups
   (v9-source/style.css :root); the --accent/--border/--dim/--surface
   aliases keep the JS inline styles (which reference those names)
   painting in v9 colours. */
@font-face { font-family: "Markazi Text"; src: url("../assets/fonts/MarkaziText-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url("../assets/fonts/PlayfairDisplay-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("../assets/fonts/IBMPlexSansArabic-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("../assets/fonts/IBMPlexSansArabic-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("../assets/fonts/IBMPlexSansArabic-SemiBold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("../assets/fonts/IBMPlexSansArabic-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  color-scheme: dark;
  --ground: #090305;
  --line: rgba(214, 176, 108, .38);
  --line2: rgba(236, 226, 214, .13);
  --cream: #efe5d8;
  --mut: rgba(239, 229, 216, .70);
  --gold: #d2ab68;
  --gold2: #ecd29a;
  --blue: #7fa2cc;
  --silver: #c6d2de;
  --turquoise: #3ec9b2;
  --yellow: #ecd35f;
  --danger: #8e4a54;
  --live: #6fbf87;
  /* Aliases the JS inline styles reference (live names, v9 values). */
  --bg: #090305;
  --bg-deep: #090305;
  --surface: rgba(42, 14, 22, .72);
  --surface-2: rgba(14, 4, 8, .84);
  --text: #efe5d8;
  --dim: rgba(239, 229, 216, .70);
  --ink: #efe5d8;
  --ink-dim: rgba(239, 229, 216, .70);
  --panel-text: #efe5d8;
  --panel-dim: rgba(239, 229, 216, .70);
  --border: rgba(214, 176, 108, .38);
  --accent: #d2ab68;
  --accent-ink: #241a08;
  --gold-grad: linear-gradient(180deg, #f0d9a2 0%, #d4ad69 45%, #a97f3d 100%);
  --radius: 20px;
  --font-display: "Markazi Text", serif;
  --font-lat: "Playfair Display", serif;
  --font-ui: "IBM Plex Sans Arabic", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; overscroll-behavior-y: none; touch-action: manipulation; }
body { overflow-x: clip; }
/* Touch polish for the game room: no pinch/double-tap zoom gestures,
   no blue tap flash, and no accidental text selection while tapping
   cards and buttons during play. */
button, .bcard, [role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
/* Seamless refresh, part 1: the page background colour is known
   from the very first paint (before the body background image is
   even applied), so a reload never flashes white. */
html { background: #090305; }
/* Seamless refresh, part 2: the tiny boot script in the head
   stamps the last visited screen onto <html data-boot="…">, and
   that screen is displayed immediately — ahead of any script or
   network work — instead of every screen starting hidden and
   popping in later. The main script removes the attribute on
   its first showScreen() call, after which the normal .hidden
   classes rule again. */
html[data-boot="home"] #screen-home,
html[data-boot="login"] #screen-login,
html[data-boot="admin"] #screen-admin,
html[data-boot="wait"] #screen-wait,
html[data-boot="game"] #screen-game { display: flex !important; }
body {
  background-color: #090305;
  background-image: url("../assets/images/heroes/bg-velvet-mobile-720x1280.webp");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--cream);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  position: relative;
}
/* Mockup body layers: a dark gradient over the velvet, then a faint
   film-grain noise (screen blend) — the screens sit above both. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(9, 3, 5, .55), rgba(9, 3, 5, .86) 40%, rgba(9, 3, 5, .93));
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: .09; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
}
@media (min-width: 768px) {
  body { background-image: url("../assets/images/heroes/bg-velvet-desktop-1600x900.webp"); }
}
button, input { font-family: inherit; }
/* Touch targets: 44px minimum on every button/input. */
button, [role="button"], select, summary, input:not([type="checkbox"], [type="radio"]) { min-height: 2.75rem; }
.font-display { font-family: var(--font-display); }
/* Buttons carry .font-display in the markup for weight, but their
   text renders in the UI font (Markazi is for headings only). */
.btn-gold.font-display, .btn-ghost.font-display { font-family: var(--font-ui); }
.hidden { display: none !important; }

/* ---------- Screens: one centred phone-width column ---------- */
.screen { margin: 0 auto; width: 100%; max-width: 30rem; padding: 0 1.25rem 3rem; min-height: 100dvh; position: relative; z-index: 1; display: flex; flex-direction: column; }
.screen > * { flex: none; }
.screen-narrow { max-width: 28rem; }
.screen-wide { max-width: 30rem; padding: 0 1.25rem 1.5rem; }

/* ---------- Top bar / brand / hero ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; height: 56px; margin-top: 10px; }
.pills { display: flex; gap: 8px; align-items: center; }
/* Mockup .pill: dark translucent, gold border, 44px, radius 22px. */
.pill {
  height: 44px; min-width: 44px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 500; color: var(--cream);
  background: rgba(10, 3, 6, .55); backdrop-filter: blur(10px);
  white-space: nowrap; cursor: pointer;
}
.pill.lat { font-family: var(--font-lat); font-weight: 600; font-size: 13px; letter-spacing: .08em; }
.brand {
  font-family: var(--font-display);
  font-size: 1.9375rem; font-weight: 700; line-height: 1;
  color: var(--cream);
  text-shadow: 0 2px 14px rgba(0, 0, 0, .7);
  white-space: nowrap;
}
.brand-sm { font-size: 1.625rem; }
/* V10 full-bleed background (merged 2026-12-04): the cinematic vault
   scene covers the whole viewport behind home + login — a fixed layer
   (it stays put while the page scrolls), cover-fit, vault door centred
   so it survives the portrait crop. z-index -1 puts it behind ALL
   screen content (it lives inside .screen's stacking context, so it
   still paints above the body velvet); the old 380px banner + 55% mask
   fade are gone. The scrim darkens the top (top bar + headline) and
   the bottom (panels + rules) and leaves the vault visible mid-screen.
   The guide overlay keeps its own .guide-hero. */
.hero { position: fixed; inset: 0; z-index: -1; }
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(9, 3, 5, .55) 0, rgba(9, 3, 5, .25) 18%, rgba(9, 3, 5, 0) 38%, rgba(9, 3, 5, .12) 55%, rgba(9, 3, 5, .55) 78%, rgba(9, 3, 5, .85) 100%);
  z-index: 1;
}
.hero img {
  display: block; width: 100%; height: 100%;
  object-fit: cover; object-position: center;
}
/* V10 brand emblem (merged 2026-12-04): the wordmark is the
   calligraphy emblem image — Arabic on ar devices, Latin on en —
   swapped by setLang in config.js. Main top bars: 72px tall (≈107px
   wide, the V10 size); the dense 50px game top bar: 30px. */
.brand-logo { display: block; height: 72px; width: auto; filter: drop-shadow(0 2px 10px rgba(0, 0, 0, .55)); }
.brand-logo-sm { height: 30px; }
.h1 {
  font-family: var(--font-display);
  font-size: 2.5rem; font-weight: 700; line-height: 1.12;
  color: var(--cream);
  text-shadow: 0 2px 20px rgba(0, 0, 0, .8);
  margin: 0;
}
#screen-home .h1 { font-size: 2.3125rem; }
.rule {
  width: 56px; height: 1px;
  background: linear-gradient(90deg, var(--gold2), var(--gold));
  margin: 14px 0;
  box-shadow: 0 0 8px rgba(210, 171, 104, .6);
}
.lead { color: var(--mut); font-size: 0.9375rem; line-height: 1.7; margin: 0; }

/* ---------- Glass panels ---------- */
.glass, .panel, .panel-flat {
  margin-top: 1rem;
  background: linear-gradient(180deg, rgba(42, 14, 22, .72), rgba(14, 4, 8, .84));
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(236, 210, 154, .18);
  color: var(--panel-text);
  padding: 1.125rem;
}
.glass h2.font-display, .panel h2.font-display, .panel-flat h2.font-display { margin: 0; text-align: center; font-size: 1.6875rem; font-weight: 700; line-height: 1; }
.glass > .dim, .panel > .dim, .panel-flat > .dim { margin: 0.375rem 0 0; text-align: center; font-size: 0.84375rem; line-height: 1.7; }
.label { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--gold2); margin-bottom: 0.5rem; }

/* ---------- Buttons (mockup .btn) ---------- */
.btn {
  height: 56px; width: 100%;
  border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700;
  border: 1px solid var(--gold);
  background: rgba(10, 3, 6, .4);
}
.btn-gold {
  background: var(--gold-grad);
  color: var(--accent-ink);
  border: 1.5px solid #f2deaa;
  border-radius: 15px;
  height: 56px; width: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(210, 171, 104, .28), inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -2px 0 rgba(90, 50, 10, .35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn-gold:not(:disabled):hover { filter: brightness(1.04); transform: translateY(-1px); }
.btn-gold:disabled { opacity: 0.5; cursor: default; }
.btn-ghost {
  background: rgba(10, 3, 6, .4);
  border: 1px solid var(--line2);
  color: var(--mut);
  border-radius: 15px;
  height: 48px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.btn-ghost:disabled { opacity: 0.4; cursor: default; }
/* Small buttons (mockup .btn.sm): 46px, 14px/600, radius 12px. */
.btn.sm { height: 46px; font-size: 14px; font-weight: 600; border-radius: 12px; }
.btn.sm.gold { border-color: #f2deaa; }
.btn.off { opacity: .4; }
.lang-btn { font-family: var(--font-lat); font-weight: 600; letter-spacing: .08em; }

/* ---------- Home: watch code + strip + rules ---------- */
#join-form { margin-top: 0.875rem; display: flex; flex-direction: column; }
.codebox-input {
  min-width: 0; width: 100%; height: 60px;
  border-radius: 13px;
  border: 1px solid var(--line2);
  background: rgba(0, 0, 0, 0.5);
  color: var(--gold2);
  padding: 0 16px;
  text-align: center;
  font-family: var(--font-lat);
  font-size: 1.6875rem; font-weight: 600; letter-spacing: 0.14em;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}
.codebox-input::placeholder { color: rgba(236, 210, 154, 0.4); letter-spacing: 0.14em; }
.codebox-input:focus { outline: 2px solid rgba(210, 171, 104, 0.65); outline-offset: 1px; }
/* Wrong-code error (mockup screen 3): the codebox itself turns red. */
.codebox-input.input-error { border-color: rgba(142, 74, 84, 0.8); background: rgba(142, 74, 84, 0.25); color: #fca5a5; }
#join-name.input-error { border-color: rgba(142, 74, 84, 0.8); background: rgba(142, 74, 84, 0.25); }
#join-btn { margin-top: 0.75rem; }
#join-name-row { margin-top: 0.625rem; display: flex; gap: 0.5rem; align-items: center; }
#join-name {
  min-width: 0; flex: 1; height: 52px;
  border-radius: 13px; border: 1px solid var(--line2);
  background: rgba(0, 0, 0, 0.45); color: var(--cream);
  padding: 0 16px; font-size: 1rem; font-weight: 400;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}
#join-name:disabled { opacity: 1; color: var(--panel-dim); }
#join-name-edit { flex-shrink: 0; width: auto; height: 44px; padding: 0.6rem 1rem; font-size: 0.9rem; }
#join-error { margin: 0.625rem 0 0; }
.home-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 1.125rem; }
.strip-tile {
  position: relative;
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer; overflow: hidden;
}
.strip-tile img { width: 100%; height: 62px; object-fit: cover; object-position: center 20%; border-radius: 10px; border: 1px solid var(--line); box-shadow: 0 4px 12px rgba(0, 0, 0, .6); }
.strip-tile span:last-child { font-size: 11.5px; font-weight: 400; color: var(--mut); line-height: 1.3; display: block; margin-top: 5px; text-align: center; }
/* Rules: open on the background (no glass panel) — a gold Playfair
   numeral per row, hairline separators, muted 14px text. */
.howto { margin-top: 1.5rem; }
.rules { counter-reset: rule; margin: 0; padding: 0; list-style: none; font-size: 0.875rem; line-height: 1.75; color: var(--mut); }
.rules li { counter-increment: rule; display: flex; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line2); }
.rules li::before {
  content: counter(rule);
  font-family: var(--font-lat); font-size: 1.375rem; font-weight: 600;
  color: var(--gold2); width: 22px; flex: none; line-height: 1.2;
}
/* ---------- Login ---------- */
#screen-login .glass { padding: 22px 18px 20px; }
#screen-login .glass h1.font-display { margin: 0; text-align: center; font-size: 2.125rem; font-weight: 700; line-height: 1; }
#login-form { margin-top: 1rem; display: grid; gap: 0.75rem; }
#login-form > label.label { display: block; margin-bottom: 0; }
.pass-wrap { position: relative; margin-top: 0.375rem; }
#login-pass { padding-inline-end: 2.75rem; }
#toggle-pass {
  position: absolute; top: 0; bottom: 0; inset-inline-end: 0;
  width: 2.5rem; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; color: var(--dim);
}
#login-error { margin: 0; }
#login-btn { width: 100%; margin-top: 20px; }
.login-note { margin: 0.9rem 0 0; text-align: center; font-size: 0.78125rem; line-height: 1.7; }

/* ---------- Admin / create ---------- */
.admin-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; height: 56px; margin-top: 10px; }
.admin-head p { margin: 0; font-size: 0.9rem; }
/* Mockup screen 5: the «logged in as» line is a dark translucent
   chip (38px, radius 19px) like .chip, not bare text. */
.admin-head .admin-chip {
  height: 38px; padding: 0 13px;
  border-radius: 19px; border: 1px solid var(--line);
  background: rgba(10, 3, 6, .6); backdrop-filter: blur(10px);
  font-size: 13px; font-weight: 500; color: var(--mut);
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
#admin-name { color: var(--cream); font-weight: 700; }
.setup-block { margin-top: 1rem; }
#team-count-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
/* Mockup count tiles: 80px, radius 15px, Playfair numeral 30px + label. */
.count-tile {
  height: 80px; border-radius: 15px;
  border: 1px solid var(--line2); background: rgba(9, 3, 5, 0.5);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  cursor: pointer; color: var(--cream);
}
.count-tile .num { font-family: var(--font-lat); font-size: 1.875rem; font-weight: 600; line-height: 1.1; color: var(--cream); }
.count-tile .count-label { font-size: 0.8125rem; font-weight: 600; color: var(--cream); }
.count-tile .count-sub { font-size: 0.71875rem; color: var(--mut); font-weight: 500; }
.count-tile.on { border-color: var(--gold2); background: linear-gradient(180deg, rgba(210, 171, 104, .25), rgba(210, 171, 104, .08)); box-shadow: 0 0 18px rgba(210, 171, 104, .28); }
.count-tile.on .num { color: var(--gold2); }
#setup-names { display: flex; flex-direction: column; gap: 10px; }
.setup-row { display: flex; gap: 10px; align-items: center; }
.setup-row .setup-avatar { width: 52px; height: 52px; flex: none; border-radius: 13px; object-fit: cover; }
.setup-row .field { flex: 1; }
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.stat-card {
  display: flex; flex-direction: column; align-items: center; gap: 0.1rem;
  padding: 0.7rem 0.25rem; border-radius: 14px;
  border: 1px solid var(--line2); background: rgba(9, 3, 5, 0.5);
}
.stat-card b.num { font-family: var(--font-lat); font-size: 1.75rem; font-weight: 600; color: var(--gold2); }
.stat-card span { font-size: 0.75rem; color: var(--mut); font-weight: 500; }
.setup-note { margin-top: 0.9rem; font-size: 0.8125rem; line-height: 1.7; }
#create-error { margin: 0.75rem 0 0; }
#create-btn { width: 100%; }

/* ---------- Wait screen ---------- */
#wait-title { margin: 0; font-size: 1.25rem; font-weight: 700; padding-top: 4rem; }
#wait-text { margin: 0.5rem 0 0; font-size: 0.9rem; }
#wait-back { margin-top: 1.25rem; padding: 0.6rem 1.25rem; font-size: 0.9rem; }

/* ---------- Fields / errors / dim ---------- */
.field {
  width: 100%; height: 52px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--line2);
  color: var(--cream);
  border-radius: 13px;
  padding: 0 16px;
  font-size: 1rem;
  font-weight: 400;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}
.field:focus { outline: 2px solid rgba(210, 171, 104, 0.65); outline-offset: 1px; }
.err { color: #e3a0a8; font-size: 0.8125rem; font-weight: 600; }
.dim { color: var(--mut); }

/* ---------- Team strip: dark translucent tabs with a coloured
   dot beside the name (mockup .tab) — NOT solid-colour pills. ---------- */
.team-strip { display: flex; gap: 6px; margin-top: 8px; }
.team-pill {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px;
  min-width: 0;
  flex: 1;
  border-radius: 13px;
  border: 1px solid var(--line2);
  background: rgba(10, 3, 6, .55);
  backdrop-filter: blur(10px);
  padding: 0 10px;
}
.team-pill .tname {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--cream);
  font-family: var(--font-ui);
}
.team-pill.is-turn {
  border-color: var(--gold2);
  background: linear-gradient(180deg, rgba(210, 171, 104, .22), rgba(210, 171, 104, .1));
  box-shadow: 0 0 14px rgba(210, 171, 104, .28);
}
.team-pill.eliminated { opacity: .6; filter: grayscale(1); }
.team-pill.eliminated.is-turn { opacity: .92; filter: grayscale(.35); }
.team-pill .tname-wrap {
  display: flex; align-items: center; justify-content: center;
  gap: 0.3rem; width: 100%; min-width: 0;
}
.team-pill .tname-wrap .tname { width: auto; flex: 0 1 auto; }
/* The coloured dot: the ONLY coloured part of a tab (mockup .dot). */
.dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--dot-c, var(--gold)); box-shadow: 0 0 8px var(--dot-c, var(--gold)); }
.d-blue { --dot-c: #7fa2cc; }
.d-silver { --dot-c: #c6d2de; }
.d-turquoise { --dot-c: #3ec9b2; }
.d-yellow { --dot-c: #ecd35f; }
.loser-badge {
  flex: none; font-size: 9px; font-weight: 700;
  padding: 0.15rem 0.4rem; border-radius: 999px;
  background: rgba(10, 3, 6, .78); color: #E8EDF4;
  border: 1px solid rgba(255, 255, 255, .55);
}
.team-pill.host { cursor: pointer; }
.team-pill input {
  height: 2rem; min-height: 2rem; width: 100%; min-width: 0;
  border-radius: 13px; border: 1px solid;
  background: var(--surface); color: var(--text);
  text-align: center; font-size: 11px; font-weight: 700; padding: 0 0.375rem;
}

/* ---------- Message banner (mockup .banner): gold-tinted 48px bar ---------- */
.msg-banner {
  margin-top: 8px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(210, 171, 104, .18), rgba(210, 171, 104, .08));
  backdrop-filter: blur(10px);
  color: var(--cream);
  padding: 0.5rem 14px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
}
.msg-banner.pending { background: linear-gradient(180deg, rgba(210, 171, 104, .3), rgba(210, 171, 104, .16)); border-color: var(--gold); }
.msg-banner p { margin: 0; text-align: center; font-size: 15px; font-weight: 600; line-height: 1.45; }

/* ---------- Host controls (mockup .btn.sm.ghost, flex:1, 44px) ---------- */
#host-controls { margin: 8px 0 10px; display: flex; align-items: center; justify-content: center; gap: 8px; }
#host-controls.hidden { display: none; }
#host-controls .btn-ghost { flex: 1; height: 44px; border-radius: 12px; font-size: 14px; font-weight: 600; }
#withdraw-btn { order: 1; }
#next-btn { order: 2; }
#skip-btn { order: 3; }

/* ---------- Board (mockup: NO wrapper panel around the board) ---------- */
.board-wrap { margin-top: 12px; }
.board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.bcard {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  border: 1px solid var(--line2);
  overflow: hidden;
  padding: 0;
  width: 100%;
  background: #160509;
  transition: none;
}
button.bcard { cursor: pointer; }
button.bcard:disabled { cursor: default; }
.bcard.face-down {
  display: flex; align-items: center; justify-content: center;
  background: #1a060d;
  border-color: rgba(210, 171, 104, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 -8px 14px rgba(0, 0, 0, 0.45), 0 8px 16px rgba(0, 0, 0, 0.35);
  transition: transform .15s ease, filter .15s ease;
}
button.bcard.face-down:not(:disabled):hover { transform: translateY(-2px); filter: brightness(1.5); }
/* Face-down: the number is plain gold Playfair over the card-back art,
   sitting on a soft radial scrim (mockup .c.down::before) — NO disc badge. */
.bcard.face-down::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: radial-gradient(circle at center, rgba(12, 3, 6, .9) 0 13px, transparent 15px);
}
.bcard .num {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-lat); font-size: 1rem; font-weight: 700; color: #ecd29a;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}
.bcard img.art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
/* Revealed-card art fades in on load (art-ok) and falls back to the
   number (art-num) on error — never a blank card: every handler
   resolves one way or the other. */
.bcard img.art, .guide-item img, .badge-img { opacity: 0; transition: opacity .25s ease; }
.bcard img.art.art-ok, .guide-item img.art-ok, .badge-img.art-ok { opacity: 1; }
.bcard img.art.art-missing, .guide-item img.art-missing, .badge-img.art-missing { display: none; }
.art-num {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-lat); font-size: 1.25rem; font-weight: 700; color: var(--gold2);
}
/* Revealed: portrait art with a bottom gradient scrim (mockup .c.up::before),
   a 10.5px/700 label, and a 4px gang-colour bottom bar with a glow. */
.bcard:not(.face-down)::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, transparent 40%, rgba(6, 2, 4, .94));
}
.card-lab {
  position: absolute; left: 0; right: 0; bottom: 4px; z-index: 3;
  text-align: center; font-size: 10.5px; font-weight: 700; color: #fff;
  text-shadow: 0 1px 3px #000, 0 0 6px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}
.bcard:not(.face-down)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: var(--tc, transparent); z-index: 3;
  box-shadow: 0 0 8px var(--tc, transparent);
}
/* Dead (killed / boss-out): the ART desaturates and darkens, and the
   card gets a 1.5px gang-colour inset ring — no whole-card opacity,
   no red «مقتول» stamp (mockup .c.dead). */
.bcard.killed img.art, .bcard.boss-out img.art { filter: grayscale(.9) brightness(.7); }
.bcard.killed, .bcard.boss-out { box-shadow: inset 0 0 0 1.5px var(--tc, var(--line2)); }
/* Jailed (mockup .c.prison): the art brightens slightly, a gang-colour
   wash (soft-light) + light bars sit over it, and the card gets the
   1.5px gang-colour inset ring. */
.bcard.prison img.art { filter: grayscale(.1) brightness(1.12) saturate(1.15); }
.bcard.prison { box-shadow: inset 0 0 0 1.5px var(--tc, var(--line2)); }
.bcard .wash { position: absolute; inset: 0; z-index: 2; pointer-events: none; background: var(--tc, transparent); opacity: .34; mix-blend-mode: soft-light; }
/* While a target must be chosen, every non-selectable card drops to
   ~35% opacity, heavily desaturated and darkened, so the available
   targets stand out at a glance. */
.bcard.dimmed { opacity: .35; filter: saturate(.3) brightness(.55); }
.bars {
  pointer-events: none; position: absolute; inset: 0; z-index: 2;
  /* Mockup .bars (v9-source/style.css): a real jail grid — cream
     verticals every 11px and cream horizontals every 26px — not
     vertical-only stripes with solid bars at the top/bottom edges,
     which read as letterbox bars on the guide thumbnail. */
  background:
    repeating-linear-gradient(90deg, rgba(240, 233, 222, .52) 0 3px, rgba(24, 14, 16, .30) 3px 4.5px, transparent 4.5px 11px),
    repeating-linear-gradient(0deg, rgba(240, 233, 222, .52) 0 3px, rgba(24, 14, 16, .30) 3px 4.5px, transparent 4.5px 26px);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, .32);
}
/* The most recently revealed card: a 2px gold2 outline + glow. */
.bcard.latest { outline: 2px solid var(--gold2); outline-offset: 2px; box-shadow: 0 0 22px rgba(236, 210, 154, .5); }

@keyframes flipIn { from { transform: rotateY(90deg); opacity: 0.4; } to { transform: rotateY(0deg); opacity: 1; } }
.card-flip { animation: flipIn 0.1s ease-out; }
@keyframes pulseGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(210, 171, 104, 0.55); } 50% { box-shadow: 0 0 0 7px rgba(210, 171, 104, 0); } }
@keyframes targetPulse {
  0%, 100% { box-shadow: 0 0 0 2px #d2ab68, 0 0 12px rgba(210, 171, 104, 0.6); filter: brightness(1.08); }
  50% { box-shadow: 0 0 0 3px #ecd29a, 0 0 24px rgba(210, 171, 104, 0.95); filter: brightness(1.25); }
}
/* Selectable targets stay fully bright with a thick glowing gold
   border and a gentle pulse — the opposite of .dimmed above. */
.target-glow {
  animation: targetPulse 1s ease-in-out infinite;
  border: 2px solid #d2ab68 !important;
  box-shadow: 0 0 0 2px #d2ab68, 0 0 18px rgba(210, 171, 104, 0.8);
  filter: brightness(1.15);
  position: relative; z-index: 1;
  cursor: pointer;
}
@keyframes winnerPop { 0% { transform: scale(0.85); opacity: 0; } 60% { transform: scale(1.04); } 100% { transform: scale(1); opacity: 1; } }
.winner-pop { animation: winnerPop 0.5s ease-out; }
@keyframes badgeFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.badge-float { animation: badgeFloat 5s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .card-flip, .target-glow, .winner-pop, .badge-float { animation: none; }
  .btn-gold { transition: none; }
}

/* ---------- Bank (mockup .bank-panel) ---------- */
.bank-wrap { margin-top: 12px; }
.bank-panel { border: 1px solid var(--line); border-radius: 16px; padding: 10px 10px 11px; background: linear-gradient(180deg, rgba(210, 171, 104, .07), rgba(10, 3, 6, .62)); color: var(--panel-text); box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4); }
.bank-panel.unlocked { border-color: #d2ab68; background: linear-gradient(180deg, rgba(210, 171, 104, .18), rgba(14, 4, 8, 0.9)); box-shadow: 0 0 0 1px rgba(210, 171, 104, 0.35), 0 0 22px rgba(210, 171, 104, 0.25), 0 16px 32px rgba(0, 0, 0, 0.4); }
.bank-head { display: flex; align-items: center; justify-content: center; gap: 6px; }
.bank-head h3 { margin: 0; text-align: center; font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--gold2); }
.bank-note { text-align: center; font-size: 11.5px; color: var(--mut); margin-top: 6px; }
.bank-note.gold { color: var(--gold2); }
.bank-grid { margin-top: 8px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bank-grid .bcard { aspect-ratio: 3 / 2; }
.bank-grid .bcard.gold-open { border-color: var(--gold2); box-shadow: 0 0 0 1.5px var(--gold2), 0 0 22px rgba(210, 171, 104, .35); }
.bank-num {
  position: absolute; bottom: 7px; right: 7px; z-index: 3;
  font-family: var(--font-lat); font-size: 15px; font-weight: 600; color: var(--gold2);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}
.bank-lock { position: absolute; top: 6px; left: 6px; width: 13px; height: 13px; color: var(--gold2); z-index: 3; }
/* ---------- Viewer panel (v9 screen 9, viewers only) ---------- */
.viewer-panel { margin-top: 12px; }
.viewer-panel > .label { margin: 12px 0 0; }
/* The hero is unboxed: portrait + text column, no panel. */
.viewer-hero { display: flex; gap: 16px; }
.viewer-hero-art { position: relative; width: 140px; height: 186px; flex-shrink: 0; border-radius: 18px; overflow: hidden; border: 1.5px solid var(--gold2); box-shadow: 0 0 22px rgba(210, 171, 104, .35); }
.viewer-hero-art img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.viewer-hero-art::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--tc, transparent); z-index: 3; }
.viewer-hero-art .hero-card-name { position: absolute; left: 0; right: 0; bottom: 8px; z-index: 3; text-align: center; font-family: var(--font-display); font-size: 33px; font-weight: 700; color: #fff; text-shadow: 0 2px 10px rgba(0, 0, 0, .8); }
.viewer-hero-text { min-width: 0; }
.viewer-hero-title { margin: 0.25rem 0 0; font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1.15; color: var(--cream); }
.viewer-hero-sub { margin: 0.3rem 0 0; font-size: 13.5px; line-height: 1.7; color: var(--mut); }
.viewer-progress { margin-top: 12px; display: grid; }
/* Gang rows are hairline rows, not boxes. */
.vrow { display: flex; align-items: center; gap: 10px; height: 44px; border-top: 1px solid var(--line2); }
.vname { font-size: 14.5px; font-weight: 600; width: 60px; flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vsegs { display: flex; gap: 3px; flex: 1; }
.vsegs .p { flex: 1; height: 6px; border-radius: 3px; background: rgba(239, 229, 216, 0.14); }
.vsegs .p.on { background: var(--gold2); box-shadow: 0 0 6px rgba(236, 210, 154, .6); }
.vsegs .p.x { background: var(--danger); }
.vcount { font-size: 13px; font-weight: 600; color: var(--gold2); white-space: nowrap; }
.mini-board { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; margin-top: 8px; }
.mini-cell { position: relative; height: 36px; border-radius: 7px; overflow: hidden; background: #160509; border: 1px solid rgba(214, 176, 108, 0.18); display: flex; align-items: center; justify-content: center; }
.mini-cell.down::before { content: ""; position: absolute; inset: 0; z-index: 1; background: radial-gradient(circle at center, rgba(12, 3, 6, .9) 0 8px, transparent 10px); }
.mini-cell.down b { position: relative; z-index: 2; font-family: var(--font-lat); font-size: 10.5px; font-weight: 700; color: rgba(236, 210, 154, 0.75); }
.mini-cell.up img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.mini-cell.up::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--tc, transparent); }
.mini-cell .mini-lab { position: absolute; left: 0; right: 0; bottom: 2px; z-index: 3; text-align: center; font-size: 7.5px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px #000; }
.mini-bank { margin-top: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: rgba(10, 3, 6, .55); }
.mini-bank .label { font-size: 10.5px; margin-bottom: 6px; }
.mini-bank-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.mini-bank-cell { position: relative; height: 34px; border-radius: 5px; overflow: hidden; background: #160509; border: 1px solid rgba(214, 176, 108, 0.18); display: flex; align-items: center; justify-content: center; }
.mini-bank-cell b { font-family: var(--font-lat); font-size: 9px; font-weight: 600; color: var(--gold2); text-shadow: 0 1px 4px rgba(0, 0, 0, .8); }
.mini-bank-cell img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.viewer-moves { margin-top: 8px; display: grid; }
.vmove { display: flex; align-items: center; min-height: 40px; border-top: 1px solid var(--line2); font-size: 13.5px; line-height: 1.6; color: var(--mut); }

/* ---------- End-screen standings (mockup: 46px hairline rows) ---------- */
.standings { margin-top: 12px; display: grid; text-align: start; }
.standing-row { display: flex; align-items: center; gap: 10px; height: 46px; border-top: 1px solid var(--line2); }
.standing-row .badge-img { width: 32px; height: 32px; }
.standing-name { font-size: 15px; font-weight: 600; }
.standing-result { margin-inline-start: auto; font-size: 13px; font-weight: 700; }
.standing-result.won { color: var(--gold2); }
.standing-result.lost { color: var(--mut); }

/* ---------- Guide: a FULL-SCREEN overlay (mockup screen 11), not a dialog ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: var(--ground); overflow-y: auto; }
.guide-overlay .guide-dialog {
  max-height: none; width: 100%; max-width: 30rem; margin: 0 auto;
  padding: 0 1.25rem 3rem; overflow: visible;
  background: none; border: none; border-radius: 0; box-shadow: none;
  position: relative; z-index: 1; display: flex; flex-direction: column;
}
.guide-overlay .guide-dialog > * { flex: none; }
.guide-hero {
  position: absolute; top: 0; left: 0; right: 0; height: 260px; z-index: 0;
  background: url("../assets/images/heroes/hero-vault-mobile-720x1280.webp") center 30% / cover no-repeat;
  -webkit-mask-image: linear-gradient(180deg, #000 0, #000 55%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0, #000 55%, transparent 100%);
}
.guide-grid { display: grid; grid-template-columns: 1fr; }
.guide-item { display: flex; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line2); align-items: flex-start; }
.guide-art { position: relative; width: 84px; height: 112px; flex-shrink: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line2); }
.guide-art img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.guide-item p { margin: 0; }
.guide-item .gname { font-family: var(--font-display); font-size: 26px; font-weight: 700; line-height: 1.2; color: var(--cream); }
.guide-item .gdesc { margin-top: 0.15rem; font-size: 13.5px; line-height: 1.7; color: var(--mut); }

.badge-img { border-radius: 26%; object-fit: cover; flex-shrink: 0; }
/* Mockup .chip: dark translucent, 38px, radius 19px, 13px/500. */
.chip {
  height: 38px; padding: 0 13px;
  border-radius: 19px; border: 1px solid var(--line);
  background: rgba(10, 3, 6, .6); backdrop-filter: blur(10px);
  font-size: 13px; font-weight: 500; color: var(--cream);
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.chip .num { font-size: 15px; color: var(--gold2); }
.chip-live { background: rgba(10, 3, 6, .6); border: 1px solid var(--line); }
#viewer-count-num.stale { opacity: .55; }
/* The live dot is a plain 8px green dot (mockup .live) — no pulse. */
.live { display: inline-block; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--live); box-shadow: 0 0 8px rgba(111, 191, 135, .8); }
.live-dot { display: inline-block; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--live); box-shadow: 0 0 8px rgba(111, 191, 135, .8); }
.code-text { font-family: var(--font-lat); letter-spacing: 0.15em; color: var(--cream); font-size: 0.9rem; }
.resume-banner .code-text, .glass .code-text, .panel .code-text, .panel-flat .code-text { color: var(--gold2); }
.save-note { text-align: center; font-size: 0.75rem; font-weight: 700; color: #fca5a5; margin-top: 0.5rem; }

/* ---------- Offline banner ---------- */
#offline-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  background: #6E1420; color: #fff;
  text-align: center; font-size: 0.8rem; font-weight: 700; line-height: 1.5;
  padding: 0.45rem 0.75rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

/* ---------- Resume last game banner ---------- */
.resume-banner {
  margin-top: 1rem;
  border: 2px solid rgba(210, 171, 104, 0.55);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(42, 14, 22, .72), rgba(14, 4, 8, .84));
  color: var(--panel-text);
  padding: 1rem 1.1rem;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.4), 0 0 0 4px rgba(210, 171, 104, 0.1);
  text-align: center;
}
.resume-banner .resume-title { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--gold2); }
.resume-banner .resume-text { margin: 0.5rem auto 0; font-size: 0.88rem; line-height: 1.7; max-width: 30rem; color: var(--mut); }
.resume-banner .resume-code { margin: 0.65rem 0 0; font-size: 0.85rem; font-weight: 700; }
.resume-banner .resume-actions { margin-top: 0.85rem; display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.resume-banner .resume-btn { border-radius: 15px; padding: 0.75rem 1.4rem; font-size: 1rem; font-weight: 800; min-width: 13rem; }
.resume-banner .resume-error { margin: 0.6rem 0 0; }

/* ---------- Game screen top bar (mockup .game-top, one 50px row) ---------- */
.game-top { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 50px; margin-top: 8px; z-index: 30; }
.game-top-start, .game-top-end { display: flex; align-items: center; gap: 8px; min-width: 0; }
#game-code-chip .num { font-family: var(--font-lat); font-size: 15px; font-weight: 600; letter-spacing: .14em; color: var(--gold2); }
#viewer-names { font-size: 12px; font-weight: 500; color: var(--dim); margin-top: 6px; }
.more-menu {
  position: absolute; top: 58px; inset-inline-end: 0; z-index: 40;
  min-width: 200px;
  /* Fully opaque: a translucent panel lets the end-screen headline,
     subtitle and bank cards bleed through and sit over the rows. */
  background: linear-gradient(180deg, #2a0e16, #0e0408);
  border: 1px solid var(--line); border-radius: 14px; padding: 6px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .6);
}
.more-row {
  display: block; width: 100%; text-align: start;
  padding: 10px 12px; background: none; border: none; border-radius: 9px;
  color: var(--cream); font-size: 14px; font-weight: 500; cursor: pointer;
}
.more-row:hover { background: rgba(210, 171, 104, .12); }

/* ---------- Lobby block (screen 6 look on the pre-first-move game screen) ---------- */
.lobby-block { margin-top: 12px; }
.lobby-code-panel {
  position: relative; border-radius: 22px; overflow: hidden;
  border: 1px solid var(--gold); margin-top: 16px; min-height: 220px;
}
.lobby-code-bg {
  position: absolute; inset: 0;
  background: url("../assets/images/cards/card-back-225x300.webp") center 30% / cover no-repeat;
}
.lobby-code-bg::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(9, 3, 5, .25), rgba(9, 3, 5, .72) 75%);
}
.lobby-code-inner { position: relative; z-index: 1; padding: 24px 16px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.lobby-code {
  font-family: var(--font-lat); font-size: 58px; font-weight: 600;
  letter-spacing: .14em; line-height: 1.1; color: var(--gold2);
  text-shadow: 0 0 26px rgba(210, 171, 104, .55);
}
.lobby-code-btns { display: flex; gap: 8px; width: 100%; margin-top: 16px; }
.lobby-code-btns .btn { flex: 1; }
.lobby-live { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; font-size: 15px; font-weight: 600; }
.lobby-live .num { font-size: 20px; color: var(--gold2); }
.lobby-gangs { margin-top: 16px; display: grid; }
.lobby-gang-row { display: flex; align-items: center; gap: 12px; height: 60px; border-top: 1px solid var(--line2); }
.lobby-gang-row .badge-img { width: 44px; height: 44px; border-radius: 13px; }
.lobby-gang-name { font-size: 16px; font-weight: 600; }
.lobby-gang-count { font-size: 12.5px; color: var(--mut); }
.lobby-steps { margin-top: 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; padding: 16px 12px; }
.lobby-steps .num { font-family: var(--font-lat); font-size: 22px; font-weight: 600; color: var(--gold2); }
.lobby-steps div div:last-child { font-size: 12.5px; color: var(--mut); margin-top: 4px; }

/* ---------- End screen (mockup screen 10) ---------- */
#screen-game.ended::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 430px; z-index: 0;
  background: url("../assets/images/cards/bank-open-gold-600x400.webp") center 30% / cover no-repeat;
  -webkit-mask-image: linear-gradient(180deg, #000 0, #000 55%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0, #000 55%, transparent 100%);
}
#screen-game.ended::after {
  content: ""; position: absolute; top: 110px; left: 0; right: 0; height: 300px; z-index: 0;
  background: linear-gradient(180deg, rgba(9, 3, 5, 0), rgba(9, 3, 5, .85));
  pointer-events: none;
}
#screen-game.ended > * { position: relative; z-index: 1; }
/* The ⋯ menu lives in .game-top: on the end screen the rule above
   puts every direct child at z-index 1, so without this the later
   siblings (winner banner, bank panel, end actions) paint over the
   open menu and swallow its clicks. .game-top must stay on top. */
#screen-game.ended .game-top { z-index: 30; }
#screen-game.ended .board-wrap, #screen-game.ended #team-strip,
#screen-game.ended #msg-banner, #screen-game.ended #host-controls,
#screen-game.ended #viewer-panel { display: none; }
#winner-banner { text-align: center; }
.winner-kicker { font-size: 13px; font-weight: 600; color: var(--gold2); }
.winner-title { font-family: var(--font-display); font-size: 45px; font-weight: 700; line-height: 1.15; color: var(--cream); text-shadow: 0 2px 20px rgba(0, 0, 0, .8); margin: 4px 0 0; }
.winner-subtitle { font-family: var(--font-display); font-size: 28px; font-weight: 500; line-height: 1.2; color: var(--gold2); text-shadow: 0 0 18px rgba(210, 171, 104, .5); margin: 2px 0 0; }
.winner-lead { font-size: 13.5px; line-height: 1.7; color: var(--mut); max-width: 26rem; margin: 8px auto 0; }
#end-actions { display: flex; flex-direction: column; gap: 10px; margin-top: auto; padding-bottom: 20px; }
/* ---------- Pull-to-refresh (Facebook style) ----------
   The browser's own pull-to-refresh is disabled above
   (overscroll-behavior-y: none) and replaced by this custom
   one: dragging down from the very top pulls the visible
   screen down with the finger while this spinner chip is
   revealed above it; releasing past the threshold re-fetches
   the live data in place (no page reload, no white flash),
   then the screen springs smoothly back to the top. */
#ptr {
  position: fixed; top: 0; left: 50%; z-index: 80;
  width: 42px; height: 42px; margin-left: -21px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transform: translateY(-56px);
}
.ptr-spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid rgba(38, 75, 111, 0.25);
  border-top-color: #264B6F;
}
#ptr.spinning .ptr-spinner { animation: ptrSpin 0.7s linear infinite; }
@keyframes ptrSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  #ptr.spinning .ptr-spinner { animation-duration: 1.6s; }
}
/* Language switch: the page CONTENT crossfades — it eases down
   to a soft ghost of itself while the language and direction
   swap underneath, then eases back up in the new language. No
   cover flashes over the page and no spinner appears, so the
   switch reads as one calm fade rather than a blink; the
   wrapper also swallows taps for the fraction of a second the
   layout is mid-flip. */
#lang-fade { transition: opacity 0.16s ease; }
#lang-fade.fading { opacity: 0.12; pointer-events: none; }
#lang-fade.returning { transition: opacity 0.3s ease; }
@media (prefers-reduced-motion: reduce) {
  #lang-fade, #lang-fade.returning { transition: none; }
}
