/* CineVote — a bright, filmic dark theme.
   One stylesheet, no build step, no external fonts (our CSP allows neither
   remote styles nor inline ones). */

:root {
  --ink:      #0b0818;
  --ink-2:    #150f2e;
  --surface:  rgba(255, 255, 255, 0.045);
  --surface-2:rgba(255, 255, 255, 0.075);
  --line:     rgba(255, 255, 255, 0.10);
  --line-2:   rgba(255, 255, 255, 0.18);
  --text:     #f4f0ff;
  --muted:    #a79dc8;
  --coral:    #ff5d73;
  --pink:     #ff6ec7;
  --violet:   #8b5cf6;
  --teal:     #2ee6c5;
  --amber:    #ffc247;
  --gold:     #ffd166;
  --silver:   #cfd8ff;
  --bronze:   #e59a63;
  --danger:   #ff7a7a;

  --brand: linear-gradient(100deg, var(--coral), var(--violet) 55%, var(--teal));
  --radius: 18px;
  --radius-sm: 11px;
  --shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.85);
  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
}

/* Colour wash behind everything. */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(48rem 34rem at 12% -8%,  rgba(255, 93, 115, 0.30), transparent 65%),
    radial-gradient(42rem 30rem at 92% 4%,   rgba(139, 92, 246, 0.34), transparent 68%),
    radial-gradient(52rem 34rem at 68% 96%,  rgba(46, 230, 197, 0.18), transparent 70%),
    radial-gradient(38rem 26rem at 4% 88%,   rgba(255, 194, 71, 0.14), transparent 70%),
    linear-gradient(180deg, var(--ink-2), var(--ink) 55%);
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.015em; }

/* ------------------------------------------------------------- top bar --- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(11, 8, 24, 0.55);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 11px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 12px;
  background: var(--brand);
  font-size: 19px;
  box-shadow: 0 8px 22px -10px rgba(255, 93, 115, 0.9);
}
.brand-name {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.topnav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.pill {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}
.pill-votes { border-color: rgba(46, 230, 197, 0.55); color: var(--teal); background: rgba(46, 230, 197, 0.10); }
.pill-spent { border-color: rgba(255, 194, 71, 0.5);  color: var(--amber); background: rgba(255, 194, 71, 0.10); }
.pill-admin { border-color: rgba(255, 110, 199, 0.55); color: var(--pink); background: rgba(255, 110, 199, 0.10); }
.pill-admin:hover { text-decoration: none; background: rgba(255, 110, 199, 0.2); }
.pill-user { color: var(--muted); }

/* -------------------------------------------------------------- buttons --- */

.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  padding: 9px 16px;
  border-radius: 11px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.12); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.btn-primary { background: var(--brand); border-color: transparent; color: #16021d; font-weight: 750; }
.btn-vote {
  background: linear-gradient(100deg, var(--teal), #58f0ff);
  border-color: transparent;
  color: #04241f;
  font-weight: 750;
}
.btn-voted { background: rgba(46, 230, 197, 0.13); border-color: rgba(46, 230, 197, 0.5); color: var(--teal); }
.btn-search { background: rgba(139, 92, 246, 0.18); border-color: rgba(139, 92, 246, 0.55); color: #d9ccff; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface); }
.btn-danger { background: transparent; border-color: rgba(255, 122, 122, 0.4); color: var(--danger); }
.btn-danger:hover { background: rgba(255, 122, 122, 0.14); }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }

/* ---------------------------------------------------------------- flash --- */

.flash {
  position: fixed;
  z-index: 30;
  top: 84px;
  right: clamp(16px, 4vw, 44px);
  left: auto;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 13px;
  border: 1px solid var(--line-2);
  background: rgba(18, 12, 38, 0.94);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  font-weight: 600;
  /* Fades itself out; no JS, and it never blocks a card for long. */
  animation: rise 0.3s ease both, flashout 0.6s ease 6s forwards;
}
.flash-ok    { border-color: rgba(46, 230, 197, 0.6);  color: #b9fff2; }
.flash-error { border-color: rgba(255, 122, 122, 0.6); color: #ffd7d7; }

@keyframes rise { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes flashout { to { opacity: 0; visibility: hidden; } }

@media (max-width: 640px) {
  .flash { top: auto; bottom: 16px; right: 16px; left: 16px; max-width: none; }
}

/* ------------------------------------------------------------ demo mode --- */

.demobar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 1180px;
  width: calc(100% - 2 * clamp(16px, 4vw, 44px));
  margin: 16px auto 0;
  padding: 11px 16px;
  border-radius: 13px;
  border: 1px dashed rgba(255, 194, 71, 0.55);
  background: rgba(255, 194, 71, 0.09);
  color: #ffe6b0;
  font-size: 14px;
}
.demotag {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--amber);
  color: #2a1a00;
  font-size: 11.5px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.demohint { color: var(--muted); }
kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  background: rgba(6, 4, 15, 0.7);
  font-family: inherit;
  font-size: 0.9em;
  font-weight: 650;
  text-align: center;
  color: #ded6f7;
}

code {
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(6, 4, 15, 0.6);
  border: 1px solid var(--line);
  font-size: 0.9em;
}

.demologins { margin: 20px 0 0; padding-top: 18px; border-top: 1px solid var(--line); }
.demologins-title { margin: 0 0 10px; font-size: 13.5px; font-weight: 700; color: #cfc6ea; }
.demologins-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 7px; }
.demologin {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: rgba(6, 4, 15, 0.45);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}
.demologin:hover, .demologin:focus-visible {
  border-color: var(--teal);
  transform: translateY(-1px);
  outline: none;
}
.demologin-name { font-weight: 700; }
.demologin-note { color: var(--muted); font-size: 12.5px; margin-left: auto; }

/* ----------------------------------------------------------------- page --- */

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(22px, 4vw, 40px) clamp(16px, 4vw, 44px) 72px;
}

.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 44px) 40px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
}

