/* movie-swipe — mobile-first, dark, mono. */

:root {
  --bg: #0b0d10;
  --panel: #14181e;
  --panel-2: #1b212a;
  --line: #242c36;
  --text: #e8edf2;
  --muted: #8a94a1;
  --like: #35d07f;
  --nope: #ff5468;
  --amber: #f5c518;
  --radius: 18px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* author display rules (.screen etc.) must never override the hidden attribute */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  background: #05070a;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

@media (min-width: 431px) {
  #app { border-inline: 1px solid var(--line); }
}

.screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- filters screen ---------- */

.brand { padding: 28px 20px 10px; }
.brand h1 { font-size: 26px; letter-spacing: -0.02em; }
.brand h1::after { content: "_"; color: var(--like); animation: blink 1.2s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.tagline { color: var(--muted); font-size: 13px; margin-top: 6px; }

.filters {
  flex: 1;
  overflow-y: auto;
  padding: 6px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.f-block { border: none; }
.f-block legend, .f-head {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 12px;
}
.hint { color: var(--muted); font-size: 11px; }
.f-head output { color: var(--amber); font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12.5px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chip .n { opacity: 0.55; font-size: 10.5px; }
.chip[aria-pressed="true"] {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}
.chip[aria-pressed="true"] .n { opacity: 0.7; }

.dual { position: relative; height: 32px; }
.dual .track, .dual .fill {
  position: absolute;
  top: 50%;
  height: 3px;
  transform: translateY(-50%);
  border-radius: 2px;
  pointer-events: none;
}
.dual .track { left: 0; right: 0; background: var(--line); }
.dual .fill { background: var(--amber); }
.dual input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: none;
  pointer-events: none;
  z-index: 1;
}
/* set by JS when both thumbs sit in the upper half, so the min thumb stays grabbable */
.dual input[type="range"].top { z-index: 2; }
.dual input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  pointer-events: auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--text);
  border: 4px solid var(--bg);
  box-shadow: 0 0 0 1px var(--line);
  cursor: grab;
}
.dual input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  border: 4px solid var(--bg);
  box-shadow: 0 0 0 1px var(--line);
  cursor: grab;
}
.dual input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--amber); }
.dual input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--amber); }

