/* =============================================================================
   tokens.css — platform design tokens (B173, features/platform)

   Skin "arena" (default; mockup: client/platform-arena-mockup.html) in two
   colour modes. Loaded right AFTER main.css so these :root values replace
   main.css's light palette; every page rule keeps reading the same --c-* names.

   Axes (set on <html> by skin-preload.js before first paint, changed by
   ui-mode.js → setColorMode()):
     data-skin  "arena" (default) | "zen" | "bento" — colour + radius tokens only
     data-mode  "dark" (default) | "light"

   NOT here (locked): --board-* tokens stay in main.css and are identical in
   both modes — the board is one shared light-paper surface on every skin.
   ============================================================================= */

:root {
  color-scheme: dark;

  --c-bg:           #121212;
  --c-surface:      #1e1e1e;
  --c-surface-2:    #282828;
  --c-border:       rgba(255,255,255,0.10);
  --c-border-light: rgba(255,255,255,0.06);

  --c-ink:          #e8e6e1;
  --c-ink-2:        #a8a49b;
  --c-ink-3:        #9a968c;

  --c-brand:        #4f7d1c;   /* fill behind white text: 4.9:1 */
  --c-brand-dark:   #3f6516;
  --c-brand-text:   #8bc34a;   /* brand-coloured TEXT on dark surfaces: 7.4:1 */
  --c-brand-light:  rgba(98,153,36,0.16);
  --c-on-brand:     #ffffff;
  --c-on-accent: #1b1208;
  --c-on-ink: #161512;
  --c-knob: #ffffff;

  --c-accent:       #ee6a20;   /* text/border only; was #d85000 = 3.7:1 on surface, now 4.95:1 (#180) */
  --c-accent-light: rgba(238,106,32,0.16);

  --c-error:        #f77f7f;
  --c-error-bg:     rgba(247,127,127,0.12);
  --c-success:      #8bc34a;
  --c-success-bg:   rgba(139,195,74,0.12);
  --c-warning:      #f2a33a;
  --c-warning-bg:   rgba(242,163,58,0.12);

  --c-state-idle:    #9a968c;   /* ui-audit F6: 4.59 -> 5.65:1 on surface */
  --c-state-playing: #8bc34a;
  --c-state-waiting: #f2a33a;

  /* Fills/hover that must flip with the mode (white-on-dark vs black-on-light) */
  --c-fill:         rgba(255,255,255,0.06);
  --c-hover:        rgba(255,255,255,0.04);
  --c-strong:       #ffffff;
  --c-field:        #121212;
  --c-scrim:        rgba(0,0,0,0.6);

  /* ui-audit F3/F4/F5: game-action + medal colours as roles (text/border vs fill under white text) */
  --c-danger-fill:  #c0392b;
  --c-time:         #5dade2;
  --c-time-fill:    #2471a3;
  --c-undo:         #c39bd3;
  --c-undo-fill:    #8e44ad;
  --c-medal-gold:   rgba(242,190,58,.16);
  --c-medal-silver: rgba(170,180,195,.18);
  --c-medal-bronze: rgba(205,127,50,.16);

  --bg-glass:       #262421;
  --bg-glass-heavy: #262421;

  --radius:     5px;
  --radius-lg:  8px;
  --radius-xl:  12px;
  --shadow-sm:  none;
  --shadow:     0 2px 8px rgba(0,0,0,0.35);
  --shadow-lg:  0 24px 48px -16px rgba(0,0,0,0.6);
  --shadow-card: inset 0 1px 0 rgba(255,255,255,.06), 0 1px 2px rgba(0,0,0,.35), 0 6px 14px -4px rgba(0,0,0,.45), 0 22px 44px -14px rgba(0,0,0,.65);   /* outer cards only (.ppanel/.phead/.ptbl-wrap/.pcard) */
  --shadow-glass: none;
  --shadow-glass-inset: none;
}

