@font-face { font-family: "Plex Mono"; src: url("assets/fonts/ibm-plex-mono-regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Inter Tight"; src: url("assets/fonts/inter-tight-regular.woff2") format("woff2"); font-display: swap; }

:root {
  --ink: #000; --paper: #fff;
  --g1: #ececec; /* quiet surfaces */
  --g2: #b8b8b8; /* inactive chrome, disabled borders */
  --g3: #616161; /* secondary text, 6:1 on white */
  --bar: 32px; --task: 40px;
  --mono: "Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --icon-ink: var(--ink); --icon-fill: var(--paper);
  --checker: conic-gradient(#fff 25%, transparent 0 50%, #fff 0 75%, transparent 0) 0 0 / 2px 2px;
  /* one spot colour on top of the one-bit palette. Only ever a fill under ink text, or a mark on black:
     lime on white text is about 1.3:1. Preferences › Accent swaps it. */
  --acc: #c6f432; --acc-dk: #7a9a12; --acc-lt: #ecffb3;
  color-scheme: light;
  scrollbar-color: var(--ink) var(--g1);
}
[data-accent="teal"] { --acc: #3fe0c5; --acc-dk: #178574; --acc-lt: #c6fff5; }
[data-accent="ember"] { --acc: #ff7a3d; --acc-dk: #a8431a; --acc-lt: #ffd3bd; }
[data-accent="mono"] { --acc: #fff; --acc-dk: #9a9a9a; --acc-lt: #fff; }
::selection { background: var(--acc); color: var(--ink); }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  display: grid; grid-template-rows: var(--bar) 1fr var(--task);
  background: var(--ink); color: var(--ink);
  font: 1rem/1.5 var(--sans); font-synthesis: none;
  overflow: hidden; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ico { display: inline-flex; line-height: 0; flex: none; }
.px { display: block; }
.px-ink { fill: var(--icon-ink); }
.px-fill { fill: var(--icon-fill); }

/* ---------- system bar ---------- */
.sysbar {
  display: flex; align-items: center; gap: 4px; padding: 0 10px;
  background: var(--paper); border-bottom: 1px solid var(--ink);
  font: 0.875rem/1 var(--mono); position: relative; z-index: 1000;
  box-shadow: 0 2px 0 var(--acc);
}
.brand { margin: 0 8px 0 0; line-height: 0; }
.brand img { height: 20px; width: auto; }
.menus { display: flex; }
.menu-btn { height: calc(var(--bar) - 1px); padding: 0 10px; background: none; border: 0; }
.menu-btn:hover { background: var(--ink); color: var(--paper); }
.sys-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.sys-status { background: none; border: 0; padding: 3px 6px; font-size: 0.8125rem; display: flex; align-items: center; gap: 6px; }
.sys-status::before { content: ""; width: 8px; height: 8px; background: var(--acc); outline: 1px solid var(--ink); }
.sys-status:hover { text-decoration: underline; }
.sys-status:not([data-state="saved"]) { background: var(--ink); color: var(--paper); }
.sys-status:not([data-state="saved"])::before { background: var(--paper); }
#clock { font-variant-numeric: tabular-nums; }

.menu {
  position: fixed; inset: auto; margin: 0; padding: 4px; min-width: 210px;
  background: var(--paper); color: var(--ink); border: 1px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  font: 0.875rem/1 var(--mono);
}
.menu:popover-open { display: flex; flex-direction: column; }
.menu button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: none; border: 0; text-align: left; }
.menu button:hover, .menu button:focus-visible { background: var(--acc); color: var(--ink); outline: 1px solid var(--ink); outline-offset: -1px; --icon-fill: var(--acc-lt); }
.menu hr { border: 0; border-top: 1px dotted var(--ink); margin: 4px 0; width: 100%; }

/* ---------- desktop ---------- */
#desk { position: relative; overflow: hidden; --icon-ink: var(--paper); --icon-fill: var(--ink); }
#wallpaper { position: absolute; inset: 0; z-index: 0; background-color: var(--ink); }
#wallpaper[data-kind="grain"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6' shape-rendering='crispEdges'%3E%3Crect width='1' height='1' fill='%23333'/%3E%3Crect x='3' y='3' width='1' height='1' fill='%231d1d1d'/%3E%3C/svg%3E");
}
#wallpaper .sky { display: block; image-rendering: pixelated; }
#wallpaper:not([data-kind="sky"]) .sky { display: none; }
#wallpaper[data-kind="image"] { background-position: center; background-repeat: no-repeat; background-size: cover; image-rendering: pixelated; }
#wallpaper[data-kind="image"][data-fit="tile"] { background-repeat: repeat; background-position: 0 0; background-size: var(--tile); }

#icons {
  position: absolute; z-index: 1; top: 12px; bottom: 12px; left: 8px;
  margin: 0; padding: 0; list-style: none; pointer-events: none;
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(auto-fill, 88px); grid-auto-columns: 108px; gap: 2px 4px;
}
#icons > li { pointer-events: auto; }
.icon {
  width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 2px 4px; background: none; border: 0; color: var(--paper); font: 0.8125rem/1.25 var(--mono); cursor: default;
}
.icon .ico {
  width: 46px; height: 46px; display: grid; place-items: center; background: var(--acc); border: 1px solid var(--ink);
  box-shadow: inset 2px 2px 0 var(--acc-lt), inset -2px -2px 0 var(--acc-dk), 3px 3px 0 var(--ink), 0 0 0 1px var(--paper);
  --icon-ink: var(--ink); --icon-fill: var(--paper); transition: transform 90ms steps(2), box-shadow 90ms steps(2);
}
.icon[data-kind="obj"] .ico { background: var(--paper); box-shadow: inset -2px -2px 0 var(--g2), 3px 3px 0 var(--ink), 0 0 0 1px var(--paper); }
.icon:hover .ico { transform: translate(-1px, -1px); box-shadow: inset 2px 2px 0 var(--acc-lt), inset -2px -2px 0 var(--acc-dk), 4px 4px 0 var(--ink), 0 0 0 1px var(--paper); }
.icon[data-kind="obj"]:hover .ico { box-shadow: inset -2px -2px 0 var(--g2), 4px 4px 0 var(--ink), 0 0 0 1px var(--paper); }
.icon:active .ico { transform: translate(2px, 2px); box-shadow: inset 2px 2px 0 var(--acc-dk), 0 0 0 1px var(--paper); }
.icon-label { padding: 1px 5px; background: var(--ink); text-align: center; max-width: 104px; overflow-wrap: break-word; outline: 1px solid var(--ink); }
.icon[aria-pressed="true"] .ico { outline: 2px dotted var(--acc); outline-offset: 3px; }
.icon[aria-pressed="true"] .icon-label { background: var(--acc); color: var(--ink); }
.icon:focus-visible { outline: none; }
.icon:focus-visible .icon-label { outline: 2px solid var(--paper); outline-offset: 1px; }

/* ---------- windows ---------- */
.win {
  position: absolute; display: flex; flex-direction: column; min-width: 0;
  outline: 1px solid var(--ink); box-shadow: 0 0 0 2px var(--paper);
  --icon-ink: var(--ink); --icon-fill: var(--paper);
}
/* one-bit drop shadow: a 50% checker that grows while the window is carried */
.win::after { content: ""; position: absolute; z-index: -1; inset: 6px -8px -8px 6px; background: var(--checker); pointer-events: none; }
.win:not(.is-active)::after { inset: 4px -5px -5px 4px; opacity: 0.6; }
.win.is-dragging::after { inset: 12px -14px -14px 12px; }
.win.is-dragging { cursor: grabbing; }
.win.is-max { outline: 0; box-shadow: none; }
.win.is-max::after, .win.is-max .win-rz, .win.is-max .win-grip { display: none; }
.win.is-opening { animation: win-in 160ms steps(4); }
@keyframes win-in { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 -20px 0); } }
[data-motion="reduced"] .win.is-opening { animation: none; }

