/* ═══════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Biome theme tokens (overridden per-biome via JS) ── */
:root {
    --b-bg:  #0f1e11;
    --b-bg2: #0a1209;
    --b-a:   29,158,117;
    --b-b:   159,225,203;
    --b-n:   93,202,165;
    --b-g1:  #1D9E7548;
    --b-g2:  #1D9E7520;
}

html,
body {
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--b-bg2);
    color: #d4edd8;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: max(env(safe-area-inset-top), 0.6rem) 0.75rem max(env(safe-area-inset-bottom), 0.75rem);
    min-height: 100dvh;
}

/* ═══════════════════════════════════════
   PAGE HEADER (title + profile)
═══════════════════════════════════════ */
#page-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 960px;
    margin-bottom: 0.6rem;
    z-index: 10;
}

h1 {
    font-family: 'Cinzel', serif;
    font-size: 1.35rem;
    font-weight: 400;
    color: #9FE1CB;
    letter-spacing: 0.1em;
    text-shadow: 0 0 24px #1D9E7560;
    text-align: center;
    pointer-events: none;
}

/* Profile button pinned to the right */
#profile-area {
    position: absolute;
    right: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Save indicator */
#header-save-status {
    position: absolute;
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #4a7a55;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}
#header-save-status.visible {
    opacity: 1;
}

#profile-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: #0a2218;
    border: 1px solid #1D9E7540;
    border-radius: 20px;
    color: #9FE1CB;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

#profile-btn:hover {
    background: #112d1a;
    border-color: #1D9E7560;
}

#profile-btn-icon {
    font-size: 14px;
    line-height: 1;
}

/* Logged-in: collapse to a circle showing just the avatar initial */
#profile-btn.logged-in {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    border-color: #1D9E7560;
    background: #0f2e1a;
    justify-content: center;
    gap: 0;
}

#profile-btn.logged-in #profile-btn-icon {
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
}

#profile-btn.logged-in #profile-btn-label {
    display: none !important;
}

#logout-inline-btn {
    display: none !important;
}

padding: 6px 12px;
background: transparent;
border: 1px solid #7a4a4a55;
border-radius: 20px;
color: #e07070;
font-size: 11px;
font-weight: 500;
cursor: pointer;
touch-action: manipulation;
-webkit-tap-highlight-color: transparent;
font-family: inherit;
transition: background 0.15s,
border-color 0.15s;
white-space: nowrap;
}

#logout-inline-btn:hover {
    background: #2e1010;
    border-color: #e0707070;
}

/* ═══════════════════════════════════════
   GAME GRID
═══════════════════════════════════════ */
#game {
    display: grid;
    grid-template-columns: 1fr 295px;
    align-items: start;
    width: 100%;
    max-width: 960px;
    border: 1px solid rgba(var(--b-a), 0.25);
    border-radius: 14px;
    background: var(--b-bg);
    position: relative;
    overflow: hidden;
}

@keyframes shake {

    0%,
    100% {
        transform: translate(0, 0);
    }

    15% {
        transform: translate(-5px, 2px);
    }

    30% {
        transform: translate(5px, -2px);
    }

    50% {
        transform: translate(-3px, 2px);
    }

    70% {
        transform: translate(3px, -1px);
    }
}

#game.shake {
    animation: shake 0.4s ease-out;
}

#flash-overlay {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    border-radius: 14px;
    transition: opacity 0.06s;
    z-index: 10;
}

/* ═══════════════════════════════════════
   MOBILE BREAKPOINTS
═══════════════════════════════════════ */
@media (max-width: 640px) {
    body {
        padding: max(env(safe-area-inset-top), 0.4rem) 0.4rem max(env(safe-area-inset-bottom), 1rem);
    }

    h1 {
        font-size: 1rem;
        padding: 0 90px;
        letter-spacing: 0.08em;
    }

    /* Collapse profile button to icon-only on mobile (no "Sign In" text) */
    #profile-btn {
        width: 36px;
        height: 36px;
        padding: 0;
        justify-content: center;
        gap: 0;
    }
    #profile-btn #profile-btn-label {
        display: none !important;
    }

    #game {
        grid-template-columns: 1fr;
        border-radius: 10px;
    }

    #left {
        padding: 0.75rem;
        gap: 0.5rem;
        border-bottom: 1px solid #1D9E7530;
    }

    #right {
        border-left: none;
        max-height: 55dvh;
        min-height: auto;
        align-self: auto;
    }

    #spore-btn {
        width: 110px;
        height: 110px;
    }

    #spore-icon {
        font-size: 36px;
    }

    #mycelium-canvas {
        width: 240px;
        height: 240px;
    }

    #btn-wrap {
        height: 240px;
    }

    .pulse-ring {
        width: 110px;
        height: 110px;
    }

    #lb-modal {
        width: calc(100vw - 1.5rem);
        max-height: calc(100dvh - 56px);
        margin-top: 48px;
    }
}

@media (min-width: 641px) and (max-width: 820px) {
    #game {
        grid-template-columns: 1fr 240px;
    }
}

/* ═══════════════════════════════════════
   LEFT PANEL
═══════════════════════════════════════ */
#left {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    align-self: stretch;
    background: var(--b-bg);
    transition: background 0.8s ease;
}

#right {
    background: var(--b-bg2);
    border-left: 1px solid rgba(var(--b-a), 0.19);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    max-height: min(900px, calc(100dvh - 80px));
    min-height: 400px;
    display: flex;
    flex-direction: column;
    position: relative;
    align-self: start;
    padding-bottom: 20px;
}

/* Stats */
#stats {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.stat-card {
    background: #0a1209;
    border-radius: 10px;
    padding: 9px 12px;
    border: 1px solid #1D9E7530;
}

.stat-label {
    font-size: 11px;
    color: #6a9d75;
    margin-bottom: 2px;
}

.stat-val {
    font-size: 22px;
    font-weight: 500;
    color: #9FE1CB;
}

/* Biome chip row — biome left, run modifier right */
#biome-bar {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
    gap: 8px;
}

#biome-bar-left {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

#mod-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    flex-shrink: 0;
}

#mod-chip-label {
    font-size: 10px;
    color: #3a5e42;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding-right: 2px;
}

#mod-chip-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid #1D9E7530;
    background: #0a1209;
    position: relative;
}

#mod-chip-pill #mod-chip-emoji {
    font-size: 13px;
    flex-shrink: 0;
    line-height: 1;
}

#mod-chip-pill #mod-chip-name {
    font-size: 11px;
    font-weight: 500;
    color: #6a9d75;
}

/* Mod tooltip opens upward, anchors right */
#mod-tip-wrap .info-tooltip {
    bottom: calc(100% + 6px);
    top: auto;
    right: 0;
    left: auto;
}

#biome-bar-label {
    font-size: 10px;
    color: #3a5e42;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding-left: 2px;
}

#biome-bar-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #0a1209;
    border: 1px solid #1D9E7530;
    border-radius: 20px;
    padding: 4px 10px 4px 7px;
    position: relative;
}

#biome-bar-emoji {
    font-size: 13px;
    flex-shrink: 0;
    line-height: 1;
}

#biome-bar-name {
    font-size: 11px;
    font-weight: 500;
    color: #6a9d75;
    white-space: nowrap;
}

#biome-tip-wrap {
    flex-shrink: 0;
}

/* Tooltip anchors left-side of chip, opens upward — never clips */
#biome-tip-wrap .info-tooltip {
    bottom: calc(100% + 6px);
    top: auto;
    left: 0;
    right: auto;
    min-width: 190px;
    max-width: 240px;
}

/* ═══════════════════════════════════════
   STATUS STRIP (season · event · bonds)
═══════════════════════════════════════ */
#status-strip {
    display: flex;
    gap: 5px;
    width: 100%;
}

.spill {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 6px;
    border-radius: 8px;
    border: 1px solid #1D9E7530;
    background: #0a1209;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
    min-width: 0;
    font-family: inherit;
}

.spill:hover:not(.inactive) {
    background: #111e13;
    border-color: #1D9E7550;
}

.spill.s-active {
    border-color: #1D9E7560;
    background: #0d2014;
}

.spill.inactive {
    opacity: 0.35;
    pointer-events: none;
}

#strip-season-icon,
#strip-event-icon,
#strip-bond-icon {
    font-size: 13px;
    flex-shrink: 0;
    line-height: 1;
}

.spill-text {
    font-size: 11px;
    font-weight: 500;
    color: #9FE1CB;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.spill-chev {
    font-size: 9px;
    color: #3a6e4a;
    flex-shrink: 0;
    margin-left: 1px;
    transition: transform 0.2s;
}

.spill.s-active .spill-chev {
    transform: rotate(180deg);
    color: #9FE1CB;
}

/* Event pill accent */
.spill-event {
    border-color: #EF9F2750;
}

