/* Wasteland OS — /os/ — the workstation's chrome.
   One stylesheet, two themes:
     · BEIGE BOX (default) — the retro light machine: platinum chrome, hard
       bevels, navy titlebars, a teal desert desktop with an amber horizon.
     · DEAD CHANNEL — the house dark: charcoal ground, amber phosphor.
   Theme is :root[data-os-theme="beige"|"channel"], set pre-paint from prefs.
   The BOOT SCREEN and SCREENSAVER are deliberately theme-independent (a BIOS
   is black; a screensaver is night) — their colours are hardcoded.
   Contrast: every text token clears WCAG AA (>=4.5:1) on the ground it sits
   on, in BOTH themes — the beige faint ink is #4d4b46 (~4.9:1 on the band),
   titlebar whites sit on navy/#6f6b62 (>=4.9:1), desktop labels are white on
   #007171 (~5.4:1). */

:root {
  /* ── BEIGE BOX (default) ─────────────────────────────────────────── */
  --desk: #007171;            /* the teal desert the machine sits on */
  --desk-label: #ffffff;      /* desktop icon labels */
  --face: #d4d0c8;            /* window / chrome face */
  --face-band: #c8c4bb;       /* panels, list rails */
  --face-hi: #e6e2da;         /* hover */
  --ink: #1b1a17;
  --ink-soft: #3e3c37;
  --ink-faint: #4d4b46;
  --rule: #a09c92;
  --rule-bright: #6f6b62;
  --accent: #8b3f00;          /* readable accent + links (amber's daylight form) */
  --accent-deep: #6f3200;
  --glow: #b25000;
  --title-a: #00206b;         /* focused titlebar gradient (navy, the classic) */
  --title-b: #1265c0;
  --title-ink: #ffffff;
  --title-a-idle: #5f5b52;
  --title-b-idle: #6f6b62;
  --title-ink-idle: #ffffff;
  --bev-hi: #ffffff;
  --bev-lo: #8a867c;
  --bev-lo2: #55524a;
  --shadow-win: 5px 5px 0 rgba(0, 0, 0, 0.22);
  --field: #fbfaf7;           /* sunken input wells */
  --sel-bg: #00206b;
  --sel-ink: #ffffff;
  --radius: 0px;              /* retro machines have corners */
  --mono: "Martian Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --serif: "Fraunces", "Iowan Old Style", Palatino, Georgia, Cambria, serif;
  --bar-h: calc(2.75rem + env(safe-area-inset-bottom, 0px));
}
:root[data-os-theme="channel"] {
  /* ── DEAD CHANNEL (the house dark) ───────────────────────────────── */
  --desk: #06070a;
  --desk-label: #e7eaf2;
  --face: #0a0c11;
  --face-band: #11141c;
  --face-hi: #161a24;
  --ink: #e7eaf2;
  --ink-soft: #98a1b4;
  --ink-faint: #7c8698;
  --rule: #20252f;
  --rule-bright: #2e3645;
  --accent: #ffc94a;
  --accent-deep: #e0a52e;
  --glow: #ffc94a;
  --title-a: #161a24;
  --title-b: #11141c;
  --title-ink: #e7eaf2;
  --title-a-idle: #11141c;
  --title-b-idle: #0e1118;
  --title-ink-idle: #98a1b4;
  --bev-hi: rgba(255, 255, 255, 0.08);
  --bev-lo: rgba(0, 0, 0, 0.55);
  --bev-lo2: transparent;
  --shadow-win: 0 24px 60px -24px rgba(0, 0, 0, 0.95);
  --field: #11141c;
  --sel-bg: #2a3040;
  --sel-ink: #e7eaf2;
  --radius: 6px;
}

* { box-sizing: border-box; }
/* several roots (#boot, #taskbar…) set their own display, which would silently
   defeat the hidden attribute — never let that happen */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); text-decoration: underline; text-underline-offset: 0.16em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-deep); }
::selection { background: var(--sel-bg); color: var(--sel-ink); }

/* ── the retro control system: raised buttons, pressed states, sunken fields ──
   Beige gets the classic double bevel; channel keeps its soft dark edges.
   Every control shares: real hover, real :active, visible focus. */