:root[data-mode="light"] {
  color-scheme: light;

  --c-bg:           #fafaf8;
  --c-surface:      #ffffff;
  --c-surface-2:    #f4f3f0;
  --c-border:       rgba(0,0,0,0.12);
  --c-border-light: rgba(0,0,0,0.07);

  --c-ink:          #2b2926;
  --c-on-ink:       #ffffff;   /* toast text on the dark ink fill; :root (dark) uses the bg colour */
  --c-ink-2:        #5f5b52;
  --c-ink-3:        #66625a;

  --c-brand:        #4d7c1f;
  --c-brand-dark:   #3d6418;
  --c-brand-text:   #3d6418;   /* = brand-dark: 4.67:1 on the 18% brand tint (.qm-line .rtag--rule), #41701a gave 3.98 */
  --c-brand-light:  rgba(77,124,31,0.10);

  --c-accent:       #a63d00;
  --c-accent-light: rgba(194,71,0,0.10);

  --c-error:        #c62828;
  --c-error-bg:     rgba(198,40,40,0.08);
  --c-success:      #276a2b;
  --c-success-bg:   rgba(46,125,50,0.08);
  --c-warning:      #8f5500;
  --c-warning-bg:   rgba(178,106,0,0.08);

  --c-state-idle:    #6b675e;   /* ui-audit F2: 3.2 -> 5.1:1 on surface-2 */
  --c-state-playing: #2e7d32;
  --c-state-waiting: #b26a00;

  --c-fill:         rgba(0,0,0,0.05);
  --c-hover:        rgba(0,0,0,0.035);
  --c-strong:       #000000;
  --c-field:        #f4f3f0;
  --c-scrim:        rgba(0,0,0,0.45);
  --c-danger-fill:  #c62828;
  --c-time:         #2471a3;
  --c-time-fill:    #2471a3;
  --c-undo:         #8e44ad;
  --c-undo-fill:    #8e44ad;
  --c-medal-gold:   rgba(214,150,0,.20);
  --c-medal-silver: rgba(110,120,135,.18);
  --c-medal-bronze: rgba(176,100,30,.18);

  --bg-glass:       #ffffff;
  --bg-glass-heavy: #ffffff;

  --shadow:     0 1px 3px rgba(0,0,0,0.10);
  --shadow-lg:  0 24px 48px -16px rgba(0,0,0,0.22);
  --shadow-card: inset 0 1px 0 rgba(255,255,255,.9), 0 1px 2px rgba(40,55,80,.08), 0 6px 14px -4px rgba(40,55,80,.12), 0 22px 44px -14px rgba(40,55,80,.28);   /* outer cards only (.ppanel/.phead/.ptbl-wrap/.pcard) */
}


/* ── Selectable skins (#180) — colour + radius tokens only; each block defines the
   FULL token set so nothing leaks from the arena blocks above. Dark block has
   specificity (0,2,0) like arena-light, so it must stay AFTER it; light blocks
   are (0,3,0). Contrast: client/tests/skin-contrast.test.js. ───────────────── */

