/* The Colourist: this file, `theme.css`, is Strophy's paint shop and holds its design tokens.
 *
 * The Colourist is the ONLY FILE THAT MAY CONTAIN COLOUR LITERALS. style.css,
 * ui/track.ts and the static legal pages (public/legal.css, bundled together with
 * this file by vite.config.ts) borrow her variables and mix no paint of their own.
 * To re-skin the app, edit this file.
 *
 * She hands out two kinds of colour token:
 *
 *  --rgb-*  three space-separated channels. Use these when you need transparency:
 *             box-shadow: 0 0 20px rgb(var(--rgb-accent) / 0.3);
 *           In TypeScript inline styles the same syntax works:
 *             el.style.background = 'rgb(var(--rgb-accent) / 0.14)';
 *  --ki-*   ready-to-use colours. Where a colour has an --rgb-* twin, the --ki-*
 *           value is derived from it, so there is exactly one place to change it.
 *
 * She does not colour the per-word identity textures: those are generated from
 * hue/saturation data sent by the backend (ui/texture.ts) and are deliberately
 * independent of the brand palette.
 */
:root {
  color-scheme: dark;

  /* ── Palette (channels) ─────────────────────────────────────────────── */
  --rgb-bg:          11 17 22;      /* #0b1116 page */
  --rgb-bg-deep:      7 12 16;      /* #070c10 play surface, inputs, overlays */
  --rgb-surface:     20 30 36;      /* #141e24 cards */
  --rgb-text:       244 251 249;    /* #f4fbf9 */
  --rgb-accent:      85 246 209;    /* #55f6d1 brand accent */
  --rgb-accent-soft: 167 255 232;   /* #a7ffe8 hover / highlight of the accent */
  --rgb-cyan:        56 189 248;    /* #38bdf8 secondary accent, "left" input side */
  --rgb-success:     85 246 166;    /* #55f6a6 */
  --rgb-warning:    255 202 88;     /* #ffca58 */
  --rgb-danger:     255 107 115;    /* #ff6b73 */
  /* The two song trophies. Their own channels rather than warning/danger: a red
     trophy is a reward, and must not borrow the colour that means "error". */
  --rgb-trophy-recognition: 255 202 88;  /* #ffca58 yellow: recognition mastered */
  --rgb-trophy-production:  240 72 84;   /* #f04854 red: production mastered too */
  /* The red of the reverse-mode trophy counter chip on the home screen. */
  --rgb-reverse-1: 214 70 82;            /* #d64652 */
  --rgb-reverse-2: 170 44 58;            /* #aa2c3a */
  --rgb-on-reverse: 255 255 255;
  /* Play button in reverse mode: the same red family, but calmer (less saturated and
     a touch lighter), because it fills a large area. White type. */
  --rgb-play-reverse-1: 196 88 96;       /* #c45860 */
  --rgb-play-reverse-2: 164 66 76;       /* #a4424c */
  --rgb-ink:          7 20 16;      /* #071410 text on accent fills */
  --rgb-shadow:       0 0 0;        /* drop shadows and scrims */
  --rgb-light:      255 255 255;    /* specular highlights on dark fills */
  --rgb-neutral:    148 163 184;    /* #94a3b8 "pressed out of range" flash */
  --rgb-label-scrim: 15 15 28;      /* #0f0f1c backing for text on word textures */

  /* Gameplay answer feedback (right / wrong card, PERFECT flash). Deliberately not
     the UI success/danger colours: they must stay unmistakable on any card. */
  --rgb-correct:     34 197 94;     /* #22c55e */
  --rgb-wrong:      239 68 68;      /* #ef4444 */

  /* The perfect-timing line across the track. */
  --rgb-timing-line: 224 231 255;   /* #e0e7ff */
  --rgb-timing-glow: 129 140 248;   /* #818cf8 */

  /* ── Surfaces ───────────────────────────────────────────────────────── */
  --ki-bg:              rgb(var(--rgb-bg));
  --ki-bg-deep:         rgb(var(--rgb-bg-deep));
  --ki-bg-gradient-end: #0d171c;              /* bottom of the page gradient */
  --ki-surface:         rgb(var(--rgb-surface));
  --ki-surface-raised:  #1a2830;
  --ki-surface-hover:   #22343d;
  --ki-track:           #26373e;              /* empty part of a progress bar */

  /* ── Text ───────────────────────────────────────────────────────────── */
  --ki-text:            rgb(var(--rgb-text));
  --ki-text-soft:       #d7e5e2;
  --ki-muted:           #a9bec3;
  --ki-text-faint:      #91a6aa;              /* idle icon buttons, placeholders */

  /* ── Borders ────────────────────────────────────────────────────────── */
  --ki-border:          #344c55;
  --ki-border-strong:   #52717a;

  /* ── Accent & status ────────────────────────────────────────────────── */
  --ki-accent:          rgb(var(--rgb-accent));
  --ki-accent-soft:     rgb(var(--rgb-accent-soft));
  --ki-cyan:            rgb(var(--rgb-cyan));
  --ki-success:         rgb(var(--rgb-success));
  --ki-warning:         rgb(var(--rgb-warning));
  --ki-danger:          rgb(var(--rgb-danger));
  --ki-favorite:        var(--ki-warning);    /* starred song */
  --ki-trophy-recognition: rgb(var(--rgb-trophy-recognition));
  --ki-trophy-production:  rgb(var(--rgb-trophy-production));
  --ki-reverse-fill:    linear-gradient(90deg, rgb(var(--rgb-reverse-1)), rgb(var(--rgb-reverse-2)));
  --ki-on-reverse:      rgb(var(--rgb-on-reverse));
  --ki-play-reverse-fill: linear-gradient(90deg, rgb(var(--rgb-play-reverse-1)), rgb(var(--rgb-play-reverse-2)));
  --ki-streak:          #fb923c;

  /* Tinted chips ("mastered" / "current song" badges). */
  --ki-success-surface: #12372b;
  --ki-success-edge:    #2c7457;
  --ki-accent-surface:  #163b3a;
  --ki-accent-edge:     #2d7770;

  /* Gameplay answer feedback, solid. */
  --ki-correct:         rgb(var(--rgb-correct));
  --ki-wrong:           rgb(var(--rgb-wrong));

  /* ── Text ON coloured fills ─────────────────────────────────────────── */
  --ki-on-accent:       rgb(var(--rgb-ink));
  --ki-on-accent-muted: #183d34;              /* small print on an accent fill */
  --ki-on-solid:        #fff;                 /* on danger / wrong / scrims */
  --ki-on-option:       #102126;              /* on the light answer buttons */

  /* ── Disabled controls ──────────────────────────────────────────────── */
  --ki-disabled-fg:     #9db0b4;
  --ki-disabled-bg:     #26333a;
  --ki-disabled-border: #43565e;

  /* ── Shape ──────────────────────────────────────────────────────────── */
  --ki-radius:    4px;
  --ki-radius-sm: 3px;
  /* Chamfered corners: large for cards, small for icon tiles, and the brand mark. */
  --ki-cut:      polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  --ki-cut-sm:   polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  --ki-cut-mark: polygon(0 0, 76% 0, 100% 24%, 100% 100%, 24% 100%, 0 76%);

  /* ── Type ───────────────────────────────────────────────────────────── */
  --ki-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}

