:root {
  --bg: #0f0e13;
  --bg-soft: #1a1822;
  --card: #1f1d29;
  --line: #2c2937;
  --text: #f3f0ff;
  --muted: #9b95b0;
  --accent: #b9a4ff;
  --accent-2: #8f74ff;
  --fire: #ff8a4c;
  --ok: #6dd28a;
  --weak: #e8c75a;
  --miss: #ff6b81;
  --radius: 18px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(120% 80% at 50% -10%, #1c1830 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Onest", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

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

.wrap {
  max-width: 460px;
  margin: 0 auto;
  padding: 10px 12px 76px; /* bottom room for the fixed progress bar */
}
.wrap.wide { max-width: 760px; padding-top: 18px; }

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.brand {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.brand small {
  display: block;
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
}
.navlink {
  font-size: 14px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  white-space: nowrap;
}

/* fixed bottom progress strip (replaces the old header) */
.bottombar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(15, 14, 19, 0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.bottombar .ptext {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.bottombar .statlink {
  font-size: 18px;
  text-decoration: none;
  flex-shrink: 0;
}
.bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 0.4s ease;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.video-shell {
  position: relative;
  background: #000;
  height: min(46vh, 440px); /* cap so controls stay on-screen; 9:16 is letterboxed */
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-shell video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.unmute {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.card-body { padding: 12px; }
.title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 10px;
  line-height: 1.3;
}
.group {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.rate-group { margin-bottom: 12px; }
.rate-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.rate-head .rg-label {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  flex-shrink: 0;
}
.rate-head .hook-name {
  font-size: 13px;
  font-style: italic;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.labels-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.label-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 4px;
  border-radius: 14px;
  background: var(--bg-soft);
  border: 1.5px solid var(--line);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease;
}
.label-btn .emoji { font-size: 26px; line-height: 1; }
.label-btn .cap { font-size: 12px; font-weight: 700; color: var(--muted); }
.label-btn.sel .cap { color: var(--text); }
.label-btn:active { transform: scale(0.95); }
.label-btn[data-key="fire"].sel { border-color: var(--fire); background: rgba(255, 138, 76, 0.12); }
.label-btn[data-key="ok"].sel   { border-color: var(--ok);   background: rgba(109, 210, 138, 0.12); }
.label-btn[data-key="weak"].sel { border-color: var(--weak); background: rgba(232, 199, 90, 0.12); }
.label-btn[data-key="miss"].sel { border-color: var(--miss); background: rgba(255, 107, 129, 0.12); }

textarea {
  width: 100%;
  resize: vertical;
  min-height: 46px;
  background: var(--bg-soft);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  margin-bottom: 10px;
}
textarea:focus { outline: none; border-color: var(--accent-2); }

.submit {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  color: #160f2e;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.08s ease;
}
.submit:disabled { opacity: 0.4; cursor: not-allowed; }
.submit:not(:disabled):active { transform: scale(0.99); }

.skip {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border: none;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 12px;
  transition: color 0.15s ease, background 0.15s ease;
}
.skip:hover { color: var(--text); background: var(--bg-soft); }

.center {
  text-align: center;
  padding: 60px 24px;
}
.center .big { font-size: 44px; margin-bottom: 12px; }
.center h2 { margin: 0 0 8px; }
.center p { color: var(--muted); margin: 0 0 18px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: #2b2740;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

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

/* ---- stats ---- */
.kpis {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}
.kpi {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.kpi .n { font-size: 26px; font-weight: 800; }
.kpi .l { font-size: 12px; color: var(--muted); }

.rank {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  gap: 14px;
  align-items: center;
}
.rank .pos {
  font-size: 20px;
  font-weight: 800;
  color: var(--muted);
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}
.rank .pos.gold { color: #ffd479; }
.rank .meta { flex: 1; min-width: 0; }
.rank .name { font-weight: 700; font-size: 15px; }
.rank .grp { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.stack {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--line);
}
.stack > span { display: block; height: 100%; }
.stack .s-fire { background: var(--fire); }
.stack .s-ok   { background: var(--ok); }
.stack .s-weak { background: var(--weak); }
.stack .s-miss { background: var(--miss); }
.rank .grp .hk { font-style: italic; color: var(--accent); }
.rank .dim {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.rank .dim-l {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  width: 46px;
  flex-shrink: 0;
}
.rank .dim .stack { flex: 1; }
.rank .dim-s {
  font-size: 13px;
  font-weight: 800;
  width: 34px;
  text-align: right;
  flex-shrink: 0;
}
.rank .right { text-align: right; flex-shrink: 0; }
.rank .score { font-size: 22px; font-weight: 800; }
.rank .votes { font-size: 11px; color: var(--muted); }
.breakdown {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.breakdown .bd {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}
.breakdown .bd-e { font-size: 14px; line-height: 1; }

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 26px 0 12px;
}
.comment {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.comment .ch {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.comment .ct { font-size: 14px; }
.empty { color: var(--muted); text-align: center; padding: 30px; }