/* Zen — monochrome, 2px corners (mockup: platform-zen-mockup.html), dark mode */
:root[data-skin="zen"] {
  color-scheme: dark;
  --c-bg: #121212;
  --c-surface: #1b1b1b;
  --c-surface-2: #242424;
  --c-border: rgba(255,255,255,0.12);
  --c-border-light: rgba(255,255,255,0.07);
  --c-ink: #ececec;
  --c-ink-2: #a8a8a8;
  --c-ink-3: #949494;
  --c-brand: #ececec;
  --c-brand-dark: #ffffff;
  --c-brand-text: #ececec;
  --c-brand-light: rgba(236,236,236,0.10);
  --c-on-brand: #121212;
  --c-on-accent: #1b1208;
  --c-on-ink: #121212;
  --c-knob: #ffffff;
  --c-accent: #f08a4b;
  --c-accent-light: rgba(240,138,75,0.16);
  --c-error: #ef6a6a;
  --c-error-bg: rgba(239,106,106,0.12);
  --c-success: #8bc34a;
  --c-success-bg: rgba(139,195,74,0.12);
  --c-warning: #f2a33a;
  --c-warning-bg: rgba(242,163,58,0.12);
  --c-state-idle: #8a8a8a;
  --c-state-playing: #8bc34a;
  --c-state-waiting: #f2a33a;
  --c-fill: rgba(255,255,255,0.06);
  --c-hover: rgba(255,255,255,0.04);
  --c-strong: #ffffff;
  --c-field: #121212;
  --c-scrim: rgba(0,0,0,0.65);
  --c-danger-fill: #c0392b;
  --c-time: #5dade2;
  --c-time-fill: #2471a3;
  --c-undo: #c39bd3;
  --c-undo-fill: #8e44ad;
  --c-medal-gold: rgba(242,190,58,.16);
  --c-medal-silver: rgba(170,180,195,.18);
  --c-medal-bronze: rgba(205,127,50,.16);
  --bg-glass: #1b1b1b;
  --bg-glass-heavy: #1b1b1b;
  --radius: 2px;
  --radius-lg: 2px;
  --radius-xl: 4px;
  --shadow-sm: none;
  --shadow: none;
  --shadow-lg: 0 24px 48px -16px rgba(0,0,0,0.6);
  --shadow-card: inset 0 1px 0 rgba(255,255,255,.06), 0 1px 2px rgba(0,0,0,.35), 0 6px 14px -4px rgba(0,0,0,.45), 0 22px 44px -14px rgba(0,0,0,.65);   /* outer cards only (.ppanel/.phead/.ptbl-wrap/.pcard) */
  --shadow-glass: none;
  --shadow-glass-inset: none;
}

/* Zen, light mode */
:root[data-skin="zen"][data-mode="light"] {
  color-scheme: light;
  --c-bg: #f7f7f5;
  --c-surface: #ffffff;
  --c-surface-2: #f1f1ef;
  --c-border: rgba(28,28,28,0.14);
  --c-border-light: rgba(28,28,28,0.08);
  --c-ink: #1c1c1c;
  --c-ink-2: #565656;
  --c-ink-3: #666666;
  --c-brand: #1c1c1c;
  --c-brand-dark: #000000;
  --c-brand-text: #1c1c1c;
  --c-brand-light: rgba(28,28,28,0.07);
  --c-on-brand: #ffffff;
  --c-on-accent: #1b1208;
  --c-on-ink: #ffffff;
  --c-knob: #ffffff;
  --c-accent: #a63d00;
  --c-accent-light: rgba(194,71,0,0.10);
  --c-error: #c62828;
  --c-error-bg: rgba(198,40,40,0.08);
  --c-success: #276a2b;
  --c-success-bg: rgba(46,125,50,0.08);
  --c-warning: #8f5500;
  --c-warning-bg: rgba(178,106,0,0.08);
  --c-state-idle: #7d7d7d;
  --c-state-playing: #2e7d32;
  --c-state-waiting: #a35f00;
  --c-fill: rgba(0,0,0,0.04);
  --c-hover: rgba(0,0,0,0.03);
  --c-strong: #000000;
  --c-field: #f1f1ef;
  --c-scrim: rgba(0,0,0,0.4);
  --c-danger-fill: #c62828;
  --c-time: #2471a3;
  --c-time-fill: #2471a3;
  --c-undo: #8e44ad;
  --c-undo-fill: #8e44ad;
  --c-medal-gold: rgba(214,150,0,.20);
  --c-medal-silver: rgba(110,120,135,.18);
  --c-medal-bronze: rgba(176,100,30,.18);
  --bg-glass: #ffffff;
  --bg-glass-heavy: #ffffff;
  --radius: 2px;
  --radius-lg: 2px;
  --radius-xl: 4px;
  --shadow-sm: none;
  --shadow: none;
  --shadow-lg: 0 24px 48px -16px rgba(0,0,0,0.2);
  --shadow-card: inset 0 1px 0 rgba(255,255,255,.9), 0 1px 2px rgba(40,55,80,.08), 0 6px 14px -4px rgba(40,55,80,.12), 0 22px 44px -14px rgba(40,55,80,.28);   /* outer cards only (.ppanel/.phead/.ptbl-wrap/.pcard) */
  --shadow-glass: none;
  --shadow-glass-inset: none;
}

