:root {
  --bg: #0d1117;
  --bg-2: #161b22;
  --bg-3: #1c2230;
  --line: #2a3242;
  --text: #e6edf3;
  --muted: #8b95a5;
  --gold: #f5c518;
  --gold-dim: #c9a012;
  --accent: #4f8cff;
  --danger: #ff5d5d;
  --radius: 12px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

* { 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;
}

.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s, opacity 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--gold); color: #1a1a1a; font-weight: 700; }
.btn-primary:hover { background: var(--gold-dim); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--bg-3); }
.btn-block { width: 100%; }
.btn-danger { background: transparent; color: var(--danger); }
.btn-danger:hover { background: rgba(255, 93, 93, 0.12); }
.btn-watch { background: var(--bg-3); color: var(--text); border: 1px solid var(--line); }
.btn-watch:hover { border-color: var(--accent); }
.btn-watch.active { background: rgba(79, 140, 255, 0.15); border-color: var(--accent); color: var(--accent); }
.btn-watch.liked { background: rgba(255, 93, 93, 0.15); border-color: var(--danger); color: var(--danger); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(13, 17, 23, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 20px;
}
.brand {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark { color: var(--gold); }
.brand-mark.big { font-size: 48px; display: block; }
.search { flex: 1; }
.search input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 15px;
  outline: none;
}
.search input:focus { border-color: var(--accent); }
.user-menu { display: flex; align-items: center; gap: 8px; }
.user-name { color: var(--muted); font-size: 14px; white-space: nowrap; }

/* ---------- Auth ---------- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #1d2740 0%, var(--bg) 60%);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
.auth-hero { text-align: center; margin-bottom: 24px; }
.auth-hero h1 { margin: 8px 0 4px; font-size: 30px; }
.auth-hero p { margin: 0; color: var(--muted); font-size: 14px; }
.auth-tabs {
  display: flex;
  background: var(--bg-3);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 9px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}
.auth-tab.active { background: var(--bg); color: var(--text); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input {
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
}
.auth-form input:focus { border-color: var(--accent); }
.auth-msg { text-align: center; font-size: 14px; min-height: 20px; margin: 14px 0 0; }
.auth-msg.error { color: var(--danger); }
.auth-msg.ok { color: #4caf73; }
.config-warn {
  margin-top: 16px;
  padding: 12px;
  background: rgba(255, 93, 93, 0.1);
  border: 1px solid var(--danger);
  border-radius: 8px;
  font-size: 13px;
  color: #ffb4b4;
  line-height: 1.5;
}

/* ---------- App grid ---------- */
.app { max-width: 1200px; margin: 0 auto; padding: 24px 20px 64px; }
.section-head { margin: 8px 0 20px; }
.section-head h2 { font-size: 22px; margin: 0; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 18px;
}
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s;
}
.card { position: relative; }
.card:hover { transform: translateY(-4px); border-color: var(--accent); }
.poster-wrap { position: relative; overflow: hidden; }
.like-badge {
  position: absolute; bottom: 8px; left: 8px; z-index: 2;
  background: rgba(0, 0, 0, 0.7); color: #fff; border-radius: 999px;
  padding: 3px 9px; font-size: 12px; font-weight: 700;
}
.heart { color: var(--danger); }
.media-tag {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  color: #fff; border-radius: 6px;
  padding: 2px 7px; font-size: 11px; font-weight: 800; letter-spacing: 0.5px;
}
.media-tag.tv { background: rgba(79, 140, 255, 0.92); }
.media-tag.movie { background: rgba(245, 197, 24, 0.92); color: #1a1a1a; }

/* Bookmark (watchlist) button on the poster */
.card-bookmark {
  position: absolute; top: 6px; right: 6px; z-index: 3;
  width: 32px; height: 32px; border-radius: 999px; border: none; cursor: pointer;
  background: rgba(0, 0, 0, 0.55); font-size: 15px; line-height: 1;
  filter: grayscale(1) brightness(1.4); opacity: 0.85; transition: transform 0.1s;
}
.card-bookmark:hover { transform: scale(1.12); opacity: 1; }
.card-bookmark.saved { filter: none; background: rgba(245, 197, 24, 0.95); }

/* Hover overlay: rating + synopsis */
.card-hover {
  position: absolute; inset: 0; z-index: 2;
  background: linear-gradient(to top, rgba(13,17,23,0.96) 30%, rgba(13,17,23,0.25));
  display: flex; flex-direction: column; justify-content: flex-end; gap: 8px;
  padding: 14px 12px; opacity: 0; transition: opacity 0.15s; pointer-events: none;
}
.card:hover .card-hover { opacity: 1; }
.card-hover-rating .badge-star { font-size: 14px; }
.card-hover-overview {
  margin: 0; font-size: 12px; line-height: 1.45; color: #d6dde6;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.card-hover-cta { font-size: 12px; font-weight: 700; color: var(--gold); }
.device-mobile .card-hover { display: none; } /* no hover on touch */

/* Trailer */
.trailer-btn {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2;
  background: rgba(0,0,0,0.65); color: #fff; border: 2px solid #fff; cursor: pointer;
  padding: 10px 20px; border-radius: 999px; font: inherit; font-weight: 700; font-size: 15px;
}
.trailer-btn:hover { background: var(--gold); color: #1a1a1a; border-color: var(--gold); }
.trailer-frame { width: 100%; height: 240px; border: 0; display: block; background: #000; }

/* Topbar icons */
.icon-btn {
  position: relative; background: transparent; border: none; color: var(--text);
  font-size: 20px; cursor: pointer; padding: 6px 8px; border-radius: 8px;
}
.icon-btn:hover { background: var(--bg-3); }
.bell-label { display: none; } /* shown only in the desktop sidebar */
.device-desktop #notifBtn .nav-badge { margin-left: auto; }
.icon-btn.has-badge { /* badge shown via .nav-badge child */ }
.avatar-btn { background: transparent; border: none; cursor: pointer; padding: 2px; border-radius: 999px; }
.avatar-btn:hover { outline: 2px solid var(--accent); }
.avatar-img.sm {
  width: 34px; height: 34px; font-size: 15px; background-size: cover; background-position: center;
}
.avatar-img.sm.has-img { background-color: transparent; }

/* Notifications dropdown */
.dropdown-panel {
  position: absolute; top: calc(100% + 6px); right: 12px; z-index: 60;
  width: 320px; max-width: calc(100vw - 24px); max-height: 60vh; overflow-y: auto;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.notif-head { padding: 12px 16px; font-weight: 700; border-bottom: 1px solid var(--line); }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; line-height: 1.4; }
.notif-item:hover { background: var(--bg-3); }
.notif-note { color: var(--muted); font-size: 13px; font-style: italic; margin-top: 4px; }
.notif-empty { padding: 22px 16px; color: var(--muted); text-align: center; font-size: 14px; }

/* Browse controls: category pills + genre filter */
.browse-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: -6px 0 22px; }
.cat-pills { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.cat-pill {
  border: 1px solid var(--line); background: var(--bg-2); color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 999px; cursor: pointer;
}
.cat-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.genre-select {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 8px 12px; font: inherit; font-size: 14px; cursor: pointer; outline: none;
}
.genre-select:focus { border-color: var(--accent); }

/* Stats page */
.stats-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 8px 2px 20px; flex-wrap: wrap; }
.stats-head h2 { margin: 0; font-size: 24px; }
.stats-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-bottom: 12px; }
.stat-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-align: center; }
.stat-num { font-size: 26px; font-weight: 800; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }
.dist-chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.dist-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 6px; }
.dist-bar { width: 70%; min-height: 2px; background: var(--gold); border-radius: 4px 4px 0 0; }
.dist-x { font-size: 11px; color: var(--muted); }
.decade-row { display: flex; gap: 14px; flex-wrap: wrap; }
.decade-item { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 16px; display: flex; flex-direction: column; }
.decade-item b { font-size: 16px; }
.decade-item span { font-size: 12px; color: var(--muted); }

