/* MovieTrakr design system. Rules and rationale: docs/DESIGN-SYSTEM.md
   Order: fonts, tokens, base, shell, components, views, states, motion prefs. */

/* ---------- Fonts (self-hosted, variable, OFL) ---------- */
@font-face {
  font-family: "Big Shoulders";
  src: url("../fonts/big-shoulders-display-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("../fonts/geist-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/geist-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark light;

  --font-display: "Big Shoulders", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  --font-ui: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Dark by default: the auditorium. */
  --bg: #0D1114;
  --bg-raised: #151A1F;
  --surface: #1C2329;
  --surface-2: #252D35;
  --line: rgb(214 225 235 / 0.09);
  --line-strong: rgb(214 225 235 / 0.17);
  --text: #EDEFF1;
  --text-2: #A7B0BA;
  --text-3: #808A95;
  --accent: #E8A33D;          /* marigold: the one accent */
  --accent-hover: #F0B055;
  --accent-ink: #0D1114;      /* text on accent */
  --accent-text: #F0B65E;     /* accent used as text */
  --accent-soft: rgb(232 163 61 / 0.16);
  --stub: #F4E6C8;            /* ticket stock */
  --stub-ink: #1B2026;
  --stamp-paper: #F2F4F5;
  --danger: #E5675F;
  --shadow-color: 210 45% 2%;
  --shadow-lg: 0 24px 48px -12px hsl(var(--shadow-color) / 0.7), 0 2px 8px hsl(var(--shadow-color) / 0.45);
  --scrim: rgb(6 8 10 / 0.62);
  --chrome: rgb(13 17 20 / 0.84);

  /* Shape rule: controls are pills or circles; containers are soft rectangles. */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;

  /* Motion (Emil Kowalski curves; see DESIGN-SYSTEM.md#motion) */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  --topbar-h: 56px;
  --tabbar-h: 62px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --gutter: 16px;

  /* Layers */
  --z-glow: 0;
  --z-content: 1;
  --z-nav: 20;
  --z-menu: 30;
  --z-toast: 40;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #EEF0F2;
    --bg-raised: #F8F9FA;
    --surface: #E2E6EA;
    --surface-2: #D5DBE0;
    --line: rgb(18 28 38 / 0.1);
    --line-strong: rgb(18 28 38 / 0.18);
    --text: #12171C;
    --text-2: #4A5562;
    --text-3: #5D6874;
    --accent-text: #8F5600;
    --accent-soft: rgb(232 163 61 / 0.22);
    --shadow-color: 212 22% 38%;
    --shadow-lg: 0 22px 44px -14px hsl(var(--shadow-color) / 0.45), 0 2px 6px hsl(var(--shadow-color) / 0.2);
    --scrim: rgb(18 24 30 / 0.42);
    --chrome: rgb(238 240 242 / 0.86);
  }
}

@media (min-width: 768px) {
  :root { --gutter: 24px; }
}

