/* Stormcatch Backers - mobile first. Palette taken from stormcatch.com */
:root {
    --navy: #060f2b;
    --navy-2: #0b1131;
    --ink: #161843;
    --purple-1: #342769;
    --purple-2: #221f57;
    --gold: #f4d27a;
    --yellow: #ffce00;
    --yellow-2: #ffc100;
    --teal-1: #41efdd;
    --teal-2: #1db4a4;
    --teal-3: #1a857a;
    --white: #ffffff;
    --muted: #aab0cf;
    --line: rgba(244, 210, 122, 0.18);
    --card: linear-gradient(145deg, rgba(52, 39, 105, 0.92) 0%, rgba(34, 31, 87, 0.92) 60%, rgba(11, 17, 49, 0.95) 100%);
    --danger: #ff6b6b;
    --radius: 20px;
    --radius-sm: 12px;
    --font: "museo-sans", "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --nav-h: 68px;
    --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Navy behind everything, so iOS Safari tints its bars and the overscroll area navy instead of white. */
html { -webkit-text-size-adjust: 100%; background-color: #060f2b; color-scheme: dark; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--navy);
    color: var(--white);
    font-family: var(--font);
    font-weight: 500;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
body::before {
    content: "";
    position: fixed;
    inset: auto 0 0 0;
    height: 60vh;
    background: url("../images/mesh.svg") bottom center / cover no-repeat;
    opacity: 0.55;
    pointer-events: none;
    z-index: 0;
}
a { color: var(--yellow); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-weight: 900; line-height: 1.15; margin: 0 0 0.4em; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.tiny { font-size: 0.72rem; }
.upper { text-transform: uppercase; letter-spacing: 0.08em; font-weight: 800; }
.gold { color: var(--gold); }
.yellow { color: var(--yellow); }
.teal { color: var(--teal-1); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon-fill { fill: currentColor; stroke: none; }

/* ---------- Layout ---------- */
.app { position: relative; z-index: 1; min-height: 100vh; padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.topbar {
    position: sticky; top: 0; z-index: 20;
    padding-top: env(safe-area-inset-top);
    background: #060f2b;
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.topbar .container { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--white); }
.brand:hover { text-decoration: none; }
.brand img { height: 40px; width: auto; color: var(--white); font-weight: 900; font-size: 1.1rem; }
.brand-sub { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); font-weight: 800; border-left: 1px solid var(--line); padding-left: 10px; }
.topnav { display: none; gap: 22px; }
.topnav a { color: var(--white); font-weight: 800; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.04em; }
.topnav a.active, .topnav a:hover { color: var(--yellow); text-decoration: none; }
.top-actions { display: flex; align-items: center; gap: 10px; }

.bottomnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    display: grid; grid-template-columns: repeat(5, 1fr);
    background: rgba(11, 17, 49, 0.96);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
}
.bottomnav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    color: var(--muted); font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
}
.bottomnav a .icon { width: 24px; height: 24px; }
.bottomnav a.active { color: var(--yellow); }
.bottomnav a:hover { text-decoration: none; }

main { padding-top: 20px; }
.page-head { margin: 8px 0 18px; }
.page-head p { color: var(--muted); margin: 0; }

.grid { display: grid; gap: 16px; }
.stack > * + * { margin-top: 16px; }
.grid > *, .stack > * { min-width: 0; }
.copy-field .input { min-width: 0; }

@media (min-width: 900px) {
    .topnav { display: flex; }
    .bottomnav { display: none; }
    .app { padding-bottom: 48px; }
    h1 { font-size: 2.25rem; }
    main { padding-top: 32px; }
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-dash { grid-template-columns: 1.15fr 1fr; align-items: start; }
}

/* ---------- Cards ---------- */
.card {
    position: relative;
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-flat { background: rgba(11, 17, 49, 0.75); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--gold); font-weight: 800; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 0 22px;
    border: 0; border-radius: 999px; cursor: pointer;
    font: inherit; font-weight: 900; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.06em;
    background: var(--yellow); color: var(--navy);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; background: var(--yellow-2); box-shadow: 0 8px 24px -8px rgba(255, 206, 0, 0.6); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-teal { background: linear-gradient(180deg, var(--teal-1) 0%, var(--teal-2) 38%, var(--teal-3) 100%); color: var(--navy); }
.btn-teal:hover { background: linear-gradient(180deg, var(--teal-1) 0%, var(--teal-2) 60%, var(--teal-3) 100%); box-shadow: 0 8px 24px -8px rgba(65, 239, 221, 0.55); }
.btn-ghost { background: transparent; color: var(--white); border: 1.5px solid rgba(255, 255, 255, 0.25); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.06); box-shadow: none; }
.btn-danger { background: transparent; color: var(--danger); border: 1.5px solid rgba(255, 107, 107, 0.5); }
.btn-danger:hover { background: rgba(255, 107, 107, 0.1); box-shadow: none; }
.btn-sm { min-height: 38px; padding: 0 16px; font-size: 0.78rem; }
.link-btn { background: none; border: 0; color: var(--yellow); font: inherit; font-weight: 800; cursor: pointer; padding: 0; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.8rem; font-weight: 800; letter-spacing: 0.04em; margin-bottom: 6px; color: var(--gold); text-transform: uppercase; }
.input, select.input, textarea.input {
    width: 100%; min-height: 48px; padding: 12px 14px;
    background: rgba(6, 15, 43, 0.7); color: var(--white);
    border: 1.5px solid rgba(255, 255, 255, 0.14); border-radius: var(--radius-sm);
    font: inherit; font-size: 16px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { outline: none; border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(255, 206, 0, 0.18); }
.input::placeholder { color: rgba(170, 176, 207, 0.6); }
.error { color: var(--danger); font-size: 0.82rem; margin-top: 6px; }
.hint { color: var(--muted); font-size: 0.8rem; margin-top: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.9rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--yellow); margin-top: 2px; flex: none; }
.form-row { display: grid; gap: 0 16px; }
@media (min-width: 640px) { .form-row { grid-template-columns: 1fr 1fr; } }

/* ---------- Alerts / toasts ---------- */
.alert { border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 16px; font-weight: 700; font-size: 0.92rem; }
.alert-ok { background: rgba(29, 180, 164, 0.15); border: 1px solid rgba(65, 239, 221, 0.4); color: var(--teal-1); }
.alert-err { background: rgba(255, 107, 107, 0.12); border: 1px solid rgba(255, 107, 107, 0.4); color: #ffb3b3; }
.toast {
    position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 60;
    transform: translate(-50%, 20px); opacity: 0;
    background: var(--navy-2); border: 1px solid var(--line); border-radius: 999px;
    padding: 12px 20px; font-weight: 800; font-size: 0.9rem; box-shadow: var(--shadow);
    transition: all 0.25s ease; pointer-events: none; white-space: nowrap;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
@media (min-width: 900px) { .toast { bottom: 32px; } }

/* ---------- Auth ---------- */
.auth { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }
.auth-hero { padding: 28px 20px 8px; text-align: center; }
.auth-hero img { height: 64px; margin: 0 auto 18px; }
.auth-hero h1 { font-size: 1.9rem; }
.auth-hero p { color: var(--muted); max-width: 420px; margin: 0 auto; }
.auth-card { width: 100%; max-width: 440px; margin: 20px auto 40px; padding: 0 16px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 0.9rem; margin-top: 18px; }
.ref-chip { display: inline-flex; gap: 8px; align-items: center; background: rgba(255, 206, 0, 0.1); border: 1px solid rgba(255, 206, 0, 0.35); color: var(--yellow); border-radius: 999px; padding: 6px 14px; font-weight: 800; font-size: 0.82rem; margin-bottom: 14px; }
@media (min-width: 900px) {
    .auth { flex-direction: row; align-items: stretch; }
    .auth-hero { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; text-align: left; padding: 64px; }
    .auth-hero img { margin: 0 0 32px; height: 84px; }
    .auth-hero h1 { font-size: 3rem; max-width: 560px; }
    .auth-hero p { margin: 0; font-size: 1.1rem; }
    .auth-card { flex: 0 0 480px; margin: auto 48px auto 0; }
}
.perks { list-style: none; padding: 0; margin: 28px 0 0; display: none; gap: 14px; }
.perks li { display: flex; gap: 12px; align-items: center; font-weight: 700; }
.perks .icon { color: var(--yellow); width: 22px; height: 22px; }
@media (min-width: 900px) { .perks { display: grid; } }

/* ---------- Avatar ---------- */
.avatar {
    width: 40px; height: 40px; border-radius: 50%; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--yellow) 0%, var(--gold) 100%); color: var(--navy);
    font-weight: 900; font-size: 0.9rem; overflow: hidden; border: 2px solid rgba(255, 206, 0, 0.5);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 88px; height: 88px; font-size: 1.8rem; border-width: 3px; }
.avatar-xl { width: 112px; height: 112px; font-size: 2.2rem; border-width: 3px; }

/* ---------- Backer pass ---------- */
.pass {
    position: relative; overflow: hidden; border-radius: 24px; padding: 22px;
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(255, 206, 0, 0.22) 0%, rgba(255, 206, 0, 0) 55%),
        linear-gradient(137deg, var(--purple-1) 0%, var(--purple-2) 53%, var(--navy-2) 100%);
    border: 1px solid rgba(244, 210, 122, 0.35);
    box-shadow: 0 30px 60px -28px rgba(255, 206, 0, 0.35), var(--shadow);
    isolation: isolate;
}
.pass::before {
    content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0.6;
    background: url("../images/mesh.svg") bottom center / 220% auto no-repeat;
}
.pass::after {
    content: ""; position: absolute; top: -50%; left: -60%; width: 40%; height: 200%; z-index: -1;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.12) 50%, rgba(255, 255, 255, 0) 100%);
    transform: rotate(20deg); animation: sheen 6s ease-in-out infinite;
}
@keyframes sheen { 0%, 60% { left: -60%; } 100% { left: 140%; } }
.pass-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pass-logo { height: 34px; width: auto; }
.pass-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: 0.12em; color: var(--gold); font-size: 0.95rem; text-align: right; }
.pass-id small { display: block; font-family: var(--font); font-size: 0.62rem; letter-spacing: 0.16em; color: var(--muted); font-weight: 800; }
.pass-body { display: flex; align-items: center; gap: 16px; margin-top: 22px; }
.pass-name { font-size: 1.45rem; font-weight: 900; line-height: 1.1; margin: 0; }
.pass-meta { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.pass-foot { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 22px; gap: 12px; flex-wrap: wrap; }
.pass-stat { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); font-weight: 800; }
.pass-stat b { display: block; color: var(--white); font-size: 1rem; letter-spacing: 0.02em; text-transform: none; }

