/* SkullSeed desktop shell */

:root {
  --menubar-h: 40px;
  --titlebar-h: 38px;
}

/* ---------- Page modes ---------- */

html:not(.js) .js-only { display: none !important; }
html.js .fallback { display: none; }

html, body { height: 100%; }

body {
  background-color: var(--wallpaper);
  transition: background-color 0.2s;
}

/* Wallpaper picture (menu: Show picture). Dithered pixel art, scaled in whole device pixels by
   fitPicture() so it stays crisp. ::before is the current picture; ::after the old one fading out. */
html.js body::before,
html.js body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--wallpaper-image, none) var(--wallpaper-position, center) / var(--wallpaper-size, cover) no-repeat;
  image-rendering: pixelated;
  pointer-events: none;
}
html.js body::after { background-image: var(--wallpaper-image-old, none); opacity: 0; }
html.picture-in body::before { animation: picture-in 0.2s both; }
html.picture-out body::after { animation: picture-out 0.2s both; }
html.wallpaper-fade.picture-in body::before,
html.wallpaper-fade.picture-out body::after { animation-duration: 3s; }
@keyframes picture-in { from { opacity: 0; } }
@keyframes picture-out { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  html.picture-in body::before,
  html.picture-out body::after { animation: none; }
}
/* Desktop icon names get a backing so they read on a busy picture */
html.has-picture .icon-label { background: color-mix(in srgb, var(--cream) 85%, transparent); }

html.js body {
  overflow: hidden;
  overscroll-behavior: none;
}

/* SVG icon strokes: 3px ink, rounded ends */
svg { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
svg .fill-cream { fill: var(--cream); }
svg .fill-ink { fill: var(--ink); stroke: none; }
.fox-svg .fox-halo { fill: var(--cream); }

/* ---------- Plain-content fallback (no JavaScript) ---------- */

.fallback {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}
.fallback article {
  background: var(--cream);
  border: var(--border);
  border-radius: var(--radius-window);
  box-shadow: var(--shadow-window);
  padding: 24px 28px;
  margin: 0 8px 36px 0;
}

/* ---------- Menu bar ---------- */

.menubar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100000;
  height: calc(var(--menubar-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 10px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--cream);
  border-bottom: var(--border);
  font: var(--weight-bold) 14px/1.2 var(--font);
}
.mb-group { display: flex; align-items: center; gap: 10px; }
.mb-menu { position: relative; }

.mb-btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  margin: 0;
  padding: 0 8px;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: var(--radius-small);
  font: inherit;
  cursor: var(--cursor);
}
.mb-btn:focus-visible { outline-offset: 2px; }
.mb-btn:hover,
.mb-btn[aria-expanded="true"] { background: var(--ink); color: var(--cream); }
.mb-btn:hover svg,
.mb-btn[aria-expanded="true"] svg { stroke: var(--cream); }
.mb-btn:hover svg .fill-cream,
.mb-btn[aria-expanded="true"] svg .fill-cream { fill: var(--ink); }
.mb-btn:hover svg .fill-ink,
.mb-btn[aria-expanded="true"] svg .fill-ink { fill: var(--cream); }

.swatch {
  display: inline-block;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: var(--border);
  flex: none;
}
.swatch-current { background: var(--wallpaper); transition: background-color 0.2s; }
/* Shuffle fades slowly to its next color */
html.wallpaper-fade body,
html.wallpaper-fade .swatch-current { transition-duration: 3s; }
.mb-chip:hover .swatch,
.mb-chip[aria-expanded="true"] .swatch { border-color: var(--cream); }

