/* ============================================================
   God's Church — Main Stylesheet (v6 / Crusader)
   ============================================================
   The foundational design system. Tokens, base, components,
   animations. Premium-game-meets-cathedral aesthetic.

   Loaded by every page. Each subsequent stylesheet
   (landing.css, leaderboard.css, app.css) extends this.

   Touch targets: 44px minimum everywhere.
   Motion: punctuated, not constant. Respects prefers-reduced-motion.

   v6 CHANGES:
   - Cross icon rebuilt as a proper SVG element with a gold
     gradient fill. The previous build relied on the Unicode glyph
     ✟ which Android/iOS render at very different weights — that's
     why the cross looked "small and weird" on phones. Now it's a
     pixel-perfect SVG that scales cleanly at any size.
   - Cross size bumped on mobile (was 1.25em, now 1.5em) so it
     reads as a proper logo mark rather than a tiny ornament.
   - "Sign up" button on mobile uses tighter padding (var(--s-2)
     var(--s-3)) so it doesn't dominate the nav. Content links get
     their breathing room back on tablets too.
   - Restored Leaderboard / About links on tablets (480–640px);
     they only hide on true phones now (≤480px).

   v5 CHANGES (preserved):
   - Mobile nav simplified at narrow widths
   ============================================================ */

/* ============================================================
   1. CSS RESET & BASE
   ============================================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
    /* Prevent rubber-banding from showing the page background */
    overscroll-behavior-y: none;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    font-feature-settings: "kern" 1, "liga" 1, "calt" 1, "ss01" 1;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

img, svg, video, canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

button, input, textarea, select {
    font: inherit;
    color: inherit;
}

button {
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation; /* Eliminates 300ms tap delay */
}

a {
    color: var(--gold);
    text-decoration: none;
    transition: color var(--t-fast);
    -webkit-tap-highlight-color: transparent;
}

a:hover {
    color: var(--gold-bright);
}

::selection {
    background: var(--gold);
    color: var(--ink);
}

/* ============================================================
   2. DESIGN TOKENS
   ============================================================ */

