/* DD-106: DESIGN.md tokens; no hex value outside :root. */
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-wght.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Estedad"; src: url("../fonts/Estedad-ExtraBold.ttf") format("truetype"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Estedad"; src: url("../fonts/Estedad-Black.ttf") format("truetype"); font-weight: 900; font-display: swap; }

:root {
  --lapis: #14244F;
  --lapis-deep: #0E1938;
  --raised: #27417F;
  --raised-light: #3A5CA8;
  --raised-edge: #1C3370;
  --you: #1FC7B6;
  --you-light: #45E5D4;
  --you-shadow: #12917F;
  --on-you: #0B1A3A;
  --opponent: #E5484D;
  --saffron: #F5B82E;
  --text: #F4F1E8;
  --text-muted: #9DACCB;
  --ink: #0A132C;
  --stage-centre: #2C4E98;
  --stage-mid: #172A5C;
  --stage-edge: #0B1430;
  --arena-mid: #101E45;
  --s-sm: 8px;
  --s-md: 16px;
  --s-lg: 24px;
  --s-xl: 32px;
  --r-lg: 20px;
  --column: 480px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--lapis); color: var(--text); }
body { font-family: "Vazirmatn", system-ui, sans-serif; font-size: 16px; line-height: 1.6; min-width: 360px;
  -webkit-text-size-adjust: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The stage (DESIGN.md Elevation & Depth): radial light at 50% across, 30% down, reaching stage-edge at 60% of the
   longer side; the khatam texture at 5%. */
.stage { min-height: 100vh; min-height: 100dvh;
  background: radial-gradient(circle 60vmax at 50% 30%, var(--stage-centre), var(--stage-mid) 30vmax, var(--stage-edge) 60vmax);
  position: relative; }
.stage::before { content: ""; position: absolute; inset: 0; background: url("../img/khatam-tile.svg") repeat;
  background-size: 96px; opacity: 0.05; pointer-events: none; }
.column { position: relative; max-width: var(--column); margin: 0 auto;
  padding: max(var(--s-md), env(safe-area-inset-top)) var(--s-md) max(var(--s-md), env(safe-area-inset-bottom)); }

/* Startup arena (DESIGN.md Startup). The mark is fixed at the viewport centre in both the static first paint and the
   Blazor page, so it never moves. */
.arena { position: fixed; inset: 0; background: var(--lapis); }
.arena::after { content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity 300ms ease-out;
  background: radial-gradient(circle at 50% 50%, var(--lapis) 150px, var(--arena-mid) 240px, var(--stage-edge) 75vmax); }
.arena--lit::after { opacity: 1; }
.arena__texture { position: absolute; inset: 0; background: url("../img/khatam-tile.svg") repeat; background-size: 96px;
  opacity: 0; transition: opacity 300ms ease-out;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent 170px, black 280px);
  mask-image: radial-gradient(circle at 50% 50%, transparent 170px, black 280px); }
.arena--lit .arena__texture { opacity: 0.06; }
.arena__mark { position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; transform: translate(-50%, -50%); z-index: 1; }
.arena__name { position: absolute; left: 0; right: 0; top: calc(50% + 76px); text-align: center; z-index: 1;
  font-family: "Estedad", sans-serif; font-weight: 900; font-size: 40px; line-height: 1.2; margin: 0;
  text-shadow: 0 4px 0 var(--ink); opacity: 0; transition: opacity 300ms ease-out; }
.arena--lit .arena__name { opacity: 1; }
.arena__slot { position: absolute; left: 0; right: 0; top: calc(50% + 150px); z-index: 1; display: flex; flex-direction: column;
  align-items: center; gap: var(--s-md); padding: 0 var(--s-md); max-width: var(--column); margin: 0 auto; }

/* The cue: three tiles, one lit at a time, right to left (RTL: the first child is on the right), 400 ms a step. */
.cue { display: flex; gap: var(--s-sm); }
.cue__tile { width: 24px; height: 24px; border-radius: 7px; background: var(--raised); box-shadow: inset 0 -5px 0 var(--raised-edge); }
.cue__tile { animation: cue-lit 1200ms steps(1, end) infinite; }
.cue__tile:nth-child(2) { animation-delay: 400ms; }
.cue__tile:nth-child(3) { animation-delay: 800ms; }
@keyframes cue-lit {
  0% { background: var(--you); box-shadow: inset 0 -5px 0 var(--you-shadow); transform: translateY(-3px); }
  33.34%, 100% { background: var(--raised); box-shadow: inset 0 -5px 0 var(--raised-edge); transform: none; }
}

/* A full-width kit-like button (spec §6.1 step 4; the real TileFace comes with DD-105). */
.button { display: block; width: 100%; min-height: 60px; border: 0; border-radius: 14px; font: inherit; font-weight: 700;
  font-size: 18px; color: var(--text); background: var(--raised); box-shadow: inset 0 3px 0 var(--raised-light), inset 0 -5px 0 var(--raised-edge);
  cursor: pointer; }
.button:focus-visible { outline: 3px solid var(--saffron); outline-offset: 3px; }
.button--primary { background: var(--you); color: var(--on-you); box-shadow: inset 0 3px 0 var(--you-light), inset 0 -5px 0 var(--you-shadow); }

.heading { font-family: "Estedad", sans-serif; font-weight: 800; font-size: 28px; line-height: 1.3; text-shadow: 0 3px 0 var(--ink); margin: var(--s-lg) 0 var(--s-md); }
.stamp { font-size: 12px; color: var(--text); margin-top: var(--s-xl); direction: ltr; text-align: center; }
.home__mark { display: block; width: 96px; height: 96px; border-radius: var(--r-lg); margin: var(--s-xl) auto 0; }
.home__lines p { margin: var(--s-sm) 0; }
.home__install { margin-top: var(--s-lg); }

/* Blazor's error surface: hidden until it shows it (display: block) on an unhandled render exception. */
#blazor-error-ui { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--lapis-deep);
  color: var(--text); padding: var(--s-md); text-align: center; box-shadow: 0 -3px 0 var(--opponent); }
/* Blazor also shows its surface when the boot fails; the boot error block already has the retry. */
#app:has(.boot-error) ~ #blazor-error-ui { display: none !important; }
#blazor-error-ui span { display: block; margin-bottom: var(--s-sm); }
#blazor-error-ui .button { display: block; text-align: center; text-decoration: none; line-height: 60px; }

@media (prefers-reduced-motion: reduce) {
  .arena::after, .arena__texture, .arena__name { transition: none; }
  .cue__tile { animation: none; }
}
