/* TreeLens website. Dark, so video leads; one accent colour (the apps' TreeLensTheme.accent). */

/* ── Base ───────────────────────────────────────────────────────────────────── */

:root {
  color-scheme: dark;
  --bg: #0d1110;
  --surface: #161c1a;
  --surface-2: #1f2724;
  --line: #2b3531;
  --text: #eef4f1;
  --muted: #9aa8a2;
  --accent: #5cc79e;
  --accent-ink: #062418;
  --danger: #ff6b6b;
  --radius: 16px;
  --gutter: clamp(16px, 4vw, 40px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter) 64px; outline: none; }
/* Each page moves focus to <main> for screen readers; it needs no outline. */
main:focus-visible { outline: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.01em; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 0.85rem; }
.fine a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.warning { color: #f0b35a; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }

/* ── Icons ──────────────────────────────────────────────────────────────────── */

.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon .filled { fill: currentColor; stroke: none; }

/* ── Header and footer ──────────────────────────────────────────────────────── */

.site-header { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 12px var(--gutter); background: rgba(13, 17, 16, 0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { flex: none; display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.15rem; }
.brand:hover { text-decoration: none; }
.dev-badge { display: none; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-ink); background: #f5c451; padding: 2px 8px; border-radius: 99px; }
body.dev .dev-badge { display: inline-block; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text); padding: 6px 10px; border-radius: 10px; white-space: nowrap; }
@media (max-width: 480px) {
  .site-header { gap: 8px; }
  .dev-badge { font-size: 0; padding: 4px; }
  .dev-badge::after { content: "Dev"; font-size: 0.65rem; }
  .site-nav { gap: 2px; }
  .nav-link .icon { display: none; }
}
.nav-link:hover { background: var(--surface); text-decoration: none; }
.nav-link .badge { min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 0.72rem; font-weight: 800; text-align: center; }
.search-box { display: flex; align-items: center; gap: 6px; padding: 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.search-box:focus-within { border-color: var(--accent); }
.search-box input { border: 0; background: none; padding: 7px 0; width: clamp(120px, 22vw, 260px); }
.search-box input:focus { outline: none; }
@media (max-width: 640px) { .search-box input { width: 96px; } }
.site-footer { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: center; padding: 24px var(--gutter); border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }
.site-footer a { color: var(--muted); }

/* ── Buttons ────────────────────────────────────────────────────────────────── */

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 10px 18px; cursor: pointer; text-decoration: none; }
.button:hover { text-decoration: none; border-color: #3d4a45; }
.button:disabled { opacity: 0.5; cursor: progress; }
.button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.button.danger { color: var(--danger); }
.button.small { padding: 6px 14px; font-size: 0.9rem; }
.button.wide { width: 100%; }
.nav-link.button { color: var(--text); }
.link-button { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; }
.link-button:hover { text-decoration: underline; }
.text-button { display: inline-flex; align-items: center; gap: 6px; font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.text-button:hover { text-decoration: underline; }
.text-button.on { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── Forms ──────────────────────────────────────────────────────────────────── */

label { display: grid; gap: 6px; font-weight: 600; font-size: 0.92rem; }
input, textarea { font: inherit; font-weight: 400; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%; }
input:focus, textarea:focus { border-color: var(--accent); outline: none; }
select { font: inherit; font-size: 0.9rem; font-weight: 600; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; }
/* A checkbox or radio button and its words, in a row. */
label.reason { display: flex; align-items: center; gap: 10px; font-weight: 400; cursor: pointer; }
label.reason input { width: auto; margin: 0; padding: 0; flex: none; accent-color: var(--accent); }
.stacked { display: grid; gap: 12px; }
.error { color: var(--danger); margin: 0; min-height: 1em; }
.error:empty { display: none; }

/* ── Page parts ─────────────────────────────────────────────────────────────── */

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 32px 0 16px; }
.page-head > h1 { flex: 1 1 auto; }
.page-head .button, .page-head .segmented { margin-top: 4px; }
.lead { font-size: clamp(1.05rem, 2.2vw, 1.3rem); color: var(--muted); }
.section-title { font-size: 1.3rem; margin: 24px 0 16px; }
.section-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.byline { font-weight: 600; }
.facts { color: var(--muted); font-size: 0.9rem; margin-bottom: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.actions .spacer { flex: 1; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.more { display: flex; justify-content: center; margin-top: 24px; }
.notice { display: flex; align-items: center; gap: 10px; margin: 20px 0 0; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--muted); }

/* Empty and loading states */
.empty { text-align: center; padding: 72px 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty.inline { padding: 40px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty-icon { width: 48px; height: 48px; stroke: var(--muted); fill: none; stroke-width: 1.5; }
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 96px 0; color: var(--muted); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.spinner.small { width: 18px; height: 18px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Cards, posters and avatars ─────────────────────────────────────────────── */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 20px; }
.grid.vertical { grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); }
.grid-title { font-size: 1rem; color: var(--muted); margin: 20px 0 12px; }
.card { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-main { display: flex; flex-direction: column; gap: 10px; color: var(--text); margin-bottom: 2px; }
.card-main:hover { text-decoration: none; }
.card-main:hover .poster { transform: translateY(-3px); border-color: var(--accent); }
.card-title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-creator { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 0.9rem; justify-self: start; width: fit-content; }
a.card-creator:hover { color: var(--text); }
.card-meta { color: var(--muted); font-size: 0.85rem; }
.card-match { color: var(--accent); font-size: 0.85rem; font-weight: 600; }
.kind-badge { position: absolute; top: 8px; right: 8px; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: #fff; background: rgba(0, 0, 0, 0.6); padding: 3px 8px; border-radius: 999px; }
.found-badge { position: absolute; bottom: 8px; right: 8px; font-size: 0.68rem; font-weight: 800; color: #fff; background: rgba(0, 0, 0, 0.6); padding: 3px 8px; border-radius: 999px; }
.poster { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: linear-gradient(160deg, #9ad9bf 0%, #3f6b5b 45%, #0b0f0e 100%); border: 1px solid var(--line); transition: transform 0.15s ease, border-color 0.15s ease; display: grid; place-items: center; }
.poster.vertical { aspect-ratio: 9 / 16; }
.poster img { width: 100%; height: 100%; object-fit: cover; }
.poster-icon { width: 40%; height: 40%; stroke: rgba(255, 255, 255, 0.6); fill: none; stroke-width: 1.5; }
.poster.small { width: 120px; aspect-ratio: 16 / 10; }
.poster.thumb { width: 96px; flex: none; border-radius: 8px; }
.poster.thumb.vertical { width: 40px; }
/* A collection's poster: up to four of its trees' posters. */
.mosaic { display: grid; place-items: stretch; gap: 2px; }
.mosaic.count-2 { grid-template-columns: 1fr 1fr; }
.mosaic.count-3, .mosaic.count-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.mosaic img { min-height: 0; }
.avatar { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.avatar.large { width: 96px; height: 96px; font-size: 2rem; }
.avatar.small { width: 32px; height: 32px; font-size: 0.8rem; }
.avatar.tiny { width: 18px; height: 18px; font-size: 0.55rem; display: inline-grid; vertical-align: -4px; margin-right: 4px; }
.avatar.picture { object-fit: cover; padding: 0; background: var(--surface-2); }

/* ── Explore ────────────────────────────────────────────────────────────────── */

.hero { padding: clamp(32px, 7vw, 80px) 0 clamp(24px, 4vw, 40px); max-width: 720px; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); }
.browse-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.segmented { display: inline-flex; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.segment { padding: 6px 16px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.segment:hover { color: var(--text); text-decoration: none; }
.segment[aria-current="true"] { background: var(--surface-2); color: var(--text); }
button.segment { background: none; border: 0; font: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; margin-bottom: 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip-link { flex: none; padding: 7px 14px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 0.9rem; font-weight: 600; white-space: nowrap; }
.chip-link:hover { text-decoration: none; background: #29332f; }
.chip-link[aria-current="true"] { background: var(--accent); color: var(--accent-ink); }
.shelf { margin-top: 8px; }
.shelf-row { display: grid; grid-auto-flow: column; grid-auto-columns: min(78vw, 260px); gap: 16px; overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x proximity; }
.shelf-row.vertical { grid-auto-columns: min(42vw, 170px); }
.shelf-row > .card { scroll-snap-align: start; }
.how { margin-top: 56px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.steps { margin: 0; padding-left: 1.2em; display: grid; gap: 12px; max-width: 760px; }

/* ── Search ─────────────────────────────────────────────────────────────────── */

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.creators { display: flex; flex-wrap: wrap; gap: 12px; }
.creator-tile { display: flex; align-items: center; gap: 12px; padding: 12px 16px 12px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); }
.creator-tile:hover { text-decoration: none; border-color: var(--accent); }
.creator-text { display: grid; line-height: 1.3; }

/* ── A channel ──────────────────────────────────────────────────────────────── */

.channel-banner { margin-top: 24px; border-radius: var(--radius); overflow: hidden; aspect-ratio: 3 / 1; max-height: 260px; width: 100%; background: var(--surface); }
.channel-banner img { width: 100%; height: 100%; object-fit: cover; }
.channel-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px; padding: 32px 0 8px; }
.channel-head h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin: 0; }
.channel-head .handle { font-size: 1.1rem; margin-bottom: 8px; }
.channel-head .row-actions { margin: 10px 0 4px; }
.bio { max-width: 640px; white-space: pre-line; }

/* ── A tree's page ──────────────────────────────────────────────────────────── */

.watch { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; padding-top: 24px; align-items: start; }
@media (max-width: 900px) { .watch { grid-template-columns: 1fr; } }
.tree-info h1 { font-size: 1.7rem; }
.summary { white-space: pre-line; }

/* ── Player: the video alone until the viewer reaches for the controls ─────── */

.player { --bar: 56px; background: #000; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.player.timeline-on { --bar: 92px; }
.stage { position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.player.vertical .stage { aspect-ratio: 9 / 16; max-height: 78vh; margin: 0 auto; }
.layers video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; pointer-events: none; }
.layers video.active { opacity: 1; }
.start-button { position: absolute; inset: 0; margin: auto; width: 88px; height: 88px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer; display: grid; place-items: center; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); z-index: 6; }
.start-button .icon { width: 40px; height: 40px; margin-left: 4px; }
.chrome-button { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; color: #fff; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.chrome-button .icon { width: 16px; height: 16px; }

/* Controls: hidden until reached for; they never cover the choices. */
.top-bar, .control-bar { position: absolute; left: 0; right: 0; z-index: 4; opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
.player.controls-shown .top-bar, .player.controls-shown .control-bar { opacity: 1; pointer-events: auto; }
.top-bar { top: 0; display: flex; justify-content: flex-end; padding: 14px; background: linear-gradient(rgba(0, 0, 0, 0.55), transparent); }
.scene-title { font-weight: 600; text-shadow: 0 1px 4px #000; }
.control-bar { bottom: 0; padding: 8px 12px 10px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.75)); }
.control-row { display: flex; align-items: center; gap: 8px; }
.control-row .spacer { flex: 1; }
.control { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.16); color: #fff; cursor: pointer; }
.control:hover, .control:focus-visible { background: rgba(255, 255, 255, 0.3); }
.control[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.control .icon { width: 18px; height: 18px; }
.timeline { display: flex; align-items: center; gap: 12px; padding: 4px 4px 8px; }
.scrubber { flex: 1; accent-color: var(--accent); padding: 0; border: 0; background: none; }
.time { font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, 0.85); font-size: 0.85rem; min-width: 84px; text-align: right; }

/* Buttons: the scene's layout, position and theme. */
.choices { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; padding: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 10px; background: linear-gradient(transparent, rgba(0,0,0,0.7)); transform: translateY(100%); opacity: 0; pointer-events: none; transition: transform 0.25s ease, opacity 0.25s ease, bottom 0.25s ease; }
.choices.visible { transform: none; opacity: 1; pointer-events: auto; }
.player.controls-shown .choices:not(.center), .player.controls-shown .branch-actions { bottom: var(--bar); }
.choices.layout-column { grid-template-columns: 1fr; width: min(100%, 560px); margin: 0 auto; }
.choices.layout-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(100%, 820px); margin: 0 auto; }
.choices.center { top: 50%; bottom: auto; transform: translateY(-50%); background: none; opacity: 0; }
.choices.center.visible { opacity: 1; transform: translateY(-50%); }
.choice { display: flex; align-items: center; gap: 12px; text-align: left; font: inherit; font-weight: 650; color: #fff; background: rgba(22, 28, 26, 0.88); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 14px; padding: 12px 14px; cursor: pointer; min-height: 52px; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.choice:hover, .choice:focus-visible { background: rgba(40, 50, 46, 0.95); outline: 2px solid var(--accent); outline-offset: 0; }
.choice-number { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 0.85rem; flex: none; }
.theme-glass .choice { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.25); }
.theme-light .choice { color: #101614; background: rgba(240, 247, 244, 0.94); border-color: transparent; }
.theme-light .choice:hover { background: #fff; }
.theme-accent .choice { color: var(--choice-ink, var(--accent-ink)); background: var(--choice-accent, var(--accent)); border-color: transparent; }
.theme-accent .choice-number { background: rgba(255, 255, 255, 0.3); color: inherit; }
/* A vertical tree's row of buttons stacks; a creator's grid stays a grid. */
.player.vertical .choices.layout-row { grid-template-columns: 1fr; }
.branch-actions { position: absolute; left: 0; right: 0; bottom: 12px; z-index: 3; display: none; justify-content: center; transition: bottom 0.25s ease; }
.branch-actions.visible { display: flex; }
.countdown { position: absolute; left: 16px; right: 16px; bottom: 6px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.2); opacity: 0; z-index: 3; }
.countdown.visible { opacity: 1; }
.countdown-bar { height: 100%; width: 100%; border-radius: 4px; background: var(--accent); }

/* The video's fitted frame: hotspot pins and skin slots are placed in it. */
.video-frame { position: absolute; z-index: 2; pointer-events: none; display: none; }
.video-frame.visible { display: block; }
.pin { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto; display: grid; place-items: center; font: inherit; }
.pin-marker { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); display: grid; place-items: center; color: #062418; transition: transform 0.15s ease; }
.pin-marker .icon { width: 12px; height: 12px; stroke-width: 4; }
.pin.look-dot .pin-marker { width: 14px; height: 14px; border-width: 2px; }
.pin.look-ring .pin-marker { background: transparent; border: 4px solid var(--accent); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.8), 0 2px 6px rgba(0, 0, 0, 0.5); color: #fff; }
.pin.look-hidden .pin-marker { opacity: 0; }
.pin-label { position: absolute; white-space: nowrap; font-weight: 650; font-size: 0.9rem; color: #fff; background: rgba(0, 0, 0, 0.62); padding: 4px 10px; border-radius: 999px; pointer-events: none; }
.pin.side-right .pin-label { left: calc(100% + 2px); }
.pin.side-left .pin-label { right: calc(100% + 2px); }
.pin.side-above .pin-label { bottom: calc(100% + 2px); }
.pin.side-below .pin-label { top: calc(100% + 2px); }
.pin.look-hidden .pin-label { opacity: 0; }
.pin:hover .pin-marker, .pin:focus-visible .pin-marker { transform: scale(1.2); opacity: 1; box-shadow: 0 0 0 8px rgba(92, 199, 158, 0.35); }
.pin:hover .pin-label, .pin:focus-visible .pin-label { opacity: 1; background: #fff; color: #101614; }
.pin:focus-visible { outline: none; }

/* Branch skins: pictures by state, the label drawn by TreeLens, a fixed set of motions. */
.skin { position: absolute; inset: 0; }
.skin-background, .slot { position: absolute; }
.slot { padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto; transition: transform 0.25s ease, opacity 0.25s ease, filter 0.25s ease; }
.slot img { position: absolute; inset: 0; width: 100%; height: 100%; }
.slot .state-visited, .slot .state-focused, .slot .state-pressed { opacity: 0; }
.slot.visited .state-visited { opacity: 1; }
.slot:hover .state-focused, .slot:focus-visible .state-focused { opacity: 1; }
.slot:active .state-pressed { opacity: 1; }
.slot:focus-visible { outline: none; }
.slot-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 0 7%; font-size: calc(var(--size) * var(--frame-height)); line-height: 1.1; text-align: center; overflow: hidden; }
.slot-label.align-leading { justify-content: flex-start; text-align: left; }
.slot-label.align-trailing { justify-content: flex-end; text-align: right; }
.skin.appear-fade { animation: skin-fade 0.35s ease-out; }
.skin.appear-slide { animation: skin-slide 0.35s ease-out; }
.skin.appear-scale { animation: skin-scale 0.35s ease-out; }
.skin.appear-pulse { animation: skin-pulse 0.45s ease-out; }
.slot.select-scale { transform: scale(1.1); }
.slot.select-pulse { transform: scale(1.15); filter: brightness(1.25); }
.slot.select-fade { opacity: 0.35; }
.slot.select-slide { transform: translateY(-12px); }
@keyframes skin-fade { from { opacity: 0; } }
@keyframes skin-slide { from { opacity: 0; transform: translateY(40px); } }
@keyframes skin-scale { from { opacity: 0; transform: scale(0.85); } }
@keyframes skin-pulse { from { opacity: 0; transform: scale(1.08); } }

/* Tree map and chapters. */
.map-panel { position: absolute; top: 12px; right: 12px; bottom: 12px; width: min(380px, calc(100% - 24px)); z-index: 5; display: none; flex-direction: column; padding: 16px; background: rgba(16, 20, 19, 0.95); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.map-panel.visible { display: flex; }
.map-head { display: flex; align-items: center; justify-content: space-between; }
.map-head h2 { font-size: 1.15rem; margin: 0; }
.map-summary { font-size: 0.8rem; margin: 4px 0 10px; }
.chapters { list-style: none; margin: 0; padding: 0; overflow: auto; counter-reset: chapter; }
.chapter { width: 100%; display: flex; align-items: center; gap: 10px; font: inherit; color: var(--text); text-align: left; background: none; border: 0; border-radius: 10px; padding: 8px 10px; cursor: pointer; counter-increment: chapter; }
.chapter::before { content: counter(chapter); width: 22px; color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.chapter-title { flex: 1; }
.chapter.current { background: rgba(255, 255, 255, 0.1); font-weight: 650; }
.chapter:hover, .chapter:focus-visible { background: rgba(255, 255, 255, 0.14); outline: none; }
.chapter .icon { width: 16px; height: 16px; color: var(--accent); }
.story-map-scroll { overflow: auto; flex: 1; }
.story-map .edge { fill: none; stroke: rgba(255, 255, 255, 0.55); stroke-width: 1.5; }
.story-map .edge.unknown { stroke: rgba(255, 255, 255, 0.3); stroke-dasharray: 3 3; }
.story-map .node circle { fill: var(--accent); stroke: none; }
.story-map .node.current circle { stroke: #fff; stroke-width: 3; }
.story-map .node.unseen circle { fill: none; stroke: rgba(255, 255, 255, 0.6); stroke-width: 1.5; }
.story-map .node.unknown circle { fill: none; stroke: rgba(255, 255, 255, 0.4); stroke-width: 1.5; stroke-dasharray: 3 3; }
.story-map .node.ending.found circle { fill: #f5c451; }
.story-map text { fill: var(--text); font-size: 11px; }
.story-map .node.unknown text { fill: var(--muted); }

/* The end screen. */
.ending-card { position: absolute; inset: 0; margin: auto; width: min(92%, 520px); height: fit-content; max-height: 94%; overflow: auto; padding: 22px; text-align: center; background: rgba(22, 28, 26, 0.95); border: 1px solid var(--line); border-radius: 20px; display: none; z-index: 5; }
.ending-card.visible { display: block; }
.ending-tag { text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.8rem; font-weight: 700; color: var(--accent); margin-bottom: 6px; }
.ending-tag.bad { color: var(--danger); }
.ending-tag.secret { color: #f5c451; }
.ending-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 0.85rem; }
.chip .icon { width: 14px; height: 14px; }
.chip.found { color: var(--text); }
.ending-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.rating { display: grid; justify-items: center; gap: 2px; margin-top: 4px; }
.stars { display: flex; gap: 4px; }
.star { background: none; border: 0; padding: 2px; color: var(--muted); cursor: pointer; }
.star .icon { width: 26px; height: 26px; }
.star .icon.on { color: var(--accent); }
.replay { margin-top: 14px; }
.replay summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.replay-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.up-next h3 { font-size: 1rem; margin: 18px 0 10px; text-align: left; }
.up-next-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.up-next-card { display: grid; gap: 6px; color: var(--text); font-size: 0.85rem; font-weight: 600; text-align: left; }
.up-next-card img, .up-next-blank { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; }
.player-message { position: absolute; left: 16px; right: 16px; bottom: 16px; padding: 10px 14px; border-radius: 12px; background: rgba(0, 0, 0, 0.75); display: none; z-index: 5; }
.player-message.visible { display: block; }

/* ── Comments ───────────────────────────────────────────────────────────────── */

.comments { margin-top: 40px; max-width: 760px; }
.comment-form { display: grid; gap: 8px; margin-bottom: 20px; }
.comment-form textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: vertical; }
.comment-form select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.comment-list { display: grid; gap: 18px; }
.thread { display: grid; gap: 10px; }
.replies { display: grid; gap: 10px; padding-left: 44px; }
.comment { display: flex; gap: 12px; align-items: flex-start; }
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: 0.9rem; }
.comment-author { color: var(--text); font-weight: 700; }
.creator-badge { font-size: 0.7rem; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: rgba(92, 199, 158, 0.25); color: var(--text); }
.comment-body { margin: 4px 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment.held .comment-body, .comment.removed .comment-body { opacity: 0.7; }
.comment-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: 0.85rem; color: var(--muted); }
.comment-actions .icon { width: 16px; height: 16px; }
.hearted { display: inline-flex; align-items: center; gap: 4px; color: #ff7a9a; }
.spoiler { display: block; width: 100%; margin: 4px 0 6px; padding: 10px 12px; text-align: left; font: inherit; color: var(--muted); background: repeating-linear-gradient(135deg, var(--surface), var(--surface) 8px, var(--surface-2) 8px, var(--surface-2) 16px); border: 1px dashed var(--line); border-radius: 10px; cursor: pointer; }

/* ── Collections, history and notifications ─────────────────────────────────── */

.collection-head { display: block; }
.collection-head .byline { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; color: var(--muted); margin-bottom: 12px; }
.collection-picks { display: grid; gap: 4px; max-height: 50vh; overflow: auto; margin-bottom: 12px; }
.history-list, .inbox { display: grid; gap: 8px; margin: 16px 0; }
.history-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px; border-radius: 12px; background: var(--surface); }
.history-tree { display: flex; align-items: center; gap: 12px; color: var(--text); min-width: 0; }
.inbox-item { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface); color: var(--text); border-left: 3px solid transparent; }
.inbox-item.unread { border-left-color: var(--accent); }
.inbox-item.unread .inbox-text { font-weight: 700; }
a.inbox-item:hover { text-decoration: none; background: var(--surface-2); }
.notify-settings { margin-top: 28px; display: grid; gap: 6px; }

/* ── My Trees ───────────────────────────────────────────────────────────────── */

.account { display: flex; align-items: center; gap: 12px; }
.my-trees { display: grid; gap: 14px; }
.my-tree { display: flex; gap: 16px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.my-tree-poster { flex: none; }
.my-tree-body { flex: 1; min-width: 0; }
.my-tree-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.my-tree-head h3 { margin: 0; font-size: 1.1rem; }
.status { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.status.published { background: rgba(92, 199, 158, 0.15); color: var(--accent); }
.edit-form { display: grid; gap: 10px; margin-top: 14px; max-width: 560px; }
.edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.edit-form select { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; width: 100%; }
@media (max-width: 560px) { .my-tree { flex-direction: column; } .poster.small { width: 100%; } }

/* Your channel: its form and pictures, and the people you've blocked. */
.channel-form { display: grid; gap: 12px; max-width: 640px; margin-bottom: 32px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.channel-form .section-title { margin: 0; }
.year-input { max-width: 8em; }
.channel-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.handle-input { display: flex; align-items: center; gap: 4px; padding-left: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; color: var(--muted); }
.handle-input input { border: 0; padding-left: 0; }
.handle-input:focus-within { border-color: var(--accent); }
.channel-pictures { display: grid; gap: 16px; max-width: 640px; margin-bottom: 32px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.channel-pictures .section-title { margin: 0; }
.picture-row { display: grid; grid-template-columns: 192px 1fr auto; align-items: center; gap: 16px; }
.picture-row .avatar.large { justify-self: start; }
.picture-row .row-actions { flex-wrap: nowrap; }
@media (max-width: 560px) { .picture-row { grid-template-columns: 1fr; } }
.banner-preview { width: 192px; aspect-ratio: 3 / 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.banner-preview img { width: 100%; height: 100%; object-fit: cover; }
.blocked-list { display: grid; gap: 8px; margin-bottom: 8px; }
.blocked-list .row-actions { align-items: center; justify-content: space-between; }

/* What TreeLens did about a tree, an account, a report. */
.review { margin: 8px 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); display: grid; gap: 6px; justify-items: start; }
.review.good { border-color: rgba(84, 200, 140, 0.35); }
.review.good strong { color: var(--accent); }
.review.warn { border-color: rgba(240, 180, 60, 0.45); }
.review.warn strong { color: #f0b43c; }
.review.bad { border-color: rgba(240, 100, 90, 0.5); }
.review.bad strong { color: var(--danger); }
.notice.review { display: flex; align-items: flex-start; gap: 10px; }
.status.review-chip { background: var(--surface-2); color: var(--muted); }
.status.review-chip.good { color: var(--accent); }
.my-reports { display: grid; gap: 12px; margin-top: 16px; }
.my-report { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.my-report-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.my-report-head .status { margin-left: auto; }
.my-report p { margin: 6px 0; }

/* ── Skins & Music, and the skin guide ──────────────────────────────────────── */

.library-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.library-head .section-title { margin-right: auto; }
.library-list { display: grid; gap: 10px; margin-bottom: 16px; }
.library-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.library-row h3 { margin: 0 0 4px; font-size: 1rem; }
.library-body { flex: 1 1 240px; min-width: 0; display: grid; gap: 6px; }
.library-body audio { width: 100%; max-width: 360px; height: 36px; }
.library-icon { width: 28px; height: 28px; color: var(--accent); flex: none; }
.guide { max-width: 760px; }
.guide h2 { margin-top: 28px; }
.guide pre.code { overflow-x: auto; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; font-size: 0.85rem; line-height: 1.45; }
.spec { width: 100%; border-collapse: collapse; margin-top: 12px; }
.spec th, .spec td { text-align: left; vertical-align: top; padding: 10px 12px; border-top: 1px solid var(--line); }
.spec th { white-space: nowrap; font-weight: 600; width: 1%; }
@media (max-width: 560px) { .spec th { white-space: normal; } }

/* ── Signing in ─────────────────────────────────────────────────────────────── */

.auth-box { max-width: 420px; margin: 48px auto 0; }
.auth-form { display: grid; gap: 14px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.auth-form h1 { font-size: 1.5rem; }
.auth-links { display: grid; gap: 8px; justify-items: start; }
.apple-choice { display: grid; gap: 14px; }
.or { display: flex; align-items: center; gap: 12px; margin: 0; color: var(--muted); font-size: 0.85rem; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
/* Apple's white button style, for dark backgrounds. */
.button.apple { background: #fff; color: #000; border-color: #fff; }
.button.apple .icon { width: 20px; height: 20px; margin-top: -3px; }

/* ── Dialogs: reports, appeals, counter-notices, collections ────────────────── */

.report-dialog { width: min(460px, calc(100vw - 32px)); padding: 24px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.report-dialog.wide { width: min(620px, calc(100vw - 32px)); }
.report-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.report-dialog h2 { margin: 0 0 12px; font-size: 1.25rem; }
.report-dialog fieldset { border: 0; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.report-dialog legend { font-weight: 600; margin-bottom: 6px; }
.report-dialog .reason { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; font-weight: 400; cursor: pointer; }
.report-dialog .reason input { width: auto; margin: 0; padding: 0; flex: none; accent-color: var(--accent); }
.report-dialog textarea { width: 100%; box-sizing: border-box; margin: 8px 0; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.report-dialog .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.report-dialog .form-problem { color: var(--danger); margin: 0; }
.report-dialog .form-problem:empty { display: none; }
/* Long statements to agree to: the box at the top of the words. */
.policy-form .reason, .report-dialog.wide .reason { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; }
.policy-form .reason input, .report-dialog.wide .reason input { width: auto; margin-top: 4px; flex: none; }

/* ── Policies ───────────────────────────────────────────────────────────────── */

.policy { max-width: 760px; margin: 0 auto; line-height: 1.6; }
.policy h2 { margin-top: 28px; font-size: 1.2rem; }
.policy ul { padding-left: 22px; }
.policy li { margin-bottom: 6px; }
.policy-form { margin-top: 32px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }

/* ── Toast ──────────────────────────────────────────────────────────────────── */

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); padding: 10px 18px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 600; z-index: 20; transition: opacity 0.3s ease; }
.toast.leaving { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 0.01s !important; }
}
