/* app-tokens.css: PoMiniGames' own design tokens, loaded right after po-tokens.css.
   Since 2026-11-18 (Po web standard) every colour, font, radius and space here is an
   alias of a --po-* token, so the app wears the estate look: one indigo accent, a
   light/dark palette that follows the device (prefers-color-scheme, no in-app toggle),
   Inter for text and Space Grotesk for titles. Only the app's game-specific values
   (player hues, podium ranks, toasts, game pieces) keep their own literals.
   Material Symbols (the icon font) is declared here; it is the one extra face. */
@font-face {
  font-family: 'Material Symbols Outlined';
  src: url('/_content/Radzen.Blazor/fonts/MaterialSymbolsOutlined.woff2') format('woff2');
  font-weight: 100 700;
  font-style: normal;
  font-display: block;
}

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
}

:root {
  /* Surfaces, text and the accent are the estate palette (po-tokens.css), which
     flips with the device's light/dark setting on its own. */
  --color-bg: var(--po-bg);
  --color-surface: var(--po-surface);
  --color-surface-hover: var(--po-surface-2);
  --color-border: var(--po-border);
  --color-text-primary: var(--po-text);
  --color-text-secondary: var(--po-text-muted);
  --color-accent: var(--po-accent);
  /* Foreground for anything sitting ON the accent fill (buttons, countdowns,
     the initials prompt): white on the light-mode indigo, near-black on the
     lighter dark-mode indigo. */
  --color-accent-contrast: var(--po-on-accent);
  /* Accent for SOLID fills that carry --color-accent-contrast text on top. */
  --color-accent-solid: var(--po-accent);
  --color-warning: var(--po-warning);
  --color-error: var(--po-danger);
  /* ── Tiered accent bag (Fix #8 — single source of truth for status colour) ──
     Each game's own brand colour (PoEcosystem amber,
     etc.) stays scoped to its theme root, but every chip / button / focus ring
     reads from one of the tokens below so the universal chrome is identical.
     Slugs reflect semantic intent, not raw colour, so swapping palettes is a
     1-line change to the named hex. */
  --accent: var(--color-accent);
  --accent-soft: color-mix(in srgb, var(--po-accent) 12%, transparent);   /* empty-state badges, etc. */
  /* Names stylesheets were already using that were never defined, so the text
     silently inherited its colour. Aliases, so both themes follow for free. */
  --color-accent-soft: var(--accent-soft);
  --color-text-muted: var(--color-text-secondary);
  --color-text-soft: var(--color-text-secondary);
  --border-subtle: var(--color-border);
  --accent-ring: color-mix(in srgb, var(--po-focus) 45%, transparent);    /* :focus-visible */
  --accent-success: var(--po-success);
  --accent-success-soft: color-mix(in srgb, var(--po-success) 16%, transparent);
  --accent-warning: var(--po-warning);
  --accent-warning-soft: color-mix(in srgb, var(--po-warning) 16%, transparent);
  --accent-danger: var(--po-danger);
  --accent-danger-soft: color-mix(in srgb, var(--po-danger) 16%, transparent);
  --accent-cyan: #22d3ee;
  --accent-amber: #fbbf24;

  /* ── Player identity ───────────────────────────────────────────────────
     The two sides of any local-versus screen. They exist so the 2P surfaces
     do not each pick their own raw hex: saturated, unrelated hues on one screen
     read as an arcade cabinet rather than a product.

     Chosen as a muted pair a step off the existing indigo accent: still clearly
     two different people at a glance (and never the ONLY signal — side, name
     and key hints all carry it too), but low enough in saturation to sit inside
     the slate/indigo system instead of fighting it. Scheme-invariant, like every
     other accent hue. Anything showing "player 1 vs player 2" reads these. */
  --player-1: #7f9cf5;
  --player-2: #d98aa8;
  /* Ink variants, same reasoning as the --accent-*-ink block below: the two hues
     above are tuned as FILLS (a 4px border, a chip) against a dark page. Used as
     TEXT on a white surface they collapse — the split-screen score measured
     2.63:1 in light mode. These are the only player tokens that re-point per
     scheme; the hues themselves stay scheme-invariant. Anything drawing a
     player's colour as text reads an -ink token, never the raw hue. */
  --player-1-ink: var(--player-1);
  --player-2-ink: var(--player-2);

  /* ── "Ink" variants: the same status hues, but safe as TEXT ────────────────
     The --accent-* values above are tuned as FILLS (chip
     backgrounds, glows, borders) against a dark page. Used as a text colour on
     the matching --accent-*-soft tint they collapse: measured in light mode,
     --accent-amber on the ELO badge was 1.38:1 and --accent-success on the
     health badge 1.48:1, against a 4.5:1 floor.

     A tint that light needs dark ink, so these are the only accent tokens that
     legitimately re-point per scheme (the hues themselves stay scheme-invariant
     per the theming rules). Anything rendering status text on a *-soft tint must
     read from an -ink token, never from the raw hue. */
  --accent-ink: var(--po-accent-hover);
  --accent-success-ink: var(--po-success);
  --accent-warning-ink: var(--po-warning);
  --accent-danger-ink: var(--po-danger);
  --accent-amber-ink: #fde68a;

  /* ── GFX FX triad ─────────────────────────────────────────────────────────
     fx.css and the ray-marched background (particlesCore.js) both need "the
     two or three colours this screen is about". Hard-coded fallbacks in each
     would let a game retheme its whole UI while the glow behind it stayed
     indigo.
     Declaring the triad here and re-pointing it inside a game's theme root
     (e.g. ``) retints every
     glass edge, aurora ring, impact flash and background curtain at once.
     Kept as plain colours, not gradients: the shader parses these through
     getComputedStyle and needs something that resolves to rgb(). */
  --fx-accent: var(--accent);
  --fx-accent-2: var(--accent-cyan);
  --fx-accent-3: var(--accent-amber);
  /* Typography: the estate faces (self-hosted by po-tokens.css). Space Grotesk
     for titles, Inter for text, the shared mono stack for numbers and code. */
  --font-display: var(--po-font-display);
  --font-body: var(--po-font);
  --font-mono: var(--po-font-mono);

  /* Type scale — fluid (Option #6).
     clamp(min, fluid, max) so headings grow with the viewport between phone
     and desktop without per-component media queries. Floor values hold at 360px
     (xs phone), ceiling at 1280px (small desktop). Above 1280 the type stops
     growing — a 27" monitor should not render headings larger than a 24". */
  --text-xs:   0.75rem;
  --text-sm:   clamp(0.85rem, 0.83rem + 0.1vw, 0.9rem);
  --text-base: clamp(0.95rem, 0.92rem + 0.15vw, 1rem);
  --text-lg:   clamp(1.1rem, 1.05rem + 0.25vw, 1.25rem);
  --text-xl:   clamp(1.3rem, 1.2rem + 0.5vw, 1.5rem);

  /* ── Tints & hairlines ─────────────────────────────────────────────────────
     Zebra striping, inset meter tracks and 1px separators were authored across
     the page stylesheets as rgba(255,255,255,0.02…0.08) — a white film that is
     literally invisible on a light surface, so tables lost their striping and
     meters lost their track. Option #2: each is a light-dark() pair so the
     light-theme override below no longer needs to mirror them. */
  --tint-subtle: light-dark(rgba(15,23,42,0.03), rgba(255,255,255,0.02));
  --tint-soft:   light-dark(rgba(15,23,42,0.05), rgba(255,255,255,0.04));
  --tint-medium: light-dark(rgba(15,23,42,0.09), rgba(255,255,255,0.08));
  --hairline:    light-dark(rgba(15,23,42,0.08), rgba(255,255,255,0.06));

  /* Podium ranks. Semantic (gold/silver/bronze reads as 1st/2nd/3rd), but unlike
     the status accents these are NOT legible on both surfaces — pale gold on
     white is roughly 1.5:1 — so the light block re-points them to the same hue
     at a darker value rather than leaving them scheme-invariant. */
  --rank-gold:   #fcd34d;
  --rank-silver: #cbd5e1;
  --rank-bronze: #d8a06a;

  /* Translucent surfaces (single source of truth — replaces scattered raw rgba).
     Option #2: each surface is a light-dark() pair declared ONCE; the
     `:root[data-theme="light"]` override no longer has to mirror them.
     `light-dark(light, dark)` resolves against the element's `color-scheme`,
     which we set to "light dark" below — so the browser picks the right half
     automatically. Tokens that need to stay identical across schemes
     (the accent hues, the toast hues) keep their plain declarations. */
  --surface-1: color-mix(in srgb, var(--po-bg) 70%, transparent);
  --surface-2: color-mix(in srgb, var(--po-surface) 92%, transparent);
  --surface-3: color-mix(in srgb, var(--po-surface-2) 85%, transparent);
  --surface-bar: color-mix(in srgb, var(--po-surface) 95%, transparent);
  --surface-raised: color-mix(in srgb, var(--po-surface) 98%, transparent);

  /* Radius scale (Design Token Unification) */
  --radius-sm: var(--po-radius-sm);
  --radius-md: var(--po-radius);
  --radius-lg: calc(var(--po-radius) + 4px);
  --radius-pill: var(--po-radius-pill);

  /* Elevation scale (Option #2: light-dark() pairs) */
  --elevation-1: light-dark(0 4px 20px rgba(15,23,42,0.08), 0 4px 20px rgba(0,0,0,0.35));
  --elevation-2: light-dark(0 8px 30px rgba(99,102,241,0.12), 0 8px 30px rgba(99,102,241,0.12));
  --elevation-3: light-dark(0 20px 60px rgba(15,23,42,0.12), 0 20px 60px rgba(0,0,0,0.4));

  /* Spacing scale */
  --space-1: var(--po-space-1);
  --space-2: var(--po-space-2);
  --space-3: var(--po-space-3);
  --space-4: var(--po-space-4);
  --space-5: var(--po-space-5);
  --space-6: var(--po-space-6);

  /* Z-index scale (single source of truth — replaces scattered raw z-index values) */
  --z-sticky: 50;
  --z-dropdown: 100;
  --z-overlay: 500;
  --z-modal: 1000;
  --z-toast: 3000;
  --z-toast-stack: 3000;
  /* GFX overlays. Above the modal/toast layers on purpose: confetti that
     stops at the edge of the "You win!" dialog reads as a z-index bug, and the
     impact flash has to cover whatever is on screen or it is not a flash.
     Both are pointer-events:none, so sitting on top costs no interactivity.
     Still below the error overlay — a crash report must never be confettied. */
  --z-fx-flash: 9990;
  --z-fx-particles: 9991;
  --z-error-overlay: 9999;

  /* Glassmorphism primitives (one source of truth for translucent chrome).
     The blur strengths are scheme-invariant; only the tint flips per scheme. */
  --glass-1: blur(8px) saturate(140%);
  --glass-2: blur(12px) saturate(160%);
  --glass-3: blur(20px) saturate(180%);
  --glass-tint: color-mix(in srgb, var(--po-surface) 60%, transparent);

  /* Motion tokens (paired with the prefers-reduced-motion guard below) */
  --dur-fast: 0.15s;
  --dur-base: 0.25s;
  --dur-slow: 0.4s;
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  /* A lightly under-damped spring as a linear() curve: one overshoot of about 4%,
     settled by 60%. For things that land (a released button, a dialog opening),
     not for things that merely fade. */
  --ease-spring: linear(0, 0.21 6%, 0.62 14%, 0.88 21%, 1.02 29%, 1.045 36%, 1.03 44%, 1.005 56%, 0.996 70%, 1);
  --dur-spring: 0.45s;

  /* Toast colors */
  --toast-info-bg: #1e3a5f;
  --toast-info-border: #3b82f6;
  --toast-info-text: #bfdbfe;
  --toast-error-bg: #450a0a;
  --toast-error-border: #ef4444;
  --toast-error-text: #fecaca;
  --toast-success-bg: #052e16;
  --toast-success-border: #22c55e;
  --toast-success-text: #bbf7d0;
  --toast-warning-bg: #451a03;
  --toast-warning-border: #f59e0b;
  --toast-warning-text: #fde68a;

  /* Game-piece tokens (single source of truth for
     the disc colours / gloss / win-glow shared by Connect Five's board and any
     future disc game). Discs are lit spheres: a light rim → mid → dark core. */
  --disc-red-lit: #ff8a80;
  --disc-red-mid: #f44336;
  --disc-red-core: #c62828;
  --disc-yellow-lit: #fffde7;
  --disc-yellow-mid: #ffee58;
  --disc-yellow-core: #f9a825;
  /* Each disc rule writes its own radial-gradient from the *-lit/-mid/-core
     tokens above — a shared gradient template can't live here because its inner
     var()s would resolve against :root (out of scope) and compute to empty. */
  --disc-shadow: inset 0 -3px 6px rgba(0,0,0,0.32), 0 2px 5px rgba(0,0,0,0.4);
  --accent-glow: rgba(0,229,255,0.5);
  /* (--accent-cyan was re-declared here, identically to its definition in the
     accent bag above. A second declaration in the same rule is dead weight and
     an invitation to change one copy and not the other.) */

  /* ── Breakpoint scale (documentation, not consumable) ───────────────────────
     Media queries cannot read custom properties, so these cannot be var()'d into
     an `@media` — they are recorded here so the canonical widths have one home
     and a reviewer can see the whole scale at a glance:

       360px  xs  tiny phone (game boards only — never chrome)
       480px  sm  compact phone portrait
       640px  md  phone / small tablet portrait
       960px  lg  tablet landscape / small desktop

     One scale keeps a component from reflowing at a different width depending
     on which page it is on.

     Prefer a container query (`@container`) over any of these for a component
     that should react to its own slot rather than to the viewport. */

  /* The phone BottomNav's height (BottomNav.razor.css): po-tokens.css lifts the
     .po-version stamp above it at the same breakpoint (768px). */
  --po-stamp-lift: calc(3.25rem + env(safe-area-inset-bottom, 0px));

  /* Light and dark both supported; the device picks (po-tokens.css sets the same).
     `light dark` is also what lets the light-dark() pairs above resolve. */
  color-scheme: light dark;
}