.win-bar {
  flex: none; display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 8px;
  background: var(--g1); color: var(--g3); border-bottom: 1px solid var(--ink);
  user-select: none; -webkit-user-select: none; touch-action: none; cursor: default;
  --icon-ink: var(--g3); --icon-fill: var(--g1);
}
.win.is-active .win-bar { background: var(--ink); color: var(--paper); --icon-ink: var(--paper); --icon-fill: var(--ink); }
.win-handle {
  flex: 1; min-width: 0; height: 100%; padding: 0 4px; text-align: left; background: none; border: 0; cursor: inherit;
  font: 0.875rem/1 var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 10px;
}
/* pinstripes fill the rest of the active title bar */
.win.is-active .win-handle::after { content: ""; flex: 1; min-width: 12px; height: 11px; margin-right: 6px; background: repeating-linear-gradient(var(--acc) 0 1px, transparent 1px 2px); opacity: 0.85; }
.win-bar > .ico { padding: 2px; }
.win.is-active .win-bar > .ico { background: var(--acc); --icon-ink: var(--ink); --icon-fill: var(--acc-lt); }
.win-handle:focus-visible { outline-offset: -4px; }
.win.is-active .win-bar :focus-visible { outline-color: var(--paper); }
.win-ctrls { display: flex; gap: 4px; }
.win-btn { width: 24px; height: 20px; display: grid; place-items: center; padding: 0; background: none; color: inherit; border: 1px solid currentColor; }
.win-btn:hover { background: var(--ink); color: var(--paper); }
.win.is-active .win-btn:hover { background: var(--acc); color: var(--ink); border-color: var(--acc); }
.win-btn:active { transform: translate(1px, 1px); }
.win-body { flex: 1; min-height: 0; overflow: auto; background: var(--paper); position: relative; container-type: inline-size; }
.win-loading, .win-error { padding: 16px 18px; margin: 0; font: 0.875rem var(--mono); }