.tier-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 999px;
    font-weight: 900; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em;
    background: rgba(255, 255, 255, 0.08); color: var(--white); border: 1px solid rgba(255, 255, 255, 0.2);
}
.tier-chip .icon { width: 14px; height: 14px; }
.tier-spark { color: #d7dcf5; }
.tier-gale { color: var(--teal-1); border-color: rgba(65, 239, 221, 0.45); background: rgba(65, 239, 221, 0.1); }
.tier-thunder { color: var(--gold); border-color: rgba(244, 210, 122, 0.55); background: rgba(244, 210, 122, 0.12); }
.tier-hurricane { color: var(--navy); background: linear-gradient(180deg, var(--gold), var(--yellow)); border-color: transparent; }
.tier-eye { color: var(--navy); background: linear-gradient(120deg, var(--teal-1), var(--yellow) 60%, var(--gold)); border-color: transparent; box-shadow: 0 0 18px rgba(255, 206, 0, 0.5); }
.vip-chip { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 6px 10px; border-radius: 999px; background: var(--yellow); color: var(--navy); font-weight: 900; font-size: 0.68rem; letter-spacing: 0.16em; vertical-align: middle; }
.vip-chip .icon { width: 13px; height: 13px; }

/* ---------- Progress ---------- */
.progress { height: 10px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--yellow), var(--gold)); transition: width 0.8s cubic-bezier(.2,.8,.2,1); }
.progress.teal > span { background: linear-gradient(90deg, var(--teal-3), var(--teal-1)); }
.progress-meta { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--muted); margin-top: 8px; font-weight: 700; }

