:root {
  --brand: #E6007E;
  --ink: #333333;
  --brand-soft: #fde6f2;
  --muted: #646b73;
  --line: #e4e7ea;
  --bg: #f5f6f7;
  --card: #ffffff;
  --ok: var(--brand);
  --warn: #b45309;
  --radius: 14px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: var(--brand); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .4rem; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
p { margin: 0 0 .8rem; }
img { max-width: 100%; height: auto; display: block; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--brand); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 18px 10px;
  display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand img { height: 40px; width: auto; }
.brand span { font-weight: 700; font-size: .95rem; line-height: 1.15; border-left: 2px solid rgba(255,255,255,.5); padding-left: 12px; }

.wrap { max-width: 560px; margin: 0 auto; padding: 18px 16px; }

.card {
  background: var(--card); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.hello { margin: 4px 2px 16px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; font-weight: 700; color: var(--brand); margin-bottom: .2rem; }
.ok { color: var(--ok); }
.note { background: var(--brand-soft); border-radius: 10px; padding: 10px 12px; }
.alert { background: #fef2f2; color: #991b1b; border-radius: 10px; padding: 10px 12px; }

.btn {
  display: inline-block; background: var(--brand); color: #fff; text-decoration: none;
  border: 0; border-radius: 12px; padding: 13px 20px; font: inherit; font-weight: 600;
  cursor: pointer; text-align: center;
}
.btn-block { display: block; width: 100%; }
.btn-ghost { background: transparent; color: var(--brand); border: 2px solid var(--brand); }
button.link { background: none; border: 0; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; padding: 8px; }

.form label { display: block; font-weight: 600; margin-bottom: 14px; }
.form input {
  display: block; width: 100%; margin-top: 6px; padding: 13px 12px;
  font: inherit; border: 1px solid #cfd4d9; border-radius: 10px; background: #fff;
}
.form input:focus { outline: 3px solid color-mix(in srgb, var(--brand) 30%, transparent); border-color: var(--brand); }

.progress { height: 12px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 10px 0; }
.progress span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.progress.small { height: 7px; margin: 6px 0 0; }
.progress-head { font-size: 1.05rem; }

.badge-card {
  background: linear-gradient(135deg, #E6007E, #b30062); color: #fff; border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px; text-align: center;
}
.badge-medal { font-size: 3rem; line-height: 1; margin-bottom: 6px; }

.cp-list { list-style: none; margin: 0 0 20px; padding: 0; }
.cp-list li { margin-bottom: 8px; }
.cp-num {
  flex: 0 0 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700;
  border: 2px solid var(--line); color: var(--muted);
}
.cp-list li.done .cp-num { background: var(--ok); border-color: var(--ok); color: #fff; }
.cp-text { display: flex; flex-direction: column; }

.past { list-style: none; padding: 0; margin: 0; }
.past li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.past li:last-child { border: 0; }

.checked-banner {
  background: var(--ok); color: #fff; font-weight: 700; font-size: 1.1rem;
  border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; text-align: center;
  animation: pop .35s ease-out;
}
.checked-banner.again { background: #e9e9e9; color: var(--ink); font-weight: 600; font-size: 1rem; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.crumb { margin-bottom: 10px; font-size: .95rem; }
.crumb a { text-decoration: none; }
.cp-header { margin-bottom: 16px; }
.pill { display: inline-block; font-size: .85rem; padding: 4px 10px; border-radius: 99px; background: var(--line); color: var(--muted); }
.pill.ok { background: var(--brand-soft); color: var(--brand); }

.offer { background: var(--brand-soft); border: 2px dashed var(--brand); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.offer.locked { background: #f8fafc; border-color: #cbd5e1; color: var(--muted); }

.content { margin-bottom: 20px; }
.blk-text { background: var(--card); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.blk-text p:last-child { margin-bottom: 0; }
.blk-image { margin: 0 0 14px; }
.blk-image img { border-radius: var(--radius); width: 100%; }
.blk-image figcaption { font-size: .85rem; color: var(--muted); padding: 6px 4px 0; }
.blk-button { margin-bottom: 14px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stats div { background: var(--card); border-radius: 12px; padding: 12px; text-align: center; }
.stats strong { display: block; font-size: 1.5rem; }
.stats span { color: var(--muted); font-size: .85rem; }
.team-list { list-style: none; padding: 0; margin: 0; }
.team-list li { background: var(--card); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.team-list li.me { outline: 2px solid var(--brand); }
.team-row { display: flex; justify-content: space-between; gap: 10px; }

.steps { padding-left: 1.3rem; }
.steps li { margin-bottom: 6px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: center; gap: 8px;
  background: var(--ink); border-top: 0;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 0 1 160px; display: flex; flex-direction: column; align-items: center;
  text-decoration: none; color: #cfcfcf; font-size: .8rem; padding: 4px; border-radius: 10px;
}
.tabbar a span { font-size: 1.35rem; }
.tabbar a.on { color: #fff; font-weight: 700; background: var(--brand); }
.logout { margin: 10px 0 20px; }

/* ---------- Scan button (overview) ---------- */
.scan-cta {
  display: flex; align-items: center; gap: 16px; text-decoration: none;
  background: var(--brand); color: #fff; border-radius: 18px; padding: 18px 20px; margin-bottom: 16px;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--brand) 35%, transparent);
}
.scan-cta:active { transform: scale(.98); }
.scan-cta-icon { font-size: 2.2rem; line-height: 1; background: rgba(255,255,255,.2); border-radius: 50%; width: 60px; height: 60px; display: grid; place-items: center; flex: 0 0 60px; }
.scan-cta strong { display: block; font-size: 1.3rem; }
.scan-cta small { display: block; opacity: .9; font-size: .9rem; }

/* ---------- Tab bar: raised Scan button ---------- */
.tabbar { align-items: flex-end; }
.tabbar a.tab-scan {
  color: #fff; font-weight: 700; background: none; margin-top: -26px;
}
.tabbar a.tab-scan span {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
  background: var(--brand); font-size: 1.7rem; margin-bottom: 2px;
  border: 4px solid var(--ink); box-shadow: 0 4px 12px rgba(0,0,0,.3);
}

/* ---------- Scanner page ---------- */
body.scanning { padding-bottom: 0; background: #000; }
body.scanning .topbar { display: none; }
body.scanning .wrap { max-width: none; padding: 0; }
.scanner { position: fixed; inset: 0; background: #000; color: #fff; overflow: hidden; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.scan-frame span {
  width: min(70vw, 300px); aspect-ratio: 1; border-radius: 24px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.45);
  border: 4px solid #fff; transition: border-color .2s;
}
.scanner.found .scan-frame span { border-color: var(--brand); }
.scan-top { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 14px; }
.scan-close {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; text-decoration: none; font-size: 1.4rem;
}
.scan-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 20px calc(28px + env(safe-area-inset-bottom)); text-align: center; background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.scan-status { display: inline-block; font-weight: 700; font-size: 1.1rem; background: rgba(0,0,0,.55); border-radius: 99px; padding: 8px 16px; margin-bottom: 8px; }
.scan-status.ok { background: var(--brand); }
.scan-status.warn { background: #b45309; }
.scan-help { opacity: .85; margin: 0; }
.scan-error { position: absolute; inset: 0; background: var(--bg); color: var(--ink); padding: calc(40px + env(safe-area-inset-top)) 22px 22px; overflow-y: auto; }
.scanner.has-error .scan-frame, .scanner.has-error .scan-bottom, .scanner.has-error .scan-top { display: none; }

/* ---------- Map page ---------- */
body.map-page .wrap { max-width: 900px; padding-bottom: 8px; }
.map-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 0 2px 10px; }
.map-head h1 { margin: 0; }
.map-legend { margin: 0; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.map-legend strong { color: var(--ink); margin-right: 8px; }
.lg { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: .75rem; font-weight: 800; }
.lg-yes { background: var(--brand); color: #fff; }
.lg-no { background: #fff; color: #777; border: 2px solid #9a9a9a; }
.route-map { height: calc(100dvh - 250px); min-height: 320px; border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.12); margin-bottom: 10px; z-index: 0; }
.mk { position: relative; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.mk b { font-size: 1.15rem; line-height: 1; }
.mk i { position: absolute; right: -6px; top: -6px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px; background: var(--ink); color: #fff; font: 700 11px/20px -apple-system, Roboto, Arial, sans-serif; text-align: center; font-style: normal; }
.mk-yes { background: var(--brand); color: #fff; border: 3px solid #fff; }
.mk-no { background: #fff; color: #8a8a8a; border: 3px solid #9a9a9a; }
.mk-pop { font: 14px/1.5 -apple-system, Roboto, Arial, sans-serif; }
.mk-pop .ok { color: var(--brand); font-weight: 600; }
.mk-pop .no { color: #777; }
.map-locate { background: #fff; border: 2px solid rgba(0,0,0,.2); border-radius: 8px; padding: 7px 10px; font: 600 14px/1 -apple-system, Roboto, Arial, sans-serif; cursor: pointer; }
.map-locate.on { background: #dbeafe; border-color: #2563eb; }

/* ---------- Line icons ---------- */
.ic { width: 1.2em; height: 1.2em; vertical-align: -0.22em; flex-shrink: 0; }
.ic-xl { width: 56px; height: 56px; color: var(--brand); margin-bottom: 8px; }
.btn .ic, h2 .ic, .crumb .ic, .pill .ic, button.link .ic { margin-right: 4px; }
.crumb a { display: inline-flex; align-items: center; gap: 4px; }
.pill { display: inline-flex; align-items: center; gap: 4px; }
.pill .ic { margin: 0; width: 1em; height: 1em; }
.offer h2, .checked-banner { display: flex; align-items: center; justify-content: center; gap: 8px; }
.offer h2 { justify-content: flex-start; }
.offer h2 .ic { color: var(--brand); margin: 0; width: 1.3em; height: 1.3em; }
.offer.locked h2 .ic { color: #8a8a8a; }
.checked-banner .ic { width: 1.5em; height: 1.5em; vertical-align: middle; }
.tabbar a span { display: grid; place-items: center; height: 30px; font-size: 0; }
.tabbar a span .ic { width: 24px; height: 24px; vertical-align: 0; }
.tabbar a.tab-scan span .ic { width: 30px; height: 30px; stroke-width: 2.2; }
.tabbar a.tab-scan span { color: #fff; }
.scan-cta-icon { font-size: 0; }
.scan-cta-icon .ic { width: 32px; height: 32px; vertical-align: 0; }
.badge-medal .ic { width: 56px; height: 56px; stroke-width: 1.6; }
.cp-num .ic { width: 20px; height: 20px; vertical-align: 0; stroke-width: 3; }
.past-year { display: inline-flex; align-items: center; gap: 6px; }
.past-year .ic { color: var(--brand); }
.team-count { display: inline-flex; align-items: center; gap: 4px; }
.team-count .ic { color: var(--brand); }
.lg .ic { width: 14px; height: 14px; vertical-align: 0; stroke-width: 3; }
.mk b { display: grid; place-items: center; }
.mk b .ic { width: 20px; height: 20px; vertical-align: 0; }
.mk-pop .ic { width: 1em; height: 1em; }
.map-locate { display: inline-flex; align-items: center; gap: 5px; }
.map-locate .ic { width: 18px; height: 18px; vertical-align: 0; }
.scan-close .ic { width: 26px; height: 26px; vertical-align: 0; }
button.link { display: inline-flex; align-items: center; gap: 2px; }

/* ---------- Locked checkpoints ---------- */
.cp-list .cp-row {
  display: flex; gap: 14px; align-items: center; text-decoration: none; color: inherit;
  background: var(--card); border-radius: 12px; padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.cp-list .cp-text { flex: 1; }
.cp-end { color: #b8b8b8; display: grid; place-items: center; }
.cp-end .ic { width: 18px; height: 18px; vertical-align: 0; }
.cp-list li.done .cp-end { color: var(--brand); }
.cp-list li.locked .cp-row { background: #fafafa; box-shadow: none; border: 1px dashed #d6d6d6; }
.locked-card { background: var(--card); border-radius: var(--radius); padding: 24px 20px; text-align: center; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.locked-icon { width: 72px; height: 72px; margin: 0 auto 10px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.locked-icon .ic { width: 34px; height: 34px; vertical-align: 0; }
.map-length { margin: 2px 0 0; font-size: .95rem; }