:root {
    /* ----- Color foundation ----- */

    /* The deep night sky (5 elevation levels) */
    --ink:           #050816;  /* deepest — body bg behind elevated content */
    --bg:           #0a0f24;
    --bg-elevated: #131938;
    --bg-card:     #1a2148;
    --bg-card-hover: #1f274f;
    --bg-overlay:  rgba(5, 8, 22, 0.88);

    /* Gold — three states + glow */
    --gold:         #d4a946;   /* canonical */
    --gold-bright:  #f0c869;
    --gold-soft:    #a8862e;
    --gold-deep:    #6b521c;
    --gold-glow:    rgba(212, 169, 70, 0.35);
    --gold-glow-strong: rgba(240, 200, 105, 0.55);

    /* Text */
    --cream:        #f6f1e3;
    --text:         #d8d3c2;
    --text-muted:   #918d80;
    --text-faded:   #5c5a52;

    /* Accents (used sparingly — for tier colors, semantic states) */
    --accent-blue:  #6b88c4;
    --accent-purple:#9580d4;
    --accent-rose:  #c4768a;

    --success:      #7dc59a;
    --success-glow: rgba(125, 197, 154, 0.4);
    --warning:      #e0b962;
    --danger:       #e08585;
    --danger-glow:  rgba(224, 133, 133, 0.4);

    /* Borders */
    --border:       rgba(212, 169, 70, 0.14);
    --border-strong:rgba(212, 169, 70, 0.32);
    --border-vivid: rgba(212, 169, 70, 0.6);
    --divider:      rgba(232, 228, 213, 0.06);

    /* Rank tier colors */
    --tier-seeker:    #888a96;
    --tier-disciple:  #9fb4d4;
    --tier-believer:  #7dc59a;
    --tier-apostle:   #d4a946;
    --tier-saint:     #c4768a;
    --tier-prophet:   #c19df8;

    /* ----- Typography ----- */
    --font-sans:   "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --font-serif:  "Crimson Pro", "Iowan Old Style", "Georgia", serif;
    --font-mono:   "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

    --fs-xs:    0.75rem;
    --fs-sm:    0.875rem;
    --fs-base:  1rem;
    --fs-md:    1.125rem;
    --fs-lg:    1.25rem;
    --fs-xl:    1.5rem;
    --fs-2xl:   2rem;
    --fs-3xl:   2.5rem;
    --fs-4xl:   3.25rem;
    --fs-5xl:   4.5rem;
    --fs-6xl:   6rem;

    --fw-light:    300;
    --fw-regular:  400;
    --fw-medium:   500;
    --fw-semibold: 600;
    --fw-bold:     700;
    --fw-black:    900;

    /* ----- Spacing ----- */
    --s-1:  0.25rem;
    --s-2:  0.5rem;
    --s-3:  0.75rem;
    --s-4:  1rem;
    --s-5:  1.25rem;
    --s-6:  1.5rem;
    --s-7:  1.75rem;
    --s-8:  2rem;
    --s-10: 2.5rem;
    --s-12: 3rem;
    --s-16: 4rem;
    --s-20: 5rem;
    --s-24: 6rem;
    --s-32: 8rem;

    /* ----- Layout ----- */
    --container-narrow: 640px;
    --container-base:   960px;
    --container-wide:   1200px;

    /* ----- Radii ----- */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 22px;
    --radius-2xl: 32px;
    --radius-full: 9999px;

    /* ----- Shadows (layered for depth) ----- */
    --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-lg:  0 14px 40px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-xl:  0 30px 80px rgba(0, 0, 0, 0.6), 0 8px 24px rgba(0, 0, 0, 0.4);

    /* Special: inset glow for "carved" elements */
    --shadow-inset-gold: inset 0 1px 0 rgba(240, 200, 105, 0.25), inset 0 -2px 6px rgba(0, 0, 0, 0.3);
    --shadow-inset-dark: inset 0 2px 4px rgba(0, 0, 0, 0.5);

    /* Glow halos */
    --halo-gold:    0 0 60px var(--gold-glow);
    --halo-gold-lg: 0 0 100px var(--gold-glow-strong);
    --halo-rim:     0 0 0 1px var(--border-vivid), 0 0 30px var(--gold-glow);

    /* ----- Transitions ----- */
    --t-instant: 0.08s ease;
    --t-fast:    0.15s ease;
    --t-base:    0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
    --t-slow:    0.45s cubic-bezier(0.4, 0.0, 0.2, 1);
    --t-slower:  0.7s cubic-bezier(0.4, 0.0, 0.2, 1);
    --t-bounce:  0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
    --t-overshoot: 0.5s cubic-bezier(0.16, 1.36, 0.4, 1);

    /* ----- Safe areas ----- */
    --safe-top:    env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left:   env(safe-area-inset-left, 0px);
    --safe-right:  env(safe-area-inset-right, 0px);

    /* ----- Z-index scale ----- */
    --z-base:    1;
    --z-raised:  10;
    --z-sticky:  50;
    --z-nav:     100;
    --z-dropdown: 110;
    --z-modal:   200;
    --z-toast:   1000;
    --z-tooltip: 1100;
}

/* ============================================================
   3. TYPOGRAPHY
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    font-weight: var(--fw-bold);
    line-height: 1.15;
    color: var(--cream);
    letter-spacing: -0.02em;
    text-wrap: balance;
}

h1 {
    font-size: clamp(var(--fs-2xl), 6vw, var(--fs-4xl));
    font-weight: var(--fw-black);
    letter-spacing: -0.035em;
}
h2 { font-size: clamp(var(--fs-xl), 4vw, var(--fs-3xl)); letter-spacing: -0.025em; }
h3 { font-size: clamp(var(--fs-lg), 3vw, var(--fs-2xl)); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }
h6 { font-size: var(--fs-md); }

p {
    line-height: 1.7;
    color: var(--text);
    text-wrap: pretty;
}

/* The "display" treatment for hero/marketing moments */
.text-display {
    font-family: var(--font-sans);
    font-weight: var(--fw-black);
    letter-spacing: -0.04em;
    font-size: clamp(var(--fs-3xl), 9vw, var(--fs-6xl));
    line-height: 0.98;
    text-wrap: balance;
}

/* "Sacred text" — for scripture, verses, hushed moments */
.text-sacred {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: var(--fw-regular);
    color: var(--cream);
    letter-spacing: 0.01em;
    line-height: 1.5;
}

/* "Carved" — for important labels (tier names, milestone numbers) */
.text-carved {
    font-family: var(--font-sans);
    font-weight: var(--fw-black);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.4),
        0 -1px 0 rgba(240, 200, 105, 0.1);
}

.text-serif       { font-family: var(--font-serif); font-style: italic; }
.text-mono        { font-family: var(--font-mono); }

.text-gold        { color: var(--gold); }
.text-gold-bright { color: var(--gold-bright); }
.text-cream       { color: var(--cream); }
.text-muted       { color: var(--text-muted); }
.text-faded       { color: var(--text-faded); }
.text-success     { color: var(--success); }
.text-warning     { color: var(--warning); }
.text-danger      { color: var(--danger); }
.text-center      { text-align: center; }
.text-left        { text-align: left; }
.text-right       { text-align: right; }