.spill-event:hover:not(.inactive) {
    background: #1a1209;
    border-color: #EF9F2780;
}

.spill-event.s-active {
    background: #1a1209;
}

.spill-event .spill-text {
    color: #EF9F27;
}

/* Bond pill alert state */
.spill-bond.alert {
    border-color: #e0707050;
}

.spill-bond.alert:hover {
    background: #180a0a;
    border-color: #e0707080;
}

.spill-bond.alert.s-active {
    background: #180a0a;
}

.spill-bond.alert .spill-text {
    color: #e07070;
}

.spill-bond-dot {
    width: 7px;
    height: 7px;
    background: #e07070;
    border-radius: 50%;
    border: 1.5px solid #0a1209;
    flex-shrink: 0;
}

/* Expandable detail panels */
.spanel {
    width: 100%;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.25s ease;
    pointer-events: none;
}

.spanel.open {
    max-height: 260px;
    pointer-events: auto;
}

.spanel.open * {
    pointer-events: auto;
}

.spanel-inner {
    background: #0a1209;
    border: 1px solid #1D9E7530;
    border-radius: 10px;
    padding: 10px 12px;
    margin-top: 3px;
}

.spanel-inner.event-inner {
    border-color: #EF9F2740;
}

.spanel-inner.bond-inner {
    border-color: #e0707040;
}

.spanel-title {
    font-size: 10px;
    font-weight: 600;
    color: #5DCAA5;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 7px;
}

.spanel-title.amber {
    color: #EF9F27;
}

.spanel-title.red {
    color: #e07070;
}

.chain-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.06em;
    background: #3a1a0a;
    color: #EF9F27;
    border: 1px solid #EF9F2760;
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: 5px;
    vertical-align: middle;
    text-transform: uppercase;
}

.spanel-desc {
    font-size: 11px;
    color: #6a9d75;
    font-style: italic;
    margin-bottom: 5px;
}

.spanel-prog-track {
    height: 3px;
    background: #1D9E7515;
    border-radius: 2px;
    overflow: hidden;
    margin: 0 0 5px;
}

.spanel-prog-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}

.spanel-mult-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    padding: 2px 0;
    color: #6a9d75;
}

.spanel-mult-up {
    color: #5DCAA5;
}

.spanel-mult-down {
    color: #EF9F27;
}

.spanel-feed-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 0;
    gap: 8px;
}

.spanel-feed-name {
    font-size: 12px;
    color: #d4edd8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spanel-feed-btn {
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #e0707055;
    background: #180a0a;
    color: #e07070;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    touch-action: auto;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    transition: background 0.15s;
}

.spanel-feed-btn:hover:not(:disabled) {
    background: #2a1010;
}

.spanel-feed-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

/* Bonds tab badge — red dot when any bond is hungry or broken */
#tab-btn-bonds {
    position: relative;
}

#tab-btn-bonds.has-alert::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 7px;
    height: 7px;
    background: #e07070;
    border-radius: 50%;
    border: 1.5px solid #0a1209;
    pointer-events: none;
}

/* Tab notification dots */
#tab-btn-upgrades, #tab-btn-lore, #tab-btn-research, #tab-btn-bonds {
    position: relative;
}

#tab-btn-upgrades.has-upgrades::after,
#tab-btn-lore.has-lore::after,
#tab-btn-research.has-research::after,
#tab-btn-bonds.has-bond-available::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 1.5px solid #0a1209;
    pointer-events: none;
}
#tab-btn-upgrades.has-upgrades::after,
#tab-btn-research.has-research::after,
#tab-btn-bonds.has-bond-available::after {
    background: #5DCAA5;
}
#tab-btn-lore.has-lore::after {
    background: #a78bfa;
}

/* Leaderboard area pinned to the left */
#lb-area {
    position: absolute;
    left: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

#lb-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #0a2218;
    border: 1px solid #1D9E7540;
    border-radius: 50%;
    color: #6a9d75;
    font-size: 15px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}

#lb-btn:hover {
    background: #112d1a;
    border-color: #1D9E7560;
    color: #9FE1CB;
}

/* Leaderboard modal */
#lb-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 8000;
    align-items: flex-start;
    justify-content: flex-start;
    padding: max(env(safe-area-inset-top), 0.5rem) 0 0 max(env(safe-area-inset-left), 0.75rem);
}

#lb-overlay.open {
    display: flex;
}

#lb-modal {
    background: var(--b-bg);
    border: 1px solid rgba(var(--b-a), 0.25);
    border-radius: 14px;
    padding: 20px;
    width: 360px;
    max-width: calc(100vw - 1.5rem);
    margin-top: 44px;
    box-shadow: 0 8px 32px #00000080;
    max-height: calc(100dvh - 60px);
    display: flex;
    flex-direction: column;
}

.lb-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    flex-shrink: 0;
}

.lb-modal-title {
    font-size: 14px;
    font-weight: 500;
    color: #9FE1CB;
}

#lb-modal-close {
    width: 28px;
    height: 28px;
    border: none;
    background: #0a1209;
    color: #6a9d75;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

#lb-modal-close:hover {
    background: #112d1a;
    color: #9FE1CB;
}

#lb-modal-wrap {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    flex: 1 1 auto;
}

/* Settings button in header */
#settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #0a2218;
    border: 1px solid #1D9E7540;
    border-radius: 50%;
    color: #6a9d75;
    font-size: 15px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}

#settings-btn:hover {
    background: #112d1a;
    border-color: #1D9E7560;
    color: #9FE1CB;
}

/* Biome path */
#biome-path {
    display: none;
    width: 100%;
    padding: 4px 0;
}

#mycelium-canvas {
    position: absolute;
    width: 340px;
    height: 340px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
    display: block;
}

/* Spore button */
@keyframes bio-idle-ring {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.95);
        opacity: 0;
    }
}

#btn-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 100%;
    height: 340px;
    overflow: hidden;
}

@keyframes bio-glow {

    0%,
    100% {
        box-shadow: 0 0 12px var(--biome-glow-1, #1D9E7545), 0 0 28px var(--biome-glow-2, #1D9E7520);
    }

    50% {
        box-shadow: 0 0 26px var(--biome-glow-1, #1D9E7545), 0 0 55px var(--biome-glow-2, #1D9E7520), 0 0 85px var(--biome-glow-2, #9FE1CB1A);
    }
}

#spore-btn {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 2px solid rgb(var(--biome-n-rgb, 29, 158, 117));
    background: radial-gradient(circle at 50% 40%, rgba(var(--biome-a-rgb, 29, 158, 117), 0.35) 0%, #0d1a10 60%, #080f09 100%);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    transition: transform 0.08s, background 0.08s;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    animation: bio-glow 2.8s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

#spore-btn:hover {
    background: radial-gradient(circle at 50% 40%, rgba(var(--biome-a-rgb, 29, 158, 117), 0.5) 0%, #112415 60%, #0a1209 100%);
}

#spore-btn:active {
    transform: scale(0.91);
    background: radial-gradient(circle at 50% 40%, rgba(var(--biome-a-rgb, 29, 158, 117), 0.65) 0%, #1a3520 60%, #0f1a10 100%);
}

@keyframes spore-float {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-5px) scale(1.07);
    }
}

#spore-icon {
    font-size: 48px;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    animation: spore-float 3.4s ease-in-out infinite;
}

#click-label {
    font-size: 11px;
    color: #5DCAA5;
    font-weight: 500;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Ticker */
#ticker {
    font-size: 12px;
    color: #6a9d75;
    min-height: 30px;
    text-align: center;
    line-height: 1.5;
    padding: 0 6px;
    font-style: italic;
    width: 100%;
    transition: color 0.3s;
}

#ticker.pulse-msg {
    color: #9FE1CB;
}

/* Progress */
#progress-bar {
    width: 100%;
    height: 6px;
    background: #0a1209;
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid #1D9E7530;
}

#progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1D9E75, #9FE1CB);
    border-radius: 3px;
    transition: width 0.25s;
    width: 0%;
}

#pulse-info {
    font-size: 11px;
    color: #5DCAA5;
    width: 100%;
    text-align: center;
}

#pulse-streak {
    font-size: 11px;
    font-weight: 600;
    width: 100%;
    text-align: center;
    letter-spacing: 0.03em;
}

.pulse-streak-combo {
    color: #EF9F27;
}

.pulse-streak-resonance {
    color: #FFD080;
    animation: resonance-pulse 0.8s ease-in-out infinite alternate;
}

@keyframes resonance-pulse {
    from {
        opacity: 0.75;
    }

    to {
        opacity: 1;
    }
}

#pulse-locked {
    font-size: 11px;
    color: #3a5e42;
    width: 100%;
    text-align: center;
    font-style: italic;
}

/* Sporulate */
#sporulate-wrap {
    display: none;
    width: 100%;
}