/* ---------- Base (includes the mobile-native baseline) ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[hidden] { display: none !important; } /* component display rules must never beat the hidden attribute */
h1, h2, h3, p, figure, dl, dd { margin: 0; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
input, select, textarea { font-size: 16px; } /* below 16px iOS zooms the page */

button, a, select, [role="tab"], .ticket {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
:focus:not(:focus-visible) { outline: none; }

.icon { width: 20px; height: 20px; fill: currentColor; flex: none; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

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

.skip-link {
  position: fixed; left: 12px; top: calc(var(--safe-top) + 8px); z-index: 100;
  padding: 10px 14px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none;
  transform: translateY(-160%);
}
.skip-link:focus-visible { transform: none; }

.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.55rem;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px;
  border: 1px solid transparent; border-radius: var(--r-pill);
  font-weight: 600; font-size: 15px; white-space: nowrap; text-decoration: none;
  transition: transform 160ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.btn:active { transform: scale(0.97); }
.btn .icon { width: 18px; height: 18px; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--ghost { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn--quiet { background: transparent; color: var(--text-2); padding: 0 12px; }
.btn--block { width: 100%; }
.btn[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: transparent; }
.btn--primary[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover { background: var(--accent-hover); }
  .btn--ghost:hover { background: var(--surface); }
  .btn--quiet:hover { color: var(--text); }
}

/* ---------- App shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: var(--z-nav);
  display: flex; align-items: center; gap: 28px;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) max(var(--gutter), env(safe-area-inset-right, 0px)) 0 max(var(--gutter), env(safe-area-inset-left, 0px));
  background: var(--bg);
  background: var(--chrome);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}

.topnav { display: none; gap: 6px; }
.topnav a {
  position: relative; padding: 8px 12px;
  color: var(--text-2); text-decoration: none; font-weight: 500;
  border-radius: var(--r-pill);
  transition: color 160ms ease, background-color 160ms ease;
}
.topnav a[aria-current="page"] { color: var(--text); background: var(--surface); }
@media (hover: hover) and (pointer: fine) {
  .topnav a:hover { color: var(--text); }
}

.account { position: relative; margin-left: auto; }
.avatar {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--surface);
  font-weight: 700; font-size: 15px;
  transition: transform 160ms var(--ease-out);
}
.avatar:active { transform: scale(0.94); }

.menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: var(--z-menu);
  min-width: 248px; padding: 6px;
  background: var(--bg-raised); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  transform-origin: top right;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}
.menu[data-state="closed"] { opacity: 0; transform: scale(0.96); }
.menu__who { display: grid; padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu__who span { color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.menu__item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  height: 44px; padding: 0 12px; border: 0; border-radius: var(--r-sm);
  background: transparent; text-align: left; font-weight: 500;
}
.menu__item:active { background: var(--surface); }
.menu__credit { margin-top: 6px; padding: 10px 12px 0; border-top: 1px solid var(--line); color: var(--text-3); font-size: 12px; line-height: 1.45; }
.menu__credit a { color: var(--text-2); }
.menu__version { padding: 8px 12px 4px; color: var(--text-3); font: 12px var(--font-mono); }
@media (hover: hover) and (pointer: fine) {
  .menu__item:hover { background: var(--surface); }
}

.views { outline: none; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-nav);
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0 env(safe-area-inset-right, 0px) var(--safe-bottom) env(safe-area-inset-left, 0px);
  background: var(--bg);
  background: var(--chrome);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); text-decoration: none;
  font-size: 11.5px; font-weight: 500; letter-spacing: 0.01em;
}
.tabbar .icon { width: 25px; height: 25px; transition: transform 140ms var(--ease-out); }
.tabbar a:active .icon { transform: scale(0.88); }
.tabbar .icon--on { display: none; }
.tabbar a[aria-current="page"] { color: var(--text); }
.tabbar a[aria-current="page"] .icon { display: none; }
.tabbar a[aria-current="page"] .icon--on { display: block; }

@media (min-width: 1024px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
}

/* ---------- Pages (Search, Library) ---------- */
.page {
  max-width: 1280px; margin: 0 auto;
  padding: 22px var(--gutter) calc(var(--tabbar-h) + var(--safe-bottom) + 40px);
}
@media (min-width: 1024px) {
  .page { padding-bottom: 64px; }
}

.page-head { display: grid; gap: 4px; margin-bottom: 18px; }
.page-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.5rem;
  line-height: 0.95;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}
.page-sub { color: var(--text-2); }

.section-label {
  margin: 4px 0 14px;
  font-size: 15px; font-weight: 600; color: var(--text-2);
}
.section-label:empty { display: none; }

/* ---------- Search field ---------- */
.searchbar {
  position: sticky; top: calc(var(--topbar-h) + var(--safe-top)); z-index: var(--z-content);
  margin: 14px calc(var(--gutter) * -1) 18px;
  padding: 8px var(--gutter);
  background: var(--bg);
}
.searchbar__field {
  display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 6px 0 16px;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.searchbar__field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.searchbar__field > .icon { color: var(--text-3); }
.searchbar input {
  flex: 1; min-width: 0; height: 100%;
  border: 0; background: transparent; outline: none;
  -webkit-appearance: none; appearance: none;
}
.searchbar input::placeholder { color: var(--text-3); }
.searchbar input::-webkit-search-cancel-button { display: none; }
.searchbar__clear {
  display: grid; place-items: center;
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: transparent; color: var(--text-2);
}
.searchbar__clear:active { background: var(--surface); }

/* ---------- Library toolbar ---------- */
.library-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 22px;
}
.chips {
  display: flex; gap: 8px;
  margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter);
  overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity;
  max-width: calc(100% + var(--gutter) * 2);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; scroll-snap-align: start;
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 15px;
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  background: transparent; color: var(--text-2);
  font-size: 14px; font-weight: 500;
  transition: background-color 160ms ease, color 160ms ease, transform 140ms var(--ease-out);
}
.chip:active { transform: scale(0.96); }
.chip[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: transparent; }
.chip__n { font: 500 12px var(--font-mono); font-variant-numeric: tabular-nums; opacity: 0.72; }
.chip__n:empty { display: none; }
@media (hover: hover) and (pointer: fine) {
  .chip:hover:not([aria-selected="true"]) { color: var(--text); background: var(--surface); }
}

.sort {
  position: relative; display: inline-flex; align-items: center;
  height: 38px; border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  color: var(--text-2);
}
.sort .icon { position: absolute; left: 12px; width: 18px; height: 18px; pointer-events: none; }
.sort select {
  height: 100%; padding: 0 16px 0 38px;
  border: 0; border-radius: var(--r-pill); background: transparent;
  font-size: 14px; font-weight: 500; color: var(--text);
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
@media (pointer: coarse) {
  .sort select { font-size: 16px; }
}
@media (min-width: 768px) {
  .chips { margin: 0; padding: 2px; max-width: none; overflow: visible; }
}

/* ---------- Poster grid (Search + Library) ---------- */
.poster-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 12px;
}
@media (min-width: 560px) { .poster-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px 16px; } }
@media (min-width: 860px) { .poster-grid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 30px 20px; } }

.poster { display: grid; gap: 10px; align-content: start; content-visibility: auto; contain-intrinsic-size: auto 330px; }
.poster__open {
  display: block; padding: 0; border: 0; background: none; text-align: left;
  border-radius: var(--r-md);
  transition: transform 160ms var(--ease-out);
}
.poster__open:active { transform: scale(0.97); }
.poster__frame {
  position: relative; display: block; aspect-ratio: 2 / 3; overflow: hidden;
  border-radius: var(--r-md); background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}
.poster__frame img {
  width: 100%; height: 100%; object-fit: cover;
  transition: opacity 260ms ease, transform 400ms var(--ease-out);
}
.poster__frame img[data-loading] { opacity: 0; }
.poster__body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 6px; align-items: start; }
.poster__title {
  font-size: 14.5px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.poster__meta {
  grid-column: 1;
  display: flex; flex-wrap: wrap; gap: 2px 10px;
  color: var(--text-3); font: 12px/1.5 var(--font-mono); font-variant-numeric: tabular-nums;
}
.poster__meta > span { display: inline-flex; align-items: center; gap: 4px; }
.poster__meta .icon { width: 13px; height: 13px; }
.poster__status--watchlist { color: var(--accent-text); }
.poster__status--seen { color: var(--text-2); }
.poster__quick {
  grid-row: 1 / span 2; grid-column: 2;
  display: grid; place-items: center;
  width: 40px; height: 40px; margin: -8px -8px 0 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--text-2);
  transition: transform 140ms var(--ease-out), color 160ms ease;
}
.poster__quick:active { transform: scale(0.88); }
.poster__quick[aria-pressed="true"] { color: var(--accent-text); }
.poster__quick .icon { width: 22px; height: 22px; }

