/* vitautas.eu — "desk" design system.
   Sections: tokens · fonts · base · motion system · header · hero · quest printer · cards/shelves ·
   tools bench · experiments studio · human · footer · components · page transitions · responsive · reduced motion */

/* ---------- tokens ---------- */
:root {
  --desk: #F2F0E8; --paper: #FBFAF4; --receipt: #FFFEF8; --ink: #171717; --muted: #5F5D55;
  --line: #D9D5C7; --rule: #E4E0D2; --soft: #ECE9DE;
  --lime: #B7FF2A; --violet: #7761FF; --yellow: #FFDC5E; --pink: #FFD3DC; --blue: #CFE8F2; --mint: #CDEFD8;
  --on-color: #171717; --danger: #C2392B;
  --shadow: 0 1px 0 rgba(23,23,23,.06), 0 12px 26px -14px rgba(23,23,23,.35);
  --shadow-lift: 0 2px 0 rgba(23,23,23,.05), 0 22px 36px -16px rgba(23,23,23,.4);
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;
  --sans: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 14px;
  /* motion */
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-in: cubic-bezier(.6, 0, .9, .4);
  --ease-spring: linear(0, .006, .025 2.8%, .101 6.1%, .539 18.9%, .721 25.3%, .849 31.5%, .937 38.1%, .968 41.8%, .991 45.7%, 1.006 50%, 1.013 55.4%, 1.011 63.9%, 1.003 78.6%, 1);
  --dur-1: 140ms; --dur-2: 260ms; --dur-3: 520ms; --dur-4: 900ms;
  color-scheme: light;
}
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }
:root[data-theme="dark"], :root:not([data-theme="light"]):has(body) { }
/* dark palette is applied through color-scheme-driven custom properties below */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #131510; --paper: #1D1F18; --receipt: #FFFEF8; --ink: #F2F0E8; --muted: #A9A79C;
    --line: #35382C; --rule: #2C2F25; --soft: #262921;
    --shadow: 0 1px 0 rgba(0,0,0,.4), 0 14px 28px -14px rgba(0,0,0,.8);
    --shadow-lift: 0 2px 0 rgba(0,0,0,.4), 0 24px 40px -16px rgba(0,0,0,.9);
  }
}
:root[data-theme="dark"] {
  --desk: #131510; --paper: #1D1F18; --receipt: #FFFEF8; --ink: #F2F0E8; --muted: #A9A79C;
  --line: #35382C; --rule: #2C2F25; --soft: #262921;
  --shadow: 0 1px 0 rgba(0,0,0,.4), 0 14px 28px -14px rgba(0,0,0,.8);
  --shadow-lift: 0 2px 0 rgba(0,0,0,.4), 0 24px 40px -16px rgba(0,0,0,.9);
}

