/* Kino prototype styles
   VOICE   : a cinephile's own video library, warm and theatrical, never techy.
   IDEA    : a shelf of boxed editions you pull out one at a time.
   PICTURE : the 3D shelf itself; generated covers and spines.
   COLOUR  : four themes (Palais default), each in themes/<id>.css; a light that takes the colour of the title in focus; grain.
   TYPE    : set per theme (--font-display, --font-ui, --font-spine, --font-mono). */

/* ---------- Tokens and theme hooks ----------
   Neutral fallback so the app still renders if no theme file loads. The themes
   (themes/palais.css, console.css, cabine.css, programme.css) override these under
   [data-kino-theme='<id>']. Full contract: docs/design/themes-contract.md

   Hooks a theme may use without new DOM:
   - body::before       wall layer, fixed under .ambient and #app; background: var(--wall)
   - body::after        grain layer; background-image: var(--grain-image)
   - .ambient           light of the title in focus; --amb-blur, --amb-radius, --amb-clip; may be moved or textured
   - .shelf-floor       shadow pool under the shelf; ::before free, ::after draws var(--floor-line)
   - .tape .cv          case shadow: var(--case-shadow)
   - .cap-item::after   free, under the caption in focus (replays on every focus change)
   - --title-shadow     text-shadow on display titles
   - --font-mono        technical readouts (.mono, .tech dd, .ep-time, kbd) */

:root {
  --bg: #121212; --surface: #1c1c1c; --fg: #ece9e4; --muted: #a29d96; --line: #33302d;
  --accent: #d9a74a; --accent-fg: #141008; --accent-2: var(--accent);
  --floor: rgba(0, 0, 0, .55); --amb-opacity: .45;
  --grain-blend: soft-light; --grain-opacity: .4;
  --grain-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .46 0 0 0 0 .42 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --font-display: 'Iowan Old Style', Georgia, serif;
  --font-ui: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-spine: 'Arial Narrow', Impact, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --amb-blur: 120px; --amb-radius: 50%; --amb-clip: none;
  --wall: none;
  --floor-line: transparent;
  --case-shadow: 0 30px 60px -28px rgba(0, 0, 0, .9);
  --title-shadow: none;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --amb: var(--accent);
}

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--fg); color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--fg);
  transition: background-color .5s, color .5s;
  -webkit-font-smoothing: antialiased;
}

/* Wall layer: free for the theme (texture, ornament). Under .ambient and #app. */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: var(--wall);
}

/* Grain over the whole page */
body::after {
  content: ''; position: fixed; inset: 0; z-index: 40; pointer-events: none;
  background-image: var(--grain-image);
  mix-blend-mode: var(--grain-blend); opacity: var(--grain-opacity);
}

/* Ambient light: takes the colour of the title in focus */
.ambient {
  position: fixed; left: 50%; top: -30vh; z-index: 0; pointer-events: none;
  width: 120vw; height: 85vh; transform: translateX(-50%);
  border-radius: var(--amb-radius);
  clip-path: var(--amb-clip);
  background-color: var(--amb);
  filter: blur(var(--amb-blur));
  opacity: var(--amb-opacity);
  transition: background-color 1.1s var(--ease), opacity .6s;
}
[data-ambient='off'] .ambient { opacity: 0; }

#app { position: relative; z-index: 1; }

a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.display { font-family: var(--font-display); font-weight: 400; letter-spacing: -.02em; font-optical-sizing: auto; }
.display, .cap-title, .brand-mark, .hero-word, .section-head h2, .row-head h2 { text-shadow: var(--title-shadow); }
.mono, .tech dd, .ep-time { font-family: var(--font-mono); }

.eyebrow {
  margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent);
}
.muted { color: var(--muted); }
.small { font-size: 13px; color: var(--muted); margin: 0; }

/* ---------- Top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 12px 40px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.brand-mark { font-family: var(--font-display); font-size: 30px; line-height: 1; }
.brand-sub { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

.mainnav { display: flex; gap: 4px; }
.mainnav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  text-decoration: none; color: var(--muted);
}
.mainnav a:hover { color: var(--fg); }
.mainnav a[aria-current='page'] { color: var(--fg); box-shadow: inset 0 -2px 0 var(--accent); }
/* Six entries: below 1180px the menu gets its own row under the logo (scrolls sideways if needed). */
.mainnav a { white-space: nowrap; }
@media (max-width: 1180px) {
  .topbar { flex-wrap: wrap; row-gap: 4px; }
  .mainnav { order: 3; width: 100%; overflow-x: auto; }
}