.win-rz { position: absolute; z-index: 2; touch-action: none; }
.rz-e { top: 10px; bottom: 10px; right: -6px; width: 12px; cursor: ew-resize; }
.rz-w { top: 30px; bottom: 10px; left: -6px; width: 12px; cursor: ew-resize; }
.rz-s { left: 10px; right: 10px; bottom: -6px; height: 12px; cursor: ns-resize; }
.rz-se { right: -8px; bottom: -8px; width: 20px; height: 20px; cursor: nwse-resize; }
.rz-sw { left: -8px; bottom: -8px; width: 20px; height: 20px; cursor: nesw-resize; }
.win-grip {
  position: absolute; z-index: 3; right: 1px; bottom: 1px; width: 15px; height: 15px; padding: 0; border: 0; cursor: nwse-resize; touch-action: none;
  background: repeating-linear-gradient(135deg, transparent 0 2px, var(--ink) 2px 3px);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
.win-grip:focus-visible { clip-path: none; outline-offset: 0; }

/* ---------- taskbar ---------- */
.taskbar { display: flex; align-items: center; gap: 6px; padding: 0 6px; background: var(--paper); border-top: 1px solid var(--ink); overflow-x: auto; position: relative; z-index: 1000; }
#tasks { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.task {
  display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; max-width: 200px;
  font: 0.8125rem/1 var(--mono); white-space: nowrap; background: var(--paper); border: 1px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
}
.task:active { transform: translate(2px, 2px); box-shadow: none; }
.task[aria-current] { background: var(--ink); color: var(--paper); --icon-ink: var(--paper); --icon-fill: var(--ink); box-shadow: inset 0 -3px 0 var(--acc); transform: translate(2px, 2px); }
.taskbar { box-shadow: 0 -2px 0 var(--acc); }
.task.is-min { border-style: dotted; color: var(--g3); box-shadow: none; --icon-ink: var(--g3); }
.task-label { overflow: hidden; text-overflow: ellipsis; }

/* ---------- shared content ---------- */
h2 { font: 1.25rem/1.2 var(--mono); margin: 0 0 6px; letter-spacing: -0.01em; }
h3 { font: 1rem/1.3 var(--mono); margin: 0 0 4px; }
p { margin: 0 0 12px; max-width: 64ch; }
.display { font-size: 1.75rem; line-height: 1.1; margin-bottom: 10px; }
.lede { font-size: 1.0625rem; margin-bottom: 12px; }
.meta { font-size: 0.875rem; color: var(--g3); }
.app-head { margin-bottom: 10px; }
.app-head h2::before { content: ""; display: inline-block; width: 0.55em; height: 0.55em; margin-right: 0.45em; background: var(--acc); outline: 1px solid var(--ink); vertical-align: 0.05em; }
.win-body a[href]:hover { background: var(--acc); color: var(--ink); }
.app-head .lede { margin: 0; }
.flag { border: 1px dashed var(--ink); padding: 8px 10px 8px 16px; font-size: 0.9375rem; box-shadow: inset 6px 0 0 var(--acc); }
.warn { margin: 0; font-size: 0.9375rem; flex-basis: 100%; }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.btn {
  font: 0.875rem/1.1 var(--mono); padding: 7px 12px; background: var(--paper); color: var(--ink);
  border: 1px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); border-radius: 0; text-decoration: none;
}
.btn:hover { background: var(--g1); }
.btn:active { transform: translate(2px, 2px); box-shadow: none; }
.btn.primary { background: var(--acc); color: var(--ink); }
.btn.primary:hover { background: var(--acc-lt); }
.btn.danger { background: var(--ink); color: var(--paper); }
.btn.danger:hover { background: #2a2a2a; }
.btn.danger { box-shadow: 2px 2px 0 var(--g3); }
.btn:disabled { color: var(--g3); border-color: var(--g2); box-shadow: none; background: var(--paper); cursor: default; transform: none; }
.btn.chip { box-shadow: none; border-style: dotted; }
input:not([type]), input[type="search"], select, textarea {
  border: 1px solid var(--ink); border-radius: 0; padding: 6px 8px; background: var(--paper); font: 1rem/1.3 var(--sans);
}
input[type="range"] { accent-color: var(--ink); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--acc); }
[data-accent="mono"] :is(input[type="checkbox"], input[type="radio"]) { accent-color: var(--ink); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; margin: 0; }
input:disabled { opacity: 0.4; }

/* read me */
.readme { padding: 24px 26px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin: 18px 0 14px; padding-top: 14px; border-top: 1px dotted var(--ink); }
.facts dt { font: 0.9375rem/1.5 var(--mono); }
.facts dd { margin: 0; }

/* luci */
.luci { display: flex; flex-direction: column; height: 100%; padding: 14px 16px 0; }
.luci .pane { flex: 1; min-height: 0; overflow: auto; }
.luci .app-head { margin-bottom: 8px; }
.brief { border: 1px solid var(--ink); padding: 12px 14px; margin: 12px 0 16px; }
.brief p { margin-bottom: 4px; }
.brief .btn-row { margin-bottom: 0; }
.tabs { display: flex; overflow-x: auto; scrollbar-width: none; }
.tab { font: 0.875rem/1 var(--mono); padding: 9px 12px; background: var(--paper); border: 1px solid var(--ink); border-bottom: 0; margin-right: -1px; }
.tab[aria-selected="true"] { background: var(--ink); color: var(--paper); box-shadow: inset 0 -4px 0 var(--acc); }
.tab:not([aria-selected="true"]):hover { background: var(--acc-lt); }
.tab-panel { border: 1px solid var(--ink); padding: 12px 14px 4px; margin-bottom: 12px; }
.tab-panel:focus-visible { outline-offset: -4px; }
.phase-line { font-size: 1.0625rem; }
.tasks { list-style: none; margin: 0; padding: 0; }
.tasks details { border-top: 1px dotted var(--ink); padding: 8px 0; }
.tasks summary { font: 0.9375rem/1.4 var(--mono); cursor: pointer; }
.out-label { font: 0.75rem/1 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--g3); margin: 10px 0 4px; }