.tbtns button, .wtool button, .wtool a.btn, #startbtn, .taskbtn, #layerchip,
.set select, .set button.tog, .corebtn {
  font-family: var(--mono);
  color: var(--ink);
  background: var(--face);
  border: 1px solid var(--rule-bright);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  box-shadow: inset 1px 1px 0 var(--bev-hi), inset -1px -1px 0 var(--bev-lo), inset -2px -2px 0 var(--bev-lo2);
}
.tbtns button:hover, .wtool button:hover, .wtool a.btn:hover, #startbtn:hover,
.taskbtn:hover, #layerchip:hover, .set button.tog:hover {
  background: var(--face-hi); color: var(--ink);
}
.tbtns button:active, .wtool button:active, .wtool a.btn:active, #startbtn:active,
.taskbtn:active, #layerchip:active, .set button.tog:active, .corebtn:active {
  box-shadow: inset 1px 1px 0 var(--bev-lo2), inset 2px 2px 0 var(--bev-lo), inset -1px -1px 0 var(--bev-hi);
  padding-top: 1px;
}

/* ---------- no-JS fallback ---------- */
.nojs { max-width: 40rem; margin: 8vh auto; padding: 1.4rem 1.6rem; font-family: var(--serif); font-size: 1.05rem; background: var(--face); border: 1px solid var(--rule-bright); box-shadow: var(--shadow-win); }
.nojs h1 { font-family: var(--mono); font-size: 1.2rem; letter-spacing: 0.08em; }
.nojs ul { line-height: 2; }
.nojs .aw-wayout { margin-top: 3rem; font-family: var(--mono); font-size: 0.72rem; color: var(--ink-soft); }

/* ---------- atmosphere ---------- */
/* the canvas MUST carry an explicit CSS size: without it the element renders at
   its device-pixel attribute size — 2-3x the viewport on high-DPI screens, so
   image wallpapers looked zoomed/cropped (the human's report, 2026-07-13) */
#wallpaper { position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%; }
#crt { position: fixed; inset: 0; z-index: 90; pointer-events: none; }
:root[data-os-theme="channel"] #crt {
  background:
    radial-gradient(120% 90% at 50% 8%, transparent 58%, rgba(0, 0, 0, 0.38) 100%),
    repeating-linear-gradient(to bottom, rgba(255,255,255,0.014) 0 1px, transparent 2px 3px);
}
:root[data-os-theme="beige"] #crt, :root:not([data-os-theme]) #crt {
  background:
    radial-gradient(125% 95% at 50% 10%, transparent 62%, rgba(0, 0, 0, 0.14) 100%),
    repeating-linear-gradient(to bottom, rgba(0,0,0,0.02) 0 1px, transparent 2px 3px);
}
body[data-scanlines="off"] #crt { background: radial-gradient(125% 95% at 50% 10%, transparent 62%, rgba(0, 0, 0, 0.14) 100%) !important; }

/* ---------- boot (theme-independent: a BIOS is black) ---------- */
#boot {
  position: fixed; inset: 0; z-index: 200; background: #06070a;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start;
  padding: clamp(1rem, 6vh, 4rem) clamp(1rem, 7vw, 5rem); cursor: pointer;
}
#bootlog {
  margin: 0; font-family: var(--mono); font-size: clamp(11px, 1.5vw, 13.5px);
  line-height: 1.75; color: #98a1b4; white-space: pre-wrap; max-width: 60rem;
}
#bootlog .ok { color: #ffc94a; }
#bootlog .dim { color: #7c8698; }
#bootlog .bright { color: #e7eaf2; }
#bootskip {
  position: fixed; right: 1.2rem; bottom: 1rem; font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase; color: #7c8698;
}
#boot .cursor { display: inline-block; width: 0.55em; height: 1em; background: #ffc94a; vertical-align: text-bottom; animation: aw-blink 1s steps(1) infinite; }
@keyframes aw-blink { 50% { opacity: 0; } }
body.crt-off #boot, body.crt-off #desk, body.crt-off #taskbar { animation: aw-poweroff 0.45s ease-in forwards; }
@keyframes aw-poweroff { to { transform: scaleY(0.004) scaleX(0.6); filter: brightness(3); } }

