/* AlexOS — a tiny desktop for alexskov.dk */
:root {
  --paper: #f4f1e8;
  --paper-2: #e9e4d6;
  --ink: #141414;
  --mute: #5f5b52;
  --folder: #f2c94c;
  --folder-2: #e2b33a;
  --red: #e2432a;
  --term: #9df2b5;
  --desk: #7f9c8c;
  --desk-dot: #6f8c7c;
  --bar-h: 30px;
  --shadow: 6px 6px 0 var(--ink);
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--sans); color: var(--ink); background: var(--desk);
  overflow: hidden; -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none;
  transition: background-color 0.4s;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.mono { font-family: var(--mono); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- menubar ---------- */
.menubar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5000; height: calc(var(--bar-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 10px 0; background: var(--paper); border-bottom: 1.5px solid var(--ink);
  display: flex; align-items: center; font-size: 13.5px;
}
.menu { position: relative; }
.menu > button { height: var(--bar-h); padding: 0 11px; font-weight: 400; }
.menu.brand > button { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.menu.brand .logo { width: 14px; height: 14px; }
.menu.open > button { background: var(--ink); color: var(--paper); }
.dropdown {
  position: absolute; top: var(--bar-h); left: 0; min-width: 220px; background: var(--paper); border: 1.5px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink); padding: 4px 0; display: none;
}
.menu.open .dropdown { display: block; }
.dropdown button, .dropdown a { display: flex; justify-content: flex-start; gap: 6px; width: 100%; padding: 5px 16px; text-align: left; text-decoration: none; font-size: 13.5px; }
.dropdown button:hover, .dropdown a:hover, .dropdown button:focus-visible { background: var(--ink); color: var(--paper); outline: none; }
.dropdown kbd { font-family: var(--mono); font-size: 11.5px; opacity: 0.6; }
.dropdown hr { border: 0; border-top: 1.5px dotted var(--ink); margin: 4px 0; }
.dropdown .on::before { content: "✓"; width: 14px; margin-left: -14px; }
.menubar .right { margin-left: auto; display: flex; align-items: center; gap: 14px; font-family: var(--mono); font-size: 12.5px; font-weight: 500; }
.lang { display: flex; border: 1.5px solid var(--ink); border-radius: 4px; overflow: hidden; }
.lang button { padding: 1px 7px; font-family: var(--mono); font-size: 11.5px; font-weight: 600; }
.lang button.on { background: var(--ink); color: var(--paper); }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #2fa35a; margin-right: 5px; box-shadow: 0 0 0 1.5px var(--ink); }

/* ---------- wallpaper layer (own element so pixel patterns can use image-rendering) ---------- */
.wallpaper { position: fixed; inset: 0; background-color: var(--desk); background-image: radial-gradient(var(--desk-dot) 1px, transparent 1px); background-size: 6px 6px; image-rendering: pixelated; transition: background-color 0.3s; }

/* ---------- desktop + icons ---------- */
.desktop { position: fixed; inset: calc(var(--bar-h) + env(safe-area-inset-top, 0px)) 0 0 0; }
.icons { position: absolute; top: 18px; right: 22px; display: grid; grid-template-rows: repeat(7, auto); grid-auto-flow: column; direction: rtl; align-content: start; gap: 8px 10px; }
.icons > * { direction: ltr; }
.icon { width: 108px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 0; touch-action: manipulation; }
.icon svg { width: 54px; height: 46px; filter: drop-shadow(3px 3px 0 var(--ink)); }
.icon span { font-size: 12px; font-weight: 600; background: var(--paper); border: 1px solid var(--ink); padding: 1px 6px; line-height: 1.35; max-width: 100%; text-align: center; overflow-wrap: anywhere; }
.icon.sel span, .icon:focus-visible span { background: var(--ink); color: var(--paper); }
.icon:focus-visible { outline: none; }
.icon.sel svg { filter: drop-shadow(3px 3px 0 var(--ink)) brightness(0.75); }

/* ---------- windows ---------- */
.win {
  position: absolute; background: var(--paper); border: 1.5px solid var(--ink); box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-width: 240px; max-width: calc(100vw - 20px); max-height: calc(100% - 16px);
  user-select: text; -webkit-user-select: text;
}
.win.opening { animation: pop 0.18s steps(3) both; }
@keyframes pop { from { transform: scale(0.94); opacity: 0.4; } }
.tb {
  flex: none; height: 26px; border-bottom: 1.5px solid var(--ink); display: flex; align-items: center; justify-content: center;
  position: relative; font-size: 12.5px; font-weight: 600; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; padding: 0 34px;
}
.win.active .tb { background: repeating-linear-gradient(var(--paper) 0 2px, var(--ink) 2px 3px); background-clip: content-box; padding: 5px 34px; }
.tb .t { background: var(--paper); padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tb .x { position: absolute; right: 6px; top: 4px; width: 18px; height: 16px; border: 1px solid var(--ink); background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 7' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h1v1h-1zM1 0h1v1h-1zM6 0h1v1h-1zM7 0h1v1h-1zM1 1h1v1h-1zM2 1h1v1h-1zM5 1h1v1h-1zM6 1h1v1h-1zM2 2h1v1h-1zM3 2h1v1h-1zM4 2h1v1h-1zM5 2h1v1h-1zM3 3h1v1h-1zM4 3h1v1h-1zM2 4h1v1h-1zM3 4h1v1h-1zM4 4h1v1h-1zM5 4h1v1h-1zM1 5h1v1h-1zM2 5h1v1h-1zM5 5h1v1h-1zM6 5h1v1h-1zM0 6h1v1h-1zM1 6h1v1h-1zM6 6h1v1h-1zM7 6h1v1h-1z' fill='%23141414'/%3E%3C/svg%3E") center / 8px 7px no-repeat;
  box-shadow: inset -1.5px -1.5px 0 #9c968a, inset 1.5px 1.5px 0 #fff; image-rendering: pixelated; }
.tb .x:hover { background-color: #fff; }
.tb .x:active { box-shadow: inset 1.5px 1.5px 0 #9c968a; background-position: calc(50% + 1px) calc(50% + 1px); }
.win:not(.active) .tb .x { opacity: 0.45; }
.dragging .tb { cursor: grabbing; }
.wc { overflow: auto; flex: 1; min-height: 0; overscroll-behavior: contain; }
.wc::-webkit-scrollbar { width: 14px; }
.wc::-webkit-scrollbar-track { background: var(--paper-2); border-left: 1.5px solid var(--ink); }
.wc::-webkit-scrollbar-thumb { background: var(--paper); border: 1.5px solid var(--ink); }
.statusbar { flex: none; font-family: var(--mono); font-size: 11px; border-top: 1.5px solid var(--ink); padding: 4px 12px; display: flex; justify-content: space-between; gap: 12px; }
.zoomrect { position: fixed; z-index: 4000; border: 1.5px dotted var(--ink); pointer-events: none; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--ink); border-radius: 8px; padding: 6px 16px; font-weight: 600; font-size: 14px; background: var(--paper); box-shadow: 2px 2px 0 var(--ink); text-decoration: none; transition: transform 0.06s; }
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:active { transform: translate(2px, 2px); box-shadow: none; }
.btn.default { outline: 2.5px solid var(--ink); outline-offset: 2px; }
.btns { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- about.txt ---------- */
.about .wc { padding: 24px 26px; }
.about h1 { font-family: var(--mono); font-size: clamp(28px, 2.8vw, 40px); line-height: 1.06; letter-spacing: -0.02em; margin-bottom: 16px; }
.cursor { display: inline-block; width: 0.5em; height: 0.95em; background: var(--ink); vertical-align: -0.1em; margin-left: 4px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.about .cols { display: grid; grid-template-columns: 1fr 150px; gap: 22px; align-items: start; }
.about p { font-size: 15.5px; line-height: 1.55; margin-bottom: 10px; }
.about p b { font-weight: 600; }
.portrait { border: 1.5px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); background: var(--paper-2); }
.portrait img { display: block; width: 100%; height: auto; filter: grayscale(1) contrast(1.25) brightness(1.05); image-rendering: auto; }
.portrait figcaption { font-family: var(--mono); font-size: 10.5px; padding: 3px 6px; border-top: 1.5px solid var(--ink); }
.about .btns { margin-top: 16px; }

/* ---------- folder grids ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 18px 6px; padding: 18px 14px 22px; }
.grid .icon { width: auto; }

/* ---------- project window ---------- */
.proj .wc { padding: 22px 24px; }
.proj .tag { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mute); }
.proj h2 { font-size: 26px; letter-spacing: -0.02em; margin: 6px 0 12px; line-height: 1.15; }
.proj p { font-size: 15.5px; line-height: 1.6; margin-bottom: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.chips span { font-family: var(--mono); font-size: 11.5px; border: 1.5px solid var(--ink); padding: 2px 8px; background: var(--paper-2); }

/* ---------- Kogebog ---------- */
.cb-bar { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1.5px solid var(--ink); background: var(--paper-2); }
.cb-bar input { flex: 1; min-width: 0; font: 14px var(--sans); color: var(--ink); background: var(--paper); border: 1.5px solid var(--ink); box-shadow: inset 1.5px 1.5px 0 #9c968a; padding: 5px 9px; outline: none; }
.cb-bar span { font-family: var(--mono); font-size: 11px; color: var(--mute); white-space: nowrap; }
.cb-tags { flex: none; display: flex; flex-wrap: wrap; gap: 5px; padding: 7px 10px; border-bottom: 1.5px solid var(--ink); }
.cb-tags button { font-family: var(--mono); font-size: 11.5px; border: 1.5px solid var(--ink); padding: 1px 8px; background: var(--paper); }
.cb-tags button:hover { background: var(--paper-2); }
.cb-tags button.on { background: var(--ink); color: var(--paper); }
.cb-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.cb-list { border-right: 1.5px solid var(--ink); padding: 4px 0 14px; background: var(--paper-2); }
.cb-list h4 { font-family: var(--mono); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--mute); padding: 10px 12px 3px; }
.cb-list [data-cook] { display: block; width: 100%; text-align: left; padding: 4px 12px; }
.cb-list [data-cook] b { display: block; font-size: 13.5px; font-weight: 600; }
.cb-list [data-cook] small { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-list [data-cook] small.ing { color: var(--ink); background: var(--folder); display: inline-block; max-width: 100%; vertical-align: top; }
.cb-list [data-cook]:hover { background: var(--paper); }
.cb-list [data-cook].on { background: var(--ink); color: var(--paper); }
.cb-list [data-cook].on small { color: #c9c4b6; }
.cb-list [data-cook].on small.ing { color: var(--ink); }
.cb-empty { font-size: 13px; padding: 12px; }
.cb-todo { list-style: none; font-size: 12.5px; padding: 0 12px; }
.cb-todo li { padding: 1px 0 1px 16px; position: relative; }
.cb-todo li::before { content: ""; position: absolute; left: 0; top: 5px; width: 8px; height: 8px; border: 1.5px solid var(--ink); }
.cb-todo li.done::before { background: var(--ink); box-shadow: inset 0 0 0 1.5px var(--paper-2); }
.cb-card { padding: 20px 24px; }
.cb-back { display: none; font-family: var(--mono); font-size: 12px; margin-bottom: 10px; text-decoration: underline; }
.cookbook .tag { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mute); }
.cookbook h2 { font-size: 26px; letter-spacing: -0.02em; margin: 6px 0 6px; line-height: 1.15; }
.cookbook h3 { font-family: var(--mono); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin: 12px 0 4px; }
.rc-meta { font-family: var(--mono); font-size: 12px; color: var(--mute); }
.rc-cols { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 22px; margin: 14px 0 16px; align-items: start; }
.rc-cols > :only-child { grid-column: 1 / -1; }
.rc-ing { list-style: none; font-size: 14px; line-height: 1.4; }
.rc-ing label { display: flex; gap: 8px; padding: 2px 0; cursor: pointer; }
.rc-ing input { appearance: none; flex: none; width: 13px; height: 13px; margin-top: 3px; border: 1.5px solid var(--ink); background: var(--paper); cursor: pointer; }
.rc-ing input:checked { background: var(--ink); box-shadow: inset 0 0 0 2px var(--paper); }
.rc-ing input:checked + span { text-decoration: line-through; color: var(--mute); }
.rc-steps { padding-left: 34px; font-size: 15px; line-height: 1.55; border-left: 1.5px dashed var(--ink); padding-top: 4px; margin-top: 10px; }
.rc-steps li { margin: 0 0 8px 6px; }
.rc-steps li::marker { font-family: var(--mono); font-weight: 600; }
.rc-note { font-size: 14px; border: 1.5px solid var(--ink); background: var(--paper-2); padding: 8px 12px; margin-bottom: 16px; }
.cookbook .btns .btn { font-size: 13px; padding: 4px 12px; }

/* ---------- films ---------- */
.posters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 14px; }
.film { text-decoration: none; display: block; min-width: 0; }
.film img, .film .ph { width: 100%; aspect-ratio: 2/3; object-fit: cover; border: 1.5px solid var(--ink); display: block; background: var(--paper-2); }
.film:hover img { outline: 2.5px solid var(--ink); outline-offset: 1px; }
.film .ft { font-size: 11.5px; font-weight: 600; margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.film .fs { font-family: var(--mono); font-size: 10.5px; color: var(--mute); }

/* ---------- terminal ---------- */
.term { background: var(--ink); }
.term .tb { background-color: var(--paper); }
.term .wc { color: var(--term); font-family: var(--mono); font-size: 13px; line-height: 1.55; padding: 12px 14px; cursor: text; }
.term .out { white-space: pre-wrap; word-break: break-word; }
.term .out a { color: var(--term); }
.term .muted { color: #6c9c7a; }
.term .warn { color: #f2c94c; }
.term .line { display: flex; gap: 8px; }
.term input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--term); font: inherit; caret-color: var(--term); }

/* ---------- toolbox ---------- */
.toolbox .wc { padding: 18px 22px; }
.spec { width: 100%; border-collapse: collapse; font-size: 14px; }
.spec th { text-align: left; font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--mute); padding: 10px 14px 10px 0; vertical-align: top; width: 120px; border-bottom: 1.5px dotted var(--ink); font-weight: 500; }
.spec td { padding: 9px 0; border-bottom: 1.5px dotted var(--ink); line-height: 1.6; }

/* ---------- mail ---------- */
.mail .wc { padding: 22px 24px; }
.mail h2 { font-size: 24px; letter-spacing: -0.02em; margin-bottom: 8px; }
.mail p { font-size: 15px; line-height: 1.55; margin-bottom: 16px; }
.addr { display: flex; align-items: stretch; border: 1.5px solid var(--ink); margin-bottom: 18px; }
.addr code { flex: 1; font-family: var(--mono); font-size: 15px; padding: 9px 12px; background: #fff; user-select: all; -webkit-user-select: all; overflow: hidden; text-overflow: ellipsis; }
.addr button { border-left: 1.5px solid var(--ink); padding: 0 14px; font-weight: 600; font-size: 13px; }
.addr button:hover { background: var(--ink); color: var(--paper); }
.links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.links a { display: flex; justify-content: space-between; border: 1.5px solid var(--ink); padding: 8px 12px; text-decoration: none; font-weight: 600; font-size: 14px; }
.links a:hover { background: var(--ink); color: var(--paper); }
.links a span { font-family: var(--mono); font-weight: 400; font-size: 12px; }

/* ---------- trash ---------- */
.trash li { list-style: none; display: flex; gap: 12px; align-items: baseline; padding: 8px 16px; border-bottom: 1.5px dotted var(--ink); font-size: 14px; }
.trash li code { font-family: var(--mono); font-size: 13px; font-weight: 500; flex: none; }
.trash li em { font-style: normal; color: var(--mute); font-size: 13px; }

/* ---------- browser ---------- */
.browser .urlbar { flex: none; display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-bottom: 1.5px solid var(--ink); }
.browser .urlbar code { flex: 1; font-family: var(--mono); font-size: 12px; border: 1.5px solid var(--ink); background: #fff; padding: 3px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.browser .urlbar a { font-family: var(--mono); font-size: 12px; font-weight: 600; text-decoration: none; border: 1.5px solid var(--ink); padding: 2px 8px; }
.browser .urlbar a:hover { background: var(--ink); color: var(--paper); }
.browser .wc { overflow: hidden; position: relative; background: #fff; }
.browser iframe { width: 100%; height: 100%; border: 0; display: block; }
.browser .loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 13px; background: var(--paper-2); }

/* ---------- music player ---------- */
.music .wc { padding: 10px; }
.lcd-panel { background: #10140f; border: 1.5px solid var(--ink); color: var(--term); font-family: var(--mono); padding: 8px 10px 6px; box-shadow: inset 0 0 0 2px #1d241b; }
.lcd-top { display: flex; justify-content: space-between; font-size: 12px; }
.lcd-time { font-size: 22px; font-weight: 600; letter-spacing: 0.04em; line-height: 1; }
.marquee { overflow: hidden; white-space: nowrap; font-size: 12.5px; margin: 6px 0; }
.marquee span { display: inline-block; padding-left: 100%; animation: marquee 12s linear infinite; }
@keyframes marquee { to { transform: translateX(-100%); } }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 26px; }
.bars i { flex: 1; height: 15%; background: var(--term); }
.music.playing .bars i { animation: eq 0.8s steps(5) infinite alternate; }
@keyframes eq { 0% { height: 10%; } 40% { height: 85%; } 70% { height: 35%; } 100% { height: 65%; } }
.mu-ctrl { display: flex; align-items: center; gap: 6px; margin: 10px 0; }
.mu-ctrl button { width: 36px; height: 28px; border: 1.5px solid var(--ink); background: var(--paper); box-shadow: 2px 2px 0 var(--ink); display: flex; align-items: center; justify-content: center; }
.mu-ctrl button:active { transform: translate(2px, 2px); box-shadow: none; }
.mu-ctrl button.play { width: 46px; background: var(--folder); }
.mu-ctrl svg { width: 14px; height: 14px; fill: var(--ink); }
.vol { margin-left: auto; display: flex; align-items: flex-end; gap: 2px; height: 16px; }
.vol i { width: 4px; background: var(--ink); }
.vol i:nth-child(1) { height: 20%; } .vol i:nth-child(2) { height: 40%; } .vol i:nth-child(3) { height: 60%; } .vol i:nth-child(4) { height: 80%; } .vol i:nth-child(5) { height: 100%; opacity: 0.25; }
.playlist { list-style: none; border: 1.5px solid var(--ink); background: #fff; }
.playlist button { width: 100%; display: flex; justify-content: space-between; gap: 10px; padding: 5px 8px; font-family: var(--mono); font-size: 12px; text-align: left; }
.playlist li + li button { border-top: 1px dotted var(--ink); }
.playlist button:hover { background: var(--paper-2); }
.playlist button.on { background: var(--ink); color: var(--paper); }

/* ---------- daily games: coming soon ---------- */
.soon .wc { padding: 26px 30px 24px; text-align: center; }
.soon .hourglass { width: 48px; height: 48px; image-rendering: pixelated; animation: flip 2.4s steps(1) infinite; }
@keyframes flip { 50% { transform: rotate(180deg); } }
.soon h2 { font-family: var(--mono); font-size: 22px; margin: 12px 0 6px; }
.soon p { font-size: 14.5px; line-height: 1.5; margin-bottom: 16px; }
.progress { height: 16px; border: 1.5px solid var(--ink); padding: 2px; margin: 0 auto 20px; max-width: 260px; background: #fff; }
.progress i { display: block; height: 100%; width: 38%; background: repeating-linear-gradient(90deg, var(--ink) 0 8px, transparent 8px 11px); }

/* ---------- control panel ---------- */
.control .wc { padding: 14px 16px 16px; display: grid; gap: 14px; }
fieldset { border: 1.5px solid var(--ink); padding: 12px 12px 12px; }
legend { font-family: var(--mono); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; padding: 0 6px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 10px; }
.swatches button { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11.5px; }
.swatches i { width: 100%; aspect-ratio: 3 / 2; border: 1.5px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); image-rendering: pixelated; }
.swatches button.on i { outline: 2.5px solid var(--ink); outline-offset: 2px; }
.swatches button.on span { background: var(--ink); color: var(--paper); padding: 0 4px; }
.seg { display: inline-flex; border: 1.5px solid var(--ink); margin: 0 10px 0 0; vertical-align: middle; flex-wrap: wrap; }
.seg button { padding: 5px 10px; font-size: 13px; font-weight: 600; }
.seg button + button { border-left: 1.5px solid var(--ink); }
.seg button.on { background: var(--ink); color: var(--paper); }
.control fieldset .btn { vertical-align: middle; padding: 4px 12px; font-size: 13px; }

/* ---------- AlexPaint (MS Paint '95, but on paper) ---------- */
.paint { --bevel-l: #fff; --bevel-d: #9c968a; }
.pt-menu { flex: none; display: flex; flex-wrap: wrap; border-bottom: 1.5px solid var(--ink); font-size: 13px; }
.pt-menu button { padding: 4px 10px; }
.pt-menu button:hover { background: var(--ink); color: var(--paper); }
.pt-body { flex: 1; min-height: 0; display: flex; background: var(--paper-2); }
.pt-tools { flex: none; display: grid; grid-template-columns: repeat(2, 28px); grid-auto-rows: 28px; gap: 2px; padding: 6px; align-content: start; border-right: 1.5px solid var(--ink); }
.pt-tools button { display: flex; align-items: center; justify-content: center; background: var(--paper); border: 1px solid var(--ink); box-shadow: inset -1.5px -1.5px 0 var(--bevel-d), inset 1.5px 1.5px 0 var(--bevel-l); }
.pt-tools button.on { background: repeating-conic-gradient(var(--paper) 0 25%, #fff 0 50%) 0 0 / 2px 2px; box-shadow: inset 1.5px 1.5px 0 var(--bevel-d); }
.pt-tools svg { width: 16px; height: 16px; fill: var(--ink); }
.pt-stage { flex: 1; min-width: 0; overflow: auto; padding: 10px; background: #8f8a7f; background-image: radial-gradient(#837e73 1px, transparent 1px); background-size: 4px 4px; display: flex; align-items: flex-start; justify-content: center; }
#pt-canvas { width: 100%; max-width: 576px; aspect-ratio: 3 / 2; image-rendering: pixelated; background: #fff; box-shadow: 3px 3px 0 var(--ink); border: 1px solid var(--ink); touch-action: none; cursor: crosshair; }
#pt-canvas[data-tool="fill"], #pt-canvas[data-tool="picker"] { cursor: cell; }
.pt-palette { flex: none; display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-top: 1.5px solid var(--ink); }
.pt-current { position: relative; width: 34px; height: 30px; flex: none; border: 1px solid var(--ink); box-shadow: inset 1.5px 1.5px 0 var(--bevel-d); background: var(--paper); }
.pt-current i { position: absolute; width: 15px; height: 13px; border: 1px solid var(--ink); }
.pt-current #pt-fg { left: 4px; top: 4px; z-index: 1; }
.pt-current #pt-bg { right: 4px; bottom: 4px; }
.pt-swatches { display: grid; grid-template-columns: repeat(14, 16px); grid-template-rows: repeat(2, 14px); gap: 2px; }
.pt-swatches button { border: 1px solid var(--ink); box-shadow: inset -1px -1px 0 rgba(0,0,0,0.25), inset 1px 1px 0 rgba(255,255,255,0.5); }

/* ---------- about this site ---------- */
.sys .wc { padding: 20px 24px; text-align: center; }
.sys .big { font-family: var(--mono); font-size: 26px; font-weight: 600; margin: 8px 0 2px; }
.sys dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; text-align: left; font-size: 13px; margin-top: 16px; border-top: 1.5px dotted var(--ink); padding-top: 12px; }
.sys dt { font-family: var(--mono); font-size: 11.5px; color: var(--mute); }

/* ---------- minesweeper ---------- */
.mines .wc { padding: 12px; display: flex; flex-direction: column; align-items: center; }
.ms-head { display: flex; justify-content: space-between; align-items: center; width: 100%; border: 1.5px solid var(--ink); padding: 5px 8px; margin-bottom: 10px; background: var(--paper-2); }
.ms-head .lcd { font-family: var(--mono); font-weight: 600; font-size: 18px; background: var(--ink); color: var(--red); padding: 0 6px; min-width: 50px; text-align: center; }
.ms-head button { display: flex; align-items: center; justify-content: center; width: 34px; height: 30px; border: 1.5px solid var(--ink); background: var(--paper); box-shadow: 2px 2px 0 var(--ink); }
.ms-board { display: grid; border: 1.5px solid var(--ink); touch-action: manipulation; }
.ms-board button { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 1px solid var(--ink); margin: -0.5px; background: var(--paper); font-family: var(--mono); font-weight: 700; font-size: 14px; box-shadow: inset -2px -2px 0 var(--paper-2); }
.ms-board button.open { background: var(--paper-2); box-shadow: none; cursor: default; }
.ms-board button.boom { background: var(--red); }
.ms-board .n1 { color: #2456c7; } .ms-board .n2 { color: #2a8a43; } .ms-board .n3 { color: var(--red); } .ms-board .n4 { color: #6a2fb0; }
.ms-board .n5 { color: #8a3b12; } .ms-board .n6 { color: #12817f; } .ms-board .n7, .ms-board .n8 { color: var(--ink); }
.ms-foot { font-family: var(--mono); font-size: 11px; color: var(--mute); margin-top: 8px; text-align: center; }

/* ---------- screensaver ---------- */
.saver { position: fixed; inset: 0; z-index: 9000; background: #05070b; cursor: none; opacity: 0; transition: opacity 0.8s; }
.saver.on { opacity: 1; }
.saver canvas { width: 100%; height: 100%; display: block; }
.saver .hint { position: absolute; bottom: 24px; width: 100%; text-align: center; font-family: var(--mono); font-size: 12px; color: #6b7690; }

.toast { position: fixed; left: 50%; bottom: 22px; z-index: 6000; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; background: var(--paper); border: 1.5px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); padding: 7px 14px; font-family: var(--mono); font-size: 12.5px; transition: opacity 0.2s, transform 0.2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- phones: home screen + full-width sheets ---------- */
@media (max-width: 760px) {
  .menubar .menu:not(.brand), .menubar .clock-date { display: none; }
  .icons { position: static; display: flex; direction: ltr; flex-direction: row; flex-wrap: wrap; justify-content: center; align-content: flex-start; padding: 22px 10px calc(30px + env(safe-area-inset-bottom, 0px)); gap: 22px 4px; overflow-y: auto; height: 100%; }
  .icon { width: 84px; }
  .icon svg { width: 52px; height: 46px; }
  .icon span { font-size: 11px; padding: 1px 4px; line-height: 1.3; }
  .win { left: 8px !important; right: 8px !important; width: auto !important; top: 10px !important; height: auto !important; max-height: calc(100% - 20px - env(safe-area-inset-bottom, 0px)); max-width: none; }
  .win.term { height: 60% !important; }
  .win.browser { height: calc(100% - 20px) !important; }
  .tb { cursor: default; height: 34px; }
  .win.active .tb { padding: 7px 44px; }
  .tb .x { width: 24px; height: 22px; top: 5px; right: 8px; background-size: 10px 9px; }
  .about .cols, .rc-cols { grid-template-columns: 1fr; }
  .rc-steps { border-left: 0; padding-left: 20px; }
  .win.cookbook { height: calc(100% - 20px) !important; }
  .cb-body { grid-template-columns: 1fr; }
  .cb-list { border-right: 0; }
  .cookbook:not(.reading) .cb-card, .cookbook.reading .cb-list, .cookbook.reading .cb-tags { display: none; }
  .cb-back { display: inline-block; }
  .cb-list [data-cook] { padding: 7px 14px; }
  .about .portrait { max-width: 160px; }
  .links { grid-template-columns: 1fr; }
  .ms-board button { width: 30px; height: 30px; }
  .win.paint { height: calc(100% - 20px) !important; }
  .pt-swatches { grid-template-columns: repeat(14, minmax(0, 1fr)); grid-template-rows: repeat(2, 18px); flex: 1; }
  .pt-tools { grid-template-columns: 30px; grid-auto-rows: 30px; }
  .pt-stage { align-items: center; }
}
@media (min-width: 761px) and (max-height: 980px) {
  .icons { gap: 4px 8px; top: 12px; bottom: 10px; }
  .icon { gap: 4px; padding: 2px 0; }
  .icon svg { width: 42px; height: 36px; }
}
@media (min-width: 761px) and (max-height: 720px) {
  .icons { gap: 2px 8px; top: 8px; }
  .icon { gap: 3px; padding: 1px 0; }
  .icon svg { width: 34px; height: 29px; }
  .icon span { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { .win.opening { animation: none; } .cursor { animation: none; } }
