/* Self-hosted fonts: loading them from Google would send every visitor's IP address to Google */
@font-face { font-family: "Atkinson Hyperlegible Next"; src: url(fonts/atkinson-hyperlegible-next.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: Fraunces; src: url(fonts/fraunces.woff2) format("woff2"); font-weight: 400 600; font-display: swap; }
@font-face { font-family: Fraunces; src: url(fonts/fraunces-italic.woff2) format("woff2"); font-style: italic; font-weight: 400; font-display: swap; }

/* Designs. Token names come from the original theme: --velvet = page, --surface = raised areas, --line = dividers,
   --edge = form-field borders (3:1 against page and surface, WCAG 1.4.11), --screen = text, --bulb = accent. */
:root {
  --velvet: #1c0a0e; --surface: #2a1116; --line: #4a232a; --edge: #9a6a70;
  --screen: #f3e6cf; --muted: #bfa597; --bulb: #f4c252; --danger: #f08a7a;
  --serif: Fraunces, Georgia, serif; --sans: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  color-scheme: dark;
}
:root[data-theme="leinwand"] {
  --velvet: #efede8; --surface: #ffffff; --line: #c2bbae; --edge: #857e72;
  --screen: #1a1917; --muted: #625d54; --bulb: #a3122a; --danger: #b3261e;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --velvet: #efede8; --surface: #ffffff; --line: #c2bbae; --edge: #857e72;
    --screen: #1a1917; --muted: #625d54; --bulb: #a3122a; --danger: #b3261e;
    color-scheme: light;
  }
}
:root[data-theme="noir"] {
  --velvet: #111111; --surface: #1c1c1c; --line: #3a3a3a; --edge: #7a7a7a;
  --screen: #f0f0f0; --muted: #a3a3a3; --bulb: #ffffff; --danger: #ff8a80;
}
:root[data-theme="technicolor"] {
  --velvet: #0d2b26; --surface: #14392f; --line: #235245; --edge: #6a9c8d;
  --screen: #f5ecd7; --muted: #a7c2b5; --bulb: #ff5470; --danger: #ff9e8a;
}
:root[data-theme="mitternacht"] {
  --velvet: #0b1026; --surface: #141c3d; --line: #27325f; --edge: #6674b5;
  --screen: #e7eaff; --muted: #9aa3cf; --bulb: #57e3e8; --danger: #ff8a9a;
}
/* film noir shows the pictures in black and white until you point at one */
:root[data-theme="noir"] :is(.hero, .poster, .d-back, .detail > img) { filter: grayscale(1); transition: filter .3s; }
:root[data-theme="noir"] :is(.hero:hover, .card:hover .poster, .card:focus-visible .poster) { filter: none; }
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
body { background: var(--velvet); color: var(--screen); font: 16px/1.6 var(--sans); min-height: 100vh; display: flex; flex-direction: column; }
body > .wrap:first-child { flex: 1; width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
:focus-visible { outline: 2px solid var(--bulb); outline-offset: 3px; }
.link { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link:hover { color: var(--screen); }
.link.danger { color: var(--danger); }
.primary { background: var(--bulb); color: var(--velvet); border: 1px solid var(--bulb); font-weight: 700; padding: 9px 20px; border-radius: 999px; cursor: pointer; text-decoration: none; }
.secondary { background: none; color: var(--screen); border: 1px solid var(--line); font-weight: 700; padding: 8px 18px; border-radius: 999px; cursor: pointer; }
.secondary:hover { border-color: var(--muted); }
.secondary.danger { color: var(--danger); border-color: var(--danger); }
.primary:disabled, .secondary:disabled { opacity: .5; cursor: progress; }
.note { color: var(--muted); font-size: 14px; min-height: 1.6em; }
.error { color: var(--danger); font-size: 14px; min-height: 1.6em; }
.error:empty, .note:empty { min-height: 0; }
.banner { background: var(--surface); border-left: 3px solid var(--bulb); padding: 10px 14px; margin-bottom: 16px; font-size: 15px; display: flex; justify-content: space-between; gap: 16px; }

/* Masthead */
.top { display: flex; align-items: baseline; gap: 12px 32px; flex-wrap: wrap; padding: 28px 0 20px; }
.brand { font: 600 28px/1 var(--serif); letter-spacing: -0.01em; color: inherit; text-decoration: none; }

.tabs { display: flex; gap: 4px 20px; flex-wrap: wrap; flex: 1; }
.tabs button { background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; }
.tabs button:hover { color: var(--screen); }
.tabs button[aria-pressed="true"] { color: var(--screen); border-color: var(--bulb); }
.tabs .n { font-size: 13px; color: var(--bulb); margin-left: 5px; }
/* only the tabs of the chosen section show; the watchlist belongs to both */
.tabs[data-media="movie"] [data-media="tv"], .tabs[data-media="tv"] [data-media="movie"] { display: none; }
.media-switch { display: inline-flex; border: 1px solid var(--edge); border-radius: 999px; padding: 2px; align-self: center; }
.tabs .media-switch button { border: 0; border-radius: 999px; padding: 3px 12px; }
.tabs .media-switch button[aria-pressed="true"] { background: var(--bulb); color: var(--velvet); }
.user { display: flex; gap: 16px; align-items: baseline; font-size: 14px; }
.user .link[aria-pressed="true"] { color: var(--bulb); }

/* Announcements */
.announcements { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.announce { background: var(--surface); border-left: 3px solid var(--bulb); border-radius: 0 4px 4px 0; padding: 14px 18px; }
.announce.important { border-left-color: var(--danger); }
.announce-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.announce h2 { font: 600 19px/1.3 var(--serif); }
.announce p { margin-top: 6px; white-space: pre-line; max-width: 70ch; overflow-wrap: anywhere; }
.announce time { display: block; margin-top: 8px; font-size: 13px; color: var(--muted); }
.announce .link { font-size: 14px; flex-shrink: 0; }

/* The screen: the one loud element */
.hero { position: relative; min-height: min(62vh, 560px); border-radius: 4px; overflow: hidden; display: flex; align-items: flex-end; background: var(--surface); cursor: pointer; text-align: left; border: 0; width: 100%; padding: 0; }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: project 1.2s ease-out both; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--velvet) 2%, color-mix(in srgb, var(--velvet) 60%, transparent) 45%, transparent 75%); }
.hero-text { position: relative; z-index: 1; padding: 32px; max-width: 760px; }
.hero-kicker { color: var(--bulb); font-size: 15px; font-weight: 500; margin-bottom: 6px; }
.hero h2 { font: 400 clamp(38px, 6.5vw, 80px)/1 var(--serif); letter-spacing: -0.02em; text-wrap: balance; }
.hero p { opacity: .9; margin-top: 14px; max-width: 60ch; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@keyframes project { from { opacity: 0; filter: brightness(2.2) saturate(0); } to { opacity: 1; filter: none; } }
@media (prefers-reduced-motion: reduce) { .hero img { animation: none; } }

/* Filters */
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 14px 20px; padding: 28px 0 18px; border-bottom: 1px solid var(--line); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.field.grow { flex: 1 1 240px; }
.field input, .field select, .field textarea { background: var(--surface); border: 1px solid var(--edge); border-radius: 3px; padding: 8px 10px; color: var(--screen); min-width: 0; font-size: 16px; }
.field textarea { resize: vertical; }
.field input:disabled { opacity: .6; }
.range { display: flex; align-items: center; gap: 6px; }
.range input { width: 88px; }
.genres { display: flex; gap: 8px; flex-wrap: wrap; padding: 18px 0 8px; }
.genres button { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 13px; font-size: 14px; color: var(--muted); cursor: pointer; }
.genres button:hover { color: var(--screen); }
.genres button[aria-pressed="true"] { background: var(--bulb); border-color: var(--bulb); color: var(--velvet); }
.count { color: var(--muted); font-size: 14px; padding: 10px 0 0; min-height: 1.6em; }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 32px 18px; padding: 18px 0 40px; }
.card { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.poster { position: relative; aspect-ratio: 2/3; border-radius: 3px; overflow: hidden; background: var(--surface); outline: 1px solid transparent; outline-offset: 3px; transition: outline-color .2s; }
.poster img { width: 100%; height: 100%; object-fit: cover; }
.poster .none { height: 100%; display: grid; place-items: center; padding: 12px; text-align: center; font: 18px var(--serif); color: var(--muted); }
.card:hover .poster { outline-color: var(--bulb); }
.saved { display: none; position: absolute; top: 0; right: 10px; width: 16px; height: 26px; background: var(--bulb); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 74%, 0 100%); }
.card.is-saved .saved { display: block; }
.card h3 { font: 600 17px/1.25 var(--serif); margin-top: 10px; }
.card .sub { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--muted); margin-top: 3px; }
.card .score { color: var(--bulb); font-variant-numeric: tabular-nums; }
.status { color: var(--muted); padding: 56px 0; text-align: center; font: 20px var(--serif); max-width: 52ch; margin: 0 auto; }
.more { display: block; margin: 0 auto 72px; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 9px 24px; cursor: pointer; }
.more:hover { border-color: var(--bulb); }

