:root {
  --bg: #0e1116;
  --bg-soft: #161b22;
  --card: #1a212b;
  --card-hover: #212a36;
  --border: #2a3340;
  --text: #e8edf3;
  --text-dim: #93a1b0;
  --accent: #ff5a5f;
  --accent-2: #ffb454;
  --rice: #6fd0ff;
  --fish: #ff8fa3;
  --overall: #7ee787;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 70% -10%, #1c2533 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}
.wrap { width: min(1080px, 92vw); margin-inline: auto; }
h1, h2, h3 { font-family: 'Sora', sans-serif; letter-spacing: -.02em; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(14,17,22,.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { font-size: 34px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.4)); }
.brand h1 { font-size: 24px; }
.tagline { font-size: 12.5px; color: var(--text-dim); }

/* Buttons */
.btn { font: inherit; font-weight: 600; border: 0; border-radius: 999px; padding: 11px 18px; cursor: pointer; transition: transform .12s ease, box-shadow .2s ease, background .2s ease; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: linear-gradient(135deg, var(--accent), #ff7a4d); color: #fff; box-shadow: 0 6px 18px rgba(255,90,95,.35); }
.btn-primary:hover { box-shadow: 0 8px 24px rgba(255,90,95,.5); }
.btn-block { width: 100%; margin-top: 8px; }
.link-btn { background: none; border: 0; color: var(--accent-2); cursor: pointer; font: inherit; text-decoration: underline; }

/* Hero */
.hero { padding: 30px 0 8px; }
.hero-stats { display: flex; gap: 14px; flex-wrap: wrap; }
.stat {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 22px; min-width: 120px; flex: 1;
}
.stat-num { display: block; font-family: 'Sora'; font-size: 30px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; }
.data-source { font-size: 12px; color: var(--text-dim); margin-top: 12px; }
.data-source .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-live { background: var(--overall); box-shadow: 0 0 8px var(--overall); }
.dot-local { background: var(--accent-2); }

/* Controls */
.controls { display: flex; gap: 12px; flex-wrap: wrap; margin: 22px 0 18px; }
.search-box { flex: 1; min-width: 220px; }
input[type=search], select, input[type=text], textarea {
  width: 100%; font: inherit; color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 11px 14px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,90,95,.18); }
.filters { display: flex; gap: 10px; }
.filters select { width: auto; min-width: 150px; cursor: pointer; }

/* Leaderboard */
.leaderboard { display: grid; gap: 14px; padding-bottom: 30px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center;
  cursor: pointer; transition: transform .14s ease, border-color .2s ease, background .2s ease;
}
.card:hover { transform: translateY(-2px); background: var(--card-hover); border-color: #38465a; }
.rank { font-family: 'Sora'; font-size: 26px; font-weight: 800; color: var(--text-dim); width: 44px; text-align: center; }
.rank-1 { color: #ffd76a; } .rank-2 { color: #d7dee6; } .rank-3 { color: #e8a87c; }
.card-main { min-width: 0; }
.card-name { font-size: 19px; font-weight: 700; }
.card-city { font-size: 13px; color: var(--text-dim); margin-bottom: 10px; }
.metrics { display: flex; gap: 16px; flex-wrap: wrap; }
.metric { display: flex; flex-direction: column; gap: 4px; min-width: 86px; }
.metric-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); }
.metric-top b { color: var(--text); font-size: 13px; }
.bar { height: 6px; border-radius: 4px; background: #0c1014; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; }
.bar-rice > i { background: var(--rice); }
.bar-fish > i { background: var(--fish); }
.bar-overall > i { background: var(--overall); }

.card-right { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.score-badge {
  font-family: 'Sora'; font-weight: 800; font-size: 26px;
  width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center;
  background: conic-gradient(var(--overall) calc(var(--p)*1%), #0c1014 0);
  position: relative;
}
.score-badge span { position: relative; z-index: 1; background: var(--card); width: 50px; height: 50px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; }
.like-btn {
  display: inline-flex; align-items: center; gap: 5px; font: inherit; font-size: 13px; font-weight: 600;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 999px; padding: 6px 12px; cursor: pointer; transition: all .15s ease;
}
.like-btn:hover { border-color: var(--fish); color: var(--fish); }
.like-btn.liked { background: rgba(255,143,163,.14); border-color: var(--fish); color: var(--fish); }
.review-count { font-size: 11.5px; color: var(--text-dim); }

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

/* Footer */
.site-footer { padding: 30px 0 50px; color: var(--text-dim); font-size: 13px; text-align: center; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(5,7,10,.72); backdrop-filter: blur(4px); padding: 18px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 20px;
  width: min(560px, 100%); max-height: 90vh; overflow-y: auto; padding: 26px; box-shadow: var(--shadow); position: relative;
}
.modal h2 { font-size: 22px; margin-bottom: 18px; }
.modal-close { position: absolute; top: 14px; right: 16px; background: none; border: 0; color: var(--text-dim); font-size: 28px; line-height: 1; cursor: pointer; }
.modal-close:hover { color: var(--text); }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field small { color: var(--text-dim); font-weight: 400; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.slider-field { margin-bottom: 16px; }
.slider-field label { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.score-pill { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 2px 10px; font-family: 'Sora'; font-weight: 700; min-width: 38px; text-align: center; }
.score-pill-lg { font-size: 16px; color: var(--overall); border-color: var(--overall); }
.auto-btn { margin-left: auto; font-size: 11px; font-weight: 600; background: var(--card); border: 1px solid var(--border); color: var(--text-dim); border-radius: 7px; padding: 3px 10px; cursor: pointer; }
.auto-btn:hover { color: var(--text); border-color: var(--accent-2); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 7px; border-radius: 5px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); cursor: pointer; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.4); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }

.form-msg { font-size: 13px; margin-top: 10px; text-align: center; min-height: 18px; }
.form-msg.error { color: var(--accent); }
.form-msg.ok { color: var(--overall); }

/* Detail modal */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 4px; }
.detail-head h2 { margin: 0; }
.detail-city { color: var(--text-dim); font-size: 14px; margin-bottom: 16px; }
.detail-metrics { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.detail-metric { flex: 1; min-width: 90px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; text-align: center; }
.detail-metric .big { font-family: 'Sora'; font-size: 28px; font-weight: 800; }
.detail-metric .lbl { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
.review-list { display: grid; gap: 10px; }
.review-item { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.review-item-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.review-item-top b { font-weight: 600; }
.review-item-scores { display: flex; gap: 12px; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.review-item-scores span b { color: var(--text); }
.review-notes { font-size: 13.5px; color: var(--text); }
.review-time { color: var(--text-dim); font-size: 12px; }
.detail-list-title { font-size: 14px; color: var(--text-dim); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .05em; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--overall); color: #06140a; font-weight: 600; font-size: 14px;
  padding: 12px 22px; border-radius: 999px; box-shadow: var(--shadow); z-index: 100;
  animation: toastIn .25s ease;
}
.toast.err { background: var(--accent); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } }

@media (max-width: 620px) {
  .card { grid-template-columns: auto 1fr; }
  .card-right { grid-column: 2; flex-direction: row; justify-content: flex-start; }
  .metrics { gap: 12px; }
  .metric { min-width: 72px; }
  .field-row { flex-direction: column; gap: 0; }
  .header-inner .btn { padding: 9px 14px; font-size: 14px; }
}