/* A poster made of type, for films TMDB has no artwork for. */
.poster__fallback {
  position: absolute; inset: 0;
  display: flex; align-items: flex-end;
  padding: 14px;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  font: 800 1.35rem/0.95 var(--font-display); text-transform: uppercase;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

@media (hover: hover) and (pointer: fine) {
  .poster__open:hover .poster__frame img { transform: scale(1.03); }
  .poster__quick:hover { color: var(--text); }
}

/* ---------- Discover ---------- */
.view--discover {
  height: calc(100dvh - var(--topbar-h) - var(--safe-top) - var(--tabbar-h) - var(--safe-bottom));
  overflow: hidden;
}
@media (min-width: 1024px) {
  .view--discover { height: calc(100dvh - var(--topbar-h) - var(--safe-top)); }
}

.discover { height: 100%; display: grid; }
.deck-area {
  position: relative; min-height: 0;
  display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 14px;
  padding: 14px var(--gutter) 12px;
}

.deck-glow { position: absolute; inset: 0; z-index: var(--z-glow); pointer-events: none; overflow: hidden; }
.deck-glow i {
  position: absolute; inset: 8% 6% 18%;
  background-size: cover; background-position: center;
  filter: blur(36px) saturate(1.25);
  opacity: 0;
  transition: opacity 700ms ease;
}
.deck-glow i[data-on] { opacity: 0.42; }

.deck {
  position: relative; z-index: var(--z-content);
  min-height: 0;
  display: grid; place-items: center;
  padding-bottom: 18px; /* room for the next ticket peeking out underneath */
  container-type: size;
}

/* The ticket: poster above a perforated stub. The signature element. */
.ticket {
  --notch: 11px;
  grid-area: 1 / 1;
  position: relative;
  display: grid; grid-template-rows: minmax(0, 1fr) auto;
  width: min(100%, 360px);
  width: min(100cqw, 55.5cqh, 400px);
  aspect-ratio: 5 / 9;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  transform-origin: 50% 90%;
  touch-action: none;
  cursor: grab;
}
.ticket.is-dragging { cursor: grabbing; }
.ticket.is-top { will-change: transform; }
.ticket.is-behind {
  pointer-events: none;
  transform: translateY(3.5%) scale(0.94);
}
.ticket.is-behind, .ticket.is-promoting { transition: transform 260ms var(--ease-out); }
.ticket.is-tracking { transition: none; } /* follows the finger frame by frame */
.ticket.is-behind .ticket__poster::after { opacity: 1; }

.ticket__poster {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: var(--surface);
  -webkit-mask:
    radial-gradient(circle var(--notch) at 0 100%, #0000 calc(var(--notch) - 0.5px), #000 var(--notch)) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% 100%, #0000 calc(var(--notch) - 0.5px), #000 var(--notch)) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle var(--notch) at 0 100%, #0000 calc(var(--notch) - 0.5px), #000 var(--notch)) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% 100%, #0000 calc(var(--notch) - 0.5px), #000 var(--notch)) right / 51% 100% no-repeat;
}
.ticket__poster img {
  width: 100%; height: 100%; object-fit: cover;
  pointer-events: none; -webkit-user-drag: none;
}
.ticket__poster::after {
  content: ""; position: absolute; inset: 0;
  background: rgb(6 8 10 / 0.38);
  opacity: 0; transition: opacity 260ms ease;
}

.ticket__stub {
  position: relative;
  display: grid; gap: 8px;
  padding: 16px 20px 18px;
  background: var(--stub); color: var(--stub-ink);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  -webkit-mask:
    radial-gradient(circle var(--notch) at 0 0, #0000 calc(var(--notch) - 0.5px), #000 var(--notch)) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% 0, #0000 calc(var(--notch) - 0.5px), #000 var(--notch)) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle var(--notch) at 0 0, #0000 calc(var(--notch) - 0.5px), #000 var(--notch)) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% 0, #0000 calc(var(--notch) - 0.5px), #000 var(--notch)) right / 51% 100% no-repeat;
}
/* The tear line */
.ticket__stub::before {
  content: ""; position: absolute; top: 0; left: calc(var(--notch) + 6px); right: calc(var(--notch) + 6px);
  border-top: 2px dashed rgb(27 32 38 / 0.26);
}
.ticket__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.45rem, 7.4cqw, 2.05rem);
  line-height: 0.94;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-wrap: balance;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  padding-bottom: 2px;
}
.ticket__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px;
  font: 500 12.5px/1.3 var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: rgb(27 32 38 / 0.72);
}
.ticket__meta span { display: inline-flex; align-items: center; gap: 5px; }
.ticket__meta .icon { width: 13px; height: 13px; }