/* ---------- Balance & loaders ---------- */
.big-number { font-size: 2.3rem; font-weight: 900; line-height: 1; letter-spacing: -0.02em; word-break: break-all; }
.big-number small { font-size: 0.95rem; color: var(--gold); letter-spacing: 0.06em; margin-left: 6px; }
.skeleton { position: relative; overflow: hidden; background: rgba(255, 255, 255, 0.08); border-radius: 10px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.sk-num { height: 40px; width: 70%; }
.sk-line { height: 12px; width: 45%; margin-top: 12px; }

.storm-loader { display: flex; align-items: center; gap: 14px; }
.storm-loader .bolt { display: inline-block; width: 44px; height: 44px; flex: none; position: relative; }
.storm-loader .bolt svg { width: 100%; height: 100%; display: block; }
.storm-loader .bolt .spin-ring { position: absolute; inset: -4px; border-radius: 50%; border: 2px solid rgba(255, 206, 0, 0.15); border-top-color: var(--yellow); animation: spin 1.1s linear infinite; }
.storm-loader .bolt path { fill: var(--yellow); animation: flash 1.8s ease-in-out infinite; transform-origin: center; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes flash { 0%, 100% { opacity: 0.35; } 10%, 30% { opacity: 1; } 20% { opacity: 0.5; } }
.dots::after { content: ""; animation: dots 1.5s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.stat { background: rgba(6, 15, 43, 0.55); border: 1px solid rgba(255, 255, 255, 0.06); border-radius: var(--radius-sm); padding: 12px 14px; }
.stat .label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 800; }
.stat .value { font-size: 1.15rem; font-weight: 900; margin-top: 2px; }

.wallet-pill { display: inline-flex; align-items: center; gap: 8px; background: rgba(6, 15, 43, 0.6); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 999px; padding: 6px 12px; font-size: 0.82rem; font-weight: 700; }
.wallet-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal-1); box-shadow: 0 0 8px var(--teal-1); }