.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 44px; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: transparent; cursor: pointer;
  font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; text-decoration: none;
}
.icon-btn:hover { border-color: var(--fg); }
.icon-btn[aria-current='page'] { border-color: var(--accent); color: var(--accent); }
.icon-btn:disabled { opacity: .35; cursor: default; border-color: var(--line); }
.icon-btn svg { width: 18px; height: 18px; flex: none; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  font-family: var(--font-display); font-size: 20px; color: #fff;
}

/* ---------- Generated covers and spines ---------- */

.thumb, .face, .spine-wrap { container-type: inline-size; }

.cover {
  position: relative; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center;
  padding: 7cqw 7cqw 6cqw; border-radius: 4px; overflow: hidden;
  background: var(--c); color: var(--t);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07), inset 0 0 18cqw rgba(0, 0, 0, .35);
}
.cover::after, .spine::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(0, 0, 0, .14) 1px, transparent 1.2px);
  background-size: 3px 3px; mix-blend-mode: multiply; opacity: .55;
}
.cover-kicker { font-size: 4.2cqw; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; opacity: .85; text-align: center; }
.cover-title {
  margin-top: 3cqw; font-family: var(--font-spine); font-weight: 600; text-transform: uppercase;
  font-size: 13cqw; line-height: .98; text-align: center; text-wrap: balance;
}
.cover-art { flex: 1; width: 100%; min-height: 0; margin-top: 4cqw; }
.cover-badge {
  position: absolute; right: 6cqw; bottom: 5cqw; padding: .6cqw 2cqw; border: .7cqw solid currentColor;
  font-family: var(--font-spine); font-size: 5cqw; font-weight: 600; letter-spacing: .04em; background: var(--c);
}

/* Real poster from the server */
.cover--poster { padding: 0; }
.cover--poster::after { display: none; }
.cover--poster img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; }
img.spine-art { object-fit: cover; object-position: center 30%; border-radius: 2px; }

.spine {
  position: relative; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 6cqw;
  padding: 14cqw 0 18cqw; border-radius: 3px; overflow: hidden;
  background: var(--c); color: var(--t);
  box-shadow: inset 2px 0 0 rgba(255, 255, 255, .08), inset -3px 0 6px rgba(0, 0, 0, .35);
}
.spine-art { width: 78%; aspect-ratio: 1; flex: none; border-radius: 2px; background: rgba(0, 0, 0, .12); }
.spine-title {
  flex: 1; min-height: 0; writing-mode: vertical-rl;
  font-family: var(--font-spine); font-weight: 600; text-transform: uppercase; letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center;
}
.spine-dir {
  max-width: 100%; overflow: hidden; white-space: nowrap;
  font-size: 15cqw; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; opacity: .85;
}
.spine-badge { padding: 0 5cqw; border: 2cqw solid currentColor; font-family: var(--font-spine); font-size: 19cqw; font-weight: 600; }

/* ---------- Shelf ---------- */

.shelf { position: relative; }
.shelf-viewport {
  position: relative; overflow: hidden; touch-action: pan-y;
  perspective-origin: 50% 50%; user-select: none; -webkit-user-select: none;
}
.shelf-viewport:focus { outline: none; }
.shelf-viewport:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }

.shelf-stage { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; }

