/* ============================================================
   CineNotes 2.0 — mobile-first design system
   ============================================================ */

:root {
  /* Surfaces */
  --bg: #0b0e14;
  --bg-raise: #11151f;
  --surface: #151a26;
  --surface-2: #1c2333;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* Text */
  --text: #f3f5fa;
  --text-2: #9aa4ba;
  --text-3: #667089;

  /* Brand */
  --accent: #f5b942;
  --accent-soft: rgba(245, 185, 66, 0.14);
  --accent-ink: #221604;
  --him: #64aef2;
  --him-soft: rgba(100, 174, 242, 0.15);
  --her: #f27ba6;
  --her-soft: rgba(242, 123, 166, 0.15);

  /* Ratings */
  --rate-great: #4bd18b;
  --rate-good: #f5b942;
  --rate-mid: #f2884d;
  --rate-bad: #e85c66;

  --danger: #e85c66;
  --danger-soft: rgba(232, 92, 102, 0.14);

  /* Shape & type */
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --font: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Layout */
  --shell-max: 680px;
  --nav-height: 62px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html { height: 100%; color-scheme: dark; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

img { display: block; max-width: 100%; }

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

input, select, textarea { font-family: inherit; }

::selection { background: rgba(245, 185, 66, 0.35); }

.icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 20px;
  border-radius: 999px;
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn .icon { width: 18px; height: 18px; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 22px rgba(245, 185, 66, 0.28);
}
.btn-primary:disabled { opacity: 0.55; box-shadow: none; }

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger-ghost {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: transform 0.12s ease, color 0.15s ease;
}
.icon-btn:active { transform: scale(0.92); }

/* ============ Fields ============ */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field label { font-size: 13.5px; font-weight: 600; color: var(--text-2); letter-spacing: 0.01em; }
.field input {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  padding: 13px 15px;
  outline: none;
  transition: border-color 0.15s ease;
  width: 100%;
}
.field input:focus { border-color: var(--accent); }
.field-hint { font-size: 12.5px; color: var(--text-3); }
.field-row { display: flex; gap: 12px; }
.field-grow { flex: 1; }
.field-sm { width: 108px; }

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 0 16px;
  transition: border-color 0.15s ease;
}
.search-field:focus-within { border-color: var(--accent); }
.search-field .icon { width: 18px; height: 18px; color: var(--text-3); }
.search-field input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15.5px;
  padding: 12px 0;
  min-width: 0;
}
.search-field input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-field-lg input { padding: 15px 0; font-size: 16px; }

/* ============ Segmented control ============ */
.segmented {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented .seg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.segmented .seg .icon { width: 15px; height: 15px; }
.segmented .seg.active { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 6px rgba(0,0,0,0.3); }
.segmented-full { width: 100%; }
.segmented-full .seg { flex: 1; }
.segmented-sm .seg { padding: 6px 14px; font-size: 13px; }

/* ============================================================
   Login
   ============================================================ */
.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px calc(28px + var(--safe-bottom));
  position: relative;
  overflow: hidden;
}

.login-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 45% at 50% -5%, rgba(245, 185, 66, 0.16), transparent 65%),
    radial-gradient(ellipse 50% 40% at 90% 110%, rgba(242, 123, 166, 0.10), transparent 60%),
    radial-gradient(ellipse 50% 40% at 5% 100%, rgba(100, 174, 242, 0.10), transparent 60%);
  pointer-events: none;
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-lang {
  position: absolute;
  top: -6px;
  right: 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 6px 12px;
}

.login-logo { width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 22px; }
.login-wordmark {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #fff 30%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-tagline { margin-top: 6px; font-size: 15.5px; font-weight: 600; color: var(--accent); }
.login-subtitle { margin: 10px auto 26px; font-size: 14.5px; line-height: 1.55; color: var(--text-2); max-width: 340px; }

.login-tabs {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 22px;
}
.login-tab {
  flex: 1;
  padding: 11px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-2);
  transition: background 0.15s ease, color 0.15s ease;
}
.login-tab.active { background: var(--surface-2); color: var(--text); }

.login-form { text-align: left; }
.login-form .btn { margin-top: 6px; }

.login-message {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
}
.login-message.error { background: var(--danger-soft); color: #ff9aa2; }
.login-message.success { background: rgba(75, 209, 139, 0.13); color: var(--rate-great); }

.login-chips {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 26px;
  flex-wrap: wrap;
}
.login-chips span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
}

/* ============================================================
   App shell
   ============================================================ */