.text-xs    { font-size: var(--fs-xs); }
.text-sm    { font-size: var(--fs-sm); }
.text-md    { font-size: var(--fs-md); }
.text-lg    { font-size: var(--fs-lg); }
.text-xl    { font-size: var(--fs-xl); }

.fw-light    { font-weight: var(--fw-light); }
.fw-regular  { font-weight: var(--fw-regular); }
.fw-medium   { font-weight: var(--fw-medium); }
.fw-semibold { font-weight: var(--fw-semibold); }
.fw-bold     { font-weight: var(--fw-bold); }
.fw-black    { font-weight: var(--fw-black); }

.uppercase     { text-transform: uppercase; letter-spacing: 0.05em; }
.tracking-wide { letter-spacing: 0.08em; }

/* Gold-leaf text effect — for headlines that need to glimmer */
.text-leaf {
    background: linear-gradient(
        180deg,
        #f0c869 0%,
        #d4a946 35%,
        #a8862e 65%,
        #d4a946 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.2),
        0 0 40px rgba(212, 169, 70, 0.2);
    filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.3));
}

/* Tabular numbers — for scores, ratings, timers */
.num {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

/* ============================================================
   4. LAYOUT PRIMITIVES
   ============================================================ */

.container {
    width: 100%;
    max-width: var(--container-base);
    margin: 0 auto;
    padding: 0 clamp(var(--s-4), 4vw, var(--s-6));
}

.container-narrow { max-width: var(--container-narrow); }
.container-base   { max-width: var(--container-base); }
.container-wide   { max-width: var(--container-wide); }

.stack > * + * { margin-top: var(--s-4); }
.stack-sm > * + * { margin-top: var(--s-2); }
.stack-lg > * + * { margin-top: var(--s-6); }
.stack-xl > * + * { margin-top: var(--s-10); }

.row {
    display: flex;
    align-items: center;
    gap: var(--s-4);
}
.row-tight   { gap: var(--s-2); }
.row-loose   { gap: var(--s-6); }
.row-between { justify-content: space-between; }
.row-center  { justify-content: center; }
.row-wrap    { flex-wrap: wrap; }

.col {
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
}

.grid {
    display: grid;
    gap: var(--s-4);
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

@media (max-width: 640px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.section    { padding: clamp(var(--s-12), 8vw, var(--s-20)) 0; }
.section-sm { padding: clamp(var(--s-8),  6vw, var(--s-12)) 0; }
.section-lg { padding: clamp(var(--s-16), 10vw, var(--s-24)) 0; }

.center { display: flex; align-items: center; justify-content: center; }
.center-col { display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* ============================================================
   5. ATMOSPHERIC BACKGROUNDS
   ============================================================ */

.bg-stars {
    position: relative;
    background: linear-gradient(180deg, var(--bg) 0%, var(--ink) 100%);
}

/* Base starfield — fixed to viewport so it doesn't scroll with content */
.bg-stars::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.5), transparent 60%),
        radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,0.4), transparent 60%),
        radial-gradient(1.5px 1.5px at 50% 50%, rgba(212,169,70,0.6), transparent 60%),
        radial-gradient(1px 1px at 80% 10%, rgba(255,255,255,0.5), transparent 60%),
        radial-gradient(1px 1px at 90% 60%, rgba(255,255,255,0.4), transparent 60%),
        radial-gradient(2px 2px at 33% 88%, rgba(212,169,70,0.5), transparent 60%),
        radial-gradient(1px 1px at 15% 75%, rgba(255,255,255,0.4), transparent 60%),
        radial-gradient(1.5px 1.5px at 70% 20%, rgba(212,169,70,0.45), transparent 60%),
        radial-gradient(ellipse at 50% 0%, rgba(212,169,70,0.10) 0%, transparent 50%);
    background-size:
        200px 200px, 250px 250px, 300px 300px, 180px 180px,
        220px 220px, 280px 280px, 200px 200px, 260px 260px,
        100% 100%;
    background-repeat: repeat, repeat, repeat, repeat, repeat, repeat, repeat, repeat, no-repeat;
}

