/* ===== Badges page — "one world, one trail" =====
   Values copied from the mock's own source (skunkworks "Cloodit Badges
   Redesign.zip" → Cloodit Badges.dc.html boards 1a/1b/1d, Badge.dc.html for
   the badge states), with the site palette of record from levels-trail.css /
   teacher/class-progress.css (paper #FBF6EA, ink #2B1C50, purple #7C2BF5,
   gold #FBBF24, muted paper ink #8A7A5A). The HUD copies Levels' placement
   and pill; the burger itself is nav-menu.css. Cut from the mock on review:
   rarity, the "N / 106" box, "N of 7 biomes", the So close subtitle and
   "nearest first" stamp. */

.badges-page {
    --paper: #FBF6EA;
    --paper-line: #E6DCC4;
    --paper-rule: #D8CDB2;
    --paper-muted: #8A7A5A;
    --paper-gold: #B7791F;
    --ink: #2B1C50;
    --navy: #12203F;
    --purple: #7C2BF5;
    --purple-hover: #8F45FF;
    --purple-deep: #5A1FC0;
    --gold: #FBBF24;
    --good-ink: #4E7A1E;
    --menu-bg: #2B1C50;
    --menu-ink: #E4D9FF;
    --glass: rgba(20,10,40,.62);
    --glass-hover: rgba(20,10,40,.78);
    --font-display: 'Baloo 2', cursive;
    --font-body: 'Nunito Sans', system-ui, sans-serif;
    --font-script: 'Caveat', cursive;
    --nav-gutter: 24px;
    /* Trail lane: where the dashed path runs, and how far content sits
       from it (mock: lx 70 / padLane 170 / padOut 44 desktop). */
    --lane-x: 70px;
    --lane-pad: 170px;
    --out-pad: 44px;
    --sec-top: 104px;
}

*, *::before, *::after { box-sizing: border-box; }

body.badges-page {
    margin: 0;
    font-family: var(--font-body);
    background: #A9DCEB;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

/* Fail closed until badges.js marks the page ready (try/finally). */
.badges-world { opacity: 0; transition: opacity .25s ease; }
html.badges-ready .badges-world { opacity: 1; }

#badgesLoading {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    background: linear-gradient(180deg, #4E97CC 0%, #7FC3E2 50%, #A9DCEB 100%);
}
.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,.35);
    border-top-color: var(--purple);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
#badgesLoading p { margin: 0; color: var(--navy); font-weight: 800; font-size: .95rem; }
html.badges-ready #badgesLoading { display: none; }

/* ===== HUD (Levels' placement and pill) ===== */
.hud-shade {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    height: 120px;
    pointer-events: none;
    z-index: 40;
    background: linear-gradient(180deg, rgba(11,16,32,.6) 0%, rgba(11,16,32,0) 100%);
}
.badges-page .top-nav {
    position: fixed;
    top: 20px;
    left: 0;
    right: 0;
    height: auto;
    z-index: 50;
}
.badges-page .nav-logo-link img { height: 30px; display: block; }
.badges-page #menu-btn { backdrop-filter: blur(8px); }
.hud-divider {
    order: 1;
    flex: none;
    width: 1px;
    height: 30px;
    background: rgba(255,255,255,.3);
}
.hud-title {
    order: 1;
    margin: 0;
    min-width: 0;
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0,0,0,.35);
    white-space: nowrap;
}
.badges-page .nav-right { flex: none; }
.hud-pill {
    flex: none;
    display: flex;
    align-items: center;
    gap: 14px;
    white-space: nowrap;
    height: 40px;
    padding: 0 7px 0 18px;
    border-radius: 16px;
    background: var(--glass);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,.16);
    color: #fff;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
    text-decoration: none;
    transition: background .2s;
}
.hud-pill[hidden] { display: none; }
.hud-pill:hover { background: var(--glass-hover); color: #fff; }
.hud-pill:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.resume-pill-arrow {
    width: 26px;
    height: 26px;
    flex: none;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
    border: 1.5px solid rgba(255,255,255,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
}
.pill-short { display: none; }

/* ===== Badge (Badge.dc.html): four states =====
   --s is the face size; the ring sits --rw outside it. --p (0-1) is how far
   an in-reach badge's colour has risen from the bottom. */
.bdg {
    --s: 92px;
    --p: 0;
    --rw: max(3px, calc(var(--s) * .045));
    position: relative;
    display: block;
    flex: none;
    width: var(--s);
    height: var(--s);
}
.bdg-ring, .bdg-dash {
    position: absolute;
    inset: calc(var(--rw) * -1);
    border-radius: 50%;
}
.bdg-face {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
}
.bdg-face img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.06);
}
.bdg-line { display: none; }
.bdg-chip {
    position: absolute;
    right: calc(var(--rw) * -1);
    bottom: calc(var(--rw) * -1);
    min-width: max(20px, calc(var(--s) * .24));
    height: max(20px, calc(var(--s) * .24));
    padding: 0 5px;
    border-radius: 999px;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-weight: 900;
    font-size: max(10px, calc(var(--s) * .12));
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(11,16,32,.3);
}

