/* Mise En Screen web app. Colours follow the adopted Mac redesign (dashboard.py). */
:root {
  color-scheme: light dark;
  --bg: #f4f3f0; --surface: #ffffff; --surface-2: #faf9f7; --border: #e6e3dc;
  --text: #121212; --text-2: #4f4d48; --muted: #87857e;
  --accent: #c8102e; --accent-2: #a30d25; --accent-soft: #fbe3e7;
  --good: #1f8a4c; --chip: #f0eee9; --err: #c0392b;
  --shadow: 0 1px 2px rgba(20,20,20,.04), 0 4px 16px rgba(20,20,20,.06);
  --radius: 14px;
  --s-imdb_quality: #d4a017; --s-genre_match: #3b82f6; --s-actor_match: #e11d48;
  --s-director_match: #10b981; --s-era_match: #8b5cf6; --s-popularity: #94a3b8;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e10; --surface: #17171a; --surface-2: #1d1d21; --border: #2a2a2f;
    --text: #f3f2ef; --text-2: #bdbbb4; --muted: #85837c;
    --accent: #ff3b55; --accent-2: #ff5c72; --accent-soft: #3a1820;
    --good: #3ccf7a; --chip: #24242a; --err: #ff6b6b;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.8rem; line-height: 1.2; margin: .2em 0 .5em; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; margin: .2em 0 .5em; }
h3 { font-size: 1rem; margin: 0 0 .2em; }
main { max-width: 1180px; margin: 0 auto; padding: 16px 16px 96px; }
.hint { color: var(--muted); font-size: .9rem; }
.lede { color: var(--text-2); font-size: 1.1rem; max-width: 46rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; }
.narrow { max-width: 560px; margin: 40px auto; }
.error { border-color: var(--err); color: var(--err); }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* header */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 18px;
  padding: 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.brand { font-weight: 800; color: var(--text); text-decoration: none; white-space: nowrap; }
.beta { font-size: .7rem; font-weight: 700; color: var(--accent); background: var(--accent-soft);
  padding: 2px 6px; border-radius: 99px; vertical-align: middle; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs a { color: var(--text-2); text-decoration: none; padding: 6px 12px; border-radius: 99px; font-weight: 600; font-size: .95rem; }
.tabs a[aria-current] { background: var(--text); color: var(--bg); }
.me { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; text-decoration: none; font-weight: 700; }

/* controls */
input[type=email], input[type=date], select, input[type=file] {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 12px; max-width: 100%; }
input[type=email] { flex: 1; min-width: 220px; }
button, .btn { font: inherit; font-weight: 600; cursor: pointer; border-radius: 99px; padding: 8px 16px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none;
  display: inline-block; }
button:hover, .btn:hover { border-color: var(--text-2); }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.danger { background: transparent; border-color: var(--err); color: var(--err); }
.quiet { color: var(--muted); }
form .card input[type=file], .card input[type=file] { display: block; margin: 12px 0; }
label { display: block; font-weight: 600; margin: 8px 0 4px; }

/* home */
.hero-intro { max-width: 720px; margin: 48px auto; }
.hero-intro h1 { font-size: 2.4rem; }
.signin label { margin-top: 0; }

/* discover */
.bar { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tuned { font-size: .9rem; font-weight: 600; color: var(--text-2); background: var(--chip);
  padding: 4px 12px; border-radius: 99px; text-decoration: none; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; }
.chips a { white-space: nowrap; background: var(--chip); color: var(--text-2); padding: 4px 12px; border-radius: 99px;
  text-decoration: none; font-size: .9rem; }
.chips a[aria-current] { background: var(--text); color: var(--bg); }
.hero { display: grid; grid-template-columns: 1fr; gap: 24px; margin-bottom: 20px; }
.hero.has-poster { grid-template-columns: 220px 1fr; }
.hero-poster { width: 100%; border-radius: 10px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--accent); margin: 0; }
.hero h2 { font-size: 1.8rem; margin: .1em 0; }
.year { color: var(--muted); font-weight: 400; }
.match { color: var(--good); font-weight: 700; margin: 0 0 6px; }
.match.big { font-size: 1.2rem; }
.reasons { margin: 0 0 8px; padding-left: 18px; color: var(--text-2); font-size: .92rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.pick { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.poster { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; display: block; background: var(--chip); }
.poster.none { display: grid; place-items: center; padding: 16px; text-align: center; color: var(--muted); font-weight: 700; }
.pick-body { padding: 12px 14px 14px; display: flex; flex-direction: column; flex: 1; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }
.actions form { margin: 0; }
.actions button, .actions .btn { padding: 5px 12px; font-size: .85rem; }
.seen { width: 100%; }
.seen summary { list-style: none; display: inline-block; padding: 5px 12px; font-size: .85rem; }
.seen summary::-webkit-details-marker { display: none; }
.seen[open] { background: var(--surface-2); border-radius: 10px; padding: 8px; }
.seen-form label { font-size: .85rem; }
.seen-form button { margin-top: 8px; }

/* score mix bars */
.mix { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--chip); margin: 6px 0; width: 100%; }
.seg { flex: var(--w) 0 0; }
.s-imdb_quality { background: var(--s-imdb_quality); } .s-genre_match { background: var(--s-genre_match); }
.s-actor_match { background: var(--s-actor_match); } .s-director_match { background: var(--s-director_match); }
.s-era_match { background: var(--s-era_match); } .s-popularity { background: var(--s-popularity); }
.mix-legend { list-style: none; padding: 0; margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 4px 12px;
  font-size: .8rem; color: var(--text-2); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }

/* tune */
fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-weight: 700; margin-bottom: 8px; }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.preset { margin: 0; cursor: pointer; font-weight: 400; display: flex; flex-direction: column; gap: 4px; }
.preset:has(input:checked) { border-color: var(--accent); outline: 2px solid var(--accent); }
.preset input { position: absolute; opacity: 0; }
.preset-name { font-weight: 700; }
.seg-control label { font-weight: 400; display: flex; gap: 8px; align-items: baseline; }

/* tables */
.list { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 16px; font-size: .95rem; }
.list th, .list td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.list th { color: var(--muted); font-weight: 600; font-size: .85rem; }
.list tr.miss td { color: var(--muted); }
.unmatched { columns: 2; color: var(--text-2); font-size: .9rem; }

footer { max-width: 1180px; margin: 0 auto; padding: 24px 16px 100px; color: var(--muted); font-size: .8rem; }
.tmdb-badge { display: inline-block; font-weight: 800; letter-spacing: .05em; color: #fff;
  background: linear-gradient(90deg, #90cea1, #01b4e4); padding: 1px 8px; border-radius: 6px; }

/* phone: tabs become a bottom bar */
@media (max-width: 720px) {
  /* backdrop-filter would make the header the containing block of the fixed bottom bar */
  .top { backdrop-filter: none; background: var(--bg); }
  .tabs { position: fixed; bottom: 0; left: 0; right: 0; justify-content: space-around; gap: 0;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabs a { font-size: .8rem; padding: 6px 8px; }
  .hero, .hero.has-poster { grid-template-columns: 1fr; }
  .hero-poster { max-width: 200px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .hero-intro h1 { font-size: 1.9rem; }
  .list { font-size: .85rem; }
  .unmatched { columns: 1; }
}

/* privacy and terms */
.prose { max-width: 760px; margin: 24px auto; }
.prose h2 { margin-top: 1.4em; }
.prose li { margin: .3em 0; }

/* account: ZIP code */
.zip-card { margin-bottom: 16px; max-width: 560px; }
.zip-card input[type=text] { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 12px; width: 10em; }
.error-text { color: var(--err); margin: 4px 0; }
.ok-text { color: var(--good); margin: 4px 0; font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* my top 100 */
.btn.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.topsearch { margin: 12px 0 16px; }
.topsearch label { margin-top: 0; }
input[type=search], input[type=text].linkbox, .share input[type=text], .rank-in, .astext textarea {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
input[type=search] { flex: 1; min-width: 200px; }
.results { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.results li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.results li img, .thumb { width: 36px; height: 54px; object-fit: cover; border-radius: 4px; background: var(--chip); flex: none; display: block; }
.results .rt { flex: 1; min-width: 160px; }
.results form { margin: 0; }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; color: var(--text-2); background: var(--chip); padding: 1px 8px; border-radius: 99px; margin-left: 4px; }
.rank-in { width: 4.2em; padding: 6px 6px; text-align: center; font-weight: 700; }
.toplist { list-style: none; padding: 0; margin: 0 0 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.toprow { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.toprow:last-child { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }
.toprow:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.toprow .rt { flex: 1; min-width: 0; }
.toprow form { margin: 0; }
.handle { cursor: grab; color: var(--muted); user-select: none; touch-action: none; padding: 4px 2px; letter-spacing: -2px; }
.toprow.dragging { box-shadow: var(--shadow); position: relative; z-index: 2; opacity: .95; }
.rowbtns { display: flex; gap: 4px; }
.icon { width: 32px; height: 32px; padding: 0; display: inline-grid; place-items: center; border-radius: 50%; font-size: 1rem; text-decoration: none; }
.icon:disabled { opacity: .35; cursor: default; }
.topgrid { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.topgrid li { padding: 0; overflow: hidden; position: relative; }
.rankbadge { position: absolute; top: 8px; left: 8px; background: var(--accent); color: #fff; font-weight: 800; font-size: .85rem;
  min-width: 28px; height: 28px; border-radius: 99px; display: grid; place-items: center; padding: 0 6px; }
.share { margin: 16px 0; }
.share .row { margin: 8px 0; }
.share label { margin: 0; }
.linkbox { flex: 1; min-width: 220px; }
.astext textarea { width: 100%; margin: 8px 0; }
.astext summary { cursor: pointer; font-weight: 600; margin-top: 8px; }
.undo { margin: 8px 0; padding: 10px 16px; }
.resetform { margin: 0 0 16px; }
.cta { margin-top: 20px; }
.steps { padding-left: 20px; color: var(--text-2); }
.steps li { margin: 4px 0; }
.mac { max-width: 760px; }
.donelist { padding-left: 20px; }
.donelist li { margin: 4px 0; }
.narrow.wide { max-width: 720px; }
.js .js-only[hidden] { display: none; }
.js-only { display: none; }
.js .js-only { display: inline-block; }
@media (max-width: 720px) {
  .wide-only { display: none; }
  .toprow { gap: 6px; padding: 8px; }
  .toprow .thumb { display: none; }
  .toprow .rank-in { width: 2.9em; padding: 6px 2px; }
  .rowbtns { gap: 2px; }
  .rowbtns .icon { width: 28px; height: 28px; font-size: .9rem; }
  .topgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .topgrid .pick-body { padding: 6px 8px 8px; }
  .topgrid h3 { font-size: .8rem; }
}
