/* ============================================================
   themes.css — every theme of the *.hiruvaporwave.com sites
   (Notewave, Toolwave, Lists, Calendar).

   DO NOT EDIT the copy inside an app (<app>/css/themes.css): the
   real one is Sous_sites/_theme/themes.css, copied into every app by
   `python3 _scripts/sync-theme.py`. See _theme/README.md.

   Linked right after the app's css/style.css (the layout), and before
   any app-only stylesheet, so theme rules win over the layout.
   ============================================================ */

:root,
[data-theme="hiru"] {
  /* Hirui theme (default/fallback; also on the picker's preview cards) */
  --void: #130a1f;
  --violet: #2d1444;
  --violet-soft: #3c1d5c;
  --magenta: #5c2a5e;
  --gold: #c9a227;
  --gold-bright: #e6c866;
  --star: #ede3f5;
  --star-dim: #b8a6cf;

  --violet-accent: #9b6bd4;
  --magenta-accent: #d17bc4;
  --rose-accent: #d98a6b;

  --panel: rgba(45, 20, 68, 0.28);
  --panel-border: rgba(201, 162, 39, 0.35);
  --danger: #d9666a;
  --accent-tint: rgba(230, 200, 102, 0.16);
  --on-accent: var(--void);
  --shadow: none;

  --font-display: 'Cinzel Decorative', Georgia, serif;
  --font-heading: 'Cinzel', Georgia, serif;
  --font-body: 'Cormorant Garamond', Georgia, serif;
  --font-mono: var(--font-heading);
}

[data-theme="cozy"] {
  /* Cozy: the default for new visitors. Hirui's violet + gold, made calm
     and easy to read: plain rounded font, solid cards, no all-caps. */
  --void: #1a1327;
  --violet: #251b36;
  --violet-soft: #30244a;
  --magenta: #3b2c55;
  --gold: #c9a227;
  --gold-bright: #e6c866;
  --star: #f4eefa;
  --star-dim: #bcaed0;

  --violet-accent: #ad87e3;
  --magenta-accent: #dc8fcc;
  --rose-accent: #e59d80;

  --panel: #241a35;
  --panel-border: #3e3157;
  --danger: #e57a82;
  --accent-tint: rgba(230, 200, 102, 0.14);
  --on-accent: #1a1327;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);

  --font-display: 'Nunito', system-ui, sans-serif;
  --font-heading: 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="kyne"] {
  /* Kyne: white and blue pixel look, like an old handheld RPG screen.
     Light version: #f8f8f8 page, #00a2ff blues (same as Kyne dark),
     navy ink for text. */
  --void: #f8f8f8;
  --violet: rgba(0, 162, 255, 0.08);
  --violet-soft: #f8f8f8;
  --magenta: rgba(0, 162, 255, 0.25);
  --gold: #00a2ff;
  --gold-bright: #00a2ff;
  --star: #142850;
  --star-dim: #4f6590;

  --violet-accent: #d9a400;
  --magenta-accent: #e0448a;
  --rose-accent: #e23b3b;

  --panel: #f8f8f8;
  --panel-border: #142850;
  --danger: #c8323c;
  --accent-tint: rgba(0, 162, 255, 0.14);
  --on-accent: #142850;
  --shadow: none;

  --kyne-ink: #142850;
  --kyne-soft: #00a2ff;
  --kyne-tint: rgba(0, 162, 255, 0.12);
  --kyne-paper: #f8f8f8;
  --kyne-grid: rgba(0, 162, 255, 0.07);
  --kyne-title-shadow: #142850;
  --kyne-hover-bg: #142850;
  --kyne-hover-fg: #f8f8f8;
  --kyne-danger-tint: #fdecee;
  --kyne-boot-1: #142850;
  --kyne-boot-2: #00a2ff;
  --kyne-boot-3: #00a2ff;
  --kyne-boot-4: #f8f8f8;
  --kyne-overlay: rgba(20, 40, 80, 0.35);
  --kyne-swatch-border: rgba(20, 40, 80, 0.35);
  --kyne-ok: #1d7f47;
  /* A thick pixel frame with square-cut corners (shadows on 4 sides). */
  --kyne-frame: 0 -3px 0 0 var(--kyne-ink), 0 3px 0 0 var(--kyne-ink), -3px 0 0 0 var(--kyne-ink), 3px 0 0 0 var(--kyne-ink);

  --font-display: 'Press Start 2P', monospace;
  --font-heading: 'Pixelify Sans', sans-serif;
  --font-body: 'Pixelify Sans', sans-serif;
  --font-mono: 'VT323', monospace;
}

[data-theme="sven"] {
  --void: #2a0e1c;
  --violet: #5c1a3d;
  --violet-soft: #7a2650;
  --magenta: #8f2f5e;
  --gold: #d4a017;
  --gold-bright: #f5c94f;
  --star: #fff3e0;
  --star-dim: #e0b8c9;

  --violet-accent: #e0559b;
  --magenta-accent: #ff8fc4;
  --rose-accent: #ff6f91;

  --panel: rgba(122, 38, 80, 0.28);
  --panel-border: rgba(212, 160, 23, 0.4);
  --danger: #d63b52;
  --accent-tint: rgba(245, 201, 79, 0.16);
  --on-accent: var(--void);
  --shadow: 0 0 16px rgba(245, 201, 79, 0.18);

  --font-display: 'Playfair Display', Georgia, serif;
  --font-heading: 'Marcellus SC', Georgia, serif;
  --font-body: 'EB Garamond', Georgia, serif;
  --font-mono: var(--font-heading);
}

/* Liri — GTA IV pause-menu look: neutral matte black and gray, a bold
   condensed poster face, orange as the one hot color cutting through it. */
