:root {
  --bg: #0b0d12;
  --bg-soft: #11141c;
  --panel: #161a24;
  --panel-2: #1c2130;
  --border: #262c3b;
  --border-soft: #1f2532;
  --text: #eef1f7;
  --muted: #9aa3b4;
  --muted-2: #6b7385;
  --brand: #ff3b5c;
  --brand-2: #ff7a45;
  --accent: #5b8cff;
  --accent-2: #7b5bff;
  --good: #2ecc71;
  --warn: #f5b13d;
  --gold: #ffd24a;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  --shadow-hover: 0 18px 44px rgba(0, 0, 0, 0.42);
  --shadow-brand: 0 10px 28px rgba(255, 59, 92, 0.4);
  --grad: linear-gradient(135deg, var(--brand), var(--brand-2));
  --grad-brand: linear-gradient(135deg, var(--brand), var(--brand-2));
  --grad-accent: linear-gradient(135deg, #5b8cff, #7b5bff);
}

* { box-sizing: border-box; }

/* The `hidden` attribute must always win, even over author display rules
   like `.center-screen { display:grid }` or `.modal-backdrop { display:grid }`. */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; max-width: 100%; overflow-x: hidden; }

body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(900px 520px at 12% -5%, rgba(255, 59, 92, 0.14), transparent 60%),
    radial-gradient(820px 520px at 88% 6%, rgba(91, 140, 255, 0.12), transparent 62%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
::selection { background: rgba(255, 59, 92, 0.35); }

a { color: inherit; }

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 22px 80px;
}
.container.narrow { max-width: 760px; }

/* ---------------- top bar (sticky, blurred, full-bleed) ---------------- */
/* The bar lives inside .container but its background spans edge-to-edge via the
   calc(50% - 50vw) trick; .topbar-inner re-aligns the content to the container. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  margin: -28px calc(50% - 50vw) 26px;
  background: rgba(11, 13, 18, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 13px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.container.narrow .topbar-inner { max-width: 760px; }
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.brand .logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--grad);
  display: grid;
  place-items: center;
  font-size: 20px;
  box-shadow: 0 6px 18px rgba(255, 59, 92, 0.35);
}
.brand small {
  display: block;
  font-weight: 500;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0;
}

/* ---------------- hero ---------------- */
.hero h1 {
  font-size: clamp(30px, 5.2vw, 46px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}
.hero h1 .grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p.lede {
  color: var(--muted);
  font-size: 17px;
  max-width: 620px;
  margin: 0 0 26px;
}

/* ---------------- cards / panels ---------------- */
.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 20px; }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 18px;
}
.section-title h2 {
  font-size: 18px;
  margin: 0;
  letter-spacing: -0.01em;
}
.section-title .hint { color: var(--muted); font-size: 13px; }

/* ---------------- forms ---------------- */
label.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 7px;
}
input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 11px;
  padding: 12px 14px;
  /* 16px (not smaller) so iOS Safari does NOT auto-zoom when the field is focused,
     which otherwise leaves the page zoomed in with horizontal scroll. */
  font-size: 16px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
select { cursor: pointer; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.18);
}
::placeholder { color: var(--muted-2); }