/* Weather: an icon and the temperature where the visitor is, left of the clock */
.weather { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.weather[hidden] { display: none; }
.weather svg { width: 18px; height: 18px; stroke-width: 2.5; flex: none; }

.clock { padding: 0 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Taskbar: one button per open window. The front window's is ink; minimized ones are dithered. */
.taskbar { flex: 1; min-width: 0; align-self: stretch; margin: 0 12px; }
.task-list {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
}
.task {
  flex: 0 1 170px;
  min-width: 48px;
  display: flex;
  align-items: center;
  height: 28px;
  background: var(--cream);
  color: var(--ink);
  border: var(--border);
  border-radius: var(--radius-small);
  overflow: hidden;
}
.task.is-active { background: var(--ink); color: var(--cream); }
.task.is-minimized { background-image: var(--dither-light); }
.task-btn {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0 8px;
  background: transparent;
  color: inherit;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: var(--cursor);
}
.task-btn:focus-visible { outline-offset: -5px; }
.task-name {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.task.is-minimized .task-name { display: inline-block; max-width: 100%; vertical-align: middle; padding: 0 4px; border-radius: 4px; background: var(--cream); }
.task:not(.is-active):hover .task-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* Skullamp minimized: the taskbar button becomes a mini player */
.task-player, .task-progress { display: none; }
.task--player.is-minimized { flex-basis: 250px; min-width: 150px; background-image: none; }
.task--player.is-minimized .task-player { display: flex; flex: none; padding-left: 2px; border-right: var(--border); }
.task--player.is-minimized .task-progress {
  display: block;
  position: absolute;
  left: 0; bottom: 0;
  height: 3px;
  background: var(--ink);
}
.task-ctrl {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 22px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: var(--cursor);
}
.task-ctrl svg { width: 16px; height: 16px; stroke-width: 3; }
.task-ctrl svg .solid { fill: var(--ink); }
.task-ctrl:hover:not(:disabled) { background: var(--ink); }
.task-ctrl:hover:not(:disabled) svg { stroke: var(--cream); }
.task-ctrl:hover:not(:disabled) svg .solid { fill: var(--cream); }
.task-ctrl:active:not(:disabled) { transform: translate(1px, 1px); }
.task-ctrl:disabled svg { opacity: 0.35; }
.task-ctrl:focus-visible { outline-offset: -2px; }

/* Dropdowns */
.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 200px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--cream);
  border: var(--border);
  border-radius: var(--radius-icon);
  box-shadow: var(--shadow-small);
}
.dropdown[hidden] { display: none; }
.dropdown-right { left: auto; right: 0; }

.dd-item {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 7px 10px;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: var(--radius-small);
  font: var(--weight-bold) 14px/1.2 var(--font);
  text-align: left;
  cursor: var(--cursor);
}
.dd-item:hover,
.dd-item:focus-visible { background: var(--ink); color: var(--cream); }
.dd-item:focus-visible { outline-offset: 2px; }
.dd-item .dd-label { flex: 1; }
.dd-item .check { visibility: hidden; flex: none; }
.dd-item .dd-icon { flex: none; }
.dd-item[aria-checked="true"] .check { visibility: visible; }
.dd-sep { height: 0; margin: 6px 4px; border-top: 2px solid var(--ink); opacity: 0.25; }
.dd-item:hover svg,
.dd-item:focus-visible svg { stroke: var(--cream); }
.dd-item:hover .swatch,
.dd-item:focus-visible .swatch { border-color: var(--cream); }

/* ---------- Desktop and icons ---------- */

.desktop {
  position: fixed;
  top: calc(var(--menubar-h) + env(safe-area-inset-top, 0px));
  left: 0; right: 0; bottom: 0;
}

.icons {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(auto-fill, 112px);
  grid-auto-columns: 116px;
  align-content: start;
  justify-content: start;
  gap: 6px 10px;
  height: 100%;
  padding: 24px 20px;
}

.icon {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 116px;
  margin: 0;
  padding: 6px 2px;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: var(--radius-small);
  cursor: var(--cursor);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.icon-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px; height: 54px;
}
/* The shadow follows each icon's own shape: folder, page, envelope, or app. */
.icon-tile > svg,
.icon-tile > img {
  display: block;
  width: 48px; height: 48px;
  filter: drop-shadow(5px 5px 0 var(--ink));
  transition: transform 0.08s, filter 0.08s;
}
.icon-label {
  max-width: 100%;
  padding: 1px 7px;
  border-radius: 5px;
  font: var(--weight-bold) 14px/1.2 var(--font);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon.is-selected .icon-tile > * { transform: translate(2px, 2px); filter: drop-shadow(3px 3px 0 var(--ink)); }
.icon.is-selected .icon-label { background: var(--ink); color: var(--cream); }

/* ---------- Windows ---------- */

.window-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.win {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--cream);
  border: var(--border);
  border-radius: var(--radius-window);
  box-shadow: var(--shadow-window);
  overflow: hidden;
  pointer-events: auto;
}
.win:focus { outline: none; }
.win:focus-visible { outline: none; } /* the window itself isn't a control; its buttons show the ring */

.win-titlebar {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  height: var(--titlebar-h);
  padding: 0 10px;
  background-color: var(--cream);
  border-bottom: var(--border);
  cursor: var(--cursor);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.win-titlebar:focus-visible { outline-offset: -8px; }
.win.is-dragging .win-titlebar { cursor: var(--cursor); }
.win.is-maximized .win-titlebar { cursor: var(--cursor); }

.win-controls { position: relative; z-index: 1; display: flex; gap: 2px; }

.win-ctrl {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: var(--cursor);
}
.win-ctrl::before {
  content: "";
  width: 14px; height: 14px;
  border-radius: 50%;
  border: var(--border);
  background: var(--cream);
}
.win-ctrl:focus-visible { outline-offset: 0; }
.win.is-active .win-close::before { background: var(--ink); }
.win-ctrl:hover::before { background: var(--ink); }
.win-ctrl:active::before { transform: translate(1px, 1px); }

.win-title {
  position: absolute;
  left: 96px; right: 96px;
  text-align: center;
  font: var(--weight-bold) 14px/1.2 var(--font);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.win-title span { padding: 2px 6px; border-radius: 4px; background: var(--cream); }

/* Inactive: light dither title bar, all circles outlined, title on a cream patch */
.win:not(.is-active) .win-titlebar {
  background-image: var(--dither-light);
}

.win-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 24px 28px 32px;
  overscroll-behavior: contain;
}
.win-body > :last-child { margin-bottom: 0; }

.win[hidden] { display: none !important; }
.win.is-shaded { height: auto !important; }
.win.is-shaded .win-titlebar { border-bottom: 0; }
.win.is-shaded .win-body,
.win.is-shaded .grow { display: none; }

/* Scrollbars: 16px, medium dither track, 3px ink left border */
.scroll::-webkit-scrollbar { width: 19px; height: 19px; }
.scroll::-webkit-scrollbar-track {
  background-color: var(--cream);
  background-image: var(--dither-medium);
  border-left: var(--border);
}
.scroll::-webkit-scrollbar-thumb {
  background: var(--cream);
  border: var(--border);
  border-radius: 4px;
}
.scroll::-webkit-scrollbar-corner { background: var(--cream); }
@supports not selector(::-webkit-scrollbar) {
  .scroll { scrollbar-color: var(--ink) var(--cream); }
}

/* Grow box */
.grow {
  position: absolute;
  right: 0; bottom: 0;
  width: 22px; height: 22px;
  background-color: var(--cream);
  background-image: var(--dither-medium);
  border-top: var(--border);
  border-left: var(--border);
  border-top-left-radius: 4px;
  cursor: nwse-resize;
  touch-action: none;
}
.grow:focus-visible { outline-offset: -2px; }
.win.is-maximized .grow { display: none; }

/* Window content */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 20px; }
.small { font-size: 14px; }

/* ---------- Finder ---------- */

.win-body.is-flush { display: flex; padding: 0; overflow: hidden; }

.finder { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }


.pathbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: var(--border);
  font: var(--weight-bold) 14px/1.2 var(--font);
}
.square-btn {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 30px;
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  border: var(--border);
  border-radius: var(--radius-small);
  cursor: var(--cursor);
}
.square-btn:hover:not(:disabled) { background: var(--ink); }
.square-btn:hover:not(:disabled) svg { stroke: var(--cream); }
.square-btn:active:not(:disabled) { transform: translate(1px, 1px); }
.square-btn:focus-visible { outline-offset: 2px; }
.square-btn:disabled { background-image: var(--dither-light); cursor: var(--cursor); }

.crumbs { flex: 1; min-width: 0; overflow: hidden; }
.crumbs ol { display: flex; margin: 0; padding: 0; list-style: none; white-space: nowrap; }
.crumbs li { display: flex; align-items: center; min-width: 0; }
.crumbs li:last-child { flex-shrink: 0; }
.crumb-sep { padding: 0 6px; }
.crumb {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  padding: 2px 0;
  background: transparent;
  color: var(--ink);
  border: 0;
  font: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
button.crumb { cursor: var(--cursor); }
button.crumb:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.item-count { flex: none; }

/* View switch: Gallery, List, Columns. The current view is inverted. */
.view-switch { flex: none; display: inline-flex; }
.view-btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 30px;
  margin: 0;
  padding: 0;
  background: var(--cream);
  border: var(--border);
  border-radius: 0;
  cursor: var(--cursor);
}
.view-btn + .view-btn { margin-left: -3px; }
.view-btn:first-child { border-radius: var(--radius-small) 0 0 var(--radius-small); }
.view-btn:last-child { border-radius: 0 var(--radius-small) var(--radius-small) 0; }
.view-btn svg { stroke-width: 2.5; }
.view-btn:hover svg { transform: scale(1.1); }
.view-btn[aria-pressed="true"] { background: var(--ink); }
.view-btn[aria-pressed="true"] svg { stroke: var(--cream); }
.view-btn[aria-pressed="true"] svg .fill-ink { fill: var(--cream); }
.view-btn:focus-visible { position: relative; z-index: 1; outline-offset: 2px; }

