:root {
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --accent: #6f6bf2;
  --ink: #0b0c14;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: #05060c; color: #fff; font-family: var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; }
#room { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; opacity: 0; transition: opacity 1.1s ease; }
body.ready #room { opacity: 1; }

#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 1; background: radial-gradient(120% 95% at 50% 46%, transparent 52%, rgba(4,3,12,.42) 100%); transition: opacity .6s ease; }
body.flying #vignette { opacity: 0; }

/* loader: a dusk glow and a thin line, alive from the first frame */
#loader { position: fixed; inset: 0; display: grid; place-items: center; background: #05060c; transition: opacity .9s ease; z-index: 5; pointer-events: none; }
#loader.done { opacity: 0; }
.loader-dusk { position: absolute; inset: 0; background: radial-gradient(60% 45% at 30% 62%, rgba(245,138,75,.34), rgba(120,70,160,.16) 45%, transparent 75%); animation: breathe 3.2s ease-in-out infinite; }
.loader-line { width: min(220px, 40vw); height: 2px; background: rgba(255,255,255,.12); border-radius: 2px; overflow: hidden; }
.loader-line i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: #fff; transition: width .25s ease; }
@keyframes breathe { 50% { transform: scale(1.08); opacity: .75; } }

/* hotspot dots */
#dots { position: fixed; inset: 0; pointer-events: none; transition: opacity .8s ease; opacity: 0; z-index: 2; }
.dot { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.9); box-shadow: 0 0 0 0 rgba(255,255,255,.5), 0 0 12px rgba(255,220,180,.6); animation: ping 2.6s ease-out infinite; }
.dot-main { background: #c9c6ff; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.55), 0 0 12px rgba(255,220,180,.6); } 80%, 100% { box-shadow: 0 0 0 14px rgba(255,255,255,0), 0 0 12px rgba(255,220,180,.6); } }
body.flying #dots, body.flying #tip, body.flying #plain { opacity: 0 !important; }

#tip { position: fixed; left: 0; top: 0; z-index: 3; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: rgba(10,10,20,.78); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.14); font-size: 13px; font-weight: 500; white-space: nowrap; opacity: 0; transition: opacity .15s ease; }
#tip.on { opacity: 1; }

/* project card */
#card { position: fixed; left: 0; top: 0; z-index: 4; width: min(360px, calc(100vw - 32px)); padding: 22px 22px 20px; border-radius: 18px; background: rgba(13,13,24,.74); backdrop-filter: blur(22px) saturate(1.3); border: 1px solid rgba(255,255,255,.14); box-shadow: 0 30px 80px rgba(0,0,0,.55); opacity: 0; transition: opacity .35s ease .25s; }
#card.on { opacity: 1; }
.card-x { position: absolute; right: 12px; top: 10px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: rgba(255,255,255,.6); font-size: 20px; cursor: pointer; }
.card-x:hover { background: rgba(255,255,255,.1); color: #fff; }
.card-kicker { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em; color: #b9b6ff; }
.card-title { margin: 0 0 10px; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.card-body { margin: 0 0 16px; font-size: 14.5px; line-height: 1.55; color: rgba(255,255,255,.82); }
.card-links { display: flex; flex-wrap: wrap; gap: 8px; }
.card-links a { padding: 8px 13px; border-radius: 10px; font-size: 13px; font-weight: 600; color: #fff; text-decoration: none; border: 1px solid rgba(255,255,255,.2); transition: background .15s ease; }
.card-links a:hover { background: rgba(255,255,255,.1); }
.card-links a.primary { background: var(--accent); border-color: transparent; }
.card-links a.primary:hover { background: #807cff; }

/* plain links for people who want the regular pages */
#plain { position: fixed; right: 18px; bottom: 14px; z-index: 2; display: flex; gap: 16px; font-size: 12.5px; font-weight: 500; opacity: 0; transition: opacity 1.2s ease 2.5s; }
body.ready #plain { opacity: .55; }
#plain:hover { opacity: 1 !important; transition-delay: 0s; }
#plain a { color: #fff; text-decoration: none; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
#plain a:hover { text-decoration: underline; text-underline-offset: 4px; }

#os { position: fixed; inset: 0; z-index: 10; }
#os[hidden] { display: none; }

/* ================================================================ mini-OS */
#os { font-family: var(--font); color: #14152a; overflow: hidden; background: #05050c; user-select: none; -webkit-user-select: none; }
.os-wall { position: absolute; top: 0; left: 50%; height: 100%; min-width: 100%; transform: translateX(-50%); object-fit: cover; }
.os-bar { position: absolute; top: 0; left: 0; right: 0; height: max(4.5vh, 30px); display: flex; align-items: center; gap: 14px; padding: 0 max(2.7vh, 12px); background: rgba(12,12,24,.55); backdrop-filter: blur(18px) saturate(1.4); color: #fff; font-size: max(1.5vh, 13px); z-index: 100000; transition: transform .5s cubic-bezier(.2,.8,.2,1); }
.os-name { font-weight: 600; }
.os-app { opacity: .75; font-weight: 500; }
.os-spacer { flex: 1; }
.os-clock { font-weight: 500; font-variant-numeric: tabular-nums; }
.os-bar button { font: inherit; font-weight: 600; color: #fff; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.08); border-radius: 999px; padding: .28em .95em; cursor: pointer; transition: background .15s ease; }
.os-bar button:hover { background: rgba(255,255,255,.2); }
.os-sound:not(.on) { background: var(--accent); border-color: transparent; }
.os-sound:not(.on):hover { background: #807cff; }
.os-wins { position: absolute; inset: 0; }
.os-dock { position: absolute; left: 50%; bottom: 1.8vh; transform: translateX(-50%); height: 10.5vh; min-height: 56px; padding: 1.6vh; display: flex; gap: 1.6vh; border-radius: 3.2vh; background: rgba(20,20,36,.55); border: 1px solid rgba(255,255,255,.18); backdrop-filter: blur(18px) saturate(1.4); z-index: 100000; transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.dock-item { position: relative; height: 100%; aspect-ratio: 1; padding: 0; border: 0; background: none; cursor: pointer; transition: transform .18s cubic-bezier(.2,.8,.2,1); }
.dock-item canvas { width: 100%; height: 100%; display: block; filter: drop-shadow(0 4px 10px rgba(0,0,0,.35)); }
.dock-item:hover { transform: translateY(-1.2vh) scale(1.16); }
.dock-item:active { transform: translateY(-.4vh) scale(1.05); }
.dock-tip { position: absolute; left: 50%; bottom: calc(100% + 1.8vh); transform: translateX(-50%); padding: 4px 9px; border-radius: 7px; background: rgba(10,10,20,.85); color: #fff; font-size: 12px; font-weight: 500; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s ease; }
.dock-item:hover .dock-tip { opacity: 1; }
.dock-run { position: absolute; left: 50%; bottom: -1.1vh; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: #fff; opacity: 0; transition: opacity .2s ease; }
.dock-item.running .dock-run { opacity: .9; }
#os.welcome .os-bar { animation: barIn .7s cubic-bezier(.2,.8,.2,1) both; }
#os.welcome .os-dock { animation: dockIn .8s cubic-bezier(.2,.8,.2,1) both; }
@keyframes barIn { from { transform: translateY(-100%); } }
@keyframes dockIn { from { transform: translate(-50%, 160%); } }
.os-boot { position: absolute; top: 0; left: 50%; height: 100%; transform: translateX(-50%); z-index: 200000; background: #05050c; box-shadow: 0 0 0 100vw #05050c; transition: opacity .45s ease; }
.os-boot[hidden] { display: none; }
.os-boot.gone { opacity: 0; pointer-events: none; }

/* windows */
.win { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; border-radius: 12px; background: #f4f1ea; box-shadow: 0 0 0 1px rgba(0,0,0,.18), 0 18px 50px rgba(0,0,0,.38); opacity: 0; scale: .94; transition: opacity .18s ease, scale .22s cubic-bezier(.2,.9,.3,1.2), box-shadow .2s ease; will-change: transform; }
.win.open { opacity: 1; scale: 1; }
.win.closing { opacity: 0 !important; scale: .94; }
.win.anim { transition: transform .25s cubic-bezier(.2,.8,.2,1), width .25s cubic-bezier(.2,.8,.2,1), height .25s cubic-bezier(.2,.8,.2,1); }
.win.focused { box-shadow: 0 0 0 1px rgba(0,0,0,.25), 0 30px 90px rgba(0,0,0,.55); }
.win.dark { background: #12131c; color: #e8e9f2; }
.win-bar { position: relative; flex: none; height: 36px; display: flex; align-items: center; border-radius: 12px 12px 0 0; background: #e6e1d6; cursor: grab; touch-action: none; }
.win.dark .win-bar { background: #1c1e2b; }
.win.dragging .win-bar { cursor: grabbing; }
.win-btns { display: flex; gap: 8px; padding: 0 13px; z-index: 1; }
.wb { width: 13px; height: 13px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; background: #c9c4b8; transition: filter .12s; }
.win.dark .wb { background: #3a3d52; }
.win.focused .wb-close, .win-btns:hover .wb-close { background: #ff5f57; }
.win.focused .wb-min, .win-btns:hover .wb-min { background: #febc2e; }
.win.focused .wb-max, .win-btns:hover .wb-max { background: #28c840; }
.wb:hover { filter: brightness(.82); }
.win-title { position: absolute; left: 80px; right: 80px; text-align: center; font-size: 13px; font-weight: 600; opacity: .72; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.win-body { position: relative; flex: 1; min-height: 0; overflow: hidden; border-radius: 0 0 12px 12px; user-select: text; -webkit-user-select: text; }
.win:not(.focused) .win-body { filter: saturate(.85); }
.rs { position: absolute; z-index: 5; touch-action: none; }
.rs-n, .rs-s { left: 10px; right: 10px; height: 7px; cursor: ns-resize; } .rs-n { top: -4px; } .rs-s { bottom: -4px; }
.rs-e, .rs-w { top: 10px; bottom: 10px; width: 7px; cursor: ew-resize; } .rs-e { right: -4px; } .rs-w { left: -4px; }
.rs-ne, .rs-nw, .rs-se, .rs-sw { width: 16px; height: 16px; }
.rs-ne { right: -5px; top: -5px; cursor: nesw-resize; } .rs-nw { left: -5px; top: -5px; cursor: nwse-resize; }
.rs-se { right: -5px; bottom: -5px; cursor: nwse-resize; } .rs-sw { left: -5px; bottom: -5px; cursor: nesw-resize; }

/* shared controls */
.btn { font: inherit; font-size: 13px; font-weight: 600; padding: 7px 13px; border-radius: 9px; border: 1px solid rgba(20,21,42,.2); background: rgba(255,255,255,.6); color: inherit; cursor: pointer; text-decoration: none; display: inline-block; transition: background .12s, transform .08s; }
.btn:hover { background: #fff; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover { background: #807cff; }
.win.dark .btn { border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.07); }
.win.dark .btn:hover { background: rgba(255,255,255,.16); }
.win.dark .btn.primary { background: var(--accent); }
.tag { font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: rgba(79,70,229,.1); color: #4038c9; }
.tag-active { background: rgba(47,158,91,.14); color: #1f7a43; }
.tag-shipped { background: rgba(245,138,75,.18); color: #a8501c; }
.tag-archive { background: rgba(20,21,42,.08); color: #5a5d73; }

/* terminal */
.term { height: 100%; overflow-y: auto; padding: 12px 14px; font: 13.5px/1.55 var(--mono); background: #0b0c14; color: #cfd3e6; cursor: text; }
.term-row { white-space: pre-wrap; word-break: break-word; }
.term-row.dim { color: #7c829c; } .term-row.err { color: #ff8f7a; } .term-row.accent { color: #f6c453; } .term-row.echo { color: #e8e9f2; }
.term-line { display: flex; }
.term-prompt { color: #7df0c0; white-space: pre; }
.term-in { flex: 1; min-width: 0; font: inherit; color: #fff; background: none; border: 0; outline: 0; padding: 0; caret-color: #7df0c0; }
.term-matrix { position: absolute; inset: 0; width: 100%; height: 100%; background: #0b0c14; }

/* work */
.work { display: flex; height: 100%; }
.work-side { flex: none; width: 168px; padding: 14px 10px; background: #ebe6db; display: flex; flex-direction: column; gap: 3px; }
.work-filter { font: inherit; font-size: 13px; font-weight: 600; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: inherit; cursor: pointer; }
.work-filter:hover { background: rgba(20,21,42,.07); }
.work-filter.on { background: var(--accent); color: #fff; }
.work-note { margin: auto 10px 4px; font-size: 12px; line-height: 1.45; opacity: .6; }
.work-main { flex: 1; min-width: 0; overflow-y: auto; padding: 16px; }
.work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.work-card { font: inherit; color: inherit; text-align: left; padding: 0; border: 1px solid rgba(20,21,42,.12); border-radius: 12px; background: #fff; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; transition: transform .16s cubic-bezier(.2,.8,.2,1), box-shadow .16s; }
.work-card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(20,21,42,.16); }
.work-thumb { aspect-ratio: 16 / 10; background: #dcd6c8; display: grid; place-items: center; overflow: hidden; }
.work-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.work-thumb span { font-size: 44px; font-weight: 700; color: rgba(255,255,255,.9); }
.work-info { padding: 12px 13px 13px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.work-info h3 { margin: 0; font-size: 15px; }
.work-info p { margin: 0; font-size: 12.5px; line-height: 1.45; opacity: .72; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.work-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.work-detail { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.work-back { font: inherit; font-size: 13px; font-weight: 600; border: 0; background: none; color: #4038c9; cursor: pointer; padding: 2px 0; }
.work-hero { width: 100%; border-radius: 12px; border: 1px solid rgba(20,21,42,.12); }
.work-detail h2 { margin: 4px 0 0; font-size: 26px; letter-spacing: -.02em; }
.work-desc { margin: 0; font-size: 15px; line-height: 1.6; opacity: .85; }
.work-links { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 12px; }

/* writing */
.reader { display: flex; height: 100%; background: #fbf8f1; }
.reader-list { flex: none; width: 44%; max-width: 340px; overflow-y: auto; border-right: 1px solid rgba(20,21,42,.1); padding: 8px; }
.reader-row { width: 100%; font: inherit; color: inherit; text-align: left; border: 0; background: none; padding: 10px 11px; border-radius: 9px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.reader-row:hover { background: rgba(20,21,42,.05); }
.reader-row.on { background: var(--accent); color: #fff; }
.reader-row-title { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.reader-row-date { font-size: 11.5px; opacity: .65; }
.reader-page { flex: 1; min-width: 0; overflow-y: auto; padding: 34px 36px; opacity: 0; transform: translateY(6px); }
.reader-page.in { opacity: 1; transform: none; transition: opacity .3s ease, transform .3s ease; }
.reader-date { margin: 0 0 10px; font-size: 12.5px; font-weight: 600; color: #4038c9; }
.reader-page h2 { margin: 0 0 16px; font: 700 30px/1.15 Georgia, "Times New Roman", serif; letter-spacing: -.01em; }
.reader-excerpt { margin: 0 0 24px; font: 17px/1.6 Georgia, "Times New Roman", serif; opacity: .85; }

/* notes */
.notes { display: flex; height: 100%; background: #fffdf5; }
.notes-side { flex: none; width: 200px; overflow-y: auto; background: #f6edd2; padding: 8px; display: flex; flex-direction: column; gap: 3px; }
.notes-item { font: inherit; color: inherit; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.notes-item:hover { background: rgba(120,80,0,.08); }
.notes-item.on { background: #f6c453; }
.notes-item strong { font-size: 13.5px; }
.notes-item span { font-size: 11.5px; opacity: .6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notes-add, .notes-reset { font: inherit; font-size: 12.5px; font-weight: 600; border: 1px dashed rgba(120,80,0,.35); background: none; color: inherit; padding: 8px; border-radius: 8px; cursor: pointer; margin-top: 6px; }
.notes-reset { border: 0; opacity: .55; margin-top: auto; }
.notes-add:hover, .notes-reset:hover { background: rgba(120,80,0,.08); opacity: 1; }
.notes-edit { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: none; padding: 26px 30px; font: 15.5px/1.65 var(--font); color: #2a2415; }

/* settings */
.settings { height: 100%; overflow-y: auto; padding: 8px 24px 22px; }
.settings h3 { margin: 20px 0 6px; font-size: 15px; }
.settings-hint { margin: 0 0 10px; font-size: 12.5px; line-height: 1.5; opacity: .65; }
.settings-walls { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.settings-wall { font: inherit; color: inherit; padding: 0; border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; }
.settings-wall canvas { width: 100%; border-radius: 9px; outline: 3px solid transparent; outline-offset: 2px; transition: outline-color .15s, transform .15s; display: block; }
.settings-wall:hover canvas { transform: scale(1.03); }
.settings-wall.on canvas { outline-color: var(--accent); }
.settings-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.settings-row .settings-hint { margin: 0; flex: 1; min-width: 180px; }

/* paint */
.paint { display: flex; flex-direction: column; height: 100%; background: #d9d3c5; }
.paint-bar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; background: #ebe6db; border-bottom: 1px solid rgba(20,21,42,.12); }
.paint-tool, .paint-act { font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 8px; border: 1px solid rgba(20,21,42,.16); background: #fff; color: inherit; cursor: pointer; }
.paint-tool.on { background: #14152a; color: #fff; border-color: #14152a; }
.paint-size { width: 90px; accent-color: var(--accent); }
.paint-swatches { display: flex; gap: 4px; flex-wrap: wrap; }
.paint-sw { width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(20,21,42,.25); cursor: pointer; transition: transform .1s; }
.paint-sw.on { transform: scale(1.22); box-shadow: 0 0 0 2px #14152a; }
.paint-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 12px; }
.paint-stage { overflow: hidden; }
.paint-stage canvas { background: #f7f1e3; border-radius: 4px; box-shadow: 0 6px 22px rgba(0,0,0,.25); cursor: crosshair; touch-action: none; }

/* beats */
.beats { height: 100%; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; background: radial-gradient(120% 90% at 50% 0%, #23203f, #12131c 70%); user-select: none; -webkit-user-select: none; }
.beats-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.beats-play { min-width: 68px; }
.beats-tempo { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; opacity: .9; }
.beats-tempo input { width: 110px; accent-color: #ff5d8f; }
.beats-tempo span { min-width: 58px; font-variant-numeric: tabular-nums; opacity: .7; }
.beats-snd { margin-left: auto; background: #ff5d8f !important; border-color: transparent !important; color: #fff; }
.beats-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 62px repeat(16, 1fr); grid-auto-rows: 1fr; gap: 5px; }
.beats-label { font: inherit; font-size: 12px; font-weight: 700; color: var(--c); background: none; border: 0; text-align: left; cursor: pointer; border-radius: 6px; padding: 0 4px; }
.beats-label.hit { animation: labelHit .2s ease-out; }
@keyframes labelHit { from { background: color-mix(in srgb, var(--c) 35%, transparent); } }
.beats-cell { padding: 0; border: 0; border-radius: 6px; background: rgba(255,255,255,.07); cursor: pointer; transition: background .1s, transform .1s; }
.beats-cell.beat { background: rgba(255,255,255,.12); }
.beats-cell:hover { background: rgba(255,255,255,.2); }
.beats-cell.on { background: var(--c); box-shadow: 0 0 14px color-mix(in srgb, var(--c) 55%, transparent); }
.beats-cell.now { outline: 2px solid rgba(255,255,255,.75); outline-offset: -2px; }
.beats-cell.hit { animation: cellHit .22s ease-out; }
@keyframes cellHit { from { transform: scale(1.3); filter: brightness(1.8); } }
.beats-foot { display: flex; gap: 10px; align-items: stretch; }
.beats-keys { flex: 1; display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; height: 54px; }
.beats-key { font: inherit; border: 0; border-radius: 0 0 8px 8px; background: #f3ead8; color: #14152a; cursor: pointer; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; font-size: 12px; font-weight: 700; }
.beats-key.hit { animation: keyHit .25s ease-out; }
@keyframes keyHit { from { background: #ff5d8f; transform: translateY(3px); } }
.beats-hint { margin: 0; font-size: 12px; opacity: .55; }

/* ride */
.ride { height: 100%; background: #10133a; }
.ride canvas { width: 100%; height: 100%; display: block; cursor: pointer; touch-action: none; }

@media (max-width: 640px) {
  .os-name, .os-clock { display: none; }
  .os-dock { gap: 1vh; padding: 1.2vh; max-width: calc(100vw - 16px); height: auto; }
  .dock-item { height: auto; width: calc((100vw - 16px - 2.4vh - 7vh) / 8); }
  .work-side, .notes-side { width: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .dot, .loader-dusk { animation: none; }
}

/* focus rings only for keyboard users */
#os button:focus, #card button:focus, #card a:focus { outline: none; }
#os button:focus-visible, #card button:focus-visible, #card a:focus-visible, #plain a:focus-visible { outline: 2px solid #b9b6ff; outline-offset: 2px; }

/* ================================================================ reading in the studio */
.book-wrap, .glass-wrap { position: fixed; inset: 0; z-index: 300000; display: grid; place-items: center; background: rgba(6,5,14,.5); backdrop-filter: blur(10px); opacity: 0; transition: opacity .3s ease; }
.book-wrap[hidden], .glass-wrap[hidden] { display: none; }
.book-wrap.on, .glass-wrap.on { opacity: 1; }

/* an open book: the left page holds the title and sections, the right page is the essay */
.book { position: relative; width: min(1180px, 94vw); height: min(800px, 90vh); display: grid; grid-template-columns: 36% 1fr; border-radius: 6px 10px 10px 6px; color: #2b2418;
  background: linear-gradient(90deg, #efe6d2 0%, #f8f1e1 5%, #f8f1e1 32%, #e9dfc9 35.6%, #d8ccb2 36%, #e9dfc9 36.4%, #f8f1e1 41%, #f8f1e1 96%, #efe6d2 100%);
  box-shadow: 0 0 0 10px #2f2a5e, 0 0 0 11px rgba(255,255,255,.12), 0 40px 120px rgba(0,0,0,.65), inset 0 0 60px rgba(120,90,40,.12);
  transform: translateY(18px) scale(.97); transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.book-wrap.on .book { transform: none; }
.book-left { min-height: 0; overflow-y: auto; padding: 44px 34px 28px 44px; display: flex; flex-direction: column; gap: 22px; }
.book-right { min-height: 0; overflow-y: auto; padding: 44px 58px 60px 50px; outline: none; scroll-behavior: smooth; }
.book-flow { font: 17.5px/1.68 Georgia, "Iowan Old Style", "Times New Roman", serif; max-width: 62ch; }
.book-title p:first-child { margin: 0 0 8px; font: 600 12.5px var(--font); letter-spacing: .05em; color: #4038c9; }
.book-title h1 { margin: 0 0 12px; font: 700 28px/1.15 Georgia, serif; letter-spacing: -.01em; }
.book-lede { margin: 0; font: italic 15px/1.5 Georgia, serif; opacity: .78; }
.book-label { margin: 0 0 6px; font: 700 11px var(--font); letter-spacing: .08em; text-transform: uppercase; opacity: .5; }
.book-toc, .book-more { display: flex; flex-direction: column; gap: 1px; }
.book-toc[hidden] { display: none; }
.book-toc-item, .book-more-item { font: 500 13.5px/1.35 var(--font); color: inherit; text-align: left; background: none; border: 0; border-left: 2px solid transparent; padding: 6px 10px; cursor: pointer; border-radius: 0 6px 6px 0; opacity: .72; }
.book-toc-item:hover, .book-more-item:hover { background: rgba(90,70,30,.1); opacity: 1; }
.book-toc-item.on { border-left-color: #4038c9; color: #4038c9; opacity: 1; font-weight: 600; }
.book-orig { margin-top: auto; font: 500 12px var(--font); color: inherit; opacity: .6; }
.book-flow p { margin: 0 0 1em; }
.book-flow h2, .book-flow h3, .book-flow h4, .book-flow h5 { margin: 1.5em 0 .5em; font: 700 22px/1.25 Georgia, serif; }
.book-flow h4, .book-flow h5 { font-size: 18px; }
.book-flow a { color: #4038c9; text-underline-offset: 3px; }
.book-flow ul, .book-flow ol { margin: 0 0 1em; padding-left: 1.3em; } .book-flow li { margin-bottom: .35em; }
.book-flow blockquote { margin: 0 0 1em; padding-left: 14px; border-left: 3px solid #c9bda2; font-style: italic; }
.book-flow code { font: 13.5px var(--mono); background: rgba(90,70,30,.1); padding: 1px 5px; border-radius: 4px; }
.book-flow pre { margin: 0 0 1em; padding: 12px; background: #2b2640; color: #e8e9f2; border-radius: 6px; overflow-x: auto; } .book-flow pre code { background: none; padding: 0; font-size: 12.5px; }
.book-flow figure { margin: 0 0 1.2em; } .book-flow img { display: block; max-width: 100%; margin: 0 auto; border-radius: 4px; box-shadow: 0 2px 10px rgba(60,40,10,.25); }
.book-flow hr { border: 0; height: 1px; background: #c9bda2; margin: 1.6em 20%; }
.book-end { margin-top: 2em !important; font: 600 13px var(--font); letter-spacing: .05em; opacity: .55; }
.book-gutter { position: absolute; left: 36%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: rgba(90,70,30,.18); pointer-events: none; }
.book-x, .glass-x { position: absolute; right: 12px; top: 10px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; font-size: 24px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; z-index: 2; }
.book-x:hover, .glass-x:hover { opacity: 1; background: rgba(120,100,60,.15); }
@media (max-width: 860px) {
  .book { display: block; overflow-y: auto; background: #f8f1e1; }
  .book-left { overflow: visible; padding: 40px 24px 8px; } .book-more, .book-orig { display: none; }
  .book-right { overflow: visible; padding: 16px 24px 48px; } .book-gutter { display: none; }
}

/* a glass page for projects */
.glass { position: relative; width: min(760px, 94vw); max-height: 88vh; display: flex; border-radius: 22px; color: #fff; background: rgba(18,17,34,.62); backdrop-filter: blur(30px) saturate(1.4); border: 1px solid rgba(255,255,255,.16); box-shadow: 0 40px 120px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.12); transform: translateY(18px) scale(.97); transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.glass-wrap.on .glass { transform: none; }
.glass-wrap { background: rgba(6,5,14,.28); backdrop-filter: blur(4px); }
.glass-body { overflow-y: auto; padding: 38px 42px 40px; font-size: 15.5px; line-height: 1.65; color: rgba(255,255,255,.86); }
.glass-body p { margin: 0 0 1em; } .glass-body a { color: #b9b6ff; } .glass-body code { font: 13px var(--mono); background: rgba(255,255,255,.1); padding: 1px 5px; border-radius: 4px; }
.glass-head { margin-bottom: 22px; }
.glass-kicker { margin: 0 0 8px !important; font-size: 12.5px; font-weight: 600; letter-spacing: .04em; color: #b9b6ff; }
.glass-body h1 { margin: 0 0 12px; font-size: 34px; font-weight: 700; letter-spacing: -.02em; color: #fff; line-height: 1.1; }
.glass-lede { font-size: 17px; color: #fff; }
.glass-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.glass-tags span { font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 7px; background: rgba(255,255,255,.1); }
.glass-btn { display: inline-block; padding: 9px 15px; border-radius: 10px; background: var(--accent); color: #fff !important; font-size: 13.5px; font-weight: 600; text-decoration: none; }
.glass-btn:hover { background: #807cff; }
.glass-fig { margin: 4px 0 20px; } .glass-fig img { display: block; width: 100%; border-radius: 12px; border: 1px solid rgba(255,255,255,.14); }
