:root {
  --ink: #2d3a5a; --paper: #f4ecdc; --tape: #eadcbd; --fg: #f3ede2; --soft: rgba(243, 237, 226, .66); --faint: rgba(243, 237, 226, .42);
  --hand: Caveat, "Kaiti TC", "BiauKai", "Bradley Hand", cursive;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "PingFang TC", "Noto Sans TC", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d0c0b; color: var(--fg); font: 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
.th-canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
/* A soft fade from black on arrival, so the room comes up like house lights. */
.th-veil { position: fixed; inset: 0; background: #0d0c0b; pointer-events: none; transition: opacity 1.2s ease; }
.is-ready .th-veil { opacity: 0; }

.th-top { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(14px, env(safe-area-inset-top)) 18px 14px; pointer-events: none; z-index: 3; }
.th-top > * { pointer-events: auto; }
.th-back { color: var(--soft); text-decoration: none; font-weight: 500; padding: 6px 8px; margin-left: -8px; border-radius: 8px; }
.th-back:hover { color: var(--fg); background: rgba(255, 255, 255, .06); }
.th-name { position: absolute; left: 50%; transform: translateX(-50%); margin: 0; font: 700 26px/1 var(--hand); color: var(--fg); letter-spacing: .01em; pointer-events: none; text-shadow: 0 1px 10px rgba(0, 0, 0, .5); }
.th-actions { display: flex; gap: 8px; }
.th-btn { appearance: none; display: inline-flex; align-items: center; min-height: 34px; padding: 0 13px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 999px; background: rgba(20, 18, 16, .5); color: var(--soft); font: 500 13.5px var(--sans); text-decoration: none; cursor: pointer; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: color .15s, background-color .15s, border-color .15s; }
.th-btn:hover { color: var(--fg); background: rgba(40, 36, 32, .7); border-color: rgba(255, 255, 255, .28); }
.th-sound[aria-pressed="true"] { color: var(--fg); }
a:focus-visible, button:focus-visible { outline: 2px solid #9db4ff; outline-offset: 2px; }

.th-hint { position: fixed; left: 50%; bottom: max(26px, env(safe-area-inset-bottom)); transform: translateX(-50%); margin: 0; padding: 7px 14px; border-radius: 999px; background: rgba(20, 18, 16, .55); color: var(--soft); font-size: 13.5px; white-space: nowrap; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: opacity .4s; z-index: 2; pointer-events: none; }
.is-busy .th-hint, .is-playing .th-hint { opacity: 0; }
/* The label that follows the film can under the pointer. */
.th-tip { position: fixed; left: 0; top: 0; margin: 0; padding: 6px 11px 7px; border-radius: 3px; background: var(--tape); color: var(--ink); font: 700 21px/1 var(--hand); white-space: nowrap; box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .7); transform: translate(-50%, -100%) rotate(-2deg); opacity: 0; transition: opacity .15s; pointer-events: none; z-index: 2; }
.th-tip small { display: block; margin-top: 3px; font: 500 11px var(--sans); color: rgba(45, 58, 90, .7); letter-spacing: .02em; }
.th-tip.is-on { opacity: 1; }

/* Keyboard and screen-reader way in: the same films as a list, shown when focused. */
.th-films { position: fixed; left: 18px; bottom: 18px; z-index: 3; padding: 12px 14px; border-radius: 12px; background: rgba(20, 18, 16, .85); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }
.th-films:focus-within { clip-path: none; width: auto; height: auto; }
.th-films-h { margin: 0 0 6px; font-size: 12px; color: var(--faint); }
.th-films ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.th-films button small { margin-left: 8px; color: var(--faint); font-size: 12px; }
.th-films button { appearance: none; width: 100%; text-align: left; padding: 6px 8px; border: 0; border-radius: 6px; background: none; color: var(--fg); font: 500 14px var(--sans); cursor: pointer; }
.th-films button:hover, .th-films button:focus-visible { background: rgba(255, 255, 255, .08); }

/* Now showing: a slim bar along the bottom, under the picture. */
.th-card { position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translate(-50%, 12px); width: min(980px, calc(100% - 28px)); display: flex; align-items: center; gap: 18px; padding: 10px 12px 10px 20px; border-radius: 14px; background: rgba(16, 14, 12, .78); border: 1px solid rgba(255, 255, 255, .08); opacity: 0; transition: opacity .45s ease, transform .55s cubic-bezier(.2, .8, .25, 1); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); z-index: 3; }
.th-card[hidden] { display: flex; visibility: hidden; }
.th-card.is-on { opacity: 1; transform: translate(-50%, 0); }
.th-card-text { flex: 1; min-width: 0; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "now now" "title meta" "blurb blurb"; align-items: baseline; column-gap: 12px; }
.th-now { grid-area: now; margin: 0; font: 700 10px/1 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: #e7b866; }
.th-title { grid-area: title; margin: 3px 0 0; padding-right: .2em; font: 700 28px/1.05 var(--hand); color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-meta { grid-area: meta; margin: 0; font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-blurb { grid-area: blurb; margin: 1px 0 0; color: var(--soft); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-card-actions { display: flex; flex: none; gap: 8px; }
.th-enter, .th-eject, .th-full, .th-pause { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 999px; font: 600 14px var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap; }
.th-enter { background: var(--paper); color: #1c1a17; border: 0; }
.th-enter:hover { background: #fff; }
.th-eject, .th-full, .th-pause { appearance: none; background: none; color: var(--soft); border: 1px solid rgba(255, 255, 255, .2); }
.th-eject:hover, .th-full:hover, .th-pause:hover { color: var(--fg); border-color: rgba(255, 255, 255, .36); }
.th-pause[hidden] { display: none; }

/* Full screen: the picture fills the view; everything else steps aside. */
.th-exitfull, .th-recenter { position: fixed; z-index: 3; opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
.th-exitfull { top: max(14px, env(safe-area-inset-top)); right: 18px; gap: 8px; }
.th-exitfull kbd, .th-recenter kbd, .th-card kbd { font: 500 11px var(--sans); color: var(--faint); border: 1px solid rgba(255, 255, 255, .18); border-radius: 4px; padding: 1px 5px; margin-left: 2px; }
.th-recenter { gap: 8px; }
@media (pointer: coarse) { .th-exitfull kbd, .th-recenter kbd, .th-card kbd { display: none; } }
.is-full .th-exitfull { opacity: .35; visibility: visible; transition-delay: .22s; } /* wait for the header to clear first */
.is-full .th-exitfull:hover, .is-full .th-exitfull:focus-visible { opacity: 1; transition-delay: 0s; }
.is-full .th-top, .is-full .th-card { opacity: 0; visibility: hidden; pointer-events: none; }
.th-top, .th-card { transition: opacity .45s ease, transform .55s cubic-bezier(.2, .8, .25, 1), visibility .45s; }
/* Recenter: shown once you've wandered off. */
.th-recenter { left: 50%; bottom: max(72px, calc(env(safe-area-inset-bottom) + 58px)); transform: translateX(-50%); }
.is-moved .th-recenter { opacity: 1; visibility: visible; }
.is-busy .th-recenter, .is-playing .th-recenter { opacity: 0; visibility: hidden; }

/* Things to do in the room. The tally: a scrap of tape under the back link, once something's been found. */
.th-tally { position: fixed; left: 18px; top: max(62px, calc(env(safe-area-inset-top) + 48px)); margin: 0; padding: 4px 10px 5px; border-radius: 3px; background: var(--tape); color: var(--ink); font: 700 18px/1 var(--hand); box-shadow: 0 6px 16px -8px rgba(0, 0, 0, .7); transform: rotate(-3deg); z-index: 2; pointer-events: none; transition: opacity .4s, visibility .4s; }
.th-tally[hidden] { display: none; }
.th-tally.is-bump { animation: th-bump .6s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes th-bump { 0% { transform: rotate(-3deg) scale(1); } 35% { transform: rotate(2deg) scale(1.22); } 100% { transform: rotate(-3deg) scale(1); } }
.is-playing .th-tally, .is-full .th-tally { opacity: 0; visibility: hidden; }
/* In a seat: stand up, and the snacks within reach. Above the Now showing bar while a film's on. */
.th-seatbar { position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translate(-50%, 8px); display: flex; gap: 8px; z-index: 3; opacity: 0; visibility: hidden; transition: opacity .35s, transform .45s cubic-bezier(.2, .8, .25, 1), visibility .35s; }
.th-seatbar .th-btn { gap: 8px; white-space: nowrap; }
.th-seatbar kbd { font: 500 11px var(--sans); color: var(--faint); border: 1px solid rgba(255, 255, 255, .18); border-radius: 4px; padding: 1px 5px; }
.th-stand { color: var(--fg); }
.is-seated .th-seatbar { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.is-seated.is-busy .th-seatbar, .is-full .th-seatbar { opacity: 0; visibility: hidden; }
.is-playing .th-seatbar { bottom: calc(max(14px, env(safe-area-inset-bottom)) + var(--card-h, 84px) + 10px); }
.is-seated .th-hint, .is-seated .th-recenter { opacity: 0; visibility: hidden; }
.is-seated .th-eject kbd { display: none; } /* Esc stands you up first */
.th-room-h { margin-top: 10px !important; }
@media (pointer: coarse) { .th-seatbar kbd { display: none; } .th-seatbar .th-btn { min-height: 44px; padding: 0 16px; } }

/* The preview: an index card beside a film can or a poster. */
.th-preview { position: fixed; left: 0; top: 0; width: 264px; margin: 0; padding: 10px 10px 14px; border-radius: 4px; background: var(--paper); color: var(--ink); box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .85), 0 2px 0 rgba(0, 0, 0, .15); transform: rotate(-1.2deg) translateY(6px); opacity: 0; transition: opacity .18s ease, transform .25s cubic-bezier(.2, .8, .25, 1); pointer-events: none; z-index: 4; }
.th-preview[hidden] { display: block; visibility: hidden; }
.th-preview.is-on { opacity: 1; transform: rotate(-1.2deg); }
.th-preview::before { content: ""; position: absolute; top: -9px; left: 50%; width: 84px; height: 20px; transform: translateX(-50%) rotate(2deg); background: rgba(234, 220, 189, .85); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.th-preview img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; object-position: top; border-radius: 2px; background: #d8ccb4; }
.th-pv-body { padding: 8px 4px 0; }
.th-pv-title { margin: 0; font: 700 26px/1.05 var(--hand); color: var(--ink); }
.th-pv-meta { margin: 3px 0 0; font: 600 10.5px/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: #b5523b; }
.th-pv-blurb { margin: 6px 0 0; font-size: 13px; line-height: 1.4; color: rgba(45, 58, 90, .9); }
.th-pv-cta { appearance: none; display: block; margin: 10px 0 0; padding: 0; border: 0; background: none; font: 700 19px/1.1 var(--hand); color: #6b7a4b; cursor: default; text-align: left; }
.th-preview.has-video .th-pv-meta::after { content: " · demo reel"; }
.th-preview.is-pinned { pointer-events: auto; }
.th-preview.is-pinned .th-pv-cta { min-height: 44px; margin-top: 10px; padding: 0 16px; border-radius: 999px; background: var(--ink); color: var(--paper); font: 600 14.5px var(--sans); cursor: pointer; }
.th-skip { position: fixed; left: 50%; bottom: max(26px, env(safe-area-inset-bottom)); transform: translateX(-50%); margin: 0; font-size: 12.5px; color: var(--faint); z-index: 2; pointer-events: none; }
.th-skip[hidden] { display: none; }
.th-fallback { position: fixed; inset: 0; display: grid; place-content: center; padding: 24px; text-align: center; color: var(--soft); }
.th-fallback a { color: var(--fg); }

@media (max-width: 860px) { .th-blurb { display: none; } }
@media (max-width: 640px) {
  .th-name { display: none; }
  .th-card { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 12px 12px; }
  .th-card-text { padding: 0 4px; }
  .th-title { font-size: 26px; }
  .th-card-actions { flex-wrap: wrap; }
  .th-card-actions > * { flex: 1 1 0; justify-content: center; }
  .th-card-actions .th-enter { flex-basis: 100%; }
  .th-hint { font-size: 12.5px; }
  .th-btn { min-height: 38px; }
  .th-preview { width: min(320px, calc(100% - 32px)); }
}
@media (prefers-reduced-motion: reduce) { .th-veil, .th-card, .th-top, .th-tip, .th-hint, .th-preview, .th-exitfull, .th-recenter, .th-tally, .th-seatbar { transition: none; } .th-tally.is-bump { animation: none; } }