/* ---------- Badges ---------- */
.badge-strip { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 8px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.badge-strip::-webkit-scrollbar { display: none; }
.badge-strip .medal { scroll-snap-align: start; }
.medal {
    --c1: #59609a; --c2: #2c2f66;
    position: relative; flex: none; width: 64px; height: 64px;
    display: flex; align-items: center; justify-content: center;
    clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
    background: linear-gradient(160deg, var(--c1), var(--c2));
    color: var(--white);
}
.medal::before { content: ""; position: absolute; inset: 4px; clip-path: inherit; background: linear-gradient(160deg, rgba(6, 15, 43, 0.15), rgba(6, 15, 43, 0.55)); }
.medal .icon { position: relative; width: 28px; height: 28px; }
.medal.rare { --c1: #41efdd; --c2: #1a857a; }
.medal.epic { --c1: #9d7cff; --c2: #342769; }
.medal.legendary { --c1: #ffce00; --c2: #b8860b; color: var(--white); }
.medal.common { --c1: #c9cff0; --c2: #59609a; }
.medal.locked { --c1: #343a68; --c2: #1a1f47; color: rgba(255, 255, 255, 0.42); }
.medal.pending { --c1: #6b6f8f; --c2: #2a2f55; color: var(--gold); }
.medal-lg { width: 84px; height: 84px; }
.medal-lg .icon { width: 36px; height: 36px; }
.medal.legendary:not(.locked) { filter: drop-shadow(0 0 10px rgba(255, 206, 0, 0.45)); }

.badge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .badge-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .badge-grid { grid-template-columns: repeat(4, 1fr); } }
.badge-card {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
    background: rgba(11, 17, 49, 0.75); border: 1px solid rgba(255, 255, 255, 0.07); border-radius: var(--radius);
    padding: 18px 12px 14px; cursor: pointer; color: var(--white); font: inherit; width: 100%;
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.badge-card:hover { transform: translateY(-2px); border-color: var(--line); }
.badge-card.earned { border-color: rgba(244, 210, 122, 0.3); background: var(--card); }
.badge-card .name { font-weight: 900; font-size: 0.92rem; line-height: 1.2; }
.badge-card .xp { font-size: 0.72rem; font-weight: 800; color: var(--gold); letter-spacing: 0.08em; }
.state-tag { font-size: 0.62rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.12em; padding: 3px 8px; border-radius: 999px; }
.state-approved { background: rgba(65, 239, 221, 0.14); color: var(--teal-1); }
.state-pending { background: rgba(244, 210, 122, 0.14); color: var(--gold); }
.state-locked { background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.rarity { font-size: 0.62rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.14em; }
.rarity.common { color: #c9cff0; }
.rarity.rare { color: var(--teal-1); }
.rarity.epic { color: #b9a3ff; }
.rarity.legendary { color: var(--yellow); }
.section-title { display: flex; align-items: center; gap: 10px; margin: 28px 0 12px; }
.section-title h2 { margin: 0; font-size: 1.05rem; text-transform: uppercase; letter-spacing: 0.1em; }
.section-title .rule { flex: 1; height: 1px; background: var(--line); }

/* Quest list */
.quest { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.quest:first-child { border-top: 0; padding-top: 0; }
.quest .medal { width: 48px; height: 48px; }
.quest .medal .icon { width: 22px; height: 22px; }
.quest-body { flex: 1; min-width: 0; }
.quest-body b { display: block; font-weight: 900; }
.quest-body span { color: var(--muted); font-size: 0.82rem; }

/* ---------- Dialog ---------- */
dialog.sheet {
    border: 0; padding: 0; color: var(--white); background: transparent;
    width: 100%; max-width: 480px; margin: auto auto 0; max-height: 92vh;
}
dialog.sheet::backdrop { background: rgba(3, 7, 22, 0.72); backdrop-filter: blur(4px); }
.sheet-inner {
    background: linear-gradient(160deg, var(--purple-1) 0%, var(--purple-2) 50%, var(--navy-2) 100%);
    border: 1px solid var(--line); border-radius: 24px 24px 0 0; padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
    text-align: center; animation: rise 0.25s ease;
}
.sheet-inner .medal { margin: 0 auto 14px; }
.sheet-close { position: absolute; top: 14px; right: 14px; background: rgba(255, 255, 255, 0.08); border: 0; color: var(--white); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1.2rem; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 640px) {
    dialog.sheet { margin: auto; }
    .sheet-inner { border-radius: 24px; }
}
.sheet-actions { display: grid; gap: 10px; margin-top: 18px; text-align: left; }

/* Celebration */
.celebrate .sheet-inner { position: relative; overflow: hidden; }
.celebrate .burst { position: absolute; inset: 0; pointer-events: none; }
.celebrate .burst i { position: absolute; top: 40%; left: 50%; width: 4px; height: 14px; border-radius: 2px; background: var(--yellow); opacity: 0; animation: burst 1.1s ease-out forwards; }
@keyframes burst { 0% { opacity: 1; transform: rotate(var(--r)) translateY(0); } 100% { opacity: 0; transform: rotate(var(--r)) translateY(-160px); } }

/* ---------- Lists / leaderboard ---------- */
.rank-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.rank-row:first-child { border-top: 0; }
.rank-row.me { background: rgba(255, 206, 0, 0.07); border-radius: var(--radius-sm); padding: 12px; border-top-color: transparent; }
.rank-no { width: 32px; text-align: center; font-weight: 900; color: var(--muted); flex: none; }
.rank-no.top { color: var(--navy); background: var(--yellow); border-radius: 50%; height: 32px; line-height: 32px; }
.rank-name { flex: 1; min-width: 0; }
.rank-name b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-xp { text-align: right; font-weight: 900; }
.rank-xp small { display: block; color: var(--muted); font-size: 0.7rem; font-weight: 700; }

.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 10px; align-items: end; margin-bottom: 16px; }
.podium > div { text-align: center; background: rgba(11, 17, 49, 0.75); border: 1px solid rgba(255, 255, 255, 0.07); border-radius: var(--radius); padding: 16px 8px; }
.podium .first { border-color: rgba(255, 206, 0, 0.5); padding-top: 24px; background: var(--card); }
.podium .avatar { margin: 0 auto 8px; }
.podium b { display: block; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium .place { font-weight: 900; color: var(--gold); font-size: 0.75rem; letter-spacing: 0.1em; }

/* ---------- Misc ---------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 0.92rem; }
.kv dt { color: var(--muted); font-weight: 700; }
.kv dd { margin: 0; font-weight: 800; text-align: right; overflow: hidden; text-overflow: ellipsis; }
.copy-field { display: flex; gap: 8px; }
.copy-field .input { font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; }
.divider { height: 1px; background: var(--line); margin: 20px 0; border: 0; }
.cta-banner {
    display: flex; gap: 14px; align-items: center;
    background: linear-gradient(120deg, rgba(255, 206, 0, 0.16), rgba(65, 239, 221, 0.08));
    border: 1px solid rgba(255, 206, 0, 0.35); border-radius: var(--radius); padding: 16px;
}
.cta-banner .icon { width: 32px; height: 32px; color: var(--yellow); flex: none; }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; flex: none; display: grid; place-items: center; background: conic-gradient(var(--yellow) calc(var(--p) * 1%), rgba(255, 255, 255, 0.08) 0); }
.ring span { width: 52px; height: 52px; border-radius: 50%; background: var(--navy-2); display: grid; place-items: center; font-weight: 900; font-size: 0.85rem; }
.empty { text-align: center; padding: 20px; color: var(--muted); }
.footer { text-align: center; color: var(--muted); font-size: 0.78rem; padding: 32px 16px 8px; }
.footer a { color: var(--muted); }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Admin ---------- */
.admin-tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 16px; scrollbar-width: none; }
.admin-tabs a { flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.15); color: var(--white); font-weight: 800; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.admin-tabs a.active { background: var(--yellow); color: var(--navy); border-color: var(--yellow); }
.admin-tabs a:hover { text-decoration: none; }
.admin-stats { grid-template-columns: repeat(2, 1fr); margin-top: 0; }
@media (min-width: 640px) { .admin-stats { grid-template-columns: repeat(4, 1fr); } }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 16px; }
.rank-xp .state-tag { display: inline-block; }
@media (min-width: 900px) { .admin-mobile-link { display: none; } }

/* ---------- Transactions ---------- */
.tx { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid rgba(255, 255, 255, 0.06); color: var(--white); }
.tx:first-child { border-top: 0; padding-top: 0; }
.tx:hover { text-decoration: none; }
.tx-dot { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; }
.tx-in .tx-dot { background: rgba(65, 239, 221, 0.14); color: var(--teal-1); }
.tx-out .tx-dot { background: rgba(244, 210, 122, 0.14); color: var(--gold); }
.tx-self .tx-dot { background: rgba(255, 255, 255, 0.08); color: var(--muted); }
.tx-dot .icon { width: 18px; height: 18px; }
.tx-in .tx-dot .icon { transform: rotate(90deg); }
.tx-out .tx-dot .icon { transform: rotate(-90deg); }
.tx-body { flex: 1; min-width: 0; }
.tx-body b { display: block; font-weight: 800; font-size: 0.92rem; }
.tx-body span { color: var(--muted); font-size: 0.78rem; }
.tx-amount { text-align: right; font-weight: 900; white-space: nowrap; }
.tx-in .tx-amount { color: var(--teal-1); }
.tx-amount small { display: block; color: var(--muted); font-weight: 700; font-size: 0.7rem; }
.tx-skeleton .tx-dot { border-radius: 50%; }