#sporulate-btn {
    width: 100%;
    padding: 9px 14px;
    border-radius: 10px;
    border: 1px solid #9FE1CB55;
    background: #0a2218;
    color: #9FE1CB;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    transition: background 0.15s;
    animation: bio-glow 2s ease-in-out infinite;
}

#sporulate-btn:hover {
    background: #112d1a;
}

#sporulate-panel {
    display: none;
    margin-top: 7px;
    background: #0a1209;
    border: 1px solid #1D9E7540;
    border-radius: 10px;
    padding: 12px 14px;
}

.spor-row {
    font-size: 12px;
    color: #6a9d75;
    margin-bottom: 5px;
    line-height: 1.5;
}

.spor-row strong {
    color: #9FE1CB;
}

.spor-row.warn {
    color: #c47a4a;
    font-style: italic;
}

#spor-confirm-btns {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

#spor-confirm-btns button {
    flex: 1;
    padding: 8px 0;
    border-radius: 8px;
    border: 1px solid;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

#spor-yes {
    background: #0f2e1a;
    border-color: #1D9E7560;
    color: #9FE1CB;
}

#spor-no {
    background: #1a1209;
    border-color: #7a4a4a55;
    color: #c47a4a;
}

/* Save / Reset */
#save-info {
    font-size: 11px;
    color: #3a5e42;
    text-align: center;
}

/* ═══════════════════════════════════════
   TABS — single emoji-icon row, sticky
═══════════════════════════════════════ */
#tabs {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 5;
    background: #0a1209;
    border-bottom: 1px solid #1D9E7530;
}

#tab-icon-row {
    display: flex;
    padding: 6px 8px 5px;
    gap: 2px;
}

.tab {
    flex: 1;
    min-width: 0;
    padding: 6px 2px;
    font-size: 19px;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    background: transparent;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, opacity 0.15s;
    font-family: inherit;
    opacity: 0.45;
}

.tab.active {
    background: #1D9E7525;
    opacity: 1;
}

.tab:hover:not(.active) {
    background: #1D9E7512;
    opacity: 0.7;
}

/* Tab heading — sits inside the sticky block, below the icons */
#tab-heading-bar {
    padding: 3px 12px 6px;
    border-top: 1px solid #1D9E7515;
}

#tab-heading-text {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.09em;
    color: #5DCAA5;
    text-transform: uppercase;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Upgrade subtabs */
#upgrade-subtabs {
    display: flex;
    gap: 6px;
    padding: 10px 12px 0;
}

.subtab {
    padding: 5px 14px;
    border-radius: 20px;
    border: 1px solid #1D9E7530;
    background: transparent;
    color: #6a9d75;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.subtab.active {
    background: #1D9E7520;
    border-color: #1D9E7560;
    color: #9FE1CB;
}

/* ═══════════════════════════════════════
   SHOP ITEMS
═══════════════════════════════════════ */
.item {
    display: block;
    width: 100%;
    padding: 11px 13px;
    border: none;
    border-bottom: 1px solid #1D9E7518;
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: left;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.1s;
    font-family: inherit;
}

.item:hover:not(.disabled) {
    background: #0f1e11;
}

.item:active:not(.disabled) {
    background: #152819;
}

.item.disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

.item.can-afford {
    border-left: 2px solid #1D9E7560;
}

.item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.item-name {
    font-size: 13px;
    font-weight: 500;
    color: #d4edd8;
}

.item-cost {
    font-size: 12px;
    color: #5DCAA5;
    font-weight: 500;
    flex-shrink: 0;
    margin-left: 8px;
}

.item-desc {
    font-size: 11px;
    color: #6a9d75;
    line-height: 1.4;
}

.item-owned {
    font-size: 11px;
    color: #4a7a55;
    margin-top: 3px;
}

.badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 500;
    background: #1D9E7222;
    color: #5DCAA5;
    border: 1px solid #1D9E7535;
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: 5px;
    vertical-align: middle;
}

.biome-badge {
    background: #2a1a0a;
    color: #EF9F27;
    border-color: #EF9F2755;
}

/* ═══════════════════════════════════════
   RESEARCH
═══════════════════════════════════════ */
#tab-research {
    padding: 12px;
}

.research-tier-label {
    font-size: 10px;
    font-weight: 500;
    color: #4a7a55;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 8px;
    padding-left: 2px;
}

.research-nodes {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 4px;
}

.rn-connector {
    width: 100%;
    text-align: center;
    color: #1D9E7540;
    font-size: 14px;
    margin: 4px 0;
    letter-spacing: 2px;
}

.rn-card {
    flex: 1;
    min-width: 90px;
    background: #0a1209;
    border: 1px solid #1D9E7530;
    border-radius: 10px;
    padding: 10px;
}

.rn-card.bought {
    border-color: #1D9E7560;
    background: #0a1e12;
}

.rn-card.locked {
    opacity: 0.4;
}

.rn-name {
    font-size: 12px;
    font-weight: 500;
    color: #d4edd8;
    margin-bottom: 4px;
}

.rn-desc {
    font-size: 11px;
    color: #6a9d75;
    line-height: 1.3;
    margin-bottom: 7px;
}

.rn-cost {
    font-size: 11px;
    color: #5DCAA5;
    margin-bottom: 6px;
}

.rn-btn {
    display: block;
    width: 100%;
    padding: 5px 0;
    background: #0f2e1a;
    border: 1px solid #1D9E7550;
    border-radius: 6px;
    color: #9FE1CB;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    transition: background 0.1s;
}

.rn-btn:hover:not(:disabled) {
    background: #152e1c;
}

.rn-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.rn-bought-badge {
    font-size: 10px;
    color: #5DCAA5;
    text-align: center;
    padding: 3px 0;
}

/* ═══════════════════════════════════════
   BONDS (SYMBIOSIS)
═══════════════════════════════════════ */
.sym-card {
    padding: 12px 14px;
    border-bottom: 1px solid #1D9E7518;
}

.sym-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.sym-name {
    font-size: 13px;
    font-weight: 500;
    color: #d4edd8;
}

.sym-status-badge {
    font-size: 10px;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 4px;
}

.sym-status-badge.locked {
    background: #1a1a1a;
    color: #555;
    border: 1px solid #333;
}

.sym-status-badge.available {
    background: #1D9E7520;
    color: #5DCAA5;
    border: 1px solid #1D9E7540;
}

.sym-status-badge.active {
    background: #1a3d25;
    color: #9FE1CB;
    border: 1px solid #1D9E7560;
}

.sym-status-badge.hungry {
    background: #3d2a0a;
    color: #EF9F27;
    border: 1px solid #EF9F2750;
}

.sym-status-badge.broken {
    background: #3d0f0f;
    color: #e07070;
    border: 1px solid #e0707050;
}

.sym-desc {
    font-size: 11px;
    color: #6a9d75;
    line-height: 1.4;
    margin-bottom: 6px;
}

.sym-stats {
    font-size: 11px;
    color: #4a7a55;
    margin-bottom: 7px;
}

.sym-btn {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    transition: background 0.1s;
}

.sym-btn.pact {
    background: #0f2e1a;
    border-color: #1D9E7550;
    color: #9FE1CB;
}

.sym-btn.feed {
    background: #3d2a0a;
    border-color: #EF9F2760;
    color: #EF9F27;
}

.sym-btn.restore {
    background: #2e1010;
    border-color: #e0707050;
    color: #e07070;
}

.sym-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.sym-feed-track {
    height: 4px;
    background: #1D9E7515;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 7px;
}

.sym-feed-fill {
    height: 100%;
    background: #5DCAA5;
    border-radius: 2px;
    transition: width 0.5s, background 0.5s;
}

/* ═══════════════════════════════════════
   OWNED UPGRADES
═══════════════════════════════════════ */
.owned-group {
    padding: 7px 13px 3px;
    font-size: 10px;
    font-weight: 500;
    color: #4a7a55;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.upgrade-section-hdr {
    padding: 10px 13px 4px;
    font-size: 10px;
    font-weight: 600;
    color: #5DCAA5;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    border-top: 1px solid #1D9E7518;
    margin-top: 4px;
}
.upgrade-section-hdr:first-child {
    border-top: none;
    margin-top: 0;
}

.owned-row {
    padding: 7px 13px;
    border-bottom: 1px solid #1D9E7510;
}

.owned-name {
    font-size: 12px;
    color: #9FE1CB;
    margin-bottom: 2px;
}

.owned-desc {
    font-size: 11px;
    color: #6a9d75;
}

/* ═══════════════════════════════════════
   GOALS / ACHIEVEMENTS
═══════════════════════════════════════ */
#tab-goals {
    padding: 10px;
}