/* ---------- desktop ---------- */
#desk { position: fixed; inset: 0 0 var(--bar-h) 0; z-index: 1; overflow: hidden; }
#brand {
  position: absolute; right: 1.1rem; bottom: 0.8rem; z-index: 1; pointer-events: none;
  font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--desk-label);
  opacity: 0.85; text-shadow: 0 1px 2px rgba(0,0,0,0.45);
}
#brand span { display: inline; }
#icons {
  position: absolute; inset: 0.9rem auto auto 0.9rem; z-index: 2;
  display: grid; grid-auto-flow: column;
  grid-template-rows: repeat(auto-fill, 5.6rem); grid-auto-columns: 5.4rem;
  gap: 0.45rem; height: calc(100% - 1.8rem);
}
.dicon {
  display: flex; flex-direction: column; align-items: center; gap: 0.42rem;
  width: 5.4rem; padding: 0.55rem 0.2rem 0.45rem; border: 1px dotted transparent; border-radius: var(--radius);
  background: none; color: var(--desk-label); font-family: var(--mono); font-size: 10.5px;
  line-height: 1.25; text-align: center; cursor: pointer; user-select: none; -webkit-user-select: none;
}
.dicon:hover { background: rgba(255, 255, 255, 0.13); border-color: rgba(255, 255, 255, 0.5); }
:root[data-os-theme="channel"] .dicon:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(231, 234, 242, 0.35); }
.dicon svg { width: 30px; height: 30px; display: block; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.35)); }
.dicon .lbl { text-shadow: 0 1px 3px rgba(0,0,0,0.55); word-break: break-word; }
/* over the desert poster the icon column sits on pale sky — give labels the
   classic solid plate (the Win95 move), so white text keeps AA on any image */
body[data-wall="poster"] .dicon .lbl {
  background: rgba(0, 74, 74, 0.88); padding: 0.1rem 0.32rem; border-radius: 2px;
  text-shadow: none; box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
body[data-wall="poster"] #brand { text-shadow: 0 1px 4px rgba(0,0,0,0.65); }

/* ---------- windows ---------- */
#windows { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.win {
  position: absolute; min-width: 260px; min-height: 160px; pointer-events: auto;
  display: flex; flex-direction: column;
  background: var(--face);
  border: 1px solid var(--rule-bright);
  border-radius: var(--radius);
  box-shadow: inset 1px 1px 0 var(--bev-hi), inset -1px -1px 0 var(--bev-lo), var(--shadow-win);
  overflow: hidden;
}
.win.focused { border-color: var(--title-a); }
:root[data-os-theme="channel"] .win.focused { border-color: color-mix(in srgb, var(--accent) 55%, var(--rule-bright)); }
.win.max { border-radius: 0; }
.tbar {
  display: flex; align-items: center; gap: 0.6rem; flex: 0 0 auto;
  margin: 2px 2px 0; padding: 0 0.3rem 0 0.6rem; height: 1.9rem;
  background: linear-gradient(90deg, var(--title-a-idle), var(--title-b-idle));
  border-radius: var(--radius);
  cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none;
}
.win.focused .tbar { background: linear-gradient(90deg, var(--title-a), var(--title-b)); }
.win.max .tbar, body.mobile .tbar { cursor: default; }
.tbar:active { cursor: grabbing; }
.tbar .tglyph { flex: 0 0 auto; display: flex; }
.tbar .tglyph svg { width: 14px; height: 14px; }
.tbar .ttitle {
  flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11px; letter-spacing: 0.07em; font-weight: 600; color: var(--title-ink-idle);
}
.win.focused .tbar .ttitle { color: var(--title-ink); }
.tbar .tbtns { display: flex; gap: 3px; }
.tbar .tbtns button { width: 1.6rem; height: 1.45rem; font-size: 11px; line-height: 1; padding: 0; }
.tbar .tbtns .tclose:hover { background: #b33a3a; color: #ffffff; border-color: #7c2626; }
.wbody { flex: 1 1 auto; position: relative; overflow: auto; background: var(--face); margin: 0 2px 2px; }
.wbody > iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #06070a; }
.win .rsz {
  position: absolute; right: 0; bottom: 0; width: 17px; height: 17px; cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 52%, var(--rule-bright) 52% 60%, transparent 60% 72%, var(--rule-bright) 72% 80%, transparent 80%);
}
.win.max .rsz, body.mobile .rsz { display: none; }
/* while dragging/resizing, don't let iframes eat pointer events */
body.wm-live iframe { pointer-events: none; }