.finder-view { flex: 1; min-height: 0; overflow-y: auto; }
.finder-view[data-view="columns"] { display: flex; overflow: hidden; }
.finder-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 14px 4px;
  align-content: start;
  margin: 0;
  padding: 18px 12px 28px;
  list-style: none;
}
.finder-items li { display: flex; justify-content: center; min-width: 0; }
.icon.icon--finder { width: 116px; }
.icon--finder .icon-tile > * { filter: drop-shadow(4px 4px 0 var(--ink)); }
.icon--finder.is-selected .icon-tile > * { filter: drop-shadow(2px 2px 0 var(--ink)); }
.finder-note { margin: 0; padding: 24px; }

/* Rows shared by List and Columns */
.f-row,
.f-crow {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  width: 100%;
  margin: 0;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: var(--radius-small);
  font: var(--weight-bold) 14px/1.2 var(--font);
  text-align: left;
  cursor: var(--cursor);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.f-row svg, .f-crow svg, .f-row img, .f-crow img { flex: none; }
.f-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-row:focus-visible, .f-crow:focus-visible { outline-offset: 1px; }
.f-row.is-selected, .f-crow.is-selected, .f-crow.is-open { background: var(--ink); color: var(--cream); }
.f-row.is-selected svg, .f-crow.is-selected svg, .f-crow.is-open svg { stroke: var(--cream); }
.f-row.is-selected svg .fill-cream, .f-crow.is-selected svg .fill-cream, .f-crow.is-open svg .fill-cream { fill: var(--ink); }
.f-row.is-selected svg .fill-ink, .f-crow.is-selected svg .fill-ink, .f-crow.is-open svg .fill-ink { fill: var(--cream); }

/* List */
.f-list { padding: 0 8px 20px; }
.f-list-head,
.f-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 76px 80px; gap: 12px; }
.f-list-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 10px 6px;
  background: var(--cream);
  border-bottom: var(--border);
  font: var(--weight-bold) 14px/1.2 var(--font);
}
.f-rows { margin: 6px 0 0; padding: 0; list-style: none; }
.f-row { align-items: center; padding: 5px 10px; }
.f-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.f-date, .f-size, .f-kind { font-weight: var(--weight-regular); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-size { font-variant-numeric: tabular-nums; }
/* Zebra stripes help the eye follow a row across. A faint ink wash rather than dither,
   because text never sits on dither: the one place the UI uses a tint. */
.f-rows li:nth-child(even) .f-row:not(.is-selected) { background: rgba(43, 42, 40, 0.07); }
.f-row:hover .f-text { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.f-row.is-selected .f-text { text-decoration: none; }

/* Columns: one per folder, then the preview */
.f-columns { display: flex; flex: 1; min-width: 0; overflow-x: auto; overflow-y: hidden; }
.f-columns.scroll::-webkit-scrollbar-track { border-left: 0; border-top: var(--border); }
.f-col {
  flex: none;
  width: 210px;
  margin: 0;
  padding: 6px;
  list-style: none;
  overflow-y: auto;
  border-right: var(--border);
}
.f-crow { gap: 8px; padding: 5px 6px 5px 8px; }
.f-crow:hover .f-text { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.f-crow.is-open .f-text, .f-crow.is-selected .f-text { text-decoration: none; }
.f-chevron { stroke-width: 3; }
.f-empty { padding: 8px; font-weight: var(--weight-regular); }

.f-preview {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 250px;
  padding: 16px 18px 24px;
  overflow-y: auto;
  text-align: center;
}
.f-preview > * { flex: none; }   /* scroll when short, never squash */
.f-preview-art { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 100px; margin-bottom: 10px; }
.f-preview-art > svg, .f-preview-art img:not(.f-thumb) { filter: drop-shadow(4px 4px 0 var(--ink)); }
.f-thumb { display: block; max-width: 100%; max-height: 130px; border: var(--border); border-radius: var(--radius-small); }
.f-preview-name { margin: 0 0 12px; font: var(--weight-bold) 16px/1.3 var(--font); overflow-wrap: anywhere; }
.f-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0 0 18px; font-size: 14px; text-align: left; }
.f-meta dt { font-weight: var(--weight-bold); text-align: right; }
.f-meta dd { margin: 0; }

/* ---------- Viewers ---------- */

html.is-moving iframe { pointer-events: none; }
/* A click on a background window's page brings the window forward first (desktop.js), like a Mac. */
.win:not(.is-active) iframe { pointer-events: none; }
html.is-moving { cursor: var(--cursor); }

.viewer { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }

.viewer-bar,
.viewer-toolbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  font: var(--weight-bold) 14px/1.2 var(--font);
}
.viewer-bar { justify-content: center; border-top: var(--border); padding-right: 30px; padding-left: 30px; }
.viewer-bar[hidden] { display: none; }
.viewer-toolbar { border-bottom: var(--border); }

.img-mat {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--ink);
}
.img-mat img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
/* Image loading: the image hides while it loads; after a moment the fox runs in its place */
.img-hold.is-waiting > img, .img-hold.is-broken > img { display: none; }
.fox-loader, .img-broken { display: none; }
.img-hold.is-loading > .fox-loader { display: flex; }
.img-hold.is-broken > .img-broken { display: block; }
.img-broken { margin: 0; color: var(--cream); font-weight: var(--weight-bold); }

.fox-loader {
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 14px 18px 10px;
  background: var(--cream);
  color: var(--ink);
  border: var(--border);
  border-radius: var(--radius-small);
}
.fox-svg { display: block; max-width: 100%; height: auto; fill: var(--ink); stroke: none; }
.fox-label { margin: 0; font: var(--weight-bold) 15px/1.2 var(--font); letter-spacing: 0.04em; }
.fox-loader--small { padding: 8px 10px 6px; }
.fox-loader--small .fox-svg { width: 144px; }
.fox-loader--small .fox-label { font-size: 13px; }
.f-preview .img-hold { display: flex; justify-content: center; }
.f-preview .img-hold.is-broken::after { content: '?'; font: var(--weight-bold) 40px/1 var(--font); }

/* Animated in whole pixels (one user unit per step) so the art never blurs.
   Reduced motion stops everything on the first frame (see skullseed.css). */
.fox-near { animation: fox-scroll-near 0.6s steps(24) infinite; }
.fox-far { animation: fox-scroll-far 3.6s steps(36) infinite; }
.fox-f1 { animation: fox-frame-a 0.3s steps(1, end) infinite; }
.fox-f2 { opacity: 0; animation: fox-frame-b 0.3s steps(1, end) infinite; }
.fox-dots span { animation: fox-dot 1.2s steps(1, end) infinite; }
.fox-dots span:nth-child(2) { animation-delay: 0.2s; }
.fox-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes fox-scroll-near { to { transform: translateX(-24px); } }
@keyframes fox-scroll-far { to { transform: translateX(-36px); } }
@keyframes fox-frame-a { from { opacity: 1; } 50% { opacity: 0; } to { opacity: 0; } }
@keyframes fox-frame-b { from { opacity: 0; } 50% { opacity: 1; } to { opacity: 1; } }
@keyframes fox-dot { from { opacity: 0; } 25% { opacity: 1; } to { opacity: 1; } }

