/* ══════════════════════════════════════════════════ Monster Ranking ══ */

:root {
  --bg: #0b0d10;
  --bg-2: #12151a;
  --surface: #161a20;
  --surface-2: #1d222a;
  --line: #262d37;
  --line-soft: #1f252d;
  --text: #e8ecf1;
  --muted: #8d97a5;
  --accent: #a4ff2e;
  --accent-dim: #6ea81d;
  --accent-ink: #0b0d10;
  --danger: #ff5f6b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgb(0 0 0 / 45%);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(900px 420px at 78% -8%, rgb(164 255 46 / 9%), transparent 62%),
    radial-gradient(700px 380px at 8% 0%, rgb(60 140 255 / 7%), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
}

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.015em; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.centre { text-align: center; }
[hidden] { display: none !important; }

button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ───────────────────────────────────────────────────────────────── brand ── */

.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 1.22rem; font-weight: 700; }
.brand-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px; flex: none;
  border-radius: 11px;
  background: linear-gradient(150deg, var(--accent), var(--accent-dim));
  color: var(--accent-ink);
  font-weight: 900; font-size: 1.2rem;
  box-shadow: 0 0 0 1px rgb(164 255 46 / 25%), 0 6px 18px rgb(164 255 46 / 18%);
}

/* ────────────────────────────────────────────────────────────────── auth ── */

.auth-screen {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(100%, 400px);
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.auth-card .brand { margin-bottom: 22px; }
.stack { display: grid; gap: 14px; }

label {
  display: grid; gap: 6px;
  font-size: 0.84rem; font-weight: 600; color: #c3ccd8;
}
input, textarea {
  width: 100%;
  padding: 11px 13px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px rgb(164 255 46 / 13%);
}
textarea { resize: vertical; min-height: 74px; line-height: 1.55; }
::placeholder { color: #5f6a78; }

.hint {
  font-size: 0.84rem; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line-soft);
  padding: 9px 12px; border-radius: var(--radius-sm);
}
.alert {
  margin-bottom: 16px; padding: 10px 13px;
  background: rgb(255 95 107 / 11%);
  border: 1px solid rgb(255 95 107 / 32%);
  border-radius: var(--radius-sm);
  color: #ffc3c8; font-size: 0.87rem;
}
.auth-switch { margin-top: 16px; font-size: 0.86rem; text-align: center; }
.auth-foot { margin-top: 20px; display: grid; gap: 12px; justify-items: center; }
.auth-foot p { margin: 0; }

/* ─────────────────────────────────────────────────────── language ── */

.lang-switch {
  display: inline-flex; gap: 2px; padding: 2px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; flex: none;
}
.lang-btn {
  padding: 3px 9px; border: 0; border-radius: 999px;
  background: transparent; cursor: pointer;
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em;
  color: var(--muted);
  transition: color .15s, background .15s;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.is-on { background: var(--accent); color: var(--accent-ink); }


/* ────────────────────────────────────────────────────────────────── btns ── */

.btn {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
  font-weight: 600; font-size: 0.9rem;
  transition: transform .06s, background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: #232a33; border-color: #333c48; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 0.82rem; }
.btn-ghost { background: transparent; }
.btn-primary {
  background: linear-gradient(160deg, var(--accent), var(--accent-dim));
  color: var(--accent-ink); border-color: transparent;
}
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(160deg, var(--accent), var(--accent-dim)); }
.back-link {
  background: none; border: 0; padding: 0 0 16px;
  color: var(--muted); cursor: pointer; font-size: .86rem; font-weight: 600;
}
.back-link:hover { color: var(--accent); }

/* ─────────────────────────────────────────────────────────────── topbar ── */

.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgb(11 13 16 / 86%);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto;
  padding: 14px 20px;
  display: flex; align-items: center; gap: 16px;
}
.brand-sm strong { font-size: 0.98rem; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.search-wrap { position: relative; flex: 1; min-width: 0; }
.search-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; fill: var(--muted); pointer-events: none;
}
#search {
  padding: 11px 42px 11px 40px;
  border-radius: 999px;
  background: var(--surface);
}
#search::-webkit-search-cancel-button { filter: invert(.6); }
.search-kbd {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: .72rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px;
  pointer-events: none;
}

.results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: min(60vh, 420px); overflow-y: auto;
  padding: 6px; z-index: 60;
}
/* ── flavour artwork ──
   Sized boxes are reserved via width/height on the <img> so lazy-loaded rows
   never reflow. The colour behind each thumbnail is the flavour's own accent,
   so a slow or missing image degrades to a colour chip instead of a gap. */

.fimg {
  display: block; flex: none;
  border-radius: 6px;
  background: var(--surface-2);
  object-fit: contain;
}
.fimg-hero { width: 132px; height: 172px; border-radius: 12px; }
.fimg-sm { width: 30px; height: 39px; }
.fimg-xs { width: 26px; height: 34px; border-radius: 999px; }