/* Drifting parallax layer — slowly moves across the viewport */
.bg-stars::after {
    content: '';
    position: fixed;
    inset: -10%;
    pointer-events: none;
    z-index: 0;
    background-image:
        radial-gradient(1px 1px at 12% 15%, rgba(255,255,255,0.35), transparent 60%),
        radial-gradient(1px 1px at 45% 85%, rgba(255,255,255,0.3), transparent 60%),
        radial-gradient(1px 1px at 88% 40%, rgba(212,169,70,0.4), transparent 60%),
        radial-gradient(1.5px 1.5px at 25% 65%, rgba(255,255,255,0.3), transparent 60%);
    background-size: 320px 320px, 380px 380px, 290px 290px, 410px 410px;
    background-repeat: repeat;
    animation: drift 240s linear infinite;
    opacity: 0.85;
    will-change: transform;
}

@keyframes drift {
    0%   { transform: translate3d(0, 0, 0) rotate(0deg); }
    100% { transform: translate3d(-12%, -8%, 0) rotate(2deg); }
}

/* Ensure page content sits above the starfield */
body > * {
    position: relative;
    z-index: 1;
}

/* Light shafts from above — used on hero sections */
.bg-shafts {
    position: relative;
    overflow: hidden;
}
.bg-shafts::before {
    content: '';
    position: absolute;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 140%;
    height: 70%;
    background:
        conic-gradient(
            from 80deg at 50% 0%,
            transparent 0deg,
            rgba(212, 169, 70, 0.08) 12deg,
            transparent 24deg,
            rgba(212, 169, 70, 0.05) 36deg,
            transparent 48deg,
            rgba(212, 169, 70, 0.07) 60deg,
            transparent 72deg
        );
    pointer-events: none;
    animation: shaft-sway 14s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes shaft-sway {
    0%   { transform: translateX(-50%) rotate(-2deg); opacity: 0.7; }
    100% { transform: translateX(-50%) rotate(2deg); opacity: 1; }
}

/* Vignette — darkens edges, focuses center */
.bg-vignette::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center,
        transparent 50%,
        rgba(0, 0, 0, 0.35) 100%
    );
    z-index: 1;
}

/* Halo glow centered on hero */
.bg-halo {
    position: relative;
}
.bg-halo::before {
    content: '';
    position: absolute;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: min(900px, 100vw);
    height: 600px;
    background: radial-gradient(ellipse at center, var(--gold-glow-strong), transparent 65%);
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
    animation: halo-pulse 8s ease-in-out infinite;
}

@keyframes halo-pulse {
    0%, 100% { opacity: 0.5; transform: translateX(-50%) scale(1); }
    50%      { opacity: 0.7; transform: translateX(-50%) scale(1.05); }
}

.bg-elevated { background: var(--bg-elevated); }
.bg-card     { background: var(--bg-card); }

/* ============================================================
   6. BUTTONS
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    padding: var(--s-3) var(--s-6);
    min-height: 44px;            /* touch target */
    font-family: inherit;
    font-size: var(--fs-base);
    font-weight: var(--fw-semibold);
    line-height: 1.2;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform var(--t-instant), background var(--t-fast),
                box-shadow var(--t-base), color var(--t-fast), border-color var(--t-fast);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    will-change: transform;
}

.btn:active {
    transform: scale(0.96);
    transition-duration: var(--t-instant), 0s, 0s, 0s, 0s;
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary — the "swing your sword" button */
.btn-primary {
    background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 50%, var(--gold-soft) 100%);
    color: var(--ink);
    font-weight: var(--fw-bold);
    border-color: var(--gold);
    box-shadow:
        0 1px 0 rgba(240, 200, 105, 0.6) inset,
        0 -2px 4px rgba(0, 0, 0, 0.2) inset,
        0 4px 16px rgba(212, 169, 70, 0.35),
        0 1px 3px rgba(0, 0, 0, 0.3);
    text-shadow: 0 1px 0 rgba(240, 200, 105, 0.4);
}

@media (hover: hover) {
    .btn-primary:hover {
        background: linear-gradient(180deg, #f5d180 0%, var(--gold-bright) 50%, var(--gold) 100%);
        box-shadow:
            0 1px 0 rgba(240, 200, 105, 0.8) inset,
            0 -2px 4px rgba(0, 0, 0, 0.2) inset,
            0 6px 24px rgba(212, 169, 70, 0.5),
            0 2px 6px rgba(0, 0, 0, 0.3);
        transform: translateY(-1px);
        color: var(--ink);
    }
}

/* Shimmer animation on hover */
.btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.35) 50%,
        transparent 100%
    );
    transform: skewX(-25deg);
    transition: left 0.6s ease;
    pointer-events: none;
}

@media (hover: hover) {
    .btn-primary:hover::after { left: 150%; }
}

/* Secondary — for important-but-not-primary actions */
.btn-secondary {
    background: var(--bg-card);
    color: var(--cream);
    border-color: var(--border-strong);
    box-shadow: 0 1px 0 rgba(212, 169, 70, 0.15) inset, var(--shadow-sm);
}

