/* Themes: every color, font and shape decision lives in custom properties on <html>.
   Switching theme = swapping one class, so it is instant mid-game. */

@font-face {
  font-family: 'Rattle Pixel';
  src: url('/fonts/rattle-pixel.ttf') format('truetype');
  font-display: swap;
}

:root,
.theme-classic {
  --font-body: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;
  --font-num: 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --display-weight: 700;
  --display-transform: none;
  --display-tracking: 0.01em;

  --bg: #1d5a37;
  --bg-image:
    radial-gradient(ellipse at 50% 35%, rgba(255, 255, 255, 0.09), transparent 65%),
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.035) 0 2px, transparent 2px 4px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 5px),
    linear-gradient(#21643d, #174a2d);
  --on-bg: #f6f0df;
  --on-bg-muted: #cfe0d2;

  --surface: #fbf6e8;
  --surface-2: #f1e8d2;
  --surface-line: #d8c9a6;
  --text: #2b2216;
  --text-muted: #6b5b43;
  --border: #c9b78f;

  --accent: #b3261e;
  --accent-2: #8a1d17;
  --accent-text: #fff8ee;
  --focus: #ffcf33;
  --good: #1f7a3f;
  --danger: #b3261e;

  --radius: 0.6rem;
  --radius-lg: 1rem;
  --radius-pill: 999px;
  --shadow: 0 0.15rem 0.5rem rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 0.6rem 1.8rem rgba(0, 0, 0, 0.35);

  --btn-bg: #fbf6e8;
  --btn-text: #2b2216;
  --btn-border: #9d8a62;

  --die-bg: #fffbf0;
  --die-edge: #d7cdb4;
  --die-pip: #1d1a16;
  --die-pip-1: #b3261e;
  --die-shine: rgba(255, 255, 255, 0.55);
  --die-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.35);
  --held-ring: #ffcf33;
  --held-label-bg: #ffcf33;
  --held-label-text: #2b2216;

  --sc-bg: #fbf6e8;
  --sc-head-bg: #efe4c8;
  --sc-line: #d9cba6;
  --sc-text: #2b2216;
  --sc-muted: #806f53;
  --sc-active-bg: #fff1c2;
  --sc-pick-bg: #fff;
  --sc-pick-text: #1f5e3a;
  --sc-pick-border: #1f7a3f;
  --sc-best-bg: #1f7a3f;
  --sc-best-text: #fff;
  --sc-zero: #9c8c70;
  --sc-ruled: repeating-linear-gradient(transparent 0 calc(100% - 1px), var(--sc-line) calc(100% - 1px));

  --chip-bg: rgba(0, 0, 0, 0.22);
  --chip-text: #f6f0df;
  --chip-active-bg: #fbf6e8;
  --chip-active-text: #2b2216;

  --ease-pop: cubic-bezier(0.2, 0.9, 0.3, 1.1);
  --anim-scale: 1;
  --theme-color: #1d5a37;
}

