@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,700&family=Inter:wght@400;500;600;700&display=swap');

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --bg:        #080B14;
  --bg-card:   #0E1220;
  --bg-el:     #151929;
  --bg-glass:  rgba(14,18,32,0.72);
  --border:    rgba(255,255,255,0.07);
  --border-h:  rgba(255,255,255,0.18);
  --txt:       #EEF0F8;
  --txt2:      #8B90AB;
  --txt3:      #3F4460;
  --acc:       #7C6EFA;   /* violet */
  --acc2:      #F06292;   /* pink accent */
  --acc-dim:   rgba(124,110,250,0.14);
  --acc-txt:   #EEF0F8;
  --gold:      #F5C842;
  --radius:    12px;
  --font-d:    'Playfair Display', Georgia, serif;
  --font-b:    'Inter', system-ui, sans-serif;
  --shadow:    0 8px 32px rgba(0,0,0,0.45);
}
.light {
  --bg:        #F0F2FA;
  --bg-card:   #FFFFFF;
  --bg-el:     #E8EBF5;
  --bg-glass:  rgba(255,255,255,0.80);
  --border:    rgba(0,0,0,0.08);
  --border-h:  rgba(0,0,0,0.18);
  --txt:       #0F1128;
  --txt2:      #4A4F6A;
  --txt3:      #9BA0BB;
  --acc:       #5B4EE0;
  --acc2:      #D63B6B;
  --acc-dim:   rgba(91,78,224,0.10);
  --acc-txt:   #FFFFFF;
  --gold:      #D4A017;
  --shadow:    0 8px 32px rgba(80,80,140,0.12);
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font-b);
  min-height: 100vh;
  font-size: 14px;
  transition: background .35s, color .35s;
  line-height: 1.5;
  overflow-x: hidden;
  width: 100%;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

/* ── Header ──────────────────────────────────────────────── */
.hdr {
  background: var(--bg-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 60;
}
.logo {
  font-family: var(--font-d);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--txt);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -.01em;
  flex-shrink: 0;
}
.logo-icon { font-size: 1.1rem; }
.logo-accent { color: var(--acc); }
.nav-btns { display: flex; gap: 4px; }
.nb {
  padding: 5px 14px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  color: var(--txt2);
  transition: all .2s;
}
.nb:hover { color: var(--txt); background: var(--bg-el); }
.nb.on { background: var(--acc); color: var(--acc-txt); font-weight: 700; }

.search-box { flex: 1; max-width: 260px; margin-left: auto; position: relative; }
.search-box input {
  width: 100%;
  background: var(--bg-el);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 6px 14px 6px 34px;
  font-size: 13px;
  color: var(--txt);
  outline: none;
  transition: border-color .2s;
}
.search-box input:focus { border-color: var(--acc); }
.search-box input::placeholder { color: var(--txt3); }
.s-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--txt3); font-size: 14px; pointer-events: none; }

.hdr-actions { display: flex; align-items: center; gap: 8px; }
.theme-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-el);
  border: 1px solid var(--border);
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
  flex-shrink: 0;
}
.theme-btn:hover { border-color: var(--acc); transform: rotate(20deg); }

/* Profile avatar in header */
.hdr-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  color: #fff;
  cursor: pointer;
  border: 2px solid var(--acc);
  transition: transform .2s, box-shadow .2s;
  flex-shrink: 0;
}
.hdr-avatar:hover { transform: scale(1.08); box-shadow: 0 0 0 3px var(--acc-dim); }

/* ── Filters ─────────────────────────────────────────────── */
.filters {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 8px 1.5rem;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  overflow-x: auto;
}
.filter-select {
  appearance: none;
  background: var(--bg-el);
  color: var(--txt);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 8px 36px 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: all .2s;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%238B90AB%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 14px top 50%;
  background-size: 10px auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.filter-select:hover, .filter-select:focus {
  border-color: var(--acc);
  box-shadow: 0 2px 12px rgba(124,110,250,0.15);
}
.filter-select option {
  background: var(--bg-card);
  color: var(--txt);
  padding: 8px;
}

/* ── Main / Grid ─────────────────────────────────────────── */
.main { padding: 1.5rem; flex: 1; }
.hero { margin-bottom: 1.5rem; }
.hero h1 {
  font-family: var(--font-d);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--txt);
}
.hero h1 em { font-style: italic; color: var(--acc); }
.hero p { font-size: 13px; color: var(--txt2); margin-top: 5px; }
.count { font-size: 12px; color: var(--txt3); margin-bottom: 14px; font-weight: 500; }