@media (hover: hover) {
    .btn-secondary:hover {
        background: var(--bg-card-hover);
        border-color: var(--gold);
        color: var(--cream);
        box-shadow: 0 1px 0 rgba(212, 169, 70, 0.3) inset, var(--shadow-md);
        transform: translateY(-1px);
    }
}

/* Ghost — subtle, for tertiary actions */
.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

@media (hover: hover) {
    .btn-ghost:hover {
        background: var(--bg-card);
        border-color: var(--border-strong);
        color: var(--cream);
    }
}

/* Danger — destructive */
.btn-danger {
    background: var(--danger);
    color: var(--cream);
    border-color: var(--danger);
}

@media (hover: hover) {
    .btn-danger:hover {
        background: #d47878;
        color: var(--cream);
    }
}

/* Sizes */
.btn-sm {
    padding: var(--s-2) var(--s-4);
    min-height: 38px;
    font-size: var(--fs-sm);
}

.btn-lg {
    padding: var(--s-4) var(--s-8);
    min-height: 52px;
    font-size: var(--fs-lg);
    font-weight: var(--fw-bold);
}

.btn-xl {
    padding: var(--s-5) var(--s-10);
    min-height: 60px;
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    border-radius: var(--radius-lg);
    letter-spacing: 0.01em;
}

.btn-block {
    width: 100%;
    display: flex;
}

/* Icon button — square, for actions without labels */
.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    min-height: auto;
    flex-shrink: 0;
}

/* ============================================================
   7. CARDS
   ============================================================ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--s-6);
    transition:
        transform var(--t-base),
        border-color var(--t-base),
        background var(--t-base),
        box-shadow var(--t-base);
    position: relative;
    overflow: hidden;
}

/* Inset "etched" top-light effect on every card */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(240, 200, 105, 0.2),
        transparent
    );
    pointer-events: none;
}

.card-elevated {
    box-shadow: var(--shadow-md);
}

.card-hover {
    cursor: pointer;
}

@media (hover: hover) {
    .card-hover:hover {
        background: var(--bg-card-hover);
        border-color: var(--border-strong);
        transform: translateY(-3px);
        box-shadow: var(--shadow-lg);
    }
}

.card-hover:active {
    transform: translateY(0);
    transition-duration: var(--t-instant);
}

.card-glow {
    box-shadow: var(--shadow-md), 0 0 50px var(--gold-glow);
    border-color: var(--border-strong);
}

.card-padded { padding: clamp(var(--s-6), 5vw, var(--s-10)); }
.card-snug   { padding: var(--s-4); }

/* ============================================================
   8. FORMS
   ============================================================ */

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

.form-group + .form-group { margin-top: var(--s-4); }

.form-label {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: var(--s-3) var(--s-4);
    min-height: 48px;
    background: var(--bg-elevated);
    color: var(--cream);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: var(--fs-base);
    font-family: inherit;
    transition: all var(--t-fast);
    appearance: none;
    -webkit-appearance: none;
    box-shadow: var(--shadow-inset-dark);
}

/* Custom dropdown chevron */
.form-select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5L6 6.5L11 1.5' stroke='%23d4a946' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right var(--s-4) center;
    padding-right: var(--s-10);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--gold);
    background: var(--bg-card);
    box-shadow: var(--shadow-inset-dark), 0 0 0 3px var(--gold-glow);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-faded);
}

.form-input.error,
.form-textarea.error,
.form-select.error {
    border-color: var(--danger);
    box-shadow: var(--shadow-inset-dark), 0 0 0 3px var(--danger-glow);
}

.form-error {
    font-size: var(--fs-sm);
    color: var(--danger);
    margin-top: var(--s-1);
    display: flex;
    align-items: center;
    gap: var(--s-1);
}

.form-help {
    font-size: var(--fs-sm);
    color: var(--text-faded);
    margin-top: var(--s-1);
}