.goals-section-hdr {
    font-size: 10px;
    font-weight: 500;
    color: #4a7a55;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 8px 4px 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    border-radius: 4px;
    transition: background 0.15s;
}
.goals-section-hdr:hover {
    background: rgba(93, 202, 165, 0.06);
}
.goals-section-title {
    flex: 1;
}
.goals-section-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.goals-chev {
    font-size: 9px;
    color: #4a7a55;
    transition: transform 0.2s;
    display: inline-block;
}
.goals-section-hdr.collapsed .goals-chev {
    transform: rotate(-90deg);
}
.goals-section-body {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.3s ease;
}
.goals-section-body.collapsed {
    grid-template-rows: 0fr;
}
.goals-section-inner {
    overflow: hidden;
    min-height: 0;
}

.goals-section-count {
    color: #5DCAA5;
}

.ach-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin-bottom: 10px;
}

.ach-card {
    background: #0a1209;
    border: 1px solid #1D9E7520;
    border-radius: 10px;
    padding: 10px;
}

.ach-card.unlocked {
    border-color: #1D9E7550;
    background: #0a1e12;
}

.ach-card.locked {
    opacity: 0.35;
}

.ach-top {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.ach-emoji {
    font-size: 18px;
}

.ach-name {
    font-size: 11px;
    font-weight: 500;
    color: #d4edd8;
    line-height: 1.2;
}

.ach-desc {
    font-size: 10px;
    color: #6a9d75;
    line-height: 1.3;
    margin-bottom: 4px;
}

.ach-bonus {
    font-size: 10px;
    color: #5DCAA5;
}

.ach-lore {
    font-size: 10px;
    color: #4a7a55;
    font-style: italic;
    line-height: 1.3;
    margin-top: 4px;
}

.pm-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 2px;
    border-bottom: 1px solid #1D9E7510;
}

.pm-name {
    font-size: 11px;
    color: #d4edd8;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pm-badges {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.pm-badge {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #1D9E7525;
    font-size: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3a5e42;
    font-weight: 500;
}

.pm-badge.done {
    background: #1D9E7520;
    border-color: #1D9E7555;
    color: #9FE1CB;
}

.pm-badge.bonus {
    border-color: #EF9F2755;
}

.pm-badge.done.bonus {
    background: #3d2a0a;
    border-color: #EF9F2780;
    color: #EF9F27;
}

.biome-ach-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.biome-ach-card {
    flex: 1;
    min-width: 80px;
    background: #0a1209;
    border: 1px solid #1D9E7520;
    border-radius: 8px;
    padding: 8px;
    text-align: center;
}

.biome-ach-card.unlocked {
    border-color: #1D9E7550;
    background: #0a1e12;
}

.biome-ach-card.locked {
    opacity: 0.35;
}

.biome-ach-emoji {
    font-size: 22px;
    display: block;
    margin-bottom: 3px;
}

.biome-ach-name {
    font-size: 10px;
    color: #d4edd8;
    font-weight: 500;
}

/* ═══════════════════════════════════════
   LORE / CODEX
═══════════════════════════════════════ */
#tab-lore {
    padding: 10px 14px;
}

.codex-entry {
    margin-bottom: 14px;
    border-bottom: 1px solid #1D9E7515;
    padding-bottom: 12px;
}

.codex-entry:last-child {
    border-bottom: none;
}

.codex-title {
    font-size: 13px;
    font-weight: 500;
    color: #9FE1CB;
    margin-bottom: 5px;
}

.codex-text {
    font-size: 12px;
    color: #6a9d75;
    line-height: 1.6;
    font-style: italic;
}

.codex-locked {
    font-size: 12px;
    color: #2a4a35;
    font-style: italic;
    padding: 8px 0;
}

/* ═══════════════════════════════════════
   ACHIEVEMENT TOASTS
═══════════════════════════════════════ */
#ach-toast-container {
    position: fixed;
    top: max(env(safe-area-inset-top), 0.75rem);
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 280px;
}

.ach-toast {
    background: #0a1e12;
    border: 1px solid #1D9E7560;
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: ach-in 0.3s ease-out forwards;
}

.ach-toast.leaving {
    animation: ach-out 0.3s ease-in forwards;
}

@keyframes ach-in {
    from {
        opacity: 0;
        transform: translateX(110%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes ach-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(110%);
    }
}

.ach-toast-emoji {
    font-size: 24px;
    flex-shrink: 0;
}

.ach-toast-body {
    flex: 1;
    min-width: 0;
}

.ach-toast-label {
    font-size: 10px;
    color: #5DCAA5;
    font-weight: 500;
    margin-bottom: 2px;
}

.ach-toast-name {
    font-size: 13px;
    font-weight: 500;
    color: #d4edd8;
    line-height: 1.2;
}

.ach-toast-bonus {
    font-size: 10px;
    color: #9FE1CB;
    margin-top: 2px;
}

/* ── Gold toast for hidden achievements ── */
.ach-toast.golden {
    border-color: #c9a22780;
    box-shadow: 0 0 14px #c9a22725, 0 2px 8px #00000060;
}

.ach-toast.golden .ach-toast-label {
    color: #c9a227;
}

.ach-toast.golden .ach-toast-bonus {
    color: #e8c547;
}

/* ── Lore toast ── */
.ach-toast.lore-toast {
    background: #0d0f1e;
    border-color: #a78bfa40;
}
.ach-toast.lore-toast .ach-toast-label {
    color: #a78bfa;
}
.lore-toast-snippet {
    font-size: 10px;
    color: #8877bb;
    font-style: italic;
    margin-top: 3px;
    line-height: 1.4;
}

@media (max-width: 640px) {
    /* Move toasts to bottom on mobile so they don't cover the header */
    #ach-toast-container {
        top: auto;
        bottom: max(env(safe-area-inset-bottom), 5rem);
        right: 50%;
        transform: translateX(50%);
        max-width: calc(100vw - 2rem);
        align-items: center;
    }
}

/* ── Unlocked hidden achievement card in Goals tab ── */
.ach-card.golden-card {
    border-color: #c9a22740;
    background: #0f1a08;
}

.ach-card.golden-card .ach-name {
    color: #c9a227;
}

.ach-card.golden-card .ach-bonus {
    color: #e8c54799;
}

/* ── Mystery card (locked hidden) ── */
.ach-card.hidden-mystery {
    opacity: 0.45;
    border-style: dashed;
}

/* ═══════════════════════════════════════
   PARTICLES
═══════════════════════════════════════ */
.particle {
    position: fixed;
    font-size: 20px;
    font-weight: 500;
    color: #9FE1CB;
    pointer-events: none;
    animation: float-up 1s ease-out forwards;
    z-index: 999;
}

.particle.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #5DCAA5;
    font-size: 0;
}

@keyframes float-up {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(var(--dx, 0px), var(--dy, -65px)) scale(0.4);
    }
}

.pulse-ring {
    position: absolute;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 2px solid rgba(var(--biome-a-rgb, 29, 158, 117), 0.85);
    animation: pulse-ring 0.7s ease-out forwards;
    pointer-events: none;
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 0.9;
    }

    100% {
        transform: scale(1.85);
        opacity: 0;
    }
}

/* ═══════════════════════════════════════
   SCROLL TO TOP BUTTON
═══════════════════════════════════════ */
#scroll-top-btn {
    display: none;
    position: fixed;
    bottom: max(env(safe-area-inset-bottom), 1rem);
    right: 1rem;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #0a2218;
    border: 1px solid #1D9E7560;
    color: #9FE1CB;
    font-size: 18px;
    cursor: pointer;
    z-index: 500;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    box-shadow: 0 2px 10px #00000060;
    transition: opacity 0.2s;
}

#scroll-top-btn.visible {
    display: flex;
}

#scroll-top-btn:hover {
    background: #112d1a;
}

/* Pull-to-refresh indicator */
#ptr-indicator {
    position: fixed;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: #0e2b1a;
    border: 1px solid #1D9E7540;
    border-radius: 20px;
    color: #9FE1CB;
    font-size: 12px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 9999;
    pointer-events: none;
    transition: top 0.15s;
    white-space: nowrap;
}
#ptr-indicator.ptr-ready #ptr-icon {
    transform: rotate(180deg);
    display: inline-block;
}
#ptr-indicator.ptr-ready {
    border-color: #1D9E7580;
    color: #b0f0cc;
}

/* ═══════════════════════════════════════
   PROFILE MODAL
═══════════════════════════════════════ */
#profile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 8000;
    align-items: flex-start;
    justify-content: flex-end;
    padding: max(env(safe-area-inset-top), 0.5rem) max(env(safe-area-inset-right), 0.75rem) 0;
}

#profile-overlay.open {
    display: flex;
}

#profile-modal {
    background: var(--b-bg);
    border: 1px solid rgba(var(--b-a), 0.25);
    border-radius: 14px;
    padding: 20px;
    width: 300px;
    max-width: calc(100vw - 1.5rem);
    position: relative;
    margin-top: 44px;
    /* clears the profile button */
    box-shadow: 0 8px 32px #00000080;
}