/* app toolbar (browser-style strip under the titlebar) */
.wtool {
  display: flex; align-items: center; gap: 0.45rem; padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--rule); background: var(--face); flex: 0 0 auto;
  font-size: 11px;
}
.wtool .addr {
  flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink-soft); background: var(--field); border: 1px solid var(--rule-bright);
  border-radius: var(--radius); padding: 0.3rem 0.55rem;
  box-shadow: inset 1px 1px 0 var(--bev-lo), inset -1px -1px 0 var(--bev-hi);
}
.wtool button, .wtool a.btn { flex: 0 0 auto; font-size: 10.5px; padding: 0.3rem 0.6rem; }

/* ---------- taskbar ---------- */
#taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--bar-h); z-index: 100;
  display: flex; align-items: stretch; gap: 0.4rem;
  padding: 0.32rem 0.45rem calc(0.32rem + env(safe-area-inset-bottom, 0px));
  background: var(--face);
  border-top: 1px solid var(--bev-hi);
  box-shadow: 0 -1px 0 var(--rule-bright);
}
:root[data-os-theme="channel"] #taskbar {
  background: color-mix(in srgb, var(--face-band) 92%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
#startbtn {
  flex: 0 0 auto; display: flex; align-items: center; padding: 0 0.8rem;
  font-size: 12px; letter-spacing: 0.1em; font-weight: 700; color: var(--ink);
}
#startbtn .sun { color: var(--accent); margin-right: 0.1rem; }
#startbtn[aria-expanded="true"] {
  box-shadow: inset 1px 1px 0 var(--bev-lo2), inset 2px 2px 0 var(--bev-lo), inset -1px -1px 0 var(--bev-hi);
  background: var(--face-hi);
}
#tasks { flex: 1 1 auto; display: flex; gap: 0.3rem; overflow-x: auto; scrollbar-width: none; }
#tasks::-webkit-scrollbar { display: none; }
.taskbtn {
  flex: 0 1 11rem; min-width: 5.5rem; display: flex; align-items: center; gap: 0.4rem;
  padding: 0 0.6rem; font-size: 10.5px; color: var(--ink-soft);
  overflow: hidden; white-space: nowrap;
}
.taskbtn svg { width: 12px; height: 12px; flex: 0 0 auto; }
.taskbtn span { overflow: hidden; text-overflow: ellipsis; }
/* the active window's task button reads PRESSED — the machine's honest tell */
.taskbtn.on {
  color: var(--ink); font-weight: 600; background: var(--face-hi);
  box-shadow: inset 1px 1px 0 var(--bev-lo2), inset 2px 2px 0 var(--bev-lo), inset -1px -1px 0 var(--bev-hi);
}
:root[data-os-theme="channel"] .taskbtn.on { border-color: color-mix(in srgb, var(--accent) 45%, var(--rule-bright)); }
/* minimized: dimmer but still AA (never dim label text below 4.5:1 with opacity) */
.taskbtn.mind { color: var(--ink-faint); border-style: dashed; }
.taskbtn.mind svg { opacity: 0.6; }
#tray { flex: 0 0 auto; display: flex; align-items: center; gap: 0.55rem; padding: 0 0.3rem 0 0.2rem; }
#layerchip { font-size: 10px; letter-spacing: 0.06em; padding: 0.28rem 0.55rem; color: var(--ink-soft); }
#layerchip:hover { color: var(--accent); }
#clock {
  font-size: 11px; color: var(--ink); font-variant-numeric: tabular-nums;
  padding: 0.28rem 0.55rem; border: 1px solid var(--rule-bright); border-radius: var(--radius);
  box-shadow: inset 1px 1px 0 var(--bev-lo), inset -1px -1px 0 var(--bev-hi);
  align-self: center;
}

/* ---------- start menu ---------- */
#startmenu {
  position: fixed; left: 0.45rem; bottom: calc(var(--bar-h) + 0.35rem); z-index: 120;
  width: min(21rem, calc(100vw - 0.9rem)); max-height: min(75vh, 34rem); overflow-y: auto;
  background: var(--face);
  border: 1px solid var(--rule-bright); border-radius: var(--radius);
  box-shadow: inset 1px 1px 0 var(--bev-hi), inset -1px -1px 0 var(--bev-lo), var(--shadow-win);
  padding: 0.6rem;
}
:root[data-os-theme="channel"] #startmenu {
  background: color-mix(in srgb, var(--face) 96%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
#startmenu .sm-h {
  font-size: 9.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-faint);
  padding: 0.55rem 0.5rem 0.3rem; border-bottom: 1px solid var(--rule); margin-bottom: 0.25rem;
}
#startmenu .sm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
#startmenu button.sm-i, #startmenu a.sm-i {
  display: flex; align-items: center; gap: 0.55rem; width: 100%; text-align: left;
  padding: 0.42rem 0.5rem; background: none; border: 1px solid transparent; border-radius: var(--radius);
  color: var(--ink-soft); font-family: var(--mono); font-size: 11.5px; cursor: pointer; text-decoration: none;
}
/* menu items highlight the classic way: a solid selection bar */
#startmenu .sm-i:hover, #startmenu .sm-i:focus-visible { background: var(--sel-bg); color: var(--sel-ink); outline: none; }
#startmenu .sm-i svg { width: 15px; height: 15px; flex: 0 0 auto; }
#startmenu .sm-row { display: flex; gap: 2px; }
#startmenu .sm-row .sm-i { justify-content: center; }

