:root {
  --bg: #0b0b0c;
  --surface: #141416;
  --surface-2: #1c1c1f;
  --line: #2a2a2e;
  --text: #e9e9ea;
  --muted: #8a8a90;
  --accent: #00e054;
  --accent-dim: #00b344;
  --warn: #ff8f2e;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.topbar {
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.brand span { color: var(--accent); }
.brand:hover { color: var(--text); }

main {
  flex: 1;
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  padding: 40px 24px 64px;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 24px;
  border-top: 1px solid var(--line);
}

/* ---------- landing ---------- */

.hero { max-width: 620px; margin: 32px auto 0; }

.hero h1 {
  font-size: 32px;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}

.lede { color: var(--muted); font-size: 16px; margin: 0 0 28px; }
.lede em { color: var(--text); font-style: normal; }

.compare-form {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px 16px;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}

.field { display: flex; flex-direction: column; gap: 6px; }

.field label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.field input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  padding: 11px 13px;
  outline: none;
  transition: border-color .15s;
}
.field input:focus { border-color: var(--accent); }

.vs { color: var(--muted); padding-bottom: 11px; font-size: 15px; }

.compare-form button {
  grid-column: 1 / -1;
  background: var(--accent);
  color: #04210f;
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 9px;
  padding: 12px;
  cursor: pointer;
  transition: background .15s;
}
.compare-form button:hover { background: var(--accent-dim); }

.fineprint { color: var(--muted); font-size: 13px; margin-top: 18px; }

.alert {
  background: rgba(255,143,46,.12);
  border: 1px solid rgba(255,143,46,.4);
  color: var(--warn);
  border-radius: 9px;
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 20px;
}

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

.results-head,
.film-row {
  display: grid;
  grid-template-columns: 1fr 130px 130px;
  gap: 16px;
  align-items: center;
}

.results-head {
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  z-index: 5;
}

.results-head .col-user { text-align: center; }
.results-head .col-user a { font-weight: 600; }
.results-head .sub {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.shared-count {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------- stats panel ---------- */

.stats {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  margin: 18px 0 8px;
}

.stat-avgs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  text-align: center;
}
.stat { display: flex; flex-direction: column; gap: 3px; }
.stat-num { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.stat-lbl { font-size: 12px; color: var(--text); }
.stat-sub { font-size: 11px; color: var(--muted); }
.stat:nth-child(2) .stat-num { color: var(--muted); }

.stat-bar {
  display: flex;
  height: 8px;
  border-radius: 5px;
  overflow: hidden;
  margin: 16px 0 10px;
  background: var(--surface-2);
}
.seg { display: block; min-width: 0; }
.seg-a { background: #3ad06b; }
.seg-eq { background: #5a5a62; }
.seg-b { background: #2ba3a3; }

.stat-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12px;
  color: var(--muted);
}
.stat-legend .muted { opacity: .8; }
.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}
.dot-a { background: #3ad06b; }
.dot-eq { background: #5a5a62; }
.dot-b { background: #2ba3a3; }

@media (max-width: 640px) {
  .stat-avgs { grid-template-columns: 1fr; gap: 14px; }
  .stat-num { font-size: 22px; }
}

.film-list { list-style: none; margin: 0; padding: 0; }

.film-row {
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.film-row:hover { background: var(--surface); }

.col-film { display: flex; align-items: center; gap: 14px; min-width: 0; }

.poster img {
  display: block;
  width: 46px;
  height: 69px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.film-meta { min-width: 0; }
.film-title {
  display: block;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.film-year { font-size: 12px; color: var(--muted); }

.col-user { text-align: center; }

.stars {
  display: inline-flex;
  gap: 1px;
  font-size: 15px;
  line-height: 1;
  --tone: var(--accent);
}
.stars.better  { --tone: #3ad06b; }
.stars.worse   { --tone: #e5564e; }
.stars.equal   { --tone: #e6b13c; }
.stars.neutral { --tone: #9a9aa0; }
.stars.none { color: #35353a; font-size: 18px; }

.star { color: #35353a; }
.star.full { color: var(--tone); }
.star.half {
  background: linear-gradient(90deg, var(--tone) 50%, #35353a 50%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

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

.results-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  font-size: 13px;
}
.refresh { color: var(--muted); }

@media (max-width: 640px) {
  .hero h1 { font-size: 26px; }
  .compare-form { grid-template-columns: 1fr; }
  .vs { display: none; }
  .results-head, .film-row {
    grid-template-columns: 1fr 84px 84px;
    gap: 8px;
  }
  .stars { font-size: 12px; }
  .film-title { white-space: normal; }
}
