/* Voidlight — cozy 16-bit game-menu look.
   Pixel font, chunky notched borders, RPG dialogue panels, pressable buttons,
   block caret. No blur, no gradients, no rounded corners. */

@font-face { font-family: "Press Start 2P"; src: url("/assets/PressStart2P-Regular-3afc38cb.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Pixelify Sans"; src: url("/assets/PixelifySans-5602fc9a.ttf") format("truetype"); font-weight: 400 700; font-display: swap; }

:root {
  --bg: #fde7f0;            /* fallback; the background controller drifts through pastels */
  --ink: #4b2c5e;
  --ink-soft: #8a6a9c;
  --panel: #fffdf7;                        /* menus and panels that float over the page: solid, so nothing ghosts through */
  --panel-page: rgba(255, 253, 247, .4);   /* the writing page: the background color shows through */
  --panel-line: #f3c4dc;    /* inner line of dialogue panels */
  --btn: #ffffff;
  --btn-hover: #fff0fa;
  --field: #ffffff;                        /* text fields and slider tracks */
  --shade: rgba(75, 44, 94, .2);           /* button bevel, bottom edge */
  --shine: rgba(255, 255, 255, .9);        /* button bevel, top edge */
  --scrim: rgba(75, 44, 94, .38);
  --accent-ink: var(--ink);                /* text on top of --accent */
  --accent: #ff8fc2;
  --accent-hover: #ff9fcb;
  --ok: #3fbf7f;
  --warn: #f2a900;
  --bad: #e5484d;
  --px: 4px;                /* the chunky pixel unit for borders */
  --icon-scale: 3;
  --drawer-w: 300px;
  --font-ui: "Press Start 2P", ui-monospace, monospace;
  --font-write: "Pixelify Sans", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { background: var(--bg); } /* body stays transparent so the drifting .background shows through */
html, body {
  margin: 0; height: 100dvh; color: var(--ink);
  font-family: var(--font-write); font-size: 20px;
  -webkit-font-smoothing: none; font-smooth: never; -webkit-tap-highlight-color: transparent;
}
img, canvas { image-rendering: pixelated; }
::selection { background: var(--accent); color: var(--accent-ink); }
a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
a:hover { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: var(--px) solid var(--accent); outline-offset: var(--px); }

/* ── Pixel icons ─────────────────────────────────────────────── */
.pixel-icon {
  width: calc(var(--w) * var(--icon-scale) * 1px); height: calc(var(--h) * var(--icon-scale) * 1px);
  flex: none; display: inline-block; vertical-align: middle;
}

/* ── Panels: RPG dialogue boxes ──────────────────────────────── */
/* Notched border = four single-axis shadows, which leaves the corners empty. */
.panel {
  position: relative; background: var(--panel); color: var(--ink);
  box-shadow: 0 calc(var(--px) * -1) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink),
              calc(var(--px) * -1) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink);
}
.panel::after { /* inner accent line */
  content: ""; position: absolute; inset: 6px; pointer-events: none;
  box-shadow: 0 -2px 0 0 var(--panel-line), 0 2px 0 0 var(--panel-line),
              -2px 0 0 0 var(--panel-line), 2px 0 0 0 var(--panel-line);
}

/* ── Buttons: pressable ──────────────────────────────────────── */
.pixel-btn, input[type=submit] {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 44px; min-width: 44px; padding: 0 16px; margin: var(--px);
  font: 10px/1 var(--font-ui); letter-spacing: 0; text-transform: none;
  color: var(--ink); background: var(--btn); border: 0; border-radius: 0; cursor: pointer;
  box-shadow: 0 calc(var(--px) * -1) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink),
              calc(var(--px) * -1) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink),
              inset 0 calc(var(--px) * -1) 0 0 var(--shade),
              inset 0 var(--px) 0 0 var(--shine);
}
.pixel-btn:hover, input[type=submit]:hover { background: var(--btn-hover); }
.pixel-btn:active, input[type=submit]:active {
  transform: translateY(var(--px));
  box-shadow: 0 calc(var(--px) * -1) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink),
              calc(var(--px) * -1) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink),
              inset 0 var(--px) 0 0 var(--shade);
}
.pixel-btn-small { padding: 0 8px; }
form.button_to { margin: 0; display: inline-flex; }

