/* ============ 1. Theme tokens ============
   data-ink="dark"  -> the light is bright: Paper panel, dark text.
   data-ink="light" -> the light is dim:    Soot panel, pale text.
   Night mode uses the red channel only, so the page does not spoil dark-adapted eyes.
   Panels are opaque, and warm neutrals leave the light as the only strong color. */
:root {
  --panel: #FBF6EE;
  --ink: #211C16;
  --muted: #5C5348;
  --line: #8A7F70;           /* outlines that identify a control */
  --track: var(--line);      /* the unfilled slider */
  --track-edge: transparent; /* an outline around the slider track */
  --edge: #E4DACA;           /* panel edges and dividers */
  --field: #EFE7DA;
  --field-hover: #E6DBCA;
  --solid: var(--ink);
  --solid-ink: var(--panel);
  --lamp: #FFE4B5;
  --warn: #a14f00;
  /* The dark rooms in the page's illustrations, and the furniture drawn in them */
  --scene: #4D3C31;
  --scene-line: #F4E6D2;
  --scene-fill: #624E40;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* The panel is centered, so it keeps clear of the larger side inset on both sides */
  --safe-side: max(env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  color-scheme: light;
}
:root[data-ink="light"] {
  --panel: #1C1815;
  --ink: #F1E9DD;
  --muted: #BDB2A3;
  --line: #8C8173;
  --edge: #3A332C;
  --field: #2B2521;
  --field-hover: #373029;
  --warn: #f0ad4e;
  --scene: #3B2E26;
  --scene-fill: #4E3F34;
  color-scheme: dark;
}
/* Red leaves little room for contrast, so text has one level. The empty slider track
   can't stand out from the panel and from the filled part by color alone, so it has an outline. */
:root[data-ink="light"][data-night="true"] {
  --panel: #0a0000;
  --ink: #ee0000;
  --muted: #ee0000;
  --line: #bb0000;
  --track: #3a0000;
  --track-edge: var(--line);
  --edge: var(--track);
  --field: #0a0000;
  --field-hover: #140000;
  --warn: var(--ink);
  --scene: #2A0000;
  --scene-line: #e00000;
  --scene-fill: #420000;
  --night-shade: #660000;   /* the lamp logo's shade */
}

/* ============ 2. Base and the light ============ */
html, body { background: #000; }
/* ui-rounded gives Safari a softer face, and other browsers fall back */
body {
  font: 500 15px/1.4 ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
::selection { background: var(--solid); color: var(--solid-ink); }
/* In the base styles so the static pages, which don't load components.css, get it too */
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* The lamp is the first screen of the page. The text below it scrolls into view. */
.stage { position: relative; height: 100vh; height: 100dvh; overflow: hidden; overflow: clip; }
#light { position: absolute; inset: 0; background: #000; }