/* ---------------- buttons ---------------- */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform .08s ease, filter .15s, background .15s, border-color .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--shadow-brand); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.04); transform: translateY(-2px); box-shadow: 0 16px 38px rgba(255, 59, 92, 0.5); }
.btn-ghost { background: rgba(255, 255, 255, 0.04); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: #39415a; background: rgba(255, 255, 255, 0.08); transform: translateY(-2px); }
.btn-danger { background: transparent; color: #ff8a9c; border-color: rgba(255, 59, 92, 0.4); }
.btn-danger:hover { background: rgba(255, 59, 92, 0.12); }
.btn-block { width: 100%; justify-content: center; padding: 14px; font-size: 15px; }
.btn-sm { padding: 8px 12px; font-size: 13px; }
.btn-google { background: #fff; color: #1f2430; border-color: #fff; gap: 10px; }
.btn-google:hover { filter: brightness(0.96); }
.btn-google svg { flex: 0 0 auto; }

/* signed-in user chip + sign out, in the top bar */
#topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px; font-weight: 600; max-width: 220px;
}
.user-chip img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.user-av {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto;
  background: var(--grad-accent); display: grid; place-items: center;
  color: #fff; font-size: 12px; font-weight: 700;
}
.user-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-expiry { background: rgba(245, 177, 61, 0.12); border-color: rgba(245, 177, 61, 0.35); color: var(--text); }

/* ---------------- thumbnail builder rows ---------------- */
.builder-row {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  margin-bottom: 14px;
  background: var(--bg-soft);
}
.drop {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  cursor: pointer;
  text-align: center;
}
.drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .placeholder { color: var(--muted-2); font-size: 12px; padding: 8px; line-height: 1.5; pointer-events: none; }
.drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.drop.dragover {
  border-color: var(--brand);
  border-style: dashed;
  box-shadow: 0 0 0 3px rgba(255, 59, 92, 0.25) inset;
}
.drop.dragover .placeholder { color: var(--brand); }
.builder-row .title-col { display: flex; flex-direction: column; gap: 8px; }
.row-controls { display: flex; flex-direction: column; gap: 6px; }
.row-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 34px; height: 30px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.row-btn:hover { color: var(--text); border-color: var(--accent); }
.row-btn.remove:hover { color: #ff8a9c; border-color: rgba(255,59,92,.4); }

/* first-round matchup preview (bracket) */
.pairing-preview {
  margin-top: 16px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--bg-soft);
}
.pairing-head { font-size: 13.5px; margin-bottom: 12px; }
.pairing-head b { font-size: 14px; }
.pairing-list { display: flex; flex-direction: column; gap: 8px; }
.pair-match {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg);
}
.pair-match.bye { border-style: dashed; }
.pair-num {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 9px; white-space: nowrap;
}
.pair-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; min-width: 0; }
.pair-chip img { width: 40px; height: 23px; object-fit: cover; border-radius: 4px; flex: 0 0 auto; }
.pair-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--border); flex: 0 0 auto; }
.pair-vs { font-weight: 800; font-size: 12px; color: var(--brand); }

/* ---------------- builder: option cards + bracket matches ---------------- */
.builder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}
.builder-bracket { display: flex; flex-direction: column; gap: 16px; }

.opt-card {
  display: flex; flex-direction: column; gap: 9px; min-width: 0;
  padding: 12px; border: 1px dashed var(--border); border-radius: 14px; background: var(--bg-soft);
}
.opt-card .drop { aspect-ratio: 16 / 9; }
.opt-title { width: 100%; }
.opt-controls { display: flex; align-items: center; gap: 6px; }
.opt-num { font-size: 12px; font-weight: 700; color: var(--muted); }

.match-card {
  border: 1px solid var(--border); border-radius: 16px;
  background: var(--bg-soft); padding: 14px 14px 16px;
}
.match-label {
  display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .04em;
  color: var(--text); background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 13px; margin-bottom: 12px;
}
.match-body { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: stretch; }
.match-body .opt-card { border: none; background: transparent; padding: 0; }
.vs-mini {
  align-self: center; display: grid; place-items: center; flex: 0 0 auto;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--grad); color: #fff; font-weight: 900; font-size: 15px; letter-spacing: .04em;
  box-shadow: 0 6px 16px rgba(255, 59, 92, .4);
}
.opt-bye {
  display: grid; place-items: center; text-align: center; cursor: pointer; font: inherit;
  border: 1px dashed var(--border); border-radius: 12px; background: var(--bg);
  color: var(--muted); transition: border-color .15s ease, color .15s ease; min-height: 130px;
}
.opt-bye:hover { border-color: var(--accent); color: var(--text); }
.bye-emoji { font-size: 26px; }
.bye-t { font-weight: 800; margin-top: 4px; font-size: 14px; }
.bye-s { font-size: 11.5px; margin-top: 3px; max-width: 220px; line-height: 1.45; }