/* ---------- generic app body helpers ---------- */
.pad { padding: 1rem 1.1rem; }
.app-note {
  font-size: 10.5px; color: var(--ink-faint); border-top: 1px solid var(--rule);
  padding: 0.5rem 0.75rem; flex: 0 0 auto; background: var(--face-band); margin: 0 2px 2px;
}

/* ---------- Files ---------- */
.files { display: flex; height: 100%; min-height: 0; }
.files .ftree {
  flex: 0 0 12.5rem; overflow-y: auto; border-right: 1px solid var(--rule);
  background: var(--face-band); padding: 0.5rem 0.35rem;
}
.files .ftree button {
  display: flex; align-items: center; gap: 0.5rem; width: 100%; text-align: left;
  padding: 0.34rem 0.5rem; background: none; border: 1px solid transparent; border-radius: var(--radius);
  color: var(--ink-soft); font-family: var(--mono); font-size: 11px; cursor: pointer;
}
.files .ftree button:hover { color: var(--ink); background: var(--face-hi); }
.files .ftree button.on { color: var(--sel-ink); background: var(--sel-bg); }
.files .ftree button.on .cnt { color: var(--sel-ink); opacity: 0.75; }
.files .ftree .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--seam, var(--ink-faint)); box-shadow: 0 0 4px var(--seam, transparent); flex: 0 0 auto; }
.files .ftree .cnt { margin-left: auto; color: var(--ink-faint); font-size: 9.5px; }
.files .fmain { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.files .fhead { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.7rem; border-bottom: 1px solid var(--rule); flex: 0 0 auto; }
.files .fhead .crumb { font-size: 11px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files .fhead input {
  margin-left: auto; width: min(13rem, 45%); background: var(--field); border: 1px solid var(--rule-bright);
  border-radius: var(--radius); color: var(--ink); font-family: var(--mono); font-size: 11px; padding: 0.32rem 0.55rem;
  box-shadow: inset 1px 1px 0 var(--bev-lo), inset -1px -1px 0 var(--bev-hi);
}
.files .flist { flex: 1 1 auto; overflow-y: auto; padding: 0.35rem 0.45rem; background: var(--field); margin: 0.35rem 0.45rem; border: 1px solid var(--rule); }
:root[data-os-theme="channel"] .files .flist { background: var(--face); }
.frow {
  display: flex; align-items: baseline; gap: 0.65rem; width: 100%; text-align: left;
  padding: 0.4rem 0.55rem; background: none; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--rule) 45%, transparent);
  color: var(--ink-soft); cursor: pointer; font-family: var(--mono);
}
.frow:hover { background: var(--sel-bg); }
.frow:hover .fname, .frow:hover .ford, .frow:hover .fdate { color: var(--sel-ink); }
.frow .ford { font-size: 9.5px; color: var(--ink-faint); flex: 0 0 2.2rem; }
.frow .fdot { width: 7px; height: 7px; border-radius: 50%; background: var(--seam, var(--ink-faint)); flex: 0 0 auto; align-self: center; }
.frow .fname { font-family: var(--serif); font-size: 14.5px; color: var(--ink); flex: 1 1 auto; min-width: 0; }
.frow .fdate { font-size: 9.5px; color: var(--ink-faint); flex: 0 0 auto; }
.files .fstatus { border-top: 1px solid var(--rule); padding: 0.4rem 0.7rem; font-size: 10px; color: var(--ink-faint); flex: 0 0 auto; }