/* ═════════════════════════════════════════════════════════════════════════
 * HOME THEMES — the home screen and the tutorial overlay.
 *
 * A home theme is a FAMILY (lime, pastel) times a MODE (night, day). ui/color-mode.ts
 * puts three classes on <body> (and on the tutorial overlay) while the home route
 * is showing:
 *
 *     scheme-app   +   scheme-night | scheme-day   +   theme-lime | theme-pastel
 *
 * `.scheme-app` (next) holds everything the four palettes share. Each palette is
 * then one block, `.theme-<family>.scheme-<mode>`, that only FILLS IN VALUES. To add
 * a theme: copy one palette block, rename it, change the values, and add the family
 * to THEMES in ui/color-mode.ts (plus its label string in i18n.ts). No component
 * and no rule in home.css changes.
 *
 * Why this is scoped to a class instead of replacing :root: the gameplay screen and
 * the screens not yet redesigned still read the mint scheme above and must keep
 * looking as they do.
 *
 * The one brand motif is the highlighted word: an accent FILL, a gradient from
 * --home-g1 to --home-g2 (equal for a one-colour theme). The logo's lit bar, the
 * sung lyric, the trophy chip, the progress bars and Play all use it.
 *
 * Home-only tokens:
 *   --home-page / --home-page-text   the page margin and the type that sits on it
 *   --home-g1 / --home-g2            the two stops of the accent fill
 *   --home-fill                      the fill itself (derived, below)
 *   --home-on-fill                   type on the fill
 *   --home-hero-*                    the now-playing panel. It may be dark on a light
 *                                    page (lime day), so it carries its own surface,
 *                                    text, line and text-safe accent
 *   --home-glow / -wide / -core      the "lamp" behind the hero: its colour, and how
 *                                    strong the wide wash and the bright core are
 *
 * --ki-accent is the TEXT-SAFE accent (a dark olive or teal by day), for small type
 * and thin lines. Bright accent colours are fills only.
 * ═════════════════════════════════════════════════════════════════════════ */