[data-theme="liri"] {
  --void: #0c0c0c;
  --violet: #1a1a1a;
  --violet-soft: #242424;
  --magenta: #2c2c2c;
  --gold: #cc6a1f;
  --gold-bright: #ff9736;
  --star: #e8e8e8;
  --star-dim: #8a8a8a;

  --violet-accent: #6b7480;
  --magenta-accent: #a13a2e;
  --rose-accent: #c9762e;

  --panel: rgba(255, 255, 255, 0.04);
  --panel-border: rgba(255, 255, 255, 0.12);
  --danger: #c0392b;
  --accent-tint: rgba(255, 151, 54, 0.16);
  --on-accent: var(--void);
  --shadow: none;

  --font-display: 'Bebas Neue', sans-serif;
  --font-heading: 'Oswald', sans-serif;
  --font-body: 'Roboto', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* Loydiie — rainbow neon theme: near-black glass, glowing multicolor
   accents, in place of Hirui's gothic dark or the calm Cozy default. */
[data-theme="loydiie"] {
  --void: #0a0014;
  --violet: #120022;
  --violet-soft: #1a0033;
  --magenta: #1a0033;
  --gold: #ff2ec4;
  --gold-bright: #00e5ff;
  --star: #f3f0ff;
  --star-dim: #9a86d6;

  --violet-accent: #b026ff;
  --magenta-accent: #ff2ec4;
  --rose-accent: #fff01f;

  --panel: rgba(24, 0, 46, 0.55);
  --panel-border: rgba(0, 229, 255, 0.35);
  --danger: #ff3860;
  --accent-tint: rgba(0, 229, 255, 0.16);
  --on-accent: #0a0014;
  --shadow: 0 0 10px rgba(255, 46, 196, 0.3), 0 0 26px rgba(0, 229, 255, 0.16);

  --font-display: 'Orbitron', sans-serif;
  --font-heading: 'Orbitron', sans-serif;
  --font-body: 'Rajdhani', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* Thanouf — cultist ritual theme: bleaker, blacker void than Hirui's gothic
   base, with a bruised amethyst glow standing in for gold, and blood/moss/
   bone tones for the note-tag colors instead of a warm palette. */
[data-theme="thanouf"] {
  --void: #050108;
  --violet: #150a24;
  --violet-soft: #200f36;
  --magenta: #240f1c;
  --gold: #6b21a8;
  --gold-bright: #b565f0;
  --star: #e6d9fb;
  --star-dim: #6d5a89;

  --violet-accent: #b8324a;
  --magenta-accent: #5a8f4f;
  --rose-accent: #c9a876;

  --panel: rgba(21, 10, 36, 0.45);
  --panel-border: rgba(181, 101, 240, 0.3);
  --danger: #b8324a;
  --accent-tint: rgba(181, 101, 240, 0.16);
  --on-accent: #f5eaff;
  --shadow: 0 0 20px rgba(107, 33, 168, 0.35);

  --font-display: 'Pirata One', 'Cinzel Decorative', Georgia, serif;
  --font-heading: 'Cinzel', Georgia, serif;
  --font-body: 'Cormorant Garamond', Georgia, serif;
  --font-mono: var(--font-heading);
}

/* ============================================================
   Light versions (data-mode="light"): each theme keeps its fonts and
   look, with these colors. Kyne was born light, so its extra version
   is the dark one (data-mode="dark").
   ============================================================ */

[data-theme="cozy"][data-mode="light"] {
  --void: #f6f2fb;
  --violet: #efe8f8;
  --violet-soft: #faf7fd;
  --magenta: #e3d7f2;
  --gold: #7d5f08;
  --gold-bright: #a07c10;
  --star: #2a2140;
  --star-dim: #6b5e84;

  --violet-accent: #7d4fc4;
  --magenta-accent: #b8489f;
  --rose-accent: #c0603d;

  --panel: #ffffff;
  --panel-border: #e0d5ee;
  --danger: #c23d4a;
  --accent-tint: rgba(160, 124, 16, 0.12);
  --on-accent: #ffffff;
  --shadow: 0 1px 2px rgba(60, 40, 90, 0.06), 0 8px 24px rgba(60, 40, 90, 0.08);
}

/* Hirui light: purple and gold trade places — a gold page, purple ink. */
[data-theme="hiru"][data-mode="light"] {
  --void: #f0dfae;
  --violet: #f6e9c4;
  --violet-soft: #fbf3dc;
  --magenta: #e6cf8c;
  --gold: #3c1d5c;
  --gold-bright: #5c2a8e;
  --star: #2d1444;
  --star-dim: #6e5482;

  --violet-accent: #b8901a;
  --magenta-accent: #8f3a7c;
  --rose-accent: #b5603f;

  --panel: rgba(255, 249, 230, 0.7);
  --panel-border: rgba(92, 42, 142, 0.4);
  --danger: #b3363b;
  --accent-tint: rgba(92, 42, 142, 0.12);
  --on-accent: #f6e7b8;
  --shadow: none;
}

[data-theme="loydiie"][data-mode="light"] {
  --void: #f8f5ff;
  --violet: #efe9ff;
  --violet-soft: #ffffff;
  --magenta: #e6dcff;
  --gold: #c4008f;
  --gold-bright: #007ea6;
  --star: #1d0b3a;
  --star-dim: #6b5a99;

  --violet-accent: #8a1fd6;
  --magenta-accent: #c4008f;
  --rose-accent: #a88f00;

  --panel: rgba(255, 255, 255, 0.78);
  --panel-border: rgba(0, 126, 166, 0.35);
  --danger: #d61e48;
  --accent-tint: rgba(0, 126, 166, 0.12);
  --on-accent: #ffffff;
  --shadow: 0 0 10px rgba(196, 0, 143, 0.12), 0 0 26px rgba(0, 126, 166, 0.1);
}

[data-theme="sven"][data-mode="light"] {
  --void: #fff0f5;
  --violet: #fde3ee;
  --violet-soft: #fff8fb;
  --magenta: #f7cfe1;
  --gold: #8a6406;
  --gold-bright: #a8780a;
  --star: #4a1530;
  --star-dim: #8f5a75;

  --violet-accent: #c2307a;
  --magenta-accent: #e0559b;
  --rose-accent: #d6455f;

  --panel: rgba(255, 255, 255, 0.72);
  --panel-border: rgba(168, 120, 10, 0.4);
  --danger: #c42a44;
  --accent-tint: rgba(168, 120, 10, 0.12);
  --on-accent: #ffffff;
  --shadow: 0 0 16px rgba(168, 120, 10, 0.14);
}

[data-theme="liri"][data-mode="light"] {
  --void: #e8e8e8;
  --violet: #f2f2f2;
  --violet-soft: #ffffff;
  --magenta: #d6d6d6;
  --gold: #b4560f;
  --gold-bright: #d4600a;
  --star: #141414;
  --star-dim: #5c5c5c;

  --violet-accent: #55606c;
  --magenta-accent: #a13a2e;
  --rose-accent: #b8661f;

  --panel: rgba(255, 255, 255, 0.85);
  --panel-border: rgba(0, 0, 0, 0.14);
  --danger: #c0392b;
  --accent-tint: rgba(212, 96, 10, 0.14);
  --on-accent: #ffffff;
}

[data-theme="thanouf"][data-mode="light"] {
  --void: #ebe3d4;
  --violet: #e3d8c4;
  --violet-soft: #f6f1e7;
  --magenta: #d8c8ae;
  --gold: #4b1580;
  --gold-bright: #6b21a8;
  --star: #1f0f2e;
  --star-dim: #6a5876;

  --violet-accent: #9c2238;
  --magenta-accent: #3f6e35;
  --rose-accent: #8a6a3a;

  --panel: rgba(250, 245, 235, 0.72);
  --panel-border: rgba(107, 33, 168, 0.3);
  --danger: #9c2238;
  --accent-tint: rgba(107, 33, 168, 0.12);
  --on-accent: #f5eaff;
  --shadow: 0 0 20px rgba(107, 33, 168, 0.12);
}

/* Kyne dark: deep night-blue screen (was pure black). Every blue is
   #00a2ff and every white #f8f8f8. */
[data-theme="kyne"][data-mode="dark"] {
  --void: #0b1d3a;
  --violet: #102449;
  --violet-soft: #152d58;
  --magenta: #1f3a6e;
  --gold: #00a2ff;
  --gold-bright: #00a2ff;
  --star: #f8f8f8;
  --star-dim: #a9bddb;

  --violet-accent: #ffd23f;
  --magenta-accent: #ff5fa2;
  --rose-accent: #ff4b4b;

  --panel: #102449;
  --panel-border: #f8f8f8;
  --danger: #ff4b4b;
  --accent-tint: rgba(0, 162, 255, 0.16);
  --on-accent: #0b1d3a;

  --kyne-ink: #f8f8f8;
  --kyne-soft: #00a2ff;
  --kyne-tint: rgba(0, 162, 255, 0.14);
  --kyne-paper: #0b1d3a;
  --kyne-grid: rgba(0, 162, 255, 0.12);
  --kyne-title-shadow: #061229;
  --kyne-hover-bg: #f8f8f8;
  --kyne-hover-fg: #0b1d3a;
  --kyne-danger-tint: rgba(255, 75, 75, 0.14);
  --kyne-boot-1: #f8f8f8;
  --kyne-boot-2: #00a2ff;
  --kyne-boot-3: #1f3a6e;
  --kyne-boot-4: #0b1d3a;
  --kyne-overlay: rgba(6, 18, 41, 0.75);
  --kyne-swatch-border: rgba(248, 248, 248, 0.4);
  --kyne-ok: #3ddc84;
}

/* Only the current theme's sigils / subtitles show. */
.theme-variant {
  display: none;
}

[data-theme="hiru"] .theme-variant--hiru,
:root:not([data-theme]) .theme-variant--hiru {
  display: block;
}

[data-theme="cozy"] .theme-variant--cozy {
  display: block;
}

[data-theme="kyne"] .theme-variant--kyne {
  display: block;
}

[data-theme="loydiie"] .theme-variant--loydiie {
  display: block;
}

[data-theme="sven"] .theme-variant--sven {
  display: block;
}

[data-theme="liri"] .theme-variant--liri {
  display: block;
}

[data-theme="thanouf"] .theme-variant--thanouf {
  display: block;
}

[data-theme="cozy"] .admin-overlay {
  background: rgba(26, 19, 39, 0.55);
}

[data-theme="cozy"] .admin-modal {
  background: var(--panel);
  border-radius: 12px;
}

[data-theme="cozy"] .admin-modal::before,
[data-theme="cozy"] .admin-modal::after {
  content: none;
}

[data-theme="cozy"] .admin-stat,
[data-theme="cozy"] .admin-trash-row,
[data-theme="cozy"] .admin-list-row {
  background: var(--violet-soft);
  border-color: var(--panel-border);
  border-radius: 8px;
}

[data-theme="cozy"] .admin-field__label,
[data-theme="cozy"] .admin-form h3,
[data-theme="cozy"] .admin-stat__label {
  text-transform: none;
  letter-spacing: 0;
}

/* ============================================================
   Theme picker (js/theme.js): a button, and a panel that slides open
   with Dark / Light tabs and little preview cards. Each card carries
   its own data-theme / data-mode, so it is drawn with that theme's
   colors and fonts. On phones the panel is a bottom sheet.
   ============================================================ */

.theme-picker {
  display: inline-flex;
}

.tp-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.7rem;
  white-space: nowrap;
}

.tp-trigger__dot {
  width: 0.8rem;
  height: 0.8rem;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: linear-gradient(135deg, var(--void) 50%, var(--gold-bright) 50%);
}

.tp-trigger__caret {
  font-size: 0.75em;
  opacity: 0.8;
}

.tp-panel {
  position: fixed;
  z-index: 900;
  width: 19rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 0.6rem;
  background: var(--void);
  color: var(--star);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  font-family: var(--font-heading);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
}

.tp-panel--open {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s;
}

/* Phones: a sheet sliding up from the bottom of the screen. */
.tp-panel--sheet {
  left: 0;
  right: 0;
  top: auto;
  bottom: 0;
  width: auto;
  max-height: 80vh;
  padding: 0.8rem 0.8rem calc(1rem + env(safe-area-inset-bottom));
  border-radius: 16px 16px 0 0;
  opacity: 1;
  transform: translateY(100%);
  transition: transform 0.25s ease, visibility 0s linear 0.25s;
}

.tp-panel--sheet.tp-panel--open {
  transform: none;
  transition: transform 0.25s ease, visibility 0s;
}

.tp-backdrop {
  position: fixed;
  inset: 0;
  z-index: 899;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

.tp-backdrop--on {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s ease, visibility 0s;
}

.tp-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.tp-tab {
  cursor: pointer;
  padding: 0.5rem;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: transparent;
  color: var(--star-dim);
  font: inherit;
  font-size: 0.9rem;
}

.tp-tab--on {
  background: var(--accent-tint);
  color: var(--gold-bright);
  border-color: var(--gold-bright);
}

.tp-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
  padding: 0.2rem 0.3rem 0.3rem 0.2rem; /* room for glows and hard shadows */
}

/* A theme row: a plain <button> holding a shadow root (js/theme.js) where
   the row is drawn by that theme's own rules — see "Theme rows" below. */
.tp-card {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: inherit;
  font: inherit;
  color: inherit;
}

.tp-card__host {
  display: block;
}

.tp-card:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

/* ---- Theme rows (inside each row's shadow root) --------------------------
   .tp-scope carries the row's data-theme / data-mode, so the theme's own
   variables and its `.btn` rules (font, border, glow, hover, press) apply
   to it — and only its own: in the shadow root the page's theme can't
   reach in. The button always shows the theme's sky (stars, neon, pixel
   grid…) instead of its fill; hovering / pressing keeps that look and only
   adds the theme's own small touch (lift, glow, press…, never its filled
   colors). A new theme gets a row for free; give it a sky below if its page
   has one. */

.tp-scope {
  display: block;
  padding: 0 3px 3px 0; /* Kyne's hard shadow / press shift */
  font-size: 16px;
  line-height: 1.2;
}

.tp-scope .btn.tp-row {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 2.6rem;
  padding: 0.5rem 1rem;
  overflow: hidden;
  box-sizing: border-box;
}

.tp-scope .btn.tp-row:is(*, :hover, :active) {
  background: var(--tp-sky, radial-gradient(ellipse at 50% -40%, var(--violet-soft) 0%, var(--void) 80%));
  color: var(--star);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

/* Without a border of its own, the resting row gets a thin one so it reads
   as a button on the panel. */
.tp-scope .btn.tp-row::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid var(--panel-border);
  border-radius: inherit;
  pointer-events: none;
}

.tp-row__name {
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The current theme. */
.tp-scope[data-current] .tp-row__name::after {
  content: ' ✓';
}

/* The sky: stars by default (themes whose page has stars). Like the page's
   star canvas (js/stars.js) they twinkle and slowly fall: each layer is a
   48px-tall tile that scrolls down and repeats, the two layers at different
   speeds. */
.tp-row__sky {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  --tp-star: rgba(237, 227, 245, 0.95);
  background-image:
    radial-gradient(1.2px 1.2px at 8% 30%, var(--tp-star) 98%, transparent),
    radial-gradient(1px 1px at 19% 72%, var(--tp-star) 98%, transparent),
    radial-gradient(1.5px 1.5px at 31% 18%, var(--tp-star) 98%, transparent),
    radial-gradient(1px 1px at 44% 80%, var(--tp-star) 98%, transparent),
    radial-gradient(1.2px 1.2px at 57% 35%, var(--tp-star) 98%, transparent),
    radial-gradient(1px 1px at 68% 65%, var(--tp-star) 98%, transparent),
    radial-gradient(1.5px 1.5px at 79% 22%, var(--tp-star) 98%, transparent),
    radial-gradient(1px 1px at 91% 70%, var(--tp-star) 98%, transparent);
  background-size: 100% 48px;
  animation:
    tp-fall 9s linear infinite,
    tp-twinkle 3.2s ease-in-out infinite alternate;
  transition: opacity 0.2s ease;
}

.tp-row__sky::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 13% 55%, var(--tp-star) 98%, transparent),
    radial-gradient(1.3px 1.3px at 25% 40%, var(--tp-star) 98%, transparent),
    radial-gradient(1px 1px at 38% 62%, var(--tp-star) 98%, transparent),
    radial-gradient(1.3px 1.3px at 62% 15%, var(--tp-star) 98%, transparent),
    radial-gradient(1px 1px at 85% 45%, var(--tp-star) 98%, transparent),
    radial-gradient(1px 1px at 96% 25%, var(--tp-star) 98%, transparent);
  background-size: 100% 48px;
  animation:
    tp-fall 15s linear -4s infinite,
    tp-twinkle 2.4s ease-in-out -1.2s infinite alternate;
}