/* Genre sections */
.genre-section { margin-bottom: 2.5rem; }
.genre-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.genre-heading h2 {
  font-family: var(--font-d);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--txt);
  font-style: italic;
}
.genre-count {
  font-size: 11px;
  color: var(--txt3);
  background: var(--bg-el);
  padding: 2px 8px;
  border-radius: 99px;
}
.genre-icon { font-size: 1.1rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), border-color .2s, box-shadow .2s;
}
.card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--acc);
  box-shadow: 0 12px 36px rgba(124,110,250,0.18);
}
.poster {
  aspect-ratio: 2/3;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 8px;
  overflow: hidden;
}
.poster-bg {
  position: absolute;
  inset: 0;
  transition: transform .35s;
}
img.poster-bg { width: 100%; height: 100%; object-fit: cover; }
.card:hover .poster-bg { transform: scale(1.06); }
.poster-ovl {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60%;
  background: linear-gradient(transparent, rgba(0,0,0,0.92));
}
.poster-title {
  position: relative;
  z-index: 2;
  font-family: var(--font-d);
  font-size: .8rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  text-shadow: 0 1px 10px rgba(0,0,0,.9);
}
.type-badge {
  position: absolute;
  top: 7px; left: 7px;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  z-index: 3;
  backdrop-filter: blur(4px);
  pointer-events: none;
  white-space: nowrap;
}
/* New badge stacks below Film badge to avoid collision */
.tb-new {
  left: auto;
  right: 7px;
  top: 7px;
}
/* On very small cards, stack New badge below Film badge */
@media (max-width: 480px) {
  .tb-new { top: 28px; right: 7px; }
}
.tb-movie { background: rgba(124,110,250,0.88); color: #fff; }
.tb-series { background: rgba(240,98,146,0.88); color: #fff; }

.card-info { padding: 8px 10px 10px; }
.card-meta { display: flex; gap: 4px; align-items: center; margin-bottom: 5px; flex-wrap: wrap; }
.cy { font-size: 10px; color: var(--txt3); }
.cg {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 99px;
  background: var(--acc-dim);
  color: var(--acc);
  font-weight: 600;
}
.stars-row { display: flex; align-items: center; gap: 4px; }
.star-sm { font-size: 10px; color: var(--gold); }
.star-empty { color: var(--border-h); }
.rating-num { font-size: 11px; font-weight: 700; color: var(--gold); }

/* Short description on card */
.card-desc {
  font-size: 10px;
  color: var(--txt2);
  line-height: 1.5;
  margin-top: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Modal ───────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.80);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.5rem 1rem;
  overflow-y: auto;
  z-index: 100;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow);
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { opacity:0; transform:translateY(24px); } to { opacity:1; transform:translateY(0); } }

.modal-hero {
  padding: 1.5rem;
  position: relative;
}
.modal-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: var(--txt);
  font-size: 15px;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .2s, color .2s;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--acc); color: #fff; border-color: var(--acc); }

.back-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; color: var(--txt);
  border: 1px solid var(--border); padding: 8px 16px;
  border-radius: 99px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.back-btn:hover { background: var(--acc-dim); color: var(--acc); border-color: var(--acc); }

.modal-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.cg {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
}
.type-badge {
  color: #fff;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}
.tb-movie { background: var(--acc); }
.tb-series { background: var(--acc2); }
.modal-title { font-family: var(--font-d); font-size: 1.5rem; font-weight: 700; color: var(--txt); margin-bottom: 4px; }
.modal-year { font-size: 12px; color: var(--txt2); margin-bottom: 10px; }
.modal-rating-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rating-big { font-family: var(--font-d); font-size: 1.15rem; font-weight: 700; color: var(--gold); }
.rev-count { font-size: 11px; color: var(--txt3); }

.modal-body { padding: 1.25rem; }
.sec { margin-bottom: 1.5rem; }
.sec-t {
  font-family: var(--font-d);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--txt3);
  font-style: italic;
  margin-bottom: 8px;
}
.movie-desc {
  font-size: 13px;
  color: var(--txt2);
  line-height: 1.7;
  background: var(--bg-el);
  padding: 12px 14px;
  border-radius: 8px;
  border-left: 3px solid var(--acc);
}