/* ── search suggestions ── */

.result-thumb {
  width: 30px; height: 39px; flex: none;
  border-radius: 6px; overflow: hidden;
  display: grid; place-items: center;
}

.result {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  cursor: pointer;
}
.result:hover, .result.is-active { background: var(--surface-2); }
.result.is-active { box-shadow: inset 2px 0 0 var(--accent); }
.result-swatch { width: 9px; height: 30px; border-radius: 4px; flex: none; }
.result-main { min-width: 0; flex: 1; }
.result-name { font-weight: 600; font-size: .93rem; }
.result-alias { font-size: .76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-score {
  font-family: var(--mono); font-size: .84rem; font-weight: 700;
  padding: 3px 8px; border-radius: 6px; background: var(--surface-2); flex: none;
}
.result-score.mine { background: rgb(164 255 46 / 16%); color: var(--accent); }
.result-empty { padding: 16px; text-align: center; color: var(--muted); font-size: .88rem; }

.user-chip { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: .78rem; font-weight: 700; color: var(--accent-ink);
  flex: none;
}
.user-name { font-size: .86rem; font-weight: 600; white-space: nowrap; }

.tabs {
  max-width: 1080px; margin: 0 auto;
  padding: 0 20px;
  display: flex; gap: 4px;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: none; border: 0; cursor: pointer;
  padding: 10px 13px 12px;
  color: var(--muted); font-size: .89rem; font-weight: 600;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  /* Real links, so they are copyable, middle-clickable and announced properly. */
  text-decoration: none;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 3px; }

/* ──────────────────────────────────────────────────────────────── layout ── */

.main { flex: 1; max-width: 1080px; width: 100%; margin: 0 auto; padding: 26px 20px 40px; }
.view { animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } }
.view-head { margin-bottom: 14px; }
.view-head h2 { font-size: 1.1rem; }

.foot {
  max-width: 1080px; width: 100%; margin: 0 auto;
  padding: 18px 20px 28px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border-top: 1px solid var(--line-soft);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}

/* ───────────────────────────────────────────────────────────── empty state ── */

.empty { text-align: center; padding: 48px 20px 32px; }
.empty-art { font-size: 2.6rem; margin-bottom: 10px; }
.empty h2 { font-size: 1.15rem; margin-bottom: 6px; }
.quick-picks { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 22px; }
.pick {
  padding: 5px 13px 5px 5px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; font-size: .85rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
}
.pick:hover { border-color: var(--accent-dim); color: var(--accent); }

/* ────────────────────────────────────────────────────────────── rate card ── */

.rate-card { position: relative; }
.rate-card::before {
  content: ''; position: absolute; inset: 0;
  border-radius: var(--radius); pointer-events: none;
  border-top: 3px solid var(--flavour-accent, var(--accent));
}

.flavour-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.flavour-hero { flex: none; }
.flavour-hero:empty { display: none; }
.flavour-head h2 { font-size: 1.45rem; margin-bottom: 9px; }
.notes { margin-top: 11px; font-size: .92rem; max-width: 62ch; }
.markets { margin-top: 5px; text-transform: uppercase; letter-spacing: .07em; font-size: .68rem; }
.nav-pair { display: flex; gap: 6px; flex: none; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  font-size: .71rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 4px 8px; border-radius: 5px;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--line-soft);
}
.badge.line { background: rgb(90 160 255 / 13%); color: #8fc0ff; border-color: rgb(90 160 255 / 25%); }
.badge.sugar { background: rgb(164 255 46 / 12%); color: var(--accent); border-color: rgb(164 255 46 / 22%); }
.badge.discontinued { background: rgb(255 95 107 / 11%); color: #ff8f97; border-color: rgb(255 95 107 / 24%); }
.badge.limited { background: rgb(255 190 60 / 12%); color: #ffc860; border-color: rgb(255 190 60 / 24%); }

/* slider */

.score-panel {
  margin-top: 22px; padding: 20px;
  background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: var(--radius);
}
.score-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.score-out {
  font-family: var(--mono); font-size: 2.5rem; font-weight: 700; line-height: 1;
  color: var(--flavour-accent, var(--accent));
}

.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 12px; margin: 0 0 4px;
  border-radius: 999px; cursor: grab;
  background: linear-gradient(90deg,
    #ff4d57 0%, #ff7a3d 22%, #ffc93c 45%, #d8e34a 62%,
    var(--accent) 78%, var(--accent) 100%);
  border: none;
}
.slider:active { cursor: grabbing; }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: #fff; border: 4px solid var(--accent-ink);
  box-shadow: 0 2px 10px rgb(0 0 0 / 55%);
  cursor: grab;
}
.slider::-moz-range-thumb {
  width: 26px; height: 26px; border-radius: 50%;
  background: #fff; border: 4px solid var(--accent-ink);
  box-shadow: 0 2px 10px rgb(0 0 0 / 55%); cursor: grab;
}

.scale { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); margin-bottom: 16px; }