.theme-playful {
  --font-body: ui-rounded, 'SF Pro Rounded', 'Nunito', 'Varela Round', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --font-display: ui-rounded, 'SF Pro Rounded', 'Nunito', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --font-num: ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  --display-weight: 900;
  --display-tracking: 0;

  --bg: #ffd84d;
  --bg-image:
    radial-gradient(circle at 12% 18%, #ff8fc7 0 9%, transparent 9.5%),
    radial-gradient(circle at 88% 12%, #7ee0ff 0 7%, transparent 7.5%),
    radial-gradient(circle at 80% 88%, #b69bff 0 11%, transparent 11.5%),
    radial-gradient(circle at 6% 92%, #8cf0b0 0 8%, transparent 8.5%),
    linear-gradient(160deg, #ffe27a, #ffc94d 55%, #ffb36b);
  --on-bg: #2a1650;
  --on-bg-muted: #4f3a78;

  --surface: #ffffff;
  --surface-2: #f4efff;
  --surface-line: #e3d9ff;
  --text: #2a1650;
  --text-muted: #5d4b85;
  --border: #d6c8ff;

  --accent: #6a3df5;
  --accent-2: #4f22d8;
  --accent-text: #ffffff;
  --focus: #ff3d8b;
  --good: #0f8a4f;
  --danger: #d7263d;

  --radius: 1.1rem;
  --radius-lg: 1.6rem;
  --shadow: 0 0.25rem 0 rgba(42, 22, 80, 0.18);
  --shadow-lg: 0 0.5rem 0 rgba(42, 22, 80, 0.2), 0 1rem 2rem rgba(42, 22, 80, 0.18);

  --btn-bg: #ffffff;
  --btn-text: #2a1650;
  --btn-border: #2a1650;

  --die-bg: #ffffff;
  --die-edge: #2a1650;
  --die-pip: #6a3df5;
  --die-pip-1: #ff3d8b;
  --die-shine: rgba(255, 255, 255, 0);
  --die-shadow: 0 0.3rem 0 #2a1650;
  --held-ring: #ff3d8b;
  --held-label-bg: #ff3d8b;
  --held-label-text: #ffffff;

  --sc-bg: #ffffff;
  --sc-head-bg: #f1ebff;
  --sc-line: #ece5ff;
  --sc-text: #2a1650;
  --sc-muted: #6e5d94;
  --sc-active-bg: #fff4c2;
  --sc-pick-bg: #f4efff;
  --sc-pick-text: #4f22d8;
  --sc-pick-border: #6a3df5;
  --sc-best-bg: #6a3df5;
  --sc-best-text: #fff;
  --sc-zero: #9a8cba;
  --sc-ruled: none;

  --chip-bg: rgba(255, 255, 255, 0.65);
  --chip-text: #2a1650;
  --chip-active-bg: #2a1650;
  --chip-active-text: #ffffff;

  --ease-pop: cubic-bezier(0.34, 1.7, 0.5, 1);
  --anim-scale: 1.25;
  --theme-color: #ffc94d;
}

.theme-retro {
  --font-body: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --font-display: 'Rattle Pixel', ui-monospace, monospace;
  --font-num: 'Rattle Pixel', ui-monospace, monospace;
  --display-weight: 400;
  --display-transform: uppercase;
  --display-tracking: 0.06em;

  --bg: #0b0820;
  --bg-image:
    linear-gradient(rgba(62, 242, 255, 0.07) 1px, transparent 1px) 0 0 / 2rem 2rem,
    linear-gradient(90deg, rgba(255, 62, 165, 0.06) 1px, transparent 1px) 0 0 / 2rem 2rem,
    radial-gradient(ellipse at 50% 120%, #3a0f5c 0, #0b0820 60%);
  --on-bg: #e9f6ff;
  --on-bg-muted: #a9bdd6;

  --surface: #140f33;
  --surface-2: #1d1745;
  --surface-line: #3b2f7a;
  --text: #e9f6ff;
  --text-muted: #a9bdd6;
  --border: #3ef2ff;

  --accent: #ff3ea5;
  --accent-2: #d61c84;
  --accent-text: #0b0820;
  --focus: #fff35c;
  --good: #5dff9d;
  --danger: #ff5c7a;

  --radius: 0.15rem;
  --radius-lg: 0.25rem;
  --shadow: 0 0 0.6rem rgba(62, 242, 255, 0.35);
  --shadow-lg: 0 0 1.6rem rgba(255, 62, 165, 0.35);

  --btn-bg: #140f33;
  --btn-text: #3ef2ff;
  --btn-border: #3ef2ff;

  --die-bg: #0f0b29;
  --die-edge: #3ef2ff;
  --die-pip: #3ef2ff;
  --die-pip-1: #ff3ea5;
  --die-shine: rgba(62, 242, 255, 0.06);
  --die-shadow: 0 0 0.7rem rgba(62, 242, 255, 0.55);
  --held-ring: #fff35c;
  --held-label-bg: #fff35c;
  --held-label-text: #0b0820;

  --sc-bg: #110c2c;
  --sc-head-bg: #1d1745;
  --sc-line: #2c2363;
  --sc-text: #e9f6ff;
  --sc-muted: #a9bdd6;
  --sc-active-bg: #261a55;
  --sc-pick-bg: #0b0820;
  --sc-pick-text: #5dff9d;
  --sc-pick-border: #5dff9d;
  --sc-best-bg: #5dff9d;
  --sc-best-text: #0b0820;
  --sc-zero: #8a87b0;
  --sc-ruled: none;

  --chip-bg: rgba(62, 242, 255, 0.08);
  --chip-text: #e9f6ff;
  --chip-active-bg: #3ef2ff;
  --chip-active-text: #0b0820;

  --ease-pop: steps(4, end);
  --anim-scale: 1;
  --theme-color: #0b0820;
}

.theme-retro .pip { rx: 1px; }
.theme-retro .die-body { rx: 6px; stroke-width: 4; }