/* Suggested movies in modal — small card strips */
.recs-strip { display: flex; gap: 10px; flex-wrap: wrap; }
.rec-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-el);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  min-width: 130px;
}
.rec-mini:hover { border-color: var(--acc); background: var(--acc-dim); }
.rec-mini-poster {
  width: 30px;
  height: 42px;
  border-radius: 4px;
  flex-shrink: 0;
  overflow: hidden;
}
.rec-mini-poster-bg {
  width: 100%;
  height: 100%;
}
img.rec-mini-poster-bg { object-fit: cover; border-radius: 4px; }
.rec-mini-info { flex: 1; min-width: 0; }
.rec-mini-title { font-size: 11px; font-weight: 600; color: var(--txt); line-height: 1.2; }
.rec-mini-year { font-size: 10px; color: var(--txt3); }

.prov-list { display: flex; gap: 6px; flex-wrap: wrap; }
.prov {
  padding: 4px 12px;
  background: var(--bg-el);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 11px;
  color: var(--txt2);
}

.form-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.form-row select {
  background: var(--bg-el);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--txt);
  outline: none;
  font-family: inherit;
}
.star-pick { display: flex; gap: 4px; }
.sp { font-size: 20px; cursor: pointer; color: var(--border-h); transition: color .15s, transform .1s; }
.sp:hover, .sp.lit { color: var(--gold); }
.sp:hover { transform: scale(1.2); }
.rev-input {
  width: 100%;
  background: var(--bg-el);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--txt);
  resize: none;
  outline: none;
  font-family: inherit;
  transition: border-color .2s;
}
.rev-input:focus { border-color: var(--acc); }
.rev-input::placeholder { color: var(--txt3); }
textarea.rev-input { height: 76px; }
.submit-row { display: flex; justify-content: flex-end; margin-top: 10px; }
.sub-btn {
  background: var(--acc);
  color: var(--acc-txt);
  padding: 7px 22px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  transition: all .2s;
}
.sub-btn:hover { opacity: .85; transform: translateY(-1px); }

.rev-list { display: flex; flex-direction: column; gap: 10px; }
.rev-card {
  background: var(--bg-el);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}
.rev-hdr { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ava {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  flex-shrink: 0;
  color: #fff;
}
.rev-user { font-size: 12px; font-weight: 600; color: var(--txt); }
.rev-text { font-size: 12px; color: var(--txt2); line-height: 1.6; }

/* ── Community ───────────────────────────────────────────── */
.comm-layout {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1.25rem;
  padding: 1.5rem;
}
.user-list { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.user-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  width: 100%;
  transition: all .2s;
}
.user-card:hover, .user-card.sel { border-color: var(--acc); background: var(--acc-dim); }
.ua {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}
.u-name { font-size: 12px; font-weight: 600; color: var(--txt); }
.u-role { font-size: 10px; color: var(--txt3); }
.badge-pill {
  font-size: 9px;
  font-weight: 700;
  border: 1px solid;
  padding: 2px 6px;
  border-radius: 99px;
  margin-top: 3px;
  display: inline-block;
}
.u-stat { text-align: right; margin-left: auto; }
.u-stat span:first-child { font-size: 15px; font-weight: 700; color: var(--txt); display: block; line-height: 1; }
.u-stat span:last-child { font-size: 9px; color: var(--txt3); }

/* ── Profile Panel ───────────────────────────────────────── */
.profile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.p-hdr { display: flex; align-items: center; gap: 14px; margin-bottom: 1.25rem; }
.pa {
  width: 62px; height: 62px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.2rem;
  color: #fff;
  flex-shrink: 0;
  border: 3px solid transparent;
  outline: 3px solid var(--border);
}
.p-name { font-family: var(--font-d); font-size: 1.3rem; font-weight: 700; color: var(--txt); }
.p-role { font-size: 11px; color: var(--txt2); margin-bottom: 5px; }
.p-stats {
  display: flex;
  gap: 2rem;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}
.ps { display: flex; flex-direction: column; }
.ps span:first-child {
  font-family: var(--font-d);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--acc);
  line-height: 1;
}
.ps span:last-child { font-size: 10px; color: var(--txt3); text-transform: uppercase; letter-spacing: .05em; }
.p-revs { display: flex; flex-direction: column; }
.pr-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.pr-item:last-child { border-bottom: none; }
.pr-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.pr-title { font-size: 11px; font-weight: 600; color: var(--acc); }
.pr-stars { font-size: 11px; color: var(--gold); }
.pr-text { font-size: 11px; color: var(--txt2); line-height: 1.55; }