#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 14, 20, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.topbar-inner {
  max-width: var(--shell-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 30px; height: 30px; border-radius: 9px; }
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rate-great);
  opacity: 0;
  transition: opacity 0.3s ease, background 0.3s ease;
}
.sync-dot.saving { opacity: 1; background: var(--accent); animation: pulse 1s infinite; }
.sync-dot.error { opacity: 1; background: var(--danger); }
@keyframes pulse { 50% { opacity: 0.35; } }

#main {
  flex: 1;
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 18px 18px calc(var(--nav-height) + var(--safe-bottom) + 34px);
}

.view { animation: viewIn 0.22s ease; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.view-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}
.view-header h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.view-count { font-size: 13.5px; font-weight: 600; color: var(--text-3); }
.view-subtitle { font-size: 14px; color: var(--text-2); margin-bottom: 18px; }

/* ============ Bottom nav ============ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-around;
  max-width: var(--shell-max);
  margin: 0 auto;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding: 0 8px var(--safe-bottom);
  background: rgba(15, 18, 27, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 10px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  border-radius: 14px;
  min-width: 58px;
  transition: color 0.15s ease;
}
.nav-item .icon { width: 22px; height: 22px; }
.nav-item.active { color: var(--accent); }

.nav-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  margin-top: -26px;
  box-shadow: 0 8px 24px rgba(245, 185, 66, 0.4);
  transition: transform 0.12s ease;
}
.nav-add:active { transform: scale(0.92); }
.nav-add .icon { width: 26px; height: 26px; stroke-width: 2.4; }

/* ============================================================
   Home
   ============================================================ */
.home-greeting { margin-bottom: 18px; }
.home-greeting h1 { font-size: 25px; font-weight: 800; letter-spacing: -0.02em; }
.home-greeting p { font-size: 14.5px; color: var(--text-2); margin-top: 2px; }

/* Pending ratings banner */
.pending-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(120deg, var(--accent-soft), rgba(245, 185, 66, 0.05));
  border: 1px solid rgba(245, 185, 66, 0.25);
  border-radius: var(--radius);
  padding: 13px 15px;
  margin-bottom: 18px;
}
.pending-card .icon { color: var(--accent); width: 21px; height: 21px; }
.pending-copy { flex: 1; min-width: 0; }
.pending-copy strong { display: block; font-size: 14px; font-weight: 700; }
.pending-copy span { font-size: 12.5px; color: var(--text-2); }
.pending-card .btn {
  padding: 9px 16px;
  font-size: 13.5px;
  background: var(--accent);
  color: var(--accent-ink);
}