#profile-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border: none;
    background: #0a1209;
    color: #6a9d75;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, color 0.15s;
}

#profile-modal-close:hover {
    background: #1a2e1d;
    color: #9FE1CB;
}

/* Profile tabs */
#profile-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #1D9E7530;
}

.ptab {
    flex: 1;
    padding: 8px 0;
    background: transparent;
    border: none;
    color: #6a9d75;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}

.ptab.active {
    background: #1D9E7520;
    color: #9FE1CB;
}

.ptab:first-child {
    border-right: 1px solid #1D9E7530;
}

/* Profile form fields */
.p-label {
    font-size: 11px;
    color: #6a9d75;
    margin-bottom: 4px;
    display: block;
}

.p-hint {
    font-size: 10px;
    color: #4a7a55;
}

.p-input {
    display: block;
    width: 100%;
    padding: 9px 12px;
    margin-bottom: 12px;
    background: #0a1209;
    border: 1px solid #1D9E7530;
    border-radius: 8px;
    color: #d4edd8;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    user-select: text;
    -webkit-user-select: text;
    transition: border-color 0.15s;
}

.p-input:focus {
    border-color: #1D9E7560;
}

.p-submit {
    display: block;
    width: 100%;
    padding: 10px 0;
    background: #0f2e1a;
    border: 1px solid #1D9E7560;
    border-radius: 8px;
    color: #9FE1CB;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    transition: background 0.15s;
    margin-top: 4px;
}

.p-submit:hover {
    background: #152e1c;
}

.p-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Profile error */
#profile-error {
    display: none;
    font-size: 12px;
    color: #e07070;
    background: #2e1010;
    border: 1px solid #e0707040;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 12px;
    line-height: 1.4;
}

#profile-error.visible {
    display: block;
}

/* Logged-in view */
#p-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #1D9E7530;
    border: 2px solid #1D9E7560;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 500;
    color: #9FE1CB;
    margin: 0 auto 10px;
}

#p-username-display {
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    color: #d4edd8;
    margin-bottom: 4px;
}

#p-sync-status {
    text-align: center;
    font-size: 11px;
    color: #4a7a55;
    margin-bottom: 16px;
    font-style: italic;
}

.p-action-btn {
    display: block;
    width: 100%;
    padding: 9px 0;
    background: #0a2218;
    border: 1px solid #1D9E7530;
    border-radius: 8px;
    color: #9FE1CB;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    transition: background 0.15s;
    margin-bottom: 8px;
}

.p-action-btn:hover {
    background: #0f2e1a;
    border-color: #1D9E7560;
}

/* Reset Game button in modal — danger style */
.p-reset-btn {
    display: block;
    width: 100%;
    padding: 9px 0;
    background: transparent;
    border: 1px solid #7a4a4a44;
    border-radius: 8px;
    color: #e07070;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
    margin-top: 4px;
    opacity: 0.7;
}

.p-reset-btn:hover {
    background: #2e1010;
    border-color: #e0707060;
    opacity: 1;
}

/* Export / Import */
#p-savetools {
    border-top: 1px solid #1D9E7520;
    margin-top: 10px;
    padding-top: 10px;
}

#p-import-panel {
    margin-top: 6px;
}

#p-import-input {
    width: 100%;
    box-sizing: border-box;
    background: #0a1209;
    border: 1px solid #1D9E7535;
    border-radius: 8px;
    color: #9FE1CB;
    font-size: 11px;
    font-family: monospace;
    padding: 8px 10px;
    resize: vertical;
    min-height: 72px;
    margin-bottom: 6px;
    outline: none;
}

#p-import-input:focus {
    border-color: #1D9E7555;
}

#p-import-error {
    font-size: 11px;
    color: #e07070;
    min-height: 16px;
    margin-top: 2px;
    text-align: center;
}

/* Firebase not configured */
.p-notice {
    font-size: 12px;
    color: #6a9d75;
    line-height: 1.6;
    text-align: center;
    padding: 10px 0;
}

.p-notice code {
    font-size: 11px;
    background: #0a1209;
    padding: 2px 5px;
    border-radius: 4px;
    color: #9FE1CB;
}

/* ═══════════════════════════════════════
   STATS TAB
═══════════════════════════════════════ */
.stats-section-hdr {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: #5DCAA5;
    padding: 12px 12px 6px;
    text-transform: uppercase;
}

.stats-section-hdr:first-child {
    padding-top: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 0 10px 4px;
}

.stats-card {
    background: #0a1209;
    border: 1px solid #1D9E7528;
    border-radius: 10px;
    padding: 9px 10px 8px;
}

.stats-card-label {
    font-size: 10px;
    color: #4a7a55;
    margin-bottom: 3px;
    line-height: 1.3;
}

.stats-card-val {
    font-size: 18px;
    font-weight: 500;
    color: #9FE1CB;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.stats-card-sub {
    font-size: 10px;
    color: #3a5e42;
    margin-top: 3px;
    line-height: 1.3;
    font-style: italic;
}

.stats-card-wide {
    grid-column: 1 / -1;
}

.stats-mod-card .stats-card-val {
    font-size: 13px;
    color: #9FE1CB;
}

.stats-sporulate-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
}

.stats-sporulate-pct {
    font-size: 12px;
    font-weight: 600;
    color: #4a7a55;
    font-variant-numeric: tabular-nums;
}

.stats-sporulate-pct.ready {
    color: #9FE1CB;
    animation: bio-glow-text 1.8s ease-in-out infinite;
}

@keyframes bio-glow-text {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.stats-progress-track {
    height: 4px;
    background: #1D9E7515;
    border-radius: 3px;
    overflow: hidden;
    margin: 6px 0 4px;
}

.stats-progress-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #1D9E75, #5DCAA5);
    transition: width 0.4s ease;
}

.stats-progress-fill.ready {
    background: linear-gradient(90deg, #5DCAA5, #9FE1CB);
}

/* ═══════════════════════════════════════
   ESSENCE / MYCELIAL CODEX TAB
═══════════════════════════════════════ */
.essence-header {
    padding: 12px 12px 8px;
    border-bottom: 1px solid #1D9E7518;
}

.essence-balance {
    margin-bottom: 3px;
}

.essence-bal-val {
    font-size: 22px;
    font-weight: 500;
    color: #EF9F27;
}

.essence-bal-label {
    font-size: 13px;
    color: #6a9d75;
}

.essence-hint {
    font-size: 11px;
    color: #4a7a55;
    font-style: italic;
}

.essence-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 8px 10px 12px;
}

.essence-branch-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border-bottom: 1px solid #1D9E7520;
    margin: 0;
}

.essence-branch-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 4px 7px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #4a7a55;
    font-size: 10px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s, border-color 0.15s;
    letter-spacing: 0.03em;
}

.essence-branch-tab:hover {
    color: #9FE1CB;
}

.essence-branch-tab.active {
    border-bottom-width: 2px;
    border-bottom-style: solid;
}

.essence-branch-locked-msg {
    text-align: center;
    font-size: 12px;
    color: #4a7a55;
    padding: 24px 16px;
    line-height: 1.8;
    font-style: italic;
}

.essence-branch {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}

.essence-branch-hdr {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    text-align: center;
    padding: 6px 4px 5px;
}

.essence-node {
    background: #0a1209;
    border: 1px solid #1D9E7520;
    border-radius: 8px;
    padding: 8px 7px;
    transition: border-color 0.15s;
}

.essence-node.bought {
    border-color: #1D9E7545;
    background: #0d1e10;
}

.essence-node.available {
    border-color: #1D9E7540;
}

.essence-node.available:hover {
    border-color: #1D9E7570;
    background: #0f2014;
}

.essence-node.locked {
    opacity: 0.4;
}

.essence-node-name {
    font-size: 11px;
    font-weight: 500;
    color: #d4edd8;
    margin-bottom: 2px;
    line-height: 1.3;
}

.essence-node-effect {
    font-size: 10px;
    color: #5DCAA5;
    font-weight: 500;
    margin-bottom: 4px;
    line-height: 1.3;
}

.essence-node-desc {
    font-size: 10px;
    color: #4a7a55;
    line-height: 1.4;
    margin-bottom: 5px;
    font-style: italic;
}

.essence-node-owned {
    font-size: 10px;
    font-weight: 600;
    color: #5DCAA5;
    letter-spacing: 0.04em;
}

.essence-node-locked {
    font-size: 10px;
    color: #3a5e42;
}

.essence-buy-btn {
    width: 100%;
    padding: 5px 4px;
    border-radius: 6px;
    border: 1px solid #EF9F2755;
    background: #1a1209;
    color: #EF9F27;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    touch-action: auto;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    transition: background 0.15s;
}

.essence-buy-btn:hover:not(:disabled) {
    background: #2a1e09;
}