/* Stamps appear as you drag, showing what letting go will do. */
.stamp {
  position: absolute; z-index: 2; top: 22px;
  padding: 7px 12px 4px;
  font: 800 1.9rem/1 var(--font-display);
  letter-spacing: 0.06em; text-transform: uppercase;
  border: 3px solid currentColor; border-radius: var(--r-sm);
  background: rgb(10 13 16 / 0.52);
  opacity: 0; pointer-events: none;
}
.stamp--watchlist { left: 18px; rotate: -11deg; color: var(--accent); }
.stamp--skipped { right: 18px; rotate: 11deg; color: var(--stamp-paper); }
.stamp--seen { left: 50%; top: auto; bottom: 22px; translate: -50% 0; rotate: -4deg; color: var(--stamp-paper); }

.deck-actions {
  position: relative; z-index: var(--z-content);
  display: flex; align-items: center; justify-content: center; gap: 14px;
}
.act {
  display: grid; place-items: center;
  width: 62px; height: 62px; padding: 0;
  border: 1px solid var(--line-strong); border-radius: 50%;
  background: var(--bg-raised); color: var(--text);
  box-shadow: 0 6px 18px -8px hsl(var(--shadow-color) / 0.6);
  transition: transform 160ms var(--ease-out), background-color 160ms ease, opacity 160ms ease;
}
.act .icon { width: 27px; height: 27px; }
.act:active { transform: scale(0.92); }
.act:disabled { opacity: 0.32; cursor: default; }
.act:disabled:active { transform: none; }
.act--small { width: 44px; height: 44px; color: var(--text-2); box-shadow: none; }
.act--small .icon { width: 21px; height: 21px; }
.act--seen { width: 54px; height: 54px; }
.act--watch { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
@media (hover: hover) and (pointer: fine) {
  .act:not(:disabled):hover { background: var(--surface); }
  .act--watch:not(:disabled):hover { background: var(--accent-hover); }
}

/* Deck messages (loading, empty, error) take the ticket's place. */
.deck-state {
  grid-area: 1 / 1;
  display: grid; align-content: center; justify-items: center; gap: 12px;
  width: min(100cqw, 55.5cqh, 400px); aspect-ratio: 5 / 9;
  padding: 28px; text-align: center;
  border: 1px dashed var(--line-strong); border-radius: var(--r-lg);
}
.deck-state .state__title { text-align: center; }

/* Desktop: details beside the deck */
.discover-info { display: none; }
@media (min-width: 1024px) {
  .discover {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 440px);
    gap: 56px; max-width: 1180px; margin: 0 auto; padding: 0 32px;
  }
  .deck-area { padding: 28px 0 24px; }
  .discover-info { display: grid; align-content: center; gap: 18px; padding-bottom: 40px; }
}
.info__title {
  font: 800 3rem/0.92 var(--font-display); text-transform: uppercase; letter-spacing: 0.005em;
  text-wrap: balance;
}
.info__facts {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  color: var(--text-2); font: 500 13px var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em;
}
.info__facts span { display: inline-flex; align-items: center; gap: 6px; }
.info__facts .icon { width: 15px; height: 15px; }
.info__overview {
  color: var(--text-2); max-width: 58ch;
  display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden;
}
.info__keys {
  display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; align-items: center;
  margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--line);
  color: var(--text-3); font-size: 13.5px;
}
kbd {
  display: inline-grid; place-items: center; min-width: 28px; height: 26px; padding: 0 7px;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 7px;
  font: 600 12px var(--font-mono); color: var(--text-2);
}
kbd .icon { width: 14px; height: 14px; }

/* Phones held sideways: put the controls beside the ticket. */
@media (orientation: landscape) and (max-height: 520px) {
  .deck-area { grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr) auto; padding-top: 10px; padding-bottom: 10px; }
  .deck-actions { flex-direction: column; gap: 8px; }
  .act { width: 50px; height: 50px; }
  .act--small { width: 38px; height: 38px; }
  .act--seen { width: 44px; height: 44px; }
}

/* ---------- Details sheet ---------- */
.sheet {
  width: 100%; max-width: none; height: 100%; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: transparent; color: var(--text);
  overflow: hidden;
}
.sheet::backdrop { background: transparent; }
.sheet__scrim {
  position: fixed; inset: 0;
  background: var(--scrim);
  opacity: 0; transition: opacity 320ms ease;
}
.sheet[data-open] .sheet__scrim { opacity: 1; }

.sheet__panel {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column;
  max-height: calc(100dvh - var(--safe-top) - 28px);
  background: var(--bg-raised);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: 0 -12px 40px hsl(var(--shadow-color) / 0.5);
  transform: translateY(100%);
  transition: transform 460ms var(--ease-drawer);
}
.sheet[data-open] .sheet__panel { transform: translateY(0); }
.sheet[data-closing] .sheet__panel { transition-duration: 260ms; }
.sheet[data-closing] .sheet__scrim { transition-duration: 220ms; }

.sheet__handle {
  flex: none; display: grid; place-items: center;
  height: 26px; touch-action: none; cursor: grab;
}
.sheet__handle::before {
  content: ""; width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong);
}
.sheet__close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 50%;
  background: rgb(10 13 16 / 0.55); color: #F2F4F5;
}
.sheet__close:active { transform: scale(0.92); }
.sheet__body {
  overflow-y: auto; overscroll-behavior: contain;
  padding: 0 20px calc(28px + var(--safe-bottom));
  display: grid; gap: 18px;
}