.tape { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-style: preserve-3d; will-change: transform; cursor: pointer; }
.tape .face { position: absolute; top: calc(var(--H) / -2); height: var(--H); backface-visibility: hidden; border-radius: 3px; }
.tape .sp { width: var(--ws); left: calc(var(--ws) / -2); transform: translateZ(calc(var(--d) / 2)); }
.tape .cv { width: var(--d); left: calc(var(--d) / -2); transform: rotateY(90deg) translateZ(calc(var(--ws) / 2)); box-shadow: var(--case-shadow); }
.tape .face::after { content: ''; position: absolute; inset: 0; background: #000; opacity: var(--shade, 0); border-radius: inherit; pointer-events: none; }
.tape.is-missing .face > * { filter: grayscale(1) contrast(.8); opacity: .5; }

.shelf-floor {
  position: absolute; left: 50%; transform: translate(-50%, -50%); pointer-events: none;
  background: radial-gradient(50% 50% at 50% 40%, var(--floor), transparent 72%);
}
.shelf-floor::after {
  content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px;
  background: var(--floor-line);
}

.shelf-caption {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) 56px; align-items: center; gap: 8px;
  width: min(92vw, 760px); margin: 0 auto;
}
.cap-mask { display: grid; overflow: hidden; }
.cap-item { grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; padding: 2px 0 6px; }
.cap-title {
  border: 0; background: none; cursor: pointer; padding: 0 8px;
  font-family: var(--font-display); font-size: clamp(28px, 3vw, 40px); line-height: 1.12; letter-spacing: -.01em;
}
.shelf--straight .cap-title { font-size: clamp(22px, 2vw, 28px); }
.cap-title:hover { color: var(--accent); }
.cap-orig { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.cap-meta { font-size: 13px; color: var(--muted); }

.shelf-arrow {
  width: 48px; height: 48px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: transparent; cursor: pointer; color: var(--fg);
}
.shelf-arrow:hover { border-color: var(--fg); }
.shelf-arrow svg { width: 22px; height: 12px; }

.shelf-empty { padding: 60px 0; text-align: center; color: var(--muted); }
kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; font: inherit; font-family: var(--font-mono); font-size: 11px; }

/* ---------- Layout ---------- */

main { display: block; }
.page { max-width: 1280px; margin: 0 auto; padding: 32px 40px 0; }
.page-pad { max-width: 1280px; margin: 0 auto; padding-left: 40px; padding-right: 40px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: clamp(44px, 6vw, 72px); line-height: 1; }

.section { margin-top: 56px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.section-head h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 28px; }

.row { margin-top: 48px; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.row-head h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(26px, 2.4vw, 34px); }
.row-head a, .hero-head a { min-height: 44px; display: inline-flex; align-items: center; }

.footer { position: relative; z-index: 1; max-width: 1280px; margin: 96px auto 0; padding: 24px 40px 48px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* ---------- Home ---------- */

.hero { position: relative; padding-top: 8px; }
.hero-word {
  position: absolute; left: 0; right: 0; top: 0; text-align: center; pointer-events: none; user-select: none;
  font-family: var(--font-display); font-weight: 300; letter-spacing: -.04em;
  font-size: clamp(140px, 24vw, 400px); line-height: .9; color: var(--fg); opacity: .92;
}
.hero-head { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.hero .shelf { position: relative; z-index: 1; margin-top: clamp(40px, 6vw, 110px); }

.resume-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 12px; }
.resume-card {
  display: grid; grid-template-columns: 72px 1fr; gap: 16px; align-items: center;
  padding: 12px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.resume-card:hover { border-color: var(--fg); }
.resume-card .thumb { width: 72px; aspect-ratio: 2 / 3; }
.resume-card h3 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 20px; line-height: 1.2; }
.progress { height: 4px; margin: 10px 0 6px; border-radius: 2px; background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); }

.empty-home { padding-top: 120px; text-align: center; }

/* ---------- Directors ---------- */

.dir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.dir-card {
  display: flex; flex-direction: column; gap: 6px; padding: 20px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.dir-card:hover { border-color: var(--fg); }
.dir-card h3 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1.1; }
.spine-strip { display: flex; gap: 4px; height: 130px; margin-top: 12px; }
.mini-spine { width: 23px; height: 130px; overflow: hidden; flex: none; }
.mini-spine > .spine-wrap { width: 46px; height: 260px; transform: scale(.5); transform-origin: top left; }
.mini-spine.is-missing { opacity: .35; filter: grayscale(1); }

.director-head { max-width: 760px; }
.director-head h1 { margin: 6px 0 8px; font-size: clamp(52px, 7vw, 96px); line-height: .95; }
.director-head .bio { font-family: var(--font-display); font-size: 20px; line-height: 1.5; margin: 16px 0 0; }