/* ---------- Mail ---------- */
.mail { display: flex; height: 100%; min-height: 0; }
.mail .mlist { flex: 0 0 15rem; overflow-y: auto; border-right: 1px solid var(--rule); background: var(--face-band); }
.mail .mrow {
  display: block; width: 100%; text-align: left; padding: 0.55rem 0.7rem;
  background: none; border: 0; border-bottom: 1px solid var(--rule); cursor: pointer; font-family: var(--mono);
}
.mail .mrow:hover { background: var(--face-hi); }
.mail .mrow.on { background: var(--sel-bg); }
.mail .mrow.on .mfrom, .mail .mrow.on .msub, .mail .mrow.on .mdate { color: var(--sel-ink); }
.mail .mrow .mfrom { font-size: 11.5px; color: var(--ink); display: block; }
.mail .mrow .msub { font-size: 10px; color: var(--ink-soft); display: block; margin-top: 0.15rem; }
.mail .mrow .mdate { font-size: 9px; color: var(--ink-faint); display: block; margin-top: 0.2rem; }
.mail .mread { flex: 1 1 auto; overflow-y: auto; min-width: 0; display: flex; flex-direction: column; background: var(--field); }
:root[data-os-theme="channel"] .mail .mread { background: var(--face); }
.mail .mhead { padding: 0.8rem 1rem 0.6rem; border-bottom: 1px solid var(--rule); }
.mail .mhead .h1 { font-family: var(--serif); font-size: 1.15rem; color: var(--ink); }
.mail .mhead .h2 { font-size: 10.5px; color: var(--ink-faint); margin-top: 0.3rem; }
.mail .mbody { padding: 0.4rem 1rem 1.2rem; }
.mail .qa { margin: 1rem 0; }
.mail .qa .q { font-size: 10.5px; letter-spacing: 0.06em; color: var(--accent); margin-bottom: 0.35rem; }
.mail .qa .a { font-family: var(--serif); font-size: 14.5px; line-height: 1.6; color: var(--ink); white-space: pre-wrap; }

/* ---------- About / README / plain docs ---------- */
.doc { font-family: var(--serif); font-size: 15px; line-height: 1.62; max-width: 38rem; }
.doc h1 { font-family: var(--mono); font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin: 0 0 0.9rem; }
.doc h2 { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-faint); margin: 1.4rem 0 0.4rem; }
.doc p { margin: 0.5rem 0; color: var(--ink-soft); }
.doc b, .doc strong { color: var(--ink); font-weight: 600; }
.doc table { border-collapse: collapse; font-family: var(--mono); font-size: 11px; margin: 0.5rem 0; width: 100%; }
.doc td { border-top: 1px solid var(--rule); padding: 0.38rem 0.6rem 0.38rem 0; color: var(--ink-soft); vertical-align: top; }
.doc td:first-child { color: var(--ink-faint); white-space: nowrap; padding-right: 1.2rem; }
.doc .sdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.45rem; vertical-align: baseline; }
.doc kbd {
  font-family: var(--mono); font-size: 10px; border: 1px solid var(--rule-bright); border-bottom-width: 2px;
  border-radius: 3px; padding: 0.08rem 0.35rem; color: var(--ink); background: var(--face-band);
}

/* ---------- Games folder ---------- */
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: 0.6rem; padding: 0.9rem; }
.gamecard {
  display: flex; flex-direction: column; gap: 0.35rem; text-align: left; padding: 0.75rem 0.8rem;
  background: var(--face); border: 1px solid var(--rule-bright); border-radius: var(--radius); cursor: pointer;
  color: var(--ink-soft); font-family: var(--mono);
  box-shadow: inset 1px 1px 0 var(--bev-hi), inset -1px -1px 0 var(--bev-lo);
}
.gamecard:hover { background: var(--face-hi); }
.gamecard:active { box-shadow: inset 1px 1px 0 var(--bev-lo), inset -1px -1px 0 var(--bev-hi); }
.gamecard .gname { font-family: var(--serif); font-size: 1.05rem; color: var(--ink); }
.gamecard .ghook { font-size: 10.5px; line-height: 1.45; }
.gamecard .gkind { font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); }

/* ---------- Recycle bin ---------- */
.bin .binrow { display: flex; gap: 0.8rem; padding: 0.8rem 0.2rem; border-bottom: 1px solid var(--rule); align-items: flex-start; }
.bin .binrow svg { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 0.15rem; }
.bin .bint { font-family: var(--serif); font-size: 15px; color: var(--ink); }
.bin .binn { font-size: 11px; color: var(--ink-soft); line-height: 1.5; margin-top: 0.2rem; font-family: var(--mono); }