/* YouTube-style title field: clamped 2-line display that opens into a textarea */
.yt-title { display: flex; flex-direction: column; gap: 4px; }
.yt-title-display,
.yt-title-input {
  width: 100%; box-sizing: border-box;
  /* Width + size tuned so ~2 lines hold ~60 characters, like YouTube on mobile. */
  max-width: 278px;
  font: 600 15px/1.4 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 11px;
}
.yt-title-display {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: calc(1.4em * 2 + 18px);
  cursor: text; white-space: normal; word-break: break-word;
}
.yt-title-display:hover { border-color: #39415a; }
.yt-title-display:focus { outline: none; border-color: var(--accent); }
.yt-title-display.empty { color: var(--muted-2); font-weight: 400; }
.yt-title-input { resize: none; overflow: hidden; display: block; }
.yt-title-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 59, 92, .12); }
.yt-title-warn { font-size: 11.5px; font-weight: 700; line-height: 1.35; }
.yt-title-warn.warn-amber { color: #f5b13d; }
.yt-title-warn.warn-red { color: #ff7a8a; }
/* On phones, keep the title editor at 16px so focusing it doesn't trigger iOS auto-zoom. */
@media (max-width: 600px) { .yt-title-display, .yt-title-input { font-size: 16px; } }

/* drag-to-reorder */
.opt-card { position: relative; }
.opt-grip {
  cursor: grab; color: var(--muted-2); font-size: 15px; line-height: 1;
  padding: 4px 7px; border-radius: 7px; user-select: none;
}
.opt-grip:hover { color: var(--text); background: var(--panel-2); }
.opt-grip:active { cursor: grabbing; }
.opt-card.dragging { opacity: .4; outline: 2px dashed var(--muted); outline-offset: 2px; }
.opt-card.drop-target,
.opt-bye.drop-target {
  outline: 2px solid var(--brand); outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(255, 59, 92, .22);
}
.place-here {
  position: absolute; inset: 0; display: none; place-items: center; z-index: 6;
  background: rgba(255, 59, 92, .18); backdrop-filter: blur(1px); border-radius: 12px;
  color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .03em; text-transform: uppercase;
  pointer-events: none;
}
.opt-card.drop-target .place-here,
.opt-bye.drop-target .place-here { display: grid; }
@keyframes swapflash { 0% { box-shadow: 0 0 0 0 rgba(70, 211, 154, .65); } 100% { box-shadow: 0 0 0 12px rgba(70, 211, 154, 0); } }
.opt-card.just-swapped { animation: swapflash .65s ease-out; outline: 2px solid #46d39a; outline-offset: 2px; }

/* bracket-only option: shuffle-round toggle */
#bracket-options {
  margin-top: 16px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--bg-soft); padding: 14px 16px;
}
.toggle-row { display: flex; gap: 13px; align-items: flex-start; cursor: pointer; }
.toggle-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-switch {
  flex: 0 0 auto; width: 44px; height: 26px; border-radius: 999px; margin-top: 1px;
  background: var(--panel-2); border: 1px solid var(--border); position: relative;
  transition: background .18s ease, border-color .18s ease;
}
.toggle-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
  transition: transform .18s ease;
}
.toggle-row input:checked + .toggle-switch { background: var(--grad); border-color: transparent; }
.toggle-row input:checked + .toggle-switch::after { transform: translateX(18px); }
.toggle-row input:focus-visible + .toggle-switch { box-shadow: 0 0 0 3px rgba(255, 59, 92, .3); }
.toggle-text { display: flex; flex-direction: column; gap: 3px; font-size: 13.5px; line-height: 1.45; }
.toggle-text b { font-size: 14.5px; }

/* ---------------- dashboard list ---------------- */
.test-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-soft);
  margin-bottom: 12px;
  flex-wrap: wrap;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.test-item:hover { transform: translateY(-3px); border-color: #39415a; box-shadow: var(--shadow-hover); }
.test-item .meta { flex: 1; min-width: 180px; }
.test-item .meta .name { font-weight: 700; font-size: 16px; }
.test-item .meta .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
}
.test-item .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- dashboard (card grid) ---------------- */
.dash-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin: 6px 0 22px;
}
.dash-title { font-size: clamp(26px, 4vw, 36px); font-weight: 800; margin: 0; letter-spacing: -0.02em; }
.dash-sub { margin: 6px 0 0; font-size: 13px; }
.btn-create {
  font-size: 15px; padding: 13px 22px; border-radius: 13px;
  box-shadow: var(--shadow-brand); white-space: nowrap;
}