@keyframes tp-fall {
  from { background-position: 0 0; }
  to   { background-position: 0 48px; }
}

@keyframes tp-twinkle {
  from { opacity: 0.25; }
  to   { opacity: 1; }
}

/* Hover: the frame lights up in the theme's accent (the theme's own
   button rules add their lift / glow on top). */
.tp-scope .btn.tp-row::after {
  transition: border-color 0.2s ease;
}

.tp-scope .btn.tp-row:hover::after {
  border-color: var(--gold-bright);
}

/* Light versions: dark dust instead of white stars (like the page). */
.tp-scope[data-mode="light"] .tp-row__sky {
  --tp-star: rgba(70, 45, 110, 0.5);
}

/* Each theme's page sky. */
.tp-scope[data-theme="cozy"] {
  --tp-sky: radial-gradient(ellipse at 50% -40%, var(--violet-soft) 0%, var(--void) 80%);
}

.tp-scope[data-theme="loydiie"] {
  --tp-sky:
    radial-gradient(ellipse at 10% 0%, rgba(176, 38, 255, 0.45) 0%, transparent 55%),
    radial-gradient(ellipse at 90% 20%, rgba(0, 229, 255, 0.4) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 120%, rgba(255, 46, 196, 0.4) 0%, transparent 60%),
    var(--void);
}