/* ----------------------------------------------------------------- hero --- */

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: clamp(18px, 4vw, 40px);
  align-items: center;
  padding: clamp(22px, 4vw, 36px);
  border-radius: 26px;
  border: 1px solid var(--line-2);
  background:
    linear-gradient(120deg, rgba(255, 93, 115, 0.16), rgba(139, 92, 246, 0.14) 45%, rgba(46, 230, 197, 0.12)),
    var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber);
}
.hero-title { font-size: clamp(30px, 5.4vw, 52px); font-weight: 850; }
.hero-title .year { font-weight: 500; color: var(--muted); font-size: 0.55em; }
.hero-sub { margin: 12px 0 0; font-size: 17px; color: #ded6f7; }
.hero-hint { margin: 10px 0 0; color: var(--muted); font-size: 14px; max-width: 52ch; }
.hero-art { width: clamp(140px, 22vw, 210px); }
.hero-art .poster { border-radius: 16px; box-shadow: 0 22px 44px -18px rgba(0, 0, 0, 0.9); }

/* --------------------------------------------------------------- budget --- */

.budget {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 22px 0 0;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}
.dots { display: flex; gap: 8px; }
.dot {
  width: 17px; height: 17px;
  border-radius: 50%;
  border: 2px solid rgba(46, 230, 197, 0.65);
  background: rgba(46, 230, 197, 0.10);
}
.dot-used { background: var(--brand); border-color: transparent; box-shadow: 0 0 14px -2px rgba(255, 93, 115, 0.7); }
.budget-text { margin: 0; color: #ded6f7; }
.budget-meta { display: block; color: var(--muted); font-size: 13px; }

/* -------------------------------------------------------------- suggest --- */

.suggest {
  margin: 22px 0 0;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}
.suggest > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 20px;
  cursor: pointer;
  font-weight: 700;
  font-size: 16px;
  list-style: none;
}
.suggest > summary::-webkit-details-marker { display: none; }
.suggest > summary:hover { color: var(--teal); }
.plus {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 9px;
  background: var(--brand);
  color: #180221;
  font-weight: 900;
}

.suggest-form, .authform {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 4px 20px 22px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field-actions { grid-column: 1 / -1; }
label { font-size: 13.5px; font-weight: 650; color: #cfc6ea; }
.opt { color: var(--muted); font-weight: 400; }

input[type="text"], input[type="url"], input[type="password"], textarea {
  font: inherit;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: rgba(6, 4, 15, 0.55);
  color: var(--text);
  width: 100%;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(46, 230, 197, 0.16);
}
textarea { resize: vertical; }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); }
.searchfield { position: relative; }
.searchrow { display: flex; gap: 10px; }
.searchrow input { flex: 1 1 auto; min-width: 0; }
/* While the dropdown is open the field and the list read as one control. */
.searchfield.open .searchrow input {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}

.formerror {
  margin: 0 0 4px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 122, 122, 0.5);
  background: rgba(255, 122, 122, 0.12);
  color: #ffd7d7;
  font-weight: 600;
}