/* ---------- Settings ---------- */
.set .srow { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.6rem 0.2rem; border-bottom: 1px solid var(--rule); font-size: 11.5px; color: var(--ink-soft); }
.set select, .set button.tog { font-size: 11px; padding: 0.32rem 0.6rem; }
.set select { max-width: 60%; }

/* ---------- Core sample (3D) — its own dark stage in both themes (it is a
     depth view; space stays space). Inks hardcoded to the dark set. ---------- */
.core { position: absolute; inset: 0; overflow: hidden; background: radial-gradient(140% 100% at 50% 0%, #0d1017, #06070a 75%); touch-action: none; }
.core .stage { position: absolute; inset: 0; perspective: 640px; perspective-origin: 50% 38%; }
.core .slab {
  /* centred: width is min(30rem,76%), so the margin must be the LESS negative
     of the two halves — max(), not min() (min() clipped slabs off narrow stages) */
  position: absolute; left: 50%; top: 40%; width: min(30rem, 76%); margin-left: max(-15rem, -38%);
  padding: 0.5rem 0.9rem; border: 1px solid color-mix(in srgb, var(--seam, #888) 55%, #2e3645);
  border-radius: 4px; background: color-mix(in srgb, #11141c 88%, var(--seam, transparent));
  transform-style: preserve-3d; will-change: transform, opacity; cursor: pointer;
}
.core .slab .st { font-family: var(--serif); font-size: 15px; color: #e7eaf2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* slab microtext sits on a seam-tinted dark panel — needs the brighter soft ink for AA */
.core .slab .sm { font-size: 9px; color: #98a1b4; letter-spacing: 0.08em; margin-top: 0.12rem; display: flex; gap: 0.6rem; }
.core .slab.cur { box-shadow: 0 0 26px -6px var(--seam, #ffc94a); }
.core .hud {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 0.7rem 1rem 0.8rem; z-index: 3;
  background: linear-gradient(to top, rgba(4,5,8,0.92), transparent);
  display: flex; align-items: flex-end; gap: 1rem; pointer-events: none;
}
.core .hud .cur-t { font-family: var(--serif); font-size: 1.15rem; color: #e7eaf2; }
.core .hud .cur-d { font-size: 10.5px; color: #98a1b4; line-height: 1.45; max-width: 34rem; }
.core .hud .cur-m { font-size: 9.5px; color: #8b95a7; letter-spacing: 0.1em; margin-top: 0.25rem; }
.core .hud .corebtn { pointer-events: auto; }
.corebtn {
  font-size: 10.5px; padding: 0.4rem 0.75rem; flex: 0 0 auto;
  background: #161a24; color: #e7eaf2; border: 1px solid #3a4252; border-radius: 3px;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.08), inset -1px -1px 0 rgba(0,0,0,0.5);
}
.corebtn:hover { background: #1d2230; border-color: #4a5266; }
.core .depth {
  position: absolute; right: 0.9rem; top: 0.8rem; bottom: 3.6rem; width: 3px; border-radius: 2px;
  background: #20252f; z-index: 3;
}
.core .depth i { position: absolute; left: -2px; width: 7px; height: 7px; border-radius: 50%; background: #ffc94a; box-shadow: 0 0 8px #ffc94a; }
.core .chint { position: absolute; top: 0.8rem; left: 1rem; font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: #8b95a7; z-index: 3; }

/* ---------- screensaver (theme-independent: night is night) ---------- */
#saver { position: fixed; inset: 0; z-index: 300; width: 100%; height: 100%; background: #06070a; cursor: none; }

/* ---------- mobile ---------- */
@media (max-width: 720px) {
  #icons { grid-template-rows: repeat(auto-fill, 5.4rem); grid-auto-columns: 25vw; gap: 0.3rem; inset: 0.55rem auto auto 0.55rem; }
  .dicon { width: 25vw; font-size: 10px; }
  #brand span { display: none; }
  .win { border-radius: 0; }
  .files .ftree { flex-basis: 9.5rem; }
  .mail { flex-direction: column; }
  .mail .mlist { flex: 0 0 34%; border-right: 0; border-bottom: 1px solid var(--rule); }
  #startmenu .sm-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  #boot .cursor { animation: none; }
  body.crt-off #boot, body.crt-off #desk, body.crt-off #taskbar { animation: none; opacity: 0; }
}