/* Loydiie: the name glows neon too. */
.tp-scope[data-theme="loydiie"] .tp-row__name {
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.85), 0 0 14px rgba(255, 46, 196, 0.6);
}

.tp-scope[data-theme="loydiie"][data-mode="light"] .tp-row__name {
  text-shadow: 0 0 6px rgba(0, 170, 220, 0.6), 0 0 12px rgba(220, 30, 170, 0.35);
}

/* Kyne: no stars, its faint LCD pixel grid instead. */
.tp-scope[data-theme="kyne"] {
  --tp-sky: var(--void);
}

.tp-scope[data-theme="kyne"] .tp-row__sky {
  background-image:
    linear-gradient(var(--kyne-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--kyne-grid) 1px, transparent 1px);
  background-size: 4px 4px;
  animation: none;
}

.tp-scope[data-theme="kyne"] .tp-row__sky::before,
.tp-scope[data-theme="kyne"] .btn.tp-row::after,
.tp-scope[data-theme="liri"] .btn.tp-row::after,
.tp-scope[data-theme="liri"] .tp-row__sky {
  display: none;
}

/* Kyne moves in whole frames, never slides. */
.tp-scope[data-theme="kyne"] .btn.tp-row:is(*, :hover, :active),
.tp-scope[data-theme="kyne"] .btn.tp-row::after {
  transition: none;
}

/* Kyne: the ▶ menu cursor points at the hovered row (like its note cards);
   pressing drops the button into its shadow (its own rule). */
.tp-scope[data-theme="kyne"] .tp-row:hover .tp-row__name::before {
  content: '▶ ';
  color: var(--gold-bright);
}

/* Liri: a flat menu screen; hovered, the entry turns orange. */
.tp-scope[data-theme="liri"] {
  --tp-sky: var(--void);
}

.tp-scope[data-theme="liri"] .tp-row:hover .tp-row__name {
  color: var(--gold-bright);
}

/* Cozy's own button doesn't move: a soft lift here. */
.tp-scope[data-theme="cozy"] .btn.tp-row:hover {
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  .tp-row__sky,
  .tp-row__sky::before {
    animation: none;
  }

  .tp-panel,
  .tp-panel--open,
  .tp-backdrop,
  .tp-card {
    transition: none;
  }
}

/* ============================================================
   Light mode — shared fixes. The base rules above were written for
   dark screens (see-through dark fills); in light mode those spots use
   the theme's light colors. Each theme's own light tweaks are at the
   end of the file.
   ============================================================ */

.theme-select optgroup {
  background: var(--void);
  color: var(--star-dim);
  font-style: normal;
}

[data-mode="light"] .panel,
[data-mode="light"] .auth-card,
[data-mode="light"] .admin-modal {
  background: var(--panel);
}

[data-mode="light"] input,
[data-mode="light"] textarea,
[data-mode="light"] .note-card,
[data-mode="light"] .theme-select {
  background: var(--violet-soft);
}

[data-mode="light"] .topbar__title,
[data-mode="light"] .auth-title {
  background-image: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 100%);
}

[data-mode="light"] .btn:hover,
[data-mode="light"] .btn--danger:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
}

[data-mode="light"] .chip,
[data-mode="light"] .auth-tab {
  border-color: var(--panel-border);
}

[data-mode="light"] .note-card:hover {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

[data-mode="light"] .note-card--active {
  box-shadow: 0 0 0 2px var(--accent-tint), 0 4px 14px rgba(0, 0, 0, 0.1);
}

[data-mode="light"] .swatch {
  border-color: rgba(0, 0, 0, 0.25);
}

[data-mode="light"] .toast {
  background: var(--violet-soft);
  color: var(--star);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
}

[data-mode="light"] .toast--error {
  color: var(--danger);
}

[data-mode="light"] .editor__content-preview code,
[data-mode="light"] .checklist__item,
[data-mode="light"] .checklist__column-editor,
[data-mode="light"] .checklist__add-input,
[data-mode="light"] .sheet__bar,
[data-mode="light"] .sheet__scroll,
[data-mode="light"] .admin-stat,
[data-mode="light"] .admin-trash-row,
[data-mode="light"] .admin-list-row {
  background: var(--violet);
}

[data-mode="light"] .admin-overlay {
  background: rgba(20, 10, 30, 0.35);
}

/* ============================================================
   Cozy theme overrides (the default) — calm and readable: solid
   rounded cards, no corner brackets or glow, normal-case text.
   Built from the old Kyne layout (see _archive/kyne-theme/).
   ============================================================ */

[data-theme="cozy"] body {
  background: radial-gradient(ellipse at top, #2c1f44 0%, var(--void) 65%) fixed, var(--void);
}

/* The site name keeps Hirui's lettering (font + gold gradient), like the sigil. */
[data-theme="cozy"] .topbar__title,
[data-theme="cozy"] .auth-title,
[data-theme="cozy"] .tools-title {
  font-family: 'Cinzel Decorative', Georgia, serif;
}

[data-theme="cozy"] .topbar__clock,
[data-theme="cozy"] .save-status {
  font-family: var(--font-mono);
}

[data-theme="cozy"] .divider {
  display: none;
}

[data-theme="cozy"] .layout {
  margin-top: 1rem;
}

[data-theme="cozy"] .panel,
[data-theme="cozy"] .auth-card {
  background: var(--panel);
  backdrop-filter: none;
  border-radius: 12px;
}

[data-theme="cozy"] .panel::before,
[data-theme="cozy"] .panel::after,
[data-theme="cozy"] .auth-card::before,
[data-theme="cozy"] .auth-card::after {
  content: none;
}

[data-theme="cozy"] input,
[data-theme="cozy"] textarea {
  background: var(--violet-soft);
  color: var(--star);
}

[data-theme="cozy"] .btn {
  background: var(--gold-bright);
  border-radius: 8px;
  box-shadow: none;
}

[data-theme="cozy"] .btn:hover {
  background: var(--gold);
  transform: none;
  box-shadow: none;
}

[data-theme="cozy"] .btn--ghost {
  background: transparent;
  color: var(--star);
  border-color: var(--panel-border);
}

[data-theme="cozy"] .btn--ghost:hover {
  background: var(--violet-soft);
}

[data-theme="cozy"] .btn--danger {
  color: var(--danger);
  border-color: var(--danger);
}

[data-theme="cozy"] .chip {
  border-color: var(--panel-border);
  border-radius: 8px;
}

[data-theme="cozy"] .note-card {
  background: var(--panel);
  box-shadow: var(--shadow);
  border-radius: 8px;
}

[data-theme="cozy"] .note-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(230, 200, 102, 0.16);
}

[data-theme="cozy"] .note-card--active {
  box-shadow: 0 0 0 2px rgba(230, 200, 102, 0.35);
}

[data-theme="cozy"] .note-card__pin {
  color: var(--violet-accent);
}

[data-theme="cozy"] .swatch {
  border-color: rgba(244, 238, 250, 0.15);
}

[data-theme="cozy"] .auth-tab {
  border-color: var(--panel-border);
}

[data-theme="cozy"] .toast {
  background: var(--violet-soft);
  color: var(--star);
  box-shadow: var(--shadow);
}

[data-theme="cozy"] .toast--error {
  color: var(--danger);
}

[data-theme="cozy"] .toast--info {
  color: var(--gold);
}

[data-theme="cozy"] .topbar__clock,
[data-theme="cozy"] .topbar__user,
[data-theme="cozy"] .btn,
[data-theme="cozy"] .chip,
[data-theme="cozy"] .note-card__title,
[data-theme="cozy"] .note-card__meta,
[data-theme="cozy"] .editor__empty,
[data-theme="cozy"] .save-status,
[data-theme="cozy"] .auth-tab,
[data-theme="cozy"] .auth-subtitle,
[data-theme="cozy"] .theme-select {
  text-transform: none;
  letter-spacing: 0;
}

[data-theme="cozy"] .theme-select {
  border-radius: 8px;
}

/* Normal-case labels read small at the all-caps sizes: a bit bigger. */
[data-theme="cozy"] .btn {
  font-size: 0.85rem;
  font-weight: 600;
}

[data-theme="cozy"] .theme-select {
  font-size: 0.85rem;
}

/* ============================================================
   Loydiie theme overrides — rainbow neon look: near-black glass
   panels, glowing multicolor borders and text, a pulsing ring
   sigil. Electric counterpoint to Hirui's gothic dark and the calm
   Cozy default.
   ============================================================ */

[data-theme="loydiie"] body {
  background:
    radial-gradient(ellipse at 15% 0%, rgba(176, 38, 255, 0.25) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 15%, rgba(0, 229, 255, 0.2) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 100%, rgba(255, 46, 196, 0.18) 0%, transparent 55%),
    var(--void);
}

@keyframes loydiie-rainbow-shift {
  to { background-position: 300% center; }
}

[data-theme="loydiie"] .topbar__title,
[data-theme="loydiie"] .topbar__title span,
[data-theme="loydiie"] .auth-title {
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, #00e5ff, #b026ff, #ff2ec4, #fff01f, #39ff14, #00e5ff);
  background-size: 300% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: loydiie-rainbow-shift 7s linear infinite;
}

[data-theme="loydiie"] .topbar__title span {
  animation-delay: -3.5s;
}

@media (prefers-reduced-motion: reduce) {
  [data-theme="loydiie"] .topbar__title,
  [data-theme="loydiie"] .topbar__title span,
  [data-theme="loydiie"] .auth-title {
    animation: none;
  }
}

[data-theme="loydiie"] .topbar__clock,
[data-theme="loydiie"] .save-status {
  font-family: var(--font-mono);
}

[data-theme="loydiie"] .divider {
  display: none;
}

[data-theme="loydiie"] .layout {
  margin-top: 1rem;
}

[data-theme="loydiie"] .panel,
[data-theme="loydiie"] .auth-card,
[data-theme="loydiie"] .admin-modal {
  background: var(--panel);
  backdrop-filter: blur(10px);
  border-radius: 14px;
  border-width: 1px;
  box-shadow: var(--shadow);
}

[data-theme="loydiie"] .panel::before,
[data-theme="loydiie"] .panel::after,
[data-theme="loydiie"] .auth-card::before,
[data-theme="loydiie"] .auth-card::after {
  content: none;
}

[data-theme="loydiie"] input,
[data-theme="loydiie"] textarea {
  background: rgba(10, 0, 20, 0.6);
  border-radius: 8px;
  border-color: var(--panel-border);
}

[data-theme="loydiie"] input:focus,
[data-theme="loydiie"] textarea:focus {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 2px var(--accent-tint), 0 0 14px rgba(0, 229, 255, 0.35);
}

[data-theme="loydiie"] .btn {
  background: linear-gradient(135deg, var(--gold-bright), var(--violet-accent) 50%, var(--gold));
  border-radius: 8px;
  color: var(--on-accent);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.3), 0 0 10px rgba(255, 46, 196, 0.2);
}

