/* =====================================================================
   Scout Treasure Hunts – mobile-first design system
   Scouts brand palette as used on blythvalleyscouts.org.uk (purple, Nunito Sans)
   ===================================================================== */
:root {
    --purple: #7413dc;
    --purple-600: #6410c4;
    --purple-700: #5a0fb2;
    --purple-dark: #4d0b96;
    --purple-50: #f6f0fe;
    --purple-100: #ede1fc;
    --purple-200: #d9c2f8;
    --teal: #088486;
    --teal-50: #e3f4f4;
    --red: #e22e12;
    --red-50: #fdebe7;
    --yellow: #ffe627;
    --gold: #f5a400;
    --green: #23a950;
    --navy: #003982;
    --navy-900: #0b1f4d;
    --ink: #17141f;
    --ink-2: #3b3647;
    --muted: #6b6578;
    --line: #e7e3ee;
    --bg: #f5f2fa;
    --card: #ffffff;
    --radius-sm: 10px;
    --radius: 18px;
    --radius-lg: 26px;
    --shadow-sm: 0 1px 2px rgba(23, 20, 31, .06);
    --shadow: 0 1px 2px rgba(23, 20, 31, .05), 0 8px 24px -8px rgba(77, 11, 150, .14);
    --shadow-lg: 0 18px 40px -12px rgba(77, 11, 150, .35);
    --grad: linear-gradient(135deg, #8a2be2 0%, #7413dc 45%, #4d0b96 100%);
    --grad-teal: linear-gradient(135deg, #0aa3a5 0%, #088486 100%);
    --font: "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 16.5px;
    line-height: 1.5;
    color: var(--ink);
    background:
        radial-gradient(1200px 500px at 100% -10%, rgba(116, 19, 220, .10), transparent 60%),
        radial-gradient(900px 400px at -10% 10%, rgba(8, 132, 134, .07), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-weight: 900; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.85rem; color: var(--ink); }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
a { color: var(--purple); text-underline-offset: 3px; }
img { max-width: 100%; }
h1:focus { outline: none; }
.icon { flex: none; display: inline-block; vertical-align: middle; }

/* ---------------------------------------------------------------- Header */
.site-header {
    position: sticky; top: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: .6rem 1rem; padding-top: max(.6rem, env(safe-area-inset-top));
    background: var(--grad);
    color: #fff;
    box-shadow: 0 6px 20px -10px rgba(77, 11, 150, .7);
}
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; min-width: 0; }
.brand img { flex: none; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .2)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand-name { font-weight: 900; font-size: .95rem; white-space: nowrap; letter-spacing: .01em; }
.brand-sub { font-size: .72rem; opacity: .85; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.site-nav { display: flex; align-items: center; gap: .35rem; font-size: .88rem; white-space: nowrap; }
.site-nav a {
    color: #fff; text-decoration: none; font-weight: 800;
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .4rem .7rem; border-radius: 999px; transition: background .15s;
}
.site-nav a:hover { background: rgba(255, 255, 255, .14); }
.site-nav .nav-cta { background: #fff; color: var(--purple); box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.site-nav .nav-cta:hover { background: #fff; }
.inline-form { display: inline; margin: 0; }
.link-button { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--purple); text-decoration: underline; text-underline-offset: 3px; font-weight: 700; }

.site-main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 1.1rem 1rem 3rem; }
.site-footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.2rem 1rem calc(1.2rem + env(safe-area-inset-bottom)); }
.site-footer strong { color: var(--purple); }

/* ---------------------------------------------------------------- Page headings */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin: .25rem 0 1rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.eyebrow { font-size: .75rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--purple); margin-bottom: .2rem; }
.back-link { display: inline-flex; align-items: center; gap: .2rem; font-weight: 800; font-size: .9rem; text-decoration: none; margin-bottom: .6rem; color: var(--purple); }
.back-link:hover { text-decoration: underline; }
.lead { font-size: 1.05rem; color: var(--ink-2); }