/* Bento — indigo + amber, large rounded tiles (mockup: platform-bento-mockup.html), dark mode */
:root[data-skin="bento"] {
  color-scheme: dark;
  --c-bg: #14151c;
  --c-surface: #1e202b;
  --c-surface-2: #282b39;
  --c-border: rgba(255,255,255,0.10);
  --c-border-light: rgba(255,255,255,0.06);
  --c-ink: #e9eaf2;
  --c-ink-2: #aeb2c4;
  --c-ink-3: #9a9eb2;
  --c-brand: #5a52e0;
  --c-brand-dark: #4a43c4;
  --c-brand-text: #a5a0ff;
  --c-brand-light: rgba(129,122,255,0.18);
  --c-on-brand: #ffffff;
  --c-on-accent: #1b1208;
  --c-on-ink: #14151c;
  --c-knob: #ffffff;
  --c-accent: #fbbf24;
  --c-accent-light: rgba(251,191,36,0.16);
  --c-error: #ff8585;
  --c-error-bg: rgba(255,133,133,0.12);
  --c-success: #7ddc8f;
  --c-success-bg: rgba(125,220,143,0.12);
  --c-warning: #f5b84a;
  --c-warning-bg: rgba(245,184,74,0.12);
  --c-state-idle: #8a8ea2;
  --c-state-playing: #7ddc8f;
  --c-state-waiting: #f5b84a;
  --c-fill: rgba(255,255,255,0.06);
  --c-hover: rgba(255,255,255,0.045);
  --c-strong: #ffffff;
  --c-field: #14151c;
  --c-scrim: rgba(0,0,0,0.6);
  --c-danger-fill: #c0392b;
  --c-time: #5dade2;
  --c-time-fill: #2471a3;
  --c-undo: #c39bd3;
  --c-undo-fill: #8e44ad;
  --c-medal-gold: rgba(242,190,58,.16);
  --c-medal-silver: rgba(170,180,195,.18);
  --c-medal-bronze: rgba(205,127,50,.16);
  --bg-glass: #1e202b;
  --bg-glass-heavy: #1e202b;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --shadow-sm: none;
  --shadow: 0 6px 18px rgba(0,0,0,0.35);
  --shadow-lg: 0 28px 56px -16px rgba(0,0,0,0.6);
  --shadow-card: inset 0 1px 0 rgba(255,255,255,.06), 0 1px 2px rgba(0,0,0,.35), 0 6px 14px -4px rgba(0,0,0,.45), 0 22px 44px -14px rgba(0,0,0,.65);   /* outer cards only (.ppanel/.phead/.ptbl-wrap/.pcard) */
  --shadow-glass: none;
  --shadow-glass-inset: none;
}