/* Lists */
.lists-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.list-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: transform 0.12s, border-color 0.12s; }
.list-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.list-card-title { font-weight: 700; font-size: 16px; }
.list-card-meta { font-size: 13px; color: var(--muted); margin-top: 6px; }
.list-form { padding: 8px 24px 24px; display: flex; flex-direction: column; gap: 12px; }
.list-form input, .list-form textarea {
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 11px 14px; font: inherit; outline: none;
}
.list-form textarea { resize: vertical; min-height: 60px; }
.list-public { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.list-create-inline { display: flex; gap: 8px; }
.list-create-inline input { flex: 1; }

/* Streaming providers */
.provider-row { display: flex; gap: 16px; flex-wrap: wrap; }
.provider { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 70px; text-align: center; }
.provider img { width: 50px; height: 50px; border-radius: 12px; }
.provider span { font-size: 11px; color: var(--muted); line-height: 1.2; }
.sim-card { width: 110px; flex-shrink: 0; cursor: pointer; }
.sim-card .cast-photo { width: 110px; height: 165px; }

/* Movies / Series browse toggle */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.browse-toggle { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.browse-btn {
  border: none; background: transparent; color: var(--muted); font: inherit; font-weight: 600;
  font-size: 14px; padding: 7px 16px; border-radius: 999px; cursor: pointer;
}
.browse-btn.active { background: var(--gold); color: #1a1a1a; }
.poster { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; display: block; background: var(--bg-3); }
.poster.placeholder {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; text-align: center; padding: 10px;
}
.card-body { padding: 10px 12px 14px; }
.card-title {
  font-size: 14px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { margin-top: 6px; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.badge-star { color: var(--gold); font-weight: 700; }
.grid-status { text-align: center; color: var(--muted); padding: 40px 0; }
.load-more { display: block; margin: 28px auto 0; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); }
.modal-panel {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.modal-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  background: rgba(0,0,0,0.5); color: #fff; border: none;
  width: 34px; height: 34px; border-radius: 999px; cursor: pointer; font-size: 15px;
}
.modal-body { display: block; }
.detail-hero { position: relative; }
.detail-backdrop { width: 100%; height: 240px; object-fit: cover; display: block; background: var(--bg-3); }
.detail-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--bg-2), transparent 70%); }
.detail-main { display: flex; gap: 20px; padding: 0 24px 24px; margin-top: -80px; position: relative; z-index: 1; }
.detail-poster { width: 140px; flex-shrink: 0; border-radius: 8px; box-shadow: var(--shadow); aspect-ratio: 2/3; object-fit: cover; background: var(--bg-3); }
.detail-info { flex: 1; padding-top: 90px; }
.detail-info h2 { margin: 0 0 6px; font-size: 24px; }
.detail-sub { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.detail-overview { font-size: 14px; line-height: 1.6; color: #c7d0dc; }

.score-row { display: flex; gap: 28px; padding: 0 24px 20px; flex-wrap: wrap; }
.score-box { display: flex; flex-direction: column; gap: 2px; }
.score-num { font-size: 26px; font-weight: 800; }
.score-num .star { color: var(--gold); }
.score-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }

.rate-box { margin: 0 24px 8px; padding: 18px; background: var(--bg-3); border-radius: var(--radius); }
.rate-box h3 { margin: 0 0 12px; font-size: 15px; }

/* Fractional (half-step) star widget — a gold layer clipped over a grey one */
.star-rate { position: relative; display: inline-block; line-height: 1; font-size: 32px; }
.star-rate .layer { white-space: nowrap; letter-spacing: 2px; }
.star-rate .bg { color: #3a4252; }
.star-rate .fill {
  color: var(--gold);
  position: absolute; top: 0; left: 0;
  overflow: hidden; width: 0;
  pointer-events: none;
}
.star-rate.input { cursor: pointer; }
.rate-line { display: flex; align-items: center; }
.rate-readout { margin-left: 14px; font-weight: 700; color: var(--gold); font-size: 18px; }
.star-rate.sm { font-size: 15px; }
.star-rate.sm .layer { letter-spacing: 1px; }
.detail-actions { margin-top: 16px; }
.rate-box textarea {
  width: 100%; margin-top: 12px; background: var(--bg-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 8px; padding: 10px 12px; font: inherit; resize: vertical; min-height: 64px; outline: none;
}
.rate-box textarea:focus { border-color: var(--accent); }
.rate-actions { display: flex; gap: 10px; margin-top: 12px; align-items: center; }

/* Simple / Detailed toggle */
.rate-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.rate-head h3 { margin: 0; }
.mode-toggle { display: flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.mode-btn { border: none; background: transparent; color: var(--muted); padding: 6px 14px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; }
.mode-btn.active { background: var(--gold); color: #1a1a1a; }
.rate-hint { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.rate-hint b { color: var(--text); }

/* Director line + cast */
.detail-director { font-size: 14px; color: #c7d0dc; margin-bottom: 12px; }
.cast { padding: 4px 24px 20px; }
.cast h3 { font-size: 15px; margin: 0 0 12px; }
.cast-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.cast-card { width: 92px; flex-shrink: 0; }
.cast-photo { width: 92px; height: 138px; object-fit: cover; border-radius: 8px; background: var(--bg-3); display: block; }
.cast-photo.placeholder { display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; color: var(--muted); }
.cast-name { font-size: 13px; font-weight: 600; margin-top: 6px; line-height: 1.3; }
.cast-char { font-size: 12px; color: var(--muted); line-height: 1.3; }

/* Detailed aspect rows */
.aspect-row { display: flex; align-items: center; gap: 14px; padding: 5px 0; }
.aspect-label { width: 92px; flex-shrink: 0; color: var(--muted); font-size: 14px; }
.aspect-row .star-rate.input { font-size: 26px; }
.aspect-avg { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; }
.detailed-avg-val { font-weight: 800; color: var(--gold); font-size: 22px; }

/* Community per-aspect breakdown (in the score area) */
.aspect-breakdown { display: flex; gap: 22px; flex-wrap: wrap; padding: 0 24px 20px; }
.ab-item { display: flex; flex-direction: column; gap: 2px; }
.ab-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.ab-val { font-weight: 700; font-size: 17px; }
.ab-val::before { content: "★ "; color: var(--gold); font-weight: 400; }

/* Activity feed (list layout) */
.grid.list { grid-template-columns: 1fr; gap: 0; }
.feed-item { display: flex; gap: 14px; align-items: center; padding: 14px 12px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 8px; }
.feed-item:hover { background: var(--bg-2); }
.feed-body { flex: 1; min-width: 0; }
.feed-line { font-size: 14px; line-height: 1.4; }
.feed-meta { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
.feed-score { color: var(--gold); font-weight: 700; font-size: 13px; }
.feed-badge { font-size: 11px; background: var(--bg-3); color: var(--accent); padding: 2px 7px; border-radius: 4px; }
.feed-review { font-size: 13px; color: #c7d0dc; margin-top: 6px; font-style: italic; }
.feed-poster { width: 46px; height: 69px; object-fit: cover; border-radius: 4px; flex-shrink: 0; background: var(--bg-3); }

/* Activity scope toggle (Everyone / You) */
.scope-toggle { display: inline-flex; gap: 6px; margin-left: 12px; vertical-align: middle; }
.scope-btn { border: 1px solid var(--line); background: var(--bg-2); color: var(--muted); padding: 4px 12px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 12px; }
.scope-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Clickable author names / avatars */
.author-link { cursor: pointer; }
b.author-link:hover, .review-name.author-link:hover { color: var(--accent); text-decoration: underline; }
.review-avatar.author-link:hover { outline: 2px solid var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; font-weight: 400; }

/* Profile header */
.profile-head { display: flex; gap: 24px; align-items: center; padding: 16px 4px 28px; flex-wrap: wrap; }
.profile-avatar-wrap { position: relative; flex-shrink: 0; }
.avatar-img { width: 56px; height: 56px; border-radius: 999px; object-fit: cover; background: var(--accent); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }
.avatar-img.lg { width: 110px; height: 110px; font-size: 44px; }
.avatar-img.placeholder { background: var(--accent); }
.avatar-edit { position: absolute; right: 0; bottom: 0; width: 34px; height: 34px; border-radius: 999px; border: 3px solid var(--bg); background: var(--gold); color: #1a1a1a; cursor: pointer; font-size: 14px; }
.profile-info { flex: 1; min-width: 220px; }
.profile-name { margin: 0 0 8px; font-size: 26px; }
.profile-stats { display: flex; gap: 20px; color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.profile-stats b { color: var(--text); }
.profile-bio { font-size: 14px; color: #c7d0dc; line-height: 1.5; margin: 0 0 14px; max-width: 600px; }
.profile-actions { display: flex; gap: 10px; }
.bio-input { width: 100%; max-width: 600px; background: var(--bg-3); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 10px 12px; font: inherit; resize: vertical; min-height: 60px; outline: none; }
.bio-actions { display: flex; gap: 10px; margin-top: 10px; }

/* Profile sections + top 5 */
.profile-section { padding: 16px 4px; border-top: 1px solid var(--line); }
.profile-section h3 { font-size: 18px; margin: 0 0 16px; }
.top5-row { display: flex; gap: 16px; flex-wrap: wrap; }
.top5-card { width: 130px; position: relative; cursor: pointer; }
.top5-card .poster { width: 130px; aspect-ratio: 2/3; object-fit: cover; border-radius: 10px; transition: transform 0.12s; }
.top5-card:hover .poster { transform: translateY(-4px); }
.top5-rank { position: absolute; top: -8px; left: -8px; z-index: 2; width: 28px; height: 28px; border-radius: 999px; background: var(--gold); color: #1a1a1a; font-weight: 800; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); }
.top5-remove { position: absolute; top: 6px; right: 6px; z-index: 2; width: 26px; height: 26px; border-radius: 999px; border: none; background: rgba(0,0,0,0.6); color: #fff; cursor: pointer; }
.top5-title { font-size: 13px; font-weight: 600; margin-top: 8px; line-height: 1.3; }

/* People search results */
.people-results:empty { display: none; }
.people-results { margin-bottom: 28px; }
.people-head { font-size: 16px; margin: 0 0 14px; color: var(--muted); }
.people-row { display: flex; gap: 14px; flex-wrap: wrap; }
.person-card { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 96px; padding: 14px 8px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; transition: transform 0.12s, border-color 0.12s; }
.person-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.person-name { font-size: 13px; font-weight: 600; text-align: center; line-height: 1.3; word-break: break-word; }

/* Clickable follower/following counts */
.stat-link { cursor: pointer; }
.stat-link:hover { color: var(--text); }
.stat-link:hover b { color: var(--accent); }

/* Followers / following list inside the modal */
.people-list-head { padding: 22px 24px 12px; }
.people-list-head h2 { margin: 0; font-size: 20px; }
.people-list { padding: 4px 12px 20px; }
.person-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.person-row:hover { background: var(--bg-3); }
.person-row-name { font-weight: 600; font-size: 15px; }

/* Activity feed: follower count + inline follow button */
.feed-stats { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.feed-followers { font-size: 12px; color: var(--muted); }
.btn-follow {
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
  border: 1px solid var(--accent); background: transparent; color: var(--accent);
  border-radius: 999px; padding: 4px 14px;
}
.btn-follow:hover { background: rgba(79, 140, 255, 0.12); }
.btn-follow.active { background: var(--bg-3); border-color: var(--line); color: var(--muted); }

/* Recommend picker (sheet) */
.recommend-note { padding: 4px 24px 12px; }
.recommend-note input {
  width: 100%; background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 11px 14px; font: inherit; outline: none;
}
.recommend-note input:focus { border-color: var(--accent); }
.rec-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; }
.rec-row:hover { background: var(--bg-3); }
.rec-row .person-row-name { flex: 1; }
.rec-send { padding: 7px 16px; font-size: 13px; }

/* "Recommended for you" cards on a profile */
.recs-row { display: flex; gap: 16px; flex-wrap: wrap; }
.rec-card { width: 130px; position: relative; cursor: pointer; }
.rec-card .poster { width: 130px; aspect-ratio: 2/3; object-fit: cover; border-radius: 10px; transition: transform 0.12s; }
.rec-card:hover .poster { transform: translateY(-4px); }
.rec-dismiss {
  position: absolute; top: 6px; right: 6px; z-index: 2; width: 26px; height: 26px;
  border-radius: 999px; border: none; background: rgba(0,0,0,0.6); color: #fff; cursor: pointer;
}
.rec-card-title { font-size: 13px; font-weight: 600; margin-top: 8px; line-height: 1.3; }
.rec-card-from { font-size: 12px; color: var(--muted); margin-top: 2px; }
.rec-card-note { font-size: 12px; color: #c7d0dc; font-style: italic; margin-top: 4px; line-height: 1.3; }

.reviews { padding: 8px 24px 28px; }
.reviews h3 { font-size: 15px; margin: 16px 0 12px; }
.review {
  padding: 12px 0; border-top: 1px solid var(--line); display: flex; gap: 12px;
}
.review-avatar {
  width: 36px; height: 36px; border-radius: 999px; background: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; color: #fff;
}
.review-content { flex: 1; }
.review-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.review-name { font-weight: 600; font-size: 14px; }
.review-stars { color: var(--gold); font-size: 13px; }
.review-date { color: var(--muted); font-size: 12px; }
.review-text { font-size: 14px; line-height: 1.5; color: #c7d0dc; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* ============================================================
   DEVICE WELCOME SCREEN
   ============================================================ */
.device-screen {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #1d2740 0%, var(--bg) 60%);
}
.device-card { text-align: center; max-width: 440px; width: 100%; }
.device-card h1 { margin: 12px 0 6px; font-size: 28px; }
.device-card > p { color: var(--muted); margin: 0 0 28px; }
.device-options { display: flex; gap: 16px; justify-content: center; }
.device-opt {
  flex: 1; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 14px; cursor: pointer; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  transition: transform 0.12s, border-color 0.12s;
}
.device-opt:hover, .device-opt:active { transform: translateY(-3px); border-color: var(--accent); }
.device-emoji { font-size: 42px; }
.device-label { font-weight: 700; font-size: 15px; }
.device-rec { font-size: 12px; color: var(--gold); min-height: 16px; }
.device-note { color: var(--muted); font-size: 13px; margin-top: 22px; }

/* ============================================================
   HAMBURGER NAV (shown only in mobile layout)
   ============================================================ */
.nav-toggle {
  display: none; background: transparent; border: none; color: var(--text);
  font-size: 24px; cursor: pointer; padding: 4px 8px; line-height: 1; position: relative;
}
/* red dot on the hamburger when there are new recommendations */
.nav-toggle.has-badge::after {
  content: ""; position: absolute; top: 2px; right: 4px;
  width: 9px; height: 9px; border-radius: 999px; background: var(--danger);
  border: 2px solid var(--bg);
}

/* count badge on the "My profile" button */
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px;
  background: var(--danger); color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700; vertical-align: middle;
}

/* ============================================================
   MOBILE LAYOUT  (body.device-mobile — set by JS on narrow
   viewports or when the user picks "mobile")
   ============================================================ */
/* Centered phone-width column on every screen size */
.device-mobile .topbar-inner,
.device-mobile .app { max-width: 480px; margin-left: auto; margin-right: auto; }
.device-mobile .topbar-inner { position: relative; gap: 10px; padding: 10px 14px; }
.device-mobile .brand { font-size: 18px; }
.device-mobile .search input { padding: 9px 14px; font-size: 14px; }
.device-mobile .nav-toggle { display: block; }
.device-mobile .user-menu {
  position: absolute; top: calc(100% + 8px); right: 8px; left: 8px;
  flex-direction: column; align-items: stretch; gap: 4px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px; box-shadow: var(--shadow); display: none; z-index: 40;
}
.device-mobile .user-menu.open { display: flex; }
.device-mobile .user-menu .btn { width: 100%; text-align: left; padding: 13px 14px; font-size: 15px; }
.device-mobile .user-name { display: none; }

.device-mobile .app { padding: 16px 12px 72px; }
.device-mobile .section-head h2 { font-size: 19px; }
.device-mobile .grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 12px; }
.device-mobile .grid.list { grid-template-columns: 1fr; gap: 0; } /* activity feed stays vertical */

/* Movie detail modal → full screen */
.device-mobile .modal { padding: 0; }
.device-mobile .modal-panel,
.device-mobile .sheet-panel { max-width: 480px; width: 100%; height: 100%; max-height: 100%; margin: 0 auto; border-radius: 0; border: none; }
.device-mobile .detail-backdrop { height: 180px; }
.device-mobile .detail-main { flex-direction: column; margin-top: -54px; gap: 12px; padding: 0 16px 16px; }
.device-mobile .detail-info { padding-top: 0; }
.device-mobile .detail-poster { width: 92px; }
.device-mobile .detail-info h2 { font-size: 21px; }
.device-mobile .score-row { gap: 22px; padding: 0 16px 18px; }
.device-mobile .aspect-breakdown { padding: 0 16px 16px; gap: 14px; }
.device-mobile .cast, .device-mobile .reviews { padding-left: 16px; padding-right: 16px; }
.device-mobile .cast-card { width: 78px; }
.device-mobile .cast-photo { width: 78px; height: 117px; }
.device-mobile .rate-box { margin: 0 16px 8px; padding: 16px; }
.device-mobile .rate-head { flex-direction: column; align-items: flex-start; gap: 10px; }
.device-mobile .detail-actions { flex-wrap: wrap; }
.device-mobile .star-rate.input { font-size: 30px; }
.device-mobile .aspect-row { gap: 8px; }
.device-mobile .aspect-row .star-rate.input { font-size: 26px; }
.device-mobile .aspect-label { width: 72px; font-size: 13px; }

/* Profile */
.device-mobile .profile-head { gap: 16px; padding: 12px 2px 22px; }
.device-mobile .avatar-img.lg { width: 84px; height: 84px; font-size: 34px; }
.device-mobile .profile-name { font-size: 22px; }
.device-mobile .top5-card, .device-mobile .top5-card .poster { width: 104px; }

/* People list / followers modal full screen too */
.device-mobile .people-list-head { padding: 20px 18px 10px; }

@media (max-width: 380px) {
  .device-mobile .grid:not(.list) { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   DESKTOP LAYOUT (body.device-desktop) — left sidebar + wide grid
   ============================================================ */
.device-desktop #topbar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 240px; height: 100vh;
  border-right: 1px solid var(--line); border-bottom: none; overflow-y: auto;
  background: var(--bg-2);
}
.device-desktop .topbar-inner {
  flex-direction: column; align-items: stretch; max-width: none; height: 100%;
  padding: 22px 14px; gap: 6px;
}
.device-desktop .brand { order: 0; font-size: 22px; padding: 0 10px 14px; }
.device-desktop .user-name { order: 1; padding: 0 12px 12px; font-size: 16px; font-weight: 700; color: var(--text); white-space: normal; }
.device-desktop .search { order: 2; flex: 0 0 auto; margin-bottom: 12px; }
.device-desktop .search input { width: 100%; }
.device-desktop .nav-toggle { display: none; }
.device-desktop #accountBtn { display: none; }
.device-desktop #notifBtn {
  order: 3; position: static; display: flex; align-items: center; gap: 8px; width: 100%;
  text-align: left; padding: 11px 12px; border-radius: 8px; font-size: 15px; color: var(--muted);
}
.device-desktop #notifBtn:hover { background: var(--bg-3); color: var(--text); }
.device-desktop .bell-label { display: inline; }
.device-desktop .user-menu {
  order: 4; flex: 1; position: static; display: flex; flex-direction: column; align-items: stretch;
  gap: 2px; background: none; border: none; box-shadow: none; padding: 0;
}
.device-desktop .user-menu .btn {
  text-align: left; width: 100%; padding: 11px 12px; border-radius: 8px; font-size: 15px;
}
.device-desktop .user-menu .btn:hover { background: var(--bg-3); color: var(--text); }
.device-desktop #signOutBtn { margin-top: auto; border-top: 1px solid var(--line); border-radius: 0; padding-top: 14px; }

/* Main content uses the rest of the screen */
.device-desktop .app { margin-left: 240px; max-width: none; padding: 30px 44px 80px; }
.device-desktop .section-head h2 { font-size: 26px; }
.device-desktop .grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 24px; }
.device-desktop #profileView,
.device-desktop #browseView { max-width: 1500px; }

/* Wider movie detail modal on desktop */
.device-desktop .modal-panel { max-width: 860px; }
.device-desktop .detail-backdrop { height: 300px; }

@media (max-width: 1100px) {
  .device-desktop .app { padding: 24px 28px 70px; }
}

/* ---------- Per-episode rating (series) ---------- */
.rate-scope { display: flex; gap: 8px; margin: 0 24px 12px; }
.rate-scope-btn {
  flex: 1; border: 1px solid var(--line); background: var(--bg-2); color: var(--muted);
  font: inherit; font-weight: 600; font-size: 14px; padding: 9px; border-radius: 8px; cursor: pointer;
}
.rate-scope-btn.active { background: var(--gold); color: #1a1a1a; border-color: var(--gold); }
#episodeRateBox .rate-head { gap: 12px; }
#seasonSelect { max-width: 60%; }
#episodeList { display: flex; flex-direction: column; }
.ep-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 2px; border-top: 1px solid var(--line);
}
.ep-info { min-width: 0; }
.ep-title { font-size: 14px; font-weight: 600; line-height: 1.3; }
.ep-num { color: var(--muted); font-weight: 700; margin-right: 4px; }
.ep-sub { font-size: 12px; color: var(--gold); margin-top: 3px; }
.ep-rate { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ep-stars { font-size: 20px; }
.ep-readout { font-size: 13px; font-weight: 700; color: var(--gold); width: 26px; text-align: right; }
.device-mobile .rate-scope, .device-mobile #episodeRateBox { margin-left: 16px; margin-right: 16px; }
.device-mobile .ep-stars { font-size: 22px; }

.ep-row.season-row { background: var(--bg-3); border-radius: 8px; padding: 12px; border-top: none; margin-bottom: 6px; }
.ep-row.season-row .ep-num { color: var(--gold); }

/* ---------- Person page (actor / director) ---------- */
.cast-card { cursor: pointer; }
.cast-card:hover .cast-photo { outline: 2px solid var(--accent); }
.person-link { cursor: pointer; }
.person-link:hover { color: var(--accent); text-decoration: underline; }
.person-head { display: flex; gap: 18px; align-items: flex-end; padding: 22px 24px 16px; }
.person-photo { width: 110px; height: 165px; object-fit: cover; border-radius: 10px; background: var(--bg-3); flex-shrink: 0; }
.person-photo.placeholder { display: flex; align-items: center; justify-content: center; font-size: 44px; font-weight: 700; color: var(--muted); }
.person-meta h2 { margin: 0 0 6px; font-size: 24px; }
.person-born { font-size: 13px; color: var(--muted); margin-top: 6px; }
.person-bio { padding: 0 24px 8px; font-size: 14px; line-height: 1.6; color: #c7d0dc; white-space: pre-line; }
.person-section { padding: 8px 24px 18px; }
.person-section h3 { font-size: 16px; margin: 8px 0 12px; }
.pfilm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 14px; }
.pfilm-card { position: relative; cursor: pointer; }
.pfilm-card .poster { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 8px; transition: transform 0.12s; }
.pfilm-card:hover .poster { transform: translateY(-3px); }
.pfilm-title { font-size: 12px; font-weight: 600; margin-top: 6px; line-height: 1.3; }
.pfilm-sub { font-size: 11px; color: var(--muted); line-height: 1.3; }

/* ---------- Streaming availability ---------- */
.watch-banner { margin-top: 14px; padding: 11px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; }
.watch-banner.can-watch { background: rgba(76, 175, 115, 0.16); border: 1px solid #4caf73; color: #8ee0ab; }
.watch-banner.no-watch { background: var(--bg-3); border: 1px solid var(--line); color: var(--muted); font-weight: 500; }
.settings-box { padding: 8px 24px 24px; display: flex; flex-direction: column; gap: 8px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settings-row span { font-weight: 600; }
.service-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.service-chip {
  border: 1px solid var(--line); background: var(--bg-2); color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 600; padding: 9px 14px; border-radius: 999px; cursor: pointer;
}
.service-chip.on { background: var(--gold); color: #1a1a1a; border-color: var(--gold); }
