:root { color-scheme: light dark; }
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, sans-serif; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid #8882; gap: 8px; flex-wrap: wrap; }
.topbar h1 { font-size: 16px; margin: 0; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
select, button, input[type=email], input[type=submit] { font: inherit; padding: 4px 8px; }
.btn { background: #36c; color: #fff; border: 0; border-radius: 6px; padding: 5px 10px; cursor: pointer; }
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; color: inherit; border: 1px solid #8884; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.output { padding: 14px; }
.hint, .seam { color: #888; font-size: .8em; }
.seam { font-style: italic; margin-top: 10px; }
.error-panel { border: 1px solid #c44; border-radius: 8px; padding: 12px; background: #c441; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.nav { padding: 0 14px 20px; border-top: 1px solid #8882; }
.nav h2 { font-size: 14px; }
.nav ul { list-style: none; padding: 0; margin: 0; }
.nav a { color: #36c; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.kbd-hint { color: #888; font-size: .75em; margin: 4px 0 0; }

.empty-notice { border: 1px dashed #8886; border-radius: 10px; padding: 14px; background: #8881; }
.empty-notice ul { margin: 6px 0 0; padding-left: 18px; }
.empty-notice a { color: #36c; }

/* ============ 1. ACADEMIC PAPER — scholarly serif, two columns ============ */
.media.academic { font-family: Georgia, "Times New Roman", serif; max-width: 46em; margin: 0 auto; }
.paper-head { text-align: center; border-bottom: 2px double #8886; padding-bottom: 12px; }
.paper-journal { text-transform: uppercase; letter-spacing: .2em; font-size: .7em; color: #777; }
.paper-title { font-size: 1.55em; margin: .3em 0 .2em; }
.paper-byline { font-style: italic; margin: 0; }
.paper-doi { font-size: .75em; color: #777; }
.paper-abstract { background: #8881; padding: 10px 14px; margin: 14px 0; border-left: 3px solid currentColor; }
.paper-abstract h3 { margin: 0 0 6px; font-size: .95em; }
.paper-abstract p { margin: 4px 0; font-size: .92em; }
.paper-kw { font-size: .8em; }
.paper-body { column-count: 2; column-gap: 22px; column-rule: 1px solid #8883; }
.paper-sec { break-inside: avoid; margin-bottom: 12px; }
.paper-sec h3 { font-size: 1em; margin: 0 0 4px; }
.sec-no { color: #777; }
.paper-sec p { font-size: .88em; margin: 0 0 8px; text-align: justify; hyphens: auto; }
.paper-sec:first-of-type::first-letter { font-size: 2.6em; float: left; line-height: .8; padding: 2px 6px 0 0; }
.paper-fig { margin: 8px 0; break-inside: avoid; }
.paper-fig img { max-width: 100%; }
.paper-fig figcaption { font-size: .72em; color: #777; }
.paper-refs { border-top: 1px solid #8885; margin-top: 16px; padding-top: 8px; }
.paper-refs h3 { font-size: .9em; }
.paper-refs ol { padding-left: 20px; font-size: .8em; }
.ref-url { color: #777; word-break: break-all; }
.paper-foot { font-size: .72em; color: #888; text-align: center; margin-top: 12px; }
@media (max-width: 560px) { .paper-body { column-count: 1; } }

/* ============ 2. TIMELINE — vertical spine, alternating cards ============ */
.media.timeline { max-width: 40em; }
.tl-head h3 { margin: 0 0 2px; }
.tl-by { color: #777; font-size: .8em; margin: 0 0 14px; }
.tl-track { list-style: none; margin: 0; padding: 0; position: relative; }
.tl-track::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(#36c, #36c4); }
.tl-event { position: relative; padding: 0 0 16px 34px; }
.tl-dot { position: absolute; left: 2px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: #36c; border: 2px solid var(--bg, #fff); box-shadow: 0 0 0 2px #36c4; }
.tl-when { position: absolute; left: -84px; top: 0; width: 70px; text-align: right; font-size: .72em; font-weight: 700; color: #36c; font-variant-numeric: tabular-nums; }
.tl-event { margin-left: 84px; }
.tl-event .tl-dot { left: -90px; }
.tl-card { background: #8881; border: 1px solid #8883; border-radius: 10px; padding: 10px 12px; }
.tl-title { margin: 0 0 4px; font-size: .95em; }
.tl-snippet { margin: 0; font-size: .85em; }
.tl-toggle { background: none; border: 0; color: #36c; cursor: pointer; padding: 4px 0 0; font-size: .8em; text-decoration: underline; }
.tl-detail { font-size: .85em; border-top: 1px dashed #8885; margin-top: 6px; padding-top: 6px; }
.tl-now .tl-card { border-style: dashed; text-align: center; color: #777; }
.tl-event.is-first .tl-card { border-color: #36c8; }

/* ============ 3. PRESENTATION — one slide at a time, stage + bar ============ */
.media.deck { max-width: 42em; }
.deck { outline: none; }
.deck-stage { position: relative; min-height: 260px; border: 1px solid #8884; border-radius: 12px; background: linear-gradient(160deg, #1d2530, #10151c); color: #eef2f8; overflow: hidden; }
.deck-slide { position: absolute; inset: 0; display: none; flex-direction: column; justify-content: center; padding: 22px 26px; }
.deck-slide.is-active { display: flex; }
.slide-title { font-size: 1.7em; margin: 0 0 8px; }
.slide-sub { color: #9fb3d1; margin: 0 0 6px; }
.slide-kicker { color: #6c86a8; font-size: .75em; letter-spacing: .08em; text-transform: uppercase; }
.slide-heading { font-size: 1.25em; margin: 0 0 10px; }
.slide-bullets { margin: 0; padding-left: 20px; font-size: .9em; }
.slide-bullets li { margin: 6px 0; }
.slide-notes { position: absolute; inset: auto 0 0 0; background: #0009; font-size: .78em; padding: 8px 12px; max-height: 40%; overflow: auto; }
.deck-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.slide-counter { font-variant-numeric: tabular-nums; font-size: .85em; min-width: 8ch; text-align: center; }
.deck-progress { flex: 1; height: 6px; border-radius: 4px; background: #8883; overflow: hidden; }
.deck-progress-fill { height: 100%; width: 0; background: #36c; transition: width .25s ease; }

/* ============ 4. MANGA — bold panels, bubbles, halftone art ============ */
.media.manga { max-width: 44em; }
.manga-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.manga-title { margin: 0; font-size: 1.15em; }
.manga-sfx { background: #000; color: #fff; padding: 1px 6px; transform: rotate(-4deg); display: inline-block; font-weight: 900; }
.manga-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.panel { margin: 0; border: 3px solid currentColor; border-radius: 4px; overflow: hidden; background: var(--panel-bg, #fff); display: flex; flex-direction: column; }
.panel.w2 { grid-column: span 2; }
.panel.h2 .panel-art { min-height: 220px; }
.panel-art { aspect-ratio: 4 / 3; position: relative; display: grid; place-items: center; background: repeating-radial-gradient(circle 3px at 25% 25%, #8882 0 2px, transparent 3px), repeating-linear-gradient(45deg, #8881 0 4px, transparent 5px); }
.panel-art img { width: 100%; height: 100%; object-fit: cover; }
.halftone { width: 100%; height: 100%; display: grid; place-items: center; background: repeating-radial-gradient(circle 4px at 30% 30%, currentColor 0 2px, transparent 3px), repeating-radial-gradient(circle 4px at 70% 70%, currentColor 0 2px, transparent 3px); opacity: .9; }
.sfx { font-weight: 900; font-size: 1.6em; letter-spacing: .06em; transform: rotate(-6deg) skewX(-6deg); text-shadow: 2px 2px 0 #fff, -2px -2px 0 #fff; }
.panel figcaption { padding: 8px; font-size: .8em; display: grid; gap: 6px; background: #8881; }
.panel-title { font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.bubble { position: relative; background: var(--bubble-bg, #fff); color: var(--bubble-fg, #111); border: 2px solid currentColor; border-radius: 14px; padding: 6px 10px; justify-self: start; max-width: 92%; }
.bubble.right { justify-self: end; }
.bubble::after { content: ""; position: absolute; bottom: -9px; left: 18px; border: 8px solid transparent; border-top-color: currentColor; border-bottom: 0; }
.bubble.right::after { left: auto; right: 18px; }
.panel-art.cover { background: linear-gradient(145deg, #333, #000); color: #fff; display: flex; flex-direction: column; }
.cover-title { font-weight: 900; font-size: 1.3em; text-align: center; padding: 0 10px; text-shadow: 3px 3px 0 #36c; }
.cover-by { font-size: .8em; color: #ccc; }
.title-panel { grid-column: span 2; border-width: 4px; }

/* ============ 5. SHORT VIDEO — preview + timecoded shot list ============ */
.media.video { max-width: 42em; }
.video-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.video-head h3 { margin: 0; }
.video-total { color: #777; font-size: .8em; font-variant-numeric: tabular-nums; }
.video-preview { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: linear-gradient(120deg, #2b1055, #7597de); color: #fff; display: grid; place-items: center; }
.kenburns { position: absolute; inset: -10%; background: radial-gradient(circle at 30% 40%, #ffffff22 0 18%, transparent 40%), radial-gradient(circle at 70% 60%, #36c3 0 22%, transparent 50%); animation: kenburns 8s ease-in-out infinite alternate; }
@keyframes kenburns { from { transform: scale(1) translate(0,0); } to { transform: scale(1.12) translate(-2%, 2%); } }
.video-ost { font-weight: 800; font-size: 1.15em; text-align: center; padding: 0 14px; text-shadow: 0 2px 8px #000a; z-index: 1; }
.video-rec { position: absolute; top: 8px; right: 10px; font-size: .7em; color: #f66; animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.video-controls { display: flex; align-items: center; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.video-progress { flex: 1; min-width: 80px; height: 8px; border-radius: 5px; background: #8883; overflow: hidden; }
.video-progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, #36c, #7c5cff); }
.video-tc { font-size: .8em; min-width: 5ch; }
.video-script { list-style: none; margin: 0; padding: 0; }
.shot { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid #8883; border-radius: 8px; margin-bottom: 6px; transition: background .2s, border-color .2s; }
.shot .t { color: #36c; font-weight: 700; min-width: 4.5ch; font-variant-numeric: tabular-nums; padding-top: 2px; }
.shot-body { display: grid; gap: 2px; flex: 1; font-size: .85em; }
.shot-visual { color: #777; font-size: .78em; text-transform: uppercase; letter-spacing: .05em; }
.shot-ost { font-weight: 700; }
.shot-vo { color: #666; }
.shot-dur { color: #777; font-size: .75em; white-space: nowrap; }
.shot.now { background: #36c1; border-color: #36c8; }
.shot.now .t { color: #d33; }

/* ============ 6. TYCOON — HUD + park grid ============ */
.media.game { max-width: 44em; }
.hud { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: #1d2530; color: #eef; border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; }
.hud-item { font-size: .85em; }
.hud-item b { font-variant-numeric: tabular-nums; }
.hud .btn { margin-left: auto; }
.game-goal { font-size: .85em; margin: 0 0 10px; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.lot { border: 2px solid #8884; border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; background: #8881; position: relative; }
.lot-head { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: .9em; }
.lot-icon { font-size: 1.3em; }
.lot-desc { font-size: .72em; color: #777; margin: 0; min-height: 2.2em; overflow: hidden; }
.lot-meta { display: flex; justify-content: space-between; font-size: .8em; }
.appeal { color: #da3; letter-spacing: .05em; }
.build-btn { margin-top: auto; }
.lot.built { border-color: #2a5; background: #2a51; }
.lot.built .build-btn { background: #2a5; }
.lot.built .lot-level::after { content: "★ Lv " attr(data-level); position: absolute; top: -10px; right: 8px; background: #2a5; color: #fff; font-size: .65em; padding: 1px 6px; border-radius: 8px; font-weight: 700; }
.game-win { margin-top: 12px; border: 2px solid #da3; border-radius: 10px; padding: 12px; text-align: center; background: #da31; font-weight: 700; }

/* ============ 7. AUDIO — player + synced transcript ============ */
.media.audio { max-width: 40em; }
.audio-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.audio-head h3 { margin: 0; }
.audio-est { color: #777; font-size: .8em; }
.audio-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0 6px; }
.audio-rate { font-size: .8em; display: flex; align-items: center; gap: 6px; }
.audio-voice { font-size: .8em; display: flex; align-items: center; gap: 6px; }
.audio-status { font-size: .8em; color: #36c; margin: 0 0 8px; min-height: 1.2em; }
.audio-transcript { border: 1px solid #8884; border-radius: 10px; padding: 12px 14px; max-height: 42vh; overflow: auto; font-size: .88em; line-height: 1.7; }
.sentence { border-radius: 4px; transition: background .2s; }
.sentence.is-speaking { background: #36c3; }
.sentence.is-done { opacity: .55; }