/* Tonight card */
.tonight-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 24px;
  min-height: 190px;
  display: flex;
}
.tonight-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 20%;
}
.tonight-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(9, 11, 16, 0.95) 32%, rgba(9, 11, 16, 0.55) 70%, rgba(9, 11, 16, 0.3));
}
.tonight-content {
  position: relative;
  display: flex;
  gap: 16px;
  padding: 18px;
  width: 100%;
  align-items: center;
}
.tonight-poster {
  width: 92px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.tonight-poster img { width: 100%; aspect-ratio: 2/3; object-fit: cover; }
.tonight-info { flex: 1; min-width: 0; }
.tonight-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.tonight-kicker .icon { width: 14px; height: 14px; }
.tonight-title { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; }
.tonight-meta { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.tonight-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.tonight-actions .btn { padding: 9px 15px; font-size: 13px; }
.tonight-actions .btn-ghost { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.14); }

/* Horizontal rows */
.row-section { margin-bottom: 26px; }
.row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.row-head .icon { width: 19px; height: 19px; color: var(--accent); }
.row-head h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; flex: 1; }
.row-head .row-sub { font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.row-head .icon-btn { width: 34px; height: 34px; }
.row-head .icon-btn .icon { width: 16px; height: 16px; color: inherit; }
.row-hint { font-size: 13px; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 12px; }

.h-scroll {
  display: flex;
  gap: 11px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 2px 18px 8px;
  margin: 0 -18px;
  scrollbar-width: none;
}
.h-scroll::-webkit-scrollbar { display: none; }
.h-scroll > * { scroll-snap-align: start; flex-shrink: 0; }

/* ============ Poster cards ============ */
.pcard {
  position: relative;
  width: 124px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: left;
  padding: 0;
  display: block;
}
.pcard-poster { position: relative; aspect-ratio: 2/3; background: var(--surface-2); }
.pcard-poster img { width: 100%; height: 100%; object-fit: cover; }
.no-poster {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
}
.no-poster .icon { width: 30px; height: 30px; }

.pcard-info { padding: 9px 10px 11px; }
.pcard-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.5em;
}
.pcard-meta { font-size: 11.5px; color: var(--text-3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-reason {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent);
  opacity: 0.85;
  margin-top: 4px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.detail-reason { font-size: 12.5px; font-weight: 600; color: var(--accent); margin-top: 6px; }

.rating-chip {
  position: absolute;
  top: 7px;
  right: 7px;
  font-size: 12.5px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(10, 12, 17, 0.82);
  backdrop-filter: blur(6px);
  border: 1.5px solid;
}
.rating-chip.great { color: var(--rate-great); border-color: var(--rate-great); }
.rating-chip.good { color: var(--rate-good); border-color: var(--rate-good); }
.rating-chip.mid { color: var(--rate-mid); border-color: var(--rate-mid); }
.rating-chip.bad { color: var(--rate-bad); border-color: var(--rate-bad); }
.rating-chip.none { color: var(--text-2); border-color: var(--text-3); font-weight: 600; }

.rank-badge {
  position: absolute;
  top: 7px;
  left: 7px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 800;
  background: rgba(10, 12, 17, 0.82);
  backdrop-filter: blur(6px);
  color: var(--text-2);
}
.rank-badge.top1 { background: linear-gradient(135deg, #f7ce68, #b8860b); color: #221604; }
.rank-badge.top2 { background: linear-gradient(135deg, #e8e8ec, #9a9aa8); color: #17181f; }
.rank-badge.top3 { background: linear-gradient(135deg, #e2a06b, #8c5228); color: #241105; }

/* Card action buttons (watchlist/recs) */
.pcard-actions {
  display: flex;
  gap: 6px;
  padding: 0 8px 10px;
}
.pcard-actions .chip-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 7px 4px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  transition: background 0.15s ease, color 0.15s ease;
}
.pcard-actions .chip-btn .icon { width: 13px; height: 13px; }
.pcard-actions .chip-btn.primary { background: var(--accent-soft); color: var(--accent); border-color: rgba(245, 185, 66, 0.3); }
.pcard-actions .chip-btn.danger { flex: 0 0 auto; width: 32px; }

/* ============ Poster grid (library/watchlist) ============ */
.poster-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
  margin-top: 16px;
}
.poster-grid .pcard { width: auto; }

@media (min-width: 480px) { .poster-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 640px) { .poster-grid { grid-template-columns: repeat(5, 1fr); } }

.library-toolbar { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }

/* ============ Empty states ============ */
.empty-state {
  text-align: center;
  padding: 44px 24px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  margin-top: 20px;
}
.empty-state .empty-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.empty-state .empty-icon .icon { width: 26px; height: 26px; }
.empty-state h3 { font-size: 17.5px; font-weight: 700; margin-bottom: 6px; }
.empty-state p { font-size: 14px; color: var(--text-2); line-height: 1.5; max-width: 300px; margin: 0 auto 18px; }

/* ============================================================
   Stats
   ============================================================ */
.stats-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 11px;
  margin-top: 14px;
}
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
}
.stat-tile .stat-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.stat-tile .stat-label { font-size: 12.5px; color: var(--text-2); font-weight: 600; margin-top: 4px; }
.stat-tile.accent .stat-value { color: var(--accent); }

.stats-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 17px;
  margin-top: 14px;
}
.stats-card > h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
}
.stats-card > h3 .icon { width: 17px; height: 17px; color: var(--accent); }
.stats-note { font-size: 12.5px; color: var(--text-3); margin-top: 10px; }

/* Him vs her */
.vs-row { display: flex; align-items: center; gap: 14px; }
.vs-side { flex: 1; text-align: center; padding: 12px; border-radius: var(--radius-sm); }
.vs-side.him { background: var(--him-soft); }
.vs-side.her { background: var(--her-soft); }
.vs-side .vs-score { font-size: 24px; font-weight: 800; }
.vs-side.him .vs-score { color: var(--him); }
.vs-side.her .vs-score { color: var(--her); }
.vs-side .vs-label { font-size: 12px; font-weight: 600; color: var(--text-2); margin-top: 2px; }
.vs-x { font-size: 14px; font-weight: 800; color: var(--text-3); }

.sync-meter { margin-top: 16px; }
.sync-meter-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.sync-meter-head span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.sync-meter-head strong { font-size: 17px; font-weight: 800; color: var(--rate-great); }
.meter-track {
  height: 9px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--him), var(--her));
  transition: width 0.5s ease;
}

