/* ivan.ngu: the tape deck. Home = the SEADECK with a cassette per section; a page = one tape, its tracks, the deck bar. */
/* Layout: home = the deck centre stage, a cassette per section floating round it, the sea along the bottom;
   a page = header / track list + track (with its photos) / now-playing bar.
   Look: a mixtape J-card printed in the sea colours of the original site (for TatBlueSea). */
:root {
  --paper: #f3f7f9; --grid: rgb(21 131 176 / .1); --ink: #0e2a57; --muted: #4a6585; --line: rgb(14 42 87 / .2);
  --sea: #1583b0; --sea-1: #c3f0f2; --sea-2: #a2e2e8; --sea-3: #63c7dd; --sea-4: #45b2cc; --sea-5: #2f80b8;
  --hl: #a8ecf7; --coral: #ff6b5e; --card: #ffffff; --tape: rgb(168 236 247 / .7);
  --display: "Archivo", "Zen Kaku Gothic New", "Helvetica Neue", Arial, sans-serif;
  --body: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --mincho: "Shippori Mincho B1", "Yu Mincho", "Hiragino Mincho ProN", serif;
  --shu: #d6363e;
  --sw: #f7fbfc; --sb: #e9f2f5; --np: rgb(243 247 249 / .9); --facts: rgb(255 255 255 / .7); --btn: var(--ink); --btn-fg: #fff;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; color: var(--ink); font: 16px/1.6 var(--body); overflow: hidden;
  background: var(--paper); }