@media (min-width: 768px) {
  .sheet__panel {
    left: 50%; top: 50%; bottom: auto; right: auto;
    width: min(720px, calc(100vw - 48px));
    max-height: min(88dvh, 860px);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    transform: translate(-50%, -48%) scale(0.96);
    opacity: 0;
    transition: transform 260ms var(--ease-out), opacity 260ms var(--ease-out);
  }
  .sheet[data-open] .sheet__panel { transform: translate(-50%, -50%); opacity: 1; }
  .sheet[data-closing] .sheet__panel { transition-duration: 180ms; }
  .sheet__handle { display: none; }
  .sheet__body { padding: 24px 28px 28px; }
}

.details__media {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  margin: 0 -20px; background: var(--surface);
}
.details__media img, .details__media iframe { width: 100%; height: 100%; object-fit: cover; border: 0; }
.details__media::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 40%;
  background: linear-gradient(to top, var(--bg-raised), transparent);
  pointer-events: none;
}
.details__media.is-playing::after { display: none; }
/* Phones: vertical drags on the artwork close the sheet; horizontal stays with the browser. */
@media (max-width: 767px) {
  .details__media:not(.is-playing) { touch-action: pan-x; }
}
.details__play {
  position: absolute; left: 50%; top: 50%; z-index: 1;
  translate: -50% -50%;
  display: inline-flex; align-items: center; gap: 10px;
  height: 48px; padding: 0 20px 0 16px;
  border: 0; border-radius: var(--r-pill);
  background: rgb(10 13 16 / 0.62); color: #F2F4F5;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-weight: 600;
  transition: transform 160ms var(--ease-out);
}
.details__play:active { transform: scale(0.96); }
@media (min-width: 768px) {
  .details__media { margin: -24px -28px 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }
}

.details__head { display: grid; gap: 8px; }
.details__title {
  font: 800 2.3rem/0.94 var(--font-display); text-transform: uppercase; letter-spacing: 0.005em;
  text-wrap: balance;
}
.details__original { color: var(--text-3); font-size: 14px; }
.details__facts {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  color: var(--text-2); font: 500 12.5px var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em;
}
.details__facts span { display: inline-flex; align-items: center; gap: 6px; }
.details__facts .icon { width: 14px; height: 14px; }
.details__tagline { color: var(--text-2); font-style: italic; }
.details__overview { color: var(--text-2); max-width: 65ch; }
.details__genres { color: var(--text-3); font-size: 14px; }
.details__actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.details__actions .btn { padding: 0 10px; }
.details__remove { justify-self: start; margin-left: -12px; }

/* ---------- Toasts ---------- */
.toaster {
  position: fixed; z-index: var(--z-toast);
  left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  width: min(440px, calc(100vw - 24px));
  transform: translateX(-50%);
  display: grid; pointer-events: none;
}
.is-guest .toaster { bottom: calc(var(--safe-bottom) + 16px); }
/* Inside the open sheet, toasts drop in from the top so they never cover its buttons. */
.sheet-toaster { top: calc(var(--safe-top) + 12px); bottom: auto; }
.sheet-toaster .toast[data-state] { transform: translateY(-100%); }
@media (min-width: 1024px) {
  .toaster { bottom: 28px; }
}
.toast {
  grid-area: 1 / 1;
  display: flex; align-items: center; gap: 12px;
  min-height: 50px; padding: 7px 7px 7px 16px;
  border-radius: var(--r-md);
  background: var(--text); color: var(--bg);
  box-shadow: var(--shadow-lg);
  font-size: 14.5px; font-weight: 500;
  pointer-events: auto;
  transition: transform 400ms ease, opacity 400ms ease;
}
.toast[data-state="enter"] { transform: translateY(100%); opacity: 0; }
.toast[data-state="exit"] { transform: translateY(60%); opacity: 0; transition-duration: 200ms; }
.toast .icon { width: 20px; height: 20px; }
.toast--error .icon { color: var(--danger); }
.toast__text { flex: 1; }
.toast__action {
  height: 36px; padding: 0 14px;
  border: 0; border-radius: var(--r-pill);
  background: rgb(127 127 127 / 0.18); color: inherit;
  font-weight: 600; font-size: 14px;
}
.toast__action:active { transform: scale(0.96); }

/* ---------- Install prompt ---------- */
.install {
  position: fixed; z-index: var(--z-toast);
  left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  width: min(440px, calc(100vw - 24px));
  transform: translateX(-50%);
  display: grid; grid-template-columns: auto 1fr; gap: 12px 14px; align-items: center;
  padding: 14px;
  background: var(--bg-raised); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  transition: transform 400ms var(--ease-out), opacity 400ms var(--ease-out);
}
.is-guest .install { bottom: calc(var(--safe-bottom) + 16px); }
@media (min-width: 1024px) { .install { bottom: 28px; } }
.install[data-state] { transform: translate(-50%, 24px); opacity: 0; }
.install[data-state="exit"] { transition-duration: 200ms; }
.install__icon { width: 44px; height: 44px; border-radius: 11px; }
.install__text { display: grid; gap: 2px; color: var(--text-2); font-size: 14px; line-height: 1.4; }
.install__text strong { color: var(--text); font-size: 15px; }
.install__glyph { width: 16px; height: 16px; vertical-align: -3px; color: var(--accent-text); }
.install__actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
@media (prefers-reduced-motion: reduce) { .install, .install[data-state] { transform: translateX(-50%); } }