.img-count { min-width: 60px; text-align: center; font-variant-numeric: tabular-nums; }

.viewer--text { overflow-y: auto; padding: 28px 32px 40px; }
.viewer--text:focus-visible { outline-offset: -8px; }
.viewer--text > * { max-width: 68ch; }
.plain-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.md h2 { font-size: 22px; margin-top: 1.2em; }
.md h3 { font-size: 18px; margin-top: 1.2em; }
.md h4 { font-size: 16px; margin-top: 1.2em; }
.md > :first-child { margin-top: 0; }
.md ul, .md ol { margin: 0 0 1em; padding-left: 1.4em; }
.md li { margin-bottom: 0.25em; }
.md blockquote { margin: 0 0 1em; padding-left: 16px; border-left: var(--border); }
.md hr { border: 0; border-top: var(--border); margin: 1.5em 0; }
.md img { max-width: 100%; border: var(--border); border-radius: var(--radius-small); }
.md code { font-size: 0.92em; padding: 1px 5px; border: 2px solid var(--ink); border-radius: 4px; }
.md pre { margin: 0 0 1em; padding: 12px 14px; border: var(--border); border-radius: var(--radius-button); overflow-x: auto; }
.md pre code { padding: 0; border: 0; }
.md strong { font-weight: var(--weight-bold); }

.path-field {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  background: var(--cream);
  color: var(--ink);
  border: var(--border);
  border-radius: var(--radius-small);
  font: var(--weight-regular) 14px/1.2 var(--font);
}
.path-field:focus-visible { outline-offset: 2px; }
.viewer--html .btn-link { flex: none; font-size: 14px; }
.app-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: var(--cream); }

/* ---------- Browser ---------- */

.browser { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.br-toolbar { gap: 6px; }
.br-address {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  margin-left: 4px;
  padding: 0 10px;
  background: #fff;
  border: var(--border);
  border-radius: 999px;
  font-weight: var(--weight-regular, 400);
}
.br-lock { display: inline-flex; flex: none; }
.br-lock[hidden] { display: none; }
.br-lock svg { stroke-width: 2.2; }
.br-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.br-out[hidden] { display: none; }

.br-marks {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-bottom: var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.br-mark {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 26px;
  margin: 0;
  padding: 0 10px;
  background: transparent;
  color: var(--ink);
  border: 2px solid transparent;
  border-radius: var(--radius-small);
  font: var(--weight-bold) 13px/1 var(--font);
  cursor: var(--cursor);
}
.br-home { padding: 0 6px; }
.br-home svg { stroke-width: 2.4; }
.br-mark:hover { border-color: var(--ink); }
.br-mark[aria-current="page"] { background: var(--ink); color: var(--cream); }
.br-mark[aria-current="page"] svg { stroke: var(--cream); }
.br-mark:focus-visible { outline-offset: 1px; }

.br-view { position: relative; flex: 1; min-height: 0; display: flex; }
.br-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
.br-start {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
  /* A soft wash of the wallpaper color, so it follows the color menu (and Shuffle) */
  background: var(--cream);
  background: color-mix(in srgb, var(--wallpaper) 28%, var(--cream));
  transition: background-color 0.2s;
}
html.wallpaper-fade .br-start { transition-duration: 3s; }
.br-start[hidden] { display: none; }
.br-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

/* Bookmark cards drawn as tiny browser windows, all as tall as the tallest in their row */
.br-tiles li { display: flex; }
.br-tile {
  flex: 1;
  position: relative;
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0;
  padding: 0;
  text-align: left;
  background: var(--cream);
  color: var(--ink);
  border: var(--border);
  border-radius: var(--radius-icon);
  box-shadow: var(--shadow-small);
  overflow: hidden;
  font: inherit;
  cursor: var(--cursor);
  transition: transform 0.12s, box-shadow 0.12s;
}
.br-tile:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }
.br-tile:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.br-tile:focus-visible { outline-offset: 4px; }
.br-tile-bar {
  display: flex;
  gap: 5px;
  padding: 6px 8px;
  border-bottom: var(--border);
}
.br-tile-bar i { width: 9px; height: 9px; border: 2px solid var(--ink); border-radius: 50%; }
.br-tile-shot {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  background: #fff var(--dither-light);
  border-bottom: var(--border);
  overflow: hidden;
}
.br-tile-shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.br-tile:hover .br-tile-shot img { transform: scale(1.03); }
.br-tile-shot img { transition: transform 0.25s; transform-origin: top; }
/* A client's logo (white on clear) instead of a picture of the page */
.br-tile-shot.is-logo { background: var(--ink); padding: 12% 14%; }
.br-tile-shot.is-logo img { object-fit: contain; object-position: center; transform-origin: center; }
.br-tile-flag {
  /* A ribbon across the card's top-right corner that springs in from outside it */
  position: absolute;
  top: 27px; right: -46px;
  z-index: 1;
  width: 170px;
  padding: 3px 0;
  background: var(--wallpaper);
  color: var(--ink);
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  font-size: 11px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 3px 0 rgba(43, 42, 40, 0.35);
  transform: rotate(45deg);
  animation: br-flag-in 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) 0.25s both;
}
@keyframes br-flag-in {
  from { transform: translate(70px, -70px) rotate(45deg); }
  to { transform: rotate(45deg); }
}
.br-tile-initial {
  display: grid;
  place-items: center;
  width: 56px; height: 56px;
  background: var(--cream);
  border: var(--border);
  border-radius: 50%;
  font-weight: var(--weight-bold);
  font-size: 26px;
}
.br-tile-text { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; min-width: 0; }
.br-tile-name { font-weight: var(--weight-bold); font-size: 15px; line-height: 1.25; }
@media (prefers-reduced-motion: reduce) {
  .br-tile, .br-tile-shot img { transition: none; }
  .br-tile:hover { transform: none; box-shadow: var(--shadow-small); }
  .br-tile:hover .br-tile-shot img { transform: none; }
}

