/* Clockface Online design tokens (generated from the design system tokens.json).
   Light values on :root, dark values on body.dark-mode. Owner: rebrand foundation.
   Never set a background or colour on body from here: body's background is the person's canvas.
   The --z-* tokens are deliberately not defined: existing z-index values stay as they are.
   Tints are precomputed rgba helpers (no color-mix) so older TV browsers still render them. */
:root {
  --canvas: #355c7d;
  --surface: #ffffff;
  --surface-subtle: #f6f4f1;
  --surface-hover: #efebe6;
  --border: #ebe6e0;
  --border-control: #8a8a8a;
  --glass: rgba(255,255,255,0.15);
  --glass-border: rgba(255,255,255,0.2);
  --glass-dim: rgba(15,23,42,0.55);
  --on-glass: #ffffff;
  --scrim: rgba(0,0,0,0.6);
  --ink: #1a3c5e;
  --text-primary: #333333;
  --text-secondary: #555555;
  --text-tertiary: #6b6b6b;
  --primary: #6db388;
  --on-primary: #1a3c5e;
  --primary-ink: #46765a;
  --accent: #cebfaf;
  --accent-ink: #6f665c;
  --focus: #1a3c5e;
  --gold: #e6c27a;
  --gold-ink: #7a6740;
  --danger: #b5443f;
  --info: #236a99;
  --warning: #f4e861;
  --medal-silver: #8a8a8a;
  --medal-bronze: #a8662a;
  --tool-clock: #cebfaf;
  --tool-focus: #6db388;
  --tool-notes: #f4e861;
  --tool-countdowns: #f4b9b2;
  --tool-challenge: #e6c27a;
  --tool-wordguess: #9caf88;
  --tool-community: #3498db;
  --tool-mixer: #aed9e0;
  --tool-music: #d4a5a5;
  --tool-weather: #7dd3fc;
  --tool-worldclocks: #b5aed4;
  --tool-habits: #b8d8be;
  --tool-breathe: #e0bbe4;
  --tool-wisdom: #c17e61;
  --tool-classroom: #f5ebe0;
  --tool-clocky: #a78bfa;
  --tool-calculator: #708090;
  --font-sans: Poppins, system-ui, -apple-system, "Segoe UI", sans-serif;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;
  --tint: 0.12;
  --tile-tint: 0.2;
  --disabled: 0.45;
  --dur-fast: 150ms;
  --dur-base: 300ms;
  --ease: cubic-bezier(.4,0,.2,1);
  --primary-tint: rgba(109,179,136,0.12);
  --primary-line: rgba(109,179,136,0.3);
  --accent-tint: rgba(206,191,175,0.12);
  --accent-line: rgba(206,191,175,0.3);
  --gold-tint: rgba(230,194,122,0.12);
  --gold-line: rgba(230,194,122,0.3);
  --danger-tint: rgba(181,68,63,0.12);
  --danger-line: rgba(181,68,63,0.3);
  --info-tint: rgba(35,106,153,0.12);
  --info-line: rgba(35,106,153,0.3);
  --warning-tint: rgba(244,232,97,0.12);
  --warning-line: rgba(244,232,97,0.3);
  --accent-tile: rgba(206,191,175,0.2);
  --accent-half: rgba(206,191,175,0.5);
  --text-primary-15: rgba(51,51,51,0.15);
  --surface-14: rgba(255,255,255,0.14);
  --surface-24: rgba(255,255,255,0.24);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-float: 0 8px 32px rgba(0,0,0,0.2);
  --shadow-modal: 0 10px 40px rgba(0,0,0,0.2);
}

/* Dark theme: set by applyAppTheme(), the server-rendered body class and the early auto script. */
body.dark-mode {
  --surface: #1a1a1a;
  --surface-subtle: #262626;
  --surface-hover: #2e2e2e;
  --border: #333333;
  --border-control: #7a7a7a;
  --ink: #f5f5f5;
  --text-primary: #eeeeee;
  --text-secondary: #aaaaaa;
  --text-tertiary: #8f8f8f;
  --primary-ink: #6db388;
  --accent-ink: #cebfaf;
  --focus: #cebfaf;
  --gold-ink: #e6c27a;
  --danger: #e5655f;
  --info: #5dade2;
  --medal-silver: #c0c0c0;
  --medal-bronze: #cd7f32;
  --primary-tint: rgba(109,179,136,0.12);
  --primary-line: rgba(109,179,136,0.3);
  --accent-tint: rgba(206,191,175,0.12);
  --accent-line: rgba(206,191,175,0.3);
  --gold-tint: rgba(230,194,122,0.12);
  --gold-line: rgba(230,194,122,0.3);
  --danger-tint: rgba(229,101,95,0.12);
  --danger-line: rgba(229,101,95,0.3);
  --info-tint: rgba(93,173,226,0.12);
  --info-line: rgba(93,173,226,0.3);
  --warning-tint: rgba(244,232,97,0.12);
  --warning-line: rgba(244,232,97,0.3);
  --accent-tile: rgba(206,191,175,0.2);
  --accent-half: rgba(206,191,175,0.5);
  --text-primary-15: rgba(238,238,238,0.15);
  --surface-14: rgba(26,26,26,0.14);
  --surface-24: rgba(26,26,26,0.24);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-float: 0 8px 32px rgba(0,0,0,0.2);
  --shadow-modal: 0 10px 40px rgba(0,0,0,0.5);
}