/* tabbed panes in the Luci and Glasses windows */
.pane { border: 1px solid var(--ink); padding: 14px 16px; }
.pane:focus-visible { outline-offset: -4px; }

/* glasses */
.glasses { display: flex; flex-direction: column; height: 100%; padding: 14px 16px 0; }
.glasses .app-head { margin-bottom: 8px; }
.glasses .pane { flex: 1; min-height: 0; overflow: auto; }
.glasses .pane-search { display: flex; flex-direction: column; }
.glasses-search { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.gl-view { margin-left: auto; }
.gl-agent { flex: 1; min-height: 0; overflow: auto; }
.gl-agent .agent-view { min-height: 100%; }
.gl-results { position: relative; }
/* the glasses coming into focus: a dither veil that lifts in three steps */
.gl-results.is-focusing::after { content: ""; position: absolute; inset: 0; background: var(--checker); pointer-events: none; animation: focus-in 420ms steps(3) forwards; }
@keyframes focus-in { to { opacity: 0; } }
[data-motion="reduced"] .gl-results.is-focusing::after { display: none; }
.gl-form { display: flex; gap: 8px; }
.gl-form input { flex: 1; min-width: 0; }
.gl-tools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; }
.gl-status { margin: 0; font-size: 0.875rem; }
.gl-links { display: flex; align-items: center; gap: 12px; font-size: 0.875rem; }
.gl-links .btn { padding: 4px 8px; box-shadow: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.gl-split { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 1.3fr); gap: 14px; }
.gl-results { list-style: none; margin: 0; padding: 0; overflow: auto; border: 1px solid var(--ink); }
.gl-results:empty { display: none; }
.gl-row { display: grid; gap: 2px; width: 100%; text-align: left; padding: 8px 10px; background: var(--paper); border: 0; border-bottom: 1px dotted var(--ink); }
.gl-row:hover { background: var(--g1); }
.gl-row[aria-pressed="true"] { background: var(--ink); color: var(--paper); box-shadow: inset 4px 0 0 var(--acc); }
.gl-name { font: 0.875rem/1.3 var(--mono); overflow-wrap: anywhere; }
.gl-desc { font-size: 0.875rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gl-meta { font: 0.75rem/1.3 var(--mono); color: var(--g3); }
.gl-row[aria-pressed="true"] .gl-meta { color: var(--g2); }
.gl-detail { overflow: auto; min-width: 0; }
.gl-detail h3 { overflow-wrap: anywhere; }
.gl-detail h3:focus { outline: none; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 0.9375rem; margin: 0 0 10px; }
.kv dt { font: 0.8125rem/1.6 var(--mono); color: var(--g3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.features { font-size: 0.9375rem; padding-left: 18px; margin: 0 0 8px; }
@container (max-width: 560px) { .gl-split { grid-template-columns: 1fr; grid-template-rows: minmax(140px, 40%) 1fr; } }

/* files */
.files { display: grid; grid-template-columns: 170px 1fr; height: 100%; }
.files-side { display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--g1); border-right: 1px solid var(--ink); overflow: auto; }
.folder { display: flex; align-items: center; gap: 8px; padding: 7px 8px; background: none; border: 0; text-align: left; font: 0.875rem/1 var(--mono); }
.folder:hover { background: var(--paper); }
.folder[aria-current] { background: var(--ink); color: var(--paper); --icon-ink: var(--paper); --icon-fill: var(--ink); box-shadow: inset 4px 0 0 var(--acc); }
.folder .count { margin-left: auto; font-size: 0.75rem; }
.files-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.files-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 12px 14px 8px; border-bottom: 1px solid var(--ink); }
.files-head h2 { margin: 0; }
.files-list { flex: 1; overflow: auto; list-style: none; margin: 0; padding: 0; }
.file-row {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  width: 100%; padding: 6px 14px; background: var(--paper); border: 0; border-bottom: 1px dotted var(--g2); text-align: left; cursor: default;
}
.file-row:hover { background: var(--g1); }
.file-row[aria-pressed="true"] { background: var(--ink); color: var(--paper); --icon-ink: var(--paper); --icon-fill: var(--ink); box-shadow: inset 4px 0 0 var(--acc); }
.file-row .ico { justify-self: center; }
.thumb { width: 48px; height: 30px; image-rendering: pixelated; outline: 1px solid var(--ink); }
.file-row[aria-pressed="true"] .thumb { outline-color: var(--paper); }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-kind, .file-origin { font: 0.75rem/1 var(--mono); color: var(--g3); }
.file-origin[data-provided] { border: 1px solid currentColor; padding: 2px 4px; }
.file-row[aria-pressed="true"] :is(.file-kind, .file-origin) { color: var(--g2); }
.files-list .empty { padding: 20px 14px; }
.files-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 52px; padding: 8px 14px; background: var(--g1); border-top: 1px solid var(--ink); }
.files-bar .meta { margin: 0; flex: 1; }
.sel-name { font: 0.875rem/1 var(--mono); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 4px; }
.move { display: inline-flex; align-items: center; gap: 6px; font: 0.8125rem var(--mono); }
.move select { font-size: 0.875rem; padding: 5px 6px; }
.rename { display: flex; gap: 8px; flex: 1; }
.rename input { flex: 1; min-width: 0; }
@container (max-width: 520px) {
  .files { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .files-side { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--ink); }
  .folder { flex: none; }
  .file-row { grid-template-columns: 40px minmax(0, 1fr); }
  .file-kind, .file-origin { display: none; }
}