/* Befriended: full colour, gold ring, ✓ chip. */
.bdg.is-earned .bdg-ring {
    background: linear-gradient(135deg, #FFE48A, #FBBF24 45%, #C98A0B);
    box-shadow: 0 4px 14px rgba(11,16,32,.28);
}
.bdg.is-earned .bdg-low { display: none; }
.bdg.is-earned .bdg-chip { background: var(--gold); color: var(--ink); }

/* In reach: colour rises from the bottom to match progress, with a lit
   edge where it has reached; the ring fills as an arc. */
.bdg.is-reach .bdg-ring {
    background: conic-gradient(var(--gold) 0deg calc(var(--p) * 360deg), rgba(255,255,255,.6) calc(var(--p) * 360deg) 360deg);
    box-shadow: 0 0 18px rgba(251,191,36,.55);
}
.bdg.is-reach .bdg-low { filter: grayscale(1) brightness(.78); }
.bdg.is-reach .bdg-hi { clip-path: inset(calc((1 - var(--p)) * 100%) 0 0 0); }
.bdg.is-reach .bdg-line {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    top: calc((1 - var(--p)) * 100%);
    height: 2px;
    margin-top: -1px;
    background: rgba(255,255,255,.95);
    box-shadow: 0 0 6px rgba(251,191,36,.9);
}
.bdg.is-reach .bdg-chip { background: var(--purple); color: #fff; }

/* Known: biome entered, not started — a faded grey creature, dashed ring,
   named. (The mock's brightness(0) silhouette assumes transparent art; ours
   fills the circle, so it would just be a dark disc.) */
.bdg.is-known .bdg-ring { background: rgba(18,32,63,.35); }
.bdg.is-known .bdg-dash { border: max(2px, calc(var(--rw) * .6)) dashed rgba(255,255,255,.95); }
.bdg.is-known .bdg-face { background: rgba(255,255,255,.62); }
.bdg.is-known .bdg-low { filter: grayscale(1) contrast(.6) brightness(1.2); opacity: .6; }
.bdg.is-known .bdg-hi { display: none; }
.bdg.is-known .bdg-chip { display: none; }

/* Undiscovered: biome not reached — dark, padlocked, no name. */
.bdg.is-hidden .bdg-ring { background: rgba(10,8,30,.5); }
.bdg.is-hidden .bdg-face {
    background:
        linear-gradient(150deg, rgba(255,255,255,.32) 0 34%, rgba(255,255,255,0) 34%),
        linear-gradient(330deg, rgba(0,0,0,.18) 0 30%, rgba(0,0,0,0) 30%),
        linear-gradient(200deg, rgba(255,255,255,.12) 0 55%, rgba(255,255,255,0) 55%),
        linear-gradient(135deg, #3A2F70, #241B4A 55%, #160F33);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 4%;
}
.bdg-lock-shackle {
    width: calc(var(--s) * .24);
    height: calc(var(--s) * .17);
    border: max(2px, calc(var(--s) * .05)) solid #7A6EB6;
    border-bottom: none;
    border-radius: 999px 999px 0 0;
}
.bdg-lock-body {
    width: calc(var(--s) * .36);
    height: calc(var(--s) * .27);
    background: #7A6EB6;
    border-radius: max(2px, calc(var(--s) * .05));
}
.bdg.is-hidden .bdg-chip { display: none; }
.bdg.no-chip .bdg-chip { display: none; }

/* A badge you can tap: a plain button around .bdg. */
.bdg-btn {
    display: block;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 50%;
    transition: transform .15s ease;
}
.bdg-btn:hover { transform: translateY(-2px) scale(1.04); }
.bdg-btn:focus-visible { outline: 3px solid var(--purple); outline-offset: 6px; }

/* ===== Hero ===== */
.bw-hero {
    position: relative;
    overflow: hidden;
    padding: 104px clamp(16px, 4vw, 48px) 40px;
    background: linear-gradient(180deg, #4E97CC 0%, #7FC3E2 50%, #A9DCEB 100%);
}
.bw-hero > img { position: absolute; display: block; height: auto; pointer-events: none; }
/* Mock 1a placements, as % of its 1200px frame. */
.hero-sun { right: 23.3%; top: 64px; width: clamp(96px, 12.5vw, 150px); opacity: .95; }
.hero-c1  { right: 10%;   top: 110px; width: clamp(96px, 12.5vw, 150px); opacity: .9; }
.hero-c5  { left: 43.3%;  top: 84px;  width: clamp(110px, 14.2vw, 170px); opacity: .85; }
.hero-c6  { left: -40px;  top: 300px; width: clamp(96px, 11.7vw, 140px); opacity: .8; }

.hero-main {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 40px;
    align-items: center;
    max-width: 1104px;
}
.hero-badge { position: relative; padding: 12px; }
.hero-badge .bdg { --s: 210px; }
.new-friend {
    position: absolute;
    left: 50%;
    bottom: -4px;
    transform: translateX(-50%) rotate(-3deg);
    padding: 3px 18px;
    border-radius: 999px;
    border: 3px solid #fff;
    background: var(--purple);
    color: #fff;
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(11,16,32,.25);
    animation: stickerIn .5s cubic-bezier(.3,1.6,.5,1) .3s both;
}
@keyframes stickerIn {
    from { transform: translateX(-50%) rotate(-12deg) scale(.4); opacity: 0; }
    to   { transform: translateX(-50%) rotate(-3deg) scale(1); opacity: 1; }
}
.hero-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.hero-eyebrow {
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--navy);
    text-transform: uppercase;
}
.hero-name {
    margin: 0;
    font-family: var(--font-display);
    font-size: 72px;
    font-weight: 800;
    line-height: .95;
    color: var(--navy);
    overflow-wrap: anywhere;
}
.hero-line {
    margin: 0;
    font-family: var(--font-script);
    font-size: 31px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--ink);
    text-wrap: pretty;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }

/* Companions strip: the one count on the page. */
.companions {
    position: relative;
    margin-top: 26px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 16px;
    width: fit-content;
    max-width: 100%;
    padding: 9px 20px 9px 22px;
    border-radius: 999px;
    background: rgba(18,32,63,.62);
    backdrop-filter: blur(8px);
}
.companions-label {
    flex: none;
    font-family: var(--font-script);
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}
.companions-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.companions-badges { display: flex; align-items: center; }
.companions-badges .bdg-btn { margin-right: -6px; }
.companions-badges .bdg { --s: 36px; }
.companions-more,
.companions-slot {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 17px;
}
.companions-slot { border: 2px dashed rgba(255,255,255,.7); }
.companions-more { width: auto; padding: 0 10px; border-radius: 999px; background: rgba(255,255,255,.14); font-size: 15px; margin-left: 10px; }

/* ===== Postcards (So close cards + biome postcard + pop-up) ===== */
.pc {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 22px 22px 24px;
    border-radius: 8px;
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 18px 34px rgba(11,16,32,.28);
    transform: rotate(var(--tilt, 0deg));
}
.pc-stamp {
    position: absolute;
    right: 16px;
    top: 16px;
    width: 58px;
    height: 70px;
    padding: 4px;
    background: #fff;
    border: 2px dashed var(--paper-rule);
    transform: rotate(4deg);
    overflow: hidden;
}
.pc-stamp-art { position: relative; width: 100%; height: 100%; overflow: hidden; background: #E9E3D3; }
.pc-stamp-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* A So close stamp: its own creature, coloured up to its progress. */
.pc-stamp-art.is-reveal .stamp-low { filter: grayscale(1) brightness(.85); }
.pc-stamp-art.is-reveal .stamp-hi { clip-path: inset(calc((1 - var(--p, 0)) * 100%) 0 0 0); }
.pc-stamp-art.is-reveal::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: calc((1 - var(--p, 0)) * 100%);
    height: 2px;
    margin-top: -1px;
    background: rgba(255,255,255,.95);
    box-shadow: 0 0 5px rgba(251,191,36,.9);
}
.pc-head { padding-right: 72px; }
.pc-from {
    font-family: var(--font-script);
    font-size: 34px;
    font-weight: 700;
    line-height: 1;
    color: var(--paper-gold);
}
.pc-sub { margin-top: 6px; font-size: 13px; font-weight: 800; color: var(--paper-muted); }
.pc-rule { border-top: 2px dashed var(--paper-rule); }
.pc-who { display: flex; align-items: center; gap: 14px; }
.pc-who-badge { padding: 9px; flex: none; }
.pc-who-badge .bdg { --s: 104px; }
.pc-who-text { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.pc-chip {
    width: fit-content;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--purple);
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1.5px;
}
.pc-state { font-size: 11px; font-weight: 900; letter-spacing: 1.5px; color: var(--purple); text-transform: uppercase; }
.pc-state.is-earned { color: var(--good-ink); }
.pc-state.is-known { color: var(--paper-muted); }
.pc-name {
    margin: 0;
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    color: var(--ink);
    overflow-wrap: anywhere;
}
.pc-body { display: flex; flex-direction: column; gap: 10px; }
.pc-label { font-size: 12px; font-weight: 900; letter-spacing: 1.5px; color: var(--paper-muted); }
.pc-crit { font-size: 17px; font-weight: 800; line-height: 1.3; color: var(--ink); }
.pc-story { font-family: var(--font-script); font-size: 27px; font-weight: 700; line-height: 1.1; color: var(--ink); }
.pc-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pc-pill { padding: 5px 12px; border-radius: 999px; background: #EFE7D4; color: var(--ink); font-size: 12px; font-weight: 800; }
.pc-progress { display: flex; align-items: center; gap: 10px; }
.pc-bar { flex: 1; height: 10px; border-radius: 5px; background: var(--paper-line); overflow: hidden; }
.pc-bar-fill { height: 100%; border-radius: 5px; background: var(--purple); }
.pc-count { font-size: 14px; font-weight: 900; color: var(--ink); white-space: nowrap; }
.pc-action { font-family: var(--font-display); font-size: 22px; font-weight: 800; line-height: 1.15; color: var(--ink); text-wrap: pretty; }

/* Gummy purple button (mock line 134). */
.gummy-btn {
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    height: 52px;
    padding: 0 8px 0 20px;
    border-radius: 999px;
    background: var(--purple);
    color: #fff;
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 5px 0 var(--purple-deep);
    transition: background .15s, transform .1s, box-shadow .1s;
}
.gummy-btn:hover { background: var(--purple-hover); color: #fff; }
.gummy-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--purple-deep); }
.gummy-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.gummy-btn-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gummy-btn-arrow {
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex;
    align-items: center;
    justify-content: center;
}
.gummy-btn.is-inline { width: fit-content; margin-top: 0; }
.gummy-btn.is-inline .gummy-btn-label { padding-right: 6px; }

/* ===== So close… ===== */
.so-close { position: relative; margin-top: 34px; max-width: 1104px; }
.so-close[hidden] { display: none; }
.so-close-title {
    margin: 0 0 22px;
    font-family: var(--font-script);
    font-size: 52px;
    font-weight: 700;
    line-height: .9;
    color: var(--ink);
}
.so-close-cards {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}
.so-close-cards.n-1 { grid-template-columns: minmax(0, 520px); }
.so-close-cards.n-2 { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.sc-card .pc-from { font-size: 28px; }
.sc-card .pc-stamp { width: 48px; height: 58px; }
.sc-card .pc-head { padding-right: 60px; }
.sc-card .pc-who-badge { padding: 6px; }
.sc-card .pc-who-badge .bdg { --s: 84px; }
.sc-card .pc-name { font-size: 27px; }
.sc-card .pc-crit { font-size: 15px; }
.sc-card .pc-action { font-size: 19px; }
.sc-card .gummy-btn { height: 46px; font-size: 16px; }
.sc-card .gummy-btn-arrow { width: 28px; height: 28px; }
/* The nearest one leads. */
.sc-card.is-lead .pc-from { font-size: 34px; }
.sc-card.is-lead .pc-stamp { width: 58px; height: 70px; }
.sc-card.is-lead .pc-head { padding-right: 72px; }
.sc-card.is-lead .pc-who-badge { padding: 9px; }
.sc-card.is-lead .pc-who-badge .bdg { --s: 128px; }
.sc-card.is-lead .pc-name { font-size: 36px; }
.sc-card.is-lead .pc-crit { font-size: 17px; }
.sc-card.is-lead .pc-action { font-size: 24px; }
.sc-card.is-lead .gummy-btn { height: 52px; font-size: 19px; }
.sc-card.is-lead .gummy-btn-arrow { width: 34px; height: 34px; }

/* ===== Trail ===== */
.bw-trail { position: relative; }
.biome {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    min-height: 230px;
    padding: var(--sec-top) var(--out-pad) 28px var(--lane-pad);
}
.biome[data-side="R"] { padding: var(--sec-top) var(--lane-pad) 28px var(--out-pad); }
.biome.is-row { min-height: 290px; }
.biome.is-trophy { min-height: 270px; }
.biome:last-child { padding-bottom: 80px; }
.biome-under, .biome-art, .biome-veil { position: absolute; inset: 0; z-index: -2; }
.biome-art {
    background-size: cover;
    background-position: center bottom;
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 26%, #000 82%, transparent 100%);
    mask-image: linear-gradient(180deg, transparent 0%, #000 26%, #000 82%, transparent 100%);
}
.biome.is-teaser .biome-art { filter: saturate(.5) blur(2px); opacity: .75; }
.biome.is-teaser .biome-veil {
    background: linear-gradient(180deg, rgba(12,14,34,0) 0%, rgba(12,14,34,.4) 45%, rgba(12,14,34,.22) 100%);
}
.biome-path {
    position: absolute;
    left: 0;
    top: 0;
    z-index: -1;
    pointer-events: none;
    overflow: visible;
}
.path-ahead {
    fill: none;
    stroke: rgba(255,255,255,.8);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-dasharray: 7 10;
    filter: drop-shadow(0 1px 1px rgba(11,16,32,.5));
}
.path-done {
    fill: none;
    stroke: var(--gold);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 8 9;
    filter: drop-shadow(0 0 4px rgba(251,191,36,.9));
}
.biome-node {
    position: absolute;
    top: 68px;
    left: calc(var(--x) - 22px);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(11,16,32,.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 800;
    color: #fff;
}
.biome.is-teaser .biome-node { background: rgba(12,14,34,.75) !important; }
.you-are-here {
    position: absolute;
    top: 206px;
    left: calc(var(--x) - 34px);
    width: 68px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 2;
}
.yah-halo {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: rgba(124,43,245,.3);
    display: flex;
    align-items: center;
    justify-content: center;
}
.yah-dot {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 4px solid #fff;
    background: var(--purple);
    color: #fff;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(11,16,32,.35);
}
.yah-label {
    white-space: nowrap;
    padding: 4px 12px;
    border-radius: 999px;
    background: #0F1020;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1px;
}
.biome-name {
    margin: 0;
    font-family: var(--font-display);
    font-size: 40px;
    font-weight: 800;
    line-height: 1;
    color: var(--ink-on);
    text-shadow: var(--shadow-on);
}
.status-pill {
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1.5px;
    background: rgba(11,16,32,.62);
    color: #fff;
    white-space: nowrap;
}
.status-pill.is-trophy { background: var(--gold); color: var(--ink); }
.status-pill.is-now { padding: 4px 12px; background: var(--purple); }
.status-pill.is-teaser { padding: 4px 12px; background: rgba(11,16,32,.6); border: 1px solid rgba(255,255,255,.3); }

/* Teaser: a biome not reached yet. */
.teaser { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; min-height: 100px; }
.teaser .biome-name { font-size: 42px; color: #fff; text-shadow: 0 2px 14px rgba(0,0,0,.5); }
.teaser-meta { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.teaser-count { font-size: 15px; font-weight: 800; color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.teaser-preview { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.teaser-preview .bdg { --s: 52px; }
.teaser-more { padding: 6px 14px; border-radius: 999px; background: rgba(11,16,32,.6); color: #fff; font-size: 15px; font-weight: 900; }

/* Row: a biome behind you (or one you've already met friends in). */
.row-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.revisit {
    margin-left: auto;
    padding: 8px 16px;
    border-radius: 999px;
    background: #fff;
    color: var(--purple-deep);
    font-size: 14px;
    font-weight: 900;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(11,16,32,.2);
}
.revisit:hover { background: #F1E9FF; color: var(--purple-deep); }
.row-badges { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 18px; }
.row-badges .bdg { --s: 50px; }

/* Current biome: the grid and its postcard. Not plain .current —
   class-switcher.js marks the burger's selected class/journey rows with it. */
.biome-current {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 36px;
    align-items: start;
}
.current-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.biome-current .biome-name { font-size: 52px; }
.legend {
    display: flex;
    align-items: center;
    gap: 8px 16px;
    flex-wrap: wrap;
    width: fit-content;
    max-width: 100%;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(255,255,255,.88);
    font-size: 13px;
    font-weight: 800;
    color: var(--navy);
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-count { font-weight: 900; }
.lg-earned {
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--gold); color: var(--ink);
    font-size: 10px; font-weight: 900;
    display: flex; align-items: center; justify-content: center;
}
.lg-reach { padding: 1px 6px; border-radius: 999px; background: var(--purple); color: #fff; font-size: 10px; font-weight: 900; }
.lg-known { width: 16px; height: 16px; border-radius: 50%; border: 2px dashed var(--navy); }
.cells {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    row-gap: 20px;
    margin-top: 12px;
    padding-bottom: 34px;
}
.cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    cursor: pointer;
}
.cell:nth-child(even) { transform: translateY(34px); }
.cell-badge { padding: 6px; border-radius: 50%; transition: transform .15s ease; }
.cell:hover .cell-badge { transform: translateY(-2px) scale(1.04); }
.cell:focus-visible { outline: none; }
.cell:focus-visible .cell-label { outline: 3px solid var(--purple); outline-offset: 2px; }
.cell .bdg { --s: 92px; }
.cell-label {
    max-width: 132px;
    text-align: center;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.94);
    color: var(--navy);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    box-shadow: 0 2px 6px rgba(11,16,32,.18);
}
.cell[aria-pressed="true"] .cell-label { background: var(--purple); color: #fff; }
.biome-current .pc { --tilt: 1deg; margin-top: 4px; padding: 24px 24px 26px; gap: 14px; box-shadow: 0 18px 34px rgba(11,16,32,.3); }
.biome-current .pc-from { font-size: 36px; }
.biome-current .pc-stamp { right: 18px; top: 18px; }

/* ===== Pop-up postcard ===== */
.pc-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(24,14,48,.7);
    animation: fadeIn .2s ease;
}
.pc-overlay[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.pc-modal {
    position: relative;
    width: min(400px, 100%);
    max-height: calc(100vh - 32px);
    overflow: auto;
    animation: modalPop .25s ease;
}
.pc-modal .pc { --tilt: -1deg; box-shadow: 0 20px 44px rgba(0,0,0,.5); }
@keyframes modalPop {
    from { transform: scale(.92); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.pc-close {
    position: absolute;
    top: 4px;
    left: 8px;
    z-index: 2;
    border: none;
    background: none;
    font-size: 28px;
    line-height: 1;
    color: var(--paper-muted);
    cursor: pointer;
    padding: 4px 8px;
}
.pc-close:hover { color: var(--ink); }
.pc-close:focus-visible { outline: 3px solid var(--purple); border-radius: 6px; }
.pc-modal .pc-head { padding-left: 22px; }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
    .so-close-cards,
    .so-close-cards.n-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .so-close-cards .is-lead { grid-column: 1 / -1; }
    .so-close-cards.n-1 { grid-template-columns: minmax(0, 520px); }
}

@media (max-width: 1000px) {
    .biome-current { grid-template-columns: minmax(0, 1fr); }
    .biome-current .pc { --tilt: -.6deg; max-width: 480px; margin-top: 22px; }
}

@media (max-width: 720px) {
    .badges-page { --lane-x: 30px; --lane-pad: 62px; --out-pad: 16px; --sec-top: 92px; }
    .hud-title { font-size: 24px; }
    .hud-pill { font-size: 17px; height: 38px; }
    .hero-main { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; gap: 6px; }
    .hero-badge { margin-bottom: 8px; padding: 8px; }
    .hero-badge .bdg { --s: 136px; }
    .new-friend { font-size: 14px; padding: 2px 14px; bottom: -6px; }
    .hero-eyebrow { font-size: 11px; }
    .hero-name { font-size: 48px; }
    .hero-line { font-size: 24px; }
    .hero-actions { justify-content: center; }
    .companions { margin: 16px auto 0; border-radius: 20px; padding: 10px 14px; justify-content: center; }
    .companions-label { font-size: 20px; }
    .companions-badges .bdg, .companions-slot, .companions-more { --s: 30px; width: 30px; height: 30px; }
    .companions-more { width: auto; }
    .so-close-title { font-size: 44px; text-align: center; }
    .so-close-cards,
    .so-close-cards.n-1,
    .so-close-cards.n-2 { grid-template-columns: minmax(0, 1fr); gap: 22px; }
    .sc-card { --tilt: 0deg !important; }
    .biome-name { font-size: 30px; }
    .biome-current .biome-name { font-size: 36px; }
    .teaser { flex-direction: column; align-items: flex-start; gap: 10px; }
    .teaser .biome-name { font-size: 30px; }
    .teaser-preview { margin-left: 0; gap: 10px; }
    .teaser-preview .bdg { --s: 38px; }
    .teaser-preview .bdg:nth-child(n+4) { display: none; }
    .teaser-count { font-size: 13px; }
    .revisit { margin-left: 0; }
    .row-badges { gap: 10px; }
    .row-badges .bdg { --s: 42px; }
    .legend { border-radius: 14px; font-size: 11px; padding: 8px 12px; gap: 6px 12px; }
    .cells { row-gap: 14px; margin-top: 6px; padding-bottom: 16px; }
    .cell { gap: 6px; }
    .cell:nth-child(even) { transform: translateY(16px); }
    .cell-badge { padding: 4px; }
    .cell .bdg { --s: 56px; }
    .cell-label { max-width: 76px; padding: 2px 6px; border-radius: 8px; font-size: 11px; box-shadow: none; }
    .biome-node { top: 72px; width: 36px; height: 36px; left: calc(var(--x) - 18px); font-size: 13px; }
    .you-are-here { top: 218px; width: 48px; left: calc(var(--x) - 24px); gap: 4px; }
    .yah-halo { width: auto; height: auto; background: none; }
    .yah-dot { width: 44px; height: 44px; font-size: 18px; box-shadow: 0 0 0 6px rgba(124,43,245,.3); }
    .yah-label { padding: 2px 6px; font-size: 9px; }
    .yah-label-long { display: none; }
}

@media (max-width: 560px) {
    .badges-page { --nav-gutter: 16px; }
    .badges-page .top-nav { top: 16px; }
    .hud-shade { height: 90px; }
    .badges-page .nav-inner { gap: 10px; }
    .badges-page .nav-logo-link, .hud-divider { display: none; }
    .hud-pill { font-size: 16px; height: 44px; gap: 10px; padding: 0 12px 0 14px; }
    .resume-pill-arrow { display: none; }
    .pill-long { display: none; }
    .pill-short { display: inline; }
    .bw-hero { padding-top: 84px; }
    .hero-sun { right: -20px; top: 70px; width: 110px; }
    .hero-c1 { left: -30px; right: auto; top: 120px; width: 110px; }
    .hero-c5, .hero-c6 { display: none; }
    .pc { padding: 18px; }
    .pc-who-badge .bdg, .sc-card.is-lead .pc-who-badge .bdg { --s: 76px; }
    .sc-card.is-lead .pc-name, .pc-name { font-size: 26px; }
    .pc-from, .sc-card.is-lead .pc-from, .biome-current .pc-from { font-size: 28px; }
    .sc-card.is-lead .pc-action, .pc-action { font-size: 19px; }
    .gummy-btn, .sc-card.is-lead .gummy-btn { height: 48px; font-size: 17px; }
}

@media (max-width: 360px) {
    .hud-title { font-size: 20px; }
    .hero-name { font-size: 40px; }
}

@media (prefers-reduced-motion: reduce) {
    .badges-world, .bdg-btn, .cell-badge, .gummy-btn { transition: none; }
    .new-friend, .pc-overlay, .pc-modal { animation: none; }
}
