/* ==========================================================================
   NIDDAK — design system
   Direction: "desert-noir geometric luxury" — night-indigo grounds, brass/
   gold ornament, four elemental rival hues (Ember / Tide / Gale / Stone).
   One typeface (Cairo) carries true EN/AR parity — no faux-Arabic Latin font.
   All spacing/position uses logical properties so [dir="rtl"] mirrors free.
   ========================================================================== */

/* ---- tokens ------------------------------------------------------------ */
:root{
  color-scheme: dark;

  /* grounds */
  --void:        #07080f;
  --bg-0:        #0b0d17;
  --bg-1:        #12162a;
  --bg-2:        #1a2038;
  --panel:       #1b2138cc;
  --panel-solid: #1b2138;
  --panel-hi:    #232b47;
  --hairline:    #ffffff14;
  --hairline-hi: #ffffff26;

  /* ink */
  --ink:       #f4efe6;
  --ink-dim:   #c7c2d6;
  --ink-faint: #8489a6;
  --ink-mute:  #5a5f7a;

  /* brass / gold — premium, currency, Throne, rarity ceiling */
  --gold:        #d4a24e;
  --gold-bright: #f2c572;
  --gold-dim:    #8a6b34;
  --gold-ink:    #241a06;

  /* rival elements */
  --ember:       #e4572e;
  --ember-glow:  #ff8a5c;
  --ember-ink:   #2a0f08;
  --tide:        #2fb6a5;
  --tide-glow:   #63e6d4;
  --tide-ink:    #06201d;
  --gale:        #8fa6d6;
  --gale-glow:   #c1d1ff;
  --gale-ink:    #0d1730;
  --stone:       #93a066;
  --stone-glow:  #c3d597;
  --stone-ink:   #171b0c;

  /* rarity */
  --rarity-common:    #9aa0b4;
  --rarity-rare:      #4fb8e0;
  --rarity-epic:      #a876d6;
  --rarity-legendary: #f2c572;

  /* semantic */
  --success: var(--tide);
  --danger:  var(--ember);
  --info:    var(--gale);

  /* type */
  --font-ui: "Cairo", "Cairo Play", system-ui, sans-serif;
  --fs-2xs: 0.6875rem;
  --fs-xs:  0.75rem;
  --fs-sm:  0.8125rem;
  --fs-md:  0.9375rem;
  --fs-lg:  1.0625rem;
  --fs-xl:  1.25rem;
  --fs-2xl: 1.5625rem;
  --fs-3xl: 2rem;
  --fs-4xl: clamp(2.25rem, 5vw + 1rem, 3.4rem);
  --fs-hero: clamp(2.6rem, 9vw + 1rem, 5.6rem);
  --lh-tight: 1.08;
  --lh-snug:  1.28;
  --lh-normal: 1.55;

  /* space (4px base) */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-20: 5rem;
  --sp-24: 6rem;

  /* shape */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --radius-pill: 999px;
  --cut: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  --cut-sm: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);

  /* elevation */
  --shadow-sm: 0 1px 2px #00000066;
  --shadow-md: 0 8px 24px -8px #000000aa, 0 2px 8px #00000066;
  --shadow-lg: 0 24px 60px -16px #000000cc, 0 4px 16px #00000088;
  --glow-gold: 0 0 0 1px #d4a24e55, 0 0 24px -4px #d4a24e99;

  /* motion */
  --ease-out: cubic-bezier(.16,.84,.44,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --dur-fast: 140ms;
  --dur-med: 320ms;
  --dur-slow: 640ms;

  /* structure */
  --shell-max: 1180px;
  --z-toast: 900;
  --z-modal: 800;
  --z-overlay: 700;
  --z-header: 600;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-i-s: env(safe-area-inset-left, 0px);
  --safe-i-e: env(safe-area-inset-right, 0px);
}

@media (prefers-reduced-motion: reduce){
  :root{ --dur-fast: 1ms; --dur-med: 1ms; --dur-slow: 1ms; }
}
.reduce-motion, .reduce-motion *{ animation-duration: 1ms !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }

/* ---- reset --------------------------------------------------------------*/
*, *::before, *::after{ box-sizing: border-box; }
html, body{ height: 100%; }
html{ -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body{
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg-0);
  color: var(--ink);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg{ display: block; max-width: 100%; }
button, input, select, textarea{ font: inherit; color: inherit; }
button{ background: none; border: 0; cursor: pointer; }
/* Navigation in a game should not read as prose hyperlinks. The base rule
   set colour but left the browser's default underline, so `.brand` and
   `.account-btn` each had to opt out by hand and the nav tabs never did.
   Clearing it here fixes both bars at once; anything that genuinely wants to
   look like a link (`.link-btn`) still asks for the underline explicitly. */
a{ color: inherit; text-decoration: none; }
ul{ margin: 0; padding: 0; list-style: none; }
h1,h2,h3,h4,p{ margin: 0; }
:focus{ outline: none; }
:focus-visible{ outline: 2px solid var(--gold-bright); outline-offset: 3px; border-radius: 4px; }
::selection{ background: var(--gold); color: var(--gold-ink); }

.visually-hidden{
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* numerals stay tabular so costs/HP don't jitter, in either script */
.num{ font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ---- backdrop atmosphere -------------------------------------------------*/
.app{
  position: relative;
  min-height: 100dvh;
  isolation: isolate;
}
.app::before{
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(60vw 45vh at 18% -6%, #3a2c5a55, transparent 60%),
    radial-gradient(70vw 55vh at 108% 8%, #4a2a2255, transparent 60%),
    radial-gradient(90vw 70vh at 50% 118%, #16324a66, transparent 60%),
    linear-gradient(180deg, var(--void), var(--bg-0) 40%, var(--bg-1) 100%);
}
.app::after{
  content: "";
  position: fixed; inset: 0; z-index: -1; opacity: .5; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

/* subtle 8-point lattice used behind panels/hero */
.lattice{
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23d4a24e' stroke-opacity='0.16' stroke-width='1'%3E%3Cpath d='M32 2 44 20 62 32 44 44 32 62 20 44 2 32 20 20 Z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 64px 64px;
}

/* ==========================================================================
   layout shell
   ========================================================================== */
.screen{
  min-height: 100dvh;
  width: 100%;
  min-width: 0;
  overflow-x: clip;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-t);
  padding-bottom: var(--safe-b);
}
.shell-header{
  position: sticky; top: 0; z-index: var(--z-header);
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) max(var(--sp-4), var(--safe-i-s)) var(--sp-3) max(var(--sp-4), var(--safe-i-e));
  padding-inline-start: max(var(--sp-4), var(--safe-i-s));
  padding-inline-end: max(var(--sp-4), var(--safe-i-e));
  background: linear-gradient(180deg, #0b0d17f0, #0b0d17c0 70%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.shell-header .brand{
  display: flex; align-items: center; gap: var(--sp-2);
  font-weight: 900; letter-spacing: .06em; font-size: var(--fs-lg);
  color: var(--ink);
  text-decoration: none;
}
.shell-header .brand .mark{ width: 26px; height: 26px; flex: none; }
.shell-header nav{
  display: none;
  gap: var(--sp-1);
  margin-inline-start: var(--sp-4);
}
.shell-header .spacer{ flex: 1; }
.shell-header .util{ display: flex; align-items: center; gap: var(--sp-2); }

@media (min-width: 1024px){
  .shell-header nav{ display: flex; }
}

.nav-link{
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm); font-weight: 700; color: var(--ink-dim);
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}
.nav-link:hover{ color: var(--ink); background: var(--hairline); }
.nav-link.active{ color: var(--gold-bright); background: #d4a24e1a; }

.main{
  flex: 1;
  width: 100%;
  min-width: 0;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding-inline: max(var(--sp-4), var(--safe-i-s));
}
.main.bleed{ max-width: none; padding-inline: 0; }

.bottom-tabbar{
  position: sticky; bottom: 0; z-index: var(--z-header);
  display: flex; justify-content: space-around;
  padding: var(--sp-2) max(var(--sp-2), var(--safe-i-s)) calc(var(--sp-2) + var(--safe-b));
  background: linear-gradient(0deg, #0b0d17f5, #0b0d17d0 80%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--hairline);
}
@media (min-width: 1024px){ .bottom-tabbar{ display: none; } }

.tab-link{
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--fs-2xs); font-weight: 700; color: var(--ink-faint);
  min-width: 56px; min-height: 44px; justify-content: center;
  border-radius: var(--radius-md);
}
.tab-link svg{ width: 22px; height: 22px; }
.tab-link.active{ color: var(--gold-bright); }
.tab-link.active svg{ filter: drop-shadow(0 0 6px #d4a24e88); }

/* ---- language / util controls ------------------------------------------ */
.lang-toggle{
  display: flex; border: 1px solid var(--hairline-hi); border-radius: var(--radius-pill);
  overflow: hidden; font-size: var(--fs-2xs); font-weight: 800;
}
.lang-toggle button{
  /* 32px failed the 44px touch minimum, on the one control an Arabic-first
     player reaches for first. */
  padding: var(--sp-1) var(--sp-3); color: var(--ink-faint);
  min-height: 44px; min-width: 44px;
  transition: color var(--dur-fast), background var(--dur-fast);
}
.lang-toggle button.active{ background: var(--gold); color: var(--gold-ink); }

.icon-btn{
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-pill);
  color: var(--ink-dim); border: 1px solid transparent;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.icon-btn:hover{ background: var(--hairline); color: var(--ink); }
.icon-btn svg{ width: 20px; height: 20px; }

/* ==========================================================================
   buttons
   ========================================================================== */
.btn{
  --btn-fg: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 48px; padding-inline: var(--sp-6);
  border-radius: var(--radius-pill);
  font-weight: 800; font-size: var(--fs-md); letter-spacing: .01em;
  color: var(--btn-fg);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast), filter var(--dur-fast), background var(--dur-fast);
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:active{ transform: scale(.97); }
/* A blanket opacity fade turned the gold primary into a muddy olive that
   read as broken rather than waiting, and dropped its near-black label
   (#241a06) far below readable contrast. Disabled now gets its own calm
   surface with legible text, so "not yet" looks deliberate. */
.btn:disabled{ cursor: not-allowed; }
.btn-primary:disabled{
  background: var(--panel-hi); color: var(--ink-faint);
  border: 1px solid var(--hairline-hi); box-shadow: none; filter: none;
}
.btn-ghost:disabled, .btn-outline:disabled{ opacity: .5; filter: none; }

.btn-primary{
  --btn-fg: var(--gold-ink);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  box-shadow: 0 10px 24px -10px #d4a24e77, inset 0 1px 0 #ffffff55;
}
.btn-primary:hover:not(:disabled){ filter: brightness(1.06); box-shadow: 0 14px 30px -10px #d4a24e99, inset 0 1px 0 #ffffff66; }

.btn-ghost{
  background: var(--panel);
  border-color: var(--hairline-hi);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.btn-ghost:hover:not(:disabled){ background: var(--panel-hi); border-color: var(--gold-dim); }

.btn-outline{
  background: transparent; border-color: var(--gold-dim); color: var(--gold-bright);
}
.btn-outline:hover:not(:disabled){ background: #d4a24e14; border-color: var(--gold); }

.btn-danger{ background: linear-gradient(180deg, var(--ember-glow), var(--ember)); color: #2a0f08; }

.btn-sm{ min-height: 38px; padding-inline: var(--sp-4); font-size: var(--fs-sm); }
.btn-lg{ min-height: 56px; padding-inline: var(--sp-8); font-size: var(--fs-lg); }
.btn-block{ width: 100%; }
.btn-icon-only{ width: 44px; height: 44px; padding: 0; border-radius: var(--radius-pill); }

/* ==========================================================================
   panels / cards (UI chrome, not game-cards)
   ========================================================================== */
.panel{
  background: var(--panel);
  border: 1px solid var(--hairline-hi);
  border-radius: var(--radius-lg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.panel-solid{ background: var(--panel-solid); }
.panel-pad{ padding: var(--sp-5); }

.chip{
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3); border-radius: var(--radius-pill);
  font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .03em;
  background: var(--hairline); color: var(--ink-dim); border: 1px solid var(--hairline-hi);
}
.chip-gold{ background: #d4a24e22; color: var(--gold-bright); border-color: #d4a24e55; }
.chip-ember{ background: #e4572e22; color: var(--ember-glow); border-color: #e4572e55; }
.chip-tide{ background: #2fb6a522; color: var(--tide-glow); border-color: #2fb6a555; }

/* section headings used across screens */
.eyebrow{
  font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold-bright); display: flex; align-items: center; gap: var(--sp-2);
}
.eyebrow::before{ content: ""; width: 18px; height: 1px; background: var(--gold-dim); }
.section-title{ font-size: var(--fs-2xl); font-weight: 900; margin-top: var(--sp-2); line-height: var(--lh-tight); }

/* ==========================================================================
   toast
   ========================================================================== */
.toast-root{
  position: fixed; z-index: var(--z-toast);
  top: calc(var(--sp-4) + var(--safe-t));
  inset-inline: 0;
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  pointer-events: none;
}
.toast{
  pointer-events: auto;
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  background: var(--panel-solid); border: 1px solid var(--hairline-hi);
  border-radius: var(--radius-pill); box-shadow: var(--shadow-md);
  font-size: var(--fs-sm); font-weight: 700;
  animation: toast-in var(--dur-med) var(--ease-spring);
  max-width: calc(100vw - 2 * var(--sp-4));
}
.toast.leaving{ animation: toast-out var(--dur-med) var(--ease-out) forwards; }
@keyframes toast-in{ from{ opacity: 0; transform: translateY(-12px) scale(.95);} to{ opacity:1; transform:none; } }
@keyframes toast-out{ to{ opacity: 0; transform: translateY(-8px) scale(.96);} }

/* ==========================================================================
   generic helpers
   ========================================================================== */
.stack{ display: flex; flex-direction: column; }
.row{ display: flex; align-items: center; }
.gap-1{ gap: var(--sp-1); } .gap-2{ gap: var(--sp-2); } .gap-3{ gap: var(--sp-3); }
.gap-4{ gap: var(--sp-4); } .gap-6{ gap: var(--sp-6); }
.muted{ color: var(--ink-faint); }
.dim{ color: var(--ink-dim); }
.center{ display: flex; align-items: center; justify-content: center; }
.text-center{ text-align: center; }
.mt-2{ margin-top: var(--sp-2);} .mt-3{ margin-top: var(--sp-3);} .mt-4{ margin-top: var(--sp-4);}
.mt-6{ margin-top: var(--sp-6);} .mt-8{ margin-top: var(--sp-8);}

.divider{ height: 1px; background: var(--hairline); border: 0; }

.skeleton{
  background: linear-gradient(90deg, var(--panel-hi) 25%, #2a3358 37%, var(--panel-hi) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-md);
}
@keyframes shimmer{ 0%{ background-position: 100% 0; } 100%{ background-position: 0 0; } }

/* ==========================================================================
   landing
   ========================================================================== */
.landing{ display: flex; flex-direction: column; }

.landing-hero{
  position: relative;
  min-height: min(92vh, 920px);
  display: flex; align-items: flex-end;
  padding-inline: max(var(--sp-4), var(--safe-i-s));
  padding-block-end: var(--sp-12);
  overflow: clip;
}
.landing-hero-art{ position: absolute; inset: 0; z-index: -1; }
.landing-hero-art img{
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%;
  display: block;
}
.landing-hero-scrim{
  position: absolute; inset: 0;
  background:
    linear-gradient(0deg, var(--void) 14%, #07080fe6 44%, #07080fb3 62%, #07080f4d 82%, transparent 100%),
    linear-gradient(100deg, #07080fcc 0%, #07080f66 38%, transparent 62%);
}
.landing-hero-inner{ position: relative; max-width: 760px; display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-5); }
.landing-title{
  font-size: var(--fs-hero); font-weight: 900; line-height: var(--lh-tight); letter-spacing: -.01em;
  display: flex; flex-direction: column;
}
.landing-title .line{
  color: var(--ink);
  text-shadow: 0 2px 20px #000000cc, 0 1px 2px #000000;
  opacity: 0; transform: translateY(14px);
  animation: line-in var(--dur-slow) var(--ease-out) forwards;
}
.landing-title .line:last-child{ color: var(--gold-bright); }
.landing-title .line:nth-child(2){ animation-delay: 90ms; }
@keyframes line-in{ to{ opacity: 1; transform: none; } }

.landing-sub{ font-size: var(--fs-lg); color: var(--ink-dim); max-width: 56ch; line-height: var(--lh-normal); }
.landing-cta-row{ display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-2); }

.landing-proof{ display: flex; gap: var(--sp-8); margin-top: var(--sp-6); flex-wrap: wrap; }
.proof-item{ display: flex; flex-direction: column; gap: 2px; }
.proof-value{ font-size: var(--fs-3xl); font-weight: 900; color: var(--gold-bright); font-variant-numeric: tabular-nums; }
.proof-label{ font-size: var(--fs-xs); color: var(--ink-faint); text-transform: uppercase; letter-spacing: .06em; }

@keyframes emblem-spin{ to{ transform: rotate(360deg); } }

@media (min-width: 1024px){
  .landing-hero{ padding-block-end: var(--sp-16); }
}

.landing-how{ padding-block: var(--sp-16); padding-inline: max(var(--sp-4), var(--safe-i-s)); max-width: var(--shell-max); margin-inline: auto; width: 100%; }
.how-grid{ display: grid; gap: var(--sp-5); margin-top: var(--sp-8); grid-template-columns: 1fr; }
@media (min-width: 768px){ .how-grid{ grid-template-columns: repeat(3, 1fr); } }
.how-card{
  border-radius: var(--radius-lg); background: var(--panel);
  border: 1px solid var(--hairline-hi); position: relative; overflow: hidden;
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast);
}
.how-card:hover{ transform: translateY(-3px); border-color: var(--gold-dim); }
.how-art{ height: 170px; overflow: hidden; background: var(--bg-1); }
.how-art img{
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%;
  transition: transform var(--dur-slow) var(--ease-out);
}
.how-card:hover .how-art img{ transform: scale(1.05); }
.how-card-body{ padding: var(--sp-5) var(--sp-6) var(--sp-6); }
.how-card h3{ font-size: var(--fs-xl); font-weight: 800; }
.how-card p{ color: var(--ink-dim); margin-top: var(--sp-2); line-height: var(--lh-normal); font-size: var(--fs-sm); }

.landing-world{
  margin: var(--sp-8) max(var(--sp-4), var(--safe-i-s)) 0; padding: var(--sp-8);
  max-width: calc(var(--shell-max) - 2 * var(--sp-4)); margin-inline: auto; width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-8);
  flex-wrap: wrap;
}
.landing-world .section-title{ max-width: 32ch; }
.landing-world p{ max-width: 46ch; margin-top: var(--sp-2); }
.world-crests{ flex: none; display: flex; }
.world-crests img{
  width: 92px; height: 92px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--gold-dim); background: var(--bg-1);
  box-shadow: 0 8px 24px -8px #000000cc;
  transition: transform var(--dur-fast) var(--ease-out);
}
.world-crests img + img{ margin-inline-start: -18px; }
.world-crests img:hover{ transform: translateY(-6px); z-index: 1; position: relative; }

.landing-footer{ padding: var(--sp-10) var(--sp-4) var(--sp-16); text-align: center; }

/* ==========================================================================
   onboarding
   ========================================================================== */
.onboarding-step{
  max-width: 860px; margin-inline: auto; padding-block: var(--sp-10) var(--sp-16);
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.onboarding-body{ max-width: 52ch; margin-top: var(--sp-2); }
.pick-grid{ display: grid; gap: var(--sp-4); width: 100%; margin-top: var(--sp-8); }
.pick-grid-2{ grid-template-columns: 1fr; }
.pick-grid-3{ grid-template-columns: 1fr; }
.pick-grid-4{ grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px){
  .pick-grid-2{ grid-template-columns: repeat(2, 1fr); }
  .pick-grid-3{ grid-template-columns: repeat(3, 1fr); }
  .pick-grid-4{ grid-template-columns: repeat(4, 1fr); }
}
.pick-card-sm{ padding: var(--sp-4); }
.pick-card-sm h3{ font-size: var(--fs-md); }

.pick-card{
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-2);
  padding: var(--sp-6) var(--sp-4); border-radius: var(--radius-lg);
  background: var(--panel); border: 1.5px solid var(--hairline-hi);
  transition: border-color var(--dur-fast), transform var(--dur-fast), background var(--dur-fast);
}
.pick-card:hover{ border-color: var(--gold-dim); transform: translateY(-2px); }
.pick-card.selected{ border-color: var(--gold); background: #d4a24e14; box-shadow: var(--glow-gold); }
.pick-card h3{ font-size: var(--fs-lg); font-weight: 800; margin-top: var(--sp-2); }
.pick-card p{ font-size: var(--fs-sm); }
.pick-emblem svg{ display: block; }

.onboarding-actions{ display: flex; gap: var(--sp-3); margin-top: var(--sp-10); }

.champion-pick-card{
  display: flex; flex-direction: column; text-align: start; overflow: hidden;
  border-radius: var(--radius-lg); background: var(--panel-solid); border: 1.5px solid var(--hairline-hi);
  transition: border-color var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-fast);
}
.champion-pick-card:hover{ border-color: var(--gold-dim); transform: translateY(-2px); }
.champion-pick-card.selected{ border-color: var(--gold); box-shadow: var(--glow-gold); }
.champion-pick-art{ position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: var(--bg-1); }
.champion-pick-art img{
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; display: block;
  transition: transform var(--dur-slow) var(--ease-out);
}
.champion-pick-card:hover .champion-pick-art img{ transform: scale(1.04); }
.champion-pick-overlay{
  position: absolute; inset-inline: 0; bottom: 0;
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2);
  padding: var(--sp-8) var(--sp-5) var(--sp-4);
  background: linear-gradient(0deg, #07080fe6 30%, #07080f80 65%, transparent 100%);
}
.champion-pick-overlay h3{ font-size: var(--fs-xl); font-weight: 900; text-shadow: 0 2px 10px #000000cc; }
.champion-pick-cta{
  display: flex; align-items: center; justify-content: center; min-height: 46px;
  margin: var(--sp-3); border-radius: var(--radius-pill);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold)); color: var(--gold-ink);
  font-size: var(--fs-md); font-weight: 900; letter-spacing: .02em;
  box-shadow: 0 8px 20px -8px #d4a24e88, inset 0 1px 0 #ffffff55;
  transition: filter var(--dur-fast);
}
.champion-pick-card:hover .champion-pick-cta, .champion-pick-card:focus-visible .champion-pick-cta{ filter: brightness(1.07); }

.faction-pick-card{
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-2);
  padding: var(--sp-4); border-radius: var(--radius-lg);
  background: var(--panel-solid); border: 1.5px solid var(--hairline-hi);
  transition: border-color var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-fast);
}
.faction-pick-card:hover{ border-color: var(--gold-dim); transform: translateY(-2px); }
.faction-pick-card.selected{ border-color: var(--gold); box-shadow: var(--glow-gold); }
.faction-pick-art{ width: 84px; height: 84px; border-radius: 50%; overflow: hidden; background: var(--bg-1); }
.faction-pick-art img{ width: 100%; height: 100%; object-fit: cover; display: block; }
.faction-pick-card h3{ font-size: var(--fs-md); font-weight: 800; margin-top: var(--sp-1); }
.faction-pick-card p{ font-size: var(--fs-sm); }

/* ==========================================================================
   hand cards (shared: mulligan + planning)
   ========================================================================== */
.hand-rail{
  display: flex; gap: var(--sp-3); overflow-x: auto; padding-block: var(--sp-2);
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.hand-rail::-webkit-scrollbar{ height: 6px; }
.hand-rail-static{ justify-content: center; flex-wrap: wrap; overflow: visible; }

.hand-card{
  flex: none; width: 132px; min-height: 196px; scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-1);
  padding: var(--sp-3); border-radius: var(--radius-md);
  background: var(--panel-solid); border: 1.5px solid var(--hairline-hi);
  text-align: center; position: relative;
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast), box-shadow var(--dur-fast), opacity var(--dur-fast);
}
/* The frame colour is the card's rarity. Common had no rule at all, so it
   fell through to the default hairline and read as a card that had lost its
   border rather than a card that is common. Every tier now states itself. */
.hand-card.rarity-common{ border-color: var(--rarity-common); }
.hand-card.rarity-rare{ border-color: var(--rarity-rare); }
.hand-card.rarity-epic{ border-color: var(--rarity-epic); }
.hand-card.rarity-legendary{ border-color: var(--rarity-legendary); box-shadow: 0 0 0 1px #f2c57233; }
.hand-card:not(:disabled):hover{ transform: translateY(-4px); }
.hand-card.selected{ border-color: var(--gold); box-shadow: var(--glow-gold); transform: translateY(-6px); }
/* opacity for unplayable cards lives with the blocked-reason rules below */
.hand-card:disabled{ cursor: not-allowed; }

.hand-card-art{
  width: 100%; height: 104px; overflow: hidden; border-radius: calc(var(--radius-md) - 4px);
  background: radial-gradient(circle at 50% 20%, #ffffff15, transparent 55%), var(--bg-1);
  border: 1px solid var(--hairline);
}
.hand-card-art img, .hand-card-art svg{ width: 100%; height: 100%; display: block; }
/* The cost badge carries a small Energy pip, the same shape the ENERGY meter
   uses. A bare gold number said nothing about what it counted; matching the
   meter's glyph ties "2" on the card to "1/1" above it without adding a word
   to a card that has no room for one. */
.hand-card-cost{
  position: absolute; top: 6px; inset-inline-start: 6px;
  min-width: 24px; height: 24px; padding-inline: 5px; border-radius: var(--radius-pill);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold)); color: var(--gold-ink);
  display: flex; align-items: center; justify-content: center; gap: 3px;
  font-weight: 900; font-size: var(--fs-xs);
}
.cost-pip{
  inline-size: 5px; block-size: 11px; border-radius: 2px;
  background: var(--gold-ink); opacity: .55;
}
.hand-card-name{ font-size: var(--fs-xs); font-weight: 800; line-height: var(--lh-snug); }
.hand-card-stats{ display: flex; gap: var(--sp-2); font-size: var(--fs-xs); font-weight: 900; color: var(--gold-bright); }
.hand-stat{ display: inline-flex; align-items: center; gap: 3px; }
.hand-stat svg{ width: 13px; height: 13px; }
.hand-stat-power{ color: var(--gold-bright); }
.hand-stat-guard{ color: var(--tide-glow); }
.hand-card-type{ margin-top: auto; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); }
.hand-card.tutorial-target{ border-color: var(--gold-bright); box-shadow: var(--glow-gold); animation: guided-card 1.4s var(--ease-in-out) infinite; }
.hand-card-tap-label, .territory-tap-label{
  position: absolute; z-index: 1; display: inline-flex; align-items: center; justify-content: center; min-height: 22px;
  padding-inline: 7px; border-radius: var(--radius-pill); background: var(--gold-bright); color: var(--gold-ink);
  font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; box-shadow: 0 2px 12px #00000055;
}
.hand-card-tap-label{ inset-block-start: 92px; inset-inline-end: 8px; }
@keyframes guided-card{ 50%{ transform: translateY(-7px); box-shadow: 0 0 28px -5px var(--gold-bright); } }

/* ==========================================================================
   mulligan
   ========================================================================== */
.mulligan-screen{
  position: relative; isolation: isolate; width: 100%; max-width: 1120px;
  min-height: calc(100svh - 82px); margin-inline: auto;
  padding-block: clamp(28px, 5vh, 64px);
  display: grid; grid-template-rows: auto auto auto; align-content: center;
  gap: clamp(20px, 4vh, 44px); text-align: center;
}
.mulligan-screen::before{
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  inset: 8% 5% 14%;
  background:
    radial-gradient(ellipse at 50% 40%, #d4a24e13, transparent 46%),
    radial-gradient(ellipse at 50% 65%, #2fb6a510, transparent 54%);
}
.mulligan-head{ display: flex; flex-direction: column; align-items: center; }
.mulligan-head .eyebrow{ justify-content: center; }
.mulligan-head .section-title{
  margin-top: var(--sp-2); font-size: clamp(34px, 4.2vw, 52px);
  line-height: .98; text-wrap: balance;
}
.mulligan-hand-stage{ position: relative; min-width: 0; }
.mulligan-hand-stage::after{
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  inset-inline: 10%; bottom: -14px; height: 44px;
  background: radial-gradient(ellipse, #00000080, transparent 68%);
  filter: blur(8px);
}
.mulligan-screen .hand-rail-static{
  justify-content: center; flex-wrap: nowrap; gap: clamp(10px, 1.5vw, 18px);
  overflow: visible; padding: var(--sp-3);
}
.mulligan-screen .hand-card{
  --card-accent: var(--rarity-common);
  width: clamp(154px, 16vw, 190px); min-height: clamp(238px, 24vw, 292px);
  gap: 6px; padding: 10px; overflow: hidden; isolation: isolate;
  border-width: 2px; border-radius: 15px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--card-accent) 9%, transparent), transparent 34%),
    linear-gradient(155deg, #20263d, #121624 72%);
  box-shadow: 0 18px 36px -24px #000, inset 0 1px 0 #ffffff10;
  animation: mulligan-deal 420ms var(--ease-out) backwards;
}
.mulligan-screen .hand-card.elem-ember{ --card-accent: var(--ember-glow); }
.mulligan-screen .hand-card.elem-tide{ --card-accent: var(--tide-glow); }
.mulligan-screen .hand-card.elem-gale{ --card-accent: var(--gale-glow); }
.mulligan-screen .hand-card.elem-stone{ --card-accent: var(--stone-glow); }
.mulligan-screen .hand-card.elem-neutral{ --card-accent: #d8d4c8; }
.mulligan-screen .hand-card::before{
  content: ""; position: absolute; inset: 4px; z-index: 2; pointer-events: none;
  border: 1px solid var(--card-accent); border-radius: 11px; opacity: .28;
}
.mulligan-screen .hand-card::after{
  content: ""; position: absolute; top: 0; inset-inline: 18%; z-index: 3;
  height: 3px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--card-accent), transparent);
}
.mulligan-screen .hand-card:nth-child(2){ animation-delay: 55ms; }
.mulligan-screen .hand-card:nth-child(3){ animation-delay: 110ms; }
.mulligan-screen .hand-card:nth-child(4){ animation-delay: 165ms; }
@keyframes mulligan-deal{
  from{ opacity: 0; transform: translateY(18px) scale(.96); }
}
.mulligan-screen .hand-card:hover{ transform: none; }
.mulligan-screen .hand-card-art{
  height: auto; aspect-ratio: 1 / 1; border-radius: 9px;
  border-color: color-mix(in srgb, var(--card-accent) 28%, var(--hairline));
}
.mulligan-screen .hand-card-name{ font-size: var(--fs-sm); line-height: 1.15; }
.mulligan-screen .hand-card-type{ font-size: 10px; }
.mulligan-screen .hand-card-cost{ top: 8px; inset-inline-start: 8px; min-width: 32px; height: 32px; font-size: var(--fs-sm); }
.mulligan-actions{
  display: grid; grid-template-columns: minmax(210px, 260px) minmax(250px, 330px);
  justify-content: center; gap: var(--sp-3);
}
.mulligan-actions .btn{ min-height: 62px; }
.mulligan-actions .btn svg{ width: 20px; height: 20px; }
.mulligan-actions .btn-primary{ box-shadow: 0 14px 34px -13px #d4a24e99, inset 0 1px 0 #ffffff66; }
.tutorial-banner{ max-width: 52ch; margin-inline: auto; margin-top: var(--sp-2); }

@media (max-width: 767px){
  .mulligan-screen{
    min-height: calc(100svh - 120px); padding-block: var(--sp-4) 104px;
    align-content: start; gap: var(--sp-4);
  }
  .mulligan-screen::before{ inset: 0 -20% 18%; }
  .mulligan-head .section-title{ font-size: clamp(30px, 10vw, 40px); }
  .mulligan-hand-stage{ margin-inline: calc(var(--sp-3) * -1); }
  .mulligan-screen .hand-rail-static{
    justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap;
    gap: 10px; padding: var(--sp-2) var(--sp-3) var(--sp-4);
    scroll-padding-inline: var(--sp-3); scrollbar-width: none;
  }
  .mulligan-screen .hand-rail-static::-webkit-scrollbar{ display: none; }
  .mulligan-screen .hand-card{ width: 148px; min-height: 230px; padding: 8px; }
  .mulligan-screen .hand-card-cost{ top: 6px; inset-inline-start: 6px; min-width: 28px; height: 28px; }
  .mulligan-screen .hand-card-name{ font-size: var(--fs-xs); }
  .mulligan-actions{
    position: fixed; z-index: calc(var(--z-header) - 1);
    inset-inline: max(var(--sp-3), var(--safe-i-s));
    bottom: calc(70px + var(--safe-b));
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 8px;
    padding: 7px; border: 1px solid var(--hairline-hi); border-radius: var(--radius-lg);
    background: #0b0d17f2; box-shadow: var(--shadow-lg);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  }
  .mulligan-actions .btn{ min-width: 0; min-height: 50px; padding-inline: 10px; font-size: var(--fs-sm); }
  .mulligan-actions .btn svg{ width: 18px; height: 18px; }
}

/* ==========================================================================
   match screen
   ========================================================================== */
.match-screen{ display: flex; flex-direction: column; gap: var(--sp-3); padding-block: var(--sp-3) var(--sp-4); }

.match-topbar{ display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--sp-2); }
.champion-badge{ display: flex; align-items: center; gap: var(--sp-2); }
.champion-badge.side-player{ flex-direction: row-reverse; text-align: end; }
.champion-sigil{ flex: none; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: var(--panel-solid); border: 1px solid var(--hairline-hi); }
.champion-sigil img{ width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; display: block; }
.champion-meta{ min-width: 0; flex: 1; }
.champion-name{ font-size: var(--fs-xs); font-weight: 800; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .04em; }
.hp-bar{ width: 100%; max-width: 110px; height: 6px; border-radius: var(--radius-pill); background: var(--panel-hi); overflow: hidden; margin-top: 3px; }
.hp-fill{ height: 100%; background: linear-gradient(90deg, var(--ember), var(--ember-glow)); transition: width var(--dur-med) var(--ease-out); }
.side-bot .hp-fill{ background: linear-gradient(90deg, var(--tide), var(--tide-glow)); }
.hp-value{ display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--ink-faint); margin-top: 2px; }
.side-player .hp-value{ justify-content: flex-end; }
.hp-label{ display: inline-flex; align-items: center; gap: 3px; color: var(--ink-dim); }
.hp-label svg{ width: 10px; height: 10px; color: var(--ember-glow); fill: #ef765633; }
.side-bot .hp-label svg{ color: var(--tide-glow); fill: #64e3d333; }

.round-badge{ display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); }
.round-num{ font-size: var(--fs-xs); font-weight: 800; color: var(--ink-faint); white-space: nowrap; }
.marks-row{ display: flex; align-items: center; gap: var(--sp-2); }
.marks-side{ display: flex; gap: 4px; }
.mark-pip{ width: 10px; height: 10px; border-radius: 2px; background: var(--panel-hi); border: 1px solid var(--hairline-hi); transform: rotate(45deg); }
.mark-pip.filled{ background: var(--gold); border-color: var(--gold-bright); box-shadow: 0 0 8px -1px var(--gold); }
.marks-label{ font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-mute); }

.trials-rail{ display: flex; gap: var(--sp-2); overflow-x: auto; }
.first-duel-goal{
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: 42px;
  padding: var(--sp-2) var(--sp-4); border-radius: var(--radius-md); background: #d4a24e12;
  border: 1px solid #d4a24e55; color: var(--gold-bright); font-size: var(--fs-sm); font-weight: 800;
}
.goal-mark{ font-size: var(--fs-md); }
.tutorial-guidance{
  display: flex; align-items: center; gap: var(--sp-2); min-height: 44px; padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md); background: var(--panel-solid); border: 1px solid var(--hairline-hi); color: var(--ink);
}
.tutorial-step{ display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 24px; border-radius: var(--radius-pill); background: var(--gold); color: var(--gold-ink); font-size: var(--fs-xs); font-weight: 900; }
.trial-chip{
  flex: 1 1 0; min-width: 148px; padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-md);
  background: var(--panel); border: 1px solid var(--hairline-hi);
}
.trial-chip.claimed-player{ border-color: var(--tide); background: #2fb6a51a; }
.trial-chip.claimed-bot{ border-color: var(--ember); background: #e4572e1a; opacity: .75; }
.trial-name{ font-size: var(--fs-xs); font-weight: 800; }
.trial-desc{ font-size: 10.5px; color: var(--ink-faint); margin-top: 2px; line-height: var(--lh-snug); }
.trial-claimed{ font-size: 10px; font-weight: 800; color: var(--gold-bright); margin-top: 4px; text-transform: uppercase; letter-spacing: .05em; }

/* Board stays spatially LTR (Left Flank always physically left) even in an
   RTL page — §23.1: "coordinates mirror only if it doesn't break the spatial
   model", and a duel's Left/Throne/Right map is exactly that model. Only
   this grid's item order is pinned; text inside still reads naturally. */
.board{ display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); direction: ltr; }
.territory-col{
  display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-2); position: relative;
  border-radius: var(--radius-md); background: var(--panel); border: 1.5px dashed transparent;
  min-height: 148px; overflow: hidden;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
[dir="rtl"] .territory-col{ direction: rtl; }
/* each territory carries a faint architectural watermark so the battlefield
   reads as a *place*, not three empty boxes — flanks get a star-lattice,
   the Throne a pointed arch (the visual center of the reference ruleset) */
.territory-col::before{
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='none' stroke='%238fa6d6' stroke-width='1.5'%3E%3Cpath d='M50 6 L61 39 L94 50 L61 61 L50 94 L39 61 L6 50 L39 39 Z'/%3E%3Cpath d='M50 22 L57 43 L78 50 L57 57 L50 78 L43 57 L22 50 L43 43 Z'/%3E%3C/g%3E%3C/svg%3E") center 58% / 84px auto no-repeat;
  opacity: .09;
}
.territory-col:nth-child(2){ background: linear-gradient(180deg, #d4a24e18, var(--panel)); }
.territory-col:nth-child(2)::before{
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 120'%3E%3Cpath d='M14 118 V56 C14 28 32 14 50 6 C68 14 86 28 86 56 V118' fill='none' stroke='%23d4a24e' stroke-width='2'/%3E%3Cpath d='M24 118 V58 C24 34 38 22 50 16 C62 22 76 34 76 58 V118' fill='none' stroke='%23d4a24e' stroke-width='1' opacity='.6'/%3E%3Ccircle cx='50' cy='52' r='5' fill='none' stroke='%23d4a24e' stroke-width='1.5'/%3E%3C/svg%3E");
  background-position: center bottom -6px; background-size: auto 118px;
  opacity: .16;
}
.territory-col:nth-child(2) .territory-header{ color: var(--gold-bright); }
.territory-col:nth-child(2)::after{
  content: ""; position: absolute; top: 0; inset-inline: 18%; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.territory-col.drop-target{ border-color: var(--gold); cursor: pointer; }
.territory-col.drop-target:hover{ background: #d4a24e22; }
.territory-col.has-staged{
  border-color: var(--gold-dim); background: linear-gradient(180deg, #d4a24e16, var(--panel));
  box-shadow: inset 0 0 22px #d4a24e0c;
}
.territory-tap-label{ inset-block-start: 28px; inset-inline-start: 50%; transform: translateX(-50%); }
.first-duel .territory-col.tutorial-lane{ box-shadow: inset 0 0 0 1px #d4a24e33; }
.territory-header{ font-size: 10.5px; font-weight: 800; text-align: center; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; }
.unit-row{ display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; min-height: 26px; }
.unit-token{
  min-width: 30px; height: 26px; padding-inline: 4px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 800;
  color: var(--void); background: var(--rarity-common);
}
.unit-token.elem-ember{ background: linear-gradient(180deg, var(--ember-glow), var(--ember)); }
.unit-token.elem-tide{ background: linear-gradient(180deg, var(--tide-glow), var(--tide)); }
.unit-token.elem-gale{ background: linear-gradient(180deg, var(--gale-glow), var(--gale)); }
.unit-token.elem-stone{ background: linear-gradient(180deg, var(--stone-glow), var(--stone)); }
.unit-token.elem-neutral{ background: linear-gradient(180deg, #e8e4d8, var(--rarity-common)); }
.unit-token.legal-target{ outline: 2px solid var(--gold-bright); outline-offset: 2px; cursor: pointer; animation: pulse-target 1.1s ease-in-out infinite; }
@keyframes pulse-target{ 50%{ outline-color: transparent; } }
.staged-unit-preview{
  position: relative; display: grid; grid-template-columns: 28px 1fr; grid-template-rows: 1fr auto;
  width: min(100%, 84px); min-height: 48px; overflow: hidden; border-radius: var(--radius-sm);
  border: 1px dashed var(--gold-bright); background: #0b0d17eb; color: var(--ink);
  box-shadow: 0 0 14px -6px var(--gold); animation: staged-in var(--dur-med) var(--ease-out);
}
@keyframes staged-in{ from{ opacity: 0; transform: translateY(5px) scale(.96); } }
.staged-unit-preview img{ grid-row: 1 / 3; width: 28px; height: 100%; object-fit: cover; opacity: .78; }
.staged-unit-copy{ display: flex; align-items: center; justify-content: space-between; gap: 3px; min-width: 0; padding: 3px 4px 0; }
.staged-unit-copy strong{ font-size: 10px; color: var(--gold-bright); }
.staged-unit-state{ font-size: 7px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); }
.staged-unit-name{ min-width: 0; padding: 0 4px 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 8px; font-weight: 800; color: var(--ink-dim); }
.territory-power{
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font-size: var(--fs-sm); font-weight: 800;
  width: fit-content; margin-inline: auto; margin-block: auto;
  padding: 2px var(--sp-3); border-radius: var(--radius-pill);
  background: #00000040; border: 1px solid var(--hairline);
}
.power-bot{ color: var(--tide-glow); } .power-player{ color: var(--ember-glow); } .vs{ color: var(--ink-mute); }
.power-player-total{ display: inline-flex; align-items: baseline; gap: 3px; }
.power-staged{ color: var(--gold-bright); font-size: .72em; }

.staged-tray{ display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; padding: var(--sp-2) var(--sp-3); background: var(--panel); border-radius: var(--radius-md); border: 1px solid var(--hairline); }
.staged-summary{ display: flex; flex: 1 1 260px; flex-direction: column; gap: 3px; min-width: 0; }
.staged-title{ font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); }
.staged-chips{ display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.staged-chip{ display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding-inline-start: var(--sp-2); border-radius: var(--radius-pill); background: var(--panel-hi); border: 1px solid var(--hairline-hi); font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; }
.staged-card-name{ color: var(--ink); }
.staged-arrow{ color: var(--gold); }
[dir="rtl"] .staged-arrow{ transform: scaleX(-1); }
.staged-destination{ color: var(--gold-bright); }
.chip-remove{ display: inline-flex; align-items: center; justify-content: center; width: 44px; min-height: 44px; color: var(--ink-faint); font-size: var(--fs-md); line-height: 1; border-radius: 50%; }
.chip-remove:hover{ color: var(--ember-glow); }
.staged-empty{ font-size: var(--fs-xs); }
/* Energy is the number every card in hand is measured against, so it is
   named, spaced away from the staged chips, and readable at a glance. */
.energy-meter{
  display: flex; align-items: center; gap: var(--sp-3); flex: none;
  padding: var(--sp-1) var(--sp-3); border-radius: var(--radius-pill);
  background: #d4a24e14; border: 1px solid var(--gold-dim);
}
.energy-title{
  font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .14em;
  text-transform: uppercase; color: var(--gold);
}
.energy-pips{ display: flex; gap: 4px; }
.energy-pip{
  width: 10px; height: 20px; border-radius: 3px;
  background: var(--bg-0); border: 1px solid var(--hairline-hi);
}
.energy-pip.filled{
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border-color: var(--gold-bright); box-shadow: 0 0 8px -2px var(--gold);
}
.energy-value{ font-size: var(--fs-md); font-weight: 800; color: var(--gold-bright); }

.action-bar{ display: flex; flex-direction: column; gap: var(--sp-2); position: sticky; bottom: calc(var(--sp-2) + var(--safe-b)); }
.action-bar-row{ display: flex; gap: var(--sp-2); }
.pill-btn{
  flex: 1; display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 44px; border-radius: var(--radius-pill); background: var(--panel-solid); border: 1px solid var(--hairline-hi);
  font-size: var(--fs-sm); font-weight: 800; color: var(--ink-dim);
}
.pill-btn svg{ width: 18px; height: 18px; }
.pill-btn:not(.disabled):hover{ border-color: var(--gold-dim); color: var(--ink); }
.pill-btn.disabled{ opacity: .4; cursor: not-allowed; }
.lock-btn{ display: flex; justify-content: space-between; }
.timer-badge{
  min-width: 30px; height: 26px; padding-inline: 6px; border-radius: var(--radius-pill);
  background: #00000030; display: inline-flex; align-items: center; justify-content: center; font-size: var(--fs-sm);
}

.inline-panel{ padding: var(--sp-4); border-radius: var(--radius-lg); background: var(--panel-solid); border: 1px solid var(--gold-dim); animation: panel-in var(--dur-med) var(--ease-out); }
@keyframes panel-in{ from{ opacity: 0; transform: translateY(6px);} to{ opacity: 1; transform: none; } }
.target-grid{ display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-3); }

@media (min-width: 768px){
  .match-screen{ max-width: 720px; margin-inline: auto; }
}
@media (min-width: 1024px){
  .match-screen{ max-width: 860px; }
  .action-bar{ position: static; }
}

/* ========================================================================
   mobile duel layout

   The phone is the base interaction surface: a compact scoreboard, all
   three objectives and lanes visible at once, a horizontal hand, and one
   thumb dock above the primary navigation. Desktop expands this system.
   ======================================================================== */
@media (max-width: 767px){
  .main{
    padding-inline: max(var(--sp-3), var(--safe-i-s));
    padding-bottom: calc(70px + var(--safe-b));
  }

  .bottom-tabbar{
    position: fixed; inset-inline: 0; bottom: 0;
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    height: calc(66px + var(--safe-b));
    padding: 6px max(4px, var(--safe-i-s)) calc(6px + var(--safe-b));
  }
  /* Rules remain available as a route, but a manual is not a primary game
     destination. Five stable tabs fit thumbs; six do not. */
  .bottom-tabbar .tab-link[data-route="rules"]{ display: none; }
  .tab-link{ min-width: 0; width: 100%; padding: 3px 1px; font-size: 9.5px; }
  .tab-link svg{ width: 21px; height: 21px; }

  .toast-root{ top: calc(58px + var(--safe-t)); padding-inline: var(--sp-3); }
  .toast{
    width: min(100%, 360px); min-height: 44px; padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-md); font-size: var(--fs-sm); line-height: var(--lh-snug);
  }

  .match-screen{
    width: 100%; min-width: 0; gap: var(--sp-2);
    padding-block: var(--sp-2) calc(74px + var(--sp-4));
  }
  .match-screen > *{ min-width: 0; max-width: 100%; }

  .match-topbar{ gap: 6px; }
  .champion-badge{ gap: 6px; }
  .champion-sigil{ width: 36px; height: 36px; }
  .champion-name{ font-size: 10px; }
  .hp-bar{ height: 5px; }
  .hp-value{ font-size: 10px; }
  .round-num{ font-size: 10px; }
  .marks-row{ gap: 6px; }
  .marks-label{ display: none; }

  .trials-rail{
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px; width: 100%; overflow: visible;
  }
  .trial-chip{ min-width: 0; padding: 7px 6px; }
  .trial-name{
    display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    font-size: 10px; line-height: 1.2; text-align: center;
  }
  .trial-desc{ display: none; }
  .trial-claimed{ text-align: center; font-size: 9px; }

  .board{ gap: 5px; width: 100%; }
  .territory-col{ min-width: 0; min-height: 118px; gap: 5px; padding: 6px 4px; border-radius: 10px; }
  .territory-header{ min-height: 24px; font-size: 9px; line-height: 1.2; }
  .territory-col::before{ background-size: 64px auto; }
  .territory-col:nth-child(2)::before{ background-size: auto 96px; }
  .territory-power{ gap: 6px; padding: 2px 7px; font-size: var(--fs-xs); }
  .unit-row{ min-height: 23px; gap: 3px; }
  .unit-token{ min-width: 27px; height: 23px; font-size: 10px; }

  .staged-tray{
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
    gap: var(--sp-2); padding: 6px 8px; flex-wrap: nowrap;
  }
  .staged-chips{ min-width: 0; overflow-x: auto; flex-wrap: nowrap; }
  .staged-empty{ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .energy-meter{ gap: 6px; padding: 3px 8px; }
  .energy-title{ font-size: 9px; }
  .energy-pips{ gap: 2px; }
  .energy-pip{ width: 7px; height: 15px; }
  .energy-value{ font-size: var(--fs-sm); }

  .hand-rail{ width: 100%; max-width: 100%; min-width: 0; gap: 8px; padding-block: 6px; }
  .hand-rail::-webkit-scrollbar{ display: none; }
  .hand-card{ width: 112px; min-height: 166px; padding: 8px; }
  .hand-card-art{ height: 82px; }
  .hand-card-tap-label{ inset-block-start: 72px; }
  .hand-card-name{ max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hand-card-blocked{ font-size: 9px; }

  .action-bar{
    position: fixed; z-index: calc(var(--z-header) - 1);
    inset-inline: max(var(--sp-3), var(--safe-i-s));
    bottom: calc(70px + var(--safe-b));
    display: flex; flex-direction: row; align-items: center; gap: 8px;
    padding: 7px; border: 1px solid var(--hairline-hi); border-radius: var(--radius-lg);
    background: #0b0d17f2; box-shadow: var(--shadow-lg);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  }
  .action-bar-row{ display: contents; }
  .pill-btn{
    flex: 0 1 96px; width: auto; min-width: 46px; min-height: 46px;
    padding-inline: 7px; border-radius: var(--radius-md); font-size: 10px; line-height: 1.1;
  }
  .pill-btn span{ max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pill-btn svg{ width: 20px; height: 20px; }
  .lock-btn{ flex: 1; min-width: 0; min-height: 48px; justify-content: space-between; }
  .inline-panel{ margin-bottom: var(--sp-2); }
}

@media (min-width: 640px) and (max-width: 767px){
  .hand-card{ width: 124px; min-height: 184px; }
  .hand-card-art{ height: 98px; }
}

@media (min-width: 768px){
  .action-bar{ position: static; }
}

/* ==========================================================================
   round report
   ========================================================================== */
.report-screen{ max-width: 560px; margin-inline: auto; padding-block: var(--sp-8) var(--sp-16); }
.report-list{ margin-top: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-2); }
.report-line{
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-md); background: var(--panel);
  font-size: var(--fs-sm); border-inline-start: 3px solid var(--hairline-hi);
  animation: report-in var(--dur-med) var(--ease-out) backwards;
}
.report-list > *:nth-child(1){ animation-delay: 0ms; }
.report-list > *:nth-child(2){ animation-delay: 60ms; }
.report-list > *:nth-child(3){ animation-delay: 120ms; }
.report-list > *:nth-child(4){ animation-delay: 180ms; }
.report-list > *:nth-child(5){ animation-delay: 240ms; }
.report-list > *:nth-child(n+6){ animation-delay: 300ms; }
@keyframes report-in{ from{ opacity: 0; transform: translateY(8px); } }
.report-line.side-player{ border-inline-start-color: var(--ember); }
.report-line.side-bot{ border-inline-start-color: var(--tide); }
.report-line.muted{ color: var(--ink-faint); }
.report-line.destroyed .report-thumb{ filter: grayscale(1) brightness(.6); }
.report-line.destroyed .report-line-title{ text-decoration: line-through; text-decoration-color: var(--ember); }
.report-thumb{
  flex: none; width: 38px; height: 38px; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--bg-1); border: 1px solid var(--hairline-hi);
}
.report-thumb img, .report-thumb svg{ width: 100%; height: 100%; object-fit: cover; display: block; }
.report-line-text{ display: flex; flex-direction: column; min-width: 0; }
.report-line-title{ font-weight: 800; line-height: var(--lh-snug); }
.report-line-sub{ font-size: var(--fs-2xs); color: var(--ink-faint); }
.report-mark{
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-md);
  background: linear-gradient(100deg, #d4a24e2e, #d4a24e10);
  border: 1px solid var(--gold-dim);
  animation: mark-in var(--dur-slow) var(--ease-spring) backwards;
}
@keyframes mark-in{ from{ opacity: 0; transform: scale(.92); } }
.report-mark-gem{
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; font-size: var(--fs-lg);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold)); color: var(--gold-ink);
  box-shadow: 0 0 18px -2px var(--gold);
}
.report-mark strong{ display: block; font-size: var(--fs-md); color: var(--gold-bright); }
.report-mark-sub{ font-size: var(--fs-2xs); color: var(--ink-dim); text-transform: uppercase; letter-spacing: .06em; }

/* ==========================================================================
   results
   ========================================================================== */
.results-screen{ max-width: 640px; margin-inline: auto; padding-block: var(--sp-8) var(--sp-16); display: flex; flex-direction: column; gap: var(--sp-5); }
.results-hero{
  position: relative; overflow: hidden; border-radius: var(--radius-xl);
  min-height: 300px; display: flex; align-items: flex-end; justify-content: center;
  border: 1px solid var(--hairline-hi); background: var(--panel);
}
.results-hero-art{
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 12%;
  animation: hero-settle 900ms var(--ease-out);
}
@keyframes hero-settle{ from{ transform: scale(1.06); opacity: .4; } }
.results-screen.lost .results-hero-art{ filter: grayscale(.75) brightness(.55); }
.results-hero-scrim{
  position: absolute; inset: 0;
  background: linear-gradient(0deg, #07080ff2 8%, #07080f99 38%, #07080f26 70%, transparent 100%);
}
.results-screen.won .results-hero-scrim{
  background:
    radial-gradient(70% 60% at 50% 100%, #d4a24e30, transparent 65%),
    linear-gradient(0deg, #07080ff2 8%, #07080f99 38%, #07080f26 70%, transparent 100%);
}
.results-hero-content{ position: relative; text-align: center; padding: var(--sp-6) var(--sp-4) var(--sp-8); }
.results-title{ font-size: var(--fs-4xl); font-weight: 900; line-height: var(--lh-tight); text-shadow: 0 2px 16px #000000cc; }
.results-screen.won .results-title{ color: var(--gold-bright); }
.results-marks{ margin-top: var(--sp-2); font-size: var(--fs-lg); font-weight: 800; color: var(--ink-dim); }
.results-reason{ margin-top: var(--sp-1); font-size: var(--fs-xs); color: var(--ink-faint); text-transform: uppercase; letter-spacing: .08em; }
.first-duel-debrief{
  display: flex; flex-direction: column; gap: 3px; padding: var(--sp-4); border-radius: var(--radius-md);
  background: #d4a24e12; border: 1px solid #d4a24e4d; color: var(--ink-dim); font-size: var(--fs-sm);
}
.first-duel-debrief strong{ color: var(--gold-bright); }

.trial-results{ display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-3); }
.trial-result{ display: flex; justify-content: space-between; padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-md); background: var(--panel-hi); font-size: var(--fs-sm); }
.trial-result.claimed-player{ box-shadow: inset 3px 0 0 var(--ember); }
.trial-result.claimed-bot{ box-shadow: inset 3px 0 0 var(--tide); }
.trial-result-who{ font-weight: 800; color: var(--gold-bright); }

.milestone-list{ display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-3); }
.milestone-card{ display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-md); background: linear-gradient(90deg, #d4a24e22, transparent); border: 1px solid var(--gold-dim); }
.milestone-sigil{ flex: none; width: 44px; height: 44px; }
.milestone-name{ font-weight: 800; }
.milestone-tag{ font-size: var(--fs-2xs); color: var(--gold-bright); text-transform: uppercase; letter-spacing: .05em; }

.results-alliance-note{ text-align: center; }
.results-actions{ display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; }

/* ==========================================================================
   collection
   ========================================================================== */
.collection-screen{ padding-block: var(--sp-6) var(--sp-16); }
.collection-head{ display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.deck-count-badge{ padding: var(--sp-2) var(--sp-4); border-radius: var(--radius-pill); background: var(--panel); border: 1px solid var(--hairline-hi); font-weight: 800; font-size: var(--fs-sm); white-space: nowrap; }
.deck-count-badge.valid{ border-color: var(--tide); color: var(--tide-glow); background: #2fb6a51a; }

.filter-tabs{ display: flex; gap: var(--sp-2); margin-top: var(--sp-5); overflow-x: auto; padding-bottom: var(--sp-1); }
.filter-tab{ min-height: 44px; padding: var(--sp-2) var(--sp-4); border-radius: var(--radius-pill); background: var(--panel); border: 1px solid var(--hairline-hi); font-size: var(--fs-sm); font-weight: 700; color: var(--ink-dim); white-space: nowrap; }
.filter-tab.active{ background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.filter-tab.filter-neutral{ border-color: #9aa0b466; color: #d8d4c8; }
.filter-tab.filter-neutral.active{
  background: linear-gradient(180deg, #e8e4d8, var(--rarity-common));
  border-color: #e8e4d8; color: #171922;
  box-shadow: 0 0 0 1px #d8d4c833;
}

.coll-grid{ display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); margin-top: var(--sp-5); }
@media (min-width: 640px){ .coll-grid{ grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px){ .coll-grid{ grid-template-columns: repeat(5, 1fr); } }

.coll-card{ position: relative; border-radius: var(--radius-md); background: var(--panel-solid); border: 1.5px solid var(--hairline-hi); overflow: hidden; }
.coll-card::before{
  content: ""; position: absolute; z-index: 1; inset: 0 0 auto; block-size: 3px;
  background: var(--card-element, transparent); pointer-events: none;
}
.coll-card.elem-ember{ --card-element: var(--ember-glow); }
.coll-card.elem-tide{ --card-element: var(--tide-glow); }
.coll-card.elem-gale{ --card-element: var(--gale-glow); }
.coll-card.elem-stone{ --card-element: var(--stone-glow); }
.coll-card.elem-neutral{ --card-element: linear-gradient(90deg, var(--rarity-common), #e8e4d8, var(--rarity-common)); }
.coll-card.rarity-rare{ border-color: var(--rarity-rare); }
.coll-card.rarity-epic{ border-color: var(--rarity-epic); }
.coll-card.rarity-legendary{ border-color: var(--rarity-legendary); }
.coll-card-body{ width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: var(--sp-3); text-align: center; position: relative; }
.coll-card-sigil{ width: 64px; height: 64px; }
.coll-card-name{ font-size: var(--fs-xs); font-weight: 800; }
.coll-card-type{ font-size: 10px; color: var(--ink-faint); }
.evo-badge{ position: absolute; top: 4px; inset-inline-end: 4px; font-size: 9px; color: var(--gold-bright); letter-spacing: 1px; }
.coll-stepper{ display: flex; align-items: center; justify-content: space-between; padding: var(--sp-1) var(--sp-2); border-top: 1px solid var(--hairline); background: #00000022; }
.stepper-btn{ width: 44px; height: 44px; border-radius: var(--radius-sm); background: var(--panel-hi); font-weight: 900; color: var(--ink); }
.stepper-btn:disabled{ opacity: .3; }
.stepper-count{ font-size: var(--fs-2xs); color: var(--ink-faint); }

/* ==========================================================================
   passport
   ========================================================================== */
.passport-screen{ max-width: 560px; margin-inline: auto; padding-block: var(--sp-6) var(--sp-16); display: flex; flex-direction: column; gap: var(--sp-4); }
.passport-card{
  text-align: center; padding: var(--sp-8) var(--sp-6); border-radius: var(--radius-xl);
  background: radial-gradient(80% 60% at 50% 0%, #d4a24e1c, transparent), var(--panel);
  border: 1.5px solid var(--hairline-hi);
}
.passport-card.rarity-rare{ border-color: var(--rarity-rare); }
.passport-card.rarity-epic{ border-color: var(--rarity-epic); }
.passport-card.rarity-legendary{ border-color: var(--rarity-legendary); box-shadow: 0 0 40px -12px #f2c57255; }
.passport-sigil{ margin-inline: auto; width: 180px; height: 180px; }
.passport-name{ font-size: var(--fs-2xl); font-weight: 900; margin-top: var(--sp-3); }
.passport-flavor{ color: var(--ink-faint); font-style: italic; margin-top: var(--sp-1); }
.passport-chips{ display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center; margin-top: var(--sp-4); }
.passport-meta .meta-row{ display: flex; justify-content: space-between; padding-block: var(--sp-2); border-bottom: 1px solid var(--hairline); font-size: var(--fs-sm); }
.passport-meta .meta-row:last-child{ border-bottom: 0; }
.milestone-rows{ display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-3); }
.milestone-row{ display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-md); background: var(--panel-hi); font-size: var(--fs-sm); color: var(--ink-faint); }
.milestone-row.unlocked{ color: var(--ink); background: #2fb6a51a; }
.milestone-dot{ width: 8px; height: 8px; border-radius: 50%; background: var(--ink-mute); }
.milestone-row.unlocked .milestone-dot{ background: var(--tide); }
.milestone-state{ margin-inline-start: auto; font-weight: 800; }
.passport-actions{ display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.passport-actions .btn{ flex: 1; }

/* ==========================================================================
   world / alliance front
   ========================================================================== */
.world-screen{ max-width: 760px; margin-inline: auto; padding-block: var(--sp-6) var(--sp-16); display: flex; flex-direction: column; gap: var(--sp-4); }
.front-hero{ display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-6); position: relative; overflow: hidden; }
.front-hero-watermark{
  position: absolute; inset-inline-end: -48px; top: 50%; transform: translateY(-50%);
  width: 240px; height: 240px; object-fit: cover; border-radius: 50%;
  opacity: .14; pointer-events: none;
}
.front-hero > div{ position: relative; }
.front-emblem{ flex: none; width: 90px; height: 90px; border-radius: 50%; overflow: hidden; border: 1.5px solid var(--gold-dim); }
.front-emblem img{ width: 100%; height: 100%; object-fit: cover; display: block; }
.world-cta{ font-size: var(--fs-lg); }
.stats-row{ display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); text-align: center; }
.stat-value{ font-size: var(--fs-2xl); font-weight: 900; color: var(--gold-bright); }
.stat-label{ font-size: var(--fs-2xs); color: var(--ink-faint); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.front-rows{ display: flex; flex-direction: column; gap: var(--sp-4); margin-top: var(--sp-4); }
.front-row-head{ display: flex; justify-content: space-between; font-size: var(--fs-sm); font-weight: 700; margin-bottom: var(--sp-2); }
.front-status{ font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .05em; font-weight: 800; }
.status-leading{ color: var(--tide-glow); } .status-behind{ color: var(--ember-glow); } .status-contested{ color: var(--gold-bright); }
.front-bar{ height: 10px; border-radius: var(--radius-pill); background: var(--panel-hi); overflow: hidden; }
.front-bar-fill{ height: 100%; background: linear-gradient(90deg, var(--ember), var(--gold), var(--tide)); transition: width var(--dur-med) var(--ease-out); }
.alliance-footnote{ margin-top: var(--sp-4); font-size: var(--fs-xs); line-height: var(--lh-normal); }

/* ==========================================================================
   store
   ========================================================================== */
.store-screen{ padding-block: var(--sp-6) var(--sp-16); }
.store-head{ position: relative; }
.store-preview-badge{ position: absolute; top: 0; inset-inline-end: 0; }
.store-note{ max-width: 62ch; margin-top: var(--sp-2); font-size: var(--fs-xs); }
.offer-grid{ display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); margin-top: var(--sp-6); }
@media (min-width: 640px){ .offer-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px){ .offer-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px){ .offer-grid{ grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.offer-card{ min-width: 0; padding: var(--sp-4); border-radius: var(--radius-lg); background: var(--panel); border: 1px solid var(--hairline-hi); display: flex; flex-direction: column; gap: var(--sp-2); }
.offer-price{ font-size: var(--fs-xl); font-weight: 900; color: var(--gold-bright); }
.offer-card h3{ font-size: var(--fs-md); font-weight: 800; }
.offer-card p{ font-size: var(--fs-xs); flex: 1; }
.offer-badges{ display: flex; flex-wrap: wrap; gap: 4px; }
.offer-badges .chip{ font-size: 9.5px; padding: 2px var(--sp-2); }
.offer-card > .btn{ max-width: 100%; white-space: normal; }

/* ---- patron memberships --------------------------------------------------*/
.patron-section{
  max-width: 74rem;
  margin: var(--sp-12) auto 0;
  padding: clamp(var(--sp-4), 3vw, var(--sp-8));
  border: 1px solid rgba(242, 197, 114, .18);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 50% -25%, rgba(242, 197, 114, .12), transparent 42%),
    rgba(12, 14, 25, .52);
}
.patron-heading{
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--sp-6);
}
.patron-heading > div:first-child{ max-width: 42rem; }
.patron-heading .section-title{ margin-block: var(--sp-1); }
.patron-eyebrow{
  color: var(--gold-bright);
  font-size: var(--fs-2xs);
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.patron-promises{ display: flex; flex-wrap: wrap; justify-content: end; gap: var(--sp-2); }
.patron-promises span{
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding-inline: var(--sp-3);
  border: 1px solid rgba(99, 230, 212, .3);
  border-radius: var(--radius-pill);
  color: var(--tide-glow);
  background: rgba(99, 230, 212, .06);
  font-size: var(--fs-2xs);
  font-weight: 800;
  white-space: nowrap;
}
.patron-promises span::before{ content: "✓"; margin-inline-end: 6px; }
.patron-grid{ display: grid; grid-template-columns: 1fr; gap: var(--sp-4); margin-top: var(--sp-6); }
@media (min-width: 700px){ .patron-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1080px){ .patron-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.offer-card.patron-card{
  position: relative;
  display: flex;
  padding: clamp(var(--sp-4), 2vw, var(--sp-6));
  border-color: rgba(242, 197, 114, .25);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(155deg, rgba(242, 197, 114, .08), transparent 34%),
    var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .16);
}
.offer-card.patron-card.is-recommended{
  border-color: rgba(99, 230, 212, .62);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .2), inset 0 2px 0 rgba(99, 230, 212, .45);
}
.patron-card-top{ display: flex; align-items: center; min-height: 52px; gap: var(--sp-2); }
.patron-card-top .offer-emblem{ margin-inline-end: auto; }
.patron-level, .patron-recommended{
  padding: 5px 9px;
  border: 1px solid var(--hairline-hi);
  border-radius: var(--radius-pill);
  color: var(--ink-faint);
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.patron-recommended{ color: var(--tide-glow); border-color: rgba(99, 230, 212, .4); }
.patron-price{ display: flex; align-items: baseline; gap: var(--sp-2); margin-top: var(--sp-3); }
.patron-price strong{ color: var(--gold-bright); font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1; }
.patron-price span{ color: var(--ink-faint); font-size: var(--fs-xs); font-weight: 700; }
.offer-card.patron-card h3{ margin-top: var(--sp-2); font-size: var(--fs-xl); line-height: var(--lh-snug); }
.offer-card.patron-card .patron-summary{ min-height: 4.5em; flex: none; line-height: var(--lh-normal); }
.patron-value-list{ list-style: none; margin: var(--sp-3) 0 0; padding: 0; display: grid; gap: var(--sp-2); }
.patron-value-list li{ display: flex; align-items: start; gap: var(--sp-2); font-size: var(--fs-xs); line-height: var(--lh-normal); }
.patron-check{
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #081310;
  background: var(--tide-glow);
  font-size: 11px;
  font-weight: 900;
}
.patron-term{
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: auto;
  padding-top: var(--sp-4);
  color: var(--ink-faint);
  font-size: var(--fs-2xs);
  font-weight: 800;
}
.patron-card > .btn{ min-height: 48px; margin-top: var(--sp-3); }
.patron-details{
  align-self: center;
  padding: var(--sp-2);
  border: 0;
  color: var(--ink-dim);
  background: transparent;
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.patron-details:hover{ color: var(--ink); }

.tier-contents{ font-size: var(--fs-xs); }
.tier-contents-h{ text-transform: uppercase; letter-spacing: .08em; font-size: 9.5px; }
.tier-contents ul{ list-style: none; margin: var(--sp-2) 0 0; padding: 0; display: grid; gap: 3px; }
.tier-contents li{
  display: flex; gap: var(--sp-2); align-items: baseline; justify-content: space-between;
  padding-block: 2px; border-bottom: 1px solid var(--hairline-hi);
}
.tier-contents li:last-child{ border-bottom: 0; }
/* A component the player already holds, so the overlap is visible before they
   pay rather than discovered afterwards. */
.tier-contents li.is-held{ opacity: .55; }
.tier-contents li.is-held > span:first-child::before{ content: "✓ "; color: var(--gold-bright); }
.tier-term{ flex: none; font-size: 9.5px; opacity: .7; white-space: nowrap; }
.renew-note{ font-size: var(--fs-xs); }

.seat-count{ font-size: var(--fs-xs); font-weight: 700; color: var(--gold-bright); }
.seat-count.is-out{ color: inherit; opacity: .6; }

/* ---- deliberate confirmation ---------------------------------------------*/
.confirm-scrim{
  position: fixed; inset: 0; z-index: var(--z-modal);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-4);
  background: rgba(0, 0, 0, .62);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  overflow-y: auto;
}
.confirm-sheet{ width: min(30rem, 100%); max-height: 100%; overflow-y: auto; }
.confirm-sheet .tier-contents li{ border-bottom-color: var(--hairline-hi); }
.confirm-fair{
  font-size: var(--fs-xs); font-weight: 700;
  padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-md);
  border: 1px solid rgba(242, 197, 114, .35);
}
.confirm-warn{ font-size: var(--fs-xs); }

/* ---- account: lapsed benefits and legacy founder seats -------------------*/
.owned-chip.is-lapsed{ opacity: .55; }
.owned-chip.is-seat .owned-date{ color: var(--gold-bright); font-weight: 800; }
.refund-due{ border-color: rgba(242, 197, 114, .45); }

@media (max-width: 639px){
  .store-screen{ padding-block-start: var(--sp-4); }
  .store-head{ display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-2); align-items: start; }
  .store-head .section-title, .store-head .dim{ grid-column: 1; }
  .store-preview-badge{ position: static; grid-column: 2; grid-row: 1; }
  .store-note{ font-size: var(--fs-sm); line-height: var(--lh-normal); }
  .offer-grid{ margin-top: var(--sp-4); }
  .offer-card{
    display: grid; grid-template-columns: 64px minmax(0, 1fr);
    column-gap: var(--sp-3); row-gap: var(--sp-2);
    border-radius: var(--radius-md);
  }
  .offer-emblem{ grid-column: 1; grid-row: 1 / span 2; align-self: center; }
  .offer-card h3{ grid-column: 2; grid-row: 1; align-self: end; font-size: var(--fs-lg); line-height: var(--lh-snug); }
  .offer-price{ grid-column: 2; grid-row: 2; align-self: start; font-size: var(--fs-lg); }
  .offer-card > p, .offer-badges, .offer-card > .btn{ grid-column: 1 / -1; }
  .offer-card > p{ font-size: 1rem; line-height: var(--lh-normal); }
  .offer-badges{ gap: 6px; }
  .offer-badges .chip{ min-height: 28px; padding: 3px var(--sp-2); font-size: var(--fs-xs); }
  .offer-card > .btn{ min-height: 48px; margin-top: var(--sp-1); }
  .patron-section{ margin-top: var(--sp-8); padding: var(--sp-4); border-radius: var(--radius-lg); }
  .patron-heading{ display: block; }
  .patron-heading .section-title{ font-size: var(--fs-2xl); }
  .patron-promises{ justify-content: start; margin-top: var(--sp-3); gap: 6px; }
  .patron-promises span{ min-height: 28px; padding-inline: var(--sp-2); }
  .patron-grid{ margin-top: var(--sp-4); }
  .offer-card.patron-card{ display: flex; padding: var(--sp-4); border-radius: var(--radius-lg); }
  .offer-card.patron-card h3{ font-size: var(--fs-xl); }
  .offer-card.patron-card .patron-summary{ min-height: 0; font-size: var(--fs-sm); }
  .patron-price strong{ font-size: 2.25rem; }
  .patron-card > .btn{ margin-top: var(--sp-3); }
}

/* ==========================================================================
   rival hall
   ========================================================================== */
.hall-screen{ max-width: 760px; margin-inline: auto; padding-block: var(--sp-6) var(--sp-16); display: flex; flex-direction: column; gap: var(--sp-4); }
.hall-hero{ display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-6); }
.hall-emblem{ flex: none; width: 88px; height: 110px; border-radius: var(--radius-md); overflow: hidden; border: 1.5px solid var(--gold-dim); }
.hall-emblem img{ width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; display: block; }
.hall-chips{ display: flex; gap: var(--sp-2); margin-top: var(--sp-2); flex-wrap: wrap; }
.showcase-grid{ display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); margin-top: var(--sp-3); }
@media (min-width: 640px){ .showcase-grid{ grid-template-columns: repeat(6, 1fr); } }
.showcase-card{ display: flex; flex-direction: column; align-items: center; gap: 4px; padding: var(--sp-3); border-radius: var(--radius-md); background: var(--panel-hi); border: 1px solid var(--gold-dim); text-align: center; }
.showcase-name{ font-size: 10.5px; font-weight: 800; }
.showcase-tier{ font-size: 9px; color: var(--gold-bright); letter-spacing: 1px; }

/* ==========================================================================
   account + auth
   ========================================================================== */
.account-btn{
  position: relative; display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: 40px; padding-inline: var(--sp-3); border-radius: var(--radius-pill);
  border: 1px solid var(--hairline-hi); color: var(--ink-dim);
  font-size: var(--fs-sm); font-weight: 800; text-decoration: none;
  transition: color var(--dur-fast), background var(--dur-fast), border-color var(--dur-fast);
}
.account-btn svg{ width: 18px; height: 18px; flex: none; }

/* Sound sits in the chrome because it is a device setting, not an account
   one, and signed out the Account screen is only reachable via a button
   labelled "Sign in" -- which nobody clicks to turn the music down. */
.sound-btn{
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: none; padding: 0;
  border-radius: var(--radius-pill);
  border: 1px solid var(--hairline-hi); background: transparent;
  color: var(--ink-dim); cursor: pointer;
  transition: color var(--dur-fast), background var(--dur-fast), border-color var(--dur-fast);
}
.sound-btn svg{ width: 19px; height: 19px; }
.sound-btn:hover{ color: var(--ink); background: var(--hairline); border-color: var(--gold-dim); }
.sound-btn.is-muted{ color: var(--ink-mute); }
.sound-btn.is-muted:hover{ color: var(--ink-dim); }
.account-btn:hover{ color: var(--ink); background: var(--hairline); border-color: var(--gold-dim); }
.account-btn.active{ color: var(--gold-bright); background: #d4a24e1a; border-color: var(--gold-dim); }
/* A guest has something to do here, so the button says so. */
.account-btn.needs-account{ color: var(--gold-bright); border-color: var(--gold-dim); background: #d4a24e14; }
.account-btn.needs-account::after{
  content: ""; position: absolute; top: 6px; inset-inline-end: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold-bright); box-shadow: 0 0 8px var(--gold);
}
@media (max-width: 560px){
  .account-btn-label{ display: none; }
  .account-btn{ padding-inline: var(--sp-2); }
}

.guest-banner{
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4); flex-wrap: wrap;
  padding: var(--sp-4) var(--sp-5); border-radius: var(--radius-lg);
  background: linear-gradient(100deg, #d4a24e26, #d4a24e0d);
  border: 1px solid var(--gold-dim);
}
.guest-banner-text strong{ display: block; font-size: var(--fs-md); color: var(--gold-bright); }
.guest-banner-text p{ margin-top: 2px; font-size: var(--fs-sm); color: var(--ink-dim); max-width: 52ch; }
.guest-banner-actions{ display: flex; align-items: center; gap: var(--sp-3); flex: none; }

.sync-note{
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-xs); color: var(--ink-faint);
}
.sync-dot{
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--tide); box-shadow: 0 0 8px var(--tide);
}

.account-screen{
  max-width: 680px; margin-inline: auto; padding-block: var(--sp-6) var(--sp-16);
  display: flex; flex-direction: column; gap: var(--sp-4);
}
.account-id{ display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); }
.account-label{ font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .08em; }
.account-email{ font-size: var(--fs-lg); font-weight: 800; margin-top: 2px; word-break: break-all; }

.auth-form{ display: flex; flex-direction: column; }
.auth-form label{ font-size: var(--fs-xs); font-weight: 800; color: var(--ink-dim); margin-bottom: var(--sp-2); }
.field{
  width: 100%; min-height: 46px; padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md); background: var(--bg-1);
  border: 1px solid var(--hairline-hi); color: var(--ink); font-size: var(--fs-md);
}
.field:focus-visible{ border-color: var(--gold); outline: none; box-shadow: var(--glow-gold); }
.link-btn{
  align-self: flex-start; color: var(--gold-bright); font-size: var(--fs-sm);
  font-weight: 700; text-decoration: underline; text-underline-offset: 3px;
}
.form-msg{ margin-top: var(--sp-3); font-size: var(--fs-sm); min-height: 1.2em; }
.form-msg.error{ color: var(--ember-glow); }
.form-msg.ok{ color: var(--tide-glow); }

/* ---- why a card is greyed out ----------------------------------------- */
/* Sits under the stat readout on an unplayable card. Energy shortfalls are
   amber because they fix themselves next round; a card with nothing to
   target is the colder problem and reads muted. */
.hand-card-blocked{
  margin-block-start: auto;
  padding: 4px var(--sp-2) 0;
  font-size: var(--fs-2xs);
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink-faint);
  text-align: center;
}
.hand-card-blocked.reason-energy{ color: var(--gold); }
.hand-card.unplayable{ opacity: .78; }
.hand-card.unplayable .hand-card-art{ opacity: .5; filter: grayscale(.35); }

/* ---- card variables, explained --------------------------------------- */
/* A bare "4/4" told a player nothing. Each stat now carries its name, its
   value and one line on why it matters. Power and Guard are marked because
   they are the two that decide duels and the two people misread. */
.passport-statkey{
  margin-block-start: var(--sp-2); text-align: center;
  font-size: var(--fs-2xs); letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-faint);
}

.stat-rows{ display: flex; flex-direction: column; margin-block-start: var(--sp-3); }
.stat-row{ padding: var(--sp-3) 0; }
.stat-row + .stat-row{ border-top: 1px solid var(--hairline); }
.stat-row-head{ display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-4); }
.stat-row-label{
  font-size: var(--fs-2xs); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 700;
}
.stat-row-value{ font-size: var(--fs-lg); font-weight: 800; color: var(--ink); }
.stat-row-hint{ margin-block-start: var(--sp-1); font-size: var(--fs-xs); color: var(--ink-dim); line-height: var(--lh-normal); }
.stat-row-key .stat-row-label{ color: var(--gold); }
.stat-row-key .stat-row-value{ color: var(--gold-bright); }

.keyword-rows{ display: flex; flex-direction: column; gap: var(--sp-3); margin-block-start: var(--sp-3); }
.keyword-row{
  padding: var(--sp-3); border-radius: var(--radius-md);
  background: var(--bg-2); border-inline-start: 3px solid var(--gold-dim);
}
.keyword-name{ display: block; font-weight: 800; font-size: var(--fs-md); color: var(--gold-bright); }
.keyword-desc{ margin-block-start: var(--sp-1); font-size: var(--fs-xs); color: var(--ink-dim); line-height: var(--lh-normal); }

/* A cleared rung gets its own banner on the results screen, or the ladder
   advances invisibly and the climb has no payoff. */
.tier-record{
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4); border-radius: var(--radius-md);
  background: linear-gradient(120deg, #d4a24e22, transparent);
  border: 1px solid var(--gold-dim);
}
.tier-record-badge{
  flex: none; inline-size: 44px; block-size: 44px;
  display: grid; place-items: center; border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  color: var(--gold-ink); font-size: var(--fs-lg); font-weight: 800;
}
.tier-record strong{ display: block; font-size: var(--fs-md); }
.tier-record .dim{ font-size: var(--fs-xs); }

/* ---- duel setup: rival roster + difficulty ladder ---------------------- */
.setup-screen{ padding-bottom: var(--sp-8); }
.setup-heading{
  font-size: var(--fs-lg); font-weight: 800; margin-block-start: var(--sp-8);
  letter-spacing: .02em;
}
.setup-note{ font-size: var(--fs-xs); margin-block-start: var(--sp-2); }

/* The ladder reads as a row of rungs, so how far you have climbed is a
   glance rather than a number you have to interpret. */
.tier-rail{
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
  margin-block-start: var(--sp-3);
}
.tier-dot{
  inline-size: 40px; block-size: 40px; flex: none;
  border-radius: var(--radius-md); border: 1px solid var(--hairline-hi);
  background: var(--bg-2); color: var(--ink-dim);
  font-family: var(--font-ui); font-size: var(--fs-sm); font-weight: 800;
  cursor: pointer; transition: transform var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.tier-dot:hover{ transform: translateY(-2px); border-color: var(--gold-dim); }
.tier-dot.selected{
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  border-color: var(--gold-bright); color: var(--gold-ink);
  box-shadow: var(--glow-gold);
}

.chip-mute{ background: var(--bg-2); color: var(--ink-faint); border: 1px solid var(--hairline); }
.chip-gold{ background: #d4a24e22; color: var(--gold-bright); border: 1px solid var(--gold-dim); }
.pick-card-sm .chip{ margin-block-start: var(--sp-3); align-self: flex-start; }

.limit-row{ display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.limit-row .field{ flex: 1; min-width: 120px; }

/* ---- switches ----------------------------------------------------------
   The whole row is the hit target, not just the 52px pill. The knob moves on
   inset-inline-start rather than translateX so RTL flips it for free.        */
.switch-list{ display: flex; flex-direction: column; }
.switch-row{
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-2); border-radius: var(--radius-md);
  cursor: pointer; transition: background var(--dur-fast) var(--ease-out);
}
.switch-row:hover{ background: #ffffff08; }
.switch-row + .switch-row{ border-top: 1px solid var(--hairline); }

.switch-text{ display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.switch-text strong{ font-size: var(--fs-md); font-weight: 700; }
.switch-text .muted{ font-size: var(--fs-xs); }

.switch{ position: relative; flex: none; inline-size: 52px; block-size: 30px; }
.switch-input{ position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch-track{
  position: absolute; inset: 0; border-radius: var(--radius-pill);
  background: var(--bg-2); border: 1px solid var(--hairline-hi);
  transition: background var(--dur-med) var(--ease-out), border-color var(--dur-med) var(--ease-out);
}
.switch-track::after{
  content: ""; position: absolute; inset-block-start: 3px; inset-inline-start: 3px;
  inline-size: 22px; block-size: 22px; border-radius: 50%;
  background: var(--ink-faint); box-shadow: var(--shadow-sm);
  transition: inset-inline-start var(--dur-med) var(--ease-spring),
              background var(--dur-med) var(--ease-out);
}
.switch-input:checked + .switch-track{
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  border-color: var(--gold-bright);
}
.switch-input:checked + .switch-track::after{ inset-inline-start: 25px; background: var(--gold-ink); }
.switch-input:focus-visible + .switch-track{ box-shadow: var(--glow-gold); }

.owned-grid{ display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.owned-chip{
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-md);
  background: var(--panel-hi); border: 1px solid var(--gold-dim); font-size: var(--fs-sm); font-weight: 700;
}
.owned-date{ font-size: var(--fs-2xs); font-weight: 500; }

.ledger-list{ display: flex; flex-direction: column; gap: var(--sp-2); }
.ledger-row{
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-md);
  background: var(--panel-hi); border-inline-start: 3px solid var(--hairline-hi);
}
.ledger-row.status-paid{ border-inline-start-color: var(--tide); }
.ledger-row.status-failed, .ledger-row.status-expired{ border-inline-start-color: var(--ember); }
.ledger-main{ display: flex; flex-direction: column; min-width: 0; }
.ledger-title{ font-weight: 700; font-size: var(--fs-sm); }
.ledger-sub{ font-size: var(--fs-2xs); }
.ledger-right{ display: flex; align-items: center; gap: var(--sp-3); flex: none; }
.ledger-delta{ font-weight: 800; }
.ledger-delta.pos{ color: var(--tide-glow); }
.ledger-delta.neg{ color: var(--ember-glow); }
.order-status{
  font-size: var(--fs-2xs); font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  padding: 2px var(--sp-2); border-radius: var(--radius-pill); background: var(--panel-solid);
}
.order-status.s-paid{ color: var(--tide-glow); }
.order-status.s-failed, .order-status.s-expired{ color: var(--ember-glow); }
.order-status.s-created, .order-status.s-processing{ color: var(--ink-faint); }

.store-balance{
  display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-4);
  padding: var(--sp-2) var(--sp-4); border-radius: var(--radius-pill);
  background: #d4a24e14; border: 1px solid var(--gold-dim); width: fit-content;
}
.store-balance strong{ font-size: var(--fs-lg); color: var(--gold-bright); }
.offer-card.is-owned{ opacity: .72; border-color: var(--tide); }
.owned-flag{ color: var(--tide-glow); border-color: var(--tide); cursor: default; }

/* ==========================================================================
   rules / how to play
   ========================================================================== */
.rules-screen{
  max-width: 760px; margin-inline: auto; padding-block: var(--sp-6) var(--sp-16);
  display: flex; flex-direction: column; gap: var(--sp-6);
}
.rules-section{
  padding: var(--sp-5) var(--sp-6); border-radius: var(--radius-lg);
  background: var(--panel); border: 1px solid var(--hairline-hi);
}
.rules-h{
  font-size: var(--fs-xl); font-weight: 900; margin-bottom: var(--sp-3);
  display: flex; align-items: center; gap: var(--sp-2);
}
.rules-h::before{
  content: ""; width: 4px; height: 18px; border-radius: 2px; flex: none;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
}
.rules-section p{ color: var(--ink-dim); line-height: var(--lh-normal); }
.rules-lead{ margin-bottom: var(--sp-4); }
.rules-note{ margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--gold-bright); }

.rules-goal{ display: flex; flex-direction: column; gap: var(--sp-3); }
.rules-goal-pill{
  display: inline-flex; align-items: center; gap: var(--sp-2); width: fit-content;
  padding: var(--sp-2) var(--sp-4); border-radius: var(--radius-pill);
  background: #d4a24e1f; border: 1px solid var(--gold-dim);
  color: var(--gold-bright); font-weight: 800;
}

.rules-steps{ display: flex; flex-direction: column; gap: var(--sp-3); counter-reset: none; }
.rules-step{ display: flex; gap: var(--sp-3); align-items: flex-start; }
.rules-step-n{
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-size: var(--fs-sm); font-weight: 900;
  background: var(--panel-hi); border: 1px solid var(--gold-dim); color: var(--gold-bright);
}
.rules-step strong{ display: block; }
.rules-step p{ font-size: var(--fs-sm); margin-top: 2px; }

.rules-board{ display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); margin-bottom: var(--sp-4); direction: ltr; }
.rules-lane{
  min-height: 66px; border-radius: var(--radius-md); display: grid; place-items: center;
  background: var(--panel-hi); border: 1px solid var(--hairline-hi);
  font-size: var(--fs-2xs); font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-faint); text-align: center; padding: var(--sp-2);
}
.rules-lane.is-throne{
  background: linear-gradient(180deg, #d4a24e26, var(--panel-hi));
  border-color: var(--gold-dim); color: var(--gold-bright);
}

.rules-energy{ display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.rules-pip{
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  display: grid; place-items: center; font-weight: 900; font-size: var(--fs-sm);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold)); color: var(--gold-ink);
}

.rules-types{ display: flex; flex-direction: column; gap: var(--sp-4); }
.rules-type{ display: flex; gap: var(--sp-4); align-items: center; }
.rules-type-art{
  flex: none; width: 64px; height: 64px; border-radius: var(--radius-md);
  overflow: hidden; background: var(--bg-1); border: 1px solid var(--hairline-hi);
}
.rules-type-art img, .rules-type-art svg{ width: 100%; height: 100%; object-fit: cover; display: block; }
.rules-type strong{ display: block; color: var(--gold-bright); }
.rules-type p{ font-size: var(--fs-sm); margin-top: 2px; }

.rules-grid{ display: grid; grid-template-columns: 1fr; gap: var(--sp-3); }
@media (min-width: 640px){ .rules-grid{ grid-template-columns: repeat(2, 1fr); } }
.rules-card{
  padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-md);
  background: var(--panel-hi); border-inline-start: 3px solid var(--gold-dim);
}
.rules-card strong{ display: block; font-size: var(--fs-sm); }
.rules-card p{ font-size: var(--fs-xs); margin-top: 3px; }

.rules-list{ display: flex; flex-direction: column; gap: var(--sp-3); }
.rules-list li{ display: flex; gap: var(--sp-3); align-items: flex-start; color: var(--ink-dim); }
.rules-list svg{ width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--gold-bright); }

.rules-fair{ background: linear-gradient(100deg, #2fb6a521, transparent); border-color: var(--tide); }
.rules-fair .rules-h::before{ background: linear-gradient(180deg, var(--tide-glow), var(--tide)); }
.rules-cta{ margin-top: var(--sp-2); }

/* Keep the five mobile destinations inside the smallest supported phone. */
@media (max-width: 420px){
  .tab-link{ min-width: 0; padding-inline: 1px; font-size: 9.5px; }
}

/* ==========================================================================
   RTL — logical properties handle most of it automatically; targeted fixes:
   ========================================================================== */
[dir="rtl"] .icon-flip{ transform: scaleX(-1); }

/* ---- the climb ---------------------------------------------------------
   The map reads bottom to top because that is the direction the word
   implies. Open nodes glow, the current one is ringed, spent ones recede. */
.run-screen{ display: flex; flex-direction: column; gap: var(--sp-4); padding-bottom: var(--sp-8); }
.run-hint{ font-size: var(--fs-sm); }

.run-header{ display: flex; align-items: center; gap: var(--sp-6); flex-wrap: wrap; }
.run-vigour{ flex: 1; min-width: 200px; }
.run-vigour-head{ display: flex; align-items: baseline; justify-content: space-between; }
.run-stat-label{ font-size: var(--fs-2xs); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); font-weight: 700; }
.run-stat-value{ font-size: var(--fs-lg); font-weight: 800; color: var(--ink); }
.run-vigour-bar{ margin-block-start: var(--sp-2); block-size: 10px; border-radius: var(--radius-pill); background: var(--bg-0); border: 1px solid var(--hairline-hi); overflow: hidden; }
.run-vigour-fill{ display: block; block-size: 100%; background: linear-gradient(90deg, var(--ember), var(--gold-bright)); transition: width var(--dur-med) var(--ease-out); }
.run-vigour-note{ margin-block-start: var(--sp-2); font-size: var(--fs-xs); color: var(--ink-dim); }
.run-tallies{ display: flex; gap: var(--sp-5); }
.run-tally{ display: flex; flex-direction: column; align-items: center; }

.run-map{ display: flex; flex-direction: column; gap: var(--sp-2); }
.map-floor{ display: flex; align-items: center; gap: var(--sp-3); }
.map-floor-num{ inline-size: 24px; text-align: end; font-size: var(--fs-2xs); color: var(--ink-mute); flex: none; }
.map-floor-nodes{ display: flex; gap: var(--sp-3); flex: 1; }
.map-node{
  flex: 1; display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 52px; padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md); border: 1px solid var(--hairline);
  background: var(--bg-1); color: var(--ink-mute); font-weight: 800; font-size: var(--fs-xs);
  cursor: not-allowed; transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast);
}
.map-node svg{ width: 18px; height: 18px; }
.map-node.done{ opacity: .45; }
.map-node.open{ cursor: pointer; color: var(--ink); border-color: var(--gold-dim); background: var(--panel-solid); }
.map-node.open:hover{ transform: translateY(-2px); border-color: var(--gold); }
.map-node.here{ border-color: var(--gold-bright); color: var(--gold-bright); box-shadow: var(--glow-gold); }
.map-node.kind-elite.open{ border-color: var(--ember); color: var(--ember-glow); }
.map-node.kind-boss.open{ border-color: var(--ember-glow); color: var(--ember-glow); box-shadow: 0 0 20px -6px var(--ember); }
.map-node.kind-rest.open{ border-color: var(--tide); color: var(--tide-glow); }

.reward-grid{ display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.reward-card{
  flex: 1; min-width: 150px; display: flex; flex-direction: column; align-items: center;
  gap: var(--sp-2); padding: var(--sp-3); border-radius: var(--radius-lg);
  background: var(--panel-solid); border: 1px solid var(--hairline-hi); cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast);
}
.reward-card:hover{ transform: translateY(-4px); border-color: var(--gold); }
.reward-card-art{ inline-size: 100%; aspect-ratio: 1; border-radius: var(--radius-md); overflow: hidden; }
.reward-card-cost{ position: absolute; }
.reward-card-name{ font-weight: 800; text-align: center; }
.reward-card-stats{ font-size: var(--fs-xs); color: var(--ink-dim); font-weight: 700; }

.relic-grid{ display: flex; flex-direction: column; gap: var(--sp-3); }
.reward-relic{
  text-align: start; padding: var(--sp-4); border-radius: var(--radius-md);
  background: var(--panel-solid); border-inline-start: 3px solid var(--gold); border-block: 1px solid var(--hairline);
  border-inline-end: 1px solid var(--hairline); cursor: pointer;
}
.reward-relic:hover{ background: var(--panel-hi); }
.reward-relic strong{ display: block; color: var(--gold-bright); font-size: var(--fs-md); }
.reward-relic p{ margin-block-start: var(--sp-1); font-size: var(--fs-xs); }
.relic-row{ display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.relic-chip{ padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-md); background: var(--bg-2); border: 1px solid var(--gold-dim); max-inline-size: 260px; }
.relic-chip strong{ display: block; font-size: var(--fs-sm); color: var(--gold-bright); }
.relic-chip .dim{ font-size: var(--fs-2xs); }

.rest-choices{ display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.rest-choice{
  flex: 1; min-width: 200px; text-align: start; padding: var(--sp-5);
  border-radius: var(--radius-lg); background: var(--panel-solid);
  border: 1px solid var(--hairline-hi); cursor: pointer;
}
.rest-choice:hover{ border-color: var(--gold); background: var(--panel-hi); }
.rest-choice strong{ display: block; font-size: var(--fs-lg); }
.rest-choice .dim{ font-size: var(--fs-xs); }
.rest-deck{ display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.rest-card{
  display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md); background: var(--bg-2); border: 1px solid var(--hairline);
  font-size: var(--fs-sm); font-weight: 700; cursor: pointer;
}
.rest-card:hover{ border-color: var(--ember); color: var(--ember-glow); }

.run-start-card{ display: flex; align-items: center; gap: var(--sp-4); }
.run-start-art{ inline-size: 84px; block-size: 84px; border-radius: var(--radius-md); object-fit: cover; flex: none; }

/* The door into the climb, on the screen players already open to play. */
.run-entry{
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  inline-size: 100%; text-align: start; padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius-lg); cursor: pointer;
  background: linear-gradient(120deg, #d4a24e22, var(--panel-solid));
  border: 1px solid var(--gold-dim);
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast);
}
.run-entry:hover{ transform: translateY(-2px); border-color: var(--gold); }
.run-entry strong{ display: block; font-size: var(--fs-lg); color: var(--gold-bright); }
.run-entry .dim{ font-size: var(--fs-xs); }
.run-entry svg{ width: 26px; height: 26px; color: var(--gold); flex: none; }

/* The selection prompt reuses the tutorial banner, minus the step counter. */
.tutorial-guidance.select-hint{ background: #d4a24e14; border-color: var(--gold-dim); }

/* Rarity key on the how-to-play page: the same four colours the card frames
   use, named, so the encoding is legible instead of guessable. */
.rarity-key{ display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-block-start: var(--sp-3); }
.rarity-chip{
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3); border-radius: var(--radius-pill);
  background: var(--bg-2); border: 1px solid var(--hairline);
  font-size: var(--fs-xs); font-weight: 700; color: var(--ink-dim);
}
.rarity-swatch{ inline-size: 12px; block-size: 12px; border-radius: 3px; border: 2px solid currentColor; }
.rarity-chip.rarity-common .rarity-swatch{ color: var(--rarity-common); }
.rarity-chip.rarity-rare .rarity-swatch{ color: var(--rarity-rare); }
.rarity-chip.rarity-epic .rarity-swatch{ color: var(--rarity-epic); }
.rarity-chip.rarity-legendary .rarity-swatch{ color: var(--rarity-legendary); }

/* A toast that asks for something gets a control, so the player is not told
   to reload and then left to find their own refresh button. */
.toast.toast-action{ display: flex; align-items: center; gap: var(--sp-3); }
.toast-btn{
  flex: none; padding: 4px var(--sp-3); border-radius: var(--radius-pill);
  background: var(--gold); color: var(--gold-ink);
  font-size: var(--fs-xs); font-weight: 800; cursor: pointer;
}
.toast-btn:hover{ background: var(--gold-bright); }