/* scratchpad */
.notes { display: grid; grid-template-columns: 190px 1fr; height: 100%; }
.notes-side { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding: 10px; background: var(--g1); border-right: 1px solid var(--ink); }
.notes-list { flex: 1; overflow: auto; list-style: none; margin: 0; padding: 0; }
.note-row { display: grid; width: 100%; text-align: left; padding: 6px; background: none; border: 0; border-bottom: 1px dotted var(--g2); }
.note-row:hover { background: var(--paper); }
.note-row[aria-current] { background: var(--ink); color: var(--paper); box-shadow: inset 4px 0 0 var(--acc); }
.note-row[aria-current] .meta { color: var(--g2); }
.note-row-title { font: 0.875rem/1.3 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-row .meta { font-size: 0.75rem; }
.notes-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.note-editor { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.note-title { border: 0 !important; border-bottom: 1px solid var(--ink) !important; padding: 10px 14px !important; font: 1rem/1.3 var(--mono) !important; }
.note-text { flex: 1; min-height: 0; resize: none; border: 0 !important; padding: 12px 14px !important; font: 1rem/1.6 var(--sans) !important; }
.note-title:focus-visible, .note-text:focus-visible { outline-offset: -3px; }
.note-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; background: var(--g1); border-top: 1px solid var(--ink); }
.note-foot .btn-row { margin: 0; }
.note-foot .btn { padding: 5px 9px; }
.note-status { margin: 0; font-size: 0.875rem; }
.note-reader, .note-empty { padding: 16px 18px; overflow: auto; }
.note-reader h2:focus { outline: none; }
.doc-text { white-space: pre-wrap; max-width: 64ch; margin: 12px 0 16px; }
@container (max-width: 480px) {
  .notes { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .notes-side { border-right: 0; border-bottom: 1px solid var(--ink); max-height: 150px; }
}

/* preferences */
.prefs { padding: 14px 18px 18px; }
.pref { border: 1px solid var(--ink); margin: 0 0 12px; padding: 10px 14px 12px; }
.pref legend { font: 0.875rem/1 var(--mono); padding: 0 6px; }
.pref .btn-row { margin: 4px 0 8px; }
.pref .meta { margin: 0 0 6px; }
.radios { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0 8px; }
.radios label, .pref > label { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9375rem; cursor: pointer; }
.data-state { font: 0.875rem/1.4 var(--mono); }
.data-state:not([data-state="saved"]) { background: var(--ink); color: var(--paper); padding: 6px 8px; }
.confirm { border: 1px dashed var(--ink); padding: 10px; margin-top: 8px; }
.confirm .btn-row { margin-bottom: 0; }

/* bitmap studio */
.studio { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto auto; height: 100%; }
.st-top { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--ink); }
.st-top .btn { padding: 6px 10px; }
.st-spacer { flex: 1; }
.seg-group { display: flex; }
.seg { font: 0.875rem/1 var(--mono); padding: 7px 14px; background: var(--paper); border: 1px solid var(--ink); margin-right: -1px; }
.seg[aria-pressed="true"] { background: var(--acc); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); position: relative; }
.st-side { display: flex; flex-direction: column; gap: 12px; padding: 10px 8px; background: var(--g1); border-right: 1px solid var(--ink); overflow: auto; }
.st-tools { display: flex; flex-direction: column; gap: 4px; }
.tool { font: 0.8125rem/1 var(--mono); padding: 7px 8px; min-width: 72px; text-align: left; background: var(--paper); border: 1px solid var(--ink); }
.tool[aria-pressed="true"] { background: var(--acc); color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.st-pats { display: grid; grid-template-columns: repeat(2, 32px); gap: 6px; }
.pat { width: 32px; height: 24px; padding: 0; border: 1px solid var(--ink); background-color: var(--paper); background-size: 16px 16px; image-rendering: pixelated; }
.pat[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 1px; }
.st-stage {
  min-width: 0; min-height: 0; overflow: auto; padding: 12px;
  display: flex; align-items: center; justify-content: center;
  background: conic-gradient(#cdcdcd 25%, #e4e4e4 0 50%, #cdcdcd 0 75%, #e4e4e4 0) 0 0 / 2px 2px;
}
.st-canvas { display: block; image-rendering: pixelated; cursor: crosshair; touch-action: none; }
.st-stage[data-zoom="fit"] .st-canvas { width: 100%; height: 100%; object-fit: contain; }
.st-stage:not([data-zoom="fit"]) { display: block; }
.st-stage:not([data-zoom="fit"]) .st-canvas { margin: auto; outline: 1px solid var(--ink); }
.st-stage.is-drop { outline: 3px dashed var(--ink); outline-offset: -8px; }
.st-adjust { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 8px 12px; border-top: 1px solid var(--ink); }
.ctl { display: flex; align-items: center; gap: 8px; font: 0.8125rem/1 var(--mono); }
.ctl input[type="range"] { width: 110px; }
.ctl output { min-width: 3ch; }
.ctl select { font: 0.875rem var(--mono); padding: 4px 6px; }
.ctl-group { display: flex; align-items: center; gap: 12px; }
.ctl-group .btn { padding: 5px 9px; }
.st-note { margin: 0; flex-basis: 100%; font-size: 0.875rem; color: var(--g3); }
.st-save { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; background: var(--g1); border-top: 1px solid var(--ink); }
.st-name { width: 150px; font: 0.875rem var(--mono) !important; }
.st-dirty { font: 0.75rem/1 var(--mono); border: 1px dotted var(--ink); padding: 4px 6px; }
.st-status { grid-column: 1 / -1; margin: 0; max-width: none; min-height: 2em; padding: 2px 12px 8px; font-size: 0.875rem; background: var(--g1); }
@container (max-width: 620px) {
  .studio { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(200px, 1fr) auto auto auto; }
  .st-side { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--ink); }
  .st-tools { flex-direction: row; flex-wrap: wrap; }
  .tool { min-width: 0; }
  .st-pats { grid-template-columns: repeat(6, 32px); }
}

/* ---------- extras: eyes, toast, lens, screensaver, boot ---------- */
.eyes { display: flex; gap: 2px; padding: 3px 4px; background: none; border: 0; line-height: 0; }
.eyes svg { display: block; }
.eye-white { fill: var(--paper); }
.eye-line, .pupil, .lid { fill: var(--ink); }
.lid { display: none; }
.eyes.shut svg > :not(.lid), .eyes svg.wink > :not(.lid) { display: none; }
.eyes.shut .lid, .eyes svg.wink .lid { display: block; }
.toast {
  position: fixed; right: 14px; bottom: calc(var(--task) + 14px); z-index: 3000; margin: 0; max-width: min(360px, calc(100vw - 28px));
  padding: 10px 14px 10px 18px; background: var(--ink); color: var(--paper); outline: 1px solid var(--paper); box-shadow: inset 6px 0 0 var(--acc), 4px 4px 0 var(--g3);
  font: 0.875rem/1.4 var(--mono); transform: translateY(12px); opacity: 0; pointer-events: none; transition: transform 160ms steps(3), opacity 160ms steps(3);
}
.toast.is-on { transform: none; opacity: 1; }
[data-motion="reduced"] .toast { transition: none; }
.xray {
  position: fixed; left: 0; top: 0; z-index: 4000; width: 240px; height: 240px; border-radius: 50%; overflow: hidden; pointer-events: none;
  outline: 3px solid var(--ink); box-shadow: 0 0 0 5px var(--acc), 0 0 0 8px var(--ink);
}
.xray canvas { display: block; image-rendering: pixelated; }
.saver { position: fixed; inset: 0; z-index: 5000; background: var(--ink); overflow: hidden; cursor: none; outline: none; }
.saver canvas { display: block; image-rendering: pixelated; }
.saver-mark { position: absolute; left: 0; top: 0; width: 240px; height: auto; filter: drop-shadow(3px 3px 0 #000); }
.boot { position: fixed; inset: 0; z-index: 5000; background: var(--ink); color: var(--paper); padding: 6vh 6vw; outline: none; cursor: none; }
.boot-text { margin: 0; font: 1rem/1.7 var(--mono); white-space: pre-wrap; }
.boot-text::after { content: "▌"; color: var(--acc); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
[data-motion="reduced"] .boot-text::after { animation: none; }

/* terminal */
.win[data-app="term"] .win-body { background: var(--ink); }
.term { display: flex; flex-direction: column; height: 100%; background: var(--ink); color: var(--paper); font: 0.875rem/1.45 var(--mono); cursor: text; }
.term-out { flex: 1; min-height: 0; overflow: auto; padding: 10px 12px 0; }
.tl { white-space: pre-wrap; overflow-wrap: anywhere; }
.tl.cmd { color: var(--paper); margin-top: 6px; }
.tl.dim { color: var(--g2); }
.tl.art { line-height: 1; letter-spacing: 0; overflow-wrap: normal; white-space: pre; margin: 4px 0; }
.tl a { color: var(--paper); }
.term-line { display: flex; gap: 8px; align-items: baseline; padding: 4px 12px 10px; }
.term-prompt { white-space: nowrap; color: var(--acc); }
.term-line .term-in { flex: 1; min-width: 0; background: none; border: 0; padding: 0; color: var(--paper); caret-color: var(--acc); font: inherit; }
.term-in:focus-visible { outline: none; }
.term-line:focus-within .term-prompt { text-decoration: underline; text-underline-offset: 3px; }

/* luci */
.meter { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0 2px; }
.meter-bar { display: flex; gap: 2px; }
.meter-bar i { width: 10px; height: 10px; border: 1px solid var(--ink); }
.meter-bar i.on { background: var(--acc); }
.track { display: grid; grid-template-columns: repeat(5, 1fr); margin: 14px 0 0; position: relative; }
.track::before { content: ""; position: absolute; left: 10%; right: 10%; top: 17px; border-top: 2px dotted var(--ink); }
.node { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 2px 8px; background: none; border: 0; font: 0.8125rem/1.2 var(--mono); }
.node-dot { width: 28px; height: 28px; display: grid; place-items: center; background: var(--paper); border: 2px solid var(--ink); font-size: 0.8125rem; }
.node.is-done .node-dot { background: repeating-linear-gradient(45deg, var(--ink) 0 2px, var(--paper) 2px 4px); color: transparent; }
.node[aria-selected="true"] .node-dot { background: var(--acc); color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.node[aria-selected="true"] .node-name { text-decoration: underline; text-underline-offset: 3px; }
.luci .tab-panel { border: 1px solid var(--ink); }
.todo { display: flex; align-items: center; gap: 10px; font: 0.9375rem/1.4 var(--mono); cursor: pointer; }
.tasks details { border-top: 0; padding: 2px 0 8px 26px; }
.tasks details summary { font: 0.75rem/1.4 var(--mono); color: var(--g3); }
.tasks li { border-top: 1px dotted var(--ink); padding-top: 8px; }
.luci-log { margin: 12px 0 0; padding: 10px 12px; max-height: 170px; overflow: auto; background: var(--ink); color: var(--paper); font: 0.8125rem/1.5 var(--mono); white-space: pre-wrap; }

/* glasses */
.gl-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.gl-filters .seg { padding: 6px 10px; font-size: 0.8125rem; }
.gl-filters select { font: 0.8125rem var(--mono); padding: 5px 6px; }
.gl-list { display: flex; flex-direction: column; min-height: 0; gap: 8px; }
.gl-list .gl-results { flex: 1; }
.gl-more { align-self: flex-start; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.pref .sub { margin: 0 0 6px 24px; padding-left: 10px; border-left: 1px dotted var(--ink); }
.pref .sub .meta { margin: 0; }

/* arcade and life */
.arcade, .life { display: flex; flex-direction: column; height: 100%; }
.arcade-top, .life-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 10px; border-bottom: 1px solid var(--ink); }
.arcade-top .meta { margin: 0; }
.game-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 10px; background: var(--checker), var(--g2); outline: none; }
.game-stage:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }
.game-canvas { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; cursor: crosshair; touch-action: none; }
.game-typerow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--ink); font: 0.875rem var(--mono); }
.game-typerow input { flex: 1; font: 1rem var(--mono); text-transform: lowercase; }
.game-typerow input.miss { background: var(--ink); color: var(--paper); }
.arcade-foot, .life-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 14px; padding: 8px 12px; background: var(--g1); border-top: 1px solid var(--ink); }
.game-hud, .game-best { margin: 0; font: 0.8125rem/1.3 var(--mono); }
.life-stat { margin: 0; }
.life-help { margin: 0; padding: 6px 12px 10px; background: var(--g1); }
.life-bar .btn { padding: 6px 10px; }

