:root {
  --bg: #0b0b0b;
  --surface: #141414;
  --surface-2: #1f1f1f;
  --border: #2a2a2a;
  --text: #f5f5f5;
  --muted: #b3b3b3;
  --accent: #e50914;
  --accent-soft: rgba(229, 9, 20, 0.15);
  --gold: #f5c518;
  --radius: 10px;
  --max: 1100px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); }
a:hover { color: var(--accent); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  border: 0;
}

.site-header {
  max-width: var(--max);
  margin: 0 auto;
  padding: 32px 20px 8px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.header-action {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.header-action:hover { color: var(--text); border-color: var(--accent); }

.support-btn {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition: filter 0.15s ease, transform 0.15s ease;
}
.support-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.support-btn span { margin-right: 4px; }

.support-dialog {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0;
  max-width: 420px;
  width: calc(100% - 32px);
}
.support-dialog::backdrop { background: rgba(0,0,0,0.6); }

.support-content {
  padding: 24px 22px 20px;
  position: relative;
  margin: 0;
}
.support-content h2 { margin: 0 0 8px; font-size: 20px; }
.support-content .muted { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.support-content .fineprint { color: var(--muted); font-size: 12px; margin: 16px 0 0; text-align: center; }

.dialog-close {
  position: absolute;
  top: 8px; right: 10px;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}
.dialog-close:hover { color: var(--text); }

.support-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.support-link {
  display: block;
  text-align: center;
  padding: 11px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.support-link:hover { border-color: var(--accent); color: var(--text); }
.support-github   { border-color: #6e5494; }
.support-bmc      { background: #ffdd00; color: #111; border-color: #ffdd00; }
.support-bmc:hover { background: #f5d300; color: #111; }
.support-kofi     { background: #29abe0; color: #fff; border-color: #29abe0; }
.support-kofi:hover { background: #1e95c4; color: #fff; }
.support-paypal   { background: #003087; color: #fff; border-color: #003087; }
.support-paypal:hover { background: #002066; color: #fff; }

.info-dialog {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0;
  max-width: 520px;
  width: calc(100% - 32px);
}
.info-dialog::backdrop { background: rgba(0,0,0,0.6); }
.info-content {
  padding: 24px 22px 20px;
  position: relative;
  margin: 0;
}
.info-content h2 { margin: 0 0 12px; font-size: 22px; }
.info-content h3 { margin: 18px 0 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.info-content p { margin: 8px 0; font-size: 14px; line-height: 1.55; }
.info-content ul { margin: 8px 0 12px; padding-left: 20px; font-size: 14px; line-height: 1.6; }
.info-content ul li { margin: 4px 0; }
.info-content a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border); }
.info-content a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.info-content .muted { color: var(--muted); }
.info-content .fineprint { color: var(--muted); font-size: 12px; margin-top: 14px; }

#feedbackText {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  margin: 6px 0 12px;
  min-height: 120px;
}
#feedbackText:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.feedback-actions { display: grid; gap: 8px; }
.feedback-btn {
  display: block;
  text-align: center;
  padding: 11px 14px;
  border-radius: 8px;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.feedback-btn:hover { border-color: var(--accent); color: var(--text); }
.feedback-btn:disabled { opacity: 0.6; cursor: progress; }
.feedback-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.feedback-btn.primary:hover { filter: brightness(1.08); color: #fff; }
.feedback-btn.primary:disabled:hover { filter: none; }

.feedback-status {
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 6px;
  margin: 0 0 10px;
}
.feedback-status.feedback-success {
  background: rgba(76, 175, 80, 0.12);
  color: #9ee0a4;
  border: 1px solid rgba(76, 175, 80, 0.4);
}
.feedback-status.feedback-error {
  background: var(--accent-soft);
  color: #ffb3b8;
  border: 1px solid var(--accent);
}

.footer-links { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.link-btn {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--border);
}
.link-btn:hover { color: var(--accent); text-decoration-color: var(--accent); }
.footer-links span { color: var(--muted); }

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  font-size: 22px;
  border-radius: 8px;
  letter-spacing: -1px;
}

h1 {
  margin: 0;
  font-size: clamp(20px, 4vw, 30px);
  font-weight: 800;
  letter-spacing: -0.5px;
}

.tagline {
  color: var(--muted);
  margin: 8px 0 0;
}

.controls {
  max-width: var(--max);
  margin: 24px auto 8px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

.control { display: flex; flex-direction: column; gap: 6px; }
.control label { color: var(--muted); font-size: 13px; }

input[type="search"],
select,
input[type="range"] {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

input[type="search"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input[type="range"] { padding: 8px; accent-color: var(--accent); }

.tag.tag-lang {
  border-color: #6e5494;
  color: #c8b9e0;
}

button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  height: fit-content;
  align-self: end;
}
button.ghost:hover { color: var(--text); border-color: var(--accent); }

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 8px 20px 40px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  margin: 8px 4px 16px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

.ranking {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.card {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-1px);
  color: inherit;
}
.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.rank {
  font-size: 26px;
  font-weight: 800;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.card.top .rank { color: var(--accent); }

.title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.title-text {
  display: block;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s ease;
}
.card:hover .title-text { color: var(--accent); }

.sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--muted);
  font-size: 13px;
  align-items: center;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}
.tag.original { color: #fff; border-color: var(--accent); background: var(--accent-soft); }

.score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 80px;
}
.score .num {
  font-size: 22px;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.score .label { font-size: 11px; color: var(--muted); }

@media (max-width: 520px) {
  .card { grid-template-columns: 40px 1fr auto; padding: 12px; gap: 12px; }
  .rank { font-size: 20px; }
  .title-text { font-size: 15px; }
  .score .num { font-size: 18px; }
}

.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px 20px 48px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
}
.site-footer p { margin: 4px 0; }

.attribution {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tmdb-link {
  display: inline-flex;
  line-height: 0;
  border-radius: 4px;
}
.tmdb-link:hover { filter: brightness(1.15); }
.tmdb-mark {
  display: block;
  height: auto;
}