.tests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.test-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-soft);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.test-card:hover { transform: translateY(-4px); border-color: #39415a; box-shadow: var(--shadow-hover); }
.test-card.is-draft { border-style: dashed; }
.card-cover {
  position: relative; display: block;
  aspect-ratio: 16 / 9; background: var(--panel-2); overflow: hidden;
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-empty { width: 100%; height: 100%; display: grid; place-items: center; font-size: 34px; opacity: 0.4; }
.badge-draft {
  position: absolute; top: 10px; left: 10px;
  background: rgba(245, 177, 61, 0.95); color: #1a1205;
  font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px;
}
.card-body { padding: 14px 15px 15px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.card-name {
  font-weight: 700; font-size: 15.5px; color: var(--text); text-decoration: none;
  line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-name:hover { color: var(--brand); }
.card-sub { display: flex; flex-wrap: wrap; gap: 6px; }
.card-foot { font-size: 12px; }
.card-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.card-actions .btn-icon { padding: 7px 10px; }

.empty-state { grid-column: 1 / -1; text-align: center; padding: 50px 20px; }
.empty-emoji { font-size: 46px; margin-bottom: 8px; }
.empty-state h3 { margin: 0 0 6px; font-size: 20px; }
.empty-state p { margin: 0 auto 18px; max-width: 360px; }

/* ---------------- create / edit page ---------------- */
.newpage-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.save-status { font-size: 13px; font-weight: 600; color: var(--muted); min-height: 18px; transition: color 0.2s ease; }
.save-status.ok { color: #46d39a; }
.save-status.err { color: #ff6b6b; }
.drop-uploading {
  position: absolute; inset: 0; display: none; place-items: center;
  background: rgba(10, 12, 20, 0.55); backdrop-filter: blur(2px);
}
.drop.is-uploading .drop-uploading { display: grid; }

/* ---------------- result links box ---------------- */
.linkbox {
  display: flex;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 8px 8px 8px 14px;
  align-items: center;
}
.linkbox input {
  border: none;
  background: transparent;
  padding: 4px 0;
  font-size: 13px;
  color: var(--muted);
}
.linkbox input:focus { box-shadow: none; }

/* ---------------- voting page ---------------- */
.vote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
}
.yt-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .15s, transform .12s;
}
.yt-card.rated { border-color: rgba(46, 204, 113, 0.5); }
.yt-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}
/* Absolutely fill so a non‑16:9 image can't stretch the box in Chrome (the box's
   aspect-ratio is otherwise overridden by the image's intrinsic height in a flex
   column). object-fit then crops it to fill. */
.yt-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-thumb .badge {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(0,0,0,.8);
  color: #fff; font-size: 12px; font-weight: 700;
  padding: 2px 6px; border-radius: 5px;
}
.yt-meta { padding: 12px 14px 4px; }
.yt-meta .yt-title {
  font-weight: 600;
  font-size: 15.5px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
}
.yt-meta .yt-channel {
  display: flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 13px; margin-top: 8px;
}
.yt-meta .yt-channel .av {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--grad-accent);
}

.rater { padding: 12px 14px 16px; }
.rater .rater-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12.5px; color: var(--muted); margin-bottom: 9px;
}
.rater .rater-label b { color: var(--text); font-size: 15px; }
.scale {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
}
.scale button {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .1s;
}
.scale button:hover { border-color: var(--accent); color: var(--text); }
.scale button.selected {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
  transform: translateY(-1px);
}
.scale-legend {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--muted-2); margin-top: 6px;
}