/* A sliding stripe along the top while a page loads */
.br-loading {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  overflow: hidden;
  pointer-events: none;
}
.br-loading[hidden] { display: none; }
.br-loading::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 30%;
  background: var(--ink);
  animation: br-load 1.1s ease-in-out infinite;
}
@keyframes br-load { from { left: -30%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .br-loading::before { animation: none; left: 0; width: 100%; opacity: 0.5; }
}
.viewer--html iframe { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }

/* ---------- Games (the game launcher) ---------- */

.games { position: relative; display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; container-type: inline-size; }
.gm-top svg { flex: none; stroke-width: 3.5; }
.gm-brand { flex: 1; font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; }
.gm-count { flex: none; font-weight: var(--weight-regular); }

.gm-main { flex: 1; min-height: 0; display: flex; }
.gm-main[inert] { visibility: hidden; }

/* The game list: a sidebar, the selected game inverted */
.gm-list {
  flex: none;
  width: 220px;
  margin: 0;
  padding: 8px;
  list-style: none;
  overflow-y: auto;
  border-right: var(--border);
}
.gm-item {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0 0 2px;
  padding: 5px 8px;
  background: transparent;
  color: var(--ink);
  border: 2px solid transparent;
  border-radius: var(--radius-small);
  font: var(--weight-bold) 14px/1.2 var(--font);
  text-align: left;
  cursor: var(--cursor);
}
.gm-item:hover { border-color: var(--ink); }
.gm-item[aria-current="true"] { background: var(--ink); color: var(--cream); }
.gm-item:focus-visible { outline-offset: 1px; }
.gm-item-icon { flex: none; display: flex; width: 28px; height: 28px; }
.gm-item-icon > * { width: 28px; height: 28px; }
.gm-item[aria-current="true"] .gm-item-icon > * { outline: 2px solid var(--cream); border-radius: 8px; }
.gm-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-running {
  flex: none;
  padding: 1px 6px;
  border: 2px solid currentColor;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.gm-running[hidden] { display: none; }

/* The selected game: a hero band in the wallpaper color, then Play and the stats */
.gm-detail { flex: 1; min-width: 0; overflow-y: auto; }
.gm-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 32px 28px;
  border-bottom: var(--border);
  background: var(--wallpaper);
  transition: background-color 0.2s;
}
html.wallpaper-fade .gm-hero { transition-duration: 3s; }
.gm-hero-icon { flex: none; display: flex; }
.gm-hero-icon > * { width: 96px; height: 96px; filter: drop-shadow(6px 6px 0 var(--ink)); }
.gm-hero-text { min-width: 0; }
.gm-title { margin: 0; font-size: 32px; line-height: 1.1; overflow-wrap: anywhere; }
.gm-genre { margin: 6px 0 0; font-weight: var(--weight-bold); font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; }

.gm-playbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
  padding: 20px 28px;
  border-bottom: var(--border);
  background: color-mix(in srgb, var(--wallpaper) 28%, var(--cream));
  transition: background-color 0.2s;
}
html.wallpaper-fade .gm-playbar { transition-duration: 3s; }
.gm-play { padding: 12px 28px; font-size: 18px; }
.gm-play svg { stroke: var(--cream); }
.gm-stats { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0; }
.gm-stats dt { font-size: 12px; font-weight: var(--weight-bold); letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.75; }
.gm-stats dd { margin: 2px 0 0; font-weight: var(--weight-bold); font-size: 15px; }
.gm-blurb { max-width: 60ch; margin: 0; padding: 20px 28px 28px; }
.gm-empty { padding: 28px; }

/* Narrow window: the list becomes a row of games along the top */
@container (max-width: 560px) {
  .gm-main { flex-direction: column; }
  .gm-list { display: flex; gap: 4px; width: auto; padding: 6px 8px; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: var(--border); }
  .gm-list li { flex: none; }
  .gm-item { width: auto; margin: 0; }
  .gm-hero { gap: 16px; padding: 20px; }
  .gm-hero-icon > * { width: 64px; height: 64px; filter: drop-shadow(4px 4px 0 var(--ink)); }
  .gm-title { font-size: 24px; }
  .gm-playbar, .gm-blurb { padding-left: 20px; padding-right: 20px; }
}

/* Start-up: the logo, a stepped progress bar, a status line. Cream on ink, like the boot screen. */
.gm-boot {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--ink);
  color: var(--cream);
  cursor: var(--cursor);
  transition: opacity 0.25s;
}
.gm-boot.is-done { opacity: 0; pointer-events: none; }
.gm-boot svg { stroke: var(--ink); filter: drop-shadow(5px 5px 0 var(--wallpaper)); }
.gm-boot-name { margin: 0; font-weight: var(--weight-bold); font-size: 28px; letter-spacing: 0.2em; text-transform: uppercase; }
.gm-boot-bar { display: block; width: min(240px, 60%); height: 16px; padding: 2px; border: 3px solid var(--cream); border-radius: 4px; }
.gm-boot-bar i { display: block; height: 100%; background: var(--cream); animation: gm-load 1.4s steps(12, end) both; }
@keyframes gm-load { from { width: 0; } to { width: 100%; } }
.gm-boot-step { min-height: 1.4em; margin: 0; font-size: 14px; }

/* ---------- Mail (contact form) ---------- */

html.js .nojs-only { display: none !important; }

.mail {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  font: var(--weight-bold) 14px/1.2 var(--font);
}
.mail[hidden] { display: none; }
.mail-head { flex: none; padding: 8px 0; border-bottom: var(--border); }
.mail-row { display: flex; align-items: center; gap: 10px; padding: 5px 14px; }
.mail-label { flex: none; width: 58px; text-align: right; }

/* "To" is fixed: a chip, never an address */
.mail-to {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px 3px 4px;
  background: var(--ink);
  color: var(--cream);
  border-radius: 999px;
}
.mail-to svg { stroke: var(--ink); stroke-width: 3; }

.mail-field {
  flex: 1;
  min-width: 0;
  height: 32px;
  margin: 0;
  padding: 0 10px;
  background: var(--cream);
  color: var(--ink);
  border: var(--border);
  border-radius: var(--radius-small);
  font: var(--weight-regular) 15px/1.2 var(--font);
}
.mail-field:focus-visible { outline-offset: 2px; }
.mail-field::placeholder,
.mail-body::placeholder { color: var(--ink); opacity: 0.55; }

.mail-body {
  flex: 1;
  min-height: 120px;
  width: 100%;
  margin: 0;
  padding: 16px 18px;
  background: var(--cream);
  color: var(--ink);
  border: 0;
  border-radius: 0;
  resize: none;
  font: var(--weight-regular) 16px/1.6 var(--font);
}
.mail-body:focus-visible { outline-offset: -8px; }

/* The honeypot: off-screen for people, still in the form for bots */
.mail-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.mail-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 30px 10px 14px;
  border-top: var(--border);
}
.mail-status { flex: 1; min-width: 0; margin: 0; }
.mail-send:disabled { cursor: var(--cursor); background-image: var(--dither-light); background-color: var(--cream); color: var(--ink); }

.mail-sent {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 24px 32px;
  text-align: center;
}
.mail-sent svg { margin-bottom: 8px; filter: drop-shadow(4px 4px 0 var(--ink)); }
.mail-sent h2:focus { outline: none; }
.mail-sent p { max-width: 36ch; margin-bottom: 18px; }

/* Without JavaScript the form sits in the plain page */
.fallback .mail { border: var(--border); border-radius: var(--radius-button); overflow: hidden; }
.fallback .mail-body { min-height: 200px; }

/* ---------- Skullamp (music player) ---------- */

.player {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 14px 14px 12px;
  overflow-y: auto;
  font: var(--weight-bold) 14px/1.2 var(--font);
}