.timeline { position: relative; height: 70px; margin: 12px 24px 0; }
.timeline-axis { position: absolute; left: 0; right: 0; top: 22px; border-top: 1px solid var(--accent); }
.tick { position: absolute; top: 18px; width: 1px; height: 9px; background: var(--accent); }
.tick-label { position: absolute; top: 34px; transform: translateX(-50%); font-size: 11px; color: var(--muted); }
.tl-dot {
  position: absolute; top: 14px; width: 17px; height: 17px; margin-left: -8.5px; padding: 0;
  border-radius: 50%; border: 2px solid var(--accent); background: var(--accent); cursor: pointer; transition: transform .3s var(--ease);
}
.tl-dot::before { content: ''; position: absolute; inset: -14px; }
.tl-dot.is-missing { background: var(--bg); }
.tl-dot.is-active { transform: scale(1.5); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.legend { display: flex; gap: 20px; justify-content: center; margin-top: 4px; font-size: 12px; color: var(--muted); }
.legend span::before {
  content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%;
  border: 2px solid var(--accent); background: var(--accent); vertical-align: -1px;
}
.legend .l-missing::before { background: transparent; }

/* ---------- Library ---------- */

.toolbar { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; margin-bottom: 8px; }
.chips { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.chip {
  min-height: 44px; padding: 0 16px; border: 0; background: transparent; cursor: pointer;
  font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.chip + .chip { border-left: 1px solid var(--line); }
.chip:hover { color: var(--fg); }
.chip[aria-pressed='true'] { background: var(--accent); color: var(--accent-fg); }

.cover-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 32px 24px; }
.cover-grid.small { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.grid-item { text-decoration: none; display: flex; flex-direction: column; gap: 10px; }
.grid-item .thumb { aspect-ratio: 2 / 3; transition: transform .3s var(--ease); }
.grid-item:hover .thumb { transform: translateY(-6px); }
.grid-item h3 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 18px; line-height: 1.25; }
.grid-item.is-missing .thumb { filter: grayscale(1); opacity: .45; }

/* ---------- Title page ---------- */

.back {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 10px;
  border: 1px solid var(--line); border-radius: 999px; background: transparent; cursor: pointer;
  font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
}
.back svg { width: 16px; height: 16px; }
.film { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 64px; align-items: center; margin-top: 24px; }
.film-title { margin: 10px 0 14px; font-size: clamp(48px, 6.5vw, 92px); line-height: .98; }
.meta { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.synopsis { margin: 20px 0 0; max-width: 34em; font-family: var(--font-display); font-size: 21px; line-height: 1.5; }
.byline { margin: 18px 0 0; font-family: var(--font-display); font-style: italic; color: var(--muted); }
.byline a { color: var(--fg); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px;
  border: 1px solid var(--accent); border-radius: 2px; background: transparent; color: var(--accent); cursor: pointer;
  font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; text-decoration: none;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { cursor: default; filter: none; opacity: .8; }
.tech { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px 24px; margin: 36px 0 0; padding-top: 20px; border-top: 1px solid var(--line); }
.tech dt { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.tech dd { margin: 2px 0 0; font-size: 14px; }
.film-cover { display: flex; justify-content: center; perspective: 1400px; }
.film-cover .thumb { width: min(400px, 100%); aspect-ratio: 2 / 3; transform: rotateY(-10deg) rotateZ(-2deg); transition: transform .6s var(--ease); }
.film-cover .thumb:hover { transform: rotateY(0deg); }
.film-cover .cover { box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .7); }
.missing-note { margin: 18px 0 0; padding: 12px 16px; border: 1px dashed var(--line); border-radius: 6px; font-size: 14px; color: var(--muted); }

.episodes { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 6px; }
.episode {
  width: 100%; min-height: 52px; display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 12px;
  padding: 0 16px; border: 1px solid var(--line); border-radius: 8px; background: color-mix(in srgb, var(--surface) 60%, transparent);
  cursor: pointer; text-align: left;
}
.episode:hover { border-color: var(--fg); }
.episode.is-current { border-color: var(--accent); }
.ep-num { font-family: var(--font-display); font-size: 22px; color: var(--accent); }
.ep-time { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* ---------- Settings ---------- */

.sec-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; max-width: 760px; }
.sec-item {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 12px 10px 16px; border: 1px solid var(--line); border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.sec-label, .switch { display: flex; align-items: center; gap: 14px; cursor: pointer; min-height: 44px; }
.sec-label > span, .switch > span { display: flex; flex-direction: column; }
.sec-label input, .switch input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.sec-move { display: flex; gap: 6px; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.theme-card {
  display: flex; flex-direction: column; gap: 6px; padding: 12px; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.theme-card[aria-checked='true'] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
/* Each preview carries its own data-kino-theme, so it shows that theme's tokens whatever the active one. */
.theme-preview {
  display: flex; align-items: flex-end; justify-content: space-between; height: 96px; padding: 12px; border-radius: 8px; margin-bottom: 4px;
  background: var(--wall), var(--bg); color: var(--fg); font-family: var(--font-ui);
  box-shadow: inset 0 0 0 1px var(--line);
}
.tp-word { font-family: var(--font-display); font-size: 34px; line-height: 1; text-shadow: var(--title-shadow); }
.tp-pill { padding: 4px 10px; border-radius: 2px; background: var(--accent); color: var(--accent-fg); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.theme-name { font-weight: 600; }

/* ---------- Profiles ---------- */

.profiles { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 40px; padding: 40px; text-align: center; }
.profiles h1 { margin: 0; font-size: clamp(48px, 7vw, 88px); line-height: 1; }
.profile-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 36px; }
.profile-btn { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px; border: 0; background: none; cursor: pointer; border-radius: 12px; }
.profile-face {
  position: relative; width: 124px; height: 124px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 56px; color: #fff; transition: transform .3s var(--ease), box-shadow .3s;
}
.profile-btn:hover .profile-face, .profile-btn:focus-visible .profile-face { transform: scale(1.06); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--fg); }
.profile-name { font-size: 14px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.profile-tag { position: absolute; right: -4px; bottom: 4px; padding: 2px 8px; border-radius: 999px; background: var(--fg); color: var(--bg); font-family: var(--font-ui); font-size: 11px; font-weight: 700; }

/* ---------- Server sign-in ---------- */

.demo-note { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 0; color: var(--muted); }
.connect-form { display: flex; flex-direction: column; gap: 16px; width: min(420px, 100%); text-align: left; }
.connect-form .btn { justify-content: center; }
.connect-form > a { align-self: center; min-height: 44px; display: inline-flex; align-items: center; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; letter-spacing: .04em; }
.field input {
  min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--fg); font: inherit; font-weight: 400; font-size: 16px;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.form-error { margin: 0; min-height: 1.5em; color: var(--accent); font-size: 14px; }

/* ---------- Overlays ---------- */

.overlay { position: fixed; inset: 0; z-index: 50; overflow: auto; }
.search { background: color-mix(in srgb, var(--bg) 96%, transparent); padding: 72px 8vw 48px; backdrop-filter: blur(10px); }
.search-top { display: flex; gap: 16px; align-items: center; }
.search input {
  flex: 1; min-width: 0; padding: 8px 0; border: 0; border-bottom: 1px solid var(--fg); background: transparent; color: var(--fg);
  font-family: var(--font-display); font-size: clamp(28px, 4vw, 48px);
}
.search input:focus { outline: none; border-bottom-color: var(--accent); }
.search-results { margin-top: 36px; }
.search-dirs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.pill { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; }
.pill:hover { border-color: var(--fg); }

.demo-player { background: #000; color: #f2ede4; display: flex; flex-direction: column; }
.demo-player-screen { flex: 1; display: flex; align-items: center; justify-content: center; }
.demo-player-screen svg { width: min(55vh, 60vw); height: auto; }
.demo-player-bar { padding: 24px 40px 32px; background: linear-gradient(transparent, rgba(0, 0, 0, .9)); }
.demo-player-bar h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 32px; }
.demo-player .small { color: inherit; }
.demo-player .progress { height: 5px; margin: 16px 0 8px; background: rgba(255, 255, 255, .25); }
.demo-player .progress span { background: #f2ede4; }
.demo-player-times { display: flex; justify-content: space-between; font-size: 13px; opacity: .8; }
.demo-player-controls { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.demo-player-controls .icon-btn { border-color: rgba(255, 255, 255, .35); }
.demo-player-note { margin: 16px 0 0; font-size: 12px; opacity: .7; }

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .topbar { padding: 8px 16px; flex-wrap: wrap; gap: 8px; }
  .mainnav { order: 3; width: 100%; overflow-x: auto; }
  .brand-sub { display: none; }
  .page { padding: 20px 16px 0; }
  .page-pad { padding-left: 16px; padding-right: 16px; }
  .film { grid-template-columns: 1fr; gap: 32px; }
  .film-cover { order: -1; }
  .film-cover .thumb { width: min(260px, 70%); transform: none; }
  .timeline { margin: 8px 8px 0; }
  .shelf-caption { grid-template-columns: 44px minmax(0, 1fr) 44px; }
  .shelf-arrow { width: 44px; height: 44px; }
  .footer { padding: 24px 16px 40px; }
  .sec-item { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