/* ── My Profile Page ─────────────────────────────────────── */
.my-profile-page { padding: 1.5rem; max-width: 680px; margin: 0 auto; }
.my-profile-banner {
  border-radius: 16px;
  padding: 2rem 1.75rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.my-profile-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--acc) 0%, var(--acc2) 100%);
  opacity: .18;
}
.my-profile-banner-border {
  position: absolute; inset: 0;
  border-radius: 16px;
  border: 1px solid var(--border);
}
.my-avatar-big {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.6rem;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  border: 3px solid rgba(255,255,255,0.25);
  z-index: 1;
}
.my-banner-info { position: relative; z-index: 1; }
.my-banner-name { font-family: var(--font-d); font-size: 1.6rem; font-weight: 700; color: var(--txt); }
.my-banner-role { font-size: 12px; color: var(--txt2); margin-top: 2px; }
.my-banner-badge { margin-top: 6px; }

.my-profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 1.5rem;
}
.my-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}
.my-stat-card .val {
  font-family: var(--font-d);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--acc);
  line-height: 1;
  display: block;
}
.my-stat-card .lbl {
  font-size: 10px;
  color: var(--txt3);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 4px;
  display: block;
}

.my-section-title {
  font-family: var(--font-d);
  font-size: 1rem;
  font-weight: 700;
  color: var(--txt);
  font-style: italic;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.my-section-title::after { content:''; flex:1; height:1px; background:var(--border); }

.edit-profile-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-el);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--txt2);
  transition: all .2s;
  margin-bottom: 1.5rem;
}
.edit-profile-btn:hover { border-color: var(--acc); color: var(--acc); }

.fav-genres { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 1.5rem; }
.genre-pill {
  padding: 5px 14px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  background: var(--acc-dim);
  color: var(--acc);
  border: 1px solid var(--acc);
}

/* empty state */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--txt3);
  font-size: 13px;
}
.empty-state .big { font-size: 2.5rem; display: block; margin-bottom: .5rem; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 680px) {
  .comm-layout { grid-template-columns: 1fr; }
  .my-profile-stats { grid-template-columns: repeat(3,1fr); }
  .hdr { padding: 10px 1rem; height: auto; flex-wrap: wrap; }
  .logo { order: 1; }
  .nav-btns { order: 2; }
  .hdr-actions { order: 3; margin-left: auto; }
  .search-box { order: 4; flex-basis: 100%; max-width: 100%; margin-top: 10px; margin-left: 0; }
  .main { padding: 1rem; }
}
@media (max-width: 420px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* ── Light mode: explicit body override ─────────────────── */
/* (JS applies .light to <body>, so all var() on body are resolved here) */
body.light { background: var(--bg); color: var(--txt); }

/* ── Watched button on cards ─────────────────────────────── */
.watch-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 5px 0;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  color: var(--txt3);
  background: var(--bg-el);
  border: 1px solid var(--border);
  transition: all .2s;
  cursor: pointer;
}
.watch-btn:hover {
  color: var(--acc);
  border-color: var(--acc);
  background: var(--acc-dim);
}
.watch-btn.watched {
  color: #22c55e;
  border-color: rgba(34,197,94,0.5);
  background: rgba(34,197,94,0.1);
}

/* ── Watched checkmark badge on poster ───────────────────── */
.watched-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #22c55e;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}

/* Subtle green tint on watched cards */
.card-watched { border-color: rgba(34,197,94,0.3); }