.essence-buy-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

.essence-connector {
    text-align: center;
    font-size: 11px;
    color: #2a4e32;
    padding: 2px 0;
    line-height: 1;
}

/* ═══════════════════════════════════════
   INFO TOOLTIPS (ⓘ on season / event)
═══════════════════════════════════════ */
.info-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.info-icon {
    font-size: 11px;
    color: #3a6e4a;
    cursor: default;
    line-height: 1;
    transition: color 0.15s;
    user-select: none;
    -webkit-user-select: none;
}

.info-tip:hover .info-icon {
    color: #9FE1CB;
}

.info-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    background: #0a1e12;
    border: 1px solid #1D9E7550;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 11px;
    color: #9FE1CB;
    white-space: pre-wrap;
    /* preserve \n breaks AND wrap long lines */
    word-break: break-word;
    line-height: 1.6;
    min-width: 160px;
    max-width: 210px;
    box-shadow: 0 4px 16px #00000070;
    z-index: 200;
    pointer-events: none;
    text-align: left;
}

/* Both season and event sit near the top of the panel — open downward to avoid clipping */
#season-tip-wrap .info-tooltip,
#event-tip-wrap .info-tooltip {
    bottom: auto;
    top: calc(100% + 6px);
    right: 0;
    left: auto;
}

/* Stats tab biome card — open upward, anchor left so it doesn't clip right edge */
.stats-biome-tooltip {
    right: auto;
    left: 0;
    bottom: calc(100% + 6px);
}

.info-tip:hover .info-tooltip {
    display: block;
}

/* (biome chip moved to main panel #biome-bar) */
/* ═══════════════════════════════════════
   SETTINGS MODAL
═══════════════════════════════════════ */
#settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 8000;
    align-items: flex-start;
    justify-content: flex-end;
    padding: max(env(safe-area-inset-top), 0.5rem) max(env(safe-area-inset-right), 0.75rem) 0;
}

#settings-overlay.open {
    display: flex;
}

#settings-modal {
    background: var(--b-bg);
    border: 1px solid rgba(var(--b-a), 0.25);
    border-radius: 14px;
    padding: 20px;
    width: 300px;
    max-width: calc(100vw - 1.5rem);
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    margin-top: 44px;
    box-shadow: 0 8px 32px #00000080;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.settings-title {
    font-size: 14px;
    font-weight: 500;
    color: #9FE1CB;
}

#settings-modal-close {
    width: 28px;
    height: 28px;
    border: none;
    background: #0a1209;
    color: #6a9d75;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

#settings-modal-close:hover {
    background: #1a2e1d;
    color: #9FE1CB;
}

.settings-section-hdr {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: #3a6e4a;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid #1D9E7518;
}

.settings-row-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.settings-row-label {
    font-size: 13px;
    font-weight: 500;
    color: #d4edd8;
}

.settings-row-desc {
    font-size: 11px;
    color: #4a7a55;
    font-style: italic;
}

/* Toggle switch */
.settings-toggle-wrap {
    position: relative;
    flex-shrink: 0;
    cursor: pointer;
}

.settings-toggle-wrap input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}

.settings-toggle-track {
    display: block;
    width: 42px;
    height: 24px;
    background: #1D9E7520;
    border: 1px solid #1D9E7540;
    border-radius: 12px;
    position: relative;
    transition: background 0.25s, border-color 0.25s;
}

.settings-toggle-wrap input:checked+.settings-toggle-track {
    background: #1D9E7545;
    border-color: #1D9E7570;
}

.settings-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #4a7a55;
    border-radius: 50%;
    transition: transform 0.25s, background 0.25s;
    pointer-events: none;
}

.settings-toggle-wrap input:checked+.settings-toggle-track .settings-toggle-thumb {
    transform: translateX(18px);
    background: #5DCAA5;
}

/* Event tone sub-row (indented, only shown when events on) */
.settings-subrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0 10px 12px;
    border-left: 2px solid #1D9E7525;
    margin-left: 4px;
    margin-bottom: 2px;
}

.settings-subrow-label {
    font-size: 11px;
    color: #6a9d75;
    white-space: nowrap;
}

/* Segmented control */
.settings-seg {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #1D9E7530;
    flex-shrink: 0;
}

.seg-btn {
    padding: 5px 11px;
    background: transparent;
    border: none;
    color: #6a9d75;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.seg-btn:first-child {
    border-right: 1px solid #1D9E7530;
}

.seg-btn.active {
    background: #1D9E7525;
    color: #9FE1CB;
}

#seg-disaster.active {
    background: #3d0f0f;
    color: #e07070;
}

.settings-action-btn {
    padding: 6px 14px;
    background: #0a2218;
    border: 1px solid #1D9E7540;
    border-radius: 20px;
    color: #9FE1CB;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}
.settings-action-btn:hover {
    background: #112d1a;
    border-color: #1D9E7560;
}

.settings-note {
    font-size: 10px;
    color: #3a5e42;
    font-style: italic;
    text-align: center;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #1D9E7515;
}

/* ── Dev Tools ── */
.dev-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
    border-top: 1px solid #1D9E7510;
    gap: 10px;
}
.dev-label {
    font-size: 12px;
    color: #6a9d75;
    flex-shrink: 0;
}
.dev-input-group {
    display: flex;
    gap: 6px;
    align-items: center;
}
.dev-input {
    width: 120px;
    background: #0a1a0d;
    border: 1px solid #1D9E7530;
    border-radius: 5px;
    color: #9FE1CB;
    font-size: 12px;
    padding: 4px 7px;
    text-align: right;
}
.dev-btn {
    background: #0f2015;
    border: 1px solid #1D9E7540;
    border-radius: 6px;
    color: #5DCAA5;
    font-size: 12px;
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.dev-btn:hover { background: #1a3020; }
.dev-btn-sm { padding: 4px 10px; }

/* ═══════════════════════════════════════
   SPORULATE BIOME PICKER (B5 Pathfinder)
═══════════════════════════════════════ */
#spor-biome-picker {
    display: none;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #1D9E7520;
}

.spor-biome-picker-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #4a7a55;
    margin-bottom: 6px;
    text-align: center;
}

#spor-biome-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}

.spor-biome-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 4px;
    background: #0a1209;
    border: 1px solid #1D9E7525;
    border-radius: 7px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
}

.spor-biome-btn:hover {
    background: #0f2014;
    border-color: #1D9E7550;
}

.spor-biome-btn.selected {
    background: #1D9E7520;
    border-color: #1D9E7570;
}

.spor-biome-btn-emoji {
    font-size: 14px;
    line-height: 1;
}

.spor-biome-btn-name {
    font-size: 8px;
    color: #6a9d75;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.spor-biome-btn.selected .spor-biome-btn-name {
    color: #9FE1CB;
}

/* ═══════════════════════════════════════
   LEADERBOARD (modal)
═══════════════════════════════════════ */
.lb-wrap {
    border: 1px solid #1D9E7525;
    border-radius: 10px;
    overflow: hidden;
}

.lb-loading {
    padding: 14px;
    text-align: center;
    font-size: 11px;
    color: #4a7a55;
    font-style: italic;
}

.lb-signin-msg {
    padding: 16px 14px;
    text-align: center;
    font-size: 12px;
    color: #4a7a55;
    font-style: italic;
    line-height: 1.5;
    border: 1px dashed #1D9E7530;
    border-radius: 8px;
    margin: 4px 0 8px;
}

.lb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.lb-table thead tr {
    background: #0a1209;
    border-bottom: 1px solid #1D9E7520;
}

.lb-table th {
    padding: 7px 8px;
    color: #3a6e4a;
    font-weight: 600;
    font-size: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.lb-table tbody tr {
    border-bottom: 1px solid #1D9E7510;
    transition: background 0.1s;
}

.lb-table tbody tr:last-child {
    border-bottom: none;
}

.lb-table tbody tr:hover {
    background: #0f1e1180;
}

.lb-table td {
    padding: 7px 8px;
    color: #6a9d75;
}

.lb-rank {
    width: 28px;
    text-align: center;
    color: #3a5e42 !important;
    font-weight: 600;
}

.lb-name {
    font-weight: 500;
    color: #9FE1CB !important;
}

.lb-score {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.lb-pres {
    width: 60px;
    text-align: center;
    color: #4a7a55 !important;
}

.lb-me {
    background: #1D9E7512 !important;
}

.lb-me td {
    color: #9FE1CB !important;
}

.lb-me .lb-rank {
    color: #EF9F27 !important;
}

.lb-empty {
    text-align: center;
    padding: 14px !important;
    color: #3a5e42 !important;
    font-style: italic;
}

.lb-me-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #5DCAA5;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
    position: relative;
    top: -1px;
    flex-shrink: 0;
}

.p-signout-btn {
    display: block;
    width: 100%;
    padding: 9px 0;
    background: transparent;
    border: 1px solid #1D9E7525;
    border-radius: 8px;
    color: #6a9d75;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    margin-top: 8px;
}

.p-signout-btn:hover {
    background: #0f2e1a;
    border-color: #1D9E7540;
    color: #9FE1CB;
}

/* ═══════════════════════════════════════
   TUTORIAL
═══════════════════════════════════════ */
#tutorial-card {
    position: fixed;
    z-index: 502;
    width: 230px;
    top: 140px;
    right: 16px;
    background: #0b1e10;
    border: 1px solid #1D9E7580;
    border-radius: 14px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55), 0 0 0 1px #1D9E7518;
    display: none;
    pointer-events: all;
}