/* ============================================================
   9. BADGES, PILLS, TIER MEDALLIONS
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--s-1);
    padding: 3px var(--s-2);
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: var(--bg-elevated);
    color: var(--text);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    line-height: 1.4;
}

.badge-gold {
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-soft) 100%);
    color: var(--ink);
    border-color: var(--gold);
}

.badge-success {
    background: rgba(125, 197, 154, 0.12);
    color: var(--success);
    border-color: var(--success);
}

.badge-warning {
    background: rgba(224, 185, 98, 0.12);
    color: var(--warning);
    border-color: var(--warning);
}

.badge-danger {
    background: rgba(224, 133, 133, 0.12);
    color: var(--danger);
    border-color: var(--danger);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    padding: var(--s-1) var(--s-3);
    min-height: 28px;
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
}

/* TIER MEDALLIONS — the rank badges. */
.tier {
    display: inline-flex;
    align-items: center;
    gap: var(--s-1);
    padding: 4px var(--s-3);
    min-height: 24px;
    font-size: var(--fs-xs);
    font-weight: var(--fw-black);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    border-radius: var(--radius-sm);
    border: 1px solid currentColor;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.2)),
        rgba(0, 0, 0, 0.35);
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -1px 0 rgba(0, 0, 0, 0.4),
        0 1px 2px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.tier::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    animation: tier-shine 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes tier-shine {
    0%, 100% { left: -100%; }
    50%      { left: 200%; }
}

.tier-seeker   { color: var(--tier-seeker); }
.tier-disciple { color: var(--tier-disciple); }
.tier-believer { color: var(--tier-believer); }
.tier-apostle  { color: var(--tier-apostle); }
.tier-saint    { color: var(--tier-saint); }
.tier-prophet  {
    color: var(--tier-prophet);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(0, 0, 0, 0.4),
        0 0 12px rgba(193, 157, 248, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ============================================================
   10. NAVIGATION
   ============================================================
   v6 strategy:

   The cross icon now ships an inline SVG (background-image data URI)
   that renders identically on every browser and OS. No more reliance
   on the Unicode ✟ glyph that Android renders as a tiny block, iOS
   renders as a serif glyph, and Windows renders as something else
   entirely.

   The icon is sized via `width/height` directly so it's predictable
   across breakpoints. The gold gradient and glow come from CSS, not
   the icon — easier to maintain.

   Mobile nav breakpoints:
     - >640px: all nav items show (brand + links + auth)
     - 481–640px: tablet width, secondary links may compress, Sign up
                  button uses tighter padding
     - ≤480px: phone width, Leaderboard / About hide entirely (still
                  reachable via the footer on every page), nav reduces
                  to [brand] [Sign in] [Sign up]
   ============================================================ */

.nav {
    position: sticky;
    top: 0;
    z-index: var(--z-nav);
    background: linear-gradient(180deg, rgba(10, 15, 36, 0.95), rgba(10, 15, 36, 0.75));
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    border-bottom: 1px solid var(--divider);
    padding-top: var(--safe-top);
    transition: border-color var(--t-base);
}

.nav.is-scrolled {
    border-bottom-color: var(--border);
    box-shadow: var(--shadow-md);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--s-3) clamp(var(--s-4), 4vw, var(--s-6));
    max-width: var(--container-wide);
    margin: 0 auto;
    gap: var(--s-3);
    min-height: 56px;
}

.nav-brand {
    font-family: var(--font-sans);
    font-weight: var(--fw-black);
    font-size: var(--fs-lg);
    color: var(--cream);
    text-decoration: none;
    letter-spacing: -0.02em;
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    transition: color var(--t-fast);
    flex-shrink: 0;
    min-width: 0;
}

@media (hover: hover) {
    .nav-brand:hover {
        color: var(--gold);
    }
    .nav-brand:hover .nav-cross {
        transform: rotate(-8deg);
    }
}

/* ============================================================
   CROSS ICON
   ============================================================
   Renders as an inline SVG mask with a gold gradient fill. This is
   guaranteed to look identical across iOS Safari, Android Chrome,
   Firefox, Edge, and desktop browsers. The actual ✟ character in
   the HTML acts as alt text / accessible label — we mask it.

   The cross shape: a vertical bar with a horizontal crossbar near
   the top, drawn with rounded corners. The SVG has a built-in
   highlight gradient (light gold top, mid gold middle, deep gold
   bottom) so it picks up the cathedral lighting without needing
   any extra CSS layers.
   ============================================================ */
.nav-cross {
    display: inline-block;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    /* Hide the fallback ✟ character; SVG takes over */
    color: transparent;
    text-indent: -9999px;
    overflow: hidden;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'><defs><linearGradient id='g' x1='0' y1='0' x2='0' y2='24' gradientUnits='userSpaceOnUse'><stop offset='0' stop-color='%23f5d180'/><stop offset='0.35' stop-color='%23f0c869'/><stop offset='0.7' stop-color='%23d4a946'/><stop offset='1' stop-color='%23a8862e'/></linearGradient></defs><path d='M10 2h4v5h5v4h-5v11h-4V11H5V7h5V2z' fill='url(%23g)' stroke='%236b521c' stroke-width='0.5' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    filter:
        drop-shadow(0 0 6px var(--gold-glow))
        drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
    transition: transform var(--t-base), filter var(--t-base);
    /* Vertical alignment with the wordmark */
    vertical-align: -3px;
}

@media (hover: hover) {
    .nav-brand:hover .nav-cross {
        filter:
            drop-shadow(0 0 10px var(--gold-glow-strong))
            drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
    }
}

/* Older builds of the HTML included a nested <svg> inside the cross
   span. v6 doesn't need it — the icon is the background image. Hide
   any leftover inner SVG so two icons don't render. */
.nav-cross svg {
    display: none;
}

.nav-brand-text {
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--s-1);
    list-style: none;
    flex-shrink: 0;
    min-width: 0;
}