/* ── Light scheme ──────────────────────────────────────────────────────
   The estate palette flips itself (po-tokens.css). What is left here are the app's
   own values that are tuned as fills against a dark page and need a darker ink on a
   light one: the player hues used as text, the amber ink, the podium ranks and the
   toasts. Follows the device only: there is no in-app theme switch (Po standard). */
@media (prefers-color-scheme: light) {
  :root {
    /* Player ink on a white surface: same hue family as --player-1/2, pushed
       down in lightness until each clears its floor as text. */
    --player-1-ink: #4338ca;
    --player-2-ink: #be123c;
    --accent-amber-ink: #854d0e;

    /* Darkened to keep the podium readable on a light surface. */
    --rank-gold:   #b45309;
    --rank-silver: #64748b;
    --rank-bronze: #9a5b2d;

    /* Toasts keep their hue but invert lightness: the dark scheme's near-black
       tinted backgrounds with pale text are unreadable on a light page. */
    --toast-info-bg: #eff6ff;
    --toast-info-text: #1e3a5f;
    --toast-error-bg: #fef2f2;
    --toast-error-text: #7f1d1d;
    --toast-success-bg: #f0fdf4;
    --toast-success-text: #14532d;
    --toast-warning-bg: #fffbeb;
    --toast-warning-text: #78350f;
  }
}

/* ── Radzen variable mappings ─────────────────────────────────────────────── */
:root {
  --rz-primary: var(--color-accent-solid);
  --rz-on-primary: var(--color-accent-contrast);
  --rz-primary-lighter: color-mix(in srgb, var(--color-accent) 16%, transparent);
  --rz-secondary: var(--accent-cyan);
  --rz-danger: var(--accent-danger);
  --rz-success: var(--accent-success);
  --rz-warning: var(--accent-warning);
  --rz-base-background-color: var(--color-bg);
  --rz-body-background-color: var(--color-bg);
  --rz-card-background-color: var(--color-surface);
  --rz-grid-background-color: var(--color-surface);
  --rz-grid-header-background-color: var(--color-surface);
  --rz-text-color: var(--color-text-primary);
  --rz-text-secondary-color: var(--color-text-secondary);
  --rz-border-color: var(--color-border);
}