/* ---------- fonts ---------- */
@font-face { font-family: Manrope; font-weight: 400 800; font-display: swap; src: url("/assets/fonts/manrope-latin.woff2") format("woff2"); unicode-range: U+0-FF, U+131, U+152-153, U+2BB-2BC, U+2C6, U+2DA, U+2DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Manrope; font-weight: 400 800; font-display: swap; src: url("/assets/fonts/manrope-latin-ext.woff2") format("woff2"); unicode-range: U+100-2BA, U+2BD-2C5, U+2C7-2CC, U+2CE-2D7, U+2DD-2FF, U+304, U+308, U+329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Manrope; font-weight: 400 800; font-display: swap; src: url("/assets/fonts/manrope-cyrillic.woff2") format("woff2"); unicode-range: U+301, U+400-45F, U+490-491, U+4B0-4B1, U+2116; }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--desk); color: var(--ink); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; min-height: 100dvh; display: flex; flex-direction: column; }
html.theming body, html.theming * { transition: background-color var(--dur-3) var(--ease-out), color var(--dur-3) var(--ease-out), border-color var(--dur-3) var(--ease-out); }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
img, svg, canvas { display: block; max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, h3 { font-weight: 800; letter-spacing: -.03em; line-height: 1.08; margin: 0; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 2.5px solid var(--violet); outline-offset: 3px; border-radius: 6px; transition: outline-offset var(--dur-1) var(--ease-out); }
::selection { background: var(--lime); color: #171717; }
.wrap { width: min(1120px, 100% - 40px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)); margin: 0 auto; }
/* Held, drawn-on or dragged objects: no scroll hijack, no text selection, no iOS long-press menu. */
.no-touch-menu { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.no-callout { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.label { font: 600 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 50; background: var(--lime); color: #171717; padding: 12px 16px; border-radius: 10px; font-weight: 800; text-decoration: none; transition: top var(--dur-2) var(--ease-out); }
.skip:focus { top: 12px; }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
main { flex: 1; }

/* ---------- motion system ---------- */
@keyframes rise { from { opacity: 0; translate: 0 18px; } to { opacity: 1; translate: 0 0; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { 0% { scale: .92; } 55% { scale: 1.04; } 100% { scale: 1; } }
@keyframes slam { 0% { opacity: 0; scale: 2.2; rotate: -22deg; } 60% { opacity: .95; scale: .96; rotate: -8deg; } 100% { opacity: .9; scale: 1; rotate: -10deg; } }
@keyframes wiggle { 0%, 100% { rotate: 7deg; } 30% { rotate: 2deg; } 60% { rotate: 10deg; } }
@keyframes sweep { from { background-size: 0% 100%; } to { background-size: 100% 100%; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes shimmer { from { translate: -120% 0; } to { translate: 220% 0; } }
@keyframes drop { from { opacity: 0; translate: 0 -40px; rotate: 20deg; } 70% { translate: 0 4px; rotate: 5deg; } to { opacity: 1; translate: 0 0; rotate: 7deg; } }
@keyframes word-in { from { opacity: 0; translate: 0 .6em; filter: blur(4px); } to { opacity: 1; translate: 0 0; filter: blur(0); } }
@keyframes bit { 0% { opacity: 1; translate: 0 0; rotate: 0deg; } 100% { opacity: 0; translate: var(--x) calc(var(--y) * -1 + 220px); rotate: var(--r); } }
@keyframes nudge { 50% { translate: 3px -3px; } }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
@keyframes spin { to { rotate: 360deg; } }
@keyframes pulse-ring { from { scale: .8; opacity: .8; } to { scale: 1.6; opacity: 0; } }

/* Entry choreography on page load. Elements opt in with [data-rise]; --i staggers siblings. */
[data-rise] { animation: rise var(--dur-3) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 70ms); }
/* Scroll-driven reveal for anything below the fold; falls back to simply visible. */
.reveal { opacity: 1; }
@supports (animation-timeline: view()) {
  .reveal { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 36%; }
}
.pop { animation: pop var(--dur-2) var(--ease-spring); }
.bits { position: fixed; z-index: 90; pointer-events: none; }
.bits i { position: absolute; width: 8px; height: 12px; border-radius: 2px; animation: bit var(--d) var(--ease-out) forwards; }

/* ---------- header ---------- */
.masthead { display: flex; align-items: center; gap: 20px; padding: calc(18px + env(safe-area-inset-top, 0px)) 0 18px; border-bottom: 1px solid var(--line); view-transition-name: masthead; }
.mark { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 15px; letter-spacing: .03em; text-decoration: none; margin-right: 6px; }
.mark .v { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; background: #171717; color: #F2F0E8; font-size: 19px; letter-spacing: -.04em; border: 1px solid var(--line); transition: rotate var(--dur-2) var(--ease-spring), scale var(--dur-2) var(--ease-spring); }
.mark:hover .v { rotate: -6deg; scale: 1.06; }
.mark .v i { font-style: normal; color: var(--lime); animation: blink 1.4s steps(1) infinite; }
.mark .exe { font-weight: 500; color: var(--muted); }
.nav { display: flex; gap: 2px; margin-right: auto; }
.nav a { position: relative; padding: 10px 12px; border-radius: 10px; text-decoration: none; font-weight: 600; font-size: 15px; transition: background var(--dur-1) var(--ease-out); }
.nav a:hover { background: var(--soft); }
.nav a::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 4px; height: 2px; background: var(--ink); scale: 0 1; transform-origin: left; transition: scale var(--dur-2) var(--ease-out); }
.nav a[aria-current]::after { scale: 1 1; }
.langs { display: flex; gap: 2px; }
.langs a { display: grid; place-items: center; min-width: 44px; height: 44px; border-radius: 10px; text-decoration: none; font: 600 12px var(--mono); transition: background var(--dur-1) var(--ease-out); }
.langs a:hover { background: var(--soft); }
.langs a[aria-current] { background: var(--ink); color: var(--desk); }
.theme { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); display: grid; place-items: center; transition: rotate var(--dur-3) var(--ease-spring), background var(--dur-1); }
.theme:hover { rotate: 40deg; }
.theme .moon { display: none; }
:root[data-theme="dark"] .theme .sun { display: none; }
:root[data-theme="dark"] .theme .moon { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme .sun { display: none; } :root:not([data-theme="light"]) .theme .moon { display: block; } }
.menu-btn { display: none; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: start; padding: 52px 0 36px; }
.hello { font-size: 26px; letter-spacing: -.02em; }
.hero h1 { font-size: clamp(52px, 9vw, 104px); line-height: .92; letter-spacing: -.05em; margin: 4px 0 26px; display: flex; flex-wrap: nowrap; }
.hero h1 span { display: inline-block; animation: rise var(--dur-3) var(--ease-out) both; animation-delay: calc(var(--i) * 45ms + 80ms); }
.hero h1 .dot { color: var(--violet); }
.thought { font-size: 20px; }
.thought-phrase { display: block; margin-top: 2px; padding: 0 .1em; border: 0; text-align: left; font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; background: linear-gradient(transparent 58%, var(--lime) 58%, var(--lime) 92%, transparent 92%) no-repeat 0 0 / 100% 100%; animation: sweep var(--dur-4) var(--ease-out) .5s both; cursor: pointer; }
:root[data-theme="dark"] .thought-phrase { background-image: linear-gradient(transparent 62%, #4d6b12 62%, #4d6b12 94%, transparent 94%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .thought-phrase { background-image: linear-gradient(transparent 62%, #4d6b12 62%, #4d6b12 94%, transparent 94%); } }
.thought-phrase .w { display: inline-block; animation: word-in var(--dur-3) var(--ease-out) both; animation-delay: calc(var(--i) * 60ms); white-space: pre; }
.thought small { display: block; margin-top: 10px; font: 500 12px var(--mono); color: var(--muted); }
.lede { color: var(--muted); font-size: 18px; max-width: 34ch; margin-top: 26px; }

/* ---------- quest printer ---------- */
.station { position: relative; max-width: 440px; margin-left: auto; width: 100%; }
.sticker { position: absolute; z-index: 3; right: -18px; top: -22px; rotate: 7deg; background: var(--yellow); color: var(--on-color); padding: 10px 14px; border-radius: 6px; font: 700 12px/1.3 var(--mono); letter-spacing: .06em; box-shadow: var(--shadow); animation: drop var(--dur-4) var(--ease-spring) .4s both; white-space: pre-line; transform-origin: 20% 20%; }
.sticker:hover { animation: wiggle .6s var(--ease-spring); }
.printer { position: relative; z-index: 2; background: #171717; color: #F2F0E8; border-radius: 20px 20px 12px 12px; padding: 20px 20px 16px; box-shadow: var(--shadow-lift); }
.printer .label { color: #A9A79C; }
.printer h2 { font-size: 30px; letter-spacing: -.03em; line-height: 1.05; margin-bottom: 4px; color: #F2F0E8; }
.printer p { margin-bottom: 16px; color: #C9C6BA; }
.printer .light { position: absolute; top: 20px; right: 20px; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 0 rgba(183,255,42,.5); }
.printer.busy .light { animation: pulse-ring .7s ease-out infinite; }
.print { width: 100%; min-height: 52px; border: 0; border-radius: 12px; background: var(--lime); color: #171717; font-weight: 800; font-size: 17px; transition: scale var(--dur-1) var(--ease-out), filter var(--dur-1); }
.print:hover { filter: brightness(1.05); }
.print:active { scale: .97; }
.print:disabled { opacity: .6; cursor: progress; }
.slot { position: relative; height: 8px; margin: 16px -6px 0; border-radius: 6px; background: #000; box-shadow: inset 0 2px 3px rgba(255,255,255,.12); overflow: hidden; }
.printer.busy .slot::after { content: ""; position: absolute; inset: 0; width: 40%; background: linear-gradient(90deg, transparent, rgba(183,255,42,.6), transparent); animation: shimmer .9s linear infinite; }
.feed { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--dur-4) var(--ease-out); margin: -10px 26px 0; position: relative; z-index: 1; }
.feed.out { grid-template-rows: 1fr; }
.feed > div { overflow: hidden; }
.receipt { position: relative; background: var(--receipt); color: #171717; padding: 26px 20px 30px; font: 13px/1.5 var(--mono);
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 14px 100%; mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 14px 100%; }
.receipt .head { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed #B9B5A6; padding-bottom: 8px; margin-bottom: 12px; font-size: 12px; }
.receipt .rarity { font-weight: 800; }
.receipt .rarity[data-rarity="odd"] { color: var(--violet); }
.receipt .rarity[data-rarity="questionable"] { color: #B2560A; }
.receipt .rarity[data-rarity="legendary"] { color: var(--danger); }
.receipt .status { font-size: 11px; letter-spacing: .08em; color: #5F5D55; margin: 0 0 10px; }
.receipt .subject { margin: 0; font-size: 12px; color: #5F5D55; text-transform: uppercase; letter-spacing: .06em; }
.receipt h3 { font: 800 22px/1.2 var(--sans); letter-spacing: -.02em; margin: 4px 0 6px; color: #171717; }
.receipt .how { font: 15px/1.45 var(--sans); margin: 0 0 14px; }
.receipt ol.chain { font: 15px/1.45 var(--sans); margin: 4px 0 14px; padding-left: 20px; }
.receipt ol.chain li + li { margin-top: 6px; }
.receipt dl { margin: 0; border-top: 1px dashed #B9B5A6; border-bottom: 1px dashed #B9B5A6; padding: 8px 0; }
.receipt dl div { display: flex; justify-content: space-between; gap: 12px; }
.receipt dt { color: #5F5D55; }
.receipt dd { margin: 0; font-weight: 700; text-align: right; }
.receipt .outcome { margin: 12px 0 0; padding: 10px 12px; background: #F2F0E8; border-radius: 8px; font: 15px/1.4 var(--sans); }
.receipt .outcome b { display: block; font-size: 20px; letter-spacing: -.02em; }
.receipt .acts { display: flex; gap: 10px; align-items: center; margin-top: 14px; position: relative; }
.receipt .acts button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border-radius: 10px; font: 700 15px var(--sans); padding: 0 16px; transition: scale var(--dur-1) var(--ease-out); }
.receipt .acts button:active { scale: .97; }
.receipt .accept { flex: 1; border: 0; background: #171717; color: #FFFEF8; }
.receipt .another { border: 1px solid #171717; background: transparent; color: #171717; }
.receipt .tools { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.receipt .barcode { display: block; width: 110px; height: 22px; background: repeating-linear-gradient(90deg, #171717 0 2px, transparent 2px 4px, #171717 4px 5px, transparent 5px 8px, #171717 8px 11px, transparent 11px 13px); }
.receipt .link { border: 0; background: none; padding: 6px 0; font: 600 12px var(--mono); text-decoration: underline; cursor: pointer; }
.receipt details { margin-top: 10px; font-size: 12px; }
.receipt summary { cursor: pointer; }
.stamp { position: absolute; right: 8px; top: -92px; border: 2.5px solid var(--violet); color: var(--violet); border-radius: 8px; padding: 2px 10px; font: 800 15px var(--mono); letter-spacing: .1em; opacity: 0; pointer-events: none; }
.stamp.on { animation: slam var(--dur-3) var(--ease-out) forwards; }
.receipt .backup { margin-top: 12px; border-top: 1px dashed #B9B5A6; padding-top: 10px; font: 13px/1.45 var(--sans); }
.receipt .backup b { display: block; font-size: 15px; margin-bottom: 4px; }
.receipt .backup input { width: 100%; margin: 8px 0 2px; min-height: 40px; border: 1px solid #B9B5A6; border-radius: 8px; background: #F2F0E8; color: #171717; padding: 0 10px; font: 16px var(--mono); }
.receipt .backup-acts { margin: 4px 0; }
.receipt .backup-qr { margin: 8px auto 4px; border-radius: 6px; }
.receipt .backup-hint { color: #5F5D55; font-size: 12px; margin-top: 6px; }
.receipt details .link { display: block; margin-top: 4px; }
/* voice */
.voice-in .w { display: inline-block; white-space: pre; animation: word-in var(--dur-3) var(--ease-out) both; animation-delay: calc(var(--i) * 45ms); }
.receipt .voice-hint { font: 13px/1.4 var(--sans); color: #5F5D55; margin: -8px 0 12px; }
.status-slip { max-width: 420px; margin: 26px 0 0; position: static; }
.receipt .msg { margin-top: 8px; font-size: 12px; color: #5F5D55; min-height: 1em; }
.quest-resume { margin-top: 10px; display: flex; gap: 10px; align-items: center; color: #C9C6BA; font-size: 14px; }
.quest-resume button { border: 1px solid #5F5D55; background: transparent; color: #F2F0E8; border-radius: 8px; padding: 8px 12px; font-weight: 700; }

/* ---------- shelves & index cards ---------- */
section.shelf { padding: 36px 0; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.shelf-head h2 { font-size: 34px; letter-spacing: -.035em; }
.shelf-head a { font-weight: 700; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.shelf-head a:hover svg { animation: nudge .5s var(--ease-spring); }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.card { position: relative; display: flex; flex-direction: column; background: var(--paper); background-image: linear-gradient(var(--pink) 0 0), repeating-linear-gradient(transparent 0 27px, var(--rule) 27px 28px); background-size: 100% 2px, 100% 100%; background-position: 0 46px, 0 50px; background-repeat: no-repeat, repeat; border-radius: 6px; padding: 16px 20px 22px; box-shadow: var(--shadow); min-height: 300px; text-decoration: none; color: inherit; rotate: var(--tilt, 0deg); transition: rotate var(--dur-3) var(--ease-spring), box-shadow var(--dur-2), translate var(--dur-2) var(--ease-out); }
.card:nth-child(3n+1) { --tilt: -1.2deg; } .card:nth-child(3n+2) { --tilt: .9deg; } .card:nth-child(3n+3) { --tilt: -.5deg; }
.card:hover, .card:focus-within { rotate: 0deg; box-shadow: var(--shadow-lift); translate: 0 -4px; }
.card .label { margin-bottom: 18px; }
.card h3 { font-size: 24px; line-height: 1.17; letter-spacing: -.025em; margin-bottom: 10px; }
.card p { color: var(--muted); }
.card .play { margin-top: auto; padding-top: 16px; }
.card .preview { margin-top: auto; padding-top: 12px; height: 110px; display: grid; place-items: center; color: var(--muted); }
.card .preview svg { width: 100%; height: 100%; }
a.card .go { position: absolute; right: 16px; bottom: 16px; width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: var(--desk); display: grid; place-items: center; transition: scale var(--dur-2) var(--ease-spring); }
a.card:hover .go { scale: 1.12; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips > * { border: 1px solid var(--line); background: var(--paper); border-radius: 99px; padding: 8px 14px; font-weight: 600; font-size: 14px; text-decoration: none; transition: background var(--dur-1), translate var(--dur-2) var(--ease-spring); }
.chips a:hover { background: var(--soft); translate: 0 -2px; }

/* ---------- tiles (tools) ---------- */
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.tile { display: block; text-decoration: none; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 18px; transition: translate var(--dur-2) var(--ease-out), box-shadow var(--dur-2), border-color var(--dur-2); }
.tile:hover { translate: 0 -4px; box-shadow: var(--shadow); border-color: transparent; }
.tile i { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: #171717; margin-bottom: 26px; transition: rotate var(--dur-3) var(--ease-spring), scale var(--dur-3) var(--ease-spring); }
.tile:hover i { rotate: -8deg; scale: 1.08; }
.tile b { display: block; font-size: 17px; letter-spacing: -.01em; }
.tile span { display: block; color: var(--muted); font-size: 14px; line-height: 1.4; margin-top: 2px; }
details.nerds { margin-top: 16px; }
details.nerds summary { cursor: pointer; font-weight: 700; padding: 10px 0; width: max-content; list-style: none; display: flex; align-items: center; gap: 8px; }
details.nerds summary::-webkit-details-marker { display: none; }
details.nerds summary::before { content: "▸"; display: inline-block; transition: rotate var(--dur-2) var(--ease-spring); }
details.nerds[open] summary::before { rotate: 90deg; }
details.nerds > div { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
details.nerds a { border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 10px 14px; text-decoration: none; font: 600 13px var(--mono); transition: background var(--dur-1); }
details.nerds a:hover { background: var(--soft); }
details.nerds[open] > div > a { animation: rise var(--dur-2) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 50ms); }

/* ---------- page heads ---------- */
.page-head { padding: 44px 0 8px; }
.page-head h1 { font-size: clamp(40px, 6vw, 64px); line-height: 1; letter-spacing: -.045em; margin-bottom: 10px; }
.page-head p:not(.label) { color: var(--muted); font-size: 18px; max-width: 50ch; }

/* ---------- tools bench ---------- */
.picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 26px 0 22px; view-transition-name: picker; }
.picker a { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 6px 16px 6px 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); font-weight: 700; font-size: 15px; text-decoration: none; transition: border-color var(--dur-1), box-shadow var(--dur-1), translate var(--dur-2) var(--ease-out); }
.picker a:hover { translate: 0 -2px; }
.picker a i { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: #171717; }
.picker a[aria-current] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.bench { display: grid; grid-template-columns: 1fr 360px; gap: 40px; align-items: start; background: var(--paper); border: 1px solid var(--line); border-radius: 22px; padding: 30px; view-transition-name: bench; }
.bench h2 { font-size: 30px; letter-spacing: -.03em; line-height: 1.1; margin-bottom: 20px; }
.bench .hint { color: var(--muted); font-size: 14px; margin-top: 8px; }
.field { margin-bottom: 20px; }
.field > label, .field > .cap { display: block; font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.field input:not([type=checkbox]):not([type=range]):not([type=file]), .field select, .field textarea { width: 100%; min-height: 56px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--desk); color: var(--ink); font: 700 20px var(--sans); padding: 0 16px; transition: border-color var(--dur-1), box-shadow var(--dur-2) var(--ease-out); }
.field textarea { padding: 14px 16px; font-size: 16px; font-weight: 500; line-height: 1.45; min-height: 150px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 4px rgba(119,97,255,.22); }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--danger); }
.field .err { color: var(--danger); font-size: 14px; font-weight: 600; margin-top: 6px; }
.field .err:empty { display: none; }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 44px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 56px; height: 56px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--desk); font-size: 24px; font-weight: 700; transition: scale var(--dur-1) var(--ease-out), background var(--dur-1); }
.stepper button:hover { background: var(--soft); }
.stepper button:active { scale: .92; }
.stepper output { min-width: 64px; text-align: center; font-weight: 800; font-size: 26px; }
.segment { display: flex; gap: 8px; flex-wrap: wrap; }
.segment button { min-width: 64px; min-height: 48px; padding: 0 16px; border: 1.5px solid var(--line); border-radius: 99px; background: var(--desk); font-weight: 700; transition: background var(--dur-2) var(--ease-out), color var(--dur-2), scale var(--dur-1); }
.segment button:active { scale: .95; }
.segment button[aria-pressed="true"] { background: var(--ink); color: var(--desk); border-color: var(--ink); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--violet); }
.range { display: flex; align-items: center; gap: 14px; }
.range input { flex: 1; accent-color: var(--violet); }
.range output { font: 700 14px var(--mono); min-width: 4ch; text-align: right; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1.5px solid var(--ink); background: transparent; font-weight: 800; text-decoration: none; transition: scale var(--dur-1) var(--ease-out), background var(--dur-1), color var(--dur-1); }
.btn:active { scale: .97; }
.btn.dark { background: var(--ink); color: var(--desk); }
.btn.dark:hover { background: var(--violet); border-color: var(--violet); color: #fff; }
.btn.lime { background: var(--lime); border-color: var(--lime); color: #171717; }
.btn:disabled { opacity: .45; cursor: default; scale: 1; }
.slip { filter: drop-shadow(0 10px 14px rgba(23,23,23,.2)); position: sticky; top: 20px; }
.slip .receipt { padding-bottom: 26px; }
.slip .big { font: 800 26px/1.2 var(--sans); letter-spacing: -.02em; margin: 6px 0 14px; color: #171717; overflow-wrap: anywhere; }
.slip .big.wait { color: #8A877B; font-weight: 600; }
.slip .big.bad { color: var(--danger); font-weight: 600; }
.slip .big.pop { animation: pop var(--dur-2) var(--ease-spring); }
.slip pre { font: 13px/1.45 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0 14px; max-height: 380px; overflow: auto; }
.slip canvas, .slip img { margin: 6px auto 14px; border-radius: 6px; }
.slip .swatch { height: 92px; border-radius: 8px; display: grid; place-items: center; font: 800 22px var(--sans); margin: 6px 0 14px; transition: background var(--dur-2), color var(--dur-2); }
.drop { border: 2px dashed var(--line); border-radius: 14px; padding: 22px; text-align: center; background: var(--desk); transition: border-color var(--dur-2), background var(--dur-2), scale var(--dur-2) var(--ease-spring); cursor: pointer; }
.drop.over { border-color: var(--violet); background: rgba(119,97,255,.08); scale: 1.01; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop b { display: block; font-size: 17px; }
.drop span { color: var(--muted); font-size: 14px; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 12px; }
.compare b { display: block; font-size: 15px; }

/* ---------- experiments studio ---------- */
.studio { display: grid; grid-template-columns: minmax(0, 480px) 1fr; gap: 44px; align-items: start; margin-top: 26px; view-transition-name: studio; }
.board { background: var(--paper); border-radius: 8px; box-shadow: var(--shadow); padding: 14px; position: relative; }
.board.dotted { background-image: radial-gradient(var(--line) 1.2px, transparent 1.4px); background-size: 22px 22px; }
.board > canvas, .board > svg { width: 100%; height: auto; aspect-ratio: 1; border-radius: 4px; touch-action: none; display: block; }
.score { font-size: clamp(72px, 11vw, 112px); font-weight: 800; letter-spacing: -.05em; line-height: 1; margin: 0; font-variant-numeric: tabular-nums; }
.score small { font-size: .4em; letter-spacing: -.02em; margin-left: 4px; }
.verdict { font-size: 22px; font-weight: 700; line-height: 1.3; margin: 10px 0 6px; min-height: 1.3em; }
.verdict.pop { animation: pop var(--dur-2) var(--ease-spring); }
.best { color: var(--muted); font: 600 13px var(--mono); margin: 0; }
details.why { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 8px; }
details.why summary { cursor: pointer; font-weight: 700; padding: 10px 0; width: max-content; }
details.why p { color: var(--muted); margin: 0 0 8px; max-width: 46ch; }
.hold { width: 100%; min-height: 64px; border: 2px solid var(--ink); border-radius: 16px; background: var(--paper); font-weight: 800; font-size: 18px; touch-action: none; user-select: none; -webkit-user-select: none; position: relative; overflow: hidden; transition: background var(--dur-2), color var(--dur-2), scale var(--dur-1); }
.hold.on { background: var(--violet); border-color: var(--violet); color: #fff; scale: .98; }
/* No visible timer while holding: a slow breathing glow only, so the count stays in your head. */
.hold.on::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 0 rgba(183,255,42,.0); animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: inset 0 0 0 6px rgba(183,255,42,.45); } }
.board .hold { min-height: 120px; font-size: 20px; }
.others { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.others a, .others span { display: block; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px; font-weight: 700; font-size: 15px; line-height: 1.3; text-decoration: none; transition: translate var(--dur-2) var(--ease-out), box-shadow var(--dur-2); }
.others a:hover { translate: 0 -3px; box-shadow: var(--shadow); }
.others span { color: var(--muted); }
.others small { display: block; font: 500 12px var(--mono); color: var(--muted); margin-bottom: 6px; }

/* ---------- human ---------- */
.human { display: grid; grid-template-columns: auto 1fr; gap: 40px; align-items: center; }
.note { background: var(--yellow); color: var(--on-color); width: 300px; padding: 26px 24px 30px; rotate: -2deg; box-shadow: var(--shadow); font-size: 19px; line-height: 1.4; font-weight: 600; border-radius: 2px 2px 2px 24px; transition: rotate var(--dur-3) var(--ease-spring); }
.note:hover { rotate: 0deg; }
.note a { display: inline-block; margin-top: 12px; font-weight: 800; }
.human p { max-width: 46ch; color: var(--muted); font-size: 18px; }
.prose { max-width: 62ch; font-size: 18px; line-height: 1.6; }
.prose h2 { font-size: 28px; margin: 36px 0 10px; }
.prose p + p { margin-top: 14px; }
.postcards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 30px; }
.postcard { background: var(--paper); border-radius: 6px; padding: 22px; box-shadow: var(--shadow); rotate: var(--tilt, 0deg); transition: rotate var(--dur-3) var(--ease-spring); min-height: 180px; }
.postcard:nth-child(1) { --tilt: -1.5deg; } .postcard:nth-child(2) { --tilt: 1deg; background: #DCD6FF; color: #171717; } .postcard:nth-child(3) { --tilt: -.6deg; background: var(--mint); color: #171717; }
.postcard:hover { rotate: 0deg; }
.postcard h3 { font-size: 22px; margin-bottom: 8px; }
.postcard p { font-size: 15px; opacity: .85; }

/* ---------- footer ---------- */
footer.site { border-top: 1px solid var(--line); margin-top: 28px; padding: 22px 0 calc(40px + env(safe-area-inset-bottom, 0px)); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
footer.site a { color: inherit; }

/* ---------- components ---------- */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); translate: -50% 0; z-index: 80; background: var(--ink); color: var(--desk); padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lift); transition: opacity var(--dur-2) var(--ease-out), translate var(--dur-2) var(--ease-out), display var(--dur-2) allow-discrete; }
.toast[hidden] { display: none; opacity: 0; translate: -50% 16px; }
@starting-style { .toast { opacity: 0; translate: -50% 16px; } }
.nojs { background: var(--yellow); color: #171717; padding: 10px 16px; border-radius: 10px; font-size: 14px; margin: 16px 0; }
.result-note { font-size: 13px; color: var(--muted); margin-top: 10px; }
.kbd { font: 600 12px var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 2px 6px; }
.notfound { padding: 80px 0; }
.notfound h1 { font-size: clamp(40px, 7vw, 80px); letter-spacing: -.05em; margin-bottom: 20px; }
.notfound .code { font: 800 180px/1 var(--sans); letter-spacing: -.08em; color: var(--soft); position: absolute; right: 0; top: 40px; z-index: -1; user-select: none; }

/* ---------- page transitions (cross-document) ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: var(--dur-2) var(--ease-in) both fade-out-up; }
::view-transition-new(root) { animation: var(--dur-3) var(--ease-out) both rise; }
::view-transition-old(masthead), ::view-transition-new(masthead), ::view-transition-old(picker), ::view-transition-new(picker) { animation: none; mix-blend-mode: normal; }
@keyframes fade-out-up { to { opacity: 0; translate: 0 -10px; } }
/* theme toggle reveal */
::view-transition-old(theme-root) { animation: none; }
::view-transition-new(theme-root) { animation: clip-reveal var(--dur-4) var(--ease-out) both; }
@keyframes clip-reveal { from { clip-path: circle(0 at var(--tx, 95%) var(--ty, 5%)); } to { clip-path: circle(150% at var(--tx, 95%) var(--ty, 5%)); } }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .masthead { flex-wrap: wrap; gap: 6px 10px; }
  .mark { margin-right: auto; font-size: 14px; gap: 8px; }
  .langs a { min-width: 36px; }
  .nav { order: 3; width: 100%; margin: 0; justify-content: space-between; }
  .nav a { padding: 10px 6px; font-size: 14px; }
  .hero { grid-template-columns: 1fr; gap: 40px; padding: 32px 0 20px; }
  .station { margin: 0 auto; }
  .sticker { right: -6px; }
  .cards { grid-template-columns: 1fr; gap: 18px; }
  .card { min-height: 0; --tilt: 0deg; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile i { margin-bottom: 14px; }
  .page-head { padding-top: 28px; }
  .picker a { flex: 1 1 calc(50% - 8px); }
  .bench { grid-template-columns: 1fr; gap: 0; padding: 20px; }
  .bench > .inputs { display: contents; }
  .bench h2 { order: 1; } .bench .field { order: 4; } .bench .field.first { order: 2; } .bench .slip { order: 3; margin: 2px 0 24px; position: static; } .bench .hint { order: 5; } .bench .actions { order: 5; }
  .studio { grid-template-columns: 1fr; gap: 24px; }
  .others { grid-template-columns: 1fr 1fr; }
  .human { grid-template-columns: 1fr; gap: 24px; }
  .note { width: 100%; max-width: 340px; }
  .postcards { grid-template-columns: 1fr; }
  .shelf-head h2 { font-size: 28px; }
  .row { grid-template-columns: 1fr; }
  .notfound .code { font-size: 120px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal, [data-rise], .hero h1 span, .thought-phrase .w { animation: none !important; opacity: 1; translate: none; }
  .mark .v i { animation: none !important; }
  @view-transition { navigation: none; }
}
@media print {
  .masthead, footer.site, .nav, .sticker, .print, .acts, .tools, .theme { display: none !important; }
  body { background: #fff; color: #000; }
}