.nav-link {
    padding: var(--s-2) var(--s-3);
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
    font-weight: var(--fw-medium);
    font-size: var(--fs-sm);
    border-radius: var(--radius-md);
    transition: color var(--t-fast), background var(--t-fast);
    text-decoration: none;
    touch-action: manipulation;
    white-space: nowrap;
}

@media (hover: hover) {
    .nav-link:hover {
        color: var(--cream);
        background: var(--bg-card);
    }
}

.nav-link.active {
    color: var(--gold);
    background: rgba(212, 169, 70, 0.08);
}

/* Auth control groups — never compress, never wrap */
#nav-auth-buttons,
#nav-user-menu,
.nav-auth-block,
.nav-user-block,
.nav-anon-block {
    flex-shrink: 0;
    white-space: nowrap;
}

/* ============================================================
   TABLET NAV — 481–640px
   ============================================================
   Tablet has room for everything, just at tighter scale. Shrink
   the Sign up button's padding so the row breathes.
   ============================================================ */
@media (max-width: 640px) and (min-width: 481px) {
    .nav-inner {
        padding: var(--s-3) var(--s-4);
        gap: var(--s-2);
    }

    .nav-link {
        padding: var(--s-2) var(--s-2);
    }

    /* Sign up button gets tighter on tablet too */
    .nav-links .btn-sm {
        padding: var(--s-2) var(--s-3);
        min-height: 36px;
        font-size: var(--fs-xs);
    }
}

/* ============================================================
   MOBILE NAV — ≤480px
   ============================================================
   - Hide secondary content links (still in the footer on every page)
   - Tight Sign up padding so brand has room
   - Cross stays at full size — it's the brand mark, must read
   ============================================================ */
@media (max-width: 480px) {
    .nav-inner {
        padding: var(--s-3) var(--s-4);
        gap: var(--s-2);
    }

    /* Hide content links — they're footer-accessible on every page */
    .nav-links .nav-link:not([data-action]) {
        display: none;
    }

    /* Sign in text link uses tight padding */
    .nav-links .nav-link[data-action="show-login"] {
        padding: var(--s-2) var(--s-2);
        font-size: var(--fs-sm);
    }

    /* Sign up button compact form: smaller padding, slightly shorter,
       smaller text. Still gold and prominent, just not dominating. */
    .nav-links .btn-sm {
        padding: var(--s-2) var(--s-3);
        min-height: 36px;
        font-size: var(--fs-xs);
        letter-spacing: 0.01em;
    }

    /* Brand text shrinks slightly to share space with the auth row */
    .nav-brand {
        font-size: var(--fs-base);
    }

    /* Cross stays prominent — it's the logo */
    .nav-cross {
        width: 20px;
        height: 20px;
        vertical-align: -3px;
    }
}

/* ============================================================
   VERY NARROW PHONES — ≤360px (old iPhone SE etc.)
   ============================================================
   Drop the gap further; let the wordmark do most of the work.
   ============================================================ */
@media (max-width: 360px) {
    .nav-inner {
        padding: var(--s-3) var(--s-3);
        gap: var(--s-1);
    }

    .nav-links .btn-sm {
        padding: var(--s-2) var(--s-3);
    }

    .nav-brand {
        font-size: 0.95rem;
        gap: 6px;
    }

    .nav-cross {
        width: 18px;
        height: 18px;
    }
}

/* ============================================================
   11. UTILITIES
   ============================================================ */

.hidden       { display: none !important; }
.invisible    { visibility: hidden; }

.relative     { position: relative; }
.absolute     { position: absolute; }
.fixed        { position: fixed; }
.sticky       { position: sticky; }

.w-full       { width: 100%; }
.h-full       { height: 100%; }
.min-h-screen { min-height: 100vh; min-height: 100dvh; }

.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }
.overflow-y-auto { overflow-y: auto; }