/* On screens where the game fills the full width, drop to bottom-center */
@media (max-width: 1020px) {
    #tutorial-card {
        width: calc(100vw - 32px);
        max-width: 420px;
        top: auto;
        right: auto;
        bottom: 16px;
        left: 50%;
        transform: translateX(-50%);
    }
}

#tutorial-inner {
    padding: 13px 15px 11px;
}

#tutorial-step-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #3a7a55;
    margin-bottom: 5px;
}

#tutorial-emoji {
    font-size: 20px;
    margin-bottom: 5px;
    line-height: 1;
}

#tutorial-msg {
    font-size: 11.5px;
    color: #9FE1CB;
    line-height: 1.5;
    margin-bottom: 9px;
}

#tutorial-skip {
    font-size: 11px;
    background: transparent;
    border: 1px solid #1D9E7540;
    color: #5DCAA5;
    border-radius: 7px;
    padding: 4px 11px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
    -webkit-tap-highlight-color: transparent;
    display: block;
}

#tutorial-skip:hover {
    background: #1D9E7518;
    border-color: #1D9E7570;
}

/* Arrows — hidden, focus ring does the job */
#tutorial-arrow-up,
#tutorial-arrow-down,
#tutorial-arrow-right {
    display: none !important;
}

/* Focus ring on highlighted element */
.tutorial-focus {
    outline: 2px solid rgba(29, 158, 117, 0.9) !important;
    outline-offset: 3px;
    border-radius: 8px;
    animation: tut-focus-pulse 1.8s ease-in-out infinite;
}

@keyframes tut-focus-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0px rgba(29, 158, 117, 0.3), 0 0 14px rgba(29, 158, 117, 0.2);
    }

    50% {
        box-shadow: 0 0 0 4px rgba(29, 158, 117, 0.12), 0 0 22px rgba(29, 158, 117, 0.3);
    }
}

/* ══════════════════════════════════════════════════════
   BOND SEASON AFFINITY
   ══════════════════════════════════════════════════════ */
.sym-season-tag {
    display: inline-block;
    font-size: 10px;
    color: #4a7a55;
    background: #1D9E7510;
    border: 1px solid #1D9E7520;
    border-radius: 5px;
    padding: 2px 7px;
    margin: 4px 0 2px;
    transition: color 0.3s, background 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.sym-season-eternal {
    color: #3a5e50;
    border-color: #1D9E7515;
}
.sym-season-active {
    color: #9FE1CB;
    background: #1D9E7522;
    border-color: #5DCAA560;
    box-shadow: 0 0 8px rgba(93, 202, 165, 0.25);
    animation: season-pulse 2s ease-in-out infinite;
}
@keyframes season-pulse {
    0%, 100% { box-shadow: 0 0 6px rgba(93, 202, 165, 0.2); }
    50%       { box-shadow: 0 0 14px rgba(93, 202, 165, 0.45); }
}

/* ══════════════════════════════════════════════════════
   SYNERGY UPGRADES
   ══════════════════════════════════════════════════════ */
.badge.synergy-badge {
    background: #1a3a5a;
    color: #70b8e8;
    border: 1px solid #70b8e830;
}
.synergy-link-row {
    font-size: 10.5px;
    color: #5a9abf;
    margin-top: 5px;
    padding-top: 4px;
    border-top: 1px solid #1D9E7518;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}
.synergy-arrow {
    color: #70b8e8;
    font-weight: 700;
}

/* ══════════════════════════════════════════════════════
   EVENT DECISION UI
   ══════════════════════════════════════════════════════ */
.event-decision-opts {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}
.event-decision-btn {
    width: 100%;
    padding: 7px 10px;
    border-radius: 7px;
    border: 1px solid;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    line-height: 1.4;
    transition: background 0.15s, border-color 0.15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.event-decision-btn.accept {
    background: #1D9E7518;
    border-color: #5DCAA540;
    color: #9FE1CB;
}
.event-decision-btn.accept:hover:not(:disabled) {
    background: #1D9E7528;
    border-color: #5DCAA570;
}
.event-decision-btn.accept:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.event-decision-btn.decline {
    background: transparent;
    border-color: #ffffff14;
    color: #6a8a75;
}
.event-decision-btn.decline:hover {
    background: #ffffff08;
    border-color: #ffffff22;
}
.event-decision-cost {
    font-size: 10px;
    color: #5DCAA5;
    font-weight: 600;
}
.event-decision-timer {
    font-size: 10px;
    color: #4a6a55;
    margin-top: 6px;
    text-align: center;
}

/* ── Run Modifier Pill ── */
.spill-mod {
    border-color: #5DCAA530;
}
.spill-mod .spill-text {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Sporulate panel modifier row ── */
.spor-mod-label {
    font-size: 11px;
    color: #8aad95;
    margin-bottom: 2px;
}
.spor-mod-desc-row {
    font-size: 11px;
    color: #6a9d75;
    font-style: italic;
    margin-top: 0;
    padding-top: 0;
}
#spor-reroll-btn {
    margin: 6px auto 0;
    display: block;
    padding: 6px 14px;
    border-radius: 7px;
    border: 1px solid #EF9F2740;
    background: #EF9F2712;
    color: #EF9F27;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, border-color 0.15s;
}
#spor-reroll-btn:hover:not(:disabled) {
    background: #EF9F2722;
    border-color: #EF9F2770;
}
#spor-reroll-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
#spor-modifier-row {
    border-top: 1px solid #1D9E7518;
    padding-top: 8px;
    margin-top: 4px;
}

/* ── Biome Objectives in Goals tab ── */
.biome-obj-section {
    margin: 4px 0 8px;
    border-radius: 8px;
    background: #ffffff04;
    padding: 6px 8px;
    border: 1px solid #1D9E7510;
}
.biome-obj-section.current-biome {
    border-color: #1D9E7530;
    background: #1D9E7508;
}
.biome-obj-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: #9FE1CB;
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}
.biome-obj-current-badge {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #5DCAA5;
    background: #1D9E7520;
    border: 1px solid #1D9E7540;
    padding: 1px 6px;
    border-radius: 10px;
}
.biome-obj-card {
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #ffffff0a;
    background: transparent;
    margin-bottom: 5px;
}
.biome-obj-card.done {
    border-color: #1D9E7530;
    background: #1D9E7510;
}
.biome-obj-card.locked {
    opacity: 0.45;
}
.biome-obj-label {
    font-size: 11px;
    font-weight: 600;
    color: #b0cdb5;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.biome-obj-done {
    color: #5DCAA5;
    font-weight: 700;
    font-size: 12px;
}
.biome-obj-desc {
    font-size: 10px;
    color: #5a7a65;
    line-height: 1.45;
}
.biome-obj-reward {
    font-size: 10px;
    color: #EF9F2780;
    margin-top: 3px;
}

/* ═══════════════════════════════════════
   END-GAME OVERLAY
═══════════════════════════════════════ */
#endgame-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.92);
    align-items: center;
    justify-content: center;
    animation: eg-fade-in 1.4s ease forwards;
}
#endgame-overlay.visible {
    display: flex;
}
@keyframes eg-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
#endgame-modal {
    max-width: 520px;
    width: 90%;
    text-align: center;
    padding: 48px 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}
#endgame-symbol {
    font-size: 64px;
    animation: eg-pulse 3s ease-in-out infinite;
}
@keyframes eg-pulse {
    0%, 100% { transform: scale(1);   opacity: 1; }
    50%       { transform: scale(1.1); opacity: 0.7; }
}
#endgame-title {
    font-family: 'Cinzel', serif;
    font-size: 28px;
    font-weight: 400;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #c4b5fd;
    text-shadow: 0 0 40px #a78bfa80, 0 0 80px #a78bfa30;
    min-height: 1.4em;
}
#endgame-text {
    display: flex;
    flex-direction: column;
    gap: 12px;
    color: #8877bb;
    font-size: 14px;
    line-height: 1.7;
    font-style: italic;
    max-width: 400px;
}
#endgame-text p:first-child {
    font-size: 17px;
    color: #c4b5fd;
    font-style: normal;
    font-weight: 500;
}
#endgame-dismiss {
    margin-top: 10px;
    padding: 10px 36px;
    background: transparent;
    border: 1px solid #a78bfa60;
    border-radius: 8px;
    color: #a78bfa;
    font-size: 14px;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