/* ---------- Listing tools: results bar, filters, view switch ---------- */
.results-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 38px; margin: 4px 0 12px;
}
.results-bar .section-label { margin: 0; }
.results-filters { margin-bottom: 18px; }
.library-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.viewtoggle {
  display: inline-flex; gap: 2px; padding: 3px;
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
}
.viewtoggle button {
  display: grid; place-items: center; width: 38px; height: 30px;
  border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--text-3);
  transition: background-color 160ms ease, color 160ms ease;
}
.viewtoggle button .icon { width: 18px; height: 18px; }
.viewtoggle button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
@media (hover: hover) and (pointer: fine) {
  .viewtoggle button:not([aria-pressed="true"]):hover { color: var(--text); }
}

/* Status on the poster itself, and seen films stepping back in Search. */
.poster__badge {
  position: absolute; left: 8px; top: 8px; z-index: 1;
  display: inline-flex; align-items: center; gap: 4px;
  height: 24px; padding: 0 9px 0 7px;
  border-radius: var(--r-pill);
  background: rgb(10 13 16 / 0.74); color: #F2F4F5;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font: 600 11.5px/1 var(--font-ui);
}
.poster__badge .icon { width: 13px; height: 13px; }
.poster__badge--watchlist { background: var(--accent); color: var(--accent-ink); }
.poster.is-seen .poster__frame img { filter: saturate(0.3) brightness(0.6); }
.poster.is-seen .poster__title { color: var(--text-2); }