/* No-JS fallback for Auto: follow the OS. */
@media (prefers-color-scheme: dark) {
  body.theme-auto:not(.theme-light) {
    --surface: #1a1a1a;
    --surface-subtle: #262626;
    --surface-hover: #2e2e2e;
    --border: #333333;
    --border-control: #7a7a7a;
    --ink: #f5f5f5;
    --text-primary: #eeeeee;
    --text-secondary: #aaaaaa;
    --text-tertiary: #8f8f8f;
    --primary-ink: #6db388;
    --accent-ink: #cebfaf;
    --focus: #cebfaf;
    --gold-ink: #e6c27a;
    --danger: #e5655f;
    --info: #5dade2;
    --medal-silver: #c0c0c0;
    --medal-bronze: #cd7f32;
    --primary-tint: rgba(109,179,136,0.12);
    --primary-line: rgba(109,179,136,0.3);
    --accent-tint: rgba(206,191,175,0.12);
    --accent-line: rgba(206,191,175,0.3);
    --gold-tint: rgba(230,194,122,0.12);
    --gold-line: rgba(230,194,122,0.3);
    --danger-tint: rgba(229,101,95,0.12);
    --danger-line: rgba(229,101,95,0.3);
    --info-tint: rgba(93,173,226,0.12);
    --info-line: rgba(93,173,226,0.3);
    --warning-tint: rgba(244,232,97,0.12);
    --warning-line: rgba(244,232,97,0.3);
    --accent-tile: rgba(206,191,175,0.2);
    --accent-half: rgba(206,191,175,0.5);
    --text-primary-15: rgba(238,238,238,0.15);
    --surface-14: rgba(26,26,26,0.14);
    --surface-24: rgba(26,26,26,0.24);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-float: 0 8px 32px rgba(0,0,0,0.2);
    --shadow-modal: 0 10px 40px rgba(0,0,0,0.5);
  }
}

/* Dark islands: surfaces that stay dark glass until their package converts them (adds .cfo-paper). */
.draggable-window:not(.cfo-paper),
.fh-card:not(.cfo-paper),
#userProfileModal .community-modal-content:not(.cfo-paper),
#shareProfileModal .community-modal-content:not(.cfo-paper),
#invigilatorRulesBoardModal .community-modal-content {
  --surface: #1a1a1a;
  --surface-subtle: #262626;
  --surface-hover: #2e2e2e;
  --border: #333333;
  --border-control: #7a7a7a;
  --ink: #f5f5f5;
  --text-primary: #eeeeee;
  --text-secondary: #aaaaaa;
  --text-tertiary: #8f8f8f;
  --primary-ink: #6db388;
  --accent-ink: #cebfaf;
  --focus: #cebfaf;
  --gold-ink: #e6c27a;
  --danger: #e5655f;
  --info: #5dade2;
  --medal-silver: #c0c0c0;
  --medal-bronze: #cd7f32;
  --primary-tint: rgba(109,179,136,0.12);
  --primary-line: rgba(109,179,136,0.3);
  --accent-tint: rgba(206,191,175,0.12);
  --accent-line: rgba(206,191,175,0.3);
  --gold-tint: rgba(230,194,122,0.12);
  --gold-line: rgba(230,194,122,0.3);
  --danger-tint: rgba(229,101,95,0.12);
  --danger-line: rgba(229,101,95,0.3);
  --info-tint: rgba(93,173,226,0.12);
  --info-line: rgba(93,173,226,0.3);
  --warning-tint: rgba(244,232,97,0.12);
  --warning-line: rgba(244,232,97,0.3);
  --accent-tile: rgba(206,191,175,0.2);
  --accent-half: rgba(206,191,175,0.5);
  --text-primary-15: rgba(238,238,238,0.15);
  --surface-14: rgba(26,26,26,0.14);
  --surface-24: rgba(26,26,26,0.24);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-float: 0 8px 32px rgba(0,0,0,0.2);
  --shadow-modal: 0 10px 40px rgba(0,0,0,0.5);
}

/* Tool colours: [data-tool] tiles pick up their pastel as --tool. */
[data-tool="clockyai"] { --tool: var(--tool-clocky); }
[data-tool="community"] { --tool: var(--tool-community); }
[data-tool="focus"] { --tool: var(--tool-focus); }
[data-tool="challenge"] { --tool: var(--tool-challenge); }
[data-tool="notes"] { --tool: var(--tool-notes); }
[data-tool="cupboard"] { --tool: var(--tool-clock); }
[data-tool="music"] { --tool: var(--tool-music); }
[data-tool="sounds"] { --tool: var(--tool-mixer); }
[data-tool="weather"] { --tool: var(--tool-weather); }
[data-tool="countdown"] { --tool: var(--tool-countdowns); }
[data-tool="habits"] { --tool: var(--tool-habits); }
[data-tool="breathe"] { --tool: var(--tool-breathe); }
[data-tool="quotes"] { --tool: var(--tool-wisdom); }
[data-tool="wordguess"] { --tool: var(--tool-wordguess); }
[data-tool="worldclocks"] { --tool: var(--tool-worldclocks); }
[data-tool="calculator"] { --tool: var(--tool-calculator); }
[data-tool="classroom"] { --tool: var(--tool-classroom); }