#endgame-dismiss:hover {
    background: #a78bfa15;
    border-color: #a78bfa;
}

/* ── Congrats overlay ── */
#congrats-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.94);
    align-items: center;
    justify-content: center;
    animation: eg-fade-in 0.6s ease forwards;
}
#congrats-overlay.visible {
    display: flex;
}
#congrats-modal {
    max-width: 480px;
    width: 90%;
    text-align: center;
    padding: 48px 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    border: 1px solid #C9920A40;
    border-radius: 12px;
    background: rgba(10, 7, 0, 0.6);
    box-shadow: 0 0 80px #C9920A18, 0 0 160px #C9920A08;
}
#congrats-symbol {
    font-size: 64px;
    animation: congrats-bounce 2s ease-in-out infinite;
}
@keyframes congrats-bounce {
    0%, 100% { transform: scale(1) rotate(-3deg); }
    50%       { transform: scale(1.12) rotate(3deg); }
}
#congrats-title {
    font-family: 'Cinzel', serif;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #F5C842;
    text-shadow: 0 0 30px #C9920A80, 0 0 60px #C9920A30;
}
#congrats-text {
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: #B8A060;
    font-size: 14px;
    line-height: 1.75;
    max-width: 380px;
}
#congrats-text p:first-child {
    font-size: 16px;
    color: #F5C842;
    font-weight: 500;
}
#congrats-text strong {
    color: #F5C842;
    font-weight: 600;
}
#congrats-dismiss {
    margin-top: 6px;
    padding: 11px 44px;
    background: transparent;
    border: 1px solid #C9920A80;
    border-radius: 8px;
    color: #F5C842;
    font-size: 14px;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
#congrats-dismiss:hover {
    background: #C9920A18;
    border-color: #F5C842;
    box-shadow: 0 0 18px #C9920A30;
}

/* ── Reset confirm modal ── */
#reset-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10002;
    background: rgba(0, 0, 0, 0.72);
    align-items: center;
    justify-content: center;
}
#reset-overlay.visible {
    display: flex;
}
#reset-modal {
    max-width: 380px;
    width: 90%;
    background: var(--b-bg);
    border: 1px solid rgba(var(--b-a), 0.35);
    border-radius: 12px;
    padding: 36px 32px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
    animation: eg-fade-in 0.18s ease forwards;
}
#reset-modal-icon {
    font-size: 36px;
    opacity: 0.85;
}
#reset-modal-title {
    font-family: 'Cinzel', serif;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: #e87070;
}
#reset-modal-desc {
    font-size: 13px;
    color: rgba(var(--b-b), 0.7);
    line-height: 1.65;
    max-width: 300px;
}
#reset-modal-desc strong {
    color: #e87070;
    font-weight: 600;
}
#reset-modal-btns {
    display: flex;
    gap: 12px;
    margin-top: 6px;
    width: 100%;
    justify-content: center;
}
#reset-cancel-btn {
    padding: 9px 28px;
    background: transparent;
    border: 1px solid rgba(var(--b-a), 0.4);
    border-radius: 7px;
    color: rgba(var(--b-b), 0.8);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
#reset-cancel-btn:hover {
    background: rgba(var(--b-a), 0.1);
    border-color: rgba(var(--b-a), 0.7);
}
#reset-confirm-btn {
    padding: 9px 28px;
    background: transparent;
    border: 1px solid #e8707060;
    border-radius: 7px;
    color: #e87070;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
#reset-confirm-btn:hover {
    background: #e8707015;
    border-color: #e87070;
    box-shadow: 0 0 12px #e8707025;
}

/* ── Offline progress modal ── */
#offline-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 10003;
    align-items: center;
    justify-content: center;
    animation: eg-fade-in 0.3s ease forwards;
}
#offline-overlay.visible {
    display: flex;
}
#offline-modal {
    background: #0a1a10;
    border: 1px solid #1D9E7540;
    border-radius: 14px;
    padding: 32px 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 340px;
    width: 90%;
    box-shadow: 0 0 40px #1D9E7520;
    text-align: center;
}
#offline-modal-icon {
    font-size: 40px;
    line-height: 1;
}
#offline-modal-title {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: #9FE1CB;
    font-weight: 400;
}
#offline-modal-time {
    font-size: 13px;
    color: #5b9e77;
}
#offline-modal-earned {
    font-size: 22px;
    font-weight: 600;
    color: #9FE1CB;
    text-shadow: 0 0 16px #1D9E7560;
}
#offline-modal-close {
    margin-top: 8px;
    padding: 10px 32px;
    background: transparent;
    border: 1px solid #1D9E7560;
    border-radius: 8px;
    color: #9FE1CB;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
#offline-modal-close:hover {
    background: #1D9E7515;
    border-color: #1D9E75;
}

/* ── Achievement progress bars ── */
.ach-progress-wrap {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ach-progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
}
.ach-progress-fill {
    height: 100%;
    background: #3a7a52;
    border-radius: 2px;
    transition: width 0.3s;
}
.ach-progress-label {
    font-size: 10px;
    color: #4a7a55;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════
   PERSISTENT TRANSCENDENCE — VOID GOLD
   Strategy: hue-rotate(244deg) on #game and
   #page-header shifts all greens to gold.
   Glow values inside those containers use
   pre-filter greens that render as gold.
═══════════════════════════════════════ */

/* Gold mode overrides */
body.transcended {
    background: #0A0700;
}

/* Modals also go gold */
body.transcended #profile-modal,
body.transcended #settings-modal,
body.transcended #lb-modal {
    filter: hue-rotate(240deg) saturate(0.9) brightness(1.0);
}

/* Core filter — entire game UI shifts green → soft amber gold */
body.transcended #game {
    filter: hue-rotate(240deg) saturate(0.9) brightness(1.0);
    box-shadow: inset 0 0 80px #1D9E7506, 0 0 80px #1D9E7508;
}

body.transcended #page-header {
    filter: hue-rotate(240deg) saturate(0.9) brightness(1.0);
}

/* Canvas handled by parent #game filter — no separate filter needed */
body.transcended #mycelium-canvas {
    filter: none;
    transition: none;
}

/* Title ✦ emblem — #9FE1CB green pre-filter renders as bright gold */
#page-header.transcended h1::after {
    content: ' ✦';
    font-size: 12px;
    color: #9FE1CB;
    vertical-align: middle;
    animation: transcend-star-pulse 3s ease-in-out infinite;
}

@keyframes transcend-star-pulse {
    0%, 100% { opacity: 0.5; text-shadow: none; }
    50%       { opacity: 1;   text-shadow: 0 0 14px #9FE1CB; }
}

/* Spore button — green glow pre-filter values render as gold pulse */
#spore-btn.transcended {
    animation: transcend-btn-pulse 4s ease-in-out infinite;
}

@keyframes transcend-btn-pulse {
    0%, 100% { box-shadow: 0 0 22px 4px #1D9E7525, 0 0 55px 10px #1D9E750c; }
    50%       { box-shadow: 0 0 42px 12px #1D9E7540, 0 0 90px 22px #1D9E7518; }
}

/* Tab bar gold shimmer */
body.transcended #tab-btns {
    border-top: 1px solid #9FE1CB15;
    background: linear-gradient(to bottom, #9FE1CB04 0%, transparent 6px);
}

/* Scroll-to-top button also gold */
body.transcended #scroll-top-btn {
    filter: hue-rotate(240deg) saturate(0.9) brightness(1.0);
}

/* Tap/click floating numbers — outside #game so need direct override */
body.transcended .particle {
    color: #D4A832;
    text-shadow: 0 0 8px #C9920A60;
}
body.transcended .particle.dot {
    background: #C9920A;
    box-shadow: 0 0 4px #C9920A80;
}

/* Star field canvas */
#star-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
}

/* ═══════════════════════════════════════
   KO-FI SUPPORT BUTTON
═══════════════════════════════════════ */
#kofi-bar {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 9999;
}

/* Ko-fi in settings modal — desktop: hidden, mobile: visible */
#settings-kofi-row {
    display: none;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
    text-align: center;
}

#settings-kofi-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    background: #ff5e5b;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 20px;
    transition: background 0.2s;
}

#settings-kofi-btn:hover {
    background: #ff3b38;
}

@media (max-width: 600px) {
    #kofi-bar {
        display: none;
    }
    #settings-kofi-row {
        display: block;
    }
}

#kofi-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    background: #ff5e5b;
    color: #fff;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    white-space: nowrap;
}

#kofi-btn:hover {
    background: #ff3b38;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.5);
}

#kofi-cup {
    width: 20px;
    height: 20px;
    object-fit: contain;
}