/* Bento, light mode */
:root[data-skin="bento"][data-mode="light"] {
  color-scheme: light;
  --c-bg: #f2efe9;
  --c-surface: #ffffff;
  --c-surface-2: #f7f5f0;
  --c-border: rgba(31,36,51,0.12);
  --c-border-light: rgba(31,36,51,0.07);
  --c-ink: #1f2433;
  --c-ink-2: #52596d;
  --c-ink-3: #626a7e;
  --c-brand: #4f46e5;
  --c-brand-dark: #4338ca;
  --c-brand-text: #4338ca;
  --c-brand-light: rgba(79,70,229,0.10);
  --c-on-brand: #ffffff;
  --c-on-accent: #1b1208;
  --c-on-ink: #ffffff;
  --c-knob: #ffffff;
  --c-accent: #a8500a;
  --c-accent-light: rgba(245,158,11,0.16);
  --c-error: #c62828;
  --c-error-bg: rgba(198,40,40,0.08);
  --c-success: #276a2b;
  --c-success-bg: rgba(46,125,50,0.08);
  --c-warning: #8f5500;
  --c-warning-bg: rgba(178,106,0,0.08);
  --c-state-idle: #7d8294;
  --c-state-playing: #2e7d32;
  --c-state-waiting: #a35f00;
  --c-fill: rgba(31,36,51,0.05);
  --c-hover: rgba(31,36,51,0.035);
  --c-strong: #000000;
  --c-field: #f7f5f0;
  --c-scrim: rgba(31,36,51,0.45);
  --c-danger-fill: #c62828;
  --c-time: #2471a3;
  --c-time-fill: #2471a3;
  --c-undo: #8e44ad;
  --c-undo-fill: #8e44ad;
  --c-medal-gold: rgba(214,150,0,.20);
  --c-medal-silver: rgba(110,120,135,.18);
  --c-medal-bronze: rgba(176,100,30,.18);
  --bg-glass: #ffffff;
  --bg-glass-heavy: #ffffff;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --shadow-sm: none;
  --shadow: 0 4px 14px rgba(31,36,51,0.08);
  --shadow-lg: 0 28px 56px -16px rgba(31,36,51,0.22);
  --shadow-card: inset 0 1px 0 rgba(255,255,255,.9), 0 1px 2px rgba(40,55,80,.08), 0 6px 14px -4px rgba(40,55,80,.12), 0 22px 44px -14px rgba(40,55,80,.28);   /* outer cards only (.ppanel/.phead/.ptbl-wrap/.pcard) */
  --shadow-glass: none;
  --shadow-glass-inset: none;
}

/* Club avatar fills (#235): skin-independent, each ≥ 4.5:1 under --club-ink. Separate block so the per-skin token-set test ignores it. */
:root {
  --radius-pill: 999px;   /* #297: actions (pill) vs chips (rounded rect); skin-independent */
  --club-blue: #1d4ed8;
  --club-green: #15803d;
  --club-red: #b91c1c;
  --club-orange: #c2410c;
  --club-purple: #7e22ce;
  --club-teal: #0f766e;
  --club-pink: #be185d;
  --club-gray: #475569;
  --club-ink: #ffffff;
}

/* ── Type scale (rem, root 16px) × --fs-scale (main.css: 1, 1.15 from 900px) ───────────
   Lobby typography round. Floor for secondary text is --text-xs (12px mobile / 13.8px desktop).
   Hero is clamp() with rem bounds (max 1.75rem <= 2x min 1.5rem) so 200% zoom still scales.
   Named exceptions kept outside the scale: icons, .pav initials, bell count badge, wordmark.
   #307: 12px floor kept on purpose (ui-audit asked 14px; decided 2026-10-22); test lobby-text-floor. */
:root {
  --text-xs:  calc(0.75rem * var(--fs-scale, 1));    /* captions, meta, badges */
  --text-sm:  calc(0.875rem * var(--fs-scale, 1));   /* nav, chips, helper text, group labels */
  --text-md:  calc(1rem * var(--fs-scale, 1));       /* row names, paragraphs */
  --text-lg:  calc(1.25rem * var(--fs-scale, 1));    /* section titles, stat numbers */
  --text-xl:  calc(clamp(1.5rem, 1.25rem + 1vw, 1.75rem) * var(--fs-scale, 1));   /* page hero */
  --text-brand: calc(1.4375rem * var(--fs-scale, 1));   /* wordmark (exception) */
}