.scheme-app {
  /* Shape: soft. The square, chamfered look is gone on this scheme. */
  --ki-radius:    12px;
  --ki-radius-sm: 8px;
  --ki-cut:      none;
  --ki-cut-sm:   none;
  --ki-cut-mark: none;

  --home-fill: linear-gradient(90deg, var(--home-g1), var(--home-g2));

  /* Every ready colour is derived from the channels HERE, on the element that also
     carries the palette class. (A --ki-* value is resolved where it is declared, so
     restating the pair below is what makes the palette take effect at all.) */
  --ki-bg:              rgb(var(--rgb-bg));
  --ki-bg-deep:         rgb(var(--rgb-bg-deep));
  --ki-bg-gradient-end: rgb(var(--rgb-bg));
  --ki-surface:         rgb(var(--rgb-surface));
  --ki-text:            rgb(var(--rgb-text));
  --ki-accent:          rgb(var(--rgb-accent));
  --ki-accent-soft:     rgb(var(--rgb-accent-soft));
  --ki-cyan:            rgb(var(--rgb-cyan));
  --ki-success:         rgb(var(--rgb-success));
  --ki-warning:         rgb(var(--rgb-warning));
  --ki-danger:          rgb(var(--rgb-danger));
  --ki-favorite:        var(--ki-warning);
  --ki-on-accent:       rgb(var(--rgb-ink));
}

/* ── lime · night ("Lime on violet") ──────────────────────────────────────
 * Acid lime on a lifted violet night. The hero is the panel itself, lit from the
 * top right like a lamp in a dark room. */
.theme-lime.scheme-night {
  color-scheme: dark;

  --home-page:        #1c1729;
  --home-page-text:   #f5f2fb;
  --home-g1:          #c8ff3d;
  --home-g2:          #c8ff3d;
  --home-on-fill:     #141a00;
  --home-hero-bg:     #2a2440;
  --home-hero-text:   #f5f2fb;
  --home-hero-muted:  #a49eb9;
  --home-hero-line:   rgba(255, 255, 255, 0.15);
  --home-hero-accent: #c8ff3d;
  --home-glow:        #c8ff3d;
  --home-glow-wide:   38%;
  --home-glow-core:   0%;

  --rgb-bg:          28 23 41;
  --rgb-bg-deep:     20 16 31;
  --rgb-surface:     42 36 64;
  --rgb-text:       245 242 251;
  --rgb-accent:     200 255 61;
  --rgb-accent-soft: 217 255 122;
  --rgb-cyan:       185 166 255;
  --rgb-success:     91 227 168;
  --rgb-warning:    255 202 88;
  --rgb-danger:     255 107 115;
  --rgb-ink:         20 26 0;

  --ki-surface-raised:  #332c4e;
  --ki-surface-hover:   #3b3359;
  --ki-track:           #3a3355;
  --ki-text-soft:       #dcd6ea;
  --ki-muted:           #a49eb9;
  --ki-text-faint:      #8a84a0;
  --ki-border:          rgba(255, 255, 255, 0.15);
  --ki-border-strong:   rgba(255, 255, 255, 0.32);
  --ki-success-surface: #1f3a33;
  --ki-success-edge:    #2f6b5a;
  --ki-accent-surface:  #39412a;
  --ki-accent-edge:     #6e8a2a;
  --ki-on-accent-muted: #3b4a00;
  --ki-disabled-fg:     #847e99;
  --ki-disabled-bg:     #241f38;
  --ki-disabled-border: #3a3355;
}

