/* Tim OSterhus desktop. Charcoal, walnut and warm light from the studio, in a compact desktop shell.
   Laptop-still contract: solid/rgba colours, borders, radii, angled linear and positioned radial gradients
   (at most four layers), <img> icons, text and canvases. Blur and shadows are enhancement only; every
   translucent surface carries an rgba background that reads correctly without them. No url() backgrounds. */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.on-desktop { overflow: hidden; }
.on-desktop > header { display: none; }

/* ---------- Shell and wallpaper ---------- */
.desktop-shell {
  --os-font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", sans-serif;
  --os-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --os-ink: #f3ede4;
  --os-ink-2: #cbc2b5;
  --os-ink-3: #a59c8f;
  --os-window: #23211e;
  --os-raised: #2c2925;
  --os-titlebar: #37322c;
  --os-titlebar-idle: #2a2723;
  --os-hairline: rgba(255, 244, 228, .1);
  --os-amber: #e8bd86;
  --os-sage: #b9cf9f;
  --os-ring: #ffce8b;
  --os-bar-h: 26px;
  position: fixed; inset: 0; z-index: 20; height: 100dvh; width: 100%;
  display: flex; flex-direction: column;
  overflow: hidden; isolation: isolate; transform-origin: 0 0;
  color: var(--os-ink);
  font: 13px/1.4 var(--os-font);
  -webkit-font-smoothing: antialiased;
  background-color: #15120f;
  /* Dusk at the studio: slate sky light from the upper left, warm window light upper right, a walnut
     glow rising from the lower left, over charcoal. Stops are evenly spaced so the laptop still matches. */
  background-image:
    radial-gradient(74% 66% at 92% 0%, rgba(255, 204, 142, .52), rgba(212, 136, 70, .18), rgba(212, 136, 70, 0)),
    radial-gradient(64% 62% at 0% 0%, rgba(96, 110, 122, .42), rgba(64, 74, 84, .14), rgba(64, 74, 84, 0)),
    radial-gradient(78% 74% at 8% 106%, rgba(200, 116, 52, .6), rgba(118, 64, 30, .24), rgba(118, 64, 30, 0)),
    linear-gradient(165deg, #2b2621, #1d1a17, #141210, #0c0b0a);
}
.desktop-shell :where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--os-ring); outline-offset: 2px; box-shadow: none;
}
.desktop-shell button { font-family: var(--os-font); }
.desktop-wordmark { margin: 0; font: 600 13px/1 var(--os-font); letter-spacing: 0; max-width: none; color: var(--os-ink); }
.desktop-wordmark:focus { outline: none; }

/* ---------- Menu bar ---------- */
.menu-bar {
  position: relative; z-index: 1000; flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  height: var(--os-bar-h); padding: 0 8px;
  color: var(--os-ink);
  background-color: rgba(22, 19, 16, .7);
  border-bottom: 1px solid rgba(255, 244, 228, .07);
  -webkit-backdrop-filter: blur(24px) saturate(1.15); backdrop-filter: blur(24px) saturate(1.15);
}
.menu-bar-start, .menu-bar-end { display: flex; align-items: center; gap: 1px; height: 100%; min-width: 0; }
.menu-bar-start { flex: 1 1 auto; overflow: hidden; }
.menu-bar-end { flex: none; gap: 6px; }
.menu-title {
  flex: none; height: 22px; min-width: 0; min-height: 0; padding: 0 9px;
  border: 0; border-radius: 5px; background: transparent; color: inherit;
  font: 500 13px/22px var(--os-font); white-space: nowrap; cursor: default;
}
.menu-title:hover { background-color: rgba(255, 244, 228, .1); }
.menu-title[aria-expanded=true], .menu-title.is-open { background-color: rgba(255, 244, 228, .2); }
.menu-title:focus-visible { outline-offset: -2px; }
.menu-brand { display: inline-flex; align-items: center; gap: 7px; padding: 0 10px 0 8px; }
.menu-brand-mark { display: block; flex: none; width: 15px; height: 15px; }
/* The wordmark rides in the menu bar: "terhus" at about half size on the same baseline as "Tim OS". */
.menu-bar .menu-brand-label { display: inline-flex; align-items: baseline; gap: 0; font-size: 14px; font-weight: 700; letter-spacing: -.01em; line-height: 1; color: var(--os-ink); }
.menu-bar .menu-brand-label .wordmark-tail { font-size: .6em; font-weight: 650; letter-spacing: 0; }
.menu-app-name { font-weight: 700; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.menu-return {
  flex: none; height: 20px; min-width: 0; min-height: 0; padding: 0 9px;
  border: 1px solid rgba(232, 189, 134, .4); border-radius: 5px;
  background-color: rgba(232, 189, 134, .14); color: #f8e2c2;
  font: 600 12px/18px var(--os-font); white-space: nowrap; cursor: default;
}
.menu-return:hover { background-color: rgba(232, 189, 134, .26); }
/* A text chevron, absolutely placed, so the laptop still draws it where it is (the button's aria-label names it). */
.menu-return { position: relative; padding-left: 21px; }
.menu-return::before { content: '\2039'; position: absolute; left: 8px; top: calc(50% - 9px); width: 8px; height: 18px; font: 600 15px/16px var(--os-font); }
.menu-return-short { display: none; }
.menu-clock { padding: 0 6px 0 4px; font: 500 13px/1 var(--os-font); font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--os-ink); }