.fight-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.fight-poster { width: 42px; border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.fight-poster img { aspect-ratio: 2/3; object-fit: cover; width: 100%; }
.fight-info { flex: 1; min-width: 0; }
.fight-info strong { display: block; font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fight-info span { font-size: 12px; color: var(--text-2); }
.fight-scores { display: flex; gap: 6px; font-size: 13px; font-weight: 800; }
.fight-scores .him { color: var(--him); }
.fight-scores .her { color: var(--her); }

/* Bars (genres / decades) */
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.bar-label { width: 92px; font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.bar-track { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--accent); }
.bar-fill.alt { background: var(--him); }
.bar-value { width: 34px; text-align: right; font-size: 12.5px; font-weight: 700; color: var(--text-2); flex-shrink: 0; }

/* Best / worst */
.duo-row { display: flex; gap: 11px; margin-top: 14px; }
.duo-card {
  flex: 1;
  display: flex;
  gap: 11px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-width: 0;
  text-align: left;
}
.duo-poster { width: 44px; border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.duo-poster img { aspect-ratio: 2/3; object-fit: cover; width: 100%; }
.duo-info { min-width: 0; }
.duo-info .duo-kicker { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); }
.duo-info .duo-title { font-size: 13px; font-weight: 700; line-height: 1.25; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.duo-info .duo-score { font-size: 13px; font-weight: 800; margin-top: 2px; }
.duo-card.best .duo-score { color: var(--rate-great); }
.duo-card.worst .duo-score { color: var(--rate-bad); }

/* ============================================================
   Sheets (bottom drawers)
   ============================================================ */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4, 6, 10, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet {
  width: 100%;
  max-width: var(--shell-max);
  background: var(--bg-raise);
  border-radius: 24px 24px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  animation: sheetIn 0.28s cubic-bezier(0.32, 0.72, 0.25, 1);
  overflow: hidden;
}
@keyframes sheetIn { from { transform: translateY(24px); } }

.sheet-tall { height: 88dvh; }

.sheet-handle {
  width: 40px;
  height: 4.5px;
  border-radius: 999px;
  background: var(--border-strong);
  margin: 10px auto 2px;
  flex-shrink: 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px 12px;
  flex-shrink: 0;
}
.sheet-header h2 { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.sheet-close { width: 36px; height: 36px; }
.sheet-close .icon { width: 17px; height: 17px; }

.sheet-body {
  padding: 0 18px calc(22px + var(--safe-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}
.sheet-body-flush { padding: 0 0 calc(22px + var(--safe-bottom)); }

.sheet-actions { display: flex; flex-direction: column; gap: 9px; margin-top: 20px; }

.sheet-close-float {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  background: rgba(10, 12, 17, 0.65);
  backdrop-filter: blur(8px);
}
.sheet-detail { position: relative; }

/* ============ Add sheet ============ */
.add-results { margin-top: 16px; }
.add-hint { text-align: center; color: var(--text-3); font-size: 13.5px; padding: 26px 20px; }

.result-row {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.result-poster { width: 52px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--surface-2); }
.result-poster img, .result-poster .no-poster { width: 100%; aspect-ratio: 2/3; object-fit: cover; }
.result-poster .no-poster .icon { width: 18px; height: 18px; }
.result-info { flex: 1; min-width: 0; }
.result-title { font-size: 14.5px; font-weight: 700; line-height: 1.25; }
.result-meta { font-size: 12.5px; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--rate-great);
  margin-top: 4px;
}
.result-badge .icon { width: 12px; height: 12px; }
.result-actions { display: flex; gap: 7px; flex-shrink: 0; }
.result-actions .chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  background: var(--surface);
}
.result-actions .chip-btn .icon { width: 13px; height: 13px; }
.result-actions .chip-btn.primary { background: var(--accent-soft); border-color: rgba(245, 185, 66, 0.35); color: var(--accent); }

/* ============ Rate sheet ============ */
.rate-movie {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 18px;
}
.rate-movie .result-poster { width: 56px; }
.rate-movie-title { font-size: 17px; font-weight: 800; line-height: 1.2; }
.rate-movie-meta { font-size: 13px; color: var(--text-2); margin-top: 3px; }

.rate-sliders { margin-top: 18px; display: flex; flex-direction: column; gap: 20px; }
.rate-slider-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.rate-slider-head label { font-size: 14px; font-weight: 600; color: var(--text-2); }
.rate-value {
  font-size: 24px;
  font-weight: 800;
  min-width: 58px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.rate-slider[data-color="joint"] .rate-value { color: var(--accent); }
.rate-slider[data-color="him"] .rate-value { color: var(--him); }
.rate-slider[data-color="her"] .rate-value { color: var(--her); }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 34px;
  background: transparent;
  --pct: 70%;
  --track-color: var(--accent);
}
.rate-slider[data-color="him"] input[type="range"] { --track-color: var(--him); }
.rate-slider[data-color="her"] input[type="range"] { --track-color: var(--her); }

input[type="range"]::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--track-color) var(--pct), var(--surface-2) var(--pct));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--track-color);
  margin-top: -8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}