/* ── Modal watch button ───────────────────────────────────── */
.modal-watch-btn {
  margin-left: auto;
  padding: 5px 14px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  color: var(--txt2);
  background: var(--bg-el);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .2s;
  flex-shrink: 0;
}
.modal-watch-btn:hover { color: var(--acc); border-color: var(--acc); }
.modal-watch-btn.watched { color: #22c55e; border-color: rgba(34,197,94,0.5); background: rgba(34,197,94,0.1); }

/* ── Watched list on My Profile ──────────────────────────── */
.watched-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 0.5rem;
}
.watched-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: border-color .2s;
}
.watched-item:hover { border-color: var(--acc); }
.watched-item-poster {
  width: 36px;
  height: 50px;
  border-radius: 6px;
  flex-shrink: 0;
}
.watched-item-info { flex: 1; min-width: 0; }
.watched-item-title { font-size: 12px; font-weight: 600; color: var(--txt); }
.watched-item-year  { font-size: 10px; color: var(--txt3); margin-top: 1px; }
.unwatch-btn {
  margin-top: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--txt3);
  background: none;
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 2px 8px;
  cursor: pointer;
  transition: all .2s;
}
.unwatch-btn:hover { color: #ef4444; border-color: #ef4444; }

/* ── Modal Badges Override ───────────────────────────────── */
.modal-badges .type-badge {
  position: static;
  display: inline-block;
  vertical-align: middle;
}

/* ── Header Profile Dropdown ─────────────────────────────── */
.hdr-user-wrap {
  position: relative;
}
.hdr-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 0;
  min-width: 160px;
  box-shadow: var(--shadow);
  z-index: 100;
  display: none;
}
.hdr-dropdown.show { display: block; animation: slideDown 0.2s ease; }
@keyframes slideDown { from { opacity:0; transform:translateY(-10px); } to { opacity:1; transform:translateY(0); } }
.hdr-dd-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--txt);
  cursor: pointer;
  background: transparent;
  border: none;
  transition: background 0.2s, color 0.2s;
}
.hdr-dd-item:hover {
  background: var(--acc-dim);
  color: var(--acc);
}

/* ── Responsive Fixes ── */
.movie-detail-hero-content {
  position: relative; z-index: 2; padding: 3rem; display: flex; gap: 2.5rem; align-items: flex-end;
}
.movie-detail-poster {
  width: 240px; border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,0.8);
}
.movie-detail-grid {
  display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; padding: 2rem 1.5rem;
}
.modal-hero-content {
  position: relative; z-index: 2; display: flex; gap: 1.25rem; align-items: flex-end;
}
.modal-poster {
  width: 120px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}