/* the lcfr menu behind the wordmark */
.brand-btn { display: flex; align-items: center; height: calc(var(--bar) - 1px); padding: 0 6px; background: none; border: 0; }
.brand-btn:hover, .brand-btn:focus-visible { background: var(--acc); }

/* optional old-monitor effect */
[data-crt="on"] body::after {
  content: ""; position: fixed; inset: 0; z-index: 6000; pointer-events: none;
  background: repeating-linear-gradient(rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.45) 100%);
}

/* a one-bit pointer for the desktop; text fields and the canvas keep theirs */
body, button, .icon, .win-bar, .menu button { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='34' viewBox='0 0 12 17' shape-rendering='crispEdges'%3E%3Cpath fill='%23fff' d='M1 2h1v1H1zM1 3h2v1H1zM1 4h3v1H1zM1 5h4v1H1zM1 6h5v1H1zM1 7h6v1H1zM1 8h7v1H1zM1 9h8v1H1zM1 10h5v1H1zM1 11h2v1H1zM4 11h2v1H4zM1 12h1v1H1zM5 12h2v1H5zM5 13h2v1H5zM6 14h2v1H6zM6 15h2v1H6z'/%3E%3Cpath fill='%23000' d='M0 0h1v15H0zM1 1h1v1H1zM2 2h1v1H2zM3 3h1v1H3zM4 4h1v1H4zM5 5h1v1H5zM6 6h1v1H6zM7 7h1v1H7zM8 8h1v1H8zM9 9h1v1H9zM6 10h5v1H6zM3 11h1v1H3zM6 11h1v1H6zM2 12h1v1H2zM4 12h1v1H4zM7 12h1v1H7zM1 13h1v1H1zM4 13h1v1H4zM7 13h1v1H7zM5 14h1v1H5zM8 14h1v1H8zM5 15h1v1H5zM8 15h1v1H8zM6 16h2v1H6z'/%3E%3C/svg%3E") 1 1, default; }
input:not([type="checkbox"], [type="radio"], [type="range"]), textarea { cursor: text; }
a[href] { cursor: pointer; }
.win-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.icon:hover .icon-label { outline: 1px dotted var(--paper); outline-offset: 1px; }

/* ---------- phone: one app at a time ---------- */
@media (max-width: 720px) {
  body { grid-template-rows: var(--bar) 1fr auto; }
  [popovertarget="menu-window"], .sys-status { display: none; }
  #desk { overflow: auto; }
  #icons {
    position: relative; inset: auto; padding: 20px 12px; gap: 16px 4px;
    grid-auto-flow: row; grid-template-rows: none; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); grid-auto-columns: auto;
  }
  .icon { cursor: pointer; }
  .icon .ico { width: 64px; height: 64px; }
  .icon .px { width: 48px; height: 48px; }
  .win { position: absolute !important; inset: 0 !important; width: auto !important; height: auto !important; outline: 0; box-shadow: none; }
  .win:not(.is-active) { display: none !important; }
  .win::after, .win-max, .win-rz, .win-grip { display: none; }
  .win-bar { height: 44px; }
  .win-btn { width: 40px; height: 32px; }
  .win.is-active .win-handle::after { display: none; }
  .taskbar { padding: 6px; }
  .task { height: 36px; }
}
@media (pointer: coarse) {
  .btn, .seg, .tool, .folder { min-height: 40px; }
}

