:root {
  --bg: #efeae1;
  --panel: #fff;
  --ink: #191612;
  --muted: #6e665c;
  --muted-soft: #9a9086;
  --line: #dbd2c4;
  --accent: #1f5a4c;
  --accent-ink: #f7f4ef;
  --danger: #93331f;
  --sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --display: Figtree, var(--sans);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; background: var(--bg); }
html { -webkit-text-size-adjust: 100%; }
body {
  color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; min-height: 100vh; min-height: 100dvh;
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
body.viewing { position: fixed; left: 0; right: 0; overflow: hidden; }
button { font-family: inherit; }
::selection { background: #e3d9c6; }

.album {
  padding: clamp(14px, 2vw, 22px) max(16px, env(safe-area-inset-right))
           calc(96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.album-head { text-align: center; max-width: 1080px; margin: 0 auto 44px; }
.title { font-family: var(--display); font-size: 46px; line-height: 1.1; letter-spacing: -.02em; margin: 0; font-weight: 400; }
.subtitle { color: var(--muted); margin-top: 12px; }

.film { position: relative; height: clamp(232px, 33vw, 340px); overflow: hidden; background: #17130f; }
.film-strip {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 5px;
  filter: blur(2.5px) saturate(.85); transform: scale(1.06);
}
.film-row { flex: 1; display: flex; gap: 5px; min-height: 0; }
.film-row:nth-child(1) { margin-left: -3%; }
.film-row:nth-child(2) { margin-left: -11%; }
.film-row:nth-child(3) { margin-left: -6%; }
.film-row-extra { display: none; margin-left: -9%; }
.film-row img { width: max(96px, 13%); height: 100%; object-fit: cover; flex: none; display: block; }
.film-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(23, 19, 15, .62), rgba(23, 19, 15, .46) 42%, rgba(23, 19, 15, .78));
}
.film-body {
  position: relative; height: 100%; display: flex; flex-direction: column; justify-content: space-between;
  color: var(--accent-ink);
  padding: 18px max(clamp(18px, 5vw, 40px), env(safe-area-inset-right)) clamp(20px, 4vw, 34px)
           max(clamp(18px, 5vw, 40px), env(safe-area-inset-left));
}
.film-top { display: flex; align-items: flex-start; gap: 12px; }
.film-title {
  font-family: var(--display); font-weight: 400; margin: 0;
  font-size: clamp(36px, 7.4vw, 68px); line-height: 1.03; letter-spacing: -.025em;
  text-wrap: pretty; text-shadow: 0 2px 24px rgba(15, 12, 9, .45);
}
.film-meta { margin-top: 9px; font-size: clamp(13px, 1.6vw, 15px); color: rgba(247, 244, 239, .86); }
.film-top .album-actions {
  margin: 0 0 0 auto; flex-direction: column; align-items: flex-end; gap: 8px; max-width: 62%;
}
.film-top .album-note { color: rgba(247, 244, 239, .86); text-align: right; }
.film-top .btn-dark, .film-top .btn-quiet {
  padding: 7px 15px; min-height: 34px; font-size: 13px; gap: 8px;
  color: var(--accent-ink); border: 1px solid rgba(247, 244, 239, .3);
  background: rgba(23, 19, 15, .35); backdrop-filter: blur(6px);
}
.film-top .btn-dark svg, .film-top .btn-quiet svg { width: 15px; height: 15px; }
.film-top .btn-quiet[data-status="ready"] {
  background: var(--accent-ink); color: var(--ink); border-color: transparent;
  animation: rise 240ms ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@media (hover: hover) {
  .film-top .btn-dark:hover, .film-top .btn-quiet:hover {
    background: rgba(247, 244, 239, .18);
  }
  .film-top .btn-quiet[data-status="ready"]:hover { background: #fff; }
}
@media (prefers-reduced-motion: reduce) { .film-top .btn-quiet[data-status="ready"] { animation: none; } }

.btn-dark, .btn-quiet, .btn-light {
  border: 0; padding: 13px 24px; border-radius: 999px; cursor: pointer; font-weight: 500;
  font-size: 15px; font-family: inherit; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 46px; touch-action: manipulation;
}
.btn-dark svg, .btn-quiet svg, .btn-light svg, .viewer-btn svg {
  width: 17px; height: 17px; flex-shrink: 0;
}
.btn-dark { background: var(--ink); color: var(--accent-ink); }
.btn-quiet { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.btn-light { background: var(--accent-ink); color: var(--ink); padding: 11px 20px; min-height: 42px; }
.btn-dark[disabled], .btn-quiet[disabled], .btn-light[disabled] { opacity: .55; cursor: default; }

.album-actions {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center;
  margin-top: 26px;
}
.album-actions > .album-note { flex-basis: 100%; }
.album-note { color: var(--muted); font-size: 13px; text-align: center; min-height: 1.2em; }

.grid { columns: 4; column-gap: 4px; }
.grid.by-column { display: flex; gap: 4px; align-items: flex-start; }
.grid-column { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tile {
  position: relative; overflow: hidden; background: #e3dcd1;
  aspect-ratio: var(--ratio, 1); break-inside: avoid; margin-bottom: 4px;
}
.grid.by-column .tile { flex: none; margin-bottom: 0; }
.tile-open { display: block; position: relative; width: 100%; height: 100%; }
.grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.tile-pick {
  position: absolute; top: 6px; left: 6px; z-index: 2; width: 28px; height: 28px;
  border-radius: 8px; border: 1.5px solid rgba(255, 255, 255, .85); background: rgba(15, 12, 9, .38);
  color: #fff; font-size: 15px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; touch-action: manipulation;
}
.tile-pick::before { content: ''; position: absolute; inset: -8px; }
.tile-get {
  position: absolute; top: 6px; right: 6px; z-index: 2; width: 28px; height: 28px;
  border-radius: 8px; border: 1.5px solid rgba(255, 255, 255, .85);
  background: rgba(15, 12, 9, .5); color: #fff;
  align-items: center; justify-content: center; display: none;
}
.tile-get svg { width: 16px; height: 16px; }
@media (hover: hover) {
  .tile-get { display: flex; opacity: 0; transition: opacity 120ms ease; }
  .tile:hover .tile-get, .tile-get:focus-visible { opacity: 1; }
  .tile-get:hover { background: rgba(15, 12, 9, .75); }
}
@media (hover: hover) {
  .tile-pick { opacity: 0; transition: opacity 120ms ease; }
  .tile:hover .tile-pick,
  .tile-input:focus-visible ~ .tile-pick,
  .tile-input:checked ~ .tile-pick { opacity: 1; }
  .tile-pick:hover { background: rgba(15, 12, 9, .6); }
}
.tile-input:checked ~ .tile-pick { background: var(--accent); border-color: var(--accent); }
.tile-input:checked ~ .tile-pick::after { content: '\2713'; }
.tile-input:focus-visible ~ .tile-pick { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile-input:checked ~ .tile-open::after {
  content: ''; position: absolute; inset: 0;
  box-shadow: inset 0 0 0 3px var(--accent);
}

.people-filter { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.people-filter .chip {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); padding: 4px 14px 4px 5px; border-radius: 999px;
  font-size: 13px; text-decoration: none; min-height: 30px;
}
@media (hover: hover) { .people-filter .chip:hover { border-color: var(--muted-soft); } }
.people-filter .chip.on { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 500; }
.people-filter .chip img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.people-filter .chip-clear {
  color: var(--muted-soft); font-size: 12.5px; text-decoration: underline; padding: 7px 4px; align-self: center;
}
.people-filter .chip-more {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  border: 1px dashed var(--muted-soft); background: var(--panel); color: var(--muted);
  border-radius: 999px; padding: 0 12px; min-height: 30px; font-size: 13px; cursor: pointer;
}
@media (hover: hover) {
  .people-filter .chip-more:hover { color: var(--ink); border-color: var(--ink); }
}
.people-filter .chip-main {
  display: inline-flex; align-items: center; gap: 7px; color: inherit; font: inherit;
  text-decoration: none;
}
.people-filter .chip-plus {
  list-style: none; border: 0; background: rgba(255, 255, 255, .25); color: inherit;
  width: 18px; height: 18px; border-radius: 50%; font-size: 12px; line-height: 18px;
  cursor: pointer; margin-left: 5px; text-align: center; flex-shrink: 0;
}
.people-filter .chip-plus::-webkit-details-marker { display: none; }
.people-filter .chip-plus:hover { background: rgba(255, 255, 255, .45); }
.chip-add[open] > .chip-plus { background: var(--accent-ink); color: var(--accent); }
.chip-plus-standalone {
  list-style: none; border: 1px dashed var(--muted-soft); background: var(--panel); color: var(--muted);
  width: 24px; height: 24px; border-radius: 50%; font-size: 13px; line-height: 22px; cursor: pointer;
  text-align: center; flex-shrink: 0;
}
.chip-plus-standalone::-webkit-details-marker { display: none; }
.chip-plus-standalone:hover { color: var(--ink); border-color: var(--ink); }
.chip-add[open] > .chip-plus-standalone {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}
.chip-group { display: inline-flex; align-items: center; gap: 6px; }
.chip-group.multi {
  padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, .55);
  border: 1px dashed var(--muted-soft);
}
.chip-add { position: relative; display: inline-flex; }
.chip-plus-popover {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 12;
  min-width: 190px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(25, 22, 18, .16); padding: 6px; display: flex; flex-direction: column; gap: 1px;
}
.chip-plus-popover-title {
  font-size: 11px; color: var(--muted); padding: 4px 8px 2px; text-transform: uppercase; letter-spacing: .02em;
}
.chip-plus-option {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px;
  text-align: left; color: var(--ink); font-size: 13px; text-decoration: none;
}
.chip-plus-option:hover { background: #f3eee5; }
.chip-plus-option img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.filter-note { color: var(--muted); font-size: 13px; margin-top: 14px; }

.selection-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--ink);
  color: var(--accent-ink); display: flex; align-items: center; justify-content: center;
  gap: 10px 22px; flex-wrap: wrap;
  padding: 14px max(20px, env(safe-area-inset-right))
           calc(14px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}
.selection-info, .selection-acts { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; }
.selection-info { font-size: 14px; }
.selection-bar .cancel, .selection-bar .text-btn {
  border: 0; background: transparent; color: rgba(247, 244, 239, .72); cursor: pointer;
  font-family: inherit; font-size: 14px; padding: 10px 2px; text-decoration: underline;
  text-underline-offset: 3px; touch-action: manipulation;
}
@media (hover: hover) {
  .selection-bar .cancel:hover, .selection-bar .text-btn:hover { color: var(--accent-ink); }
}

.page-toast {
  position: fixed; left: 50%; z-index: 11; transform: translateX(-50%);
  bottom: calc(var(--selection-bar-h, 0px) + 18px + env(safe-area-inset-bottom));
  max-width: min(90%, 420px); text-align: center;
  background: rgba(20, 17, 14, .92); color: #f4f0e9; font-size: 13px;
  padding: 10px 16px; border-radius: 999px; overflow-wrap: anywhere;
}
body:not(.selecting) .page-toast { bottom: calc(18px + env(safe-area-inset-bottom)); }

.saved-chip {
  position: fixed; left: 50%; z-index: 60;
  bottom: calc(30px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 7px;
  padding: 9px 16px 9px 12px; border-radius: 999px;
  background: rgba(20, 17, 14, .94); color: #f4f0e9;
  font-size: 13.5px; font-weight: 500; white-space: nowrap;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .34);
  pointer-events: none;
  opacity: 0; transform: translate(-50%, 10px);
  transition: opacity 180ms ease, transform 180ms ease;
}
.saved-chip.on { opacity: 1; transform: translate(-50%, 0); }
.saved-chip svg { width: 17px; height: 17px; flex-shrink: 0; color: #7ed3a4; }
@media (prefers-reduced-motion: reduce) {
  .saved-chip { transition: none; }
}

body.selecting .album {
  padding-bottom: calc(var(--selection-bar-h, 120px) + 40px + env(safe-area-inset-bottom));
}
.footer { text-align: center; margin-top: 56px; color: var(--muted-soft); font-size: 12.5px; }
.footer a { color: var(--muted-soft); }

.viewer {
  --drawer-w: 360px;
  position: fixed; inset: 0; z-index: 40; background: #0e0c0a; touch-action: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  grid-template-areas: "top" "stage" "drawer" "strip";
}
.viewer-top { grid-area: top; }
.viewer-stage { grid-area: stage; }
.viewer-panel { grid-area: drawer; }
.viewer-strip { grid-area: strip; }
.viewer-top {
  position: relative; z-index: 4;
  display: grid; grid-template-columns: auto 1fr auto auto;
  align-items: center; column-gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px
           max(12px, env(safe-area-inset-left));
  color: #f4f0e9;
}
.viewer-count { justify-self: center; }
.viewer-files, .viewer-slot { display: inline-flex; align-items: center; gap: 8px; justify-self: end; }
.viewer-count { font-size: 13px; color: rgba(244, 240, 233, .7); font-variant-numeric: tabular-nums; }
.viewer-btn {
  border: 1px solid rgba(244, 240, 233, .22); background: rgba(244, 240, 233, .08); color: #f4f0e9;
  min-width: 46px; height: 46px; border-radius: 999px; font-size: 16px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 14px;
  touch-action: manipulation;
}
.viewer-btn.wide { font-size: 15px; font-weight: 500; background: var(--accent-ink); color: var(--ink); border-color: transparent; }
.viewer-btn[disabled] { opacity: .5; }
.viewer-stage {
  min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: 4px 8px calc(14px + env(safe-area-inset-bottom)); position: relative;
  overflow: hidden; touch-action: none;
}
.viewer.has-strip .viewer-stage { padding-bottom: 6px; }
.viewer-stage > img {
  position: relative; max-width: 100%; max-height: 100%; object-fit: contain; display: block;
  opacity: 0; transition: opacity 140ms ease; -webkit-user-select: none; user-select: none;
  transform-origin: center center;
}
.viewer-stage > img.ready { opacity: 1; }
.viewer-stage > img.glide { transition: opacity 140ms ease, transform 200ms ease; }
.viewer-peek {
  position: absolute; inset: 0; padding: inherit; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center; pointer-events: none;
}
.viewer-peek[hidden] { display: none; }
.viewer-peek img {
  max-width: 100%; max-height: 100%; object-fit: contain; display: block;
  -webkit-user-select: none; user-select: none;
}
.viewer-stage > img.sliding, .viewer-peek.sliding {
  transition: transform 220ms cubic-bezier(.25, .6, .3, 1);
}
.viewer-stage.zoomed > img { will-change: transform; cursor: grab; }
.viewer-stage.zoomed .viewer-nav { opacity: 0; pointer-events: none; }
.viewer-zoom {
  position: absolute; left: max(12px, env(safe-area-inset-left)); bottom: 12px;
  background: rgba(20, 17, 14, .8); color: #f4f0e9; font-size: 12px;
  padding: 5px 11px; border-radius: 999px; font-variant-numeric: tabular-nums;
  pointer-events: none; opacity: 0; transition: opacity 180ms ease;
}
.viewer-zoom.on { opacity: 1; }
.viewer-spinner {
  position: absolute; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid rgba(244, 240, 233, .25); border-top-color: rgba(244, 240, 233, .9);
  animation: viewer-spin 700ms linear infinite;
}
@keyframes viewer-spin { to { transform: rotate(360deg); } }
.viewer-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(20, 17, 14, .55); color: #f4f0e9; font-size: 30px; line-height: 1;
  display: flex; align-items: center; justify-content: center; touch-action: manipulation;
}
.viewer-nav.prev { left: 10px; }
.viewer-nav.next { right: 10px; }
.viewer-nav[disabled] { opacity: 0; pointer-events: none; }
@media (hover: hover) { .viewer-nav:hover { background: rgba(20, 17, 14, .8); } }
.viewer-toast {
  position: absolute; left: 50%; bottom: 12px;
  transform: translateX(-50%); max-width: min(90%, 420px); text-align: center;
  background: rgba(20, 17, 14, .92); color: #f4f0e9; font-size: 13px;
  padding: 10px 16px; border-radius: 999px; overflow-wrap: anywhere;
}

.viewer-strip {
  flex-shrink: 0; display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden;
  touch-action: pan-x; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth; background: rgba(0, 0, 0, .32);
  border-top: 1px solid rgba(244, 240, 233, .1);
  padding: 9px max(12px, env(safe-area-inset-right)) calc(9px + env(safe-area-inset-bottom))
           max(12px, env(safe-area-inset-left));
}
.viewer-strip::-webkit-scrollbar { display: none; }
.strip-item {
  flex: 0 0 auto; width: 58px; height: 58px; padding: 0; border: 0;
  overflow: hidden; background: rgba(244, 240, 233, .08); cursor: pointer;
  opacity: .48; transition: opacity 120ms ease; touch-action: manipulation;
}
.strip-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.strip-item.on { opacity: 1; box-shadow: 0 0 0 2px var(--accent-ink); }
.strip-item:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
@media (hover: hover) { .strip-item:hover { opacity: .8; } }

.gate { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.gate-card { width: 100%; max-width: 380px; text-align: center; }
.gate-card .title { font-size: 27px; letter-spacing: -.01em; }
.gate-card input {
  width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: 9px;
  padding: 12px 14px; text-align: center; outline: none; font-family: inherit; font-size: 14px;
  margin-top: 24px;
}
.gate-card input:focus { border-color: var(--accent); }
.gate-card button.unlock {
  width: 100%; margin-top: 12px; border: 0; background: var(--accent); color: var(--accent-ink);
  padding: 12px; border-radius: 9px; cursor: pointer; font-weight: 500; font-family: inherit; font-size: 14px;
}
.error { color: var(--danger); font-size: 13px; margin-top: 9px; }

.pager {
  position: sticky; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 8; display: flex; justify-content: center;
  margin-top: 34px; pointer-events: none; transition: transform 160ms ease;
}
.pager.lifted { transform: translateY(calc(-1 * (var(--selection-bar-h, 96px) + 12px))); }
.pager-bar {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255, 255, 255, .88); -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 8px; box-shadow: 0 10px 30px rgba(25, 22, 18, .14);
}
.pager-arrow {
  width: 30px; height: 30px; border-radius: 50%; color: var(--ink); font-size: 18px;
  line-height: 28px; text-align: center; text-decoration: none; flex-shrink: 0;
}
@media (hover: hover) { .pager-arrow:hover { background: #f0ebe1; } }
.pager-arrow.off { color: var(--line); }
.pager-pages { display: inline-flex; align-items: center; gap: 2px; }
.pager-page {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px; color: var(--muted);
  font-size: 13px; line-height: 30px; text-align: center; text-decoration: none;
}
@media (hover: hover) { .pager-page:hover { color: var(--ink); background: #f0ebe1; } }
.pager-page.on { background: var(--accent); color: var(--accent-ink); font-weight: 500; }
.pager-gap { color: var(--muted-soft); font-size: 13px; padding: 0 3px; }
.pager-count {
  color: var(--muted); font-size: 12.5px; white-space: nowrap; margin-left: 5px;
  padding: 0 8px 0 11px; border-left: 1px solid var(--line);
}

@media (max-width: 899px) {
  .grid { columns: 3; }
}

@media (max-width: 700px) {
  .album {
    padding: 16px max(10px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom))
             max(10px, env(safe-area-inset-left));
  }
  .title { font-size: 30px; }
  .album-head { margin: 0 auto 30px; }
  .grid { columns: 2; }
  .people-filter { gap: 6px; }
  .album-actions { flex-direction: column; align-items: stretch; }
  .album-actions .btn-dark, .album-actions .btn-quiet { width: 100%; text-align: center; }
  .film { height: 50vh; height: 50dvh; }
  .film-row-extra { display: flex; }
  .film-top .album-actions { flex-direction: column; align-items: flex-end; }
  .film-top .album-actions .btn-dark, .film-top .album-actions .btn-quiet { width: auto; }
  .pager-count { display: none; }
  .selection-bar { flex-direction: column; gap: 8px; }
  .selection-acts { width: 100%; }
  .selection-acts .btn-light { flex: 1; }
  .viewer-nav { display: none; }
}

@media (max-height: 480px) {
  .strip-item { width: 44px; height: 44px; }
  .viewer-strip { padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
}

/* ---------- videos ---------- */
.tile-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 42px; height: 42px; border-radius: 50%; pointer-events: none; z-index: 1;
  background: rgba(15, 12, 9, .52); color: #fff;
  display: flex; align-items: center; justify-content: center; padding-left: 3px;
}
.tile-play svg { width: 17px; height: 17px; }
.tile-duration {
  position: absolute; right: 6px; bottom: 6px; pointer-events: none; z-index: 1;
  background: rgba(15, 12, 9, .68); color: #fff; border-radius: 5px;
  padding: 2px 6px; font-size: 11.5px; font-variant-numeric: tabular-nums;
}
.tile-input:checked ~ .tile-open .tile-play { opacity: .4; }
.viewer-stage video {
  max-width: 100%; max-height: 100%; display: block; background: #000;
  -webkit-user-select: none; user-select: none;
}
.viewer-stage.playing { touch-action: auto; }
.viewer-stage.playing .viewer-nav { opacity: .55; }
.viewer-unplayable {
  max-width: min(90%, 420px); text-align: center; color: rgba(244, 240, 233, .82);
  font-size: 14px; line-height: 1.5;
}
.quality-switch {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  border-radius: 999px; background: rgba(23, 21, 18, .62);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.quality-switch[hidden] { display: none; }
.quality-option {
  border: 0; background: transparent; color: rgba(244, 240, 233, .72);
  font: inherit; font-size: 12px; line-height: 1; letter-spacing: .01em;
  padding: 7px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  font-variant-numeric: tabular-nums; touch-action: manipulation;
}
.quality-option:hover { color: #f4f0e9; }
.quality-option.on { background: rgba(244, 240, 233, .92); color: var(--ink); font-weight: 500; }
.strip-item { position: relative; }
.strip-play {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at center, rgba(15, 12, 9, .55) 0 13px, transparent 13px);
}
.strip-play::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  transform: translate(-45%, -50%); border-style: solid;
  border-width: 5px 0 5px 8px; border-color: transparent transparent transparent #fff;
}

/* ---------- reactions and comments ---------- */
.rx-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.rx {
  width: 17px; height: 17px; flex: none; display: block;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}

.mark {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.mark .rx { width: 13px; height: 13px; stroke-width: 1.9; }

.tile-marks {
  position: absolute; left: 6px; bottom: 6px; z-index: 2; border: 0; padding: 0;
  background: none; cursor: pointer; touch-action: manipulation;
  display: flex; gap: 4px; max-width: calc(100% - 12px); flex-wrap: wrap;
}
.tile-marks::before { content: ''; position: absolute; inset: -7px; }
.tile-marks .mark {
  background: rgba(15, 12, 9, .62); color: #fff; border-radius: 999px; padding: 4px 8px;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.tile-marks.empty { display: none; }
.tile-marks:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
@media (hover: hover) {
  .tile-marks.empty { display: flex; opacity: 0; transition: opacity 120ms ease; }
  .tile:hover .tile-marks.empty, .tile-marks.empty:focus-visible { opacity: 1; }
  .tile-marks:hover .mark { background: rgba(15, 12, 9, .82); }
}

.viewer-btn.talk { gap: 9px; padding: 0 14px; }
.viewer-btn.talk .mark { color: inherit; gap: 6px; font-size: 12.5px; }
.viewer-btn.talk .mark .rx { width: 17px; height: 17px; stroke-width: 1.7; }
.talk-count { font-size: 12.5px; line-height: 1; font-variant-numeric: tabular-nums; }
.viewer.talking .viewer-btn.talk {
  background: var(--accent-ink); color: var(--ink); border-color: transparent;
}

.panel-head { flex: none; display: flex; justify-content: flex-end; padding: 8px 8px 0; }
.talkbox { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.talkbox .panel-scroll { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.talkbox .panel-reactions, .talkbox .panel-comments { flex: none; }

.viewer-panel {
  display: flex; flex-direction: column;
  margin: 0 8px 8px; min-height: min(220px, 38vh); max-height: min(52vh, 420px);
  background: #17140f; border: 1px solid rgba(244, 240, 233, .12);
  border-radius: 14px; color: #f4f0e9; overflow: hidden;
}

.tile-popover {
  position: fixed; left: 12px; top: 12px; z-index: 45; width: min(360px, calc(100vw - 24px));
  max-height: min(70vh, 460px); display: flex; flex-direction: column;
  background: #17140f; color: #f4f0e9; border-radius: 14px;
  border: 1px solid rgba(244, 240, 233, .14);
  box-shadow: 0 20px 52px rgba(15, 12, 9, .45);
  animation: pop-in 140ms ease;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .tile-popover { animation: none; } }
.popover-close {
  position: absolute; top: 6px; right: 6px; z-index: 1; width: 30px; height: 30px;
  border: 0; border-radius: 50%; cursor: pointer; font-size: 13px; line-height: 1;
  background: rgba(244, 240, 233, .08); color: rgba(244, 240, 233, .72);
}
@media (hover: hover) { .popover-close:hover { color: #f4f0e9; background: rgba(244, 240, 233, .16); } }
.tile-popover .panel-scroll { padding-top: 12px; padding-right: 42px; }
.panel-head .viewer-btn { height: 38px; min-width: 38px; padding: 0 11px; }

@media (max-width: 560px) {
  .tile-popover {
    left: 0; right: 0; bottom: 0; top: auto; width: auto;
    max-height: 76vh; border-radius: 16px 16px 0 0; border-width: 1px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
}
.panel-scroll {
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 12px max(12px, env(safe-area-inset-left)) 4px max(12px, env(safe-area-inset-right));
}
.panel-reactions {
  display: flex; flex-wrap: wrap; gap: 2px; padding-bottom: 12px;
  border-bottom: 1px solid rgba(244, 240, 233, .09);
}
.react {
  border: 0; background: none; color: rgba(244, 240, 233, .6);
  border-radius: 999px; cursor: pointer; touch-action: manipulation;
  height: 36px; min-width: 36px; padding: 0 9px;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}
.react .rx { width: 20px; height: 20px; stroke-width: 1.6; }
.react .count { font-size: 12.5px; line-height: 1; font-variant-numeric: tabular-nums; }
.react.mine { background: var(--accent-ink); color: var(--ink); }
.react[disabled] { opacity: .55; cursor: default; }
@media (hover: hover) {
  .react:hover { background: rgba(244, 240, 233, .1); color: #f4f0e9; }
  .react.mine:hover { background: var(--accent-ink); color: var(--ink); }
}

.panel-comments { list-style: none; margin: 0; padding: 12px 0 0; display: flex; flex-direction: column; gap: 14px; }
.panel-comment { display: flex; flex-direction: column; gap: 3px; }
.comment-who {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-size: 13.5px; font-weight: 500;
}
.comment-when { font-size: 11.5px; font-weight: 400; color: rgba(244, 240, 233, .48); }
.comment-body { font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-acts { display: flex; gap: 12px; margin-top: 2px; }
.comment-act {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; font-size: 12px; color: rgba(244, 240, 233, .58);
}
@media (hover: hover) { .comment-act:hover { color: #f4f0e9; } }
.comment-edit { display: flex; flex-direction: column; gap: 7px; }
.panel-empty {
  margin: auto 0; padding: 26px 0; font-size: 13.5px;
  color: rgba(244, 240, 233, .45); text-align: center;
}

.panel-write {
  display: flex; align-items: flex-end; gap: 8px; flex-shrink: 0;
  padding: 10px max(14px, env(safe-area-inset-right)) 12px max(14px, env(safe-area-inset-left));
  border-top: 1px solid rgba(244, 240, 233, .1);
}
.panel-write textarea, .comment-edit textarea {
  flex: 1; min-width: 0; resize: none; font: inherit; font-size: 15px; line-height: 1.45;
  max-height: 128px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid rgba(244, 240, 233, .22); background: rgba(244, 240, 233, .06); color: #f4f0e9;
}
.panel-write textarea::placeholder { color: rgba(244, 240, 233, .42); }
.panel-write textarea:focus, .comment-edit textarea:focus { outline: none; border-color: rgba(244, 240, 233, .5); }
.panel-write .btn-light {
  flex: none; height: 42px; min-width: 42px; padding: 0 12px; justify-content: center;
  border-radius: 12px;
}
.panel-write .btn-light .rx { width: 19px; height: 19px; }
.comment-edit .btn-light { align-self: flex-start; min-height: 34px; padding: 0 14px; font-size: 13px; }
.panel-note {
  flex-shrink: 0; font-size: 12.5px; color: #e6b8a6; overflow-wrap: anywhere;
  padding: 0 max(14px, env(safe-area-inset-left)) 10px;
}
.panel-note[hidden] { display: none; }

@media (min-width: 900px) {
  .viewer {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "top drawer" "stage drawer" "strip strip";
  }
  .viewer-panel {
    width: var(--drawer-w); margin: 10px 12px 12px 0;
    min-height: 0; max-height: none;
  }
}

.join-veil {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(15, 12, 9, .68); backdrop-filter: blur(3px);
}
.join-card {
  width: 100%; max-width: 380px; background: var(--panel); color: var(--ink);
  border-radius: 16px; padding: 26px 24px 22px; box-shadow: 0 24px 60px rgba(15, 12, 9, .3);
}
.join-title { font-family: var(--display); font-weight: 400; font-size: 26px; margin: 0; letter-spacing: -.015em; }
.join-lead { color: var(--muted); font-size: 14px; margin: 8px 0 18px; }
.join-name {
  width: 100%; font: inherit; font-size: 16px; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
.join-name:focus { outline: none; border-color: var(--accent); }
.join-note { margin-top: 10px; font-size: 13px; color: var(--danger); }
.join-acts { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.join-acts .cancel {
  border: 0; background: none; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer;
}
@media (hover: hover) { .join-acts .cancel:hover { color: var(--ink); } }
.wordmark {
  font-family: var(--display); font-weight: 500; letter-spacing: -.01em; white-space: nowrap;
}
.wordmark svg { height: .8em; width: .68em; vertical-align: -.03em; margin-right: -.01em; color: var(--accent); }
.join-foot { margin: 16px 0 0; font-size: 12px; color: var(--muted-soft); }