[data-theme="loydiie"] .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.55), 0 0 20px rgba(255, 46, 196, 0.4);
}

[data-theme="loydiie"] .btn--ghost {
  background: transparent;
  color: var(--gold-bright);
  border-color: var(--gold-bright);
  box-shadow: none;
}

[data-theme="loydiie"] .btn--ghost:hover {
  background: var(--accent-tint);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.4);
}

[data-theme="loydiie"] .btn--danger {
  color: var(--danger);
  border-color: var(--danger);
}

[data-theme="loydiie"] .btn--danger:hover {
  box-shadow: 0 0 12px rgba(255, 56, 96, 0.5);
}

[data-theme="loydiie"] .chip {
  border-radius: 999px;
  border-color: var(--panel-border);
  color: var(--gold-bright);
}

[data-theme="loydiie"] .chip--active {
  background: var(--accent-tint);
  color: var(--gold-bright);
  border-color: var(--gold-bright);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}

[data-theme="loydiie"] .note-card {
  background: var(--panel);
  border-radius: 10px;
  border-left-width: 3px;
  box-shadow: none;
}

[data-theme="loydiie"] .note-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 16px currentColor;
}

[data-theme="loydiie"] .note-card--active {
  box-shadow: 0 0 0 1px var(--gold-bright), 0 0 16px rgba(0, 229, 255, 0.45);
}