.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 18px; }
.chip {
  width: 32px; height: 30px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; font-family: var(--mono); font-size: .84rem; font-weight: 700;
  color: var(--muted);
}
.chip:hover { border-color: var(--accent-dim); color: var(--text); }
.chip.is-on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.comment-label { margin-bottom: 14px; }
.score-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.save-status.is-saved { color: var(--accent); }

/* consensus + rated by */

.consensus {
  margin-top: 18px; padding: 14px 16px;
  background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: var(--radius);
}
.consensus-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.consensus-num { font-family: var(--mono); font-size: 1.7rem; font-weight: 700; }
.spread { flex: 1; min-width: 140px; height: 8px; border-radius: 999px; background: var(--surface-2); position: relative; }
.spread i { position: absolute; inset: 0 auto 0 0; background: var(--flavour-accent, var(--accent)); border-radius: 999px; }

.ratedby { margin-top: 18px; display: grid; gap: 8px; }
.ratedby-head { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.rated-row {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; background: var(--bg-2);
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
}
.rated-row.me { border-color: rgb(164 255 46 / 28%); background: rgb(164 255 46 / 5%); }
.rated-name { font-weight: 600; font-size: .89rem; min-width: 0; }
.rated-comment { color: var(--muted); font-size: .84rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-pill {
  font-family: var(--mono); font-weight: 700; font-size: .82rem;
  padding: 3px 9px; border-radius: 6px; flex: none;
  background: var(--surface-2);
}

/* ──────────────────────────────────────────────────────────────── lists ── */

.list { display: grid; gap: 8px; }

.row {
  display: grid;
  grid-template-columns: 44px auto 1fr auto;
  align-items: center; gap: 14px;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  text-align: left; width: 100%;
}
.row:hover { border-color: var(--accent-dim); background: var(--surface-2); }
.row-rank { font-family: var(--mono); font-size: 1.15rem; font-weight: 700; color: var(--muted); text-align: center; }
.row-rank.top { color: var(--accent); }
.row-main { min-width: 0; }
.row-name { font-weight: 650; font-size: .96rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-sub { color: var(--muted); font-size: .8rem; margin-top: 3px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-comment { color: var(--muted); font-size: .82rem; margin-top: 4px; font-style: italic; }
.row-scores { display: flex; align-items: center; gap: 12px; }
.row-avg { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; min-width: 58px; text-align: right; }
.row-votes { font-size: .74rem; color: var(--muted); text-align: center; }
.mine-pill {
  font-family: var(--mono); font-size: .78rem; font-weight: 700;
  padding: 3px 8px; border-radius: 6px;
  background: rgb(164 255 46 / 15%); color: var(--accent);
}

.podium {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 26px;
}
.pod {
  padding: 16px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  cursor: pointer; text-align: center;
}
.pod:hover { border-color: var(--accent-dim); }
.pod-crown { font-size: 1.3rem; }
.pod .fimg { margin: 8px auto 0; }
.pod-name { font-weight: 700; font-size: .93rem; margin-top: 5px; overflow-wrap: anywhere; }
.pod-avg { font-family: var(--mono); font-size: 1.75rem; font-weight: 700; color: var(--accent); margin-top: 6px; }
.pod-sub { color: var(--muted); font-size: .74rem; }
.pod-1 { border-color: rgb(164 255 46 / 40%); background: linear-gradient(180deg, rgb(164 255 46 / 8%), var(--surface)); }

.stat-strip { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 20px; }
.stat b { display: block; font-family: var(--mono); font-size: 1.3rem; }
.stat span { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.divisive { margin-bottom: 26px; }
.divisive-note { color: var(--muted); font-size: .8rem; margin-bottom: 10px; }

/* ───────────────────────────────────────────────────────────────── toast ── */

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  padding: 11px 20px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  box-shadow: var(--shadow); font-size: .88rem; font-weight: 600;
  z-index: 100; animation: rise .2s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ─────────────────────────────────────────────────────────────── responsive ── */

@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; padding: 12px 14px; gap: 11px; }
  .brand-sm { order: 1; }
  .topbar-right { order: 2; margin-left: auto; }
  .search-wrap { order: 3; flex-basis: 100%; }
  .tabs { padding: 0 14px; }
  .main { padding: 18px 14px 30px; }
  .flavour-head { flex-direction: column-reverse; }
  .nav-pair { align-self: stretch; }
  .nav-pair .btn { flex: 1; }
  .podium { grid-template-columns: 1fr; }
  .row { grid-template-columns: 34px auto 1fr; row-gap: 8px; }
  .row-scores { grid-column: 3; justify-content: flex-start; }
  .row-avg { text-align: left; }
  .foot { flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