/* ── lime · day ("Bulb") ──────────────────────────────────────────────────
 * A light page with one near-black hero panel and a hot lime core: the lamp again.
 * Lime is too bright to be type on white, so outside the hero the text-safe accent
 * is a dark olive and the lime is only ever a fill. */
.theme-lime.scheme-day {
  color-scheme: light;

  --home-page:        #f3f1ee;
  --home-page-text:   #15131c;
  --home-g1:          #c8ff3d;
  --home-g2:          #c8ff3d;
  --home-on-fill:     #141a00;
  --home-hero-bg:     #121115;
  --home-hero-text:   #f4f3f6;
  --home-hero-muted:  #9a98a2;
  --home-hero-line:   rgba(255, 255, 255, 0.14);
  --home-hero-accent: #c8ff3d;
  --home-glow:        #c8ff3d;
  --home-glow-wide:   50%;
  --home-glow-core:   46%;

  --rgb-bg:         243 241 238;
  --rgb-bg-deep:    232 229 224;
  --rgb-surface:    255 255 255;
  --rgb-text:        21 19 28;
  --rgb-accent:      76 107 0;
  --rgb-accent-soft: 107 143 10;
  --rgb-cyan:        79 70 200;
  --rgb-success:     61 122 31;
  --rgb-warning:    183 121 31;
  --rgb-danger:     194 65 12;
  --rgb-ink:        255 255 255;

  --ki-surface-raised:  #f6f5f9;
  --ki-surface-hover:   #eeedf3;
  --ki-track:           #e4e2ec;
  --ki-text-soft:       #34313f;
  --ki-muted:           #67657a;
  --ki-text-faint:      #8a879a;
  --ki-border:          rgba(21, 19, 28, 0.13);
  --ki-border-strong:   rgba(21, 19, 28, 0.35);
  --ki-success-surface: #e6f2df;
  --ki-success-edge:    #9cc88a;
  --ki-accent-surface:  #eef5cf;
  --ki-accent-edge:     #b7d05c;
  --ki-on-accent-muted: #e6f0c0;
  --ki-disabled-fg:     #9a98a8;
  --ki-disabled-bg:     #eceaf1;
  --ki-disabled-border: #d9d6e2;
}

/* ── pastel · night ("C2 Pastel") ─────────────────────────────────────────
 * Milky lime running into aqua on petrol blue. The gentlest of the set: a soft
 * marker, and only a faint lamp behind the hero. */
.theme-pastel.scheme-night {
  color-scheme: dark;

  --home-page:        #182229;
  --home-page-text:   #eef3f4;
  --home-g1:          #d4eb8c;
  --home-g2:          #8adfcb;
  --home-on-fill:     #12201a;
  --home-hero-bg:     #223039;
  --home-hero-text:   #eef3f4;
  --home-hero-muted:  #8fa2ab;
  --home-hero-line:   rgba(255, 255, 255, 0.14);
  --home-hero-accent: #d4eb8c;
  --home-glow:        #d4eb8c;
  --home-glow-wide:   16%;
  --home-glow-core:   0%;

  --rgb-bg:          24 34 41;
  --rgb-bg-deep:     17 25 30;
  --rgb-surface:     34 48 57;
  --rgb-text:       238 243 244;
  --rgb-accent:     212 235 140;
  --rgb-accent-soft: 228 243 182;
  --rgb-cyan:       138 223 203;
  --rgb-success:    138 223 203;
  --rgb-warning:    255 202 88;
  --rgb-danger:     255 107 115;
  --rgb-ink:         18 32 26;

  --ki-surface-raised:  #2a3a44;
  --ki-surface-hover:   #32454f;
  --ki-track:           #33444e;
  --ki-text-soft:       #d3dfe2;
  --ki-muted:           #8fa2ab;
  --ki-text-faint:      #7a8d96;
  --ki-border:          rgba(255, 255, 255, 0.14);
  --ki-border-strong:   rgba(255, 255, 255, 0.3);
  --ki-success-surface: #1d3a36;
  --ki-success-edge:    #2f6e62;
  --ki-accent-surface:  #2f3b2a;
  --ki-accent-edge:     #6b8a4a;
  --ki-on-accent-muted: #3a4a2a;
  --ki-disabled-fg:     #7a8d96;
  --ki-disabled-bg:     #1e2b33;
  --ki-disabled-border: #33444e;
}