/* The "LCD": ink panel, cream type, with a cream bezel line inside */
.amp-display {
  flex: none;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "time vis" "marquee marquee" "info info";
  align-items: center;
  gap: 8px 14px;
  padding: 12px 14px;
  background: var(--ink);
  color: var(--cream);
  border-radius: var(--radius-button);
  box-shadow: inset 0 0 0 3px var(--ink), inset 0 0 0 5px var(--cream);
}
.amp-display.has-art {
  grid-template-columns: auto auto 1fr;
  grid-template-areas: "art time vis" "art marquee marquee" "art info info";
}
/* Always square. A cover that isn't square is cropped to fill, centered. */
.amp-art {
  grid-area: art;
  align-self: center;
  width: 104px;
  height: 104px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
  border: 2px solid var(--cream);
  border-radius: 4px;
}
.amp-art[hidden] { display: none; }
.amp-display svg { stroke: var(--cream); }
.amp-display svg .solid { fill: var(--cream); }
.amp-display :focus-visible { outline-color: var(--cream); outline-offset: 2px; }

.amp-time,
.amp-vis {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  border: 0;
  border-radius: 4px;
  cursor: var(--cursor);
}
.amp-time {
  grid-area: time;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 5.4ch;
  font: var(--weight-bold) 28px/1 var(--font);
  font-variant-numeric: tabular-nums;
}
.amp-state { display: flex; }
.amp-vis { grid-area: vis; display: block; min-width: 0; height: 40px; }
.amp-vis canvas { display: block; width: 100%; height: 100%; }

.amp-marquee {
  grid-area: marquee;
  min-width: 0;
  padding: 5px 8px;
  border: 2px solid var(--cream);
  border-radius: 4px;
}
.amp-marquee-clip { overflow: hidden; white-space: pre; text-overflow: ellipsis; }
.amp-marquee-clip.is-scrolling { text-overflow: clip; }
.amp-marquee-clip.is-scrolling .amp-marquee-text {
  display: inline-block;
  animation: amp-marquee linear infinite;
}
@keyframes amp-marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.amp-info {
  grid-area: info;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Sliders: dithered track, cream thumb with an ink border */
.amp-range {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 24px;
  margin: 0;
  background: transparent;
  cursor: var(--cursor);
}
.amp-range:disabled { cursor: var(--cursor); }
.amp-range:focus-visible { outline-offset: 2px; }
.amp-range::-webkit-slider-runnable-track {
  box-sizing: border-box;
  height: 14px;
  background-color: var(--cream);
  background-image: var(--dither-medium);
  border: var(--border);
  border-radius: var(--radius-small);
}
.amp-range::-moz-range-track {
  box-sizing: border-box;
  height: 14px;
  background-color: var(--cream);
  background-image: var(--dither-medium);
  border: var(--border);
  border-radius: var(--radius-small);
}
.amp-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 30px; height: 24px;
  margin-top: -8px;
  background: var(--cream);
  border: var(--border);
  border-radius: var(--radius-small);
}
.amp-range::-moz-range-thumb {
  box-sizing: border-box;
  width: 30px; height: 24px;
  background: var(--cream);
  border: var(--border);
  border-radius: var(--radius-small);
}
.amp-range:hover:not(:disabled)::-webkit-slider-thumb { background: var(--ink); }
.amp-range:hover:not(:disabled)::-moz-range-thumb { background: var(--ink); }
.amp-range:disabled::-webkit-slider-thumb { visibility: hidden; }
.amp-range:disabled::-moz-range-thumb { visibility: hidden; }
.amp-range--small::-webkit-slider-thumb { width: 20px; }
.amp-range--small::-moz-range-thumb { width: 20px; }

/* Transport: Winamp's five buttons, then Eject */
.amp-transport { flex: none; display: flex; gap: 6px; }
.amp-gap { flex: 1; }
.amp-btn { width: 44px; height: 38px; }
.amp-btn[data-action="toggle"] { width: 64px; }
.amp-btn svg .solid { fill: var(--ink); }
.amp-btn:hover:not(:disabled) svg .solid { fill: var(--cream); }
.amp-btn:disabled svg { visibility: hidden; }

.amp-options { flex: none; display: flex; align-items: center; gap: 8px; }
.amp-toggle {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  margin: 0;
  padding: 6px 12px;
  background: var(--cream);
  color: var(--ink);
  border: var(--border);
  border-radius: var(--radius-button);
  font: inherit;
  cursor: var(--cursor);
}
.amp-toggle:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.amp-toggle[aria-pressed="true"] { background: var(--ink); color: var(--cream); text-decoration: none; }
.amp-toggle:active { transform: translate(1px, 1px); }
.amp-toggle:focus-visible { outline-offset: 2px; }
.amp-volume { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; margin-left: 6px; }
.amp-volume .amp-range { flex: 1; min-width: 60px; }