/* ─── 1024px: Tablet landscape ────────────────────────────── */
@media (max-width: 1024px) {
  .comm-layout { grid-template-columns: 100px 1fr; }
  #profile-pane { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ─── 900px: Tablet portrait ──────────────────────────────── */
@media (max-width: 900px) {
  .movie-detail-hero-content { flex-direction: column; align-items: flex-start; gap: 1.5rem; padding: 1.5rem; }
  .movie-detail-poster { width: 140px; }
  .movie-detail-grid { grid-template-columns: 1fr; }
  .movie-detail-grid > div { min-width: 0; }
  .modal-hero-content { flex-direction: column; align-items: flex-start; }
  .modal-poster { width: 100px; }
  .comm-layout { grid-template-columns: 90px 1fr; gap: 0.75rem; padding: 1rem; }
  .comm-layout > div { min-width: 0; }
  .modal { max-width: 95vw; }
  .search-box { max-width: 180px; }
}

/* ─── 768px: Large phone / small tablet ───────────────────── */
@media (max-width: 768px) {
  .hdr { padding: 0 1rem; gap: 8px; height: 52px; }
  .logo { font-size: 1.1rem; }
  .search-box { max-width: 140px; }
  .search-box input { font-size: 12px; padding: 5px 10px 5px 28px; }
  .nb { padding: 4px 10px; font-size: 12px; }
  .filters { padding: 6px 1rem; gap: 4px; }
  .filter-select { padding: 6px 28px 6px 12px; font-size: 12px; }
  .main { padding: 1rem; }
  .hero h1 { font-size: 1.5rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
  .comm-layout { grid-template-columns: 80px 1fr; gap: 0.6rem; padding: 0.75rem; }
  .user-card { padding: 7px 4px; }
  .overlay { padding: 0; align-items: flex-end; }
  .modal { border-radius: 18px 18px 0 0; max-height: 90dvh; max-width: 100vw; width: 100%; overflow-y: auto; }
  .modal-poster { width: 80px; }
  .modal-title { font-size: 1.3rem !important; }
  .cg, .type-badge { font-size: 10px !important; padding: 3px 8px !important; }
  .movie-detail-poster { width: 110px; }
  .movie-detail-hero-content { padding: 1rem; gap: 1rem; }
  .mpo-panel { padding: 1.2rem 1rem 2rem; }
}

/* ─── 600px: Phone ────────────────────────────────────────── */
@media (max-width: 600px) {
  .search-box { display: none; }
  .hdr { gap: 6px; }
  .comm-layout { grid-template-columns: 1fr; padding: 0.75rem; gap: 0.75rem; }
  .comm-layout > div:first-child { order: -1; }
  .user-list { flex-direction: row; overflow-x: auto; gap: 8px; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .user-list::-webkit-scrollbar { display: none; }
  .user-card { flex-direction: column; min-width: 68px; width: 68px; flex-shrink: 0; padding: 8px 4px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
  .modal { border-radius: 20px 20px 0 0; max-height: 92dvh; width: 100vw; }
  .modal-poster { width: 70px; }
  .modal-body { padding: 1rem; }
  .modal-rating-row { flex-wrap: wrap; gap: 6px; }
  .modal-watch-btn { padding: 5px 10px; font-size: 11px; }
  .rev-card { padding: 12px; }
  .sub-btn { padding: 8px 16px; font-size: 12px; }
  .movie-detail-poster { width: 90px; }
  .movie-detail-hero-content .modal-title { font-size: 1.8rem !important; }
  .mpo-panel { width: 100vw; border-radius: 0; padding: 1rem 0.9rem 2rem; }
}

/* ── Expand button in modal hero ──────────────────────────── */
.expand-btn {
  position: absolute;
  top: 12px;
  right: 50px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.22);
  padding: 5px 13px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  z-index: 5;
  backdrop-filter: blur(8px);
  transition: background 0.2s;
  white-space: nowrap;
}
.expand-btn:hover { background: var(--acc); border-color: var(--acc); }

/* ─── 400px: Tiny phones ──────────────────────────────────── */
@media (max-width: 400px) {
  .hdr { padding: 0 0.75rem; }
  .logo { font-size: 1rem; }
  .logo-icon { display: none; }
  .nb { padding: 4px 8px; font-size: 11px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; }
  .modal-poster { width: 56px; }
  .movie-detail-poster { width: 80px; }
}


/* ── Member Profile Overlay ───────────────────────────────── */
#member-profile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: flex-start;
  justify-content: flex-end;
}
.mpo-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
}
.mpo-panel {
  position: relative;
  z-index: 1;
  width: min(520px, 100vw);
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 2rem 1.8rem 3rem;
  display: flex;
  flex-direction: column;
  animation: mpo-slide-in 0.3s cubic-bezier(0.22,1,0.36,1);
}
@keyframes mpo-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.mpo-close {
  position: sticky;
  top: 0;
  align-self: flex-start;
  background: var(--bg-el);
  border: 1px solid var(--border);
  color: var(--txt);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.mpo-close:hover { background: var(--acc); color: #fff; }
.mpo-header {
  display: flex;
  gap: 1.2rem;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}
.mpo-section {
  margin-top: 1.8rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
}
.mpo-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--txt2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

/* ── Back button ─── icon only ──────────────────────────── */
.back-btn {
  background: var(--bg-el);
  border: 1px solid var(--border);
  color: var(--txt);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.back-btn:hover { background: var(--acc); color: #fff; }

/* ── Final Polish ─────────────────────────────────────────── */

/* Touch-friendly: minimum 44px tap targets on mobile */
@media (hover: none) and (pointer: coarse) {
  .nb, .sub-btn, .modal-watch-btn, .back-btn, .mpo-close, .modal-close {
    min-height: 44px;
    min-width: 44px;
  }
  .card:hover { transform: none; box-shadow: none; }
  .card:active { transform: scale(0.97); border-color: var(--acc); }
  .user-card:hover { transform: none; }
  .user-card:active { background: var(--acc-dim); }
}

/* iOS safe area support */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .hdr { padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); }
  .modal { padding-bottom: env(safe-area-inset-bottom); }
  .mpo-panel { padding-bottom: max(2rem, env(safe-area-inset-bottom)); }
}

/* Custom scrollbar (desktop only) */
@media (hover: hover) {
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: var(--bg-el); }
  ::-webkit-scrollbar-thumb { background: var(--border-h); border-radius: 99px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--acc); }
}

/* Selection colour */
::selection { background: var(--acc-dim); color: var(--acc); }

/* Focus rings (keyboard nav) */
:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Smooth image loading */
img { transition: opacity 0.3s ease; }
img[src=""] { opacity: 0; }

/* Prevent text overflow on cards */
.card-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rev-user   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Follow button active state */
.follow-btn-active { background: var(--acc) !important; color: #fff !important; }

/* Logo hover glow */
.logo:hover .logo-icon { filter: drop-shadow(0 0 6px var(--acc)); }
.logo { transition: opacity 0.2s; }
.logo:active { opacity: 0.75; }