/* 青海波 seigaiha, the "blue sea waves" pattern, faded out toward the top */
body::before { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; background-color: var(--sb);
  background-image: radial-gradient(circle at 100% 150%, var(--sb) 24%, var(--sw) 25%, var(--sw) 28%, var(--sb) 29%, var(--sb) 36%, var(--sw) 36%, var(--sw) 40%, transparent 40%, transparent), radial-gradient(circle at 0 150%, var(--sb) 24%, var(--sw) 25%, var(--sw) 28%, var(--sb) 29%, var(--sb) 36%, var(--sw) 36%, var(--sw) 40%, transparent 40%, transparent), radial-gradient(circle at 50% 100%, var(--sw) 10%, var(--sb) 11%, var(--sb) 23%, var(--sw) 24%, var(--sw) 30%, var(--sb) 31%, var(--sb) 43%, var(--sw) 44%, var(--sw) 50%, var(--sb) 51%, var(--sb) 63%, var(--sw) 64%, var(--sw) 71%, transparent 71%, transparent), radial-gradient(circle at 100% 50%, var(--sw) 5%, var(--sb) 6%, var(--sb) 15%, var(--sw) 16%, var(--sw) 20%, var(--sb) 21%, var(--sb) 30%, var(--sw) 31%, var(--sw) 35%, var(--sb) 36%, var(--sb) 45%, var(--sw) 46%, var(--sw) 49%, transparent 50%, transparent), radial-gradient(circle at 0 50%, var(--sw) 5%, var(--sb) 6%, var(--sb) 15%, var(--sw) 16%, var(--sw) 20%, var(--sb) 21%, var(--sb) 30%, var(--sw) 31%, var(--sw) 35%, var(--sb) 36%, var(--sb) 45%, var(--sw) 46%, var(--sw) 49%, transparent 50%, transparent);
  background-size: 88px 44px;
  -webkit-mask-image: linear-gradient(to bottom, rgb(0 0 0 / .25), #000 85%); mask-image: linear-gradient(to bottom, rgb(0 0 0 / .25), #000 85%); }
/* 縦書き: a vertical line of Japanese down the right edge */
.tate { position: fixed; right: 26px; top: 84px; z-index: 3; writing-mode: vertical-rl; font: 800 15px/1 var(--mincho); letter-spacing: .32em; color: var(--ink); opacity: .6; pointer-events: none; }
.ph h2 .jp { font-family: var(--mincho); font-weight: 800; color: var(--sea); margin-right: 14px; font-size: 1.05em; }
.tracks .side b { font: 900 13px/1 var(--body); letter-spacing: .04em; color: var(--shu); margin-right: 8px; text-transform: none; }
.kick .jk { display: block; font: 700 13px/1.2 var(--body); letter-spacing: .14em; color: var(--ink); margin-bottom: 5px; text-transform: none; }
.hello .greet b { font: 700 13px/1 var(--body); letter-spacing: .1em; margin-right: 8px; text-transform: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }
.lab { font: 600 11.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; }

/* ---------- the sea ---------- */
.sea { position: fixed; left: 0; right: 0; bottom: 0; height: 27vh; z-index: 1; pointer-events: none; overflow: hidden; transition: height .6s cubic-bezier(.2,.8,.2,1); }
body.on-page .sea { height: 9vh; }
.sea svg { position: absolute; left: 0; bottom: 0; width: 200%; height: 100%; mix-blend-mode: multiply; }
.sea .w1 { animation: tide 26s linear infinite; opacity: .9; }
.sea .w2 { animation: tide 19s linear infinite reverse; opacity: .85; }
.sea .w3 { animation: tide 15s linear infinite; opacity: .8; }
.sea .w4 { animation: tide 22s linear infinite reverse; opacity: .75; }
.sea .w5 { animation: tide 12s linear infinite; opacity: .7; }
@keyframes tide { to { transform: translateX(-50%); } }

.brand { position: fixed; z-index: 6; top: 16px; left: 78px; display: flex; align-items: center; gap: 10px; text-decoration: none; font: 900 21px/1 var(--display); letter-spacing: -.01em; color: var(--ink); }
.brand .seal { width: 44px; height: 44px; rotate: -5deg; filter: drop-shadow(0 1px 0 rgb(14 42 87 / .15)); transition: rotate .2s; }
.brand:hover .seal { rotate: 3deg; }

.stage { position: fixed; inset: 0; z-index: 2; }
.screen { position: absolute; inset: 0; overflow: hidden; }

/* ================= HOME ================= */
.hello { position: absolute; left: 84px; bottom: 30px; max-width: 34ch; z-index: 5; background: var(--card); padding: 16px 20px 18px; rotate: -1.2deg; box-shadow: 0 2px 4px rgb(14 42 87 / .18), 0 14px 26px -14px rgb(14 42 87 / .4); }
.hello::before { content: ""; position: absolute; top: -11px; left: 38%; width: 86px; height: 22px; background: var(--tape); rotate: 4deg; }
.hello .greet { color: var(--coral); }
.hello h1 { margin: 6px 0 0; font: 900 clamp(30px, 3vw, 46px)/1.05 var(--display); }
.hello p { margin: 8px 0 0; font-size: 14.5px; color: var(--muted); }
.orbit { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.par { display: block; transition: transform .5s cubic-bezier(.2,.8,.2,1); }
.deckwrap { position: absolute; left: 0; top: 0; translate: -50% -42%; width: clamp(320px, 34vw, 640px); z-index: 4; }
.deck { width: 100%; height: auto; display: block; overflow: visible; filter: drop-shadow(9px 11px 0 rgb(14 42 87 / .2)); user-select: none; }
.deck .key { cursor: pointer; }
.deck .key:focus { outline: none; }
.deck .key:focus-visible .face { stroke: var(--coral); stroke-width: 2.5; }
.deck .key .cap { transition: transform .07s; }
.deck .key.down .cap { transform: translate(1px, 2px); }
.deck .hub { transform-box: view-box; transform-origin: 0 0; }
.deck.playing .hub { animation: spin 1.6s linear infinite; }
@keyframes spin { to { transform: rotate(-360deg); } }
.deck .ledg { fill: #2c4a35; transition: fill .15s; }
.deck.playing .ledg { fill: #44ff7a; filter: drop-shadow(0 0 2px #44ff7a); }
.deck .wheel { transform-box: fill-box; transform-origin: center; transition: transform .3s; }
.deck.empty #tapeIn { opacity: 0; }
.deckbob { display: block; animation: float 6s ease-in-out infinite alternate; }
@keyframes float { from { transform: translateY(-4px) rotate(-.4deg); } to { transform: translateY(5px) rotate(.4deg); } }

.tape { position: absolute; left: var(--x, 0px); top: var(--y, 0px); width: clamp(160px, 13vw, 270px); translate: -50% -50%; z-index: 3; border: 0; padding: 0; background: none; cursor: pointer; outline: none; }
.tape .bob { display: block; animation: bob var(--bob, 5s) ease-in-out infinite alternate; animation-delay: var(--bd, 0s); }
@keyframes bob { from { transform: translateY(-7px) rotate(-1.4deg); } to { transform: translateY(7px) rotate(1.6deg); } }
.tape .tilt { display: block; transform: rotate(var(--r, 0deg)); transition: transform .3s cubic-bezier(.2,.9,.3,1.2); }
.tape svg { display: block; width: 100%; height: auto; filter: drop-shadow(6px 8px 0 rgb(14 42 87 / .2)); }
.tape:hover .tilt, .tape.sel .tilt { transform: rotate(0deg) scale(1.08) translateY(-10px); }
.tape.sel svg { filter: drop-shadow(0 0 0 #fff) drop-shadow(3px 0 0 #fff) drop-shadow(-3px 0 0 #fff) drop-shadow(0 3px 0 #fff) drop-shadow(0 -3px 0 #fff) drop-shadow(8px 12px 0 rgb(14 42 87 / .22)); }
.tape:focus-visible .tilt { outline: 2px dashed var(--coral); outline-offset: 6px; }
.tape.in-deck { visibility: hidden; }
.orbit.dim .tape:not(.sel) { opacity: .35; transition: opacity .25s; }

.caption { position: absolute; left: 0; top: 0; translate: -50% 0; z-index: 5; width: min(520px, 80vw); text-align: center; }
.caption .t { font: 900 30px/1.1 var(--display); }
.caption .t span { color: var(--sea); font: 900 .6em/1 "Zen Kaku Gothic New", sans-serif; margin-left: 8px; vertical-align: middle; }
.caption .d { display: inline-block; font-size: 14.5px; margin-top: 6px; background: linear-gradient(100deg, transparent 2%, var(--hl) 4% 95%, transparent 98%); padding: 1px 10px; }

.cmd { position: absolute; z-index: 5; right: 3vw; bottom: 30px; background: var(--card); padding: 10px 14px; rotate: .8deg; box-shadow: 0 2px 4px rgb(14 42 87 / .16); }
.keys { display: flex; gap: 14px; flex-wrap: wrap; font: 400 13.5px/1 var(--body); color: var(--muted); }
.keys span { display: inline-flex; gap: 6px; align-items: center; }
kbd { font: 600 11px/1 var(--mono); border: 1.5px solid var(--line); border-bottom-width: 3px; border-radius: 4px; min-width: 24px; height: 23px; padding: 0 6px; display: inline-grid; place-items: center; color: var(--ink); background: var(--card); }

/* ================= PAGE ================= */
.page { position: absolute; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.ph { display: flex; align-items: center; gap: 16px; padding: 70px 4vw 4px 84px; }
.back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font: 700 14px/1 var(--body); padding: 9px 13px; border: 1.5px dashed var(--line); background: var(--card); flex: none; }
.back:hover { border-style: solid; border-color: var(--ink); }
.ph .mini { width: 62px; flex: none; rotate: -4deg; }
.ph .mini svg { display: block; width: 100%; height: auto; }
.ph h2 { margin: 0; font: 900 clamp(32px, 3vw, 46px)/1 var(--display); outline: none; }
.ph h2 small { font: 700 13px/1 var(--body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-left: 12px; }

.body { display: grid; grid-template-columns: minmax(220px, clamp(270px, 19vw, 340px)) minmax(0, 1fr); gap: 0 clamp(24px, 3.4vw, 60px); padding: 4px 3vw 8px 84px; min-height: 0; width: min(100%, 1720px); justify-self: center; }
.tracks { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: 4px 10px 4px 0; scrollbar-width: thin; }
.tracks > .tin, .track > .tin { margin-block: auto; position: relative; width: 100%; }
.tracks .side { color: var(--sea); margin: 16px 0 6px 10px; }
.tracks .side:first-child { margin-top: 2px; }
.tracks button { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; width: 100%; border: 0; background: none; text-align: left; padding: 7px 10px; cursor: pointer; font: 700 clamp(14.5px, .98vw, 17px)/1.3 var(--body); color: var(--ink); }
.tracks button:hover { background: linear-gradient(100deg, transparent 2%, rgb(168 236 247 / .45) 4% 94%, transparent 97%); }
.tracks .no { font-size: .85em; color: var(--muted); }
.tracks .len { font: 500 12px/1 var(--mono); color: var(--muted); }
.tracks button[aria-selected="true"] { background: linear-gradient(100deg, transparent 2%, var(--hl) 4% 94%, transparent 97%); }

.track { display: flex; flex-direction: column; position: relative; min-height: 0; overflow-y: auto; padding: 18px 14px 14px 6px; scrollbar-width: thin; }
.track .kick { color: var(--coral); }
.track h3 { margin: 8px 0 0; font: 900 clamp(38px, min(4.6vw, 7.6vh), 86px)/1 var(--display); max-width: 18ch; text-wrap: balance; }
.track .squig { display: block; width: min(300px, 60%); height: 14px; margin-top: 6px; }
.track .squig path { fill: none; stroke: var(--sea-3); stroke-width: 3; stroke-linecap: round; }
.track .fn { font: 400 clamp(16px, 1.25vw, 22px)/1.35 var(--body); color: var(--muted); margin-top: 8px; }
.track .cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 26px clamp(28px, 3vw, 56px); margin-top: 22px; align-items: start; }
.track .cols.solo { grid-template-columns: minmax(0, 1.35fr) minmax(220px, .9fr); }
.track .text p { margin: 0 0 12px; font-size: clamp(15.5px, min(1vw, 1.95vh), 18.5px); line-height: 1.7; max-width: 62ch; }
.facts { border: 1.5px dashed var(--line); background: var(--facts); padding: 4px 16px; margin-top: 14px; }
.cols.solo .facts { margin-top: 0; }
.facts div { display: grid; grid-template-columns: 7.4em minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: clamp(14px, .92vw, 16px); }
.facts div:last-child { border-bottom: 0; }
.facts dl { margin: 0; }
.facts dt { color: var(--sea); }
.facts dd { margin: 0; }
.acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--ink); cursor: pointer; text-decoration: none; font: 700 15px/1 var(--body); padding: 11px 16px; background: var(--btn); color: var(--btn-fg); }
.btn.main { background: var(--sea); border-color: var(--sea); color: var(--btn-fg); }
.btn.alt { background: var(--card); color: var(--ink); border: 1.5px dashed var(--line); }
.btn:hover { filter: brightness(1.12); }
.btn.alt:hover { border-style: solid; border-color: var(--ink); }
.big-mail { font: 900 clamp(26px, 2.8vw, 40px)/1.15 var(--display); overflow-wrap: anywhere; margin: 2px 0 8px; }
.meter { height: 12px; border: 1.5px solid var(--ink); margin: 6px 0 16px; max-width: 480px; background: var(--card); }
.meter b { display: block; height: 100%; background: repeating-linear-gradient(-45deg, var(--sea-3) 0 6px, var(--sea-4) 6px 12px); }

/* taped-down photos */
.photos { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px 14px; align-items: start; padding: 12px 6px 6px; }
.photo { position: relative; grid-column: span 2; margin: 0; padding: 8px 8px 30px; background: var(--card); border: 0; cursor: zoom-in; box-shadow: 0 2px 3px rgb(14 42 87 / .16), 0 16px 26px -16px rgb(14 42 87 / .45); rotate: var(--rot, 0deg); transition: rotate .25s, scale .25s, box-shadow .25s; text-align: left; font: inherit; color: inherit; }
.photo.hero { grid-column: 1 / -1; padding-bottom: 34px; }
.photo img { display: block; width: 100%; height: auto; aspect-ratio: var(--ar, 16/10); object-fit: cover; object-position: top; background: #0b1324; }
.photo .cap { position: absolute; left: 10px; right: 10px; bottom: 7px; font: 700 13px/1.2 var(--body); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo::before { content: ""; position: absolute; top: -10px; left: 50%; width: 74px; height: 20px; translate: -50% 0; background: var(--tape); rotate: var(--tr, -3deg); z-index: 1; }
.photo:hover, .photo:focus-visible { rotate: 0deg; scale: 1.02; z-index: 2; box-shadow: 0 3px 4px rgb(14 42 87 / .2), 0 24px 36px -16px rgb(14 42 87 / .5); }
.diagram { grid-column: 1 / -1; background: var(--card); padding: 18px; box-shadow: 0 2px 3px rgb(14 42 87 / .16); rotate: -.6deg; }
.diagram svg { display: block; width: 100%; height: auto; }

/* lightbox */
.lb { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 4vh 5vw; background: rgb(14 42 87 / .78); backdrop-filter: blur(4px); }
.lb[hidden] { display: none; }
.lb figure { margin: 0; max-width: min(1500px, 100%); max-height: 100%; background: var(--card); padding: 12px 12px 48px; position: relative; box-shadow: 0 30px 60px -20px rgb(0 0 0 / .6); }
.lb img { display: block; max-width: 100%; max-height: calc(92vh - 76px); width: auto; height: auto; margin: 0 auto; }
.lb figcaption { position: absolute; left: 16px; right: 140px; bottom: 12px; font: 900 20px/1.2 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb .x { position: absolute; right: 12px; bottom: 10px; border: 1.5px solid var(--ink); background: var(--card); padding: 6px 12px; font: 700 13px/1 var(--body); cursor: pointer; }
.lb .nav { position: absolute; top: 50%; translate: 0 -50%; border: 0; background: var(--card); width: 44px; height: 60px; font: 700 22px/1 var(--body); cursor: pointer; box-shadow: 0 4px 10px rgb(0 0 0 / .3); }
.lb .prev { left: -22px; } .lb .next { right: -22px; }

/* now-playing bar */
.np { position: relative; z-index: 3; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 18px; align-items: center; padding: 10px 3vw 12px 84px; background: var(--np); border-top: 1.5px dashed var(--line); backdrop-filter: blur(6px); }
.np .reels { width: 70px; height: 32px; border-radius: 16px; background: #14171f; display: flex; align-items: center; justify-content: space-around; padding: 0 6px; }
.np .reels i { width: 20px; height: 20px; border-radius: 50%; background: repeating-conic-gradient(#f2f4f7 0 20deg, #8a93a6 20deg 60deg); box-shadow: 0 0 0 3px #3d2a20; }
.np.playing .reels i { animation: spin 1.6s linear infinite; }
.np .now { min-width: 0; }
.np .now small { display: block; color: var(--muted); }
.np .now b { display: block; font: 700 16.5px/1.3 var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.np .pos { height: 4px; background: var(--line); margin-top: 6px; max-width: 420px; }
.np .pos i { display: block; height: 100%; background: var(--sea); width: 0; }
.np .ctl { display: flex; gap: 6px; }
.np .ctl button { width: 40px; height: 36px; border: 1.5px solid var(--line); cursor: pointer; background: var(--card); display: grid; place-items: center; }
.np .ctl button:hover { border-color: var(--ink); }
.np .ctl button[aria-pressed="true"] { background: var(--sea); border-color: var(--sea); color: var(--btn-fg); }
.np .ctl svg { width: 15px; height: 13px; fill: currentColor; }

@media (max-height: 700px) {
  .orbit { top: 48%; }
  .deckwrap { width: clamp(260px, 27vw, 400px); }
  .tape { width: clamp(130px, 10.5vw, 170px); }
  .hello p { display: none; }
  .tate { display: none; }
  .track h3 { font-size: clamp(32px, 3.6vw, 48px); }
  .track .cols { margin-top: 12px; }
  .ph { padding-top: 58px; }
  .sea { height: 22vh; }
}
@media (max-width: 860px) {
  body { overflow: auto; }
  body::before { left: 14px; }
  .brand { position: absolute; left: 30px; }
  .stage, .screen { position: relative; inset: auto; }
  .screen { min-height: 100vh; }
  .hello { position: relative; left: 0; bottom: auto; margin: 70px 20px 0 30px; }
  .orbit { position: relative; left: 0; top: 0; width: auto; height: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 26px 14px; padding: 24px 20px 120px 30px; }
  .deckwrap { position: relative; translate: none; grid-column: 1 / -1; order: -2; width: 100%; max-width: 420px; justify-self: center; }
  .caption { position: relative; translate: none; grid-column: 1 / -1; order: -1; width: auto; top: auto !important; }
  .tape { position: relative; left: 0; top: 0; translate: none; width: 100%; }
  .cmd { display: none; }
  .sea { height: 14vh; }
  .sky .sun { bottom: calc(14vh - 75px); }
  .page { position: relative; display: block; }
  .ph { padding: 70px 20px 6px 30px; flex-wrap: wrap; }
  .body { grid-template-columns: minmax(0, 1fr); padding: 6px 20px 20px 30px; }
  .tracks, .track { overflow: visible; }
  .track .cols, .track .cols.solo { grid-template-columns: minmax(0, 1fr); }
  .np { position: sticky; bottom: 0; grid-template-columns: auto minmax(0, 1fr) auto; padding-left: 30px; }
  .np .keys { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sea svg, .tape .bob, .deckbob, .deck.playing .hub, .np.playing .reels i { animation: none; }
  .tape .tilt, .par, .photo { transition: none; }
}

/* ================= v2: fit tracks to the screen, no inner scrollbars ================= */
.stage, .screen { pointer-events: none; }
.screen > *, .orbit > * { pointer-events: auto; }
.sea { pointer-events: auto; }
.tracks { scrollbar-width: none; }
.tracks::-webkit-scrollbar, .track .text::-webkit-scrollbar { display: none; }
.tracks.long, .track .text.long { -webkit-mask-image: linear-gradient(#000 calc(100% - 56px), transparent); mask-image: linear-gradient(#000 calc(100% - 56px), transparent); }
.jside { overflow-y: auto; scrollbar-width: none; padding: 14px 6px 30px; }
.jside.long { -webkit-mask-image: linear-gradient(#000 calc(100% - 56px), transparent); mask-image: linear-gradient(#000 calc(100% - 56px), transparent); }
.tracks.long.end, .jside.long.end, .track .text.long.end { -webkit-mask-image: none; mask-image: none; }
.tracks > .tin { margin-block: auto; }
.track { overflow: hidden; padding-bottom: 6px; }
.track > .tin { height: 100%; margin-block: 0; display: flex; flex-direction: column; }
.track .cols { flex: 1; min-height: 0; margin-top: clamp(10px, 2vh, 22px); }
.track .cols > * { min-height: 0; max-height: 100%; }
.track .text { overflow-y: auto; scrollbar-width: none; padding-bottom: 30px; }
.cols.solo .facts { align-self: start; }

.photos { height: 100%; display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); grid-template-rows: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px 12px; padding: 12px 8px 8px; }
.photos.flat { grid-template-rows: minmax(0, 1fr); align-items: start; }
.photos.flat .photo { max-height: 100%; }
.photos.one { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, auto); align-content: start; justify-items: center; }
.photo { display: flex; flex-direction: column; min-height: 0; padding: 7px 7px 30px; }
.photo.hero { grid-column: 1 / -1; }
.photo.small { grid-column: auto; }
.photos:not(.flat):not(.one) .photo { height: 100%; }
.photos:not(.flat):not(.one) .photo img, .photos:not(.flat):not(.one) .photo video { height: 0; flex: 1 1 0; object-fit: contain; object-position: center; background: transparent; } /* the row sets the size; the whole screenshot shows on the print, nothing cropped */ /* v1 made smalls span 2 of 6; here each takes one column of the row */
.photo img, .photo video { display: block; width: 100%; flex: 1; min-height: 0; height: auto; aspect-ratio: auto; object-fit: cover; object-position: top; background: #0b1324; }
.photos.flat .photo img, .photos.flat .photo video { aspect-ratio: 9 / 16; flex: none; }
.photo.single { width: 100%; max-width: min(560px, 100%); }
.photo.single img, .photo.single video { aspect-ratio: var(--ar, 16 / 10); flex: none; max-height: calc(100vh - 380px); object-fit: cover; }
.photo .more { position: absolute; right: 10px; top: 10px; background: var(--ink); color: var(--paper); font: 700 13px/1 var(--body); padding: 5px 8px; border-radius: 3px; }
.diagram { width: 100%; }

.lb figure { min-width: min(480px, 90vw); }
#lbMedia img, #lbMedia video { display: block; max-width: 100%; max-height: calc(92vh - 76px); width: auto; height: auto; margin: 0 auto; }

/* secret tape glows a little */
.tape.secret svg { filter: drop-shadow(0 0 10px rgb(99 199 221 / .9)) drop-shadow(6px 8px 0 rgb(14 42 87 / .2)); }

/* ================= eggs ================= */
.overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 4vh 4vw; background: rgb(14 42 87 / .45); backdrop-filter: blur(3px); }
.overlay[hidden] { display: none; }

.term-win { width: min(860px, 100%); height: min(560px, 82vh); display: flex; flex-direction: column; background: #0e2a57; color: #dff6fb; border: 4px solid #0e2a57; box-shadow: 10px 12px 0 rgb(14 42 87 / .3), inset 0 0 0 2px #2f80b8; border-radius: 14px; overflow: hidden; font: 500 14.5px/1.55 var(--mono); }
.term-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: #c3f0f2; color: var(--ink); }
.term-x { border: 2px solid var(--ink); background: #fff; font: 700 12px/1 var(--body); padding: 4px 8px; cursor: pointer; border-radius: 4px; }
.term-body { flex: 1; overflow-y: auto; padding: 18px 26px; scrollbar-width: thin; scrollbar-color: #2f80b8 transparent; }
.term-body .ln { white-space: pre-wrap; word-break: break-word; }
.term-body pre { margin: 0; font: inherit; white-space: pre; }
.term-body a { color: #ffd35c; }
.term-body .acc, .term .pr { color: #63c7dd; } .term-body .dim { color: #8fb3d6; } .term-body .err { color: #ff8f84; } .term-body .warn { color: #ffd35c; } .term-body .pink { color: #ff9ccb; }
.term-in { display: flex; gap: 10px; align-items: center; padding: 12px 26px 16px; border-top: 1px dashed #2f80b8; }
.term-in input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: #fff; font: inherit; caret-color: #ffd35c; }
.nf { display: flex; gap: 26px; align-items: center; padding: 14px 0 10px; white-space: normal; line-height: 1.7; }
.nf > div { min-width: 0; }
.nf img { width: 96px; height: 96px; border-radius: 12px; object-fit: cover; border: 3px solid #63c7dd; }
.nf .k { display: inline-block; width: 6ch; color: #63c7dd; }
.nf .sw { display: flex; gap: 4px; margin-top: 6px; } .nf .sw i { width: 16px; height: 16px; border-radius: 4px; border: 2px solid #0b1f45; }
.sl { animation: sl 4s linear forwards; }
@keyframes sl { from { transform: translateX(100%); } to { transform: translateX(-110%); } }
.tetris { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; padding: 8px 0; }
.tetris canvas { border: 3px solid #63c7dd; border-radius: 6px; }
.tetris .ts { display: grid; gap: 6px; }
.tetris .teto { width: 120px; image-rendering: pixelated; }

.toast { position: fixed; z-index: 50; left: 50%; bottom: 26px; translate: -50% 0; display: grid; gap: 2px; text-align: center; background: #fff; color: var(--ink); padding: 12px 22px 14px; rotate: -1deg; border: 3px solid var(--ink); border-radius: 6px; box-shadow: 6px 8px 0 rgb(14 42 87 / .25); }
body.on-page .toast { bottom: 150px; }
/* tape pages: the deck bar rides just above a strip of sea, so the fish stay in view */
body.on-page .sea { height: 46px; }
body.on-page .bottle { width: 24px; top: -20px; }
.sea { overflow: clip visible; }
body.on-page .page { padding-bottom: 46px; }
.toast::before { content: ""; position: absolute; top: -11px; left: 50%; width: 70px; height: 20px; translate: -50% 0; background: var(--tape); rotate: 3deg; }
.toast .lab { color: var(--coral); } .toast b { font: 900 22px/1.15 var(--display); } .toast small { color: var(--muted); }
.note-card { position: fixed; z-index: 50; right: 4vw; top: 90px; width: min(340px, 86vw); background: #fffdf2; color: var(--ink); padding: 16px 18px 18px; rotate: 1.5deg; border: 3px solid var(--ink); border-radius: 4px; box-shadow: 6px 8px 0 rgb(14 42 87 / .22); transition: opacity .3s; }
.note-card p { margin: 6px 0 0; font: 900 19px/1.3 var(--display); }
.note-card .lab { color: var(--sea); }
.note-card button { position: absolute; right: 8px; top: 6px; border: 0; background: none; font: 700 20px/1 var(--body); cursor: pointer; color: var(--ink); }

.fish { position: absolute; left: 0; pointer-events: none; animation: swim var(--dur) linear forwards; z-index: 2; }
.fish svg { display: block; width: 100%; height: auto; transform: scaleX(calc(var(--dir) * -1)); } /* drawn facing left; --dir 1 swims right */
.fish.gold { pointer-events: auto; border: 0; background: none; padding: 0; cursor: pointer; filter: drop-shadow(0 0 6px #ffd35c); }
.fish.whale { z-index: 0; }
.fish .koi-tail { transform-box: fill-box; transform-origin: 0% 50%; animation: koi-tail .9s ease-in-out infinite alternate; }
@keyframes koi-tail { from { transform: skewY(-9deg) scaleY(.92); } to { transform: skewY(9deg) scaleY(1.04); } }
@keyframes swim { from { translate: calc(var(--dir) * -12vw + (var(--dir) - 1) * -56vw) 0; } to { translate: calc(var(--dir) * 112vw + (var(--dir) - 1) * -56vw) 0; } }
.bottle { position: absolute; top: -26px; width: 34px; border: 0; background: none; padding: 0; cursor: pointer; z-index: 3; animation: bottle 3.2s ease-in-out infinite alternate; }
.bottle svg { display: block; width: 100%; height: auto; }
@keyframes bottle { from { transform: translateY(-4px) rotate(-12deg); } to { transform: translateY(6px) rotate(10deg); } }
.chest { position: absolute; bottom: 4px; width: 54px; opacity: .3; z-index: 1; transition: opacity .4s; pointer-events: none; }
.chest svg { display: block; width: 100%; }
.chest .lid { transform-box: fill-box; transform-origin: 0 100%; transition: transform .5s cubic-bezier(.2,1.4,.4,1); }
.chest.open { opacity: 1; } .chest.open .lid { transform: rotate(-28deg); }
.ping { position: fixed; z-index: 4; width: 10px; height: 10px; translate: -50% -50%; border: 3px solid #fff; border-radius: 50%; pointer-events: none; animation: ping 1.1s ease-out forwards; }
@keyframes ping { to { width: 260px; height: 260px; opacity: 0; } }
.bub { position: fixed; z-index: 45; border-radius: 50%; border: 2px solid #fff; background: rgb(255 255 255 / .25); pointer-events: none; }
.fx { position: fixed; inset: 0; z-index: 60; background: #0e2a57; cursor: none; }
body.hightide .sea { height: 78vh !important; transition: height 1.6s cubic-bezier(.3,1.2,.5,1); }
body.adrift .tape .bob { animation-duration: 9s !important; }
body.adrift .orbit { transition: transform 8s ease-in-out; transform: translateY(-14px); }
.deck.pencilling .hub { animation: spin .18s linear infinite reverse; }
.pencil { animation: spin .4s linear infinite; transform-box: view-box; transform-origin: 0 0; }

.gacha-win, .launch-win, .help-win { background: #fff; color: var(--ink); border: 4px solid var(--ink); border-radius: 12px; box-shadow: 10px 12px 0 rgb(14 42 87 / .25); }
.gacha-win { width: min(380px, 100%); padding: 22px; text-align: center; display: grid; gap: 14px; justify-items: center; }
.capsule { --tc: #63c7dd; width: 110px; height: 110px; border-radius: 50%; border: 4px solid var(--ink); background: linear-gradient(var(--tc) 0 50%, #fff 50%); position: relative; box-shadow: 6px 8px 0 rgb(14 42 87 / .2); }
.capsule::after { content: ""; position: absolute; left: 0; right: 0; top: calc(50% - 2px); height: 4px; background: var(--ink); }
.capsule i { position: absolute; left: 18px; top: 14px; width: 26px; height: 10px; border-radius: 6px; background: #fff; opacity: .7; }
.g-res { font: 900 22px/1.2 var(--display); min-height: 1.3em; } .g-res .new { color: var(--coral); font-size: .7em; }
.launch-win { width: min(620px, 100%); align-self: start; margin-top: 10vh; overflow: hidden; }
.launch-win input { width: 100%; border: 0; border-bottom: 2px dashed var(--line); padding: 16px 18px; font: 400 18px/1 var(--body); color: var(--ink); outline: none; }
.launch-win ul { list-style: none; margin: 0; padding: 6px; max-height: 56vh; overflow-y: auto; }
.launch-win li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 9px 12px; cursor: pointer; border-radius: 6px; }
.launch-win li small { color: var(--muted); font-size: 12.5px; }
.launch-win li[aria-selected="true"], .launch-win li:hover { background: linear-gradient(100deg, transparent 1%, var(--hl) 2% 97%, transparent 99%); }
.help-win { width: min(460px, 100%); padding: 22px 26px; }
.help-win h3 { margin: 4px 0 12px; font: 900 32px/1 var(--display); }
.help-win dl { margin: 0 0 16px; display: grid; gap: 6px; }
.help-win dl div { display: grid; grid-template-columns: 11em 1fr; align-items: center; }
.help-win dd { margin: 0; }

/* tracks without screenshots: the tape itself, labelled with the track, sits beside the text */
.jside { display: grid; gap: 22px; align-content: start; justify-items: center; }
.jside .bigtape { width: min(400px, 100%); rotate: -3deg; filter: drop-shadow(8px 10px 0 rgb(14 42 87 / .16)); }
.jside .bigtape svg { display: block; width: 100%; height: auto; max-height: calc(100vh - 470px); }
.jside .facts { width: 100%; margin-top: 0; }
@media (max-width: 860px) {
  .jside .bigtape { display: none; }
  body.on-page .np { bottom: 46px; }
  /* phone deck bar: one line for the track, smaller transport */
  .np { gap: 10px; padding-left: 26px; }
  .np .now small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10px; }
  .np .reels { width: 54px; height: 26px; } .np .reels i { width: 15px; height: 15px; }
  .np .ctl { gap: 4px; } .np .ctl button { width: 34px; height: 32px; }
  .track, .track .text { overflow: visible; }
  .track > .tin { height: auto; }
  .photos, .photos.one { height: auto; grid-template-rows: auto auto; }
  .photo img, .photo video { aspect-ratio: 16 / 10; flex: none; }
  .photo.single img { max-height: none; }
  .tracks.long, .track .text.long { -webkit-mask-image: none; mask-image: none; }
}
@media (prefers-reduced-motion: reduce) {
  .bottle, .fish, .pencil, .sl { animation: none; }
}

/* ================= home pitch ================= */
.hello { max-width: 40ch; }
.hello .tagline { font: 900 clamp(17px, 1.35vw, 22px)/1.2 var(--display); color: var(--sea); margin-top: 6px; }
.hstats { display: flex; gap: 18px; margin: 12px 0 0; }
.hstats div { display: grid; }
.hstats dt { font: 900 26px/1 var(--display); color: var(--ink); }
.hstats dd { margin: 2px 0 0; font: 700 10.5px/1.2 var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.hello .acts { margin-top: 14px; }
.hello .btn { padding: 9px 13px; font-size: 14px; }
@media (max-height: 760px) { .hstats { display: none; } }

/* ================= stack: sticker sheets ================= */
.stack { display: grid; gap: 16px; align-content: start; overflow-y: auto; scrollbar-width: none; padding: 14px 6px 30px; }
.stack.long { -webkit-mask-image: linear-gradient(#000 calc(100% - 56px), transparent); mask-image: linear-gradient(#000 calc(100% - 56px), transparent); }
.stack.long.end { -webkit-mask-image: none; mask-image: none; }
.sg { position: relative; background: var(--card); padding: 14px 16px 16px; box-shadow: 0 2px 3px rgb(14 42 87 / .16), 0 14px 22px -16px rgb(14 42 87 / .45); }
.sg:nth-child(odd) { rotate: -.6deg; } .sg:nth-child(even) { rotate: .5deg; }
.sg::before { content: ""; position: absolute; top: -9px; left: 22px; width: 64px; height: 18px; background: var(--tape); rotate: -3deg; }
.sg-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 10px; }
.sg-h .lab { color: var(--ink); }
.sg-h code { font: 500 12.5px/1 var(--mono); color: var(--muted); }
.sg ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sg li { font: 700 14.5px/1 var(--body); padding: 7px 11px 8px; background: color-mix(in srgb, var(--tint) 32%, #fff); border: 2px solid var(--ink); border-radius: 7px; box-shadow: 2px 2px 0 var(--ink); }

/* ================= stats: numbers pinned up ================= */
.statboard { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 18px; align-content: start; padding: 16px 8px; }
.stat { position: relative; display: grid; gap: 6px; background: var(--card); padding: 20px 18px 18px; rotate: var(--rot); box-shadow: 0 2px 3px rgb(14 42 87 / .16), 0 14px 22px -16px rgb(14 42 87 / .45); }
.stat::before { content: ""; position: absolute; top: -9px; left: 50%; width: 60px; height: 18px; translate: -50% 0; background: var(--tape); rotate: 3deg; }
.stat b { font: 900 clamp(46px, 4.2vw, 72px)/.9 var(--display); color: var(--sea); }
.stat span { font: 700 13px/1.3 var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
@media (max-width: 860px) { .stack { overflow: visible; } .stack.long { -webkit-mask-image: none; mask-image: none; } }

/* no JavaScript: a plain card instead of the deck */
.noscript { position: relative; z-index: 3; max-width: 60ch; margin: 90px 24px 0 84px; background: var(--card); padding: 20px 24px; box-shadow: 0 2px 4px rgb(14 42 87 / .18); }
.noscript h1 { margin: 0 0 8px; font: 900 40px/1.1 var(--display); }

/* ================= the time of day: dawn, day, dusk and night each get their own light ================= */
.sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.sky .sun { position: absolute; right: 15vw; bottom: calc(27vh - 75px); width: 150px; height: 150px; border-radius: 50%; opacity: 0; background: var(--sun, transparent); transition: opacity 1.2s; }
.sky .moon { position: absolute; right: 13vw; top: 13vh; width: 64px; height: 64px; border-radius: 50%; box-shadow: inset -15px -5px 0 0 #fdf1c8; rotate: -20deg; opacity: 0; transition: opacity 1.2s; filter: drop-shadow(0 0 14px rgb(253 241 200 / .45)); }
.sky .stars { position: absolute; inset: 0 0 30vh; opacity: 0; transition: opacity 1.2s; }
.sky .stars i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; animation: twinkle var(--tw) ease-in-out infinite alternate; }
@keyframes twinkle { from { opacity: .15; } to { opacity: .95; } }
body.on-page .sky .sun { opacity: 0 !important; }
body[data-time="dawn"] {
  --paper: #fbf3ef; --sw: #fff9f6; --sb: #f5e6e0; --hl: #ffd8cb; --np: rgb(251 243 239 / .9); --tape: rgb(255 200 180 / .65);
  --sea-1: #fbdcd3; --sea-2: #e9c8dc; --sea-3: #a6cde0; --sea-4: #6faccb; --sea-5: #3f80ae; }
body[data-time="dawn"] .sky .sun { --sun: radial-gradient(circle, #fff1dc 0 46%, #ffc9ab 62%, rgb(255 201 171 / 0) 71%); opacity: 1; width: 190px; height: 190px; bottom: calc(27vh - 95px); }
body[data-time="dawn"] .sky .stars { opacity: .25; }
body[data-time="day"] .sky .sun { --sun: radial-gradient(circle, #fffdf0 0 30%, rgb(255 246 200 / .5) 50%, rgb(255 246 200 / 0) 70%); opacity: .9; bottom: auto; top: 8vh; width: 220px; height: 220px; }
body[data-time="dusk"] {
  --paper: #f8eae6; --sw: #fcf3f0; --sb: #f0dbd7; --muted: #6a5570; --hl: #ffd0bb; --np: rgb(248 234 230 / .9); --tape: rgb(255 190 160 / .6);
  --sea-1: #ffcaa6; --sea-2: #f4a08e; --sea-3: #c97c9c; --sea-4: #7d61a0; --sea-5: #3e4b87; }
body[data-time="dusk"] .sky .sun { --sun: #ec5547; opacity: 1; width: 180px; height: 180px; bottom: calc(27vh - 80px); }
body[data-time="dusk"] .sky .stars { opacity: .2; }
body[data-time="night"] {
  --paper: #0d1a35; --sw: #142a52; --sb: #0f2042; --ink: #e8f1f8; --muted: #a5bad2; --line: rgb(200 225 255 / .22); --card: #17294d;
  --hl: rgb(99 199 221 / .32); --sea: #6fd0e6; --np: rgb(13 26 53 / .9); --facts: rgb(23 41 77 / .75); --btn: #e8f1f8; --btn-fg: #0d1a35; --tape: rgb(99 199 221 / .4);
  --sea-1: #1f4170; --sea-2: #183662; --sea-3: #132d57; --sea-4: #0f264b; --sea-5: #0a1c3b; color-scheme: dark; }
body[data-time="night"] .sky .moon, body[data-time="night"] .sky .stars { opacity: 1; }
body[data-time="dusk"] .sea svg, body[data-time="dawn"] .sea svg { mix-blend-mode: normal; }

/* ================= the games tape ================= */
.pcard { background: var(--card); border: 3px solid var(--ink); border-radius: 10px; padding: 18px 20px 20px; box-shadow: 6px 8px 0 rgb(14 42 87 / .2); max-width: 460px; width: 100%; align-self: start; }
.pc-top { display: flex; gap: 14px; align-items: center; }
.pc-top img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; border: 3px solid var(--ink); image-rendering: auto; }
.pc-top b { display: block; font: 900 24px/1.1 var(--display); }
.pc-lv { display: inline-block; margin-top: 4px; font: 400 15px/1 "DotGothic16", var(--mono); background: var(--ink); color: var(--paper); padding: 3px 8px; border-radius: 4px; }
.pc-exp { height: 10px; border: 2px solid var(--ink); border-radius: 6px; margin: 14px 0 12px; overflow: hidden; }
.pc-exp i { display: block; height: 100%; background: repeating-linear-gradient(-45deg, #6fd3a8 0 6px, #4fbf8f 6px 12px); }
.pcard dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.pcard dt { font: 700 11px/1.3 var(--body); color: var(--muted); }
.pcard dd { margin: 2px 0 0; font: 400 18px/1.25 "DotGothic16", var(--body); }
.gwrap { display: grid; gap: 12px; align-content: start; min-width: 0; }
.gstat { display: flex; gap: 14px; align-items: center; background: var(--card); border: 2px solid var(--ink); border-radius: 8px; padding: 12px 16px; max-width: 560px; }
.gs-b { flex: 1; min-width: 0; display: grid; gap: 4px; }
.gs-b b { font: 400 22px/1 "DotGothic16", var(--body); }
.rank { flex: none; width: 54px; height: 54px; display: grid; place-items: center; font: 400 34px/1 "DotGothic16", var(--display); color: #fff; background: var(--ink); border-radius: 8px; box-shadow: inset 0 -4px 0 rgb(0 0 0 / .25); }
.rank.rS { background: linear-gradient(135deg, #ffd35c, #ff8a5c); color: #0e2a57; } .rank.rA { background: #c79cff; } .rank.rB { background: #63c7dd; } .rank.rC { background: #8a93a6; }
.gbar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin-bottom: 4px; }
.gbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--sea-3), var(--sea)); }
.gbar.ach i { background: linear-gradient(90deg, #ffd35c, #ff8a5c); }
.acard { display: grid; grid-template-columns: auto minmax(0, 1fr); background: var(--card); border: 3px solid var(--ink); border-radius: 6px; overflow: hidden; max-width: 460px; width: 100%; min-height: 260px; align-self: start; box-shadow: 6px 8px 0 rgb(14 42 87 / .2); }
.ac-tate { writing-mode: vertical-rl; background: var(--at); color: #fff; font: 800 clamp(22px, 2vw, 30px)/1.1 var(--mincho); letter-spacing: .12em; padding: 18px 14px; text-shadow: 0 2px 0 rgb(0 0 0 / .15); }
.ac-body { position: relative; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ac-body b { font: 900 clamp(22px, 2vw, 30px)/1.1 var(--display); text-wrap: balance; }
.ac-fn { color: var(--muted); font-size: 14px; }
.ac-note { margin-top: auto; font-weight: 700; font-size: 14px; border-top: 1.5px dashed var(--line); padding-top: 10px; }
.ac-mark { position: absolute; right: 14px; top: 10px; color: var(--at); font-size: 22px; }
.tracks.dense button { padding-block: 4px; font-size: clamp(13.5px, .9vw, 15.5px); }
.tracks.dense .side { margin-top: 10px; margin-bottom: 3px; }