/* ---------- no JavaScript ---------- */
.fallback { position: fixed; inset: 0; z-index: 2000; overflow: auto; padding: 48px 24px; background: var(--paper); color: var(--ink); }
.fallback > * { max-width: 560px; margin-left: auto; margin-right: auto; }
.fallback form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 20px auto; }
.fallback label { flex-basis: 100%; font-family: var(--mono); }
.fallback input { flex: 1; }

/* ---------- the status panel ---------- */
.widget {
  position: absolute; z-index: 2; top: 16px; right: 16px; width: 228px;
  background: var(--paper); color: var(--ink); border: 1px solid var(--ink); box-shadow: 0 0 0 1px var(--paper);
  font: 0.8125rem/1.3 var(--mono);
}
.widget::after { content: ""; position: absolute; z-index: -1; inset: 5px -6px -6px 5px; background: var(--checker); pointer-events: none; }
.wg-bar { display: flex; justify-content: space-between; align-items: center; padding: 2px 2px 2px 8px; background: var(--acc); border-bottom: 1px solid var(--ink); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.08em; }
.wg-x { width: 20px; height: 18px; padding: 0; background: none; border: 1px solid transparent; font: 0.875rem/1 var(--mono); }
.wg-x:hover { border-color: var(--ink); background: var(--paper); }
.wg-date { display: flex; justify-content: space-between; align-items: baseline; margin: 0; padding: 8px 8px 7px; font-size: 1rem; border-bottom: 1px solid var(--ink); background: repeating-linear-gradient(var(--paper) 0 3px, var(--g1) 3px 4px); }
.wg-sky { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; background: var(--ink); color: var(--paper); padding: 1px 5px; }
.wg-sky:empty { display: none; }
.wg-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; padding: 5px 8px; background: none; border: 0; text-align: left; font: inherit; }
.wg-row:hover, .wg-row:focus-visible { background: var(--acc); outline: none; }
.wg-k { color: var(--g3); }
.wg-row:hover .wg-k { color: var(--ink); }
.wg-v { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.wg-dot { display: inline-block; width: 7px; height: 7px; border: 1px solid var(--ink); }
.wg-dot.is-live { background: var(--acc); box-shadow: 0 0 0 1px var(--paper), 0 0 0 2px var(--ink); }
.widget hr { border: 0; border-top: 1px dotted var(--ink); margin: 2px 0; }
.wg-tip { margin: 0; padding: 6px 8px 7px; max-width: none; background: var(--g1); border-top: 1px solid var(--ink); font-size: 0.75rem; }
.pref > label { display: flex; margin: 2px 0; }
@media (max-width: 720px) { .widget { display: none; } }

/* ---------- the opening: the wordmark dithers in, then flies up into the menu bar ---------- */
.intro { position: fixed; inset: 0; z-index: 7000; display: grid; place-content: center; justify-items: center; gap: 18px; background: var(--ink); animation: intro-safety 0s 5s forwards; }
@keyframes intro-safety { to { visibility: hidden; } } /* never leave the screen covered if the script doesn't run */
.no-intro .intro { display: none; }
.intro-mark { display: block; width: min(56vw, 380px); height: auto; transform-origin: 0 0; }
.intro-line { margin: 0; min-height: 1.5em; max-width: none; color: var(--paper); font: 0.9375rem/1.5 var(--mono); letter-spacing: 0.06em; }
.intro-line::after { content: "\258C"; color: var(--acc); animation: caret 0.5s steps(1) infinite; }
.intro[data-step] .intro-line { visibility: hidden; }
.intro[data-step="1"] { background: conic-gradient(transparent 25%, var(--ink) 0) 0 0 / 2px 2px; }
.intro[data-step="2"] { background: conic-gradient(var(--ink) 25%, transparent 0 50%, var(--ink) 0 75%, transparent 0) 0 0 / 2px 2px; }
.intro[data-step="3"] { background: conic-gradient(var(--ink) 25%, transparent 0) 0 0 / 4px 4px; }
.intro[data-step="4"] { background: none; }
.intro-run .sysbar, .intro-run .taskbar { transition: transform 300ms steps(6); }
.intro-bar .sysbar { transform: translateY(-110%); }
.intro-bar .taskbar { transform: translateY(110%); }
.intro-brand .brand img { visibility: hidden; }
.intro-run #icons > li { transition: opacity 140ms steps(2) calc(var(--i) * 45ms), transform 180ms steps(3) calc(var(--i) * 45ms); }
.intro-desk #icons > li { opacity: 0; transform: translateY(10px); }
.intro-run .widget { transition: transform 240ms steps(4) 300ms, opacity 240ms steps(2) 300ms; }
.intro-desk .widget { opacity: 0; transform: translateX(24px); }
.intro-desk .win { visibility: hidden; }