/* sticky submit bar */
.submitbar {
  position: sticky;
  bottom: 0;
  margin-top: 26px;
  background: linear-gradient(180deg, rgba(11,13,18,0), var(--bg) 40%);
  padding: 18px 0 6px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.progress {
  flex: 1;
  min-width: 200px;
  height: 10px;
  background: var(--panel-2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress > span {
  display: block; height: 100%;
  width: 0%;
  background: var(--grad);
  transition: width .25s ease;
}

/* ---------------- results page ---------------- */
.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 14px 18px;
  min-width: 130px;
}
.stat .n { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.rank-item {
  display: grid;
  grid-template-columns: 54px 168px 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-soft);
  margin-bottom: 14px;
}
.rank-item.winner {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(255, 210, 74, 0.10), var(--bg-soft));
  box-shadow: 0 0 0 1px rgba(255,210,74,.15), 0 12px 30px rgba(0,0,0,.35);
}
.rank-badge {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 18px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.rank-item.winner .rank-badge { background: var(--gold); color: #3a2c00; border-color: transparent; }
.rank-thumb { aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background:#000; }
.rank-thumb img { width:100%; height:100%; object-fit: cover; display:block; }
.rank-info .rt { font-weight: 600; font-size: 15px; line-height: 1.3; }
.rank-info .crown { color: var(--gold); font-size: 12px; font-weight: 700; margin-bottom: 4px; display:flex; gap:6px; align-items:center;}
.bar {
  margin-top: 10px;
  height: 9px; border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden; border: 1px solid var(--border);
}
.bar > span { display:block; height:100%; background: var(--grad); }
.score-big { text-align: right; }
.score-big .s { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.score-big .s small { font-size: 14px; color: var(--muted); font-weight: 600; }
.score-big .v { color: var(--muted); font-size: 12.5px; }

.histogram { display:flex; align-items:flex-end; gap:3px; height: 38px; margin-top:10px; }
.histogram .hb { flex:1; background: var(--panel-2); border-radius: 3px 3px 0 0; min-height:2px; position:relative; }
.histogram .hb > i { position:absolute; inset:0 0 0 0; background: var(--grad-accent); border-radius: 3px 3px 0 0; }

/* ---------------- misc ---------------- */
.center-screen { min-height: 70vh; display: grid; place-items: center; }
.muted { color: var(--muted); }
.error-text { color: #ff8a9c; font-size: 13px; min-height: 18px; margin-top: 8px; }
.success-screen { text-align: center; padding: 40px 20px; }
.success-screen .check {
  width: 76px; height: 76px; margin: 0 auto 18px;
  border-radius: 50%;
  background: rgba(46,204,113,.15);
  border: 1px solid rgba(46,204,113,.5);
  display: grid; place-items: center;
  font-size: 38px; color: var(--good);
}
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--panel); border: 1px solid var(--border);
  color: var(--text); padding: 11px 18px; border-radius: 11px;
  box-shadow: var(--shadow); font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--brand);
  animation: spin .8s linear infinite; margin: 30px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.row-actions { display:flex; gap: 10px; flex-wrap: wrap; align-items:center; }
.divider { height:1px; background: var(--border-soft); margin: 22px 0; border:0; }

/* ---------------- mode selector (admin) ---------------- */
.mode-select { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mode-card {
  position: relative;
  display: block;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  background: var(--bg-soft);
  transition: border-color .15s, background .15s, transform .08s;
}
.mode-card:hover { border-color: var(--accent); }
.mode-card.selected {
  border-color: var(--brand);
  background: linear-gradient(180deg, rgba(255,59,92,.10), var(--bg-soft));
  box-shadow: 0 0 0 1px rgba(255,59,92,.25);
}
.mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.mode-emoji { font-size: 24px; margin-bottom: 6px; }
.mode-name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.mode-name .tag {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: var(--grad); color: #fff; padding: 2px 7px; border-radius: 999px;
}
.mode-desc { color: var(--muted); font-size: 13px; margin-top: 6px; line-height: 1.45; }
.mode-desc b { color: var(--text); font-weight: 600; }
.pill-mode { color: var(--text); background: rgba(255,210,74,.12); border-color: rgba(255,210,74,.35); }
.pill-click { background: rgba(91,140,255,.14); border-color: rgba(91,140,255,.4); }
.pill-bracket { background: rgba(255,59,92,.14); border-color: rgba(255,59,92,.4); }

/* ---------------- fake YouTube bar (click test) ---------------- */
.yt-bar {
  margin: -28px -22px 0;
  padding: 12px 22px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.yt-bar-inner { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 16px; }
.yt-logo { font-weight: 800; letter-spacing: -.02em; }
.yt-logo::first-letter { color: var(--brand); }
.yt-fake-search {
  flex: 1; max-width: 420px;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 16px; color: var(--muted-2); font-size: 13px; background: var(--bg);
}
.yt-avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--grad-accent); display: grid; place-items: center;
  font-weight: 700; font-size: 14px; color: #fff;
}
/* quieter brand on the voting page so it doesn't pull focus */
.brand-quiet .logo.logo-quiet {
  background: var(--panel-2);
  border: 1px solid var(--border);
  box-shadow: none;
  width: 32px;
  height: 32px;
  font-size: 17px;
  filter: grayscale(0.2);
}

/* bracket hero (voting) — centered */
.bracket-hero { text-align: center; padding-top: 6px; }
.bracket-hero h1 {
  font-size: clamp(26px, 4.5vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 10px;
}
/* higher specificity than `.hero p.lede` so block-centering actually applies */
.hero.bracket-hero p.lede { margin-left: auto; margin-right: auto; }

/* identical, channel-less stats line on bracket cards */
.yt-stats { color: var(--muted); font-size: 13px; margin-top: 8px; }

.click-instructions { padding: 28px 0 22px; }
.click-instructions h1 { font-size: clamp(24px,4vw,38px); margin: 0 0 8px; letter-spacing: -.03em; }
.click-instructions h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------------- clickable cards + pick badge ---------------- */
.yt-card.clickable { cursor: pointer; }
.yt-card.clickable:hover { transform: translateY(-3px); border-color: var(--accent); }
.yt-card.picked { border-color: var(--brand); }
.yt-card.picked .yt-thumb img { filter: brightness(.55); }
.pick-badge {
  display: none;
  position: absolute; top: 8px; left: 8px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--grad); color: #fff;
  place-items: center; font-weight: 800; font-size: 14px;
  box-shadow: 0 4px 12px rgba(255,59,92,.5);
  border: 2px solid #fff;
}

/* ---------------- watch modal ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  padding: 20px;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%; max-width: 640px;
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-close {
  position: absolute; top: 10px; right: 12px; z-index: 2;
  background: rgba(0,0,0,.5); color: #fff; border: none;
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 20px;
}
.watch-player { position: relative; aspect-ratio: 16/9; background: #000; }
.watch-player img { width: 100%; height: 100%; object-fit: cover; }
.watch-pick {
  position: absolute; bottom: 10px; left: 10px;
  background: var(--grad); color: #fff; font-weight: 700; font-size: 13px;
  padding: 4px 12px; border-radius: 999px;
}
.watch-body { padding: 18px 20px 20px; }
.watch-body h3 { margin: 0; font-size: 18px; line-height: 1.3; }

/* edit survey modal */
.modal.modal-lg { max-width: 760px; }
.edit-body { padding: 22px 22px 22px; max-height: 86vh; overflow-y: auto; }
.edit-warn { line-height: 1.5; }

/* ---------------- score test (one at a time) ---------------- */
.rate-stage { max-width: 560px; margin: 0 auto; }
.rate-counter { text-align: center; font-weight: 700; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.rate-nav { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
textarea { resize: vertical; min-height: 44px; }

/* ---------------- click results metrics ---------------- */
.rank-item.click-rank { grid-template-columns: 54px 168px 1fr; }
.metric-row { display: flex; gap: 22px; flex-wrap: wrap; margin: 10px 0; }
.metric-v { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.metric-l { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.metric-s { font-size: 12px; color: var(--muted-2); margin-top: 1px; }

/* ---------------- comments ---------------- */
.comments { margin-top: 14px; border-top: 1px solid var(--border-soft); padding-top: 12px; }
.comments-head { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.comment { display: flex; gap: 10px; margin-bottom: 10px; font-size: 13.5px; }
.comment b { font-size: 13px; }
.comment-body { color: var(--muted); margin-top: 1px; }
.comment-av {
  flex: 0 0 auto;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--grad-accent); display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff;
}

/* ---------------- voters breakdown ---------------- */
.voter-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--bg-soft); margin-bottom: 10px;
}
.order-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.order-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px 3px 4px; font-size: 12.5px; color: var(--muted);
}
.order-chip b {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--panel); display: inline-grid; place-items: center;
  font-size: 11px; color: var(--text);
}
.order-chip.first { border-color: var(--brand); color: var(--text); }
.order-chip.first b { background: var(--grad); color: #fff; }

/* per-person bracket path */
.voter-row.col { flex-direction: column; align-items: stretch; }
.voter-head { display: flex; gap: 12px; align-items: center; }
.voter-id { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.voter-path {
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.path-match {
  display: grid; grid-template-columns: 80px 1fr; gap: 10px; align-items: center;
  padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg);
}
.path-round {
  font-size: 11.5px; font-weight: 800; color: var(--muted); text-align: center;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 5px 6px;
}
.pm-cards { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: start; }
.pm-over {
  align-self: center; font-size: 10.5px; font-weight: 800; color: var(--muted-2);
  text-transform: uppercase; letter-spacing: .05em;
}
/* YouTube-style mini card: thumbnail on top, title below */
.pcard {
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  border: 1px solid var(--border); border-radius: 10px; padding: 6px; background: var(--bg-soft);
}
.pcard-thumb { aspect-ratio: 16 / 9; border-radius: 7px; overflow: hidden; background: var(--panel-2); }
.pcard-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard-thumb .cover-empty { font-size: 22px; }
.pcard-title {
  font-size: 12.5px; line-height: 1.3; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pcard.won { border-color: rgba(46, 204, 113, .5); background: rgba(46, 204, 113, .08); }
.pcard.won .pcard-title { font-weight: 700; color: var(--text); }
.pcard.lost { opacity: .72; }
.pcard-win { font-size: 11px; font-weight: 800; color: var(--good); }
.pcard-lose { font-size: 11px; font-weight: 700; color: var(--muted-2); }

/* keep old chip styles for any legacy use */
.path-chip { display: inline-flex; align-items: center; gap: 7px; }
.path-chip img { width: 38px; height: 22px; object-fit: cover; border-radius: 4px; flex: 0 0 auto; }

/* ---------------- bracket (tournament) ---------------- */
.bracket-head { display: flex; align-items: center; gap: 12px; margin: 8px 0 16px; flex-wrap: wrap; }
.round-pill {
  font-weight: 800; font-size: 13px; letter-spacing: .02em;
  background: var(--grad); color: #fff; padding: 5px 14px; border-radius: 999px;
  box-shadow: 0 6px 16px rgba(255,59,92,.35);
}
.bracket-arena {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
}
.vs-slot { min-width: 0; }
.vs-or {
  display: grid; place-items: center;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--border);
  font-weight: 800; font-size: 15px; color: var(--muted);
}
.yt-card.choice { cursor: pointer; transition: transform .1s, border-color .12s, box-shadow .12s; }
/* Hover lift only on devices with a real pointer, so touch screens never get a
   "stuck" highlight that could bias the choice. Red is reserved for the armed state. */
@media (hover: hover) and (pointer: fine) {
  .yt-card.choice:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.3); }
  .yt-card.choice:hover .choice-cta { color: var(--text); border-color: var(--accent); }
}
.choice-cta {
  text-align: center; padding: 11px; margin: 0 12px 12px;
  border-radius: 10px; font-weight: 700; font-size: 13.5px;
  background: var(--panel-2); color: var(--muted);
  border: 1px solid var(--border); transition: all .12s;
}
/* armed = tapped once, awaiting confirm (the only thing that turns a card red) */
.yt-card.choice.armed {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(255, 59, 92, 0.35), 0 14px 34px rgba(255, 59, 92, 0.22);
}
.yt-card.choice.armed .choice-cta { background: var(--grad); color: #fff; border-color: transparent; }
.bye-note {
  text-align: center; margin-top: 18px; color: var(--muted);
  font-size: 13.5px; background: var(--bg-soft);
  border: 1px dashed var(--border); border-radius: 10px; padding: 8px 12px;
}
.bracket-hint { text-align: center; font-size: 12.5px; margin-top: 16px; }
.bracket-hint b { color: var(--text); background: var(--panel-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; }

/* ---------------- round 2 intro ---------------- */
.round2-badge {
  display: inline-block;
  font-weight: 800; font-size: 13px; letter-spacing: .04em; text-transform: uppercase;
  background: var(--grad-accent); color: #fff;
  padding: 7px 16px; border-radius: 999px;
  box-shadow: 0 6px 18px rgba(91, 140, 255, 0.35);
}

/* ---------------- champion screen ---------------- */
.champ-crown { font-size: 54px; line-height: 1; animation: pop .25s ease; }
.champ-thumb {
  aspect-ratio: 16/9; border-radius: 14px; overflow: hidden; margin-top: 14px;
  border: 2px solid var(--gold); box-shadow: 0 0 0 4px rgba(255,210,74,.12), var(--shadow);
}
.champ-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.champ-title { font-weight: 700; font-size: 18px; margin-top: 14px; line-height: 1.3; }

/* ---------------- merged top-3 podium ---------------- */
#bracket-top3 { margin-bottom: 22px; }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.podium-item {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px; text-align: center; position: relative;
}
.podium-item.p1 { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(255,210,74,.2); }
.podium-medal { font-size: 26px; line-height: 1; margin-bottom: 8px; }
.podium-thumb { aspect-ratio: 16/9; border-radius: 9px; overflow: hidden; background: #000; }
.podium-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.podium-title {
  font-weight: 600; font-size: 13.5px; margin-top: 10px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.podium-stat { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* ---------------- group tabs ---------------- */
.group-tabs { display: inline-flex; gap: 4px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.group-tab {
  appearance: none; border: none; background: transparent; cursor: pointer;
  color: var(--muted); font-weight: 700; font-size: 13.5px; font-family: inherit;
  padding: 8px 14px; border-radius: 9px; display: inline-flex; align-items: center; gap: 7px;
  transition: background .12s, color .12s;
}
.group-tab:hover { color: var(--text); }
.group-tab.active { background: var(--grad); color: #fff; }
.group-count {
  font-size: 11px; font-weight: 700; background: rgba(0,0,0,.22); color: inherit;
  padding: 1px 7px; border-radius: 999px; min-width: 18px; text-align: center;
}
.group-tab:not(.active) .group-count { background: var(--panel); }
.pill-shuffled { background: rgba(91,140,255,.16); border-color: rgba(91,140,255,.45); color: var(--text); }

/* ---------------- matchup matrix ---------------- */
.matrix-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-soft); padding: 14px; }
.matrix-table { border-collapse: collapse; font-size: 13px; }
.matrix-table th, .matrix-table td {
  border: 1px solid var(--border-soft);
  text-align: center; min-width: 40px; height: 40px; padding: 2px 6px;
}
.matrix-table th { color: var(--muted); font-weight: 700; background: var(--panel); }
.matrix-table th.corner { font-size: 11px; color: var(--muted-2); font-weight: 600; text-align: left; min-width: 110px; }
.matrix-table th.rowhead { text-align: left; }
.matrix-table th.rowhead { display: flex; align-items: center; gap: 8px; height: 40px; border-right: 1px solid var(--border); }
.mx-num {
  width: 20px; height: 20px; border-radius: 50%; flex: 0 0 auto;
  background: var(--panel-2); display: inline-grid; place-items: center; font-size: 11px; color: var(--text);
}
.mx-thumb { width: 46px; height: 26px; object-fit: cover; border-radius: 4px; }
.matrix-table td { font-weight: 700; color: var(--text); }
.matrix-table td.diag { color: var(--muted-2); background: var(--panel); font-weight: 400; }
.matrix-legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 14px; }
.mx-leg { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.mx-leg b { width: 18px; height: 18px; border-radius: 50%; background: var(--panel-2); display: inline-grid; place-items: center; font-size: 11px; color: var(--text); }

@media (max-width: 720px) {
  .builder-row { grid-template-columns: 1fr; }
  .mode-select { grid-template-columns: 1fr; }
  .rank-item { grid-template-columns: 40px 110px 1fr; }
  .rank-item .score-big { grid-column: 2 / -1; text-align: left; display:flex; gap:14px; align-items:baseline; }
  .rank-item.click-rank { grid-template-columns: 40px 110px 1fr; }
}

@media (max-width: 560px) {
  /* Stack the two cards; the VS becomes a bold gradient badge that sits in the
     seam between them so it's obvious there are two options to pick from. */
  .bracket-arena { grid-template-columns: 1fr; gap: 10px; }
  .vs-or {
    margin: -24px auto;
    width: 60px; height: 60px;
    font-size: 20px; font-weight: 900; letter-spacing: .06em;
    color: #fff;
    background: var(--grad);
    border: 4px solid var(--bg);
    box-shadow: 0 6px 20px rgba(255, 59, 92, .55);
    position: relative; z-index: 3;
  }

  /* Builder match: stack the two option cards, VS badge in the seam. */
  .match-body { grid-template-columns: 1fr; gap: 8px; }
  .vs-mini {
    margin: -20px auto; width: 52px; height: 52px; font-size: 17px;
    border: 4px solid var(--bg-soft); position: relative; z-index: 3;
  }
  .opt-bye { min-height: 96px; }

  /* Per-person path: round label on its own line above the two cards. */
  .path-match { grid-template-columns: 1fr; gap: 8px; }
  .path-round { justify-self: start; }
}

/* ---------------- legal pages ---------------- */
.legal { max-width: 760px; }
.legal h1 { font-size: clamp(28px, 5vw, 40px); font-weight: 900; letter-spacing: -0.02em; margin: 6px 0 4px; }
.legal-meta { color: var(--muted-2); font-size: 13px; margin: 0 0 24px; }
.legal h2 { font-size: 20px; font-weight: 800; margin: 30px 0 8px; }
.legal h3 { font-size: 16px; font-weight: 700; color: var(--text); margin: 18px 0 6px; }
.legal p, .legal li { color: var(--muted); font-size: 15px; line-height: 1.72; }
.legal a { color: var(--brand); }
.legal ul { margin: 8px 0; padding-left: 22px; }
.legal li { margin: 5px 0; }
.legal code { background: var(--panel-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-size: 13px; color: var(--text); }
.legal-note { margin-top: 28px; font-style: italic; color: var(--muted-2); font-size: 13px; }

/* ---------------- site footer ---------------- */
.site-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 44px; padding-top: 20px; border-top: 1px solid var(--border);
  color: var(--muted-2); font-size: 13px;
}
.site-footer nav a { color: var(--muted); text-decoration: none; }
.site-footer nav a:hover { color: var(--text); }

/* ---------------- cookie notice ---------------- */
.cookie-bar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 200;
  width: min(680px, calc(100% - 28px));
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: rgba(20, 24, 33, 0.96); border: 1px solid var(--border); border-radius: 14px;
  padding: 13px 16px; box-shadow: 0 16px 50px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: cookieup 0.3s ease;
}
@keyframes cookieup { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }
.cookie-bar.hide { opacity: 0; transition: opacity 0.25s ease; }
.cookie-text { flex: 1; min-width: 220px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.cookie-text a { color: var(--brand); }