/* ---------- List view ---------- */
.movie-list { display: grid; }
.row {
  position: relative;
  display: grid; align-items: center; gap: 6px 14px;
  /* Phones: poster | title, details, status underneath | bookmark */
  grid-template-columns: 44px minmax(0, 1fr);
  grid-template-areas: "thumb main" "thumb status";
  min-height: 82px; padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  content-visibility: auto; contain-intrinsic-size: auto 82px;
}
.movie-list--search .row { grid-template-columns: 44px minmax(0, 1fr) 40px; grid-template-areas: "thumb main quick" "thumb status quick"; }
.row__thumb { grid-area: thumb; align-self: start; }
.row__main { grid-area: main; }
.row__status { grid-area: status; justify-self: start; }
.row__status:empty { display: none; }
.row__quick { grid-area: quick; }
.row__open {
  position: absolute; inset: 0; z-index: 0;
  border: 0; border-radius: var(--r-sm); background: transparent;
}
.row__open:focus-visible { outline-offset: -2px; }
.row:not(.row--head) > :not(.row__open) { position: relative; z-index: 1; pointer-events: none; }
.row .row__quick { pointer-events: auto; }
.row__thumb {
  width: 44px; aspect-ratio: 2 / 3; overflow: hidden;
  border-radius: 6px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
}
.row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.row__thumb-fallback { display: grid; place-items: center; height: 100%; font: 800 1.2rem var(--font-display); color: var(--text-3); }
.row__main { display: grid; gap: 3px; min-width: 0; }
.row__title {
  font-size: 15px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.row__sub { display: none; font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__meta {
  display: flex; flex-wrap: wrap; gap: 2px 12px;
  color: var(--text-3); font: 12px/1.4 var(--font-mono); font-variant-numeric: tabular-nums;
}
.row__meta > span, .row__tmdb { display: inline-flex; align-items: center; gap: 4px; }
.row__meta .icon, .row__tmdb .icon { width: 13px; height: 13px; }
.row__cell { display: none; }
.row__quick {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 50%; background: transparent; color: var(--text-2);
  transition: transform 140ms var(--ease-out), color 160ms ease;
}
.row__quick:active { transform: scale(0.88); }
.row__quick[aria-pressed="true"] { color: var(--accent-text); }
.row__quick .icon { width: 22px; height: 22px; }
.row.is-seen .row__thumb img { filter: saturate(0.3) brightness(0.65); }
.row.is-seen .row__title { color: var(--text-2); }
.row--head { display: none; }
.row--skeleton { pointer-events: none; }
.row--skeleton .row__main { gap: 8px; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 10px 0 8px;
  border: 1px solid transparent; border-radius: var(--r-pill);
  font: 600 12px/1 var(--font-ui); white-space: nowrap;
}
.pill .icon { width: 14px; height: 14px; }
.pill--watchlist { background: var(--accent-soft); color: var(--accent-text); }
.pill--seen, .pill--verdict { background: var(--surface); color: var(--text-2); }
.pill--verdict { color: var(--text); }
.pill--skipped { border-color: var(--line-strong); color: var(--text-3); }

@media (hover: hover) and (pointer: fine) {
  .row:not(.row--head):hover { background: var(--bg-raised); }
  .row__quick:hover { color: var(--text); }
}

@media (min-width: 768px) {
  .movie-list--search .row { grid-template-columns: 48px minmax(0, 1fr) 64px 128px 76px 150px 40px; }
  .movie-list--library .row { grid-template-columns: 48px minmax(0, 1fr) 64px 128px 76px 160px 112px; }
  .row, .movie-list--search .row { grid-template-areas: none; row-gap: 0; min-height: 84px; }
  .row > * { grid-area: auto; }
  .row__status:empty { display: block; }
  .row__thumb { width: 48px; align-self: center; }
  .row__title { -webkit-line-clamp: 1; }
  .row__sub { display: block; }
  .row__meta { display: none; }
  .row__cell { display: block; color: var(--text-2); font-size: 14px; }
  .row__year, .row__tmdb, .row__added { font: 13px var(--font-mono); font-variant-numeric: tabular-nums; }
  .row__tmdb { display: inline-flex; }
  .row--head {
    display: grid; position: sticky; top: calc(var(--topbar-h) + var(--safe-top)); z-index: 2;
    min-height: 42px; padding-block: 0;
    background: var(--bg); border-bottom-color: var(--line-strong);
    color: var(--text-3); font-size: 12.5px; font-weight: 600;
    content-visibility: visible;
  }
  .row__h {
    justify-self: start; display: inline-flex; align-items: center; gap: 4px;
    padding: 0; border: 0; background: none; color: inherit; font: inherit;
  }
  button.row__h { cursor: pointer; }
  .row__h.is-active { color: var(--text); }
  .row__h .icon { width: 13px; height: 13px; }
}
@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
  button.row__h:hover { color: var(--text); }
}

/* ---------- Your verdict (details sheet) ---------- */
.verdict { display: grid; gap: 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.verdict__title { font: 800 1.35rem/1 var(--font-display); text-transform: uppercase; letter-spacing: 0.01em; }
/* Segmented choices: the one documented exception to "controls are pills" (soft rectangles read as a set). */
.verdict__options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 480px) { .verdict__options { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.verdict__btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 68px; padding: 10px 6px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: transparent; color: var(--text-2);
  font-size: 13px; font-weight: 600; text-align: center;
  transition: transform 140ms var(--ease-out), background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}
.verdict__btn .icon { width: 22px; height: 22px; }
.verdict__btn:active { transform: scale(0.96); }
.verdict__btn[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: transparent; }
.verdict__tags { display: grid; gap: 8px; }
.verdict__hint { color: var(--text-3); font-size: 13px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  height: 34px; padding: 0 13px;
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  background: transparent; color: var(--text-2);
  font-size: 13px; font-weight: 500;
  transition: transform 140ms var(--ease-out), background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}
.tag:active { transform: scale(0.95); }
.tag[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
@media (hover: hover) and (pointer: fine) {
  .verdict__btn:hover:not([aria-pressed="true"]), .tag:hover:not([aria-pressed="true"]) { color: var(--text); background: var(--surface); }
}
.poster__status--verdict { color: var(--accent-text); }

/* ---------- Quick rate (after swiping up) ---------- */
.quickrate {
  position: fixed; z-index: var(--z-toast);
  left: 50%; top: calc(var(--topbar-h) + var(--safe-top) + 10px);
  width: min(440px, calc(100vw - 24px));
  transform: translateX(-50%);
  display: grid; gap: 10px;
  padding: 14px 14px 12px;
  background: var(--bg-raised); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  transition: transform 320ms var(--ease-out), opacity 320ms var(--ease-out);
}
.quickrate[data-state] { transform: translate(-50%, -14px); opacity: 0; }
.quickrate[data-state="exit"] { transition-duration: 200ms; }
.quickrate__q { padding-right: 40px; font-size: 15px; color: var(--text-2); }
.quickrate__q strong { color: var(--text); }
.quickrate__close {
  position: absolute; top: 8px; right: 8px;
  display: grid; place-items: center; width: 36px; height: 36px;
  border: 0; border-radius: 50%; background: transparent; color: var(--text-3);
}
.quickrate__options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.quickrate__opt {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 2px 8px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: transparent; color: var(--text);
  font-size: 12px; font-weight: 600;
  transition: transform 140ms var(--ease-out), background-color 160ms ease;
}
.quickrate__opt .icon { width: 22px; height: 22px; }
.quickrate__opt:active { transform: scale(0.94); background: var(--surface); }
.quickrate__done { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; min-height: 52px; color: var(--accent-text); font-weight: 600; font-size: 14px; }
@media (hover: hover) and (pointer: fine) { .quickrate__opt:hover { background: var(--surface); } }

/* ---------- Onboarding ---------- */
.onb-dialog {
  width: min(420px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px);
  margin: auto; padding: 0; border: 0;
  background: transparent; color: var(--text);
  overflow: auto; overscroll-behavior: contain;
}
.onb-dialog::backdrop { background: var(--scrim); }
.onb {
  display: grid; gap: 16px;
  padding: 22px 20px 20px;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}
.onb__title { font: 800 2.1rem/0.95 var(--font-display); text-transform: uppercase; letter-spacing: 0.005em; }
.onb__stage {
  height: 216px; display: grid; place-items: center; overflow: hidden;
  border-radius: var(--r-md); background: var(--bg);
}
.onb__ticket {
  width: 112px; border-radius: 12px; box-shadow: var(--shadow-lg);
  transition: transform 600ms var(--ease-in-out);
}
.onb__poster {
  position: relative; aspect-ratio: 2 / 3; overflow: hidden;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
}
.onb__poster img { width: 100%; height: 100%; object-fit: cover; }
.onb__stub {
  padding: 7px 9px; border-radius: 0 0 12px 12px;
  background: var(--stub); color: var(--stub-ink);
  font: 800 12px/1.1 var(--font-display); text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-top: 2px dashed rgb(27 32 38 / 0.26);
}
.onb .stamp { top: 10px; padding: 3px 6px 2px; font-size: 0.8rem; border-width: 2px; border-radius: 6px; transition: opacity 300ms ease; }
.onb .stamp--watchlist { left: 6px; }
.onb .stamp--skipped { right: 6px; }
.onb .stamp--seen { top: auto; bottom: 10px; }
.onb__tap {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: rgb(10 13 16 / 0.6); color: #F2F4F5;
  opacity: 0; transition: opacity 300ms ease;
}
.onb__tap .icon { width: 24px; height: 24px; }
.onb__ticket[data-step="right"] { transform: translateX(72px) rotate(10deg); }
.onb__ticket[data-step="left"] { transform: translateX(-72px) rotate(-10deg); }
.onb__ticket[data-step="up"] { transform: translateY(-44px); }
.onb__ticket[data-step="tap"] { transform: scale(0.95); }
.onb__ticket[data-step="right"] .stamp--watchlist,
.onb__ticket[data-step="left"] .stamp--skipped,
.onb__ticket[data-step="up"] .stamp--seen,
.onb__ticket[data-step="tap"] .onb__tap { opacity: 1; }
.onb__rows { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.onb__row {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center;
  color: var(--text-2); font-size: 14px; line-height: 1.4;
  transition: color 200ms ease;
}
.onb__row[data-active] { color: var(--text); }
.onb__glyph {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--text);
  transition: border-color 200ms ease, transform 200ms var(--ease-out);
}
.onb__glyph .icon { width: 19px; height: 19px; }
.onb__glyph--watch { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.onb__row[data-active] .onb__glyph { border-color: var(--accent); transform: scale(1.06); }
@media (prefers-reduced-motion: reduce) {
  .onb__ticket, .onb .stamp, .onb__glyph { transition: none; }
  .quickrate, .quickrate[data-state] { transform: translateX(-50%); }
}

/* ---------- States: empty, error, loading ---------- */
.state { display: grid; justify-items: start; gap: 10px; padding: 28px 0 40px; max-width: 46ch; }
.state__title { font: 800 1.75rem/1 var(--font-display); text-transform: uppercase; }
.state__text { color: var(--text-2); }
.state .btn { margin-top: 6px; }
.grid-full { grid-column: 1 / -1; }

.skeleton { position: relative; overflow: hidden; background: var(--surface); }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.05), transparent);
  animation: shimmer 1.4s linear infinite;
}
@media (prefers-color-scheme: light) {
  .skeleton::after { background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.5), transparent); }
}
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton--line { height: 12px; border-radius: 6px; }
.skeleton--ticket { grid-area: 1 / 1; width: min(100cqw, 55.5cqh, 400px); aspect-ratio: 5 / 9; border-radius: var(--r-lg); }

