/* ---------- tokens ---------- */
:root {
  --cream: #faf8f1;
  --paper: #ffffff;
  --ink: #1b2130;
  --ink-2: #4b5365;
  --ink-3: #8a91a1;
  --ink-4: #b9becb;
  --line: rgba(27, 33, 48, 0.08);
  --line-2: rgba(27, 33, 48, 0.14);
  --blue-50: #eef4fd;
  --blue-100: #dde9fb;
  --blue-200: #bed4f6;
  --blue-300: #9dbdf1;
  --blue-500: #5b93e8;
  --blue-700: #2f63c4;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-2: rgba(255, 255, 255, 0.82);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 18px 40px -18px rgba(27, 41, 80, 0.35), 0 4px 10px -4px rgba(27, 41, 80, 0.12);
  --shadow-soft: 0 24px 60px -30px rgba(27, 41, 80, 0.35);
  --font: "IBM Plex Sans JP", "IBM Plex Sans Thai Looped", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "IBM Plex Sans JP", "IBM Plex Sans Thai Looped", ui-monospace, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --cw: clamp(150px, min(13.6vw, 23dvh), 240px);
  --top-h: 138px;
  --dock-h: 64px;
  --gutter: clamp(16px, 3.2vw, 52px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(160deg, #f3f6fb 0%, #edf2fa 45%, #e6eefa 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
img { display: block; }
.mono { font-family: var(--mono); letter-spacing: 0.06em; text-transform: uppercase; font-size: 12px; }
.accent { color: var(--blue-700); }
:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 3px; border-radius: 12px; }

/* ---------- background: casper cream + noised blue ---------- */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bg-blob { position: absolute; border-radius: 50%; filter: blur(80px); }
.b1 { width: 36vw; height: 120vh; left: -14vw; top: -10vh; background: radial-gradient(closest-side, rgba(91, 147, 232, 0.55), transparent); animation: drift2 34s ease-in-out infinite alternate; }
.b2 { width: 36vw; height: 46vh; left: 22vw; top: 24vh; background: radial-gradient(closest-side, rgba(239, 230, 216, 0.95), transparent); }
.b3 { width: 34vw; height: 42vh; left: 4vw; bottom: -12vh; background: radial-gradient(closest-side, rgba(110, 160, 236, 0.6), transparent); }
.b4 { width: 40vw; height: 50vh; right: -10vw; bottom: -14vh; background: radial-gradient(closest-side, rgba(190, 212, 246, 0.8), transparent); }
.bg-wave { position: absolute; right: -8vw; top: 12vh; width: 64vw; height: 52vh; overflow: visible; filter: blur(42px); opacity: 0.85; animation: drift1 28s ease-in-out infinite alternate; }
.bg-wave path { fill: none; stroke: #5b93e8; stroke-width: 64; stroke-linecap: round; }
.bg-grain {
  position: absolute; inset: -50%; opacity: 0.5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .42  0 0 0 0 .48  0 0 0 0 .62  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
@keyframes drift1 { to { transform: translate(-5vw, 5vh) rotate(-4deg); } }
@keyframes drift2 { to { transform: translate(5vw, 6vh); } }

/* ---------- header ---------- */
.top { position: fixed; top: 0; left: 0; right: 0; z-index: 40; padding: 0 var(--gutter); }
.topline { display: flex; justify-content: space-between; align-items: center; height: 58px; color: var(--ink-3); }
.topline-r { display: flex; align-items: center; gap: 14px; }
/* Secondary controls: outlined and quiet so the badge and nav bar lead */
.lang { display: flex; gap: 2px; padding: 2px; height: 28px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line-2); }
/* The selected chip uses the same glass as the nav bar so both read as one colour */
.lang-btn.is-on, .topline .mode-btn.is-on { background: var(--glass); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); }
.lang-btn { padding: 0 10px; border-radius: 999px; font-size: 10.5px; color: var(--ink-3); transition: background 0.3s, color 0.3s, box-shadow 0.3s; }
.lang-btn[lang="ja"] { font-size: 11.5px; letter-spacing: 0.04em; }
.lang-btn:hover { color: var(--ink); }
.lang-btn.is-on { color: var(--ink); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 4px 10px -6px rgba(27, 41, 80, 0.35); }
/* Japanese-only mode: the dock shows just the Japanese category names */
body.lang-ja .pill .en { display: none; }
body.lang-ja .pill .th { font-size: 14px; font-weight: 500; opacity: 1; }
.bar {
  display: flex; align-items: center; gap: 12px; height: 64px; padding: 10px;
  background: var(--glass); border-radius: 24px;
  backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 10px 30px -20px rgba(27, 41, 80, 0.4);
}
.badge {
  height: 100%; display: inline-flex; align-items: center; gap: 16px; padding: 0 22px;
  background: var(--ink); color: #fff; border-radius: 14px; font-weight: 500; font-size: 16px; letter-spacing: -0.01em; white-space: nowrap;
  transition: transform 0.3s var(--ease), background 0.3s;
}
.badge:hover { background: #262e42; }
.badge:active { transform: scale(0.97); }
.badge-n { opacity: 0.6; font-variant-numeric: tabular-nums; }
.search { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; padding: 0 0 0 18px; height: 100%; cursor: text; }
.search svg { width: 20px; height: 20px; fill: none; stroke: var(--ink-3); stroke-width: 1.6; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: 17px; color: var(--ink); outline: none; }
.search input::placeholder { color: var(--ink-3); }
.search input::-webkit-search-cancel-button { display: none; }
kbd { border: 1px solid var(--line-2); border-radius: 7px; padding: 5px 8px; font-size: 10px; color: var(--ink-3); background: rgba(255, 255, 255, 0.6); }
.mode { display: flex; gap: 0; padding: 0; border-radius: 14px; background: rgba(27, 33, 48, 0.05); height: 44px; flex: none; }
.mode-btn { padding: 0 16px; border-radius: 14px; font-size: 14px; font-weight: 500; color: var(--ink-2); transition: background 0.3s, color 0.3s, box-shadow 0.3s; }
.mode-btn.is-on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(27, 33, 48, 0.12); }
.views { display: flex; gap: 6px; height: 100%; align-items: center; }
/* Short centred divider with equal space either side (bar gap on the left, margin + gap on the right) */
.views::before { content: ""; width: 1px; height: 24px; background: var(--line-2); margin-right: 6px; }
.view-btn { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: var(--ink-2); transition: background 0.3s, color 0.3s; }
.view-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.view-btn:hover { background: rgba(27, 33, 48, 0.05); }
.view-btn.is-on { background: var(--ink); color: #fff; }

/* ---------- stage ---------- */
.stage { position: fixed; z-index: 10; top: var(--top-h); bottom: calc(var(--dock-h) + 28px); left: 0; right: 0; transition: opacity 0.5s var(--ease), transform 0.6s var(--ease), filter 0.5s; }
body.is-open .stage { opacity: 0; transform: scale(0.97); filter: blur(6px); pointer-events: none; }

.ambient { position: absolute; left: calc(var(--gutter) + 28px); top: 2.4vh; pointer-events: none; }
.kicker { color: var(--ink-3); letter-spacing: 0.22em; margin: 0 0 1.6vh; font-size: 13px; }
.ambient-h {
  margin: 0; font-weight: 300; font-size: clamp(56px, min(8.4vw, 14dvh), 160px); line-height: 0.92; letter-spacing: -0.055em;
  color: rgba(27, 33, 48, 0.1); white-space: nowrap; transition: opacity 0.5s, filter 0.5s, transform 0.6s var(--ease);
}
.ambient-h [lang="ja"] { letter-spacing: 0.02em; }
.hint { position: absolute; left: calc(var(--gutter) + 30px); bottom: 6px; margin: 0; color: var(--ink-3); letter-spacing: 0.14em; font-size: 12px; }

/* ---------- deck ---------- */
.deck { position: absolute; inset: 0 calc(380px + var(--gutter)) 0 0; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.card {
  position: absolute; left: 50%; top: 50%; width: var(--cw); margin-left: calc(var(--cw) / -2); margin-top: calc(var(--cw) * -0.75);
  background: var(--paper); border-radius: 20px; padding: 5px; box-shadow: var(--shadow-card);
  transition: box-shadow 0.4s, translate 0.3s var(--ease);
  transform-origin: 50% 50%; cursor: pointer;
  opacity: 0; transform: scale(0.3);
}
/* No will-change on purpose: 41 cards as separate GPU layers, resized every frame, run phones out of graphics memory and the page blinks */
.card.is-active { box-shadow: 0 1px 0 #fff inset, 0 40px 70px -30px rgba(27, 41, 80, 0.5), 0 10px 20px -10px rgba(27, 41, 80, 0.2); }
.card.is-focus:not(.is-active) { box-shadow: 0 1px 0 #fff inset, 0 30px 56px -24px rgba(27, 41, 80, 0.45), 0 8px 16px -8px rgba(27, 41, 80, 0.18); }
@media (hover: hover) { .card:not(.is-active):hover { translate: 0 -10px; } }
/* On the globe only the front card shows its title; the rest read as framed images */
.deck .card-meta { transition: opacity 0.35s, max-height 0.45s var(--ease), padding 0.45s var(--ease); max-height: 80px; overflow: hidden; }
.deck .card:not(.is-active) .card-meta { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; }
/* Cards orbiting on the globe skip the blurred fill and the tag, which are costly to redraw every frame; the front card keeps both */
.deck .vm .blur, .deck .tag { transition: opacity 0.4s, visibility 0.4s; }
.deck .card:not(.is-active) .blur, .deck .card:not(.is-active) .tag { opacity: 0; visibility: hidden; }
.card.is-gone { opacity: 0 !important; pointer-events: none; }
.card-vis { position: relative; aspect-ratio: 9 / 13; border-radius: 15px; overflow: hidden; background: var(--blue-50); }
.vm { position: absolute; inset: 0; animation: fadeIn 0.5s var(--ease) both; }
.vm .blur { position: absolute; inset: -20px; width: calc(100% + 40px); height: calc(100% + 40px); object-fit: cover; filter: blur(22px) saturate(1.2); transform: scale(1.15); opacity: 0.9; }
.vm .soft { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.2); opacity: 0.85; }
.vm .fit, .screen .fit { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.vm .fit.cover { object-fit: cover; object-position: 50% 30%; }
.vm .fit.snug { object-fit: cover; object-position: 50% 50%; }
.vm .fit.focus { object-fit: fill; right: auto; bottom: auto; }
.card-vis::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 0 1px rgba(27, 33, 48, 0.06) inset; pointer-events: none; }
.tag {
  position: absolute; right: 10px; bottom: 10px; z-index: 2; font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 5px 8px; border-radius: 7px; background: rgba(255, 255, 255, 0.86); color: var(--ink); backdrop-filter: blur(6px);
}
.tag.now { background: var(--blue-700); color: #fff; }
.tag.soon { background: var(--ink); color: #fff; }
.card-meta { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 11px 9px; }
.card-meta h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta .n { font-family: var(--mono); font-size: 11px; color: var(--ink-3); align-self: center; }
.card-meta p { margin: 0; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta .arr { font-size: 12px; color: var(--ink-2); justify-self: end; }

/* typographic cover for works with no official imagery */
.type-cover {
  position: absolute; inset: 0; display: flex; justify-content: space-between; padding: 16px;
  background: linear-gradient(to top, var(--blue-300), var(--blue-100) 45%, var(--cream) 85%);
}
.type-cover::before { content: ""; position: absolute; inset: 0; background: inherit; opacity: 0; }
.tc-t { writing-mode: vertical-rl; font-size: clamp(17px, 1.7vw, 24px); font-weight: 600; letter-spacing: 0.06em; line-height: 1.25; color: var(--ink); max-height: 100%; }
.tc-k { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; color: var(--ink-2); writing-mode: vertical-rl; text-transform: uppercase; }

/* ---------- side panel ---------- */
.panel {
  position: absolute; right: var(--gutter); top: 50%; transform: translateY(-50%); width: 380px; min-height: min(560px, 100%);
  max-height: 100%; overflow: auto; display: flex; flex-direction: column;
  background: var(--glass-2); border-radius: 32px; padding: 28px 30px 26px;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: var(--shadow-soft), 0 1px 0 #fff inset;
  z-index: 200; transition: opacity 0.45s, transform 0.7s var(--ease);
}
.panel > * { animation: rise 0.55s var(--ease) both; }
.panel > *:nth-child(2) { animation-delay: 0.03s; }
.panel > *:nth-child(3) { animation-delay: 0.06s; }
.panel > *:nth-child(4) { animation-delay: 0.09s; }
.panel > *:nth-child(5) { animation-delay: 0.12s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes sheet-up { from { opacity: 0; transform: translateY(60vh); } }
.p-top { display: flex; justify-content: space-between; align-items: center; color: var(--ink-4); }
.p-top > span { font-size: 10.5px; letter-spacing: 0.14em; }
.p-open { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); background: var(--blue-100); padding: 8px 12px; border-radius: 10px; transition: background 0.25s; }
.p-open:hover { background: var(--blue-200); }
/* Category leads the header; billing sits one step back; the counter above is quietest */
.p-kick { margin: 22px 0 12px; color: var(--ink); font-size: 13px; font-weight: 500; letter-spacing: 0.08em; }
.p-kick .bill-t { color: var(--ink-3); font-weight: 400; }
.p-title { margin: 0; text-wrap: balance; word-break: auto-phrase; font-size: clamp(26px, 2.3vw, 36px); line-height: 1.15; font-weight: 600; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.p-artist { display: block; font-size: 14px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; margin-bottom: 6px; }
.p-sub { margin: 10px 0 0; color: var(--ink-2); font-size: 16px; line-height: 1.45; }
.p-sub .th { display: block; color: var(--ink-3); font-size: 15px; }
.p-role { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-2); }
.p-role .lbl { color: var(--ink-3); font-size: 11px; margin: 0 0 8px; }
.p-role .who { margin: 0; font-size: 17px; font-weight: 500; line-height: 1.45; }
.p-role .who small { font-size: 14px; color: var(--ink-3); font-weight: 400; margin-left: 4px; }
.p-role .note { margin: 4px 0 0; font-size: 14px; color: var(--ink-2); line-height: 1.55; }
.p-role .meta { margin: 12px 0 0; font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); letter-spacing: 0.02em; line-height: 1.7; }
.p-cta { margin-top: auto; padding-top: 22px; display: grid; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 12px; height: 50px; padding: 0 20px; border-radius: 16px;
  text-decoration: none; font-weight: 500; font-size: 15px; transition: transform 0.25s var(--ease), background 0.25s, box-shadow 0.25s;
}
.btn:active { transform: scale(0.98); }
.btn small { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; opacity: 0.6; margin-left: 6px; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #283148; }
.btn-ghost { background: rgba(255, 255, 255, 0.7); box-shadow: 0 0 0 1px var(--line-2) inset; color: var(--ink); }
.btn-ghost:hover { background: #fff; }
.p-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; color: var(--ink-3); font-size: 13px; }
.btn-open { height: 40px; padding: 0 16px; border-radius: 13px; background: var(--blue-100); color: var(--ink); font-weight: 500; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; transition: background 0.25s; }
.btn-open:hover { background: var(--blue-200); }

/* ---------- index (list view) ---------- */
.index { position: absolute; inset: 0 var(--gutter); overflow: auto; padding: 8px 0 40px; opacity: 0; pointer-events: none; transition: opacity 0.45s var(--ease), transform 0.5s var(--ease); transform: translateY(20px); }
body.view-list .index { opacity: 1; pointer-events: auto; transform: none; }
body.view-list .deck, body.view-list .panel, body.view-list .hint, body.view-grid .deck, body.view-grid .panel, body.view-grid .hint { opacity: 0; pointer-events: none; }
body.view-list .ambient, body.view-grid .ambient { opacity: 0; }
.grid { position: absolute; inset: 0; overflow: auto; padding: 4px var(--gutter) 40px; opacity: 0; pointer-events: none; transform: translateY(20px); transition: opacity 0.45s var(--ease), transform 0.5s var(--ease); }
body.view-grid .grid { opacity: 1; pointer-events: auto; transform: none; }
.grid-kick { color: var(--ink-3); letter-spacing: 0.18em; margin: 10px 4px 10px; }
.grid-h { margin: 0 4px 26px; font-size: clamp(36px, 4.6vw, 72px); font-weight: 600; letter-spacing: -0.045em; line-height: 1; }
/* As many ~220px columns as fit, so cards stay a sensible size on wide screens */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.gcard { background: var(--paper); border-radius: 20px; padding: 5px; box-shadow: var(--shadow-card); text-decoration: none; color: inherit; transition: transform 0.35s var(--ease), box-shadow 0.35s; }
.gcard:hover { transform: translateY(-4px); }
.gcard .card-vis { aspect-ratio: 4 / 3; }
.ambient, .deck, .hint { transition: opacity 0.45s var(--ease); }
.row {
  display: grid; grid-template-columns: 56px 64px 72px minmax(0, 1.4fr) minmax(0, 1fr) 128px 24px; align-items: center; gap: 16px;
  padding: 10px 16px; border-radius: 18px; text-decoration: none; cursor: pointer; transition: background 0.25s;
}
.row + .row { box-shadow: 0 -1px 0 var(--line); }
.row:hover { background: var(--glass-2); box-shadow: none; }
.row:hover + .row { box-shadow: none; }
.row .n, .row .y { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.row .th { width: 64px; height: 44px; border-radius: 10px; overflow: hidden; background: linear-gradient(to top, var(--blue-300), var(--blue-100) 60%, var(--cream)); position: relative; }
.row .th img { width: 100%; height: 100%; object-fit: cover; }
.row .t { min-width: 0; }
.row .t b { display: block; font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t span { display: block; font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .r { font-size: 14px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .c { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.row .c em { font-style: normal; display: inline-block; padding: 4px 7px; border-radius: 6px; background: var(--blue-100); margin-left: 4px; }
.row .c em.lead { background: var(--ink); color: #fff; }
.row .a { color: var(--ink-3); }
.index-head { display: grid; grid-template-columns: inherit; padding: 0 16px 10px; color: var(--ink-3); }

.empty { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); margin: 0; text-align: center; color: var(--ink-2); font-size: 18px; }
.empty small { display: block; margin-top: 6px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; color: var(--ink-3); }

/* ---------- dock ---------- */
.dock {
  position: fixed; z-index: 40; left: var(--gutter); right: var(--gutter); bottom: 18px; height: var(--dock-h);
  display: flex; align-items: center; gap: 12px; padding: 7px; border-radius: 24px;
  background: var(--glass); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 10px 30px -20px rgba(27, 41, 80, 0.4);
}
.dock-pills { flex: 1; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; height: 100%; }
.dock-pills::-webkit-scrollbar { display: none; }
.pill {
  flex: 1 0 auto; min-width: 104px; height: 100%; border-radius: 17px; padding: 0 16px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--ink-2); transition: background 0.35s var(--ease), color 0.35s; line-height: 1.15;
}
.pill .en { font-size: 14.5px; font-weight: 500; }
.pill .th { font-size: 11px; opacity: 0.75; }
.pill:hover { color: var(--ink); }
.pill.is-on { background: var(--ink); color: #fff; }
.pill.is-empty { opacity: 0.35; }
.dock-count { display: flex; align-items: center; gap: 8px; padding: 0 14px 0 6px; color: var(--ink-2); white-space: nowrap; font-size: 12px; }
.dock-count i { width: 6px; height: 6px; border-radius: 50%; background: var(--blue-500); box-shadow: 0 0 0 4px rgba(91, 147, 232, 0.18); }

/* ---------- opened work (split) ---------- */
.work {
  position: fixed; inset: 0; z-index: 30; overflow-y: auto; overscroll-behavior: contain;
  padding: calc(var(--top-h) + 20px) var(--gutter) calc(var(--dock-h) + 70px);
  -webkit-mask-image: linear-gradient(to bottom, transparent calc(var(--top-h) - 8px), #000 calc(var(--top-h) + 22px), #000 calc(100% - var(--dock-h) - 48px), transparent calc(100% - var(--dock-h) - 18px));
  mask-image: linear-gradient(to bottom, transparent calc(var(--top-h) - 8px), #000 calc(var(--top-h) + 22px), #000 calc(100% - var(--dock-h) - 48px), transparent calc(100% - var(--dock-h) - 18px));
}
.work[hidden] { display: none; }
.work-in { max-width: 1480px; margin: 0 auto; animation: workIn 0.6s var(--ease) both; }
@keyframes workIn { from { opacity: 0; transform: translateY(18px); } }
.w-head { display: flex; justify-content: space-between; align-items: center; margin: 0 0 22px 2px; color: var(--ink-2); }
.w-close { width: 58px; height: 58px; border-radius: 18px; background: var(--glass-2); display: grid; place-items: center; box-shadow: 0 1px 0 #fff inset, 0 10px 24px -16px rgba(27, 41, 80, 0.5); transition: transform 0.25s var(--ease), background 0.25s; }
.w-close:hover { background: #fff; transform: rotate(90deg); }
.w-close svg { width: 20px; height: 20px; stroke: var(--ink); stroke-width: 1.7; fill: none; }
.w-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); align-items: start; }

.frame { position: relative; border-radius: 30px; background: rgba(255, 255, 255, 0.55); padding: 6px; box-shadow: var(--shadow-soft), 0 0 0 1px rgba(255, 255, 255, 0.8) inset; }
.screen { position: relative; aspect-ratio: 16 / 10.4; border-radius: 24px; overflow: hidden; background: #e9eef7; }
.screen .blur { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); object-fit: cover; filter: blur(34px) saturate(1.15); opacity: 0.75; }
.screen .fit { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; animation: fadeIn 0.5s var(--ease) both; }
.screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.screen .type-cover { padding: 28px; }
.screen .type-cover .tc-t { font-size: clamp(28px, 3vw, 46px); }
@keyframes fadeIn { from { opacity: 0; } }
.row-kick { margin: 22px 2px 0; color: var(--ink-3); font-size: 11px; }
.screen-label { position: absolute; left: 18px; top: 16px; z-index: 3; color: var(--ink); background: rgba(255, 255, 255, 0.78); padding: 7px 10px; border-radius: 9px; font-size: 10.5px; backdrop-filter: blur(8px); }
.play {
  position: absolute; left: 50%; top: 50%; z-index: 3; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 12px;
  height: 58px; padding: 0 24px 0 8px; border-radius: 999px; background: rgba(27, 33, 48, 0.86); color: #fff; font-weight: 500;
  backdrop-filter: blur(8px); transition: transform 0.3s var(--ease), background 0.3s; box-shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.5);
}
.play:hover { transform: translate(-50%, -50%) scale(1.04); background: var(--ink); }
.play i { width: 42px; height: 42px; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.play i::before { content: ""; border-left: 12px solid var(--ink); border-top: 7.5px solid transparent; border-bottom: 7.5px solid transparent; margin-left: 3px; }
.screen-bar { display: flex; align-items: center; gap: 16px; padding: 14px 16px 6px; color: var(--ink-3); font-size: 11px; }
.screen-bar .track { flex: 1; min-width: 24px; height: 1px; background: var(--line-2); }
#sb-l, #sb-r { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46%; }
#sb-l { color: var(--ink-2); }

.thumbs { display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 32px) / 3); gap: 16px; margin: 10px -12px 0; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 12px; padding: 8px 12px 30px; scrollbar-width: thin; }
.thumb { scroll-snap-align: start; background: var(--paper); border-radius: 20px; padding: 5px; text-align: left; box-shadow: var(--shadow-card); transition: transform 0.3s var(--ease), box-shadow 0.3s; }
.thumb:hover { transform: translateY(-3px); }
.thumb.is-on { box-shadow: 0 0 0 2px var(--ink), var(--shadow-card); }
.thumb .tv { display: block; position: relative; aspect-ratio: 16 / 10; border-radius: 15px; overflow: hidden; background: var(--blue-50); }
.thumb .tv img { width: 100%; height: 100%; object-fit: cover; }
.thumb .tv .mini-play { position: absolute; right: 8px; bottom: 8px; width: 26px; height: 26px; border-radius: 50%; background: rgba(27, 33, 48, 0.85); display: grid; place-items: center; }
.thumb .tv .mini-play::before { content: ""; border-left: 8px solid #fff; border-top: 5px solid transparent; border-bottom: 5px solid transparent; margin-left: 2px; }
/* Label over source, each on one line, so narrow thumbnails never squeeze them together */
.thumb .tl { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 10px 9px 7px; font-size: 13.5px; font-weight: 500; }
.thumb .tl span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb .tl span:last-child { color: var(--ink-3); font-size: 10px; letter-spacing: 0.04em; }
.thumb .tv img { object-position: 50% 25%; }
.thumb .tv img.keep { object-fit: contain; object-position: 50% 50%; }

.info .kick { color: var(--ink-3); margin: 6px 0 18px; letter-spacing: 0.18em; }
.info h2 { margin: 0; text-wrap: balance; word-break: auto-phrase; font-size: clamp(36px, 4.2vw, 68px); line-height: 1.06; font-weight: 600; letter-spacing: -0.045em; overflow-wrap: anywhere; }
.info .artist { display: block; font-size: 0.34em; letter-spacing: -0.01em; font-weight: 500; color: var(--ink-3); margin-bottom: 0.3em; }
.info .subs { margin: 18px 0 0; font-size: 19px; color: var(--ink-2); line-height: 1.5; }
.info .subs span { display: block; color: var(--ink-3); }
.role-card { margin-top: 30px; padding: 22px 24px; border-radius: 24px; background: var(--glass-2); box-shadow: 0 1px 0 #fff inset, var(--shadow-soft); }
.role-card .lbl { color: var(--ink-3); font-size: 11px; display: flex; justify-content: space-between; }
.role-card .who { margin: 12px 0 0; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.35; }
.role-card .who small { display: block; font-size: 16px; color: var(--ink-3); font-weight: 400; letter-spacing: 0; }
.role-card .note { margin: 10px 0 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.6; }
.bill { display: inline-flex; gap: 6px; align-items: center; padding: 5px 9px; border-radius: 8px; background: var(--blue-100); color: var(--ink); font-size: 10.5px; }
.bill.lead { background: var(--ink); color: #fff; }
.facts { margin: 26px 0 0; display: grid; grid-template-columns: 132px 1fr; }
.facts dt, .facts dd { padding: 13px 0; border-top: 1px solid var(--line-2); margin: 0; }
.facts dt { color: var(--ink-3); font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; padding-top: 16px; }
.facts dt small { display: block; font-family: var(--font); letter-spacing: 0; text-transform: none; font-size: 12px; margin-top: 2px; }
.facts dd { font-size: 15.5px; line-height: 1.55; color: var(--ink); }
.facts dd .muted { color: var(--ink-3); }
.links { margin-top: 26px; display: grid; gap: 8px; }
.links .btn { height: 54px; }
.links .btn .l { display: flex; flex-direction: column; line-height: 1.2; }
.links .btn .l small { margin: 2px 0 0; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 30px; }
.pager button { text-align: left; padding: 14px 16px; border-radius: 18px; background: rgba(255, 255, 255, 0.5); box-shadow: 0 0 0 1px var(--line) inset; transition: background 0.25s; min-width: 0; }
.pager button:last-child { text-align: right; }
.pager button:hover { background: #fff; }
.pager .mono { display: block; font-size: 10.5px; color: var(--ink-3); margin-bottom: 4px; }
.pager b { display: block; font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* view transition morph: card visual -> screen */
::view-transition-group(hero) { animation-duration: 0.6s; animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.4s; }

/* ---------- responsive ---------- */
@media (max-height: 980px) { .hint { display: none; } }
@media (max-width: 1180px) {
  .panel { width: 330px; padding: 24px; }
  .deck { right: calc(330px + var(--gutter)); }
  .hint { display: none; }
}
/* Nothing picked yet: the globe takes the whole stage and the panel waits off to the right, then slides in */
@media (min-width: 901px) {
  .deck { transition: opacity 0.45s var(--ease), right 0.7s var(--ease); }
  body:not(.is-picked) .deck { right: 0; }
  body:not(.is-picked) .panel { transform: translate(calc(100% + var(--gutter) + 40px), -50%); opacity: 0; pointer-events: none; }
}
@media (max-width: 900px) {
  :root { --top-h: calc(126px + env(safe-area-inset-top)); --cw: 168px; --dock-h: 58px; }
  body { overflow: auto; overflow-x: hidden; }
  .top { padding-top: env(safe-area-inset-top); }
  .topline { height: 52px; }
  .topline-l, .topline-r .accent { display: none; }
  .bar { height: 54px; padding: 7px; gap: 6px; border-radius: 19px; }
  .badge { padding: 0 14px; font-size: 15px; gap: 10px; border-radius: 12px; }
  .badge-n { display: none; }
  .search { padding: 0 6px 0 6px; gap: 6px; }
  .search input { font-size: 16px; }
  kbd { display: none; }
  .views { gap: 2px; }
  .views::before { height: 24px; margin-right: 10px; }
  .view-btn { width: 40px; height: 40px; border-radius: 12px; }
  /* On phones the image switch lives in the top line (moved there by app.js), outside the bar's own blur */
  .mode { height: 28px; padding: 2px; border-radius: 999px; background: none; box-shadow: inset 0 0 0 1px var(--line-2); }
  .mode-btn { padding: 0 10px; font-size: 11.5px; border-radius: 999px; color: var(--ink-3); }
  .mode-btn.is-on { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 4px 10px -6px rgba(27, 41, 80, 0.35); }
  /* Everything on phones lines up with the nav and the dock: 16px from each edge */
  .grid { position: relative; inset: auto; display: none; transform: none; padding: 0 16px; }
  .grid-kick, .grid-h { margin-left: 0; margin-right: 0; }
  body.view-grid .grid { display: block; }
  body.view-grid .deck, body.view-grid .panel { display: none; }
  /* The background headline only belongs to the fan; drop it so lists and grids start under the nav */
  body.view-list .ambient, body.view-grid .ambient { display: none; }
  .grid-kick { margin-top: 4px; }
  .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stage { overflow-x: clip; position: relative; top: auto; bottom: auto; padding-top: var(--top-h); min-height: 100dvh; padding-bottom: calc(var(--dock-h) + 56px + env(safe-area-inset-bottom)); }
  .ambient { position: relative; left: 0; top: 0; padding: 18px 16px 0; }
  .kicker { font-size: 11px; }
  .ambient-h { font-size: clamp(48px, 15vw, 90px); }
  .deck { position: relative; inset: auto; height: 420px; margin-top: -40px; touch-action: pan-y; transition: opacity 0.45s var(--ease), height 0.7s var(--ease); }
  /* Nothing picked yet: the globe fills the screen down to the dock; picking a card brings the panel up from the bottom */
  body:not(.is-picked) .deck { height: max(400px, calc(100dvh - var(--top-h) - var(--dock-h) - 170px - env(safe-area-inset-bottom))); }
  body:not(.is-picked) .panel { display: none; }
  body.is-picked .panel { animation: sheet-up 0.7s var(--ease) both; }
  .card { top: 52%; }
  .card-meta h3 { font-size: 14px; }
  .panel { position: relative; right: auto; top: auto; transform: none; width: auto; margin: 0 16px; min-height: 0; max-height: none; overflow: visible; }
  .index { position: relative; inset: auto; padding: 0 16px; display: none; transform: none; }
  body.view-list .index { display: block; }
  body.view-list .deck, body.view-list .panel { display: none; }
  .row { grid-template-columns: 40px minmax(0, 1fr) 24px; gap: 12px; padding: 10px 0; }
  .row .n, .row .y, .row .r, .row .c { display: none; }
  .row .th { width: 40px; height: 56px; }
  .dock { left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); padding: 5px; border-radius: 20px; }
  .dock-pills { -webkit-mask-image: linear-gradient(to right, #000 82%, transparent); mask-image: linear-gradient(to right, #000 82%, transparent); }
  .dock-pills.at-end { -webkit-mask-image: none; mask-image: none; }
  .pill { min-width: 84px; padding: 0 12px; border-radius: 15px; }
  .dock-count { display: none; }
  .work { padding: calc(var(--top-h) + 8px) 16px calc(var(--dock-h) + 60px); }
  .w-head { margin-left: 0; }
  /* Role over source under the main image, instead of both truncated on one line */
  .screen-bar { flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px 12px 6px; }
  .screen-bar .track { display: none; }
  #sb-l, #sb-r { max-width: 100%; }
  .w-grid { grid-template-columns: minmax(0, 1fr); }
  .w-close { width: 48px; height: 48px; border-radius: 15px; }
  .thumbs { grid-auto-columns: 42%; }
  .facts { grid-template-columns: 104px 1fr; }
  .empty { top: 340px; width: 80%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