/* ---------------------------------------------------------------- Cards */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(116, 19, 220, .06);
    padding: 1.15rem;
    margin-bottom: 1rem;
    animation: rise .35s var(--ease) both;
}
.card > :last-child { margin-bottom: 0; }
.card-title { display: flex; align-items: center; gap: .6rem; margin-bottom: .85rem; }
.card-title h2, .card-title h3 { margin: 0; }
.chip-icon {
    width: 38px; height: 38px; border-radius: 12px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--purple-50); color: var(--purple);
}
.chip-icon.teal { background: var(--teal-50); color: var(--teal); }
.chip-icon.gold { background: #fff4d6; color: #b87900; }
.chip-icon.red { background: var(--red-50); color: var(--red); }
.card.accent { border-left: 5px solid var(--purple); }

.hero {
    position: relative; overflow: hidden;
    background: var(--grad); color: #fff;
    border-radius: var(--radius-lg);
    padding: 1.6rem 1.3rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-lg);
    animation: rise .4s var(--ease) both;
}
.hero::before, .hero::after {
    content: ""; position: absolute; border-radius: 50%; pointer-events: none;
    background: radial-gradient(circle, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 70%);
}
.hero::before { width: 280px; height: 280px; right: -90px; top: -110px; }
.hero::after { width: 200px; height: 200px; left: -70px; bottom: -110px; background: radial-gradient(circle, rgba(255, 230, 39, .28), rgba(255, 230, 39, 0) 70%); }
.hero h1 { color: #fff; font-size: 2rem; margin-bottom: .35rem; position: relative; }
.hero p { color: rgba(255, 255, 255, .9); position: relative; margin: 0; }
.hero .hero-meta { position: relative; display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .9rem; }
.hero-pill { display: inline-flex; align-items: center; gap: .35rem; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .22); padding: .3rem .7rem; border-radius: 999px; font-size: .85rem; font-weight: 800; backdrop-filter: blur(6px); }
.hero .stars { color: var(--yellow); }
.hero .muted { color: rgba(255, 255, 255, .85); }
.hero-art { position: absolute; right: 1rem; bottom: .6rem; opacity: .2; color: #fff; }

.stack > * + * { margin-top: .75rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.hidden { display: none !important; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain > li { padding: .75rem 0; border-bottom: 1px solid var(--line); }
.list-plain > li:last-child { border-bottom: 0; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.divider { height: 1px; background: var(--line); margin: 1rem 0; border: 0; }

/* ---------------------------------------------------------------- Forms */
label { display: block; font-weight: 800; margin-bottom: .3rem; font-size: .95rem; }
.field { margin-bottom: 1rem; }
.field .hint, .hint { font-size: .84rem; color: var(--muted); margin-top: .3rem; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], textarea, select {
    width: 100%;
    font: inherit; font-size: 1rem; /* 16px+ stops iOS zooming on focus */
    padding: .75rem .9rem;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: #fbfafd;
    color: var(--ink);
    transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: #a7a1b3; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--purple); background: #fff; box-shadow: 0 0 0 4px rgba(116, 19, 220, .14); }
textarea { min-height: 6rem; resize: vertical; }
input.pin-input { font-size: 2.2rem; letter-spacing: .5em; text-align: center; font-weight: 900; padding-left: 1.4rem; }
.checkbox { display: flex; align-items: center; gap: .55rem; font-weight: 700; cursor: pointer; }
.checkbox input { width: 1.25rem; height: 1.25rem; accent-color: var(--purple); }
.validation-message, .field-error { color: var(--red); font-size: .88rem; margin-top: .3rem; font-weight: 700; }
.validation-errors { color: var(--red); padding-left: 1.2rem; }
input.invalid, textarea.invalid { border-color: var(--red); }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > input { padding-left: 2.6rem; }
.w3w-input { position: relative; }
.w3w-input::before { content: "///"; position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: #e11f26; font-weight: 900; pointer-events: none; }
.w3w-input input { padding-left: 2.6rem; font-weight: 800; }

.file-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
label.btn { position: relative; margin: 0; }

/* -------- Fancy option card (big checkbox) */
.option-card {
    position: relative; display: flex; align-items: center; gap: .75rem;
    padding: .9rem; margin: 0;
    border: 2px solid var(--line); border-radius: 16px; background: #fff;
    cursor: pointer; user-select: none;
    transition: border-color .2s, background .2s, box-shadow .2s, transform .1s;
    font-weight: 400;
}
.option-card:hover { border-color: var(--purple-200); }
.option-card:active { transform: scale(.99); }
.option-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.option-card .oc-icon {
    width: 46px; height: 46px; border-radius: 14px; flex: none;
    display: flex; align-items: center; justify-content: center;
    background: var(--purple-50); color: var(--purple); transition: background .2s, color .2s;
}
.option-card .oc-text { flex: 1; min-width: 0; }
.option-card .oc-title { display: block; font-weight: 900; font-size: 1rem; line-height: 1.25; }
.option-card .oc-desc { display: block; font-size: .86rem; color: var(--muted); margin-top: .1rem; }
.option-card .oc-check {
    width: 30px; height: 30px; border-radius: 9px; flex: none;
    border: 2px solid var(--purple-200); background: #fff;
    display: flex; align-items: center; justify-content: center; color: transparent;
    transition: background .2s var(--ease), border-color .2s, color .2s, transform .2s var(--ease);
}
.option-card.on { border-color: var(--purple); background: var(--purple-50); box-shadow: 0 0 0 4px rgba(116, 19, 220, .10); }
.option-card.on .oc-icon { background: var(--purple); color: #fff; }
.option-card.on .oc-check { background: var(--purple); border-color: var(--purple); color: #fff; transform: scale(1.06); }
.option-card.on .oc-check .icon { animation: pop .3s var(--ease); }
.option-card input:focus-visible ~ .oc-check { box-shadow: 0 0 0 4px rgba(116, 19, 220, .25); }

/* -------- Segmented toggle */
.segmented {
    position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
    background: #efe9f8; padding: 5px; border-radius: 16px;
}
.segmented .seg-thumb {
    position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc(50% - 7px);
    background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(77, 11, 150, .16);
    transition: transform .3s var(--ease);
}
.segmented.second .seg-thumb { transform: translateX(calc(100% + 4px)); }
.segmented button {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; align-items: center; gap: .25rem;
    border: 0; background: none; font: inherit; cursor: pointer;
    padding: .7rem .4rem; border-radius: 12px;
    color: var(--muted); font-weight: 800; font-size: .88rem; line-height: 1.2; text-align: center;
    transition: color .2s;
}
.segmented button.active { color: var(--purple); }
.reveal { animation: reveal .35s var(--ease) both; }

/* ---------------------------------------------------------------- Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    font: inherit; font-weight: 800; font-size: 1rem; line-height: 1.1;
    padding: .8rem 1.25rem; min-height: 48px;
    border-radius: 14px; border: 0;
    background: var(--grad); color: #fff;
    text-decoration: none; cursor: pointer;
    box-shadow: 0 6px 16px -6px rgba(116, 19, 220, .55);
    transition: transform .12s var(--ease), box-shadow .2s, filter .2s, background .2s;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover:not(:disabled) { filter: brightness(1.06); box-shadow: 0 10px 22px -8px rgba(116, 19, 220, .6); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.secondary { background: #fff; color: var(--purple); box-shadow: inset 0 0 0 1.5px var(--purple-200), var(--shadow-sm); }
.btn.secondary:hover:not(:disabled) { background: var(--purple-50); box-shadow: inset 0 0 0 1.5px var(--purple), var(--shadow-sm); }
.btn.ghost { background: transparent; color: var(--purple); box-shadow: none; }
.btn.ghost:hover:not(:disabled) { background: var(--purple-50); }
.btn.teal { background: var(--grad-teal); box-shadow: 0 6px 16px -6px rgba(8, 132, 134, .6); }
.btn.danger { background: #fff; color: var(--red); box-shadow: inset 0 0 0 1.5px #f5b8ab; }
.btn.danger:hover:not(:disabled) { background: var(--red-50); }
.btn.small { min-height: 38px; padding: .45rem .85rem; font-size: .9rem; border-radius: 11px; }
.btn.icon-only { width: 38px; padding: 0; }
.btn.block { display: flex; width: 100%; }
.btn.big { font-size: 1.12rem; min-height: 58px; border-radius: 16px; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 auto; }

/* ---------------------------------------------------------------- Alerts / badges */
.alert { display: flex; gap: .6rem; align-items: flex-start; padding: .85rem 1rem; border-radius: 14px; margin-bottom: 1rem; font-weight: 700; font-size: .95rem; animation: rise .3s var(--ease) both; }
.alert .icon { margin-top: 1px; }
.alert.error { background: var(--red-50); color: #9b1c08; }
.alert.success { background: var(--teal-50); color: #05595a; }
.alert.info { background: var(--purple-50); color: var(--purple-dark); }
.alert.warn { background: #fff7d1; color: #6b5800; }

.badge { display: inline-flex; align-items: center; gap: .25rem; font-size: .74rem; font-weight: 900; padding: .18rem .6rem; border-radius: 999px; background: var(--purple-50); color: var(--purple-dark); vertical-align: middle; white-space: nowrap; }
.badge.teal { background: var(--teal-50); color: #05595a; }
.badge.red { background: var(--red); color: #fff; }
.badge.grey { background: #efedf3; color: var(--muted); }
.badge.gold { background: #fff1c7; color: #8a5a00; }

.stars { color: var(--gold); letter-spacing: .05em; white-space: nowrap; }
.star-input { display: flex; gap: .2rem; }
.star-input button { background: none; border: 0; cursor: pointer; color: #d9d4e2; padding: .1rem; line-height: 0; transition: transform .15s var(--ease), color .15s; }
.star-input button:hover { transform: scale(1.15); }
.star-input button.on { color: var(--gold); }
.star-input button.on svg { fill: currentColor; }

/* ---------------------------------------------------------------- Hunt list */
.hunt-tile {
    display: flex; gap: .9rem; align-items: center; text-decoration: none; color: inherit;
    padding: .9rem; border-radius: 16px; transition: background .15s;
}
.hunt-tile:hover { background: var(--purple-50); }
.hunt-tile .tile-icon { width: 52px; height: 52px; border-radius: 16px; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; box-shadow: 0 6px 14px -6px rgba(116, 19, 220, .6); }
.hunt-tile .title { font-weight: 900; font-size: 1.05rem; }
.hunt-tile .meta { font-size: .84rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .2rem .8rem; }
.hunt-tile .meta span { display: inline-flex; align-items: center; gap: .25rem; }
.tile-list { display: flex; flex-direction: column; gap: .15rem; }

.empty-state { text-align: center; padding: 2rem 1rem; }
.empty-state .empty-art { width: 84px; height: 84px; margin: 0 auto 1rem; border-radius: 26px; background: var(--purple-50); color: var(--purple); display: flex; align-items: center; justify-content: center; }

/* ---------------------------------------------------------------- Steps */
.step-list { display: flex; flex-direction: column; gap: .7rem; list-style: none; padding: 0; margin: 0; }
.step-item { display: flex; gap: .8rem; align-items: flex-start; padding: .85rem; border: 1.5px solid var(--line); border-radius: 16px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.step-item:hover { border-color: var(--purple-200); box-shadow: var(--shadow-sm); }
.step-num { flex: none; width: 2.2rem; height: 2.2rem; border-radius: 12px; background: var(--grad); color: #fff; font-weight: 900; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px -4px rgba(116, 19, 220, .6); }
.step-thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 12px; flex: none; }
.step-body { flex: 1; min-width: 0; }
.step-title { font-weight: 900; }
.step-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
.step-actions { display: flex; flex-direction: column; gap: .3rem; }
.w3w { font-weight: 900; color: #e11f26; text-decoration: none; overflow-wrap: anywhere; }
.w3w::before { content: "///"; }
.photo-preview { width: 100%; max-height: 340px; object-fit: cover; border-radius: 14px; display: block; }
.photo-frame { position: relative; }
.photo-frame .btn { position: absolute; right: .6rem; top: .6rem; }
.photo-drop { border: 2px dashed var(--purple-200); border-radius: 16px; padding: 1.2rem; text-align: center; background: var(--purple-50); color: var(--purple-dark); }

.location-result {
    display: flex; gap: .8rem; align-items: center;
    padding: .9rem 1rem; border-radius: 16px;
    background: linear-gradient(135deg, #fff5f5, #fff); border: 1.5px solid #f6c9c9;
    animation: reveal .35s var(--ease) both;
}
.location-result .w3w { font-size: 1.15rem; }
.location-result .lr-icon { width: 42px; height: 42px; border-radius: 12px; background: #e11f26; color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }

/* ---------------------------------------------------------------- Choice tiles (start / join) */
.choice-grid { display: grid; gap: .8rem; }
.choice {
    display: flex; align-items: center; gap: 1rem; text-decoration: none; color: var(--ink);
    padding: 1.15rem; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow);
    border: 2px solid transparent; transition: border-color .2s, transform .15s var(--ease), box-shadow .2s;
    animation: rise .4s var(--ease) both;
}
.choice:hover { border-color: var(--purple-200); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.choice .ch-icon { width: 56px; height: 56px; border-radius: 18px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--grad); color: #fff; }
.choice.alt .ch-icon { background: var(--grad-teal); }
.choice .ch-title { font-weight: 900; font-size: 1.15rem; display: block; }
.choice .ch-desc { color: var(--muted); font-size: .88rem; display: block; }
.choice > .icon:last-child { color: var(--purple-200); margin-left: auto; }

/* ---------------------------------------------------------------- Game status bar */
.game-bar {
    position: sticky; top: 56px; z-index: 900;
    display: grid; grid-template-columns: 1.2fr 1fr 1.3fr; gap: .4rem;
    margin: -1.1rem -1rem 1rem; padding: .65rem 1rem .75rem;
    background: linear-gradient(180deg, var(--navy-900), #10296a);
    color: #fff;
    border-radius: 0 0 22px 22px;
    box-shadow: 0 10px 24px -12px rgba(11, 31, 77, .7);
}
.game-bar .stat { text-align: center; min-width: 0; }
.game-bar .stat + .stat { border-left: 1px solid rgba(255, 255, 255, .12); }
.game-bar .stat-label { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; opacity: .7; font-weight: 800; display: inline-flex; align-items: center; gap: .25rem; }
.game-bar .stat-value { font-size: 1.4rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-bar .stat-value.name { font-size: 1rem; padding-top: .2rem; }
.score-bump { animation: bump .6s var(--ease); display: inline-block; }
.countdown.urgent { color: var(--yellow); animation: pulse 1s ease-in-out infinite; }
.countdown.done { color: #ff9b8a; }

.pin-display { font-size: 3.6rem; font-weight: 900; letter-spacing: .28em; text-align: center; font-variant-numeric: tabular-nums; padding-left: .28em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.1; }
.pin-box { text-align: center; padding: 1.4rem 1rem; }
.pin-box .qr-wrap { width: 190px; margin: 1rem auto 0; padding: 10px; background: #fff; border-radius: 16px; box-shadow: var(--shadow); }

.team-name { display: inline-flex; align-items: center; gap: .3rem; min-width: 0; }
.rename-btn {
    border: 0; background: var(--purple-50); color: var(--purple); cursor: pointer;
    width: 28px; height: 28px; border-radius: 9px; flex: none;
    display: inline-flex; align-items: center; justify-content: center; transition: background .15s;
}
.rename-btn:hover { background: var(--purple-100); }
.rename-form { width: 100%; }
.rename-form input { padding: .5rem .7rem; font-weight: 800; }

.copy-link { margin-top: 1rem; text-align: left; }
.copy-link .small { display: block; margin-bottom: .3rem; text-align: center; }
.link-box {
    display: block; padding: .7rem .9rem; border-radius: 12px; text-align: center;
    background: var(--purple-50); border: 1.5px dashed var(--purple-200);
    color: var(--purple-dark); font-weight: 800; font-size: .95rem; text-decoration: none;
    word-break: break-all; user-select: all;
}

.clue-card { position: relative; overflow: hidden; padding-top: 1.3rem; }
.clue-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--grad); }
.clue-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 900; color: var(--purple); }
.clue-text { font-size: 1.22rem; font-weight: 700; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); }
.big-w3w { font-size: 1.35rem; }
.w3w-box { display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem; border-radius: 14px; background: #fff5f5; border: 1.5px solid #f6c9c9; text-decoration: none; margin-bottom: .8rem; }
.w3w-box .lr-icon { width: 38px; height: 38px; border-radius: 11px; background: #e11f26; color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }

.progress-track { display: flex; gap: .35rem; margin: .55rem 0 .9rem; }
.progress-track span { flex: 1; height: 8px; border-radius: 999px; background: var(--line); transition: background .3s; }
.progress-track span.done { background: var(--grad-teal); }
.progress-track span.current { background: var(--purple); animation: pulse 1.6s ease-in-out infinite; }

.toast {
    position: fixed; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 2000;
    width: min(92vw, 520px); transform: translateX(-50%);
    padding: .95rem 1.1rem; border-radius: 18px; font-weight: 800; font-size: 1rem;
    box-shadow: 0 16px 36px -10px rgba(0, 0, 0, .4);
    display: flex; align-items: center; gap: .75rem;
    animation: toast-in .45s var(--ease) both;
}
.toast.success { background: var(--grad-teal); color: #fff; }
.toast.error { background: linear-gradient(135deg, #f0472b, #c9230b); color: #fff; }
.toast.info { background: linear-gradient(135deg, #17398a, var(--navy-900)); color: #fff; }
.toast button { margin-left: auto; background: rgba(255, 255, 255, .15); border: 0; color: inherit; width: 30px; height: 30px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex: none; }

.celebrate { text-align: center; padding: 1.2rem 1rem .4rem; }
.celebrate .burst { width: 96px; height: 96px; margin: 0 auto .8rem; border-radius: 30px; display: flex; align-items: center; justify-content: center; color: #fff; background: linear-gradient(135deg, #ffcf3f, var(--gold)); box-shadow: 0 14px 30px -10px rgba(245, 164, 0, .7); animation: pop .6s var(--ease) both; }
.celebrate .burst.wait { background: var(--grad); box-shadow: var(--shadow-lg); animation: floaty 2.4s ease-in-out infinite; }
.celebrate .burst.time { background: linear-gradient(135deg, #ff8a70, var(--red)); }
.big-score { font-size: 2.6rem; font-weight: 900; color: var(--purple); line-height: 1; }

/* ---------------------------------------------------------------- Leaderboard */
.leaderboard { width: 100%; border-collapse: separate; border-spacing: 0 .35rem; }
.leaderboard th { font-size: .7rem; text-transform: uppercase; color: var(--muted); letter-spacing: .08em; text-align: left; padding: 0 .5rem; }
.leaderboard td { padding: .7rem .5rem; background: #faf8fd; }
.leaderboard td:first-child { border-radius: 12px 0 0 12px; }
.leaderboard td:last-child { border-radius: 0 12px 12px 0; }
.leaderboard td.num, .leaderboard th.num { text-align: right; font-variant-numeric: tabular-nums; }
.leaderboard tr.me td { background: var(--purple-50); font-weight: 900; }
.rank { width: 2.2rem; }
.rank-badge { width: 1.9rem; height: 1.9rem; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-weight: 900; font-size: .9rem; background: #ece8f2; color: var(--muted); }
.rank-badge.r1 { background: linear-gradient(135deg, #ffd54a, var(--gold)); color: #fff; }
.rank-badge.r2 { background: linear-gradient(135deg, #d6dbe3, #a7b0bf); color: #fff; }
.rank-badge.r3 { background: linear-gradient(135deg, #e7b083, #c47a3c); color: #fff; }
.team-row { cursor: pointer; }
.team-row:hover td { background: var(--purple-50); }

/* ---------------------------------------------------------------- Tabs */
.tabs { display: flex; gap: 4px; background: #ece5f7; padding: 5px; border-radius: 16px; margin-bottom: 1rem; position: sticky; top: 140px; z-index: 800; }
.tabs button {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
    border: 0; background: none; font: inherit; font-weight: 800; font-size: .92rem;
    padding: .6rem .3rem; border-radius: 12px; cursor: pointer; color: var(--muted); transition: background .2s, color .2s;
}
.tabs button.active { background: #fff; box-shadow: 0 2px 8px rgba(77, 11, 150, .15); color: var(--purple); }

/* ---------------------------------------------------------------- Map */
.map { width: 100%; height: 420px; border-radius: var(--radius); overflow: hidden; background: #e8e6ee; z-index: 0; box-shadow: var(--shadow); }
.map.short { height: 240px; }
.map-label { background: #fff; border: 0; border-radius: 8px; font-weight: 900; font-family: var(--font); padding: 2px 7px; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.step-pin { width: 28px; height: 28px; border-radius: 10px; background: var(--purple); color: #fff; font-weight: 900; font-size: 13px; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); font-family: var(--font); }

/* ---------------------------------------------------------------- Messages */
.thread { display: flex; flex-direction: column; gap: .5rem; max-height: 50vh; overflow-y: auto; padding: .3rem 0; }
.bubble { max-width: 85%; padding: .6rem .85rem; border-radius: 18px; overflow-wrap: anywhere; animation: rise .25s var(--ease) both; }
.bubble .meta { display: block; font-size: .72rem; opacity: .75; margin-top: .15rem; }
.bubble.them { background: #f0edf5; align-self: flex-start; border-bottom-left-radius: 6px; }
.bubble.me { background: var(--grad); color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.compose { display: flex; gap: .5rem; align-items: flex-end; margin-top: .7rem; }
.compose textarea { min-height: 3rem; height: 3rem; border-radius: 16px; }
.compose .btn { min-height: 48px; }

/* ---------------------------------------------------------------- QR scanner */
.scanner video { width: 100%; border-radius: var(--radius); background: #000; max-height: 60vh; object-fit: cover; }
.code-entry, .inline-entry { display: flex; gap: .5rem; }
.code-entry input { text-transform: uppercase; letter-spacing: .15em; font-weight: 900; }
.code-entry input::placeholder { text-transform: none; letter-spacing: normal; font-weight: 600; }
.or-sep { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; margin: .9rem 0; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------------------------------------------------------------- How it works */
.steps-how { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; counter-reset: how; }
.steps-how li { display: flex; gap: .8rem; align-items: flex-start; }
.steps-how li::before { counter-increment: how; content: counter(how); flex: none; width: 1.9rem; height: 1.9rem; border-radius: 10px; background: var(--purple-50); color: var(--purple); font-weight: 900; display: flex; align-items: center; justify-content: center; }

/* ---------------------------------------------------------------- Print sheets (browser printing fallback) */
.print-sheet { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.qr-card { background: #fff; border: 3px dashed var(--purple); border-radius: 16px; padding: 1rem; text-align: center; break-inside: avoid; page-break-inside: avoid; }
.qr-card .qr svg, .qr-card .qr img { width: 100%; max-width: 260px; height: auto; display: block; margin: .5rem auto; }
.qr-card .qr-title { font-weight: 900; color: var(--purple); font-size: 1.3rem; }
.qr-card .qr-code-text { font-weight: 900; letter-spacing: .2em; font-size: 1.2rem; }
.qr-card.start { border-style: solid; }

@media (min-width: 640px) {
    .print-sheet { grid-template-columns: 1fr 1fr; }
    h1 { font-size: 2.2rem; }
    .hero { padding: 2.2rem 2rem; }
    .hero h1 { font-size: 2.5rem; }
    .map { height: 520px; }
    .choice-grid { grid-template-columns: 1fr 1fr; }
    .site-nav { font-size: .92rem; }
}
@media (max-width: 430px) {
    /* Phones: keep "My hunts" readable on one line; the account link shows just its icon. */
    .site-nav a[href="account/manage"] .nav-label { display: none; }
}
@media (max-width: 380px) {
    .brand-name { font-size: .85rem; }
    .site-nav a { padding: .35rem .5rem; }
    .site-nav .nav-label { display: none; }
}

@media print {
    .site-header, .site-footer, .no-print, #blazor-error-ui, #components-reconnect-modal { display: none !important; }
    body { background: #fff; }
    .site-main { max-width: none; padding: 0; }
    .card { box-shadow: none; animation: none; }
    .print-sheet { grid-template-columns: 1fr 1fr; gap: 8mm; }
    .qr-card { border-color: #000; }
    .qr-card.start { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------------- Motion */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes reveal { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.35); color: var(--yellow); } 100% { transform: scale(1); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 20px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------------------------------------------------------------- Blazor plumbing */
#blazor-error-ui { background: #fff7d1; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2); display: none; left: 0; padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 3000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.blazor-error-boundary { background: var(--red); padding: 1rem; color: white; border-radius: 12px; }
.blazor-error-boundary::after { content: "Something went wrong."; }