/* ── Layout ──────────────────────────────────────────────────── */
.stage {
  display: flex; flex-direction: column; height: 100dvh; position: relative; overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.chrome { position: relative; z-index: 14; /* above the scrim, so the header can still close the menu */ display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; }
.chrome-actions { display: flex; align-items: center; gap: 8px; } /* timer, sounds, sign out: grouped on the right */
.brand {
  position: absolute; left: 50%; transform: translateX(-50%); /* the exact center of the header, at any width */
  display: inline-flex; align-items: center; gap: 12px; font: 20px/1 var(--font-ui); pointer-events: none;
}
.brand .pixel-icon { --icon-scale: 3; }
.brand-text { display: none; }
@media (max-width: 479px) { .brand { display: none; } } /* four header buttons leave no room for the logo */
@media (min-width: 560px) { .brand-text { display: inline; } }
@media (max-width: 519px) {
  .brand .pixel-icon { --icon-scale: 2; }
  .chrome-actions { gap: 0; }
  .chrome-actions .pixel-btn { padding: 0; } /* icon-only squares, so the group stays narrow */
  .chrome-actions .timer-btn:has(.timer-badge:not(:empty)) { padding: 0 12px; }
  /* While the timer shows its countdown there is no room left for the logo. */
  .chrome:has(.timer-badge:not(:empty)) .brand { display: none; }
}

.editor-slot, turbo-frame#editor { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* The writing panel */
.editor {
  background: var(--panel-page);
  flex: 1; display: flex; flex-direction: column; min-height: 0;
  width: calc(100% - 24px); max-width: 760px; margin: 8px auto 16px; padding: 12px 16px 8px;
}
.editor > * { position: relative; z-index: 1; } /* keep content above the ::after line */
.editor-title, .editor-foot {
  background-repeat: repeat-x; background-image: linear-gradient(90deg, var(--ink-soft) 4px, transparent 4px); background-size: 8px 2px;
}
.editor-title {
  font: 600 28px/1.2 var(--font-write); color: var(--ink); background-color: transparent; border: 0; outline: 0;
  padding: 4px 0 12px; width: 100%; background-position: bottom;
}
.editor-body-wrap { position: relative; flex: 1; min-height: 0; display: flex; }
.editor-body {
  position: relative; flex: 1; min-height: 0; width: 100%; padding: 12px 0; overflow-y: auto; outline: 0;
  white-space: pre-wrap; overflow-wrap: break-word; cursor: text;
  font: 400 20px/1.6 var(--font-write); color: var(--ink);
  caret-color: var(--ink); caret-shape: block; /* blinking block caret where supported */
}
.editor-body .line { min-height: 1.6em; }
/* "# Title" lines render as headings, larger than the body text. */
.editor-body .line.h1 { font-size: 25px; line-height: 1.25; font-weight: 700; margin: .5em 0 .15em; }
.editor-body .line.h2 { font-size: 23px; line-height: 1.3; font-weight: 700; margin: .45em 0 .1em; }
.editor-body .line.h3 { font-size: 21px; line-height: 1.35; font-weight: 600; margin: .4em 0 .1em; }
.editor-body .line:first-child { margin-top: 0; }
.editor-body .mark { display: none; } /* the "# " disappears unless the caret is on that line */
.custom-caret .editor-body { caret-color: transparent; } /* caret_controller draws a block instead */
.block-caret { position: absolute; pointer-events: none; background: var(--ink); opacity: .7; animation: caret-blink 1.1s steps(1) infinite; }
.block-caret[hidden] { display: none; }
@keyframes caret-blink { 0%, 55% { opacity: .7; } 56%, 100% { opacity: 0; } }
.editor-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 8px;
  font: 10px/1.4 var(--font-ui); background-position: top;
}
.word-count { color: var(--ink-soft); }
.save-status::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; background: var(--ok); }
.save-status[data-state="saving"]::before, .save-status[data-state="error"]::before { animation: blink 1s steps(2) infinite; }
.save-status[data-state="saving"]::before { background: var(--warn); }
.save-status[data-state="unsaved"]::before { background: var(--ink-soft); }
.save-status[data-state="error"]::before { background: var(--bad); }
.save-status[data-state="error"] { color: var(--bad); }
@keyframes blink { 50% { opacity: 0; } }