/* ------------------------------------------------------- search results --- */

/* An author display rule beats the browser's [hidden] { display: none }, so the
   hidden state has to be spelled out or an empty list paints a stray strip. */
.results[hidden] { display: none; }

/* The suggestion list hangs off the bottom of the search field, like any
   autocomplete: it overlays the rest of the form instead of shoving it down. */
.results {
  position: absolute;
  z-index: 15;
  top: 100%;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(52vh, 400px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  border: 1px solid var(--teal);
  border-top: 1px solid var(--line-2);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: #0d0920;
  box-shadow: 0 22px 44px -20px rgba(0, 0, 0, 0.95);
}
.result {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 7px 8px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background 0.12s ease;
}
.result:hover, .result:focus-visible {
  background: rgba(46, 230, 197, 0.12);
  outline: none;
}
/* Where the arrow keys are. Needs to read clearly even when the mouse is
   hovering somewhere else entirely. */
.result.active {
  background: rgba(46, 230, 197, 0.18);
  box-shadow: inset 3px 0 0 var(--teal);
}

/* Fixed box: a poster that fails to load can never reflow the row, and its
   alt text stays inside. */
.result .poster {
  width: 36px;
  height: 54px;
  flex: 0 0 36px;
  aspect-ratio: auto;
  border-radius: 5px;
  overflow: hidden;
  font-size: 12px;
}
.result-label { display: flex; flex-direction: column; min-width: 0; }
.result-title {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-year {
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.results-msg { margin: 0; padding: 6px 8px; color: var(--muted); font-size: 13.5px; }

/* -------------------------------------------------------------- filters --- */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin: 22px 0 0;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}
.filters .field { gap: 5px; }
.filters .field-grow { flex: 1 1 240px; }
.filters label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.filter-buttons { flex-direction: row; gap: 8px; align-items: center; }

input[type="search"], select {
  font: inherit;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: rgba(6, 4, 15, 0.55);
  color: var(--text);
  max-width: 100%;
}
select { cursor: pointer; }
input[type="search"]:focus, select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(46, 230, 197, 0.16);
}

/* Card / list toggle: two links styled as one segmented control. */
.viewswitch { margin-left: auto; }
.switch {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: rgba(6, 4, 15, 0.55);
}
.switch-option {
  padding: 7px 15px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--muted);
}
.switch-option:hover { color: var(--text); text-decoration: none; }
.switch-option.on {
  background: var(--brand);
  color: #16021d;
}
.switch-option.on:hover { color: #16021d; }

.credits { margin: 0; font-size: 12.5px; color: var(--muted); }
.credits a { color: #cbbcff; }

/* ------------------------------------------------------------- similar --- */

.similar-head {
  display: grid;
  grid-template-columns: clamp(110px, 16vw, 170px) 1fr;
  gap: clamp(16px, 3vw, 32px);
  align-items: start;
  padding: clamp(18px, 3vw, 28px);
  border-radius: 24px;
  border: 1px solid var(--line-2);
  background:
    linear-gradient(120deg, rgba(139, 92, 246, 0.16), rgba(46, 230, 197, 0.10)),
    var(--surface);
  box-shadow: var(--shadow);
}
.similar-head .hero-title { font-size: clamp(24px, 4vw, 38px); margin-bottom: 10px; }
.similar-head .meta { margin-bottom: 8px; }
.similar-art .poster { border-radius: 14px; }

.matchwrap { display: flex; flex-direction: column; gap: 0; }
.matchwrap .card { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.reasons {
  list-style: none;
  margin: 0;
  padding: 10px 14px 12px;
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  background: rgba(139, 92, 246, 0.10);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.reasons li { font-size: 12.5px; color: #ded6f7; }
.reasons li::before { content: "✓ "; color: var(--teal); font-weight: 800; }

.grid-tips { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.card-tip { border-style: dashed; }
.card-tip .poster { aspect-ratio: 2 / 3; }

.foot-links { display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.similar-link { font-size: 12.5px; font-weight: 700; color: var(--pink); }

@media (max-width: 640px) {
  .similar-head { grid-template-columns: 1fr; }
  .similar-art { width: min(150px, 40vw); }
}

/* ------------------------------------------------------------- sections --- */

.section { margin: 40px 0 0; }
.section-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  font-size: clamp(19px, 2.6vw, 25px);
  font-weight: 800;
  margin-bottom: 16px;
}
.section-note { font-size: 13.5px; font-weight: 500; color: var(--muted); }
.empty {
  margin: 0;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px dashed var(--line-2);
  color: var(--muted);
}

.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }

/* ---------------------------------------------------------------- cards --- */

/* Voting returns to #film-<id>, so the target must clear the sticky header. */
.card, .table tr { scroll-margin-top: 96px; }

.card:target {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(46, 230, 197, 0.35), var(--shadow);
}
.table tr:target { background: rgba(46, 230, 197, 0.08); }

.card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--line-2); }
.card-voted { border-color: rgba(46, 230, 197, 0.5); }

.card-art { position: relative; }
.poster { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; background: var(--ink-2); }
.card-top .poster { aspect-ratio: 2 / 2.6; }
.card-seen .poster { aspect-ratio: 16 / 10; }

.poster-empty {
  display: grid;
  place-items: center;
  font-size: clamp(28px, 6vw, 46px);
  font-weight: 850;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.04em;
}
.ph-0 { background: linear-gradient(150deg, #ff5d73, #8b5cf6); }
.ph-1 { background: linear-gradient(150deg, #8b5cf6, #2ee6c5); }
.ph-2 { background: linear-gradient(150deg, #ffc247, #ff5d73); }
.ph-3 { background: linear-gradient(150deg, #2ee6c5, #3b82f6); }
.ph-4 { background: linear-gradient(150deg, #ff6ec7, #ffc247); }
.ph-5 { background: linear-gradient(150deg, #3b82f6, #8b5cf6); }

.rank {
  position: absolute;
  top: 10px; left: 10px;
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 13px;
  font-size: 22px;
  background: rgba(8, 5, 18, 0.72);
  border: 1px solid var(--line-2);
  backdrop-filter: blur(6px);
}
.stamp, .voted-flag {
  position: absolute;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(6px);
}
.stamp { top: 10px; right: 10px; background: rgba(8, 5, 18, 0.75); color: var(--amber); border: 1px solid rgba(255, 194, 71, 0.5); }
.voted-flag { bottom: 10px; left: 10px; background: rgba(46, 230, 197, 0.9); color: #04241f; }

.card-body { display: flex; flex-direction: column; gap: 9px; padding: 15px 16px 16px; flex: 1 1 auto; }
.card-title { font-size: 17px; font-weight: 750; }
.card-top .card-title { font-size: 20px; }
.card-title .year { font-weight: 500; color: var(--muted); font-size: 0.82em; }

.meta { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 3px 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  color: #ded6f7;
}
.chip-rating { color: var(--gold); border-color: rgba(255, 209, 102, 0.45); background: rgba(255, 209, 102, 0.10); }
.chip-muted { color: var(--muted); font-weight: 500; }

.overview {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.votes { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.votecount { font-size: 15px; }
.votecount strong { font-size: 21px; color: var(--teal); }
.voters {
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.card-foot { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-top: auto; }
.byline { font-size: 12.5px; color: var(--muted); }
.imdb { font-size: 12.5px; font-weight: 700; color: var(--gold); white-space: nowrap; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions form { display: contents; }

/* Podium accents: gold, silver, bronze. */
.podium .card:nth-child(1) { border-color: rgba(255, 209, 102, 0.55); box-shadow: 0 18px 46px -22px rgba(255, 194, 71, 0.75); }
.podium .card:nth-child(2) { border-color: rgba(207, 216, 255, 0.45); }
.podium .card:nth-child(3) { border-color: rgba(229, 154, 99, 0.45); }

.section-seen .card { opacity: 0.82; }
.section-seen .card:hover { opacity: 1; }
.grid-seen { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }

/* -------------------------------------------------------- who am I picker --- */

.auth-wide { max-width: 520px; }

.member-input { display: flex; align-items: stretch; }
.member-at {
  display: grid;
  place-items: center;
  width: 38px;
  flex: 0 0 38px;
  border: 1px solid var(--line-2);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: rgba(6, 4, 15, 0.75);
  color: var(--muted);
  font-weight: 700;
}
.member-input input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.searchfield.open .member-input input { border-bottom-right-radius: 0; }
.member-option { padding: 9px 10px; }

.rolenote {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 110, 199, 0.5);
  background: rgba(255, 110, 199, 0.1);
  color: #ffd7f2;
  font-size: 13.5px;
  font-weight: 600;
}

/* ----------------------------------------------------------------- auth --- */

.auth {
  max-width: 430px;
  margin: clamp(20px, 6vh, 64px) auto;
  padding: clamp(22px, 4vw, 34px);
  border-radius: 22px;
  border: 1px solid var(--line-2);
  background: linear-gradient(140deg, rgba(139, 92, 246, 0.14), rgba(46, 230, 197, 0.08)), var(--surface);
  box-shadow: var(--shadow);
}
.auth-title { font-size: 28px; font-weight: 850; }
.auth-sub { margin: 8px 0 18px; color: var(--muted); }
.authform { grid-template-columns: 1fr; padding: 0; gap: 14px; }
.auth-alt { margin: 16px 0 0; color: var(--muted); font-size: 14px; }

/* --------------------------------------------------------------- tables --- */

.tablewrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; min-width: 720px; font-size: 14px; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.table tr:last-child td { border-bottom: none; }
.table .right { text-align: right; }
.tabletitle { font-weight: 700; }
.row-seen { opacity: 0.65; }
.voters-cell { max-width: 260px; color: var(--muted); }
.rowactions { display: flex; gap: 8px; justify-content: flex-end; }

/* The board as a table: dense enough to compare films at a glance, with the
   same actions as the cards. */
.table-board { min-width: 940px; }
.table-board td { padding: 9px 12px; }
.table-board tr:hover { background: rgba(255, 255, 255, 0.03); }
.row-voted { box-shadow: inset 3px 0 0 var(--teal); }

.cell-rank { width: 46px; text-align: center; color: var(--muted); font-weight: 700; }
.rank-medal { font-size: 19px; }
.cell-num { white-space: nowrap; }
.cell-muted { color: var(--muted); max-width: 190px; }
.cell-film { min-width: 230px; }

.filmlink { display: flex; align-items: center; gap: 11px; color: var(--text); }
.filmlink:hover { text-decoration: none; }
.filmlink:hover .filmname { color: var(--teal); }
.thumb {
  display: block;
  width: 32px;
  height: 48px;
  flex: 0 0 32px;
  border-radius: 4px;
  overflow: hidden;
}
.thumb .poster { width: 32px; height: 48px; aspect-ratio: auto; border-radius: 4px; font-size: 11px; }
/* Inline flow, not flex: a long title should wrap mid-title and keep its year
   on the same line, rather than orphaning the year below. */
.filmname { display: block; font-weight: 700; }
.filmname .year { font-weight: 500; }
.filmname .tag { margin-left: 6px; vertical-align: 2px; }
.votenum { font-size: 17px; color: var(--teal); }
.table-board .voters {
  display: block;
  max-width: 150px;
  font-weight: 400;
}

/* API quota ------------------------------------------------------------- */

.quota { font-weight: 650; color: #cbbcff; }
.quota-low { color: var(--amber); }
.quota-out { color: var(--danger); }

.quotapanel {
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}
.quotapanel.quota-low { border-color: rgba(255, 194, 71, 0.5); }
.quotapanel.quota-out { border-color: rgba(255, 122, 122, 0.5); }
.quotanums { font-size: 15px; color: #ded6f7; }
.quotanums strong { font-size: 24px; color: var(--teal); }
.quotapanel.quota-low .quotanums strong { color: var(--amber); }
.quotapanel.quota-out .quotanums strong { color: var(--danger); }
.quotaused { display: block; font-size: 12.5px; color: var(--muted); }
.quotabar {
  height: 8px;
  margin: 11px 0 9px;
  border-radius: 999px;
  background: rgba(6, 4, 15, 0.6);
  border: 1px solid var(--line);
  overflow: hidden;
}
.quotafill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--brand);
  transition: width 0.3s ease;
}
.quotapanel.quota-low .quotafill { background: linear-gradient(90deg, var(--amber), var(--coral)); }
.quotapanel.quota-out .quotafill { background: var(--danger); }
/* Width classes, because the CSP forbids inline styles. */
.quotafill-0 { width: 0%; }
.quotafill-1 { width: 1%; }
.quotafill-2 { width: 2%; }
.quotafill-3 { width: 3%; }
.quotafill-4 { width: 4%; }
.quotafill-5 { width: 5%; }
.quotafill-6 { width: 6%; }
.quotafill-7 { width: 7%; }
.quotafill-8 { width: 8%; }
.quotafill-9 { width: 9%; }
.quotafill-10 { width: 10%; }
.quotafill-11 { width: 11%; }
.quotafill-12 { width: 12%; }
.quotafill-13 { width: 13%; }
.quotafill-14 { width: 14%; }
.quotafill-15 { width: 15%; }
.quotafill-16 { width: 16%; }
.quotafill-17 { width: 17%; }
.quotafill-18 { width: 18%; }
.quotafill-19 { width: 19%; }
.quotafill-20 { width: 20%; }
.quotafill-21 { width: 21%; }
.quotafill-22 { width: 22%; }
.quotafill-23 { width: 23%; }
.quotafill-24 { width: 24%; }
.quotafill-25 { width: 25%; }
.quotafill-26 { width: 26%; }
.quotafill-27 { width: 27%; }
.quotafill-28 { width: 28%; }
.quotafill-29 { width: 29%; }
.quotafill-30 { width: 30%; }
.quotafill-31 { width: 31%; }
.quotafill-32 { width: 32%; }
.quotafill-33 { width: 33%; }
.quotafill-34 { width: 34%; }
.quotafill-35 { width: 35%; }
.quotafill-36 { width: 36%; }
.quotafill-37 { width: 37%; }
.quotafill-38 { width: 38%; }
.quotafill-39 { width: 39%; }
.quotafill-40 { width: 40%; }
.quotafill-41 { width: 41%; }
.quotafill-42 { width: 42%; }
.quotafill-43 { width: 43%; }
.quotafill-44 { width: 44%; }
.quotafill-45 { width: 45%; }
.quotafill-46 { width: 46%; }
.quotafill-47 { width: 47%; }
.quotafill-48 { width: 48%; }
.quotafill-49 { width: 49%; }
.quotafill-50 { width: 50%; }
.quotafill-51 { width: 51%; }
.quotafill-52 { width: 52%; }
.quotafill-53 { width: 53%; }
.quotafill-54 { width: 54%; }
.quotafill-55 { width: 55%; }
.quotafill-56 { width: 56%; }
.quotafill-57 { width: 57%; }
.quotafill-58 { width: 58%; }
.quotafill-59 { width: 59%; }
.quotafill-60 { width: 60%; }
.quotafill-61 { width: 61%; }
.quotafill-62 { width: 62%; }
.quotafill-63 { width: 63%; }
.quotafill-64 { width: 64%; }
.quotafill-65 { width: 65%; }
.quotafill-66 { width: 66%; }
.quotafill-67 { width: 67%; }
.quotafill-68 { width: 68%; }
.quotafill-69 { width: 69%; }
.quotafill-70 { width: 70%; }
.quotafill-71 { width: 71%; }
.quotafill-72 { width: 72%; }
.quotafill-73 { width: 73%; }
.quotafill-74 { width: 74%; }
.quotafill-75 { width: 75%; }
.quotafill-76 { width: 76%; }
.quotafill-77 { width: 77%; }
.quotafill-78 { width: 78%; }
.quotafill-79 { width: 79%; }
.quotafill-80 { width: 80%; }
.quotafill-81 { width: 81%; }
.quotafill-82 { width: 82%; }
.quotafill-83 { width: 83%; }
.quotafill-84 { width: 84%; }
.quotafill-85 { width: 85%; }
.quotafill-86 { width: 86%; }
.quotafill-87 { width: 87%; }
.quotafill-88 { width: 88%; }
.quotafill-89 { width: 89%; }
.quotafill-90 { width: 90%; }
.quotafill-91 { width: 91%; }
.quotafill-92 { width: 92%; }
.quotafill-93 { width: 93%; }
.quotafill-94 { width: 94%; }
.quotafill-95 { width: 95%; }
.quotafill-96 { width: 96%; }
.quotafill-97 { width: 97%; }
.quotafill-98 { width: 98%; }
.quotafill-99 { width: 99%; }
.quotafill-100 { width: 100%; }

.tag { padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; border: 1px solid var(--line-2); }
.tag-seen  { color: var(--amber); border-color: rgba(255, 194, 71, 0.45); }
.tag-open  { color: var(--teal);  border-color: rgba(46, 230, 197, 0.45); }
.tag-admin { color: var(--pink);  border-color: rgba(255, 110, 199, 0.5); }

/* ------------------------------------------------------------ responsive --- */

@media (max-width: 860px) {
  .viewswitch { margin-left: 0; }
  .hero { grid-template-columns: 1fr; }
  .hero-art { width: min(190px, 45vw); }
  .podium { grid-template-columns: 1fr; }
  .suggest-form { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