/* ── pastel · day ─────────────────────────────────────────────────────────
 * A pale green-grey page with white panels. Pastel is too light to be type, so the
 * text-safe accent is a deep teal and the hero is a light panel like the rest. */
.theme-pastel.scheme-day {
  color-scheme: light;

  --home-page:        #f2f5f3;
  --home-page-text:   #0e1517;
  --home-g1:          #d4eb8c;
  --home-g2:          #8adfcb;
  --home-on-fill:     #12201a;
  --home-hero-bg:     #fcfdfc;
  --home-hero-text:   #0e1517;
  --home-hero-muted:  #637175;
  --home-hero-line:   rgba(14, 21, 23, 0.13);
  --home-hero-accent: #2e7a66;
  --home-glow:        #d4eb8c;
  --home-glow-wide:   26%;
  --home-glow-core:   0%;

  --rgb-bg:         242 245 243;
  --rgb-bg-deep:    231 236 233;
  --rgb-surface:    252 253 252;
  --rgb-text:        14 21 23;
  --rgb-accent:      46 122 102;
  --rgb-accent-soft: 70 150 126;
  --rgb-cyan:        42 110 150;
  --rgb-success:     46 122 90;
  --rgb-warning:    183 121 31;
  --rgb-danger:     194 65 12;
  --rgb-ink:        255 255 255;

  --ki-surface-raised:  #f5f8f6;
  --ki-surface-hover:   #ecf1ee;
  --ki-track:           #dfe6e2;
  --ki-text-soft:       #2b3538;
  --ki-muted:           #637175;
  --ki-text-faint:      #8a979b;
  --ki-border:          rgba(14, 21, 23, 0.13);
  --ki-border-strong:   rgba(14, 21, 23, 0.35);
  --ki-success-surface: #e3f1ea;
  --ki-success-edge:    #93c4ae;
  --ki-accent-surface:  #eef5d8;
  --ki-accent-edge:     #bcd47a;
  --ki-on-accent-muted: #dfeedd;
  --ki-disabled-fg:     #98a4a8;
  --ki-disabled-bg:     #eaeeec;
  --ki-disabled-border: #d6ddd9;
}

/* The Notary: this file, `legal.css`, styles the static legal pages (datenschutz.html etc.). No JS, same look as the app.
 * Colours come from theme.css: vite.config.ts serves/emits this file as
 * `/legal.css` = theme.css + this file, so there is exactly one palette.
 */

body {
  margin: 0;
  background: var(--ki-bg);
  color: var(--ki-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
}

.legal {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.legal h1 { font-size: 1.6rem; line-height: 1.3; }
.legal h2 { font-size: 1.2rem; margin-top: 2.2rem; }

.legal a { color: var(--ki-accent); }

.legal code {
  background: var(--ki-surface);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* Tables scroll sideways on narrow screens instead of breaking the layout. */
.legal table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1rem 0;
}

.legal th,
.legal td {
  border: 1px solid var(--ki-border);
  padding: 0.45rem 0.7rem;
  text-align: left;
  vertical-align: top;
}

.legal th { background: var(--ki-surface); }

.legal-back {
  margin-top: 3rem;
  color: var(--ki-muted);
}

.legal-langs {
  font-size: 0.9rem;
  color: var(--ki-muted);
}

.legal-langs [aria-current="page"] { color: var(--ki-text); font-weight: 600; }