/* Dialogs: margin auto re-centers what the global reset un-centered */
dialog { margin: auto; background: var(--surface); color: var(--screen); border: 0; border-radius: 4px; padding: 0; max-width: 820px; width: calc(100% - 32px); max-height: calc(100dvh - 32px); }
dialog::backdrop { background: color-mix(in srgb, color-mix(in srgb, black 75%, var(--velvet)) 85%, transparent); }
dialog[open] { animation: open .25s ease-out; }
@keyframes open { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { dialog[open] { animation: none; } }
.close { position: absolute; top: 12px; right: 12px; z-index: 2; width: 36px; height: 36px; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--velvet) 75%, transparent); font-size: 20px; cursor: pointer; }
.d-back { position: relative; aspect-ratio: 16/7; background: var(--velvet) center/cover; }
.d-back::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--surface), transparent 70%); }
.detail { display: grid; grid-template-columns: 180px 1fr; gap: 28px; padding: 0 28px 28px; margin-top: -90px; position: relative; }
.detail > img { width: 100%; border-radius: 3px; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.detail h2 { font: 400 clamp(30px, 4vw, 42px)/1.05 var(--serif); letter-spacing: -0.015em; margin-top: 70px; }
.tagline { font: italic 17px var(--serif); color: var(--muted); margin-top: 8px; }
.overview { margin-top: 16px; max-width: 62ch; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin-top: 20px; font-size: 15px; }
.facts dt { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 22px; }
.watch { background: none; color: var(--screen); border: 1px solid var(--line); font-weight: 700; padding: 8px 18px; border-radius: 999px; cursor: pointer; }
.watch[aria-pressed="true"] { border-color: var(--bulb); color: var(--bulb); }
.player { aspect-ratio: 16/9; background: #000; }
.player iframe { display: block; width: 100%; height: 100%; border: 0; }
/* a bar above the video keeps the close button off YouTube's own controls */
dialog:has(.playing) { padding-top: 56px; }
dialog:has(.playing) .close { top: 10px; }
#dlgBody.playing .detail { margin-top: 0; padding-top: 24px; }
#dlgBody.playing .detail h2 { margin-top: 0; }
#legalDlg { padding: 36px 32px 32px; max-width: 760px; }
#legalDlg h2 { font: 400 34px/1.1 var(--serif); margin-bottom: 16px; }
.legal-text { white-space: pre-line; max-width: 70ch; overflow-wrap: anywhere; }

/* Reviews */
.reviews { border-top: 1px solid var(--line); margin: 0 28px; padding: 24px 0 32px; }
.reviews h3 { font: 600 21px/1.2 var(--serif); }
.rv-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 16px; }
.rv-head + .rv-head { margin-top: 8px; }
.rv-avg { color: var(--muted); font-size: 15px; }
.rv-avg strong { color: var(--bulb); font: 600 24px var(--serif); margin-right: 4px; }
.rv-ext { margin: 0 0 12px; }
.rv-ext .score { color: var(--bulb); font-weight: 700; }
.rv-form { display: flex; flex-direction: column; gap: 14px; margin-bottom: 28px; }
.rv-scale { border: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.rv-scale legend { font-size: 14px; color: var(--muted); padding: 0; margin-bottom: 6px; }
.rv-scale label { position: relative; }
.rv-scale input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.rv-scale span { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--edge); border-radius: 50%; font-variant-numeric: tabular-nums; }
.rv-scale label:hover span { border-color: var(--muted); }
.rv-scale input:checked + span { background: var(--bulb); border-color: var(--bulb); color: var(--velvet); font-weight: 700; }
.rv-scale input:focus-visible + span { outline: 2px solid var(--bulb); outline-offset: 2px; }
.reviews .field textarea { background: var(--velvet); }
.rv-form .actions { margin-top: 0; }
.rv-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 20px; margin-bottom: 32px; }
.rv-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: 14px; color: var(--muted); }
.rv-name { font-weight: 700; color: var(--screen); font-size: 15px; }
.rv-meta .score { color: var(--bulb); font-weight: 700; }
.rv-text { margin-top: 4px; white-space: pre-line; max-width: 68ch; overflow-wrap: anywhere; }
.rv.clamp .rv-text { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.rv .link { font-size: 14px; margin-top: 4px; }

/* Sign in */
.auth { max-width: 460px; margin: 56px auto 72px; }
.auth h2 { font: 400 40px/1.1 var(--serif); letter-spacing: -0.015em; text-wrap: balance; }
.auth .hint { color: var(--muted); margin: 12px 0 24px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack > .primary, .stack > .secondary { align-self: flex-start; }
.switch { color: var(--muted); margin-top: 22px; font-size: 15px; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.field input.code { font-size: 24px; letter-spacing: .25em; font-variant-numeric: tabular-nums; max-width: 260px; }
.choices { display: flex; flex-direction: column; gap: 14px; }
.choice { border: 1px solid var(--line); border-radius: 4px; padding: 18px; }
.choice h3 { font: 600 19px/1.3 var(--serif); }
.choice p { color: var(--muted); margin: 4px 0 14px; font-size: 15px; }
.totp { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; margin-bottom: 18px; }
.qr { background: #fff; padding: 6px; border-radius: 4px; width: 172px; height: 172px; }
.totp p { font-size: 14px; color: var(--muted); max-width: 32ch; }
/* secrets and recovery codes must be copied character for character, so they get a fixed-width face */
.secret, .codes { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.secret { display: block; color: var(--screen); font-size: 15px; word-break: break-all; margin-top: 6px; user-select: all; }
.codes { list-style: none; display: grid; grid-template-columns: repeat(2, max-content); gap: 6px 28px; font-size: 18px; padding: 16px 20px; background: var(--surface); border-radius: 4px; margin: 4px 0 18px; user-select: all; }

/* Admin and account */
.admin h2 { font: 400 40px/1.1 var(--serif); letter-spacing: -0.015em; padding: 12px 0 8px; }
.admin h3 { font: 600 22px var(--serif); margin-bottom: 12px; }
.admin h4 { font: 600 17px var(--serif); margin: 18px 0 8px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 56px; }
.panel { border-top: 1px solid var(--line); padding: 24px 0 32px; }
.panel .facts { margin-top: 0; }
.panel .stack .field { max-width: 420px; }
.panel p { max-width: 60ch; }
.panel > p + .stack, .panel > p + .actions { margin-top: 14px; }
.check { display: flex; gap: 10px; align-items: center; }
.check input { width: 18px; height: 18px; accent-color: var(--bulb); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th { text-align: left; font-weight: 500; color: var(--muted); }
th, td { padding: 9px 16px 9px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
td input { width: 18px; height: 18px; accent-color: var(--bulb); }
td .link + .link { margin-left: 14px; }
#auditRows td:last-child, #blockRows td:nth-child(2) { white-space: normal; min-width: 18ch; overflow-wrap: anywhere; }
#auditRows td { vertical-align: top; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em; }
.field input[readonly] { color: var(--muted); }
.google-btn { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.google-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.or { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; margin: 22px 0 16px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.tag { display: inline-block; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; }
.tag.bad { border-color: var(--danger); color: var(--danger); }
.warn { color: var(--bulb); }

/* Design picker: each option previews its own palette */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; border: 0; padding: 0; margin-top: 4px; }
.theme { position: relative; display: flex; flex-direction: column; gap: 8px; cursor: pointer; }
.theme input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.theme-preview { height: 76px; border-radius: 4px; border: 2px solid var(--line); background: var(--p-bg); padding: 10px 12px; display: flex; flex-direction: column; justify-content: space-between; }
.theme-preview b { font: 600 20px/1 var(--serif); color: var(--p-text); }
.theme-preview i { display: block; height: 6px; width: 46%; border-radius: 3px; background: var(--p-accent); box-shadow: 0 10px 0 -1px var(--p-surface); }
.theme-auto .theme-preview { background: linear-gradient(135deg, var(--p-bg) 50%, var(--p-bg2) 50%); }
.theme-name { font-weight: 700; font-size: 15px; }
.theme-desc { font-size: 13px; color: var(--muted); line-height: 1.45; }
.theme input:checked ~ .theme-preview { border-color: var(--bulb); box-shadow: 0 0 0 1px var(--bulb); }
.theme input:focus-visible ~ .theme-preview { outline: 2px solid var(--bulb); outline-offset: 3px; }
.theme:hover .theme-preview { border-color: var(--muted); }

/* Footer */
.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; border-top: 1px solid var(--line); padding-top: 22px; padding-bottom: 36px; margin-top: 24px; font-size: 13px; color: var(--muted); width: 100%; }
.foot img { height: 12px; width: auto; }
.foot p { max-width: 70ch; }
.foot nav { margin-left: auto; display: flex; gap: 18px; }
.foot a { color: inherit; }

@media (max-width: 600px) {
  .detail { grid-template-columns: 1fr; margin-top: -60px; padding: 0 18px 22px; }
  .detail > img { max-width: 140px; }
  .detail h2 { margin-top: 0; }
  .reviews { margin: 0 18px; }
  .hero-text { padding: 20px; }
  .foot nav { margin-left: 0; }
}