.sentinel { height: 1px; }

/* ---------- Sign-in ---------- */
.login {
  min-height: 100svh;
  display: grid;
  /* The wall gets what the panel leaves, so the sign-in button is always on screen. */
  grid-template-rows: clamp(150px, calc(100svh - 430px), 460px) auto;
  overflow: hidden;
}
.login__wall {
  position: relative;
  display: grid; align-content: center; gap: 12px;
  padding-top: var(--safe-top);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 50%, transparent 98%);
  mask-image: linear-gradient(to bottom, #000 50%, transparent 98%);
}
.wall-row {
  display: flex; gap: 12px; width: max-content;
  transform: rotate(-4deg);
  animation: drift 90s linear infinite;
}
.wall-row--1 { animation-duration: 120s; animation-direction: reverse; margin-left: -60px; }
.wall-row--2 { animation-duration: 105s; }
.wall-row img {
  width: 96px; height: auto; aspect-ratio: 2 / 3;
  border-radius: var(--r-sm); object-fit: cover; background: var(--surface);
}
@keyframes drift {
  from { transform: rotate(-4deg) translateX(0); }
  to { transform: rotate(-4deg) translateX(-50%); }
}

.login__panel {
  position: relative; z-index: 1;
  display: grid; gap: 14px; align-content: start;
  width: 100%; max-width: 560px;
  padding: 0 24px calc(36px + var(--safe-bottom));
}
.login__title {
  font: 800 clamp(2.6rem, 11vw, 4.4rem)/0.92 var(--font-display);
  text-transform: uppercase; letter-spacing: 0.005em;
  text-wrap: balance;
}
.login__lede { color: var(--text-2); max-width: 42ch; font-size: 16px; }
.login__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 44px; margin-top: 10px; }
.login__google { min-height: 44px; }
.login__status { color: var(--text-2); font-size: 14px; min-height: 1.5em; }
.login__status:empty { display: none; }

@media (min-width: 900px) {
  .login { grid-template-columns: minmax(420px, 5fr) 7fr; grid-template-rows: 100svh; }
  .login__panel { order: -1; align-self: center; padding: 48px clamp(40px, 6vw, 88px); }
  .login__wall {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 28%);
    mask-image: linear-gradient(to right, transparent, #000 28%);
  }
  .wall-row img { width: 150px; }
}

/* ---------- Preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  /* Fewer, gentler animations: keep fades, drop movement. */
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .wall-row { animation: none; }
  .sheet__panel, .sheet[data-open] .sheet__panel {
    transform: none; opacity: 0;
    transition: opacity 200ms ease;
  }
  @media (min-width: 768px) {
    .sheet__panel, .sheet[data-open] .sheet__panel { transform: translate(-50%, -50%); }
  }
  .sheet[data-open] .sheet__panel { opacity: 1; }
  .toast, .toast[data-state] { transform: none; }
  .menu[data-state="closed"] { transform: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar, .tabbar { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .deck-glow { display: none; }
}

@media (forced-colors: active) {
  .ticket__stub, .act, .chip, .btn { border: 1px solid CanvasText; }
}