.start-bar {
  padding: 10px 20px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fine { color: var(--muted); font-size: 11.5px; text-align: center; }
.credit { opacity: 0.7; }
/* muted, not the green accent: these are required links, not calls to action */
.credit a { color: var(--muted); text-underline-offset: 3px; }

/* Shown only when JS is off. #app is a full-height flex column that would
   otherwise sit on top of this, so the card is positioned above it. */
.noscript-card {
  position: relative;
  z-index: 10;
  max-width: 34em;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  line-height: 1.7;
}
.noscript-card h1 { font-size: 26px; margin-bottom: 1rem; }
.noscript-card p { color: #b7c0cb; margin-bottom: 0.9rem; }
.noscript-card a { color: var(--muted); }

.cta {
  width: 100%;
  padding: 15px;
  border-radius: 12px;
  background: var(--like);
  color: #06130c;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}
.cta:active { transform: scale(0.98); }
.cta[disabled] { opacity: 0.5; }

/* ---------- home results hub ---------- */

.results { padding: 4px 20px 16px; display: flex; flex-direction: column; gap: 8px; }
.result-card {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid rgba(245, 197, 24, 0.4);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.result-card:active { transform: scale(0.99); }
.rc-big { color: var(--amber); font-weight: 700; font-size: 15px; }
.rc-sub { color: var(--muted); font-size: 12px; }
.result-link {
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.result-link:active { background: var(--panel); }

/* ---------- tonight picks ---------- */

.picks { display: flex; flex-direction: column; gap: 10px; }
.pick {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  align-items: center;
}
.pick .pk-poster {
  width: 64px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  background: var(--panel-2);
}
.pick .pk-title { font-weight: 700; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pick .pk-meta { color: var(--muted); font-size: 11.5px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.pick .pk-why { color: var(--amber); font-size: 11px; margin-top: 4px; }
.pick .pk-actions { display: flex; gap: 6px; margin-top: 8px; }
.pick .t-btn {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.pick .t-btn .ico { width: 1.1em; height: 1.1em; }
.pick .t-btn.mark-seen { color: var(--amber); border-color: rgba(245, 197, 24, 0.35); }
.pick .t-btn.save-btn { color: var(--like); border-color: rgba(53, 208, 127, 0.4); }

/* ---------- deck screen ---------- */

.deck-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  gap: 8px;
}
.icon-btn {
  min-width: 44px;
  height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 17px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:active { background: var(--panel); }
.likes-btn { color: var(--like); font-size: 14px; }
.library-btn { color: var(--amber); font-size: 14px; gap: 6px; font-variant-numeric: tabular-nums; }
.ico { width: 1em; height: 1em; fill: currentColor; display: block; }
.icon-btn .ico, .round .ico { width: 1.05em; height: 1.05em; }
.deck-status { color: var(--muted); font-size: 12px; text-align: center; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.stack { flex: 1; position: relative; margin: 4px 16px 10px; }

.card {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
}
.card.pos1 { transform: scale(0.955) translateY(14px); }
.card.pos2 { transform: scale(0.91) translateY(28px); }
.card.pos1, .card.pos2 { transition: transform 0.25s ease; pointer-events: none; }

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
  background: var(--panel-2);
}

.card .fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 26px;
}
.fallback { align-items: center; }
.fallback .fb-year { color: rgba(255, 255, 255, 0.55); font-size: 52px; font-weight: 800; letter-spacing: 0.04em; }

.card .scrim {
  position: absolute;
  inset: auto 0 0 0;
  padding: 46px 16px 16px;
  background: linear-gradient(transparent, rgba(4, 6, 9, 0.55) 35%, rgba(4, 6, 9, 0.92));
}
.card .title { font-size: 21px; font-weight: 700; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { color: #b7c0cb; font-size: 12.5px; margin-top: 5px; }

.card .badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(8, 10, 13, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 700;
  color: var(--amber);
  backdrop-filter: blur(4px);
}
.card .badge .votes { color: var(--muted); font-weight: 400; font-size: 10.5px; }

.stamp {
  position: absolute;
  top: 22px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 4px 12px;
  border: 3px solid;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
}
/* horizontal = verdict on a seen film; zone 2 (a longer pull) snaps bigger and brighter */
.stamp.pos { left: 14px; color: rgba(53, 208, 127, 0.75); border-color: rgba(53, 208, 127, 0.75); transform: rotate(-14deg); }
.stamp.neg { right: 14px; color: rgba(255, 84, 104, 0.75); border-color: rgba(255, 84, 104, 0.75); transform: rotate(14deg); }
.stamp.pos.z2 { color: var(--like); border-color: var(--like); font-size: 32px; border-width: 4px; }
.stamp.neg.z2 { color: var(--nope); border-color: var(--nope); font-size: 32px; border-width: 4px; }
.stamp.save { left: 50%; color: var(--amber); border-color: var(--amber); transform: translateX(-50%) rotate(-4deg); }
.stamp.skip { left: 50%; color: var(--muted); border-color: var(--muted); transform: translateX(-50%) rotate(4deg); }

.deck-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 6px 0 calc(16px + env(safe-area-inset-bottom));
}
.round {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--panel);
  border: 1.5px solid var(--line);
  font-size: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s;
}
.round:active { transform: scale(0.9); }
.round.grade-btn { width: 46px; height: 46px; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.round.gb1 { color: var(--nope); border-color: rgba(255, 84, 104, 0.55); }
.round.gb2 { color: rgba(255, 84, 104, 0.65); border-color: rgba(255, 84, 104, 0.35); }
.round.gb3 { color: rgba(53, 208, 127, 0.75); border-color: rgba(53, 208, 127, 0.4); }
.round.gb4 { color: var(--like); border-color: rgba(53, 208, 127, 0.6); }
/* the middle pair is the vertical-gesture legend: save above, skip below */
.v-pair { display: flex; flex-direction: column; gap: 6px; }
.v-btn {
  width: 54px; height: 34px; border-radius: 10px;
  background: var(--panel); border: 1.5px solid var(--line); font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
}
.v-btn:active { transform: scale(0.92); }
.v-btn.save { color: var(--amber); border-color: rgba(245, 197, 24, 0.45); }
.v-btn.skip { color: var(--muted); }
.round.small { width: 46px; height: 46px; font-size: 18px; color: var(--muted); }
.round[disabled] { opacity: 0.4; }

.deck-empty {
  /* lives inside .stack, so it only ever covers the card area */
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px;
  text-align: center;
}
.deck-empty .cta { max-width: 240px; }

.big { font-size: 19px; font-weight: 700; }
.sub { color: var(--muted); font-size: 13px; }
.center { text-align: center; padding: 24px 16px; }
.center-all { align-items: center; justify-content: center; gap: 12px; padding: 32px; text-align: center; }
#screen-error .cta { max-width: 200px; }

/* ---------- likes screen ---------- */

.scroll-body { flex: 1; overflow-y: auto; padding: 4px 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 18px; }

.eyebrow { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }

.taste { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.taste-row { display: grid; grid-template-columns: 92px 1fr auto; gap: 10px; align-items: center; font-size: 12px; margin-bottom: 7px; }
.taste-row:last-child { margin-bottom: 0; }
.taste-row .g { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* signed quantity, so the bar diverges from a centre axis: right = liked,
   left = avoided, and a genuinely neutral genre sits visibly on the line */
.taste-row .bar { position: relative; height: 8px; border-radius: 2px; background: var(--panel-2); }
.taste-row .bar::before {
  content: ""; position: absolute; left: 50%; top: -1px; bottom: -1px;
  width: 1px; background: var(--line); transform: translateX(-0.5px);
}
.taste-row .bar i { position: absolute; top: 1px; bottom: 1px; min-width: 2px; border-radius: 1px; background: var(--like); }
.taste-row .bar i.neg { background: var(--nope); }
.taste-row .bar i.zero { background: var(--muted); }
.taste-row .c { color: var(--muted); font-size: 11px; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile { position: relative; border-radius: 12px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); }
.tile .ph { aspect-ratio: 2 / 3; background: var(--panel-2); }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .fallback { position: static; aspect-ratio: 2 / 3; padding: 14px; display: flex; align-items: center; justify-content: center; }
.tile .fallback .fb-year { font-size: 22px; }
.tile figcaption { padding: 8px 10px 10px; font-size: 12px; }
.tile .t-title { font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .t-meta { color: var(--muted); font-size: 11px; margin-top: 2px; }
.tile .unlike {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(8, 10, 13, 0.72);
  color: #d6dde4;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.danger {
  margin-top: 4px;
  padding: 12px;
  border: 1px solid rgba(255, 84, 104, 0.45);
  border-radius: 10px;
  color: var(--nope);
  font-size: 13px;
}

/* per-tile actions on library tiles */
.tile .t-actions { display: flex; gap: 6px; padding: 0 8px 9px; }
.tile .t-btn {
  flex: 1;
  padding: 7px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.tile .t-btn.mark-seen { color: var(--amber); border-color: rgba(245, 197, 24, 0.35); }
.tile .t-btn .ico { width: 1.1em; height: 1.1em; }

/* grade badge on seen tiles: 1 red .. 4 green, amber-free so it can't be
   mistaken for the IMDb rating */
.grade-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 16px;
  background: rgba(8, 10, 13, 0.82);
  border: 1.5px solid;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}
.grade-badge[data-grade="1"] { color: var(--nope); border-color: var(--nope); }
.grade-badge[data-grade="2"] { color: rgba(255, 84, 104, 0.65); border-color: rgba(255, 84, 104, 0.55); }
.grade-badge[data-grade="3"] { color: rgba(53, 208, 127, 0.75); border-color: rgba(53, 208, 127, 0.6); }
.grade-badge[data-grade="4"] { color: var(--like); border-color: var(--like); }

/* ---------- library tabs ---------- */

.tabs {
  flex: 1;
  display: flex;
  gap: 6px;
  justify-content: center;
  min-width: 0;
}
.tab {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tab[aria-selected="true"] {
  color: var(--text);
  background: var(--panel);
  border-color: var(--line);
}
.tab span { color: var(--muted); font-size: 11px; }

/* ---------- grade dialog ---------- */

.grader {
  position: absolute;
  inset: 0;
  z-index: 90;
  background: rgba(4, 6, 9, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.grader-panel {
  width: 100%;
  max-width: 340px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}
.grader-eyebrow { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); }
.grader-film { font-size: 16px; font-weight: 700; line-height: 1.25; text-wrap: balance; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grade {
  padding: 12px 4px 10px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--panel-2);
  font-size: 20px;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}
.grade span { font-size: 10.5px; font-weight: 400; letter-spacing: 0.04em; }
.grade:active { transform: scale(0.94); }
.grade[data-grade="1"] { color: var(--nope); border-color: rgba(255, 84, 104, 0.55); }
.grade[data-grade="2"] { color: rgba(255, 84, 104, 0.65); border-color: rgba(255, 84, 104, 0.35); }
.grade[data-grade="3"] { color: rgba(53, 208, 127, 0.75); border-color: rgba(53, 208, 127, 0.4); }
.grade[data-grade="4"] { color: var(--like); border-color: rgba(53, 208, 127, 0.6); }
.grade span { color: var(--muted); }
.grader-cancel {
  padding: 10px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  border: 1px solid transparent;
}
.grader-cancel:active { background: var(--panel-2); }

/* ---------- about this film ---------- */

/* Top-LEFT, opposite the rating badge. The two are the only things floating
   over the artwork and putting them on the same side makes the corner read as
   a toolbar, which invites a mis-tap on the surface you swipe. */
.card .info-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(8, 10, 13, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #cbd4de;
  backdrop-filter: blur(4px);
  /* the card sets touch-action: none for dragging; the button must not */
  touch-action: auto;
}
.card .info-btn .ico { width: 17px; height: 17px; }
.card .info-btn:active { transform: scale(0.9); }

.info-panel { max-width: 380px; }
.info-title { font-size: 17px; font-weight: 700; line-height: 1.25; text-wrap: balance; }
.info-overview {
  font-size: 13.5px;
  line-height: 1.55;
  color: #b7c0cb;
  /* a long synopsis scrolls inside the panel rather than pushing the trailer
     link off the bottom of a short phone */
  max-height: 42vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.info-overview.muted { color: var(--muted); }
/* Deliberately NOT the green .cta treatment it inherits sizing from. In this
   app green means "I liked it" — it is the +1/+2 grades and the save button —
   so a green button inside the info panel reads as a verdict on the film
   rather than a link to its trailer. Neutral surface, typography carries it. */
.info-trailer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px;
  text-decoration: none;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
}
.info-trailer:active { background: var(--line); }
.info-trailer .ico { width: 18px; height: 18px; }
.pick .t-btn.about-btn { color: var(--muted); }

/* ---------- misc ---------- */

.spin {
  width: 26px;
  height: 26px;
  margin: 0 auto;
  border: 3px solid var(--line);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.stack-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

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