:root {
  --bg: #090909;
  --panel: #151515;
  --panel-2: #1f1f1f;
  --text: #f5f5f5;
  --muted: #999;
  --yellow-star: #f5c542;
  --black-star: #000000;
  --danger: #ff3b30;
  --success: #ffd84d;
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

body { overscroll-behavior: none; }

.app-shell {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(var(--safe-top) + 16px) 18px calc(var(--safe-bottom) + 16px);
  display: flex;
  flex-direction: column;
}

a { color: var(--success); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 16px 22px;
  font-size: 17px;
  font-weight: 700;
  background: var(--success);
  color: #0c0c0c;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: transform .08s ease, opacity .2s ease;
}
.btn:active { transform: scale(.98); }
.btn.secondary { background: var(--panel-2); color: var(--text); }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- Home ---------- */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}
.hero h1 {
  font-size: 40px;
  line-height: 1.05;
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hero .sub {
  color: var(--muted);
  font-size: 16px;
  margin: 0 0 6px;
  line-height: 1.4;
}
textarea.movies-input {
  width: 100%;
  min-height: 200px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid #2a2a2a;
  border-radius: var(--radius);
  padding: 16px;
  font-size: 16px;
  line-height: 1.5;
  resize: vertical;
  font-family: inherit;
}
textarea.movies-input:focus { outline: none; border-color: var(--success); }

.brand {
  font-size: 13px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ---------- Typeahead suggestions ---------- */
.suggestion-list {
  margin-top: 10px;
  background: var(--panel);
  border: 1px solid #2a2a2a;
  border-radius: 14px;
  overflow: hidden;
}
.suggestion-hint {
  font-size: 12px;
  color: var(--muted);
  padding: 10px 14px 4px;
}
.suggestion {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 8px 14px;
  cursor: pointer;
  border-top: 1px solid #222;
  font-size: 15px;
}
.suggestion:hover { background: var(--panel-2); }
.suggestion img {
  width: 34px;
  height: 51px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.suggestion-noposter {
  width: 34px;
  height: 51px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
  border-radius: 6px;
  flex-shrink: 0;
}
.suggestion-title em { color: var(--muted); font-style: normal; }

/* ---------- TMDB attribution ---------- */
.attribution {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid #1d1d1d;
  display: flex;
  align-items: center;
  gap: 12px;
}
.attribution img { display: block; flex-shrink: 0; opacity: .9; }
.attribution p {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}

/* ---------- Flash / messages ---------- */
.flash {
  background: var(--panel-2);
  border-left: 3px solid var(--success);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 10px;
}
.flash.error { border-left-color: var(--danger); }

/* ---------- Progress ---------- */
.progress-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}
.progress-track {
  flex: 1;
  height: 6px;
  background: var(--panel-2);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 999px;
  transition: width .3s ease;
}

/* ---------- Rating stage ---------- */
.rate-stage {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.swipe-hints {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  padding: 0 2px;
  z-index: 0;
}
.swipe-hint {
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #444;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}
.swipe-hint.left { transform: rotate(180deg); }

.card-deck {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* The card is a single poster panel, capped at 500px tall. Details overlay
   the bottom of the poster so total height never exceeds the cap. */
.movie-card {
  position: relative;
  width: 100%;
  max-width: 340px;
  height: min(500px, 72vh);
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
}

.poster-wrap {
  position: relative;
  width: 100%;
  background: linear-gradient(160deg, #222, #0c0c0c);
}
/* The swipe card fills its fixed-height card; recommendation cards use an
   aspect-ratio (set in the Recommendations section) instead. */
.movie-card .poster-wrap {
  position: absolute;
  inset: 0;
  height: 100%;
}
.poster-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Anchor to the top so the top third of the poster (faces/title) is kept
     when a tall poster is cropped to a shorter card, instead of cutting heads. */
  object-position: center top;
  display: block;
  pointer-events: none;
}
.poster-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
}

.card-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 56px 16px 16px;
  background: linear-gradient(
    to top,
    rgba(0,0,0,.94) 0%,
    rgba(0,0,0,.78) 42%,
    rgba(0,0,0,0) 100%
  );
  pointer-events: none;
}
.card-meta h2 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
}
.card-meta .year { color: var(--muted); font-weight: 600; }
.card-meta .genres {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}
.genre-pill {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
}
.card-meta .overview {
  font-size: 13px;
  color: #cfcfcf;
  line-height: 1.4;
  margin: 8px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Live rating preview overlays on the poster */
.rating-overlay {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s ease;
}
.rating-overlay.active { opacity: 1; }
.rating-badge {
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(6px);
  border-radius: 14px;
  padding: 12px 16px;
  text-align: center;
  min-width: 210px;
  border: 1px solid rgba(255,255,255,.08);
}
.rating-badge .stars { font-size: 26px; letter-spacing: 2px; line-height: 1; }
.rating-badge .label {
  font-size: 18px;
  font-weight: 800;
  margin-top: 6px;
}
.rating-badge .desc {
  font-size: 12px;
  color: #d8d8d8;
  margin-top: 4px;
  line-height: 1.3;
}
.star-yellow { color: var(--yellow-star); }
.star-black {
  color: var(--black-star);
  -webkit-text-stroke: 1px rgba(245,245,245,.85);
  text-shadow: 0 0 1px rgba(245,245,245,.85);
}
.star-skip { color: var(--muted); }

/* Direction tint while dragging */
.movie-card[data-dir="right"] { box-shadow: 0 24px 60px rgba(245,200,66,.25); }
.movie-card[data-dir="left"]  { box-shadow: 0 24px 60px rgba(0,0,0,.85); }
.movie-card[data-dir="down"]  { box-shadow: 0 24px 60px rgba(140,140,140,.35); }

/* Manual rating controls (fallback / accessibility) — sit below the card */
.manual-rate {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 5px;
  margin-top: 16px;
  width: 100%;
  max-width: 360px;
}
.rate-chip {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 2px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease,
    background .12s ease, box-shadow .12s ease;
}
.rate-chip .chip-stars {
  font-size: 15px;
  letter-spacing: 1px;
  line-height: 1;
}
.rate-chip.skip {
  flex: 0 0 auto;
  min-width: 50px;
  flex-direction: column;
  gap: 2px;
  color: var(--muted);
}
.rate-chip.skip .chip-skip-icon { font-size: 16px; line-height: 1; }
.rate-chip.skip .chip-skip-label {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1.1;
  text-align: center;
}

/* Live highlight: the chip matching the current drag gesture */
.rate-chip.preview {
  transform: translateY(-5px) scale(1.12);
  background: #333;
  border-width: 2px;
}
.rate-chip.preview .chip-stars { font-size: 17px; }
.rate-chip.pos.preview {
  border-color: var(--yellow-star);
  box-shadow: 0 6px 22px rgba(245,200,66,.55);
}
.rate-chip.neg.preview {
  border-color: rgba(245,245,245,.9);
  box-shadow: 0 6px 22px rgba(245,245,245,.3);
}
.rate-chip.skip.preview {
  border-color: var(--muted);
  color: var(--text);
  box-shadow: 0 6px 22px rgba(150,150,150,.4);
}

/* Text-only chips (recommendation cards) keep their tint */
.rate-chip.pos { color: var(--yellow-star); }
.rate-chip.neg { color: #f5f5f5; }

/* ---------- Recommendations ---------- */
.page-head { margin-bottom: 16px; }
.page-head h1 { font-size: 28px; margin: 0 0 6px; font-weight: 800; }

/* Genre sections */
.genre-section { margin-bottom: 26px; }
.genre-heading {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #222;
  display: flex;
  align-items: center;
  gap: 8px;
}
.genre-heading::before {
  content: "";
  width: 8px;
  height: 18px;
  border-radius: 3px;
  background: var(--success);
}

/* Full-screen refill overlay (shown via hx-indicator while rating) */
.rec-loading {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(9, 9, 9, .82);
  backdrop-filter: blur(2px);
  pointer-events: none;
}
.rec-loading.htmx-indicator { opacity: 0; }
.htmx-request .rec-loading.htmx-indicator,
.rec-loading.htmx-indicator.htmx-request { opacity: 1; pointer-events: all; }
.taste-summary {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: #d8d8d8;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 18px;
}
/* Cards are ~40% smaller than before (compact fonts/padding + clamped text). */
.rec-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 520px) {
  .rec-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 860px) {
  /* Desktop: four movies per row. */
  .app-shell { max-width: 1100px; }
  .rec-grid { grid-template-columns: repeat(4, 1fr); }
}
.rec-card {
  background: var(--panel);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.rec-card .poster-wrap { aspect-ratio: 16 / 10; }
/* Take the poster out of flow so the aspect-ratio box drives the height
   (otherwise the portrait image's intrinsic height wins). */
.rec-card .poster-wrap img { position: absolute; inset: 0; }
.rec-body { padding: 9px 10px 11px; }
.rec-body h3 { margin: 0 0 1px; font-size: 14px; font-weight: 800; line-height: 1.15; }
.rec-body .year { color: var(--muted); font-size: 11px; }
.rec-category {
  display: inline-block;
  margin: 5px 0;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--success);
  background: rgba(245,216,77,.1);
  padding: 3px 7px;
  border-radius: 999px;
}
.rec-reason {
  font-size: 11px;
  color: #cfcfcf;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rec-reason strong { color: var(--text); }
.rec-overview {
  font-size: 10px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Click the synopsis / why text to expand it, click again to collapse. */
.expandable { cursor: pointer; }
.rec-overview.expanded,
.rec-reason.expanded {
  -webkit-line-clamp: unset;
  overflow: visible;
}

.rec-rate {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 9px;
}
.rec-rate-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.rec-rate .rate-chip {
  padding: 6px 2px;
  min-height: 0;
}
.rec-rate .rate-chip .chip-stars { font-size: 13px; letter-spacing: 1px; }
/* Hover highlights the star and the hint line explains its meaning. */
.rec-rate .rate-chip:hover {
  transform: translateY(-2px);
  background: #333;
}
.rec-rate .rate-chip.pos:hover { border-color: var(--yellow-star); }
.rec-rate .rate-chip.neg:hover { border-color: rgba(245,245,245,.9); }
.rec-rate-hint {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.3;
  /* Always occupy exactly two lines so the card doesn't resize whether a short
     or long rating description is shown. */
  min-height: 2.6em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color .12s ease;
}
.rec-rate-hint.show { color: var(--text); }

/* ---------- Empty / loading states ---------- */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 14px;
  color: var(--muted);
}
.empty-state h2 { color: var(--text); margin: 0; }

.htmx-indicator { opacity: 0; transition: opacity .2s ease; }
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-request.htmx-indicator { opacity: 1; }

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--panel-2);
  border-top-color: var(--success);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.center-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 0;
  color: var(--muted);
}

/* ---------- Accounts: auth pages + account bar ---------- */
.auth-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  max-width: 460px;
  margin: 0 auto;
  width: 100%;
}
.auth-page h1 { font-size: 30px; margin: 0; font-weight: 800; }
.auth-page .sub { color: var(--muted); margin: 0 0 8px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.auth-form label,
.account-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field-row { display: flex; gap: 12px; }
.field-row label { flex: 1; }
.auth-form input,
.account-form input {
  background: var(--panel);
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 16px;
  color: var(--text);
  width: 100%;
}
.auth-form input:focus,
.account-form input:focus { outline: none; border-color: var(--success); }
.field-error { color: var(--danger); font-size: 12px; }
.auth-alt { font-size: 14px; color: var(--muted); margin: 4px 0 0; }

.account-bar {
  background: var(--panel);
  border: 1px solid #232323;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 14px;
}
.account-bar.signed-in {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: #d8d8d8;
}
.account-link, .account-alt a { color: var(--success); text-decoration: none; }
.account-bar.register summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  color: #d8d8d8;
}
.account-bar.register summary::-webkit-details-marker { display: none; }
.account-cta {
  flex-shrink: 0;
  background: var(--success);
  color: #0c0c0c;
  font-weight: 800;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 999px;
}
.account-bar.register[open] summary .account-cta { display: none; }
.account-form { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.account-form-row { display: flex; gap: 10px; }
.account-form-row input { flex: 1; }
.account-alt { font-size: 13px; color: var(--muted); margin: 2px 0 0; text-align: center; }

/* ---------- Ratings tutorial ---------- */
.tutorial-help {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid #333;
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
}
.tutorial-help:hover { color: var(--text); border-color: var(--success); }

.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(6, 6, 6, .86);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.tutorial-overlay[hidden] { display: none; }
.tutorial-card {
  background: var(--panel);
  border: 1px solid #262626;
  border-radius: 20px;
  padding: 22px 20px 20px;
  max-width: 380px;
  width: 100%;
  text-align: center;
}
.tutorial-card h2 { margin: 0 0 4px; font-size: 24px; font-weight: 800; }
.tutorial-card .tutorial-sub { margin: 0 0 6px; color: var(--muted); font-size: 14px; }

/* Animated demo: a mini card + finger that swipes right, left, then down. */
.tutorial-demo {
  position: relative;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0 10px;
}
.demo-arrow {
  position: absolute;
  font-size: 26px;
  font-weight: 800;
  color: #3a3a3a;
}
.demo-arrow.demo-left { left: 6px; top: 50%; transform: translateY(-50%); animation: arrowLeft 6s infinite; }
.demo-arrow.demo-right { right: 6px; top: 50%; transform: translateY(-50%); animation: arrowRight 6s infinite; }
.demo-arrow.demo-down { bottom: 2px; left: 50%; transform: translateX(-50%); animation: arrowDown 6s infinite; }

.demo-swiper {
  position: relative;
  width: 86px;
  height: 124px;
  animation: swipeDemo 6s cubic-bezier(.3,.7,.3,1) infinite;
  will-change: transform;
}
.demo-mini-card {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: linear-gradient(160deg, #2c2c2c, #161616);
  border: 1px solid #3a3a3a;
  box-shadow: 0 14px 30px rgba(0,0,0,.5);
}
.demo-hand {
  position: absolute;
  right: -6px;
  bottom: -10px;
  font-size: 30px;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.6));
}

@keyframes swipeDemo {
  0%, 8%      { transform: translate(0,0) rotate(0); }
  16%         { transform: translate(64px,0) rotate(10deg); }   /* right */
  26%, 34%    { transform: translate(0,0) rotate(0); }
  42%         { transform: translate(-64px,0) rotate(-10deg); } /* left */
  52%, 60%    { transform: translate(0,0) rotate(0); }
  70%         { transform: translate(0,58px) rotate(0); }       /* down */
  80%, 100%   { transform: translate(0,0) rotate(0); }
}
@keyframes arrowRight { 0%,8%{color:#3a3a3a} 16%{color:var(--yellow-star)} 26%,100%{color:#3a3a3a} }
@keyframes arrowLeft  { 0%,34%{color:#3a3a3a} 42%{color:#f5f5f5} 52%,100%{color:#3a3a3a} }
@keyframes arrowDown  { 0%,60%{color:#3a3a3a} 70%{color:var(--muted)} 80%,100%{color:#3a3a3a} }

.tutorial-legend {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tutorial-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #cfcfcf;
  line-height: 1.3;
}
.tutorial-legend li strong { color: var(--text); }
.leg-arrow { font-size: 18px; font-weight: 800; color: var(--muted); width: 18px; flex-shrink: 0; }
.tutorial-legend .chip-stars { font-size: 14px; flex-shrink: 0; }
.leg-skip { font-size: 16px; color: var(--muted); flex-shrink: 0; }
@media (prefers-reduced-motion: reduce) {
  .demo-swiper, .demo-arrow { animation: none; }
}

/* "See recommendations" escape hatch on the rating progress bar */
.finish-link {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 800;
  color: #0c0c0c;
  background: var(--success);
  padding: 5px 12px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
}

/* ---------- Logo: shared header + home brand ---------- */
.site-header {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}
.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}
.site-logo img { display: block; }
.site-logo-word {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text);
}
.site-logo-word span { color: var(--success); }

.home-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  margin-bottom: 8px;
}
/* ~2× the icon, capped so it never overflows a narrow phone. */
.home-brand img {
  display: block;
  width: clamp(58px, 18vw, 92px);
  height: auto;
}
.home-brand-word {
  font-size: clamp(34px, 10vw, 59px);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
  color: var(--text);
}
.home-brand-word span { color: var(--success); }

/* ---------- Home account bar (login / greeting) ---------- */
.home-account {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 38px;
  margin-bottom: 2px;
}
.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--panel-2);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 15px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: background .15s ease;
}
.account-btn:hover { background: #2c2c2c; }
.account-btn svg { display: block; }
.home-greeting { color: var(--muted); font-size: 14px; }
.home-greeting strong { color: var(--text); font-weight: 700; }

/* ---------- Recommendation card: tap poster to expand to centre ---------- */
.rec-card { position: relative; }
.rec-card .poster-wrap { cursor: pointer; }

.rec-expand-hint {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .85;
  pointer-events: none;
}

.rec-close {
  display: none;
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 4;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

#rec-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: none;
  background: rgba(6, 6, 6, .82);
  backdrop-filter: blur(3px);
}
#rec-modal-backdrop.show { display: block; }
body.rec-modal-open { overflow: hidden; }
#rec-loading { z-index: 120; }

/* The expanded, centred card — large readable text. */
.rec-card.expanded {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(480px, 92vw);
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
  z-index: 100;
  border: 1px solid #333;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .75);
}
.rec-card.expanded .rec-expand-hint { display: none; }
.rec-card.expanded .rec-close { display: flex; align-items: center; justify-content: center; }
.rec-card.expanded .poster-wrap { aspect-ratio: 16 / 11; cursor: default; }
.rec-card.expanded .rec-body { padding: 18px 20px 22px; }
.rec-card.expanded h3 { font-size: 26px; line-height: 1.15; margin-bottom: 4px; }
.rec-card.expanded .year { font-size: 15px; }
.rec-card.expanded .rec-category { font-size: 12px; padding: 5px 12px; margin: 12px 0; }
.rec-card.expanded .rec-overview,
.rec-card.expanded .rec-reason {
  font-size: 16px;
  line-height: 1.5;
  margin-top: 12px;
  -webkit-line-clamp: unset;
  overflow: visible;
}
.rec-card.expanded .rec-overview { color: #c6c6c6; }
.rec-card.expanded .rec-reason { color: #e8e8e8; }
.rec-card.expanded .rec-rate { margin-top: 20px; gap: 8px; }
.rec-card.expanded .rec-rate-hint { font-size: 14px; min-height: 2.4em; }
.rec-card.expanded .rec-rate .rate-chip { min-height: 50px; }
.rec-card.expanded .rec-rate .rate-chip .chip-stars { font-size: 20px; }

/* ---------- Recommendation: dismiss without rating ---------- */
.rec-dismiss {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 7px 4px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  border-top: 1px solid #202020;
}
.rec-dismiss:hover { color: var(--text); }
.rec-card.expanded .rec-dismiss {
  margin-top: 16px;
  padding: 12px 4px;
  font-size: 14px;
}

/* ---------- Section nav tabs (logged-in) ---------- */
.app-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.app-nav a {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid #222;
}
.app-nav a:hover { color: var(--text); }
.app-nav a.on { background: var(--success); color: #0c0c0c; border-color: var(--success); }

/* ---------- Two-up dismiss row on recommendation cards ---------- */
.rec-dismiss-row {
  display: flex;
  margin-top: 10px;
  border-top: 1px solid #202020;
}
.rec-dismiss-row .rec-dismiss {
  flex: 1;
  margin-top: 0;
  border-top: none;
}
.rec-dismiss-row .rec-dismiss + .rec-dismiss { border-left: 1px solid #202020; }
.rec-card.expanded .rec-dismiss-row { margin-top: 16px; }

/* ---------- List pages (history / watch later / not interested) ---------- */
.list-wrap { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  display: flex;
  gap: 12px;
  background: var(--panel);
  border: 1px solid #222;
  border-radius: 14px;
  padding: 10px;
}
.list-thumb {
  width: 54px;
  flex-shrink: 0;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 20px;
}
.list-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.list-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
}
.list-title { font-size: 15px; font-weight: 700; color: var(--text); }
.list-year { color: var(--muted); font-weight: 600; font-size: 13px; }
.list-sub { font-size: 12px; color: var(--muted); line-height: 1.35; }
.clamp2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.list-stars { font-size: 17px; letter-spacing: 1px; flex-shrink: 0; align-self: center; }
.list-actions { margin-top: 4px; }
.list-actions form { display: flex; flex-wrap: wrap; gap: 6px; }
.list-btn {
  border: 1px solid #333;
  background: var(--panel-2);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.list-btn:hover { background: #2a2a2a; }
.list-btn.primary { background: var(--success); color: #0c0c0c; border-color: var(--success); }