[data-theme="loydiie"] .note-card--gold    { color: var(--gold-bright); }
[data-theme="loydiie"] .note-card--violet  { color: var(--violet-accent); }
[data-theme="loydiie"] .note-card--magenta { color: var(--magenta-accent); }
[data-theme="loydiie"] .note-card--rose    { color: var(--rose-accent); }
[data-theme="loydiie"] .note-card--star    { color: #39ff14; border-left-color: #39ff14; }

[data-theme="loydiie"] .note-card__pin {
  color: var(--rose-accent);
}

[data-theme="loydiie"] .swatch {
  border-color: rgba(243, 240, 255, 0.25);
}

[data-theme="loydiie"] .swatch--star { background: #39ff14; }

[data-theme="loydiie"] .swatch--active {
  box-shadow: 0 0 0 2px var(--void), 0 0 10px currentColor;
}

[data-theme="loydiie"] .auth-tab {
  border-color: var(--panel-border);
  border-radius: 8px;
}

[data-theme="loydiie"] .auth-tab--active {
  background: var(--accent-tint);
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.35);
}

[data-theme="loydiie"] .theme-select {
  border-radius: 8px;
}

[data-theme="loydiie"] .toast {
  background: rgba(18, 0, 34, 0.92);
  color: var(--star);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

[data-theme="loydiie"] .toast--error {
  color: #ff8fa8;
  border-color: var(--danger);
  box-shadow: 0 0 12px rgba(255, 56, 96, 0.4);
}

[data-theme="loydiie"] .toast--info {
  color: var(--gold-bright);
  border-color: var(--gold-bright);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
}

[data-theme="loydiie"] .admin-overlay {
  background: rgba(5, 0, 12, 0.7);
}

[data-theme="loydiie"] .admin-modal::before,
[data-theme="loydiie"] .admin-modal::after {
  content: none;
}

[data-theme="loydiie"] .admin-modal__title {
  background: linear-gradient(90deg, #00e5ff, #b026ff, #ff2ec4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

[data-theme="loydiie"] .admin-stat,
[data-theme="loydiie"] .admin-trash-row,
[data-theme="loydiie"] .admin-list-row {
  background: rgba(10, 0, 20, 0.55);
  border-color: var(--panel-border);
  border-radius: 8px;
}

[data-theme="loydiie"] .admin-stat__value {
  color: var(--gold-bright);
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.5);
}

[data-theme="loydiie"] .topbar__clock,
[data-theme="loydiie"] .topbar__user,
[data-theme="loydiie"] .btn,
[data-theme="loydiie"] .chip,
[data-theme="loydiie"] .note-card__title,
[data-theme="loydiie"] .note-card__meta,
[data-theme="loydiie"] .editor__empty,
[data-theme="loydiie"] .save-status,
[data-theme="loydiie"] .auth-tab,
[data-theme="loydiie"] .auth-subtitle,
[data-theme="loydiie"] .theme-select,
[data-theme="loydiie"] .admin-field__label,
[data-theme="loydiie"] .admin-form h3,
[data-theme="loydiie"] .admin-stat__label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ============================================================
   Sven theme overrides — a pink-and-gilt court look. Keeps
   Hirui's structure (sigil corner brackets, divider, serif
   elegance) and repaints it: a rose/gold crest gradient on the
   title, warmer panel and card tints, a gilded glow on hover.
   ============================================================ */

[data-theme="sven"] .topbar__title,
[data-theme="sven"] .auth-title {
  background: linear-gradient(180deg, var(--gold-bright) 0%, var(--rose-accent) 55%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

[data-theme="sven"] .panel,
[data-theme="sven"] .auth-card {
  background: linear-gradient(160deg, rgba(143, 47, 94, 0.32), rgba(42, 14, 28, 0.32));
}

[data-theme="sven"] input,
[data-theme="sven"] textarea {
  background: rgba(30, 8, 20, 0.55);
}

[data-theme="sven"] .note-card {
  background: rgba(30, 8, 20, 0.5);
}

[data-theme="sven"] .btn:hover {
  box-shadow: 0 6px 20px rgba(245, 201, 79, 0.35), 0 0 14px rgba(224, 85, 155, 0.3);
}

/* ============================================================
   Liri theme overrides — the GTA IV pause menu, not a Hirui
   repaint: flat matte black, sharp square edges, no blur, no
   glow, no starfield, no sigil. Orange is the only color that
   ever lights up — everything else is black, white or gray.
   ============================================================ */

[data-theme="liri"] #stars {
  display: none;
}

[data-theme="liri"] body {
  background: var(--void);
}

[data-theme="liri"] .divider {
  display: none;
}

[data-theme="liri"] .layout {
  margin-top: 1.25rem;
}

[data-theme="liri"] .topbar__title,
[data-theme="liri"] .auth-title {
  font-family: var(--font-display);
  letter-spacing: 0.1em;
  background: none;
  -webkit-text-fill-color: initial;
  color: var(--star);
}

[data-theme="liri"] .topbar__title span {
  background: none;
  -webkit-text-fill-color: initial;
  color: var(--gold-bright);
}

[data-theme="liri"] .panel,
[data-theme="liri"] .auth-card {
  background: var(--panel);
  backdrop-filter: none;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

[data-theme="liri"] .panel::before,
[data-theme="liri"] .panel::after,
[data-theme="liri"] .auth-card::before,
[data-theme="liri"] .auth-card::after {
  content: none;
}

[data-theme="liri"] input,
[data-theme="liri"] textarea {
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-bottom: 1px solid var(--panel-border);
  border-radius: 0;
}

[data-theme="liri"] input:focus,
[data-theme="liri"] textarea:focus {
  border-bottom-color: var(--gold-bright);
  box-shadow: none;
}

[data-theme="liri"] .btn {
  background: transparent;
  border: 1px solid var(--star-dim);
  border-radius: 0;
  color: var(--star);
  box-shadow: none;
}

[data-theme="liri"] .btn:hover {
  background: var(--gold-bright);
  border-color: var(--gold-bright);
  color: var(--void);
  transform: none;
  box-shadow: none;
}

[data-theme="liri"] .btn--ghost {
  background: transparent;
  color: var(--star-dim);
  border-color: var(--panel-border);
}

[data-theme="liri"] .btn--danger {
  color: var(--danger);
  border-color: var(--danger);
}

[data-theme="liri"] .btn--danger:hover {
  background: var(--danger);
  color: var(--star);
}

[data-theme="liri"] .chip {
  border-radius: 0;
  border-color: var(--panel-border);
  color: var(--star-dim);
}

[data-theme="liri"] .chip--active {
  background: var(--gold-bright);
  color: var(--void);
  border-color: var(--gold-bright);
}

[data-theme="liri"] .note-card {
  background: rgba(0, 0, 0, 0.35);
  border: none;
  border-bottom: 1px solid var(--panel-border);
  border-left: 3px solid var(--gold);
  border-radius: 0;
}

[data-theme="liri"] .note-card:hover {
  transform: none;
  background: rgba(255, 151, 54, 0.08);
  box-shadow: none;
}

[data-theme="liri"] .note-card--active {
  box-shadow: inset 3px 0 0 var(--gold-bright);
  border-color: var(--panel-border);
}

[data-theme="liri"] .note-card__pin {
  color: var(--gold-bright);
}

[data-theme="liri"] .swatch {
  border-radius: 2px;
  border-color: var(--panel-border);
}

[data-theme="liri"] .swatch--active {
  box-shadow: 0 0 0 2px var(--star);
}

[data-theme="liri"] .auth-tab {
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
}

[data-theme="liri"] .auth-tab--active {
  background: transparent;
  border-bottom-color: var(--gold-bright);
  color: var(--gold-bright);
}

[data-theme="liri"] .theme-select {
  border-radius: 0;
}

[data-theme="liri"] .toast {
  background: var(--void);
  border-radius: 0;
  box-shadow: none;
}

[data-theme="liri"] .admin-overlay {
  background: rgba(0, 0, 0, 0.75);
}

[data-theme="liri"] .admin-modal {
  border-radius: 0;
}

[data-theme="liri"] .admin-modal::before,
[data-theme="liri"] .admin-modal::after {
  content: none;
}

[data-theme="liri"] .admin-list-row,
[data-theme="liri"] .admin-trash-row,
[data-theme="liri"] .admin-stat {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 0;
}


/* Version label (filled by js/version.js from api/version.php). */
.app-version {
  font-family: var(--font-mono, monospace);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--star-dim);
  opacity: 0.7;
  cursor: help;
}
.app-version:empty { display: none; }

/* ============================================================
   Kyne theme overrides — white and blue pixel screens in the style
   of the first handheld monster-RPGs: menu boxes with a thick pixel
   frame and a thin inner line, pixel fonts, a ▶ menu cursor, a
   bobbing ▼ "more text" arrow, and animations that jump between
   2–4 frames (steps) instead of sliding smoothly.
   ============================================================ */

[data-theme="kyne"] body {
  background-color: var(--void);
  /* faint LCD pixel grid */
  background-image:
    linear-gradient(var(--kyne-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--kyne-grid) 1px, transparent 1px);
  background-size: 4px 4px;
}

/* Screen "boots" through the palette, dark to white, like the old
   fade-in between scenes. */
[data-theme="kyne"] body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  /* Hidden by default; only the animation itself shows it, so a browser
     that skips animations never gets stuck on a blank screen. */
  opacity: 0;
  visibility: hidden;
  animation: kyne-boot 0.5s steps(1, end) backwards;
}

@keyframes kyne-boot {
  0%   { background: var(--kyne-boot-1); opacity: 1; visibility: visible; }
  25%  { background: var(--kyne-boot-2); opacity: 1; }
  50%  { background: var(--kyne-boot-3); opacity: 1; }
  75%  { background: var(--kyne-boot-4); opacity: 1; }
  100% { background: var(--kyne-boot-4); opacity: 0; visibility: hidden; }
}

@keyframes kyne-blink {
  0%   { visibility: visible; }
  50%  { visibility: hidden; }
}

@keyframes kyne-hop {
  0%   { transform: translateY(0); }
  50%  { transform: translateY(-4px); }
}

@keyframes kyne-bob {
  0%   { transform: translateY(0); }
  50%  { transform: translateY(3px); }
}

@keyframes kyne-type {
  from { width: 0; }
}

[data-theme="kyne"] ::selection {
  background: var(--gold-bright);
  color: var(--kyne-paper);
}

[data-theme="kyne"] ::-webkit-scrollbar-thumb {
  background: var(--kyne-ink);
  border-radius: 0;
}

[data-theme="kyne"] .kyne-sigil {
  animation: kyne-hop 1.2s steps(1, end) infinite;
}

/* Titles: chunky pixel letters with a hard offset shadow. */
[data-theme="kyne"] .topbar__title,
[data-theme="kyne"] .auth-title,
[data-theme="kyne"] .tools-title {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.3;
  background: none;
  -webkit-text-fill-color: initial;
  color: var(--gold-bright);
  text-shadow: 3px 3px 0 var(--kyne-title-shadow);
}

[data-theme="kyne"] .topbar__title span,
[data-theme="kyne"] .tools-title span {
  background: none;
  -webkit-text-fill-color: initial;
  color: var(--kyne-ink);
}

[data-theme="kyne"] .topbar__title {
  font-size: clamp(1rem, 3.2vw, 1.6rem);
}

[data-theme="kyne"] .auth-title {
  font-size: clamp(1rem, 6vw, 1.45rem);
  margin-bottom: 0.9rem;
}

[data-theme="kyne"] .tools-title {
  font-size: clamp(1rem, 5vw, 1.4rem);
}

[data-theme="kyne"] .topbar__clock,
[data-theme="kyne"] .save-status {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

[data-theme="kyne"] .divider {
  display: none;
}

[data-theme="kyne"] .layout {
  margin-top: 1rem;
}

/* Menu boxes: white, thick navy pixel frame, thin blue inner line. */
[data-theme="kyne"] .panel,
[data-theme="kyne"] .auth-card,
[data-theme="kyne"] .admin-modal {
  background: var(--kyne-paper);
  border: 0;
  border-radius: 0;
  backdrop-filter: none;
  box-shadow: var(--kyne-frame), inset 0 0 0 3px var(--kyne-paper), inset 0 0 0 5px var(--kyne-soft);
}

[data-theme="kyne"] .panel::before,
[data-theme="kyne"] .panel::after,
[data-theme="kyne"] .auth-card::before,
[data-theme="kyne"] .admin-modal::before,
[data-theme="kyne"] .admin-modal::after {
  content: none;
}

/* The blinking-bobbing ▼ at the corner of a text box. */
[data-theme="kyne"] .auth-card::after {
  content: '▼';
  position: absolute;
  right: 14px;
  bottom: 10px;
  width: auto;
  height: auto;
  border: 0;
  opacity: 1;
  font-size: 0.7rem;
  line-height: 1;
  color: var(--kyne-ink);
  animation: kyne-bob 0.8s steps(1, end) infinite;
}

[data-theme="kyne"] .auth-subtitle {
  letter-spacing: 0.04em;
}

[data-theme="kyne"] .kyne-type {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: bottom;
  width: 11ch;
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0;
  color: var(--kyne-ink);
  animation: kyne-type 1.1s steps(11, end) 0.5s both;
}

[data-theme="kyne"] .auth-subtitle:has(.kyne-type) {
  letter-spacing: 0;
}

[data-theme="kyne"] input,
[data-theme="kyne"] textarea,
[data-theme="kyne"] select.tools-select,
[data-theme="kyne"] .tw select {
  background: var(--kyne-paper);
  color: var(--kyne-ink);
  border: 2px solid var(--kyne-ink);
  border-radius: 0;
}

[data-theme="kyne"] input:focus,
[data-theme="kyne"] textarea:focus {
  border-color: var(--gold-bright);
  box-shadow: 3px 3px 0 var(--kyne-soft);
}

[data-theme="kyne"] .editor__title {
  font-family: var(--font-heading);
  font-weight: 600;
}

[data-theme="kyne"] .btn {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  background: var(--gold-bright);
  color: var(--on-accent);
  border: 2px solid var(--kyne-ink);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--kyne-ink);
  transition: none;
}

[data-theme="kyne"] .btn:hover {
  background: var(--kyne-hover-bg);
  color: var(--kyne-hover-fg);
  transform: none;
  box-shadow: 3px 3px 0 var(--kyne-ink);
}

/* Pressed: the button drops into its shadow (2 frames, no slide). */
[data-theme="kyne"] .btn:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

[data-theme="kyne"] .btn--ghost {
  background: var(--kyne-paper);
  color: var(--kyne-ink);
}

[data-theme="kyne"] .btn--ghost:hover {
  background: var(--kyne-tint);
  color: var(--kyne-ink);
}

[data-theme="kyne"] .btn--danger {
  background: var(--kyne-paper);
  color: var(--danger);
  border-color: var(--danger);
  box-shadow: 3px 3px 0 var(--danger);
}

[data-theme="kyne"] .btn--danger:hover {
  background: var(--kyne-danger-tint);
  color: var(--danger);
  box-shadow: 3px 3px 0 var(--danger);
}

[data-theme="kyne"] .chip,
[data-theme="kyne"] .auth-tab {
  border: 2px solid var(--kyne-ink);
  border-radius: 0;
  background: var(--kyne-paper);
  color: var(--kyne-ink);
}

[data-theme="kyne"] .chip--active,
[data-theme="kyne"] .auth-tab--active {
  background: var(--kyne-ink);
  color: var(--kyne-paper);
  border-color: var(--kyne-ink);
}

[data-theme="kyne"] .note-card {
  background: var(--kyne-paper);
  border: 2px solid var(--kyne-ink);
  border-left-width: 6px;
  border-radius: 0;
  transition: none;
}

/* Keep each note's color stripe (the border shorthand above resets it). */
[data-theme="kyne"] .note-card--gold    { border-left-color: var(--gold-bright); }
[data-theme="kyne"] .note-card--violet  { border-left-color: var(--violet-accent); }
[data-theme="kyne"] .note-card--magenta { border-left-color: var(--magenta-accent); }
[data-theme="kyne"] .note-card--rose    { border-left-color: var(--rose-accent); }
[data-theme="kyne"] .note-card--star    { border-left-color: var(--star); }

[data-theme="kyne"] .note-card:hover {
  transform: none;
  box-shadow: 3px 3px 0 var(--kyne-soft);
}

[data-theme="kyne"] .note-card--active {
  background: var(--kyne-tint);
  box-shadow: 3px 3px 0 var(--kyne-ink);
}

/* The ▶ menu cursor: a reserved column before each note title, shown
   (blinking) on the hovered note and steady on the open one. */
[data-theme="kyne"] .note-card__title::before {
  content: '▶';
  display: inline-block;
  width: 1.1em;
  font-size: 0.75em;
  color: var(--gold-bright);
  visibility: hidden;
}

[data-theme="kyne"] .note-card:hover .note-card__title::before {
  visibility: visible;
  animation: kyne-blink 0.8s steps(1, end) infinite;
}

[data-theme="kyne"] .note-card--active .note-card__title::before,
[data-theme="kyne"] .note-card--active:hover .note-card__title::before {
  visibility: visible;
  animation: none;
}

[data-theme="kyne"] .note-card__pin {
  color: var(--gold-bright);
}

[data-theme="kyne"] .swatch {
  border-color: var(--kyne-swatch-border);
}

[data-theme="kyne"] .theme-select {
  border: 2px solid var(--kyne-ink);
  border-radius: 0;
  background: var(--kyne-paper);
  color: var(--kyne-ink);
  font-size: 0.75rem;
  font-weight: 600;
}

[data-theme="kyne"] .theme-select option {
  background: var(--kyne-paper);
  color: var(--kyne-ink);
}

[data-theme="kyne"] .toast {
  background: var(--kyne-paper);
  color: var(--kyne-ink);
  border: 0;
  border-radius: 0;
  box-shadow: var(--kyne-frame);
  transition: opacity 0.24s steps(3, end), transform 0.24s steps(3, end);
}

[data-theme="kyne"] .toast--error {
  color: var(--danger);
}

[data-theme="kyne"] .toast--info {
  color: var(--gold);
}

/* Spots that used a see-through dark fill: light blue instead. */
[data-theme="kyne"] .editor__content-preview code,
[data-theme="kyne"] .checklist__item,
[data-theme="kyne"] .checklist__column-editor,
[data-theme="kyne"] .checklist__add-input,
[data-theme="kyne"] .sheet__bar,
[data-theme="kyne"] .sheet__scroll,
[data-theme="kyne"] .admin-stat,
[data-theme="kyne"] .admin-trash-row,
[data-theme="kyne"] .admin-list-row {
  background: var(--kyne-tint);
  border-radius: 0;
}

[data-theme="kyne"] .editor__content-preview code {
  font-size: 1.15em;
}

[data-theme="kyne"] .editor__content-preview h1,
[data-theme="kyne"] .editor__content-preview h2,
[data-theme="kyne"] .editor__content-preview h3 {
  color: var(--gold-bright);
}

[data-theme="kyne"] .admin-overlay {
  background: var(--kyne-overlay);
}

[data-theme="kyne"] .admin-modal__title {
  font-size: 1rem;
}

[data-theme="kyne"] .admin-stat__value {
  font-size: 1rem;
}

/* Safety net: 2.5 s after load the page script adds .kyne-booted, so
   the start-up fade and typed text can never stay stuck mid-way. */
.kyne-booted[data-theme="kyne"] body::after {
  display: none;
}

.kyne-booted[data-theme="kyne"] .kyne-type {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  [data-theme="kyne"] body::after,
  [data-theme="kyne"] .kyne-sigil,
  [data-theme="kyne"] .auth-card::after,
  [data-theme="kyne"] .kyne-type,
  [data-theme="kyne"] .note-card:hover .note-card__title::before {
    animation: none;
  }
}

/* Kyne: the theme picker as a pixel menu box that opens in 3 steps. */
[data-theme="kyne"] .tp-panel {
  padding: 0.9rem;
  border: 0;
  border-radius: 0;
  background: var(--kyne-paper);
  box-shadow: var(--kyne-frame), inset 0 0 0 3px var(--kyne-paper), inset 0 0 0 5px var(--kyne-soft);
  transition-timing-function: steps(3, end);
}

[data-theme="kyne"] .tp-panel--sheet {
  padding-bottom: calc(1.2rem + env(safe-area-inset-bottom));
}

[data-theme="kyne"] .tp-tab {
  border: 2px solid var(--kyne-ink);
  border-radius: 0;
  color: var(--kyne-ink);
}

[data-theme="kyne"] .tp-tab--on {
  background: var(--kyne-ink);
  color: var(--kyne-paper);
}

/* ============================================================
   Each theme's own light-version tweaks (its rules above that use
   dark colors), plus Kyne's dark version.
   ============================================================ */

/* Cozy light */
[data-theme="cozy"][data-mode="light"] body {
  background: radial-gradient(ellipse at top, #ffffff 0%, var(--void) 65%) fixed, var(--void);
}

[data-theme="cozy"][data-mode="light"] .admin-overlay {
  background: rgba(42, 33, 64, 0.3);
}

[data-theme="cozy"][data-mode="light"] .note-card:hover {
  box-shadow: 0 4px 14px rgba(160, 124, 16, 0.18);
}

[data-theme="cozy"][data-mode="light"] .note-card--active {
  box-shadow: 0 0 0 2px rgba(160, 124, 16, 0.4);
}

/* The shared Hirui sigil in a darker gold, so it shows on the light page. */
[data-theme="cozy"][data-mode="light"] .theme-variant--cozy [stroke] {
  stroke: #a07c10;
  opacity: 1;
}

[data-theme="cozy"][data-mode="light"] .theme-variant--cozy circle[fill] {
  fill: #a07c10;
}

/* Hirui light: purple title over a gold page; "WAVE" turns gold. */
[data-theme="hiru"][data-mode="light"] .panel,
[data-theme="hiru"][data-mode="light"] .auth-card,
[data-theme="hiru"][data-mode="light"] .admin-modal {
  background: linear-gradient(160deg, rgba(255, 249, 230, 0.85), rgba(233, 211, 150, 0.45));
}

[data-theme="hiru"][data-mode="light"] .topbar__title,
[data-theme="hiru"][data-mode="light"] .auth-title {
  background-image: linear-gradient(180deg, #7a3fb0 0%, #5c2a8e 55%, #2d1444 100%);
}

[data-theme="hiru"][data-mode="light"] .topbar__title span {
  background-image: linear-gradient(180deg, #b8901a 0%, #7d5f08 100%);
}

[data-theme="hiru"][data-mode="light"] .theme-variant--hiru [stroke] {
  stroke: #5c2a8e;
  opacity: 1;
}

[data-theme="hiru"][data-mode="light"] .theme-variant--hiru circle[fill] {
  fill: #5c2a8e;
}

/* Loydiie light: deeper neon so it reads on white. */
[data-theme="loydiie"][data-mode="light"] body {
  background:
    radial-gradient(ellipse at 15% 0%, rgba(176, 38, 255, 0.14) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 15%, rgba(0, 200, 255, 0.14) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 100%, rgba(255, 46, 196, 0.12) 0%, transparent 55%),
    var(--void);
}

[data-theme="loydiie"][data-mode="light"] .topbar__title,
[data-theme="loydiie"][data-mode="light"] .topbar__title span,
[data-theme="loydiie"][data-mode="light"] .auth-title {
  background-image: linear-gradient(90deg, #007ea6, #8a1fd6, #c4008f, #c27c00, #1f9e3a, #007ea6);
}

[data-theme="loydiie"][data-mode="light"] input,
[data-theme="loydiie"][data-mode="light"] textarea {
  background: #ffffff;
}

[data-theme="loydiie"][data-mode="light"] .toast {
  background: rgba(255, 255, 255, 0.95);
}

[data-theme="loydiie"][data-mode="light"] .toast--error {
  color: var(--danger);
}

[data-theme="loydiie"][data-mode="light"] .admin-overlay {
  background: rgba(40, 0, 80, 0.3);
}

[data-theme="loydiie"][data-mode="light"] .admin-stat,
[data-theme="loydiie"][data-mode="light"] .admin-trash-row,
[data-theme="loydiie"][data-mode="light"] .admin-list-row {
  background: rgba(255, 255, 255, 0.7);
}

[data-theme="loydiie"][data-mode="light"] .note-card--star {
  color: #1f9e3a;
  border-left-color: #1f9e3a;
}

[data-theme="loydiie"][data-mode="light"] .swatch {
  border-color: rgba(29, 11, 58, 0.25);
}

/* Sven light */
[data-theme="sven"][data-mode="light"] .panel,
[data-theme="sven"][data-mode="light"] .auth-card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.85), rgba(251, 214, 230, 0.6));
}

[data-theme="sven"][data-mode="light"] input,
[data-theme="sven"][data-mode="light"] textarea,
[data-theme="sven"][data-mode="light"] .note-card {
  background: rgba(255, 255, 255, 0.85);
}

[data-theme="sven"][data-mode="light"] .btn:hover {
  box-shadow: 0 6px 20px rgba(168, 120, 10, 0.25), 0 0 14px rgba(194, 48, 122, 0.2);
}

/* Liri light */
[data-theme="liri"][data-mode="light"] input,
[data-theme="liri"][data-mode="light"] textarea,
[data-theme="liri"][data-mode="light"] .note-card {
  background: #ffffff;
}

[data-theme="liri"][data-mode="light"] .admin-overlay {
  background: rgba(0, 0, 0, 0.35);
}

[data-theme="liri"][data-mode="light"] .admin-list-row,
[data-theme="liri"][data-mode="light"] .admin-trash-row,
[data-theme="liri"][data-mode="light"] .admin-stat {
  background: #f2f2f2;
}

/* Kyne dark: the pixel badge in white, #00a2ff and black. */
[data-theme="kyne"][data-mode="dark"] .kyne-sigil .k-o {
  fill: #f8f8f8;
}

[data-theme="kyne"][data-mode="dark"] .kyne-sigil .k-b,
[data-theme="kyne"][data-mode="dark"] .kyne-sigil .k-l,
[data-theme="kyne"][data-mode="dark"] .kyne-sigil .k-d {
  fill: #00a2ff;
}

[data-theme="kyne"][data-mode="dark"] .kyne-sigil .k-w {
  fill: #0b1d3a;
}