input[type="range"]::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
}
input[type="range"]::-moz-range-progress {
  height: 10px;
  border-radius: 999px;
  background: var(--track-color);
}
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--track-color);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

/* ============ Detail sheet ============ */
.detail-hero {
  position: relative;
  height: 200px;
  background-color: var(--surface-2);
  background-size: cover;
  background-position: center 25%;
}
.detail-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(17, 21, 31, 0.1) 20%, var(--bg-raise) 98%);
}
.detail-head {
  position: relative;
  display: flex;
  gap: 15px;
  padding: 0 18px;
  margin-top: -64px;
  align-items: flex-end;
}
.detail-poster {
  width: 104px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
}
.detail-poster img, .detail-poster .no-poster { width: 100%; aspect-ratio: 2/3; object-fit: cover; }
.detail-titles { padding-bottom: 4px; min-width: 0; }
.detail-titles h2 { font-size: 21px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; }
.detail-meta { font-size: 13px; color: var(--text-2); margin-top: 5px; line-height: 1.5; }

.detail-section { padding: 0 18px; margin-top: 20px; }
.detail-section h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  margin-bottom: 10px;
}
.detail-overview { font-size: 14.5px; line-height: 1.6; color: var(--text-2); }

.detail-ratings { display: flex; gap: 9px; flex-wrap: wrap; }
.detail-rating-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
}
.detail-rating-pill strong { font-size: 15.5px; font-weight: 800; color: var(--text); }
.detail-rating-pill .icon { width: 15px; height: 15px; }
.detail-rating-pill.joint .icon { color: var(--accent); }
.detail-rating-pill.him .icon { color: var(--him); }
.detail-rating-pill.her .icon { color: var(--her); }
.detail-rating-pill.tmdb .icon { color: var(--rate-great); }

.cast-scroll {
  display: flex;
  gap: 11px;
  overflow-x: auto;
  padding: 2px 18px 6px;
  margin: 0 -18px;
  scrollbar-width: none;
}
.cast-scroll::-webkit-scrollbar { display: none; }
.cast-card { width: 76px; flex-shrink: 0; text-align: center; }
.cast-photo {
  width: 64px;
  height: 64px;
  margin: 0 auto 7px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
}
.cast-photo img { width: 100%; height: 100%; object-fit: cover; }
.cast-name { font-size: 11.5px; font-weight: 700; line-height: 1.25; }
.cast-role { font-size: 10.5px; color: var(--text-3); margin-top: 1px; line-height: 1.25; }

.detail-actions { padding: 0 18px; margin-top: 24px; display: flex; flex-direction: column; gap: 9px; }
.detail-actions-row { display: flex; gap: 9px; }
.detail-actions-row .btn { flex: 1; }

.detail-added { font-size: 12px; color: var(--text-3); text-align: center; margin-top: 14px; padding: 0 18px; }

/* ============ Settings sheet ============ */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.settings-label { display: flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 600; }
.settings-label .icon { width: 18px; height: 18px; color: var(--text-2); }
.settings-value { font-size: 14px; font-weight: 700; color: var(--accent); }
#sheet-settings .btn-danger-ghost { margin-top: 20px; }
.settings-about { font-size: 12.5px; color: var(--text-3); text-align: center; line-height: 1.5; margin-top: 18px; }

/* ============ Confirm sheet ============ */
.sheet-confirm { max-width: 420px; border-radius: 24px; margin-bottom: calc(20px + var(--safe-bottom)); border-bottom: 1px solid var(--border); }
.confirm-message { font-size: 15.5px; font-weight: 600; text-align: center; padding: 14px 6px 20px; line-height: 1.45; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; }

/* ============ Toasts ============ */
#toast-container {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 14px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.25s ease;
  max-width: 100%;
}
.toast.out { animation: toastOut 0.25s ease forwards; }
.toast .icon { width: 16px; height: 16px; color: var(--rate-great); }
.toast.error .icon { color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

/* ============ Skeletons ============ */
.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(100deg, var(--surface) 40%, var(--surface-2) 50%, var(--surface) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton-pcard { width: 124px; aspect-ratio: 2/3.6; flex-shrink: 0; }

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

@media (min-width: 700px) {
  body { background: #07090d; }
  #app { border-left: 1px solid var(--border); border-right: 1px solid var(--border); margin: 0 auto; max-width: var(--shell-max); background: var(--bg); }
  .bottom-nav { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}