/* Playlist */
.amp-playlist {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  border: var(--border);
  border-radius: var(--radius-button);
}
.amp-tracks { margin: 0; padding: 6px; list-style: none; }
.amp-track {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 6px 8px;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: var(--radius-small);
  font: inherit;
  text-align: left;
  cursor: var(--cursor);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.amp-track:focus-visible { outline-offset: 1px; }
.amp-track:hover .amp-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.amp-track[aria-current="true"] { background: var(--ink); color: var(--cream); }
.amp-track[aria-current="true"] .amp-name { text-decoration: none; }
.amp-track.is-failed .amp-name { text-decoration: line-through; text-decoration-thickness: 2px; }
.amp-num { flex: none; min-width: 2ch; font-variant-numeric: tabular-nums; }
.amp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amp-dur { flex: none; font-variant-numeric: tabular-nums; }
.amp-empty { padding: 8px; font-weight: var(--weight-regular); }

.amp-footer { flex: none; margin: 0; padding: 0 22px 0 4px; font-variant-numeric: tabular-nums; }

/* ---------- Read Me ---------- */

/* A hero band in two columns: the logo on its own black, then the wallpaper color (like the Games
   library) with a dot pattern that fades in from the right like the dithered wallpapers. */
.welcome-hero {
  display: flex;
  margin: 0 0 20px;
  border: var(--border);
  border-radius: var(--radius-icon);
  overflow: hidden;
}
.win-body > .welcome-hero { margin: -24px -28px 20px; border-width: 0 0 var(--border-width); border-radius: 0; }
.welcome-logo {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 144px;        /* square black area: 141px inside the border, as tall as the hero */
  min-height: 140px;
  background: #111;   /* the logo image's own background */
  border-right: var(--border);
}
/* The image has wide margins of its own: show it a little smaller and trim them to a 6px edge */
.welcome-logo-crop { display: block; width: 77px; height: 90px; overflow: hidden; }
.welcome-logo img { display: block; width: 118px; height: 118px; max-width: none; margin: -11px 0 0 -19px; }
.welcome-hero-text {
  position: relative;
  flex: 1;
  min-width: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 28px;
  background: var(--wallpaper);
  transition: background-color 0.2s;
}
html.wallpaper-fade .welcome-hero-text { transition-duration: 3s; }
.welcome-hero-text::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, var(--ink) 1.1px, transparent 1.6px) 0 0 / 7px 7px;
  opacity: 0.22;
  -webkit-mask-image: linear-gradient(100deg, transparent 35%, #000 100%);
  mask-image: linear-gradient(100deg, transparent 35%, #000 100%);
  pointer-events: none;
}
.welcome-hero-text > * { position: relative; }
.welcome-kicker {
  align-self: flex-start;
  margin: 0 0 8px;
  padding: 1px 8px;
  background: var(--ink);
  color: var(--cream);
  border-radius: var(--radius-small);
  font: var(--weight-bold) 12px/1.5 var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.welcome-title { margin: 0; font-size: 30px; line-height: 1.1; }
.welcome-sub { margin: 6px 0 0; font-weight: var(--weight-bold); }

.welcome-intro { font-size: 17px; line-height: 1.55; }

.welcome-label {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.welcome-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin: 0 0 26px;   /* clears the cards' 5px shadow */
  padding: 0;
  list-style: none;
}
/* Cards in a soft wash of the wallpaper color (like the Browser start page), lifting on hover */
.welcome-card {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 10px 14px;
  text-align: left;
  background: var(--cream);
  background: color-mix(in srgb, var(--wallpaper) 22%, var(--cream));
  color: var(--ink);
  border: var(--border);
  border-radius: var(--radius-icon);
  box-shadow: var(--shadow-small);
  font: inherit;
  cursor: var(--cursor);
  transition: transform 0.12s, box-shadow 0.12s, background-color 0.2s;
}
html.wallpaper-fade .welcome-card { transition-duration: 0.12s, 0.12s, 3s; }
.welcome-card:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }
.welcome-card:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.welcome-card:focus-visible { outline-offset: 4px; }
.welcome-card-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  background: var(--wallpaper);
  border: var(--border);
  border-radius: var(--radius-button);
  transition: background-color 0.2s;
}
html.wallpaper-fade .welcome-card-icon { transition-duration: 3s; }
.welcome-card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.welcome-card-text strong { font-size: 16px; }
.welcome-card-text span { font-size: 14px; line-height: 1.35; }
.welcome-note { margin: 0; font-size: 14px; }
.win[data-id="welcome"] .win-body { padding-bottom: 26px; }   /* matches the gap above the note */
@media (prefers-reduced-motion: reduce) {
  .welcome-card:hover, .welcome-card:active { transform: none; }
}
html.is-compact .win-body > .welcome-hero { margin: -20px -20px 20px; }
html.is-compact .welcome-logo { width: 120px; min-height: 120px; }
html.is-compact .welcome-hero-text { padding: 18px 16px; }
html.is-compact .welcome-title { font-size: 24px; }

/* A one-line status bar along a window's bottom edge (the Read Me's tip) */
.win-status {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 34px 6px 12px;
  border-top: var(--border);
  font-size: 13px;
  line-height: 1.35;
}
.win-status svg { flex: none; stroke-width: 2.2; }
.win-status p { margin: 0; }
/* The Read Me's tip: a band in a wash of the wallpaper color, with a lit bulb and a label */
.win-status--tip {
  gap: 12px;
  min-height: 52px;
  padding: 9px 34px 9px 14px;
  background: var(--cream);
  background: color-mix(in srgb, var(--wallpaper) 30%, var(--cream));
  font-size: 14px;
  transition: background-color 0.2s;
}
html.wallpaper-fade .win-status--tip,
html.wallpaper-fade .tip-icon { transition-duration: 3s; }
.tip-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--wallpaper);
  border: var(--border);
  border-radius: var(--radius-button);
  box-shadow: 3px 3px 0 var(--ink);
  transition: background-color 0.2s;
}
.win-status--tip p { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.tip-label {
  display: inline-block;
  padding: 0 7px;
  background: var(--ink);
  color: var(--cream);
  border-radius: var(--radius-small);
  font: var(--weight-bold) 11px/1.6 var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.win.is-shaded .win-status { display: none; }

/* ---------- Boot screen (first visit): an old computer starting up ---------- */

@property --boot-mem { syntax: '<integer>'; inherits: false; initial-value: 0; }

.boot { display: none; }
html.booting { background: #262624; }   /* no wallpaper showing round the edges (overscroll, toolbars) */
html.booting .boot {
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: block;
  padding: 28px 32px;
  background: #262624;
  color: #F4F1EA;
  font: 15px/1.7 ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  text-shadow: 0 0 1px rgba(244, 241, 234, 0.9), 0 0 8px rgba(244, 241, 234, 0.35);
  cursor: default;
  transition: opacity 0.25s;
}
html.booting .boot::after {        /* faint scanlines */
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, 0.22) 2px 3px);
  pointer-events: none;
}
.boot.is-done { opacity: 0; pointer-events: none; }
.boot-text { max-width: 100%; overflow: hidden; }
.boot-text p { margin: 0; white-space: pre; }

/* Each line, and each OK, appears at its --at time */
.boot-text p, .boot-ok { visibility: hidden; animation: boot-show 1ms var(--at) forwards; }
@keyframes boot-show { to { visibility: visible; } }

/* The memory count ticks up from 0K to 640K */
.boot-mem { counter-reset: mem var(--boot-mem); animation: boot-mem 0.4s steps(10, end) 0.35s both; }
.boot-mem::before { content: counter(mem); }
@keyframes boot-mem { from { --boot-mem: 0; } to { --boot-mem: 640; } }

/* The dots type out one at a time */
.boot-dots { display: inline-block; vertical-align: bottom; overflow: hidden; animation: boot-dots 0.4s steps(9, end) 1.2s both; }
@keyframes boot-dots { from { width: 0; } to { width: 9ch; } }

.boot-cursor {
  display: inline-block;
  width: 1ch;
  height: 1.1em;
  vertical-align: text-bottom;
  background: currentColor;
  box-shadow: 0 0 8px rgba(244, 241, 234, 0.35);
  animation: boot-blink 0.5s steps(1, end) infinite;
}
@keyframes boot-blink { 50% { opacity: 0; } }

/* ---------- Login screen (first visit, and after Log Out) ----------
   Like the Mac's: the bare wallpaper, a round picture and a name, Restart and Shut Down along
   the bottom. html.is-logged-out shows it; html.is-login-waiting swaps the user for a progress
   bar while logging in or out; html.is-off is the shut-down screen. */

.login, .off { display: none; }
html.is-logged-out .menubar,
html.is-logged-out .desktop,
html.is-logged-out .window-layer { visibility: hidden; }
html.is-logged-out .login {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login:focus { outline: none; }   /* it takes focus only so Enter can log in */

.login-clock {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: 18px;
  font-weight: var(--weight-bold);
}

.login-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: -6vh;    /* a little above center, like the Mac */
  animation: login-in 0.3s cubic-bezier(0.1, 0.5, 0.5, 1) both;
}
@keyframes login-in { from { opacity: 0; transform: translateY(12px); } }

.login-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;           /* room for the hover ring and the focus ring */
  margin: 0;
  padding: 24px 24px 6px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-icon);
  color: inherit;
  font: inherit;
  cursor: var(--cursor);
}
.login-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 128px;
  height: 128px;
  background: #111;   /* the logo image's own background, as in the Read Me */
  border: var(--border);
  border-radius: 50%;
  overflow: hidden;
  transition: transform 0.15s cubic-bezier(0.2, 0.7, 0.4, 1), box-shadow 0.15s;
}
.login-avatar .welcome-logo-crop { width: 86px; height: 100px; }
.login-avatar img { display: block; width: 132px; height: 132px; max-width: none; margin: -12px 0 0 -21px; }
/* Hover or keyboard focus: it zooms a little inside a ring a few shades lighter than the wallpaper */
.login-user:hover .login-avatar,
.login-user:focus-visible .login-avatar {
  transform: scale(1.06);
  box-shadow: 0 0 0 9px color-mix(in srgb, var(--wallpaper) 55%, var(--cream));
}
.login-user:active .login-avatar { transform: scale(1.02); }
/* The focus ring follows the circle, just outside the light ring */
.login-user:focus-visible { outline: none; }
.login-user:focus-visible .login-avatar { outline: var(--focus-ring); outline-offset: 12px; }
.login-name { padding: 1px 10px; border-radius: var(--radius-small); font-weight: var(--weight-bold); font-size: 24px; line-height: 1.2; }
.login-hint { margin: 0; padding: 1px 8px; border-radius: 5px; font-size: 14px; }
.login-tap { display: none; }
@media (pointer: coarse) {
  .login-click { display: none; }
  .login-tap { display: inline; }
}

