:root {
  --bg: #111111;
  --surface: #181818;
  --surface-2: #202020;
  --line: #2b2b2b;
  --text: #ecece6;
  --muted: #8f958f;
  --accent: #e9b44c;
  --accent-ink: #1a1405;
  --good: #7fc58f;
  --bad: #e07a6a;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'Inter', system-ui, sans-serif; font-size: 16px; line-height: 1.55;
}
h1, h2, h3, .brand { font-family: 'Inter', system-ui, sans-serif; letter-spacing: -0.01em; line-height: 1.15; }
h1 { font-size: clamp(28px, 5vw, 40px); margin: 28px 0 8px; font-weight: 700; }
h2 { font-size: 22px; margin: 36px 0 14px; font-weight: 700; }
h3 { font-size: 17px; margin: 0 0 6px; font-weight: 700; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-bottom: 80px; }

.top { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { font-size: 20px; font-weight: 700; color: var(--text); text-decoration: none; }
nav { display: flex; gap: 4px 18px; align-items: center; flex-wrap: wrap; }
nav a, .linklike { color: var(--muted); text-decoration: none; font-size: 15px; padding: 6px 0; border-bottom: 2px solid transparent; }
nav a:hover, .linklike:hover { color: var(--text); }
nav a.on { color: var(--text); border-bottom-color: var(--accent); }
nav form { margin: 0; }
.linklike { background: none; border: 0; cursor: pointer; font: inherit; font-size: 15px; }

.flash { margin: 20px 0 0; padding: 12px 16px; border-radius: 10px; background: #2b2410; border: 1px solid #5a4716; color: #f3d68b; }
.flash.err { background: #2c1613; border-color: #5e2a22; color: #f2a99b; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* forms */
label { display: block; font-size: 14px; color: var(--muted); margin: 14px 0 6px; }
input, textarea, select {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 110px; resize: vertical; }
.btn {
  display: inline-block; margin-top: 18px; padding: 11px 20px; border-radius: 10px; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; font-size: 15px; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.small { padding: 6px 12px; margin-top: 0; font-size: 13px; }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid #5e2a22; }
.row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }

.auth { max-width: 420px; margin: 56px auto; }

/* curriculum */
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 18px 0 8px; max-width: 560px; }
.progress > i { display: block; height: 100%; background: var(--accent); }
.continue { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 26px; }
.continue .eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.continue strong { font-size: 18px; }
.continue .btn { margin-top: 0; }

.mod { padding: 0; overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: transform .15s, border-color .15s; }
a.mod:hover { transform: translateY(-2px); border-color: #3a413b; }
.cover { height: 150px; position: relative; display: flex; align-items: flex-end; padding: 16px 18px; overflow: hidden; }
.cover b { font-family: 'Inter', sans-serif; font-size: 86px; line-height: .8; opacity: .22; position: absolute; right: 12px; top: 14px; }
.cover span { font-family: 'Inter', sans-serif; font-weight: 700; font-size: 24px; line-height: 1.05; max-width: 80%; }
.c0 { background: #1f3a2c; } .c1 { background: #432a1f; } .c2 { background: #1f3040; }
.c3 { background: #3a3a1c; } .c4 { background: #1a3b3b; } .c5 { background: #40222c; }
.mod .info { padding: 16px 18px 18px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; }
.mod p { margin: 4px 0 10px; color: var(--muted); font-size: 14px; }
.mod .foot { margin-top: auto; font-size: 13px; color: var(--muted); }
.mod.locked { opacity: .6; }
.mod .bar { height: 4px; background: var(--line); border-radius: 9px; overflow: hidden; margin-bottom: 8px; min-height: 0; padding: 0; display: block; }
.mod .bar i { display: block; height: 100%; background: var(--accent); }

.lessons { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 10px; }
.lessons a { display: flex; gap: 14px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--text); }
.lessons a:hover { border-color: #3a413b; }
.tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; font-size: 13px; }
.tick.done { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.video { position: relative; padding-top: 56.25%; border-radius: var(--radius); overflow: hidden; background: #000; margin: 18px 0; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.body { max-width: 720px; margin: 18px 0; }
.crumbs { font-size: 14px; margin-top: 24px; }
.crumbs a { color: var(--muted); text-decoration: none; }

/* leaderboard */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 22px 0; }
@media (max-width: 560px) {
  .stats { gap: 8px; }
  .stats .card { padding: 12px; }
  .stat .muted { font-size: 12px; line-height: 1.3; }
  .stat .n { font-size: 20px !important; }
  .tabs span { display: none; }
}
.stat .n { font-family: 'Inter', sans-serif; font-size: 34px; font-weight: 700; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; }
.tabs a { padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: 14px; }
.tabs a.on { background: var(--text); color: var(--bg); border-color: var(--text); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 12px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.me td { background: #211d10; }
.rank { width: 48px; font-family: 'Inter', sans-serif; font-weight: 700; color: var(--muted); }
.rank.gold { color: var(--accent); }
.scroll { overflow-x: auto; }

/* directory */
.person .who { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-family: 'Inter', sans-serif; font-weight: 700; flex: none; }
.person p { margin: 6px 0; font-size: 14px; color: var(--muted); }
.tag { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); margin: 0 6px 6px 0; }

details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin: 10px 0; padding: 0 16px; }
summary { cursor: pointer; padding: 13px 0; font-weight: 500; }
details[open] { padding-bottom: 16px; }
.inline { display: inline; margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
code.link { display: block; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; word-break: break-all; font-size: 14px; margin-top: 8px; }

/* intro + image covers */
.intro { max-width: 720px; margin: 4px 0 6px; max-height: 4.6em; overflow: hidden; }
.intro.open { max-height: none; }
.more { color: var(--accent); padding: 0; border: 0; font-size: 14px; }
.cover.img { padding: 0; background: var(--surface-2); }
.cover.img img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- header like the reference: wordmark left, links right, avatar menu ---- */
.brand { font-size: 19px; letter-spacing: -0.02em; }
.top { background: #131313; }
.bar { min-height: 58px; }
.acct { position: relative; }
.acct summary { list-style: none; }
.acct summary::-webkit-details-marker { display: none; }
.avatar-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 14px; cursor: pointer; border: 0; }
.menu { position: absolute; right: 0; top: 44px; min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 12px 30px rgba(0,0,0,.5); z-index: 20; }
.menu .who { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .who strong, .menu .who small { display: block; }
.menu .who small { color: var(--muted); font-size: 13px; word-break: break-all; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; font-size: 15px; cursor: pointer; border-bottom: 0; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }
nav { gap: 4px 22px; }

/* ---- curriculum page ---- */
main h1 { font-size: clamp(26px, 4vw, 32px); }
.intro { font-size: 15px; max-height: 7.6em; }
.more { color: var(--accent); }
h2.sect { font-size: 16px; margin: 34px 0 14px; }
.progress { max-width: 640px; margin: 20px 0 8px; height: 5px; }
.continue { background: var(--surface); padding: 18px 20px; }
.continue strong { font-size: 16px; display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.play { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); display: inline-block; flex: none; position: relative; }
.play::after { content: ''; position: absolute; left: 4px; top: 2px; border-left: 5px solid var(--muted); border-top: 3px solid transparent; border-bottom: 3px solid transparent; }
.btn.neutral { background: #3a3a3a; color: #f2f2f2; }
.btn.neutral:hover { background: #474747; filter: none; }
.cover { height: auto; aspect-ratio: 16 / 9; }
.cover.img { background: #e9e9ee; }
.mod .info { gap: 2px; }
.mod h3 { font-size: 16px; margin: 4px 0 2px; }
.mod p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lock { color: var(--muted); }
.mod.locked { opacity: 1; }
.mod.locked .cover { filter: saturate(.7); }
.mod.locked .info { opacity: .75; }
details.acct { border: 0; background: none; padding: 0; margin: 0; }
details.acct[open] { padding: 0; }
.avatar-btn { line-height: 1; padding-bottom: 1px; }

/* ---- font tuning for Inter ---- */
h1, h2, h3, .brand { letter-spacing: -0.02em; font-weight: 700; }
h1 { letter-spacing: -0.03em; }

/* ---- map + referrals ---- */
#map { height: min(68vh, 560px); min-height: 340px; border-radius: var(--radius); border: 1px solid var(--line); margin-top: 16px; background: var(--surface); }
.leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.5); }
.leaflet-container { font-family: 'Inter', sans-serif; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--text); }
.leaflet-popup-content a { color: var(--accent); }
.reflink { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.reflink code { flex: 1; min-width: 220px; padding: 11px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; word-break: break-all; font-size: 14px; }
.reflink .btn { margin-top: 0; }
.status { font-size: 12px; padding: 2px 9px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.status.joined { color: var(--good); border-color: #2f5a3b; }
.status.invited { color: var(--accent); border-color: #5a4716; }
@media (max-width: 640px) {
  nav { display: contents; }
  .brand { order: 1; margin-right: auto; }
  .acct { order: 2; }
  nav > a { order: 3; }
  .bar { row-gap: 0; }
  .menu { right: 0; }
}

/* ---- video upload ---- */
.video.file { padding-top: 0; background: #000; }
.video.file video { width: 100%; max-height: 70vh; display: block; background: #000; }
.dropzone { border: 2px dashed var(--line); border-radius: 12px; padding: 22px; text-align: center; cursor: pointer; margin-top: 16px; background: var(--surface-2); }
.dropzone:hover, .dropzone.over, .dropzone:focus { border-color: var(--accent); outline: none; }
h2.step { margin: 26px 0 0; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 560px) { .hide-sm { display: none; } }

/* ---- leaderboard layout ---- */
.lb-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.lb-head .btn { margin-top: 0; }
.stats4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 22px 0; }
.stats4 .stat .n { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.lb { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.lb-side { display: grid; gap: 18px; }
.lb h3 { font-size: 16px; margin: 0 0 4px; }
.find { margin: 14px 0 6px; max-width: 360px; }
tr[hidden] { display: none; }
.who2 { display: flex; align-items: center; gap: 12px; }
.avatar.sm { width: 34px; height: 34px; font-size: 14px; }
.you { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: #26325a; color: #b9c8ff; font-weight: 600; margin-left: 6px; }
.medal { display: block; }
td.rank { vertical-align: middle; }
.standing { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 12px; margin-top: 12px; }
.standing .big { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.standing .big small { font-size: 13px; color: var(--muted); font-weight: 500; }
.standing .mid { font-size: 18px; font-weight: 600; }
.win { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.win:first-of-type { margin-top: 10px; }
.grow { flex: 1; min-width: 0; }
@media (max-width: 960px) { .lb { grid-template-columns: minmax(0, 1fr); } .lb-side { order: -1; } .stats4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .stats4 .stat .n { font-size: 22px; } .stats4 .card { padding: 14px; } }

.lb > *, .lb-side > * { min-width: 0; }

/* ---- directory cards ---- */
.person .bio { margin: 6px 0 12px; color: var(--text); opacity: .85; font-size: 15px; }
.person .links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { display: inline-flex; gap: 6px; align-items: baseline; max-width: 100%; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; text-decoration: none; cursor: pointer; overflow-wrap: anywhere; text-align: left; }
.chip span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.chip:hover { border-color: #3a3a3a; background: #262626; }

/* ---- map clusters and pins ---- */
.mc-wrap, .pin-wrap { background: none; border: 0; }
.mc { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: rgba(233,180,76,.28); box-shadow: 0 0 0 1px rgba(233,180,76,.55); }
.mc span { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font: 700 14px 'Inter', sans-serif; }
.pin { width: 34px; height: 34px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); display: grid; place-items: center; box-shadow: 0 4px 12px rgba(0,0,0,.5); }
.pin span { color: var(--text); font: 700 14px 'Inter', sans-serif; }
.leaflet-popup-content { margin: 12px 14px; font: 14px/1.4 'Inter', sans-serif; }
.leaflet-popup-content .pp-row { color: var(--muted); }
.leaflet-popup-content .pp-link { display: block; margin-top: 4px; color: var(--accent); text-decoration: none; word-break: break-all; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.lb-head .actions { margin-top: 0; }
.lb-head .actions .btn { margin-top: 0; }

/* map popups and controls: beat the map library's own stylesheet, which loads after this one */
.leaflet-container .leaflet-popup-content-wrapper, .leaflet-container .leaflet-popup-tip { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.leaflet-container .leaflet-popup-content strong { color: var(--text); }
.leaflet-container .leaflet-bar a { background: var(--surface); color: var(--text); border-bottom-color: var(--line); }
.leaflet-container .leaflet-bar a:hover { background: var(--surface-2); }
.leaflet-container .leaflet-bar a.leaflet-disabled { color: var(--muted); background: var(--surface); }
.leaflet-container .leaflet-control-attribution { background: rgba(17,17,17,.75); color: var(--muted); }
.leaflet-container .leaflet-control-attribution a { color: var(--muted); }

/* ---- referral earnings ---- */
.status.closed { color: var(--accent); border-color: #5a4716; }
.status.paid { color: var(--good); border-color: #2f5a3b; background: rgba(127,197,143,.08); }
.status.received { color: var(--muted); }
.rate { font-size: 56px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; margin-top: 10px; color: var(--accent); }
.example { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 15px; }
.example .muted { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 2px; }
form.inline.actions { display: inline-flex; gap: 8px; align-items: center; }
.lb-col { display: grid; gap: 18px; }
table.earn td, table.earn th { padding: 10px 12px; }
table.earn tbody tr:last-child td { border-bottom: 0; }
table.earn tbody tr:last-child strong { color: var(--accent); }

/* ---- waiting-for-approval count ---- */
.avatar-btn.has-dot { position: relative; }
.avatar-btn.has-dot::after { content: ''; position: absolute; top: -2px; right: -2px; width: 11px; height: 11px; border-radius: 50%; background: #e0654f; border: 2px solid #131313; }
.menu a .waiting { margin-left: 6px; padding: 1px 8px; border-radius: 99px; background: #e0654f; color: #fff; font-size: 12px; font-weight: 600; }
.wait { padding: 4px 18px; }
.wait-row { display: flex; justify-content: space-between; align-items: center; gap: 12px 16px; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid var(--line); }
.wait-row:last-child { border-bottom: 0; }
.wait-who { min-width: 0; overflow-wrap: anywhere; }