.no-select { user-select: none; -webkit-user-select: none; }
.cursor-pointer { cursor: pointer; }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--divider) 20%, var(--divider) 80%, transparent);
    margin: var(--s-6) 0;
    border: none;
}

.spacer-sm { height: var(--s-4); }
.spacer    { height: var(--s-8); }
.spacer-lg { height: var(--s-16); }

/* Scripture verse block — the "sacred quote" moment */
.verse {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: var(--fs-lg);
    color: var(--cream);
    border-left: 2px solid var(--gold);
    padding: var(--s-2) var(--s-6);
    margin: var(--s-6) 0;
    position: relative;
}

.verse::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: -8px;
    font-family: var(--font-serif);
    font-size: 4rem;
    color: var(--gold);
    opacity: 0.3;
    line-height: 1;
    pointer-events: none;
    font-style: normal;
}

.verse-ref {
    display: block;
    font-style: normal;
    font-family: var(--font-sans);
    font-size: var(--fs-xs);
    color: var(--gold);
    margin-top: var(--s-3);
    font-weight: var(--fw-bold);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* ============================================================
   12. ANIMATIONS
   ============================================================ */

@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in-down {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes scale-in {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes scale-in-bounce {
    0%   { opacity: 0; transform: scale(0.6); }
    50%  { opacity: 1; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px var(--gold-glow); }
    50%      { box-shadow: 0 0 40px var(--gold-glow), 0 0 60px var(--gold-glow); }
}

@keyframes shimmer {
    0%   { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

@keyframes float-slow {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes punch {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

@keyframes heartbeat {
    0%, 28%, 70%, 100% { transform: scale(1); }
    14%, 42%           { transform: scale(1.06); }
}

/* Utility classes for these */
.anim-fade-in        { animation: fade-in var(--t-slow) ease both; }
.anim-fade-in-up     { animation: fade-in-up var(--t-slow) ease both; }
.anim-fade-in-down   { animation: fade-in-down var(--t-slow) ease both; }
.anim-scale-in       { animation: scale-in var(--t-bounce) ease both; }
.anim-scale-in-bounce{ animation: scale-in-bounce 0.5s var(--t-overshoot) both; }
.anim-pulse-glow     { animation: pulse-glow 3s ease-in-out infinite; }
.anim-float          { animation: float 4s ease-in-out infinite; }
.anim-float-slow     { animation: float-slow 6s ease-in-out infinite; }
.anim-spin           { animation: spin 1s linear infinite; }
.anim-punch          { animation: punch 0.5s var(--t-overshoot); }
.anim-shake          { animation: shake 0.4s ease-in-out; }
.anim-heartbeat      { animation: heartbeat 1s ease-in-out infinite; }

.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-1000 { animation-delay: 1s; }

/* ============================================================
   13. TOASTS
   ============================================================ */

.toast-container {
    position: fixed;
    top: calc(var(--safe-top) + var(--s-4));
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    pointer-events: none;
    max-width: min(92vw, 480px);
    width: max-content;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    color: var(--cream);
    padding: var(--s-3) var(--s-5);
    border-radius: var(--radius-md);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: var(--s-2);
    animation: fade-in-up 0.3s ease both;
    transition: opacity 0.3s ease, transform 0.3s ease;
    backdrop-filter: blur(20px);
}

.toast-success { border-color: var(--success); }
.toast-success::before { content: '✓'; color: var(--success); font-weight: bold; }

.toast-error   { border-color: var(--danger); }
.toast-error::before { content: '✕'; color: var(--danger); font-weight: bold; }

.toast-warning { border-color: var(--warning); }
.toast-warning::before { content: '!'; color: var(--warning); font-weight: bold; }

.toast-info    { border-color: var(--accent-blue); }

/* ============================================================
   14. LOADING STATES
   ============================================================ */

.loader {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.loader-sm { width: 18px; height: 18px; border-width: 2px; }
.loader-lg { width: 60px; height: 60px; border-width: 4px; }

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-card) 25%,
        var(--bg-card-hover) 50%,
        var(--bg-card) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* ============================================================
   15. ACCESSIBILITY
   ============================================================ */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

.btn:focus-visible,
.card:focus-visible,
.form-input:focus-visible {
    outline-offset: 2px;
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .bg-stars::after { animation: none; }
    .bg-shafts::before { animation: none; opacity: 0.6; }
    .bg-halo::before { animation: none; }
    .tier::before { display: none; }
}

/* ============================================================
   16. PRINT
   ============================================================ */

@media print {
    body { background: white; color: black; }
    .nav, .btn, .toast-container, .bg-stars::before, .bg-stars::after { display: none; }
}