/* Restart and Shut Down: round buttons with a name underneath */
.login-power {
  position: absolute;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 28px;
}
.login-power-btn, .off-power {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-small);
  color: inherit;
  font: var(--weight-bold) 14px/1.2 var(--font);
  cursor: var(--cursor);
}
.login-power-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--cream);
  border: var(--border);
  border-radius: 50%;
  box-shadow: 3px 3px 0 var(--ink);
}
.login-power-label { padding: 1px 7px; border-radius: 5px; }
.login-power-btn:hover .login-power-icon { background: var(--ink); }
.login-power-btn:hover svg { stroke: var(--cream); }
.login-power-btn:active .login-power-icon,
.off-power:active .login-power-icon { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

/* On a busy picture the words get a cream backing, like the desktop icon names */
html.has-picture .login-name,
html.has-picture .login-hint,
html.has-picture .login-power-label,
html.has-picture .login-clock { background: color-mix(in srgb, var(--cream) 85%, transparent); }
html.has-picture .login-clock { padding: 1px 7px; border-radius: 5px; }

/* Logging in or out: a stepped bar and a line of text in place of the user */
.login-wait { display: none; }
html.is-login-waiting .login-main,
html.is-login-waiting .login-power { display: none; }
html.is-login-waiting .login-wait {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(260px, 100%);
}
.login-bar { display: block; width: 100%; height: 22px; padding: 3px; background: var(--cream); border: var(--border); border-radius: var(--radius-small); box-shadow: 4px 4px 0 var(--ink); }
.login-bar i { display: block; height: 100%; background: var(--ink); border-radius: 2px; animation: gm-load var(--login-ms, 1s) steps(10, end) both; }
.login-wait-text { margin: 0; padding: 1px 8px; font-weight: var(--weight-bold); background: var(--cream); border-radius: var(--radius-small); }

/* Shut down: ink screen, cream words, a power button */
html.is-off { background: #262624; }
html.is-off .login { display: none; }
html.is-off .off {
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 36px;
  padding: 16px;
  background: #262624;
  color: #F4F1EA;
  text-align: center;
}
.off-text { margin: 0; font: var(--weight-bold) clamp(20px, 4vw, 30px)/1.3 var(--font); color: #F9A55A; }
.off-power .login-power-icon { box-shadow: none; }
.off-power:hover .login-power-icon { background: #F9A55A; }

/* The desktop fades in once logged in */
html.waking .menubar,
html.waking .desktop { animation: login-wake 0.4s both; }
@keyframes login-wake { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .login-main, html.waking .menubar, html.waking .desktop { animation: none; }
  .login-bar i { animation: none; width: 100%; }
}

/* ---------- Small screens: full-screen windows, one at a time ---------- */

html.is-compact .icons {
  grid-auto-flow: row;
  grid-template-rows: none;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  justify-items: center;
  height: auto;
  padding: 20px 12px;
}
html.is-compact .icon { width: 108px; }
html.is-compact .mail-row { padding: 5px 10px; }
html.is-compact .mail-label { width: 52px; }
html.is-compact .icon-label { padding: 1px 4px; }

html.is-compact .win {
  left: 8px !important;
  top: calc(var(--menubar-h) + env(safe-area-inset-top, 0px) + 8px) !important;
  width: calc(100% - 21px) !important;
  height: calc(100% - var(--menubar-h) - env(safe-area-inset-top, 0px) - 21px - env(safe-area-inset-bottom, 0px)) !important;
  box-shadow: var(--shadow-small);
}
html.is-compact .win-titlebar { cursor: var(--cursor); }
html.is-compact .win-max,
html.is-compact .grow { display: none; }
html.is-compact .win-title { left: 72px; right: 72px; }
html.is-compact .taskbar { margin: 0 6px; }
html.is-compact .task:not(.is-minimized) { display: none; }   /* the one open window fills the screen */
html.is-compact .task--player.is-minimized { min-width: 0; }
html.is-compact .task-ctrl[data-action="prev"] { display: none; }
html.is-compact .win-body { padding: 20px 20px 28px; }
html.is-compact .win-body.is-flush { padding: 0; }
html.is-compact .clock-day { display: none; }
html.is-compact .weather svg { display: none; }
html.is-compact .item-count { display: none; }
html.is-compact .f-list-head,
html.is-compact .f-row { grid-template-columns: minmax(0, 1fr) 70px; }
html.is-compact .f-date, html.is-compact .f-list-head span:nth-child(2),
html.is-compact .f-size, html.is-compact .f-list-head span:nth-child(3) { display: none; }
html.is-compact .f-col { width: 170px; }
html.is-compact .f-preview { width: 210px; }
html.is-compact .viewer--html .btn-link .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
html.is-compact .icon.icon--finder { width: 108px; }
/* The Read Me opens short, at the bottom, so the desktop icons stay in view */
html.is-compact .win[data-id="welcome"] {
  top: auto !important;
  bottom: calc(13px + env(safe-area-inset-bottom, 0px));
  height: min(560px, calc(100% - var(--menubar-h) - env(safe-area-inset-top, 0px) - 21px - env(safe-area-inset-bottom, 0px))) !important;
}
