/* ChallengeTube — white page, ink type, challenge-red accent, gold for EXP. */
:root {
  --bg: #ffffff;
  --bg2: #f6f7fa;
  --panel: #ffffff;
  --line: #e6e8ee;
  --ink: #14161c;
  --muted: #5f6672;
  --dim: #8a909b;
  --red: #e5372b;
  --red-hi: #c41f14;
  --red-soft: #fdebe9;
  --gold: #f2b705;
  --gold-ink: #8a5d00;
  --ok: #157a3e;
  --ok-soft: #e7f7ee;
  --warn: #9a5b00;
  --warn-soft: #fff4df;
  --bad: #b42318;
  --bad-soft: #fdeaea;
  --info: #1d4ed8;
  --info-soft: #e8f0ff;
  --t1: #2bb673;
  --t2: #2f7bff;
  --t3: #9b4dff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 28px rgba(20, 22, 28, .08);
  --head: "Poppins", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--body); }
a { color: var(--red-hi); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--head); line-height: 1.12; margin: 0 0 .4em; letter-spacing: -.015em; }
h1 { font-size: clamp(30px, 5vw, 52px); font-weight: 900; }
h2 { font-size: clamp(21px, 2.8vw, 28px); font-weight: 800; }
h3 { font-size: 17px; font-weight: 800; }
p { margin: 0 0 .8em; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 99; background: var(--red); color: #fff; padding: 8px 12px; border-radius: 8px; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 13px; } .tiny { font-size: 12px; } .center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.red { color: var(--red); }

/* layout */
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 22px 16px 60px; outline: none; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid--sm { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.split { display: grid; gap: 24px; }
@media (min-width: 900px) { .split { grid-template-columns: 1.1fr 1fr; align-items: start; } .split--side { grid-template-columns: 2fr 1fr; } }
.section { margin-top: 36px; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.panel--soft { background: var(--bg2); box-shadow: none; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* header */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar__in { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 18px; }
.logo { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font: 900 21px/1 var(--head); letter-spacing: -.03em; text-decoration: none !important; }
.logo b { color: var(--red); font-weight: 900; }
.nav { display: none; gap: 4px; }
.nav a { color: var(--ink); font-weight: 700; font-size: 14px; padding: 8px 12px; border-radius: 999px; text-decoration: none; }
.nav a:hover, .nav a.on { background: var(--bg2); }
.nav a.on { color: var(--red-hi); }
.search { display: none; flex: 1; max-width: 300px; margin-left: auto; }
.search input, .input, select.input, textarea.input { width: 100%; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg2); outline: none; }
.input { border-radius: var(--radius-sm); background: #fff; }
textarea.input { border-radius: var(--radius-sm); min-height: 90px; resize: vertical; }
.search input:focus, .input:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.acct { margin-left: auto; }
.burger { display: inline-flex; flex-direction: column; gap: 4px; padding: 9px; border: 0; background: none; cursor: pointer; }
.burger span { width: 20px; height: 2px; background: var(--ink); border-radius: 2px; }
@media (min-width: 900px) { .nav { display: flex; } .search { display: block; } .acct { margin-left: 0; } .burger { display: none; } }
.drawer[hidden] { display: none; }
.drawer { position: sticky; top: 57px; z-index: 49; background: #fff; border-bottom: 1px solid var(--line); padding: 8px 16px 14px; display: grid; }
.drawer a { padding: 10px 4px; font-weight: 700; color: var(--ink); border-bottom: 1px solid var(--line); }
.menu { position: absolute; right: 16px; top: 56px; z-index: 60; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); min-width: 230px; padding: 6px; display: grid; }
.menu a, .menu button { text-align: left; padding: 9px 12px; border-radius: 8px; color: var(--ink); background: none; border: 0; cursor: pointer; font-weight: 600; font-size: 14px; }
.menu a:hover, .menu button:hover { background: var(--bg2); text-decoration: none; }
.menu hr { margin: 4px 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; display: inline-grid; place-items: center; background: var(--ink); color: #fff; font-weight: 800; font-size: 14px; flex: none; }
.avatar--lg { width: 84px; height: 84px; font-size: 32px; }

/* buttons + chips */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 12px; padding: 10px 16px; font-weight: 800; font-size: 14px; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { border-color: #cfd3dc; }
.btn--red { background: var(--red); border-color: var(--red); color: #fff; }
.btn--red:hover { background: var(--red-hi); border-color: var(--red-hi); }
.btn--ink { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn--ghost { background: transparent; }
.btn--sm { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.btn--lg { padding: 14px 22px; font-size: 16px; border-radius: 14px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; background: var(--bg2); color: var(--muted); font: 800 11px/1.4 var(--body); letter-spacing: .04em; text-transform: uppercase; }
.chip--ok { background: var(--ok-soft); color: var(--ok); } .chip--warn { background: var(--warn-soft); color: var(--warn); } .chip--bad { background: var(--bad-soft); color: var(--bad); } .chip--info { background: var(--info-soft); color: var(--info); } .chip--red { background: var(--red-soft); color: var(--red-hi); } .chip--ink { background: var(--ink); color: #fff; }
.tier { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font: 900 11px/1.4 var(--body); letter-spacing: .06em; color: #fff; }
.tier--1 { background: var(--t1); } .tier--2 { background: var(--t2); } .tier--3 { background: var(--t3); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.tab { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 13px; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* hero */
.hero { position: relative; overflow: hidden; border-radius: 24px; padding: clamp(26px, 5vw, 56px); background: #14161c; color: #fff; }
.hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(700px 360px at 85% 10%, rgba(229,55,43,.55), transparent 60%), radial-gradient(500px 300px at 10% 110%, rgba(242,183,5,.35), transparent 60%); }
.hero > * { position: relative; }
.hero h1 { color: #fff; max-width: 760px; }
.hero h1 em { font-style: normal; color: #ffd75a; }
.hero p { color: #d6d9e0; max-width: 620px; font-size: 17px; }
.hero__stats { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 20px; }
.hero__stats b { display: block; font: 900 26px/1 var(--head); color: #fff; }
.hero__stats span { font-size: 12px; color: #b9bdc7; text-transform: uppercase; letter-spacing: .08em; }
.steps { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.step { padding: 16px; border-radius: var(--radius); background: var(--bg2); }
.step b { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 900; margin-bottom: 8px; }

/* cards */
.card { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); text-decoration: none !important; transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card__media { position: relative; aspect-ratio: 16 / 10; background: linear-gradient(135deg, #1b1e27, #3a2020); display: grid; place-items: center; overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__media .glyph { width: 64px; height: 64px; opacity: .9; }
.card__badges { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.card__body { padding: 14px; display: grid; gap: 6px; flex: 1; }
.card__title { font: 800 16px/1.25 var(--head); }
.card__meta { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.rewards { display: flex; gap: 6px; flex-wrap: wrap; }
.rw { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 8px; font: 800 12px/1.4 var(--body); background: var(--bg2); }
.rw--p { color: var(--gold-ink); background: #fff7d6; } .rw--i { color: #1d4ed8; background: var(--info-soft); } .rw--b { color: var(--red-hi); background: var(--red-soft); } .rw--x { color: #15803d; background: var(--ok-soft); }
.rw img { width: 14px; height: 14px; }

/* lists + tables */
.list { display: grid; }
.list__row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 4px; border-top: 1px solid var(--line); }
.list__row:first-child { border-top: 0; }
.rank { font: 900 18px/1 var(--head); width: 44px; text-align: center; color: var(--muted); }
.rank--1 { color: #c48a00; } .rank--2 { color: #7b8794; } .rank--3 { color: #a0522d; }
.thumb { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: var(--bg2); flex: none; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.scroll-x { overflow-x: auto; }

/* completion page (Strava-style) */
.proof { border-radius: 24px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
.proof__top { background: #14161c; color: #fff; padding: 22px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.proof__verified { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: #1f8f4e; color: #fff; font: 900 12px/1 var(--body); letter-spacing: .12em; }
.proof__verified svg { width: 16px; height: 16px; }
.proof__media { background: #0d0f14; display: grid; gap: 2px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.proof__media img, .proof__media video { width: 100%; max-height: 640px; object-fit: contain; background: #0d0f14; }
.proof__private { padding: 36px 18px; text-align: center; color: #b9bdc7; background: #0d0f14; }
.proof__body { padding: 20px; display: grid; gap: 18px; }
.proof__stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kv { background: var(--bg2); border-radius: 12px; padding: 12px 14px; }
.kv b { display: block; font: 900 22px/1.1 var(--head); }
.kv span { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }

/* forms */
.form { display: grid; gap: 12px; }
.field { display: grid; gap: 5px; font-size: 13px; font-weight: 700; }
.field small { font-weight: 500; color: var(--muted); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 3px; }

/* states */
.loading { display: grid; place-items: center; min-height: 40vh; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--red); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.banner { padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: #5c3a00; font-size: 14px; }
.banner--info { background: var(--info-soft); color: #173a8a; }
.legal h2 { margin-top: 1.4em; font-size: 20px; }
.legal { max-width: 760px; }

/* toasts + modal */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); }
.toast { background: var(--ink); color: #fff; padding: 12px 14px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; font-weight: 600; }
.toast--ok { background: var(--ok); } .toast--bad { background: var(--bad); }
.modal { position: fixed; inset: 0; z-index: 90; background: rgba(10,12,20,.5); display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal__box { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: #fff; border-radius: 20px; padding: 22px; box-shadow: var(--shadow); }

/* footer */
.foot { border-top: 1px solid var(--line); background: var(--bg2); }
.foot__in { max-width: 1180px; margin: 0 auto; padding: 28px 16px 40px; display: grid; gap: 10px; }
.foot__tag { color: var(--muted); margin: 0; }
.foot__links { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; }
.foot__links a { color: var(--ink); font-weight: 600; }
.foot__fine { color: var(--dim); font-size: 12px; margin: 0; }

/* admin */
.admin-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-nav a { padding: 8px 12px; border-radius: 10px; background: var(--bg2); color: var(--ink); font-weight: 700; font-size: 13px; }
.admin-nav a.on { background: var(--ink); color: #fff; }
.media-tile { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.media-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #0d0f14; }
.media-tile__b { padding: 8px 10px; font-size: 12px; display: grid; gap: 4px; overflow-wrap: anywhere; }
.kvs { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kvs dt { color: var(--muted); font-weight: 700; }
.kvs dd { margin: 0; word-break: break-word; }
pre.json { background: #0d0f14; color: #d6f5d6; padding: 12px; border-radius: 10px; overflow: auto; font-size: 12px; max-height: 360px; }