/* ── Drawer: the RPG menu ────────────────────────────────────── */
.drawer {
  position: absolute; z-index: 13; top: calc(env(safe-area-inset-top) + 76px); bottom: 16px; left: 12px; width: min(80vw, var(--drawer-w));
  padding: 20px 16px 16px; overflow-y: auto;
  transform: translateX(calc(-100% - 24px)); transition: transform .15s steps(4);
}
.drawer-open .drawer { transform: none; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; padding-bottom: 5.6px; /* puts the line level with the one under the writing-area title */
  border-bottom: 2px solid color-mix(in srgb, var(--ink-soft) 40%, transparent); /* light divider under the header */
}
.drawer-head h2 { margin: 0 0 0 13px; font: 400 14px/1 var(--font-ui); color: color-mix(in srgb, var(--ink) 60%, var(--ink-soft)); } /* a quieter label than the project names, but still readable */
.drawer-pin { min-height: 26px; min-width: 26px; padding: 0 4px; margin: 4px; }
.drawer-pin .pixel-icon { --icon-scale: 2; }
.drawer-pin[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* Wide screens: a kept-open menu docks beside the writing area and pushes it over. */
.editor-slot { transition: margin-left .15s steps(4); }
@media (min-width: 900px) {
  .drawer-pinned .drawer { transform: none; background: var(--panel-page); } /* docked beside the page: same color and see-through as the writing area, in every theme */
  .drawer-pinned .editor-slot { margin-left: calc(var(--drawer-w) + 12px); }
  .drawer-pinned .editor { margin-left: max(12px, calc((100% - 760px) * .3)); margin-right: auto; } /* sits closer to the rail than centered */
  .ui-hidden.drawer-pinned .drawer { opacity: 1; pointer-events: auto; } /* it stays while you write */
}
/* Small screens: no docking; an open menu dims the page and blocks it until closed. */
@media (max-width: 899px) { .drawer-pin { display: none; } }
.scrim { display: none; position: absolute; inset: 0; z-index: 12; background: var(--scrim); }
@media (max-width: 899px) {
  .drawer-open .scrim { display: block; }
}
.drawer ul { list-style: none; margin: 0 0 16px; padding: 0; position: relative; z-index: 1; }
.drawer > * { position: relative; z-index: 1; }
.drawer a {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px; text-decoration: none; font-size: 16px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.drawer a::before { /* stepped pixel pointer */
  content: ""; flex: none; width: 9px; height: 15px; background: var(--ink); visibility: hidden;
  clip-path: polygon(0 0, 3px 0, 3px 3px, 6px 3px, 6px 6px, 9px 6px, 9px 9px, 6px 9px, 6px 12px, 3px 12px, 3px 15px, 0 15px);
}
.drawer a:hover, .drawer a:focus-visible { background: var(--panel-line); }
.drawer a:hover::before, .drawer a:focus-visible::before, .drawer a.active::before { visibility: visible; }
.drawer a.active { font-weight: 700; }
.drawer a.active::before { animation: blink 1.2s steps(2) infinite; }



/* Projects with collapsible heading outlines */
.drawer ul.projects { margin-bottom: 16px; }
.drawer > form { margin-left: 12px; } /* the button's notched border sticks out 4px, so nudge it in line with the pointers */
.project-row { display: flex; align-items: center; }
.project-row .project-link { flex: 1; min-width: 0; }
.twisty { flex: none; width: 36px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.twisty .pixel-icon { --icon-scale: 2; transition: transform .1s steps(2); }
/* the chevron bitmap points right: down when collapsed, up when expanded */
.project.collapsed .twisty .pixel-icon { transform: rotate(90deg); }
.project:not(.collapsed) .twisty .pixel-icon { transform: rotate(-90deg); }
.project:not(.has-outline) .twisty { visibility: hidden; }
.project.collapsed .outline { display: none; }
.drawer ul.outline { margin: 0 0 8px; padding: 0; }
.outline a { min-height: 36px; padding: 4px 8px 4px 32px; font-size: 14px; color: var(--ink-soft); }
.outline a::before { display: none; }
.outline a[data-level="2"] { padding-left: 48px; }
.outline a[data-level="3"] { padding-left: 64px; }
.outline a:hover, .outline a:focus-visible { color: var(--ink); }


/* ── Timer ───────────────────────────────────────────────────── */
.timer {
  position: absolute; z-index: 13; top: calc(env(safe-area-inset-top) + 72px); right: 12px; width: min(86vw, 340px);
  padding: 18px 18px 16px; transform: translateX(calc(100% + 24px)); transition: transform .15s steps(4);
}
.timer-open .timer { transform: none; }
.timer > * { position: relative; z-index: 1; }
.timer h2 { margin: 0 0 12px; font: 12px/1.5 var(--font-ui); }
.timer-readout { margin: 8px 0; text-align: center; font: 28px/1.3 var(--font-ui); letter-spacing: 0; }
[data-timer="running"] .timer-readout { color: var(--ink); }
[data-timer="paused"] .timer-readout { color: var(--ink-soft); animation: blink 1.2s steps(2) infinite; }
.timer-done { margin: 0 0 8px; text-align: center; font: 10px/1.6 var(--font-ui); color: var(--ok); }
.timer-done[hidden] { display: none; }
.timer-controls { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.timer-start { background: var(--accent); color: var(--accent-ink); }
.timer-presets { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-bottom: 8px; }
.timer-presets .pixel-btn { min-width: 52px; }
.timer-presets .pixel-btn[aria-pressed="true"] { background: var(--panel-line); }
.timer-custom { display: flex; align-items: center; justify-content: center; gap: 8px; }
.timer-custom label { font: 10px/1 var(--font-ui); }
.timer-custom input {
  width: 84px; min-height: 44px; margin: 4px; padding: 6px 8px; border: 0; border-radius: 0; outline: 0; background: var(--field);
  font: 400 20px/1.2 var(--font-write); color: var(--ink); caret-shape: block;
  box-shadow: 0 calc(var(--px) * -1) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink), calc(var(--px) * -1) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink);
}
.timer-custom input::placeholder { font-family: var(--font-write); color: var(--ink-soft); opacity: 1; }
.timer-custom input:focus { box-shadow: 0 calc(var(--px) * -1) 0 0 var(--accent), 0 var(--px) 0 0 var(--accent), calc(var(--px) * -1) 0 0 0 var(--accent), var(--px) 0 0 0 var(--accent); }
.timer-btn { gap: 8px; }
.timer-badge { font: 10px/1 var(--font-ui); }
.timer-badge:empty { display: none; }
[data-timer="done"] .timer-badge { animation: blink 1s steps(2) infinite; }

/* ── Theme picker ────────────────────────────────────────────── */
.themes {
  position: absolute; z-index: 13; top: calc(env(safe-area-inset-top) + 72px); right: 12px; width: min(86vw, 300px); padding: 20px 16px 16px;
  transform: translateX(calc(100% + 24px)); transition: transform .15s steps(4);
}
.theme-open .themes { transform: none; }
.themes > * { position: relative; z-index: 1; }
.themes h2 { margin: 0 0 8px; font: 12px/1.5 var(--font-ui); }
.themes h3 { margin: 12px 0 4px 4px; font: 10px/1.5 var(--font-ui); color: var(--ink-soft); }
.themes { max-height: calc(100dvh - env(safe-area-inset-top) - 92px); overflow-y: auto; }
.themes [role=group] { display: flex; flex-direction: column; align-items: stretch; }
.theme-choice { justify-content: flex-start; font-size: 10px; }
.theme-choice[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.swatch { flex: none; width: 20px; height: 20px; box-shadow: 0 0 0 2px var(--ink); }
.swatch-rainbow { background: linear-gradient(90deg, #ffd6e8 0 25%, #fff3c4 0 50%, #cdf5e0 0 75%, #cfe3fc 0); }
.swatch-light { background: #f2f1ed; }
.swatch-dark { background: #1a1722; }
.swatch-image { background: repeating-conic-gradient(#2a2438 0 25%, #4b3f6b 0 50%) 0 0 / 8px 8px; } /* a small pixel checker; the real GIFs are too big to load for swatches */

/* ── Sound mixer ─────────────────────────────────────────────── */
.mixer {
  position: absolute; z-index: 13; top: calc(env(safe-area-inset-top) + 72px); right: 12px; width: min(86vw, 340px);
  padding: 18px 18px 14px; transform: translateX(calc(100% + 24px)); transition: transform .15s steps(4);
}
.mixer-open .mixer { transform: none; }
.mixer > * { position: relative; z-index: 1; }
.mixer h2 { margin: 0 0 12px; font: 12px/1.5 var(--font-ui); }
.mixer ul { list-style: none; margin: 14px 0 0; padding: 0; }
.mixer li { display: grid; grid-template-columns: 4.5em 1fr 2.2em; align-items: center; gap: 10px; min-height: 48px; }
.mixer label { font: 10px/1.4 var(--font-ui); }
.mixer output { font: 10px/1 var(--font-ui); text-align: right; color: var(--ink-soft); }

/* Master mute / header speaker: show the right icon for the state. */
.icon-mute { display: none; }
[data-muted="true"] .icon-sound { display: none; }
[data-muted="true"] .icon-mute { display: inline-block; }

/* Pixel range slider: notched track that fills as you slide, square thumb. */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 36px; margin: 0; background: transparent; cursor: pointer; --fill: 0%; }
input[type=range]:focus-visible { outline: var(--px) solid var(--accent); outline-offset: 0; }
input[type=range]::-webkit-slider-runnable-track {
  height: 12px; border: 0; background: linear-gradient(90deg, var(--accent) var(--fill), var(--field) var(--fill));
  box-shadow: 0 calc(var(--px) * -1) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink), calc(var(--px) * -1) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink);
}
input[type=range]::-moz-range-track {
  height: 12px; border: 0; background: linear-gradient(90deg, var(--accent) var(--fill), var(--field) var(--fill));
  box-shadow: 0 calc(var(--px) * -1) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink), calc(var(--px) * -1) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 28px; margin-top: -8px; border: 0; border-radius: 0; background: var(--ink);
  box-shadow: inset 0 0 0 4px var(--field), inset 0 0 0 8px var(--ink);
}
input[type=range]::-moz-range-thumb {
  width: 16px; height: 28px; border: 0; border-radius: 0; background: var(--ink);
  box-shadow: inset 0 0 0 4px var(--field), inset 0 0 0 8px var(--ink);
}

/* ── Hide-while-writing ──────────────────────────────────────── */
[data-ui] { transition: opacity .4s steps(4); }
.ui-hidden [data-ui] { opacity: 0; pointer-events: none; }
/* While writing, the page's box (border, fill, inner line) fades away too, leaving just the words. */
.editor { transition: background-color .4s steps(4), box-shadow .4s steps(4); }
.editor::after { transition: opacity .4s steps(4); }
.ui-hidden .editor { background-color: transparent; box-shadow: 0 0 0 0 transparent; }
.ui-hidden .editor::after { opacity: 0; }
.reveal { position: absolute; left: 0; right: 0; height: 56px; z-index: 12; display: none; }
.reveal-top { top: 0; }
.reveal-bottom { bottom: 0; }
.ui-hidden .reveal { display: block; }

/* ── Background ──────────────────────────────────────────────── */
.background { position: fixed; inset: 0; z-index: -1; background-color: var(--bg); }

/* ── Themes (rainbow is the default: the drifting pastels set inline by background_controller) ── */
html[data-theme="light"] {
  --bg: #f2f1ed; --ink: #34322f; --ink-soft: #6f6c67;
  --panel: #fcfcfa; --panel-page: rgba(252, 252, 250, .6); --panel-line: #dcdad3;
  --btn: #ffffff; --btn-hover: #f3f2ee; --accent: #dccb9f; --accent-hover: #e5d6ae;
  --shade: rgba(52, 50, 47, .18); --scrim: rgba(52, 50, 47, .35);
}
html[data-theme="dark"], html[data-theme^="pixel_"] {
  color-scheme: dark;
  --ink: #efe9fb; --ink-soft: #b4aac9;
  --accent: #6b52c8; --accent-hover: #7a62d8; --accent-ink: #ffffff;
  --shine: rgba(255, 255, 255, .12); --scrim: rgba(8, 6, 12, .65);
  --ok: #5fd99a; --warn: #f5c04a; --bad: #ff7a80;
}
html[data-theme="dark"] {
  --bg: #1a1722;
  --panel: #252131; --panel-page: rgba(37, 33, 49, .6); --panel-line: #433c5a;
  --btn: #2f2a41; --btn-hover: #3b3552; --field: #141119;
  --shade: rgba(0, 0, 0, .4);
}
/* Pixel Jeff: dark, see-through UI over the picture. */
html[data-theme^="pixel_"] {
  --bg: #1a1722;
  --panel: rgba(26, 22, 36, .88); --panel-page: rgba(26, 22, 36, .78); --panel-line: rgba(239, 233, 251, .28);
  --btn: rgba(47, 42, 65, .92); --btn-hover: rgba(66, 59, 90, .95); --field: rgba(14, 11, 20, .85);
  --shade: rgba(0, 0, 0, .4);
}
html[data-theme="pixel_jeff"] { --bg-image: url("/theme-images/pixel_jeff"); }
html[data-theme="pixel_city"] { --bg-image: url("/theme-images/pixel_city"); }
html[data-theme="pixel_souls"] { --bg-image: url("/theme-images/pixel_souls"); }
html[data-theme="pixel_spaceship"] { --bg-image: url("/theme-images/pixel_spaceship"); }
html[data-theme="pixel_study"] { --bg-image: url("/theme-images/pixel_study"); }
html[data-theme="pixel_train"] { --bg-image: url("/theme-images/pixel_train"); }
html[data-theme^="pixel_"] .background {
  background: var(--bg-image) center / cover no-repeat; image-rendering: pixelated;
}
html[data-theme^="pixel_"] .background::after { /* dark wash over the whole picture: the words stay readable when the UI fades away */
  content: ""; position: absolute; inset: 0; background: rgba(14, 11, 20, .74);
}

/* ── Flash messages ──────────────────────────────────────────── */
.flash {
  position: fixed; z-index: 30; bottom: calc(env(safe-area-inset-bottom) + 28px); left: 50%; transform: translateX(-50%);
  max-width: calc(100vw - 48px); padding: 14px 18px; font: 10px/1.6 var(--font-ui); pointer-events: none;
  animation: flash-out .4s steps(4) 3.5s forwards;
}
.flash-alert { color: var(--bad); }
@keyframes flash-out { to { opacity: 0; visibility: hidden; } }

/* ── Auth pages ──────────────────────────────────────────────── */
.auth { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 32px 20px; }
.auth-brand { display: flex; align-items: center; gap: 14px; margin: 0; font: 16px/1 var(--font-ui); }
.auth-panel { width: min(100%, 420px); padding: 24px 22px 20px; }
.auth-panel > * { position: relative; z-index: 1; }
.auth-panel h2 { margin: 0 0 16px; font: 12px/1.5 var(--font-ui); }
.auth-panel p { margin: 10px 0; }
.auth-panel label { font: 10px/1.6 var(--font-ui); }
.auth-panel em { font-size: 16px; color: var(--ink-soft); }
.auth-panel input[type=email], .auth-panel input[type=password], .auth-panel input[type=text] {
  width: calc(100% - 8px); min-height: 48px; margin: 4px; padding: 8px 12px; border: 0; border-radius: 0; outline: 0;
  font: 400 20px/1.2 var(--font-write); color: var(--ink); background: var(--field); caret-color: var(--ink); caret-shape: block;
  box-shadow: 0 calc(var(--px) * -1) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink),
              calc(var(--px) * -1) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink),
              inset 0 var(--px) 0 0 var(--shade);
}
.auth-panel input:focus {
  box-shadow: 0 calc(var(--px) * -1) 0 0 var(--accent), 0 var(--px) 0 0 var(--accent),
              calc(var(--px) * -1) 0 0 0 var(--accent), var(--px) 0 0 0 var(--accent),
              inset 0 var(--px) 0 0 var(--shade);
}
.auth-panel .field:has(input[type=checkbox]) { display: flex; align-items: center; gap: 12px; margin: 14px 0 0; }
.auth-panel .field:has(input[type=checkbox]) p { margin: 0; }
.auth-panel input[type=checkbox] {
  appearance: none; width: 24px; height: 24px; margin: 4px; background: var(--field); cursor: pointer; display: block;
  box-shadow: 0 calc(var(--px) * -1) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink),
              calc(var(--px) * -1) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink);
}
.auth-panel input[type=checkbox]:checked { background: var(--ink); box-shadow: inherit; border: 6px solid var(--field); }
.auth-panel input[type=checkbox]:checked { box-shadow: 0 calc(var(--px) * -1) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink), calc(var(--px) * -1) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink); }
.auth-panel .actions { margin-top: 20px; }
.auth-panel input[type=submit] { width: calc(100% - 8px); min-height: 52px; background: var(--accent); color: var(--accent-ink); }
.auth-panel input[type=submit]:hover { background: var(--accent-hover); }
.auth-panel #error_explanation { color: var(--bad); margin-bottom: 12px; }
.auth-panel #error_explanation h2 { color: var(--bad); }
.auth-panel #error_explanation ul { margin: 0; padding-left: 20px; }

@media (prefers-reduced-motion: reduce) {
  .save-status::before, .drawer a.active::before, .block-caret, .timer-badge, .timer-readout { animation: none; }
  .drawer, .mixer, .timer, .themes { transition: none; }
}

/* The logo floats straight over the image, so give it a plate to stay readable. */
html[data-theme^="pixel_"] .brand { background: var(--panel); padding: 8px 14px; box-shadow: 0 -4px 0 0 var(--ink), 0 4px 0 0 var(--ink), -4px 0 0 0 var(--ink), 4px 0 0 0 var(--ink); }