/* ---------- Menus ---------- */
.menu-popover {
  position: absolute; z-index: 1001; top: calc(var(--os-bar-h) + 1px); left: 8px;
  display: flex; flex-direction: column; gap: 0;
  min-width: 220px; max-width: min(380px, calc(100vw - 16px)); max-height: calc(100dvh - var(--os-bar-h) - 16px); overflow-y: auto;
  padding: 5px; color: var(--os-ink); font: 13px/1.3 var(--os-font);
  background-color: rgba(44, 39, 34, .9);
  border: 1px solid rgba(255, 244, 228, .14); border-radius: 9px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .55), 0 14px 40px rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(28px) saturate(1.5); backdrop-filter: blur(28px) saturate(1.5);
}
.menu-item {
  position: relative; display: flex; align-items: center; gap: 28px; width: 100%; height: 24px; min-width: 0; min-height: 0;
  padding: 0 10px 0 22px; border: 0; border-radius: 5px; background: transparent; color: inherit;
  font: inherit; text-align: left; cursor: default;
}
/* Left gutter marks, drawn (not text) so accessible names stay clean: a check for the chosen radio item,
   a diamond for a minimized window in the Window menu. */
.menu-item[aria-checked=true]::before, .menu-item[data-checked=true]::before {
  content: ''; position: absolute; left: 9px; top: calc(50% - 6px); width: 4px; height: 8px;
  border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
.menu-item[data-minimized=true]::after {
  content: ''; position: absolute; left: 9px; top: calc(50% - 3px); width: 5px; height: 5px; background-color: currentColor; transform: rotate(45deg);
}
.menu-group { display: flex; flex-direction: column; }
.menu-group + .menu-group, .menu-item + .menu-group { margin-top: 4px; padding-top: 4px; border-top: 1px solid rgba(255, 244, 228, .13); }
.menu-group-label { padding: 4px 10px 2px 22px; font-size: 12px; font-weight: 700; color: var(--os-ink-3); }
.menu-item-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-shortcut { flex: none; margin-left: auto; color: var(--os-ink-3); font: 12.5px/1 var(--os-font); letter-spacing: .06em; font-variant-numeric: tabular-nums; }
/* The highlight is the focus indicator, as in native menus: dark ink on amber (contrast over 9:1). */
.menu-item:hover, .menu-item:focus-visible, .menu-item.is-active { background-color: #e6b77c; color: #1c1612; outline: none; }
.menu-item:hover .menu-shortcut, .menu-item:focus-visible .menu-shortcut, .menu-item.is-active .menu-shortcut { color: #3d2e1f; }
.menu-item[aria-disabled=true] { color: #8a8277; }
.menu-item[aria-disabled=true]:hover, .menu-item[aria-disabled=true].is-active { background-color: transparent; color: #8a8277; }
.menu-item[aria-disabled=true]:focus-visible { background-color: rgba(255, 244, 228, .1); color: #a39b90; }
.menu-item[aria-disabled=true] .menu-shortcut { color: #7a7268; }
.menu-separator { flex: none; height: 1px; margin: 5px 10px; background-color: rgba(255, 244, 228, .13); }

/* ---------- Surface and windows ---------- */
.desktop-surface { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.desktop-window {
  position: absolute; display: flex; flex-direction: column; min-width: 0;
  color: var(--os-ink); background-color: var(--os-window);
  border: 1px solid rgba(255, 244, 228, .13); border-radius: 11px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 10px 24px rgba(0, 0, 0, .3), 0 30px 80px rgba(0, 0, 0, .45);
}
.desktop-window[data-focused=false] { box-shadow: 0 0 0 1px rgba(0, 0, 0, .55), 0 8px 26px rgba(0, 0, 0, .32); }
/* Background windows recede slightly; the overlay keeps text well above AA. */
.desktop-window[data-focused=false]::after {
  content: ''; position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  background-color: rgba(10, 8, 6, .06); pointer-events: none;
}
.desktop-window[data-window-state=minimized] { display: none; }
.desktop-window[data-window-state=zoomed] { border-radius: 8px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 12px 32px rgba(0, 0, 0, .35); }
.desktop-window[data-dragging=true] { user-select: none; }
.window-titlebar {
  position: relative; flex: none; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center;
  height: 30px; background-color: var(--os-titlebar); border-bottom: 1px solid rgba(0, 0, 0, .5);
}
.desktop-window[data-focused=false] .window-titlebar { background-color: var(--os-titlebar-idle); }
.window-controls { position: relative; z-index: 1; grid-column: 1; grid-row: 1; display: flex; align-items: center; height: 100%; padding-left: 6px; }
.window-control {
  position: relative; flex: none; width: 20px; height: 30px; min-width: 0; min-height: 0; margin: 0; padding: 0;
  border: 0; border-radius: 0; background: transparent; cursor: default;
}
.window-control:hover { background: transparent; }
/* The desktop's text glyphs stay hidden; the drawn glyphs below are crisper at 12 px. */
.window-control-glyph { display: none; }
.window-control::before {
  content: ''; position: absolute; left: 4px; top: 9px; width: 12px; height: 12px; border-radius: 50%;
  background-color: #e9675c; box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .3);
  background-repeat: no-repeat; background-position: center;
}
.window-minimize::before { background-color: #ebba4b; }
.window-zoom::before { background-color: #79bd67; }
.desktop-window[data-focused=false] .window-control::before { background-color: #4b4640; box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .08); }
.desktop-window[data-focused=false] .window-controls:hover .window-close::before { background-color: #e9675c; }
.desktop-window[data-focused=false] .window-controls:hover .window-minimize::before { background-color: #ebba4b; }
.desktop-window[data-focused=false] .window-controls:hover .window-zoom::before { background-color: #79bd67; }
/* Glyphs appear on hover or keyboard focus, as on the desktop this follows. */
.window-controls:hover .window-close::before, .window-controls:focus-within .window-close::before {
  background-image: linear-gradient(45deg, transparent 43%, rgba(77, 12, 6, .78) 43% 57%, transparent 57%), linear-gradient(-45deg, transparent 43%, rgba(77, 12, 6, .78) 43% 57%, transparent 57%);
  background-size: 7px 7px;
}
.window-controls:hover .window-minimize::before, .window-controls:focus-within .window-minimize::before {
  background-image: linear-gradient(rgba(96, 56, 0, .8), rgba(96, 56, 0, .8)); background-size: 7px 1.5px;
}
.window-controls:hover .window-zoom::before, .window-controls:focus-within .window-zoom::before {
  background-image: linear-gradient(rgba(16, 62, 10, .8), rgba(16, 62, 10, .8)), linear-gradient(rgba(16, 62, 10, .8), rgba(16, 62, 10, .8));
  background-size: 7px 1.5px, 1.5px 7px;
}
.window-control:active::before { filter: brightness(.82); }
.window-control:focus-visible { outline: none; }
.window-control:focus-visible::before { outline: 2px solid var(--os-ring); outline-offset: 2px; }
.window-title {
  grid-column: 1 / -1; grid-row: 1; min-width: 0; min-height: 0; height: 100%;
  padding: 0 80px; border: 0; border-radius: 0; background: transparent; color: #ede6db;
  font: 600 13px/30px var(--os-font); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: default; touch-action: none;
}
.window-title:hover { background: transparent; }
.window-title:focus-visible { outline-offset: -4px; border-radius: 7px; }
.desktop-window[data-focused=false] .window-title { color: #9f978c; }
[data-dragging=true] .window-title { cursor: grabbing; }
.window-body {
  position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 22px 28px 26px; font-size: 14px; line-height: 1.55;
  scrollbar-width: thin; scrollbar-color: rgba(255, 244, 228, .26) transparent;
}
.window-body h2 { margin: 0 0 12px; font-size: 20px; font-weight: 650; line-height: 1.3; letter-spacing: -.015em; }
.window-body p { font-size: 14px; line-height: 1.6; margin: 0 0 14px; }
.window-body .status { font-size: 13px; color: #e6c393; }
.window-body .evidence { margin: 18px 0; padding: 2px 16px; font-size: 13px; color: var(--os-ink-2); border-left: 2px solid rgba(232, 189, 134, .45); }
.window-body .result { padding: 14px 18px; margin: 0 0 14px; border-radius: 8px; border: 1px solid var(--os-hairline); background-color: rgba(255, 244, 228, .04); }
.window-body dt { font-size: 12px; color: var(--os-ink-3); }
.window-body dd { margin: 0 0 10px; }
.window-body .controls { margin: 16px 0; gap: 8px; }
.desktop-window .outbound-actions a, .app-about .window-body > a {
  display: inline-flex; align-items: center; height: 28px; min-height: 0; min-width: 0; padding: 0 12px;
  border: 1px solid rgba(232, 189, 134, .45); border-radius: 6px; background-color: rgba(232, 189, 134, .1);
  color: #f5d7ab; font: 500 13px/1 var(--os-font); text-decoration: none;
}
.desktop-window .outbound-actions a:hover { background-color: rgba(232, 189, 134, .2); }

/* Shared compact push buttons inside app windows (Snake keeps its own game controls). Zero-specificity
   scope, so each app's own button rules win. */
:where(.desktop-window:not(.app-snake) .window-body) button {
  min-width: 0; min-height: 0; height: 28px; padding: 0 12px; border-radius: 6px;
  border: 1px solid rgba(255, 244, 228, .16); background-color: rgba(255, 244, 228, .07); color: var(--os-ink);
  font: 500 13px/1 var(--os-font);
}
:where(.desktop-window:not(.app-snake) .window-body) button:hover { background-color: rgba(255, 244, 228, .13); }
:where(.desktop-window:not(.app-snake) .window-body) button:disabled { color: #8f877c; background-color: rgba(255, 244, 228, .03); border-color: rgba(255, 244, 228, .08); }

/* ---------- Dock ---------- */
.desktop-dock {
  position: relative; z-index: 900; flex: none; align-self: center;
  display: flex; flex-wrap: nowrap; align-items: flex-end; gap: 2px;
  max-width: calc(100% - 16px); margin: 6px auto 8px; padding: 4px 6px;
  background-color: rgba(48, 42, 36, .56);
  border: 1px solid rgba(255, 244, 228, .17); border-radius: 18px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .35);
  -webkit-backdrop-filter: blur(24px) saturate(1.5); backdrop-filter: blur(24px) saturate(1.5);
}
.dock-app {
  position: relative; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  width: 56px; height: 60px; min-width: 0; min-height: 0; padding: 4px 0 0;
  border: 0; border-radius: 12px; background: transparent; cursor: default;
}
.dock-app:hover { background: transparent; }
.dock-app:focus-visible { outline-offset: -1px; border-radius: 13px; }
.dock-icon {
  display: block; width: 48px; height: 48px; pointer-events: none; user-select: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35));
  transition: transform .2s cubic-bezier(.3, .7, .4, 1);
}
.dock-app:hover .dock-icon { transform: translateY(-4px); }
.dock-app:active .dock-icon { filter: brightness(.78) drop-shadow(0 2px 3px rgba(0, 0, 0, .35)); }
/* Open apps carry a dot; a minimized app's dot widens to an amber bar. */
.dock-app[data-open=true]::after {
  content: ''; position: absolute; left: 26px; top: 54px; width: 4px; height: 4px; border-radius: 50%;
  background-color: #f1e6d4;
}
.dock-app[data-minimized=true]::after { left: 22px; width: 12px; border-radius: 2px; background-color: var(--os-amber); }
.dock-label {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  padding: 4px 10px; border-radius: 7px; color: var(--os-ink);
  background-color: rgba(34, 30, 26, .94); border: 1px solid rgba(255, 244, 228, .16);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  font: 500 12.5px/1.3 var(--os-font); white-space: nowrap; pointer-events: none;
  opacity: 0; visibility: hidden; transition: opacity .12s, visibility .12s;
}
.dock-app:hover .dock-label, .dock-app:focus-visible .dock-label { opacity: 1; visibility: visible; }
.dock-app:first-child .dock-label { left: 0; transform: none; }
.dock-app:last-child .dock-label { left: auto; right: 0; transform: none; }
.dock-separator { flex: none; align-self: center; width: 1px; height: 40px; margin: 0 5px; background-color: rgba(255, 244, 228, .2); }

/* ---------- Projects: a file browser ---------- */
.app-projects .window-body { display: flex; flex-direction: column; padding: 0; }
.file-toolbar {
  position: sticky; top: 0; z-index: 2; flex: none; display: flex; align-items: center; gap: 12px;
  height: 40px; margin: 0; padding: 0 12px; background-color: var(--os-raised); border-bottom: 1px solid rgba(0, 0, 0, .45);
}
.desktop-window .file-toolbar button { position: relative; height: 26px; padding: 0 10px 0 23px; font-size: 12.5px; }
/* Drawn, not text, so the button keeps its name; absolutely placed so the laptop still puts it in place. */
.desktop-window .file-toolbar button::before {
  content: ''; position: absolute; left: 11px; top: calc(50% - 3.5px); width: 6px; height: 6px;
  border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg);
}
.desktop-window .file-toolbar button[aria-disabled=true] { color: #8f877c; background-color: transparent; border-color: rgba(255, 244, 228, .08); }
.file-path { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--os-ink-2); font: 500 12.5px/1 var(--os-font); }
.project-folders {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); align-content: start; gap: 6px;
  padding: 18px 16px;
}
.desktop-window .project-folders .project-folder {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 10px;
  height: auto; min-height: 0; padding: 14px 8px 12px; border: 0; border-radius: 9px; background: transparent;
  color: var(--os-ink); font: 500 12.5px/1.3 var(--os-font); text-align: center;
}
.desktop-window .project-folders .project-folder:hover { background-color: rgba(255, 244, 228, .07); }
.desktop-window .project-folders .project-folder:focus-visible { background-color: rgba(232, 189, 134, .16); outline-offset: -2px; }
.folder-icon {
  position: relative; display: block; width: 64px; height: 46px; margin-top: 8px;
  border-radius: 4px 4px 6px 6px; background-color: #d7a15f;
  background-image: linear-gradient(180deg, #ebbd80, #c48a4c);
  box-shadow: inset 0 1px rgba(255, 255, 255, .4), 0 4px 10px rgba(0, 0, 0, .3);
}
.folder-icon::before {
  content: ''; position: absolute; left: 0; top: -7px; width: 26px; height: 9px;
  border-radius: 4px 5px 0 0; background-color: #e2ad6c;
}
.project-detail { padding: 18px 28px 28px; }
.file-views {
  display: inline-flex; gap: 2px; margin: 0 0 18px; padding: 2px;
  border-radius: 8px; background-color: rgba(0, 0, 0, .28); border: 1px solid rgba(255, 244, 228, .08);
}
.desktop-window .file-views button { height: 24px; padding: 0 14px; border: 0; border-radius: 6px; background: transparent; color: var(--os-ink-2); font-size: 12.5px; }
.desktop-window .file-views button:hover { background-color: rgba(255, 244, 228, .06); }
.desktop-window .file-views button[aria-pressed=true] { background-color: #4d463d; color: var(--os-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.desktop-window .open-model-app { color: #142012; background-color: #b9cf9f; border-color: #d3e4bd; font-weight: 600; }
.desktop-window .open-model-app:hover { background-color: #c9dbb2; }

/* ---------- Terminal ---------- */
.terminal-app {
  display: flex; flex-direction: column;
  background-color: #121310; color: #dbe2d1; font: 12.5px/1.55 var(--os-mono);
  scrollbar-color: rgba(190, 210, 170, .3) transparent;
}
.desktop-window .terminal-app { padding: 10px 14px 10px; }
.terminal-app .terminal-notice { max-width: none; margin: 0 0 8px; padding: 0 0 8px; color: #a3ad97; font-size: 12px; border-bottom: 1px dashed rgba(190, 210, 170, .2); }
.terminal-log { flex: 1; min-height: 60px; overflow-y: auto; padding: 0 2px; }
.terminal-app .terminal-command { max-width: none; margin: 6px 0 2px; color: #eec58e; font-size: 12.5px; }
.terminal-output { width: auto; min-height: 0; margin: 0 0 10px; color: #dbe2d1; font: inherit; line-height: 1.55; overflow-wrap: anywhere; }
.terminal-form { flex: none; display: flex; align-items: center; gap: 8px; padding-top: 8px; border-top: 1px solid rgba(190, 210, 170, .16); }
.terminal-form > span { white-space: nowrap; color: #bdd3a2; }
.terminal-form input {
  flex: 1; width: 0; height: 26px; min-height: 0; padding: 0 6px;
  border: 1px solid transparent; border-radius: 4px; background: transparent; color: #f2f5eb; font: inherit; caret-color: #eec58e;
}
.desktop-shell .terminal-form input:focus-visible { outline: none; border-color: rgba(238, 197, 142, .6); background-color: rgba(255, 255, 255, .03); }
.desktop-window .terminal-form button { flex: none; height: 24px; padding: 0 10px; border-color: rgba(190, 210, 170, .3); background-color: transparent; color: #cfdac2; font: 12px/1 var(--os-mono); }
.desktop-window .terminal-form button:hover { background-color: rgba(190, 210, 170, .1); }
.terminal-log:focus-visible { outline: 2px solid var(--os-ring); outline-offset: 2px; }

/* ---------- Notes and About: calm paper documents ---------- */
.app-notes .window-body, .app-about .window-body {
  padding: 34px 44px 40px; color: #2d2620; background-color: #f4eee4;
  scrollbar-color: rgba(70, 48, 26, .35) transparent;
}
.app-notes .window-body h2, .app-about .window-body h2 { color: #211b16; font-size: 22px; font-weight: 680; letter-spacing: -.02em; }
.app-notes .window-body p, .app-about .window-body p { color: #3b332b; font-size: 15px; line-height: 1.65; }
.app-notes .evidence, .app-about .evidence { color: #574c41; border-left-color: #c6ad88; }
.app-notes .window-body .evidence p { font-size: 13px; color: #574c41; }
.app-notes .result { background-color: #ebe3d6; border-color: #d8cab4; }
.app-notes dt { color: #65594d; }
.app-notes .window-body a, .app-about .window-body a { color: #83501f; }
.app-notes :focus-visible, .app-about :focus-visible { outline-color: #83501f; }
.desktop-note + .desktop-note { border-top: 1px solid #dccfbd; margin-top: 30px; padding-top: 26px; }
.app-about .window-body > h2:first-child { font-size: 28px; margin-bottom: 8px; }
.app-about .window-body > h2:first-child + p { font: italic 19px/1.45 ui-serif, "Iowan Old Style", Georgia, "Times New Roman", serif; color: #5a4330; margin-bottom: 22px; }
.app-about .window-body > a { border-color: #b98a5c; background-color: #efe3d2; color: #6d4118; }
.app-about .window-body > a:hover { background-color: #e8d7bf; }

/* ---------- Snake framing (game styles live in snake.css) ---------- */
.app-snake .window-body { container-type: inline-size; }

/* ---------- Model app ----------
   Recorded output is walnut/amber; text generated in this browser is sage; each is also labelled in words. */
.language-model {
  container: model / inline-size;
  --model-ink: #f3ede4; --model-ink-2: #cbc2b5; --model-ink-3: #a99f92;
  --model-panel: #1d1b18; --model-line: rgba(255, 244, 228, .1);
}
.model-layout { display: grid; grid-template-columns: minmax(0, 1fr); }
.model-main { width: min(100%, 680px); min-width: 0; margin-inline: auto; }
.model-panel { margin: 0; padding: 0; }
.model-panel-heading {
  margin: 0 0 8px; font-size: clamp(22px, 4.5cqw, 29px); font-weight: 650;
  letter-spacing: -.027em; line-height: 1.25; color: var(--model-ink);
}
.language-model .model-intro { margin: 0 0 20px; color: var(--model-ink-2); font-size: 14px; line-height: 1.45; }
/* Sentence case, not text-transform: the laptop still paints source glyphs. */
.model-chip { display: inline-block; padding: 1px 8px; border-radius: 5px; font-size: 11.5px; font-weight: 700; line-height: 1.55; letter-spacing: .01em; white-space: nowrap; }
.model-chip-recorded { color: #f3d6ab; background-color: #4a3a28; border: 1px solid #8a6c46; }
.model-chip-live { color: #d9e5c5; background-color: #2f3a2b; border: 1px solid #6c8160; }
.model-chip-off { color: #dad2c4; background-color: #33302a; border: 1px solid #6d6557; }
.model-chip-end { color: #ebe4d6; background-color: #3a3630; border: 1px solid #6d6557; }
.model-picker-field { display: flex; flex-direction: row; align-items: center; gap: 10px; margin: 0 0 14px; }
.model-prompt-field { gap: 7px; margin: 0 0 14px; }
.model-picker-field > span, .model-prompt-field > span { font-size: 12.5px; font-weight: 500; color: var(--model-ink-2); }
.language-model select {
  width: auto; max-width: 100%; min-width: 0; min-height: 44px; padding: 0 10px;
  border: 1px solid #7c6a52; border-radius: 6px; color: #f1e8da; background-color: #2e2a25;
  font: inherit; text-overflow: ellipsis;
}
.model-prompt {
  min-height: 70px; padding: 10px 12px; line-height: 1.55; color: #f0f2e8;
  background-color: #191a17; border: 1px solid #6c8160; border-radius: 7px; resize: vertical; overflow-wrap: anywhere;
}
.model-prompt[readonly] { color: #cbd0c1; border-style: dashed; }
.model-prompt:disabled { color: #b4ada1; background-color: #25231f; border-color: #555048; }
.model-prompt[aria-invalid=true] { border-color: #e39a7c; }
.model-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 10px; }
.model-actions button { min-width: 104px; }
.model-generate-button:not(:disabled) { color: #142012; background-color: #b9cf9f; border-color: #d3e4bd; font-weight: 650; }
.model-generate-button:not(:disabled):hover { background-color: #c9dbb2; }
.model-stop-button { border-color: #c79a6c; color: #f6dcbb; }
.language-model .generation-reason { flex: 1 1 220px; min-width: 0; max-width: none; margin: 0; min-height: 1.5em; font-size: 13px; line-height: 1.5; color: var(--model-ink-2); }
.language-model[data-model-state=error] .generation-reason { color: #f2b9a0; }
.language-model[data-model-state=running] .generation-reason, .language-model[data-model-state=loading] .generation-reason { color: #d6e2c2; }
.language-model .model-settings { max-width: none; margin: 0 0 12px; font-size: 12px; color: var(--model-ink-3); }
.model-progress { position: relative; height: 5px; margin: 2px 0 14px; overflow: hidden; border-radius: 3px; background-color: #33382f; }
.model-progress-fill { position: absolute; inset: 0 auto 0 0; width: 0; background-color: #b9cf9f; transition: width .2s linear; }
.model-progress[data-mode=indeterminate] .model-progress-fill { width: 34%; animation: model-progress 1.4s ease-in-out infinite; }
@keyframes model-progress { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.model-result { margin: 18px 0 0; }
.model-result-head { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.generated-output {
  max-width: none; max-height: 300px; overflow-y: auto; margin: 0; padding: 14px 16px; white-space: pre-wrap;
  border: 1px solid #4b5741; border-radius: 8px; background-color: #161714; color: #e1e7d6;
  font-size: 14.5px; line-height: 1.65; scrollbar-color: #738065 transparent;
}
.generated-opening { color: #cddab4; font-weight: 600; }
.generated-text { color: #f0f2e8; }
.language-model[data-model-state=running] .generated-text::after { content: '▍'; margin-left: 1px; color: #b9cf9f; animation: model-caret 1s steps(2) infinite; }
@keyframes model-caret { 50% { opacity: 0; } }
.model-result[data-end=stopped] .generated-output, .model-result[data-end=error] .generated-output { border-style: dashed; }
.model-recorded { margin-top: 25px; }
.model-disclosure { min-width: 0; border-top: 1px solid var(--model-line); }
.model-disclosure-title { display: list-item; cursor: pointer; padding: 12px 2px; color: var(--model-ink-2); font-size: 13px; font-weight: 600; }
.model-disclosure-title:hover { color: var(--model-ink); }
.recorded-sample {
  max-width: none; margin: 0 0 10px; padding: 12px 16px; white-space: pre-wrap;
  border-left: 3px solid #a98557; border-radius: 0 7px 7px 0; background-color: #1c1a17; color: #d9d1c4;
  font-size: 14px; line-height: 1.65;
}
.sample-opening { color: #f2c98d; font-weight: 600; }
.language-model .sample-stop, .language-model .samples-note { max-width: none; margin: 0 0 8px; font-size: 12.5px; line-height: 1.55; color: var(--model-ink-3); }
.model-info .status { margin: 0 0 12px; font-size: 13px; line-height: 1.55; color: #e6c393; }
.model-facts { margin: 0 0 12px; padding: 0; list-style: none; }
.model-facts li { margin: 0; padding: 9px 0; font-size: 12.5px; line-height: 1.55; color: var(--model-ink-2); border-top: 1px solid var(--model-line); }
.language-model .model-publication { max-width: none; margin: 0; padding-top: 10px; border-top: 1px solid var(--model-line); font-size: 12.5px; line-height: 1.55; color: var(--model-ink-3); }
.language-model select:focus-visible, .generation-reason:focus-visible, .generated-output:focus-visible { outline: 3px solid var(--os-ring, #ffce8b); outline-offset: 2px; }
/* One scroll surface in the desktop window; disclosures expand below the task. */
.app-language-model .window-body { display: flex; padding: 0; overflow: hidden; }
.app-language-model .language-model { flex: 1 1 auto; min-width: 0; height: 100%; }
.app-language-model .model-layout { height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255, 244, 228, .26) transparent; }
.app-language-model .model-main { padding: clamp(18px, 4cqw, 34px) 22px 28px; }
/* Compact native-size controls in the desktop with a fine pointer; 44 px targets come back below. */
.desktop-window .language-model select { min-height: 0; height: 28px; font-size: 13px; }
.desktop-window .model-prompt { font-size: 14px; }
.desktop-window .model-actions button { height: 28px; font-size: 13px; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .model-progress[data-mode=indeterminate] .model-progress-fill { width: 100%; animation: none; opacity: .45; }
  .language-model[data-model-state=running] .generated-text::after { animation: none; }
  .model-progress-fill { transition: none; }
  .dock-icon { transition: none; }
  .dock-app:hover .dock-icon { transform: none; }
  .dock-label { transition: opacity .12s; }
}

/* ---------- Touch and narrow: 44 px targets, one full-surface window ---------- */
@media (max-width: 700px), (pointer: coarse) {
  .desktop-shell { --os-bar-h: 44px; }
  .menu-title, .menu-return { min-height: 44px; }
  .menu-title { line-height: 44px; border-radius: 0; }
  .menu-title[data-menu] { min-width: 44px; }
  .menu-return { height: 32px; min-height: 32px; margin: 6px 0; padding: 0 12px 0 22px; position: relative; }
  /* The visible pill stays compact; its hit area reaches the full bar height. */
  .menu-return::after { content: ''; position: absolute; left: -2px; right: -2px; top: -7px; bottom: -7px; }
  .menu-item { height: 44px; font-size: 15px; }
  .window-titlebar { height: 44px; }
  .window-control { width: 44px; height: 44px; }
  .window-control::before { left: 16px; top: 16px; }
  .window-controls { padding-left: 0; }
  .window-title { line-height: 44px; font-size: 14px; padding: 0 12px 0 140px; text-align: left; touch-action: manipulation; }
  .desktop-window .window-body button, .desktop-window .file-toolbar button, .desktop-window .file-views button,
  .desktop-window .terminal-form button, .desktop-window .model-actions button { height: auto; min-height: 44px; min-width: 44px; }
  .desktop-window .outbound-actions a, .app-about .window-body > a { height: auto; min-height: 44px; }
  .desktop-window .language-model select { height: auto; min-height: 44px; }
  .terminal-form input { height: auto; min-height: 44px; }
  .file-toolbar { height: 52px; }
  .dock-app { width: 48px; height: 56px; }
  .dock-app[data-open=true]::after { left: 22px; top: 50px; }
  .dock-app[data-minimized=true]::after { left: 18px; }
}
@media (max-width: 700px) {
  .menu-bar { padding: 0 4px; gap: 4px; }
  /* Every menu stays reachable: the titles scroll sideways, fading at the edge instead of clipping hard. */
  .menu-bar-start { overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent); }
  .menu-bar-start::-webkit-scrollbar { display: none; }
  .menu-title { padding: 0 10px; }
  .menu-app-name { max-width: 150px; }
  .menu-bar .menu-brand-label { display: none; }
  .menu-popover { left: 4px; right: 4px; min-width: 0; max-width: none; }
  .desktop-window { border-radius: 10px; }
  .desktop-window:not([data-focused=true]) { visibility: hidden; }
  .window-body { padding: 18px 18px 22px; }
  .window-body h2 { font-size: 19px; }
  .project-folders { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px 10px; }
  .project-detail { padding: 16px 18px 22px; }
  .file-toolbar { gap: 8px; padding: 0 8px; }
  .desktop-window .terminal-app { padding: 8px 10px; }
  .terminal-form { gap: 6px; }
  .app-notes .window-body, .app-about .window-body { padding: 24px 20px 30px; }
  .desktop-dock { gap: 1px; margin: 4px auto max(6px, env(safe-area-inset-bottom)); padding: 3px 4px; border-radius: 16px; }
  .dock-app { width: 46px; }
  .dock-icon { width: 40px; height: 40px; }
  .dock-app[data-open=true]::after { left: 21px; top: 48px; }
  .dock-app[data-minimized=true]::after { left: 17px; }
  .dock-label { font-size: 12px; }
  .app-language-model .model-main { padding: 14px 14px 20px; }
  .model-disclosure-title { padding-block: 14px; }
  .model-actions button { flex: 1 1 120px; }
  .generated-output, .recorded-sample { padding: 12px 13px; }
}
@media (max-width: 520px) {
  .menu-return-label { display: none; }
  .menu-return-short { display: inline; }
}
@media (max-width: 400px) {
  .menu-clock { display: none; }
}
