/* ============================================================
   K-Life UI Polish — Claymorphism dark adaptation
   Design system: design-system/k-life/MASTER.md
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Nunito:wght@400;500;600;700;800&display=swap');

:root {
    --font-heading: 'Fredoka', 'Outfit', sans-serif;
    --font-body: 'Nunito', 'Outfit', sans-serif;
    --color-primary: #ec4899;
    --color-secondary: #8b5cf6;
    --color-accent: #f59e0b;
    --clay-radius: 18px;
    --clay-border: 3px;
    --clay-shadow-out: 0 8px 0 rgba(0, 0, 0, 0.25), 0 12px 28px rgba(0, 0, 0, 0.35);
    --clay-shadow-in: inset 0 2px 8px rgba(255, 255, 255, 0.08), inset 0 -4px 12px rgba(0, 0, 0, 0.25);
    --ease-bounce: cubic-bezier(0.34, 1.4, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --dur-fast: 180ms;
    --dur-med: 280ms;
    --dur-slow: 450ms;
    /*
     * Modal height policy
     * ─────────────────────────────────────────────────────────────
     * ONLY raise height when: (1) panel was scrolling AND
     * (2) viewport still had free space. Do NOT inflate all popups.
     *
     * FIXED_TAB — keep pre-existing caps (85dvh / 620–720). Tab sync.
     * FIT       — height:auto; max-height only. Used for check-in:
     *             was locked to 640px fixed → forced scroll on desktop
     *             while free space remained. Now grows with content
     *             up to fit-max, then scrolls.
     * COMPACT   — content height only.
     */
    /* Default fixed panels (friends/quests/bag…) — keep original density */
    --klife-modal-fixed-h: min(85dvh, 680px);
    --klife-modal-fixed-h-sm: min(85dvh, 620px);
    --klife-modal-fixed-h-lg: min(85dvh, 720px);
    /* Long-list panels measured INCREASE_OK (scroll + free viewport) —
       use remaining viewport instead of low px caps leaving empty room */
    --klife-modal-fixed-h-list: min(90dvh, calc(100dvh - var(--klife-pad-top, 0px) - var(--klife-pad-bottom, 0px) - 40px));
    --klife-modal-fit-max: min(92dvh, calc(100dvh - var(--klife-pad-top, 0px) - var(--klife-pad-bottom, 0px) - 32px));
    --klife-checkin-day-size: 40px;
}
@media (max-width: 768px) {
    :root {
        --klife-modal-fixed-h: min(88dvh, calc(100dvh - var(--klife-pad-top, 0px) - var(--klife-pad-bottom, 0px) - 24px), 720px);
        --klife-modal-fixed-h-sm: min(88dvh, calc(100dvh - var(--klife-pad-top, 0px) - var(--klife-pad-bottom, 0px) - 24px), 720px);
        --klife-modal-fixed-h-lg: min(88dvh, calc(100dvh - var(--klife-pad-top, 0px) - var(--klife-pad-bottom, 0px) - 24px), 720px);
        --klife-modal-fixed-h-list: min(90dvh, calc(100dvh - var(--klife-pad-top, 0px) - var(--klife-pad-bottom, 0px) - 20px));
        --klife-modal-fit-max: min(92dvh, calc(100dvh - var(--klife-pad-top, 0px) - var(--klife-pad-bottom, 0px) - 16px));
        --klife-checkin-day-size: 36px;
    }
}

body {
    font-family: var(--font-body);
}

.player-name,
.panel-title,
.logo-title,
#farm-view-title-header,
.animal-shelter-card__title,
.farm-tab-btn {
    font-family: var(--font-heading);
}

/* ── Ambient background — leaf pattern + shimmer ── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.35;
    background: url('../assets/bg_leaves_pattern.png') center / 420px repeat;
    animation: leaf-pattern-drift 42s linear infinite;
}

@keyframes leaf-pattern-drift {
    0% { background-position: 0 0; }
    100% { background-position: 420px 280px; }
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 60% 40% at 15% 10%, rgba(236, 72, 153, 0.1), transparent 55%),
        radial-gradient(ellipse 50% 35% at 85% 90%, rgba(245, 158, 11, 0.09), transparent 50%),
        radial-gradient(ellipse 40% 30% at 70% 20%, rgba(139, 92, 246, 0.08), transparent 45%),
        linear-gradient(180deg, rgba(8, 12, 24, 0.35) 0%, rgba(12, 18, 32, 0.15) 50%, rgba(8, 12, 24, 0.4) 100%);
    animation: ambient-drift 18s ease-in-out infinite alternate;
}

@keyframes ambient-drift {
    0% { opacity: 0.7; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.03); }
}

#game-screen { position: relative; z-index: 1; }

/* ── App screen transitions (splash → login → game) ── */
#login-screen,
#game-screen {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
    transition: opacity var(--dur-med) var(--ease-smooth), transform var(--dur-med) var(--ease-bounce);
}

#login-screen.klife-screen--visible,
#game-screen.klife-screen--visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

#login-screen.klife-screen--enter,
#game-screen.klife-screen--enter {
    animation: screen-enter 0.42s var(--ease-bounce) both;
}

#login-screen.klife-screen--exit,
#game-screen.klife-screen--exit {
    animation: screen-exit 0.36s var(--ease-smooth) both;
}

@keyframes screen-enter {
    0% { opacity: 0; transform: translateY(14px) scale(0.97); filter: blur(4px); }
    100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes screen-exit {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-8px) scale(0.98); }
}

.app-splash.hide {
    opacity: 0 !important;
    transform: scale(1.02);
    transition: opacity 0.42s var(--ease-smooth), transform 0.42s var(--ease-smooth) !important;
}

/* ── Glass panels — clay upgrade ── */
.glass-panel {
    background: linear-gradient(155deg, rgba(22, 28, 45, 0.82), rgba(12, 16, 28, 0.72));
    border: var(--clay-border) solid rgba(255, 255, 255, 0.06);
    box-shadow: var(--clay-shadow-out), var(--clay-shadow-in);
}

/* ── HUD bar ── */
.hud-bar {
    background: linear-gradient(160deg, rgba(24, 30, 48, 0.9), rgba(14, 18, 32, 0.85)) !important;
    border: var(--clay-border) solid rgba(255, 255, 255, 0.07) !important;
}

.avatar {
    border: 3px solid rgba(236, 72, 153, 0.45);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3), 0 0 16px rgba(236, 72, 153, 0.25);
    transition: transform var(--dur-med) var(--ease-bounce), box-shadow var(--dur-med);
}

.avatar:hover { transform: scale(1.05); }

.level-badge {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.35), rgba(236, 72, 153, 0.2));
    border: 2px solid rgba(192, 132, 252, 0.4);
    font-family: var(--font-heading);
}

.stat-pill {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)) !important;
    border: 2px solid rgba(251, 191, 36, 0.25) !important;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: transform var(--dur-fast) var(--ease-bounce), box-shadow var(--dur-fast);
}

.stat-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 0 rgba(0, 0, 0, 0.2), 0 0 12px rgba(251, 191, 36, 0.15);
}

.btn-shop {
    border: 2px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
    font-family: var(--font-heading) !important;
    letter-spacing: 0.02em;
    transition: transform var(--dur-fast) var(--ease-bounce), box-shadow var(--dur-fast), filter var(--dur-fast) !important;
}

.btn-shop:hover {
    transform: translateY(-3px) !important;
    filter: brightness(1.08);
}

.btn-shop:active {
    transform: translateY(1px) !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25) !important;
}

.btn-shop img {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
    transition: transform var(--dur-fast) var(--ease-bounce);
}

.btn-shop:hover img {
    transform: scale(1.12) rotate(-3deg);
}

.exp-bar-fill {
    background: linear-gradient(90deg, #ec4899, #8b5cf6, #c084fc) !important;
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.5);
}

/* ── Farm plots container ── */
.farm-plots-container {
    border: var(--clay-border) solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: var(--clay-shadow-out), var(--clay-shadow-in) !important;
    transition: background-image var(--dur-slow) var(--ease-smooth), box-shadow var(--dur-med);
}

.farm-plots-container.farm-view--animals {
    box-shadow:
        0 8px 0 rgba(0, 0, 0, 0.25),
        0 12px 28px rgba(0, 0, 0, 0.35),
        0 0 40px rgba(245, 158, 11, 0.08),
        inset 0 2px 8px rgba(255, 255, 255, 0.06) !important;
}

.farm-plots-bg-blur {
    background: radial-gradient(ellipse 80% 75% at 50% 45%, transparent 45%, rgba(8, 10, 20, 0.75) 100%) !important;
}

/* Pasture ambient particles */
.farm-pasture-ambient {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    border-radius: inherit;
}

.farm-pasture-ambient::before,
.farm-pasture-ambient::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    animation: pasture-glow 6s ease-in-out infinite alternate;
}

.farm-pasture-ambient::before {
    width: 180px;
    height: 180px;
    top: 10%;
    left: 8%;
    background: rgba(16, 185, 129, 0.18);
}

.farm-pasture-ambient::after {
    width: 140px;
    height: 140px;
    bottom: 15%;
    right: 10%;
    background: rgba(245, 158, 11, 0.15);
    animation-delay: -3s;
}

@keyframes pasture-glow {
    0% { opacity: 0.5; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1.15); }
}

.farm-pasture-sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
    animation: sparkle-float 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes sparkle-float {
    0%, 100% { opacity: 0; transform: translateY(0) scale(0.5); }
    30%, 70% { opacity: 1; transform: translateY(-12px) scale(1); }
}

/* ── Farm tab switcher ── */
.farm-switch-tabbar {
    display: flex;
    position: relative;
    z-index: 3;
    background: rgba(8, 12, 22, 0.75);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 5px;
    border-radius: 16px;
    margin-bottom: 15px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    gap: 4px;
    user-select: none;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.farm-tab-indicator {
    position: absolute;
    top: 5px;
    left: 5px;
    height: calc(100% - 10px);
    width: calc(50% - 6px);
    border-radius: 12px;
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25), 0 0 16px rgba(16, 185, 129, 0.35);
    transition: transform var(--dur-med) var(--ease-bounce), background var(--dur-med), box-shadow var(--dur-med);
    z-index: 0;
    pointer-events: none;
}

.farm-tab-indicator--animals {
    transform: translateX(calc(100% + 4px));
    background: linear-gradient(135deg, #fbbf24, #d97706);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25), 0 0 16px rgba(245, 158, 11, 0.35);
}

.farm-tab-btn {
    flex: 1;
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 10px 16px;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.55);
    background: transparent;
    cursor: pointer;
    transition: color var(--dur-fast), transform var(--dur-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.farm-tab-btn--active {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.farm-tab-btn:not(.farm-tab-btn--active):hover {
    color: rgba(255, 255, 255, 0.85);
}

.farm-tab-btn:active { transform: scale(0.97); }

.farm-tab-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    background: transparent !important;
}

#farm-view-animals-btn .farm-tab-icon {
    width: 20px;
    height: 20px;
}

/* ── Farm view title chip ── */
.farm-view-title-chip {
    position: relative;
    z-index: 6;
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.35));
    padding: 8px 16px;
    border-radius: 14px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(8px);
    transition: transform var(--dur-med) var(--ease-bounce), opacity var(--dur-med);
}

.farm-view-title-chip.farm-title--enter {
    animation: title-pop 0.45s var(--ease-bounce);
}

@keyframes title-pop {
    0% { opacity: 0; transform: translateY(-8px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.farm-view-title-chip__icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(5, 150, 105, 0.2));
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
}

.farm-view-title-chip__icon--img {
    background: transparent !important;
    box-shadow: none !important;
}

.panel-launcher-title-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.panel-launcher-title-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    flex-shrink: 0;
}

.farm-view-title-chip--animals .farm-view-title-chip__icon {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(217, 119, 6, 0.25));
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

#farm-3d-container,
#farm-animals-container {
    border: 2px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 20px !important;
    box-shadow:
        0 4px 0 rgba(0, 0, 0, 0.25),
        inset 0 2px 8px rgba(255, 255, 255, 0.04),
        inset 0 -4px 16px rgba(0, 0, 0, 0.3) !important;
    background: rgba(8, 12, 22, 0.35) !important;
}

.farm-tab-locked {
    opacity: 0.65;
}

.farm-tab-locked .farm-tab-icon {
    filter: grayscale(0.6) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* ── Farm view crossfade ── */
.farm-view-panel {
    position: relative;
    z-index: 1;
    transition: opacity var(--dur-med) var(--ease-smooth), transform var(--dur-med) var(--ease-smooth);
}

.farm-view-panel.farm-view-panel--hidden {
    opacity: 0;
    transform: scale(0.98);
    pointer-events: none;
}

.farm-view-panel.farm-view-panel--enter {
    animation: panel-enter 0.4s var(--ease-bounce);
}

@keyframes panel-enter {
    0% { opacity: 0; transform: translateY(12px) scale(0.97); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Animal pasture container ── */
#farm-animals-container {
    background: transparent !important;
}

/* ── Shelter cards — clay per-type accents ── */
.animal-shelter-card {
    --shelter-accent: #fbbf24;
    --shelter-accent-soft: rgba(251, 191, 36, 0.2);
    --shelter-glow: rgba(251, 191, 36, 0.35);
    background: linear-gradient(160deg, rgba(32, 38, 55, 0.92), rgba(18, 22, 36, 0.88));
    border: var(--clay-border) solid var(--shelter-accent-soft);
    box-shadow:
        0 5px 0 rgba(0, 0, 0, 0.3),
        0 8px 20px rgba(0, 0, 0, 0.25),
        inset 0 2px 6px rgba(255, 255, 255, 0.06),
        inset 0 -3px 8px rgba(0, 0, 0, 0.2);
    transition:
        transform var(--dur-med) var(--ease-bounce),
        box-shadow var(--dur-med),
        border-color var(--dur-fast);
}

.animal-shelter-card[data-shelter="chicken"] { --shelter-accent: #fbbf24; --shelter-accent-soft: rgba(251, 191, 36, 0.35); --shelter-glow: rgba(251, 191, 36, 0.4); }
.animal-shelter-card[data-shelter="cow"] { --shelter-accent: #f87171; --shelter-accent-soft: rgba(248, 113, 113, 0.35); --shelter-glow: rgba(248, 113, 113, 0.35); }
.animal-shelter-card[data-shelter="pig"] { --shelter-accent: #f472b6; --shelter-accent-soft: rgba(244, 114, 182, 0.35); --shelter-glow: rgba(244, 114, 182, 0.35); }
.animal-shelter-card[data-shelter="fish"] { --shelter-accent: #38bdf8; --shelter-accent-soft: rgba(56, 189, 248, 0.35); --shelter-glow: rgba(56, 189, 248, 0.35); }
.animal-shelter-card[data-shelter="dog"] { --shelter-accent: #fb923c; --shelter-accent-soft: rgba(251, 146, 60, 0.35); --shelter-glow: rgba(251, 146, 60, 0.35); }
.animal-shelter-card[data-shelter="cat"] { --shelter-accent: #c084fc; --shelter-accent-soft: rgba(192, 132, 252, 0.35); --shelter-glow: rgba(192, 132, 252, 0.35); }

.animal-shelter-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(ellipse 80% 60% at 50% 0%, var(--shelter-accent-soft), transparent 65%);
    pointer-events: none;
    opacity: 0.8;
    transition: opacity var(--dur-fast);
}

.animal-shelter-card:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: var(--shelter-accent);
    box-shadow:
        0 7px 0 rgba(0, 0, 0, 0.28),
        0 12px 28px rgba(0, 0, 0, 0.3),
        0 0 20px var(--shelter-glow),
        inset 0 2px 8px rgba(255, 255, 255, 0.08);
}

.animal-shelter-card:active {
    transform: translateY(-1px) scale(0.99);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3), inset 0 2px 6px rgba(0, 0, 0, 0.15);
}

.animal-shelter-card--locked {
    border-color: rgba(255, 255, 255, 0.06) !important;
    background: linear-gradient(160deg, rgba(20, 24, 35, 0.85), rgba(12, 16, 26, 0.9));
}

.animal-shelter-card--locked::before { opacity: 0.3; }

.animal-shelter-card--ready {
    border-color: var(--shelter-accent) !important;
    animation: shelter-ready-pulse 2s ease-in-out infinite;
}

@keyframes shelter-ready-pulse {
    0%, 100% { box-shadow: 0 5px 0 rgba(0, 0, 0, 0.3), 0 0 12px var(--shelter-glow); }
    50% { box-shadow: 0 5px 0 rgba(0, 0, 0, 0.3), 0 0 24px var(--shelter-glow), 0 0 40px var(--shelter-accent-soft); }
}

.animal-shelter-card__icon {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
    transition: transform var(--dur-med) var(--ease-bounce);
}

.animal-shelter-card:hover .animal-shelter-card__icon {
    transform: scale(1.08) translateY(-2px);
}

.animal-shelter-card__title {
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.animal-shelter-card__yield {
    background: rgba(0, 0, 0, 0.45) !important;
    border: 2px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.3);
}

.animal-shelter-card__ready-badge {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    border: 2px solid rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25), 0 0 12px rgba(16, 185, 129, 0.5);
    animation: badge-bounce 1.5s ease-in-out infinite;
}

@keyframes badge-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

.animal-shelter-card__adopt-btn {
    background: linear-gradient(135deg, var(--shelter-accent), color-mix(in srgb, var(--shelter-accent) 70%, #000)) !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25) !important;
    transition: transform var(--dur-fast), box-shadow var(--dur-fast) !important;
    font-family: var(--font-heading);
}

.animal-shelter-card__adopt-btn:hover {
    transform: translateY(-2px);
}

.animal-shelter-card__adopt-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25) !important;
}

/* Stagger entrance */
.animal-shelter-card.shelter-card--enter {
    animation: shelter-card-enter 0.5s var(--ease-bounce) both;
}

@keyframes shelter-card-enter {
    0% { opacity: 0; transform: translateY(20px) scale(0.9); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Equipment bar clay ── */
#equipment-bar {
    background: linear-gradient(160deg, rgba(18, 24, 40, 0.85), rgba(10, 14, 26, 0.8)) !important;
    border: 2px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    border-radius: 16px !important;
    padding: 10px !important;
}

.equipment-slot {
    border: 2px solid rgba(255, 255, 255, 0.08) !important;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)) !important;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border-radius: 12px !important;
}

.equipment-slot.active {
    background: linear-gradient(145deg, rgba(59, 130, 246, 0.25), rgba(37, 99, 235, 0.15)) !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2), 0 0 14px rgba(59, 130, 246, 0.4) !important;
}

/* ── Side panels ── */
.side-panels .panel {
    transition: transform var(--dur-med) var(--ease-bounce), box-shadow var(--dur-med);
}

.side-panels .panel:hover {
    transform: translateY(-2px);
}

.player-row {
    border: 2px solid rgba(255, 255, 255, 0.05) !important;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)) !important;
    transition: transform var(--dur-fast) var(--ease-bounce), border-color var(--dur-fast), background var(--dur-fast) !important;
}

.player-row:hover {
    border-color: rgba(6, 182, 212, 0.3) !important;
    background: linear-gradient(145deg, rgba(6, 182, 212, 0.08), rgba(255, 255, 255, 0.02)) !important;
    transform: translateX(4px) !important;
}

/* ── Plot float UI polish ── */
/* NOTE: do NOT animate `transform` here — JS sets translate+scale from plot on-screen size / zoom. */
.plot-time-float {
    border: 2px solid rgba(251, 191, 36, 0.3) !important;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3), 0 0 10px rgba(251, 191, 36, 0.2) !important;
    font-family: var(--font-heading);
    animation: timer-tick 1s ease-in-out infinite;
    transform-origin: center center;
    will-change: transform, filter;
}

@keyframes timer-tick {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.12); }
}

.plot-status-icon {
    border: 2px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25), 0 0 8px rgba(59, 130, 246, 0.25) !important;
}

/* Legacy HTML ripe ring removed — ripe FX is Three.js world-space (glow disk + sparkles). */
.plot-ripe-glow { display: none !important; }

/* Farm burst particles */
.farm-burst-particle {
    position: fixed;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 99990;
    box-shadow: 0 0 8px currentColor;
    animation: farm-burst-fly 1.1s var(--ease-bounce) forwards;
    opacity: 0;
}

@keyframes farm-burst-fly {
    0% { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--bx), var(--by)) scale(0.2); }
}

.harvest-particle {
    font-family: var(--font-heading) !important;
    font-weight: 800 !important;
    animation: harvest-float-up 1.4s var(--ease-bounce) forwards !important;
    z-index: 99995;
}

.animal-burst-particle {
    position: fixed;
    font-size: clamp(16px, 4vw, 22px);
    line-height: 1;
    pointer-events: none;
    z-index: 99992;
    opacity: 0;
    transform: translate(-50%, -50%);
    animation: animal-burst-fly 1.3s var(--ease-bounce) forwards;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

@keyframes animal-burst-fly {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(0.6) rotate(0deg); }
    100% { opacity: 0; transform: translate(calc(-50% + var(--abx)), calc(-50% + var(--aby))) scale(1.1) rotate(180deg); }
}

@media (pointer: coarse) {
    .farm-burst-particle {
        width: 10px !important;
        height: 10px !important;
        box-shadow: 0 0 12px currentColor !important;
    }

    .klife-click-ripple {
        width: 28px;
        height: 28px;
        margin: -14px 0 0 -14px;
        border-width: 3px;
    }
}

@keyframes harvest-float-up {
    0% { opacity: 1; transform: translateY(0) scale(0.8); }
    40% { opacity: 1; transform: translateY(-40px) scale(1.1); }
    100% { opacity: 0; transform: translateY(-90px) scale(0.9); }
}

/* ── Modals — clay entrance ── */
.modal-overlay.show {
    animation: modal-backdrop-in 0.28s var(--ease-smooth);
}

@keyframes modal-backdrop-in {
    from { background: rgba(0, 0, 0, 0); backdrop-filter: blur(0); }
    to { background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(5px); }
}

.modal-overlay.show .shop-modal,
.modal-overlay.show .glass-panel.kfarm-hub-panel,
.modal-overlay.show > .glass-panel {
    animation: modal-panel-in 0.38s var(--ease-bounce);
}

@keyframes modal-panel-in {
    0% { opacity: 0; transform: scale(0.88) translateY(16px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.shop-modal,
#world-panel-overlay > .glass-panel,
#farm-panel-overlay .shop-modal {
    border: 3px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: var(--clay-shadow-out), var(--clay-shadow-in) !important;
}

.shop-title {
    font-family: var(--font-heading) !important;
    background: linear-gradient(135deg, #fbbf24, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.shop-item-row {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)) !important;
    border: 2px solid rgba(255, 255, 255, 0.07) !important;
    border-radius: 16px !important;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: transform var(--dur-fast) var(--ease-bounce), border-color var(--dur-fast), box-shadow var(--dur-fast) !important;
}

.shop-item-row:hover {
    transform: translateY(-2px) !important;
    border-color: rgba(236, 72, 153, 0.25) !important;
    box-shadow: 0 5px 0 rgba(0, 0, 0, 0.2), 0 0 12px rgba(236, 72, 153, 0.1) !important;
}

.shop-tab-btn.active,
.lang-btn.active {
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2), 0 0 10px rgba(16, 185, 129, 0.25) !important;
}

/* ── World panel launcher cards ── */
#world-grid-launcher .farm-grid-card {
    border: 3px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 18px !important;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
    transition: transform var(--dur-med) var(--ease-bounce), box-shadow var(--dur-med) !important;
    animation: world-card-enter 0.45s var(--ease-bounce) both;
}

#world-grid-launcher .farm-grid-card:nth-child(1) { animation-delay: 0.04s; }
#world-grid-launcher .farm-grid-card:nth-child(2) { animation-delay: 0.08s; }
#world-grid-launcher .farm-grid-card:nth-child(3) { animation-delay: 0.12s; }
#world-grid-launcher .farm-grid-card:nth-child(4) { animation-delay: 0.16s; }
#world-grid-launcher .farm-grid-card:nth-child(5) { animation-delay: 0.20s; }
#world-grid-launcher .farm-grid-card:nth-child(6) { animation-delay: 0.24s; }

@keyframes world-card-enter {
    0% { opacity: 0; transform: translateX(-12px); }
    100% { opacity: 1; transform: translateX(0); }
}

#world-grid-launcher .farm-grid-card:hover {
    transform: translateY(-4px) scale(1.01) !important;
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.22), 0 0 20px rgba(139, 92, 246, 0.15) !important;
}

.panel-launcher-header {
    border-bottom: 2px solid rgba(255, 255, 255, 0.06) !important;
}

/* ── KFarm hub tabs — clay slider ── */
.kfarm-hub-tabs {
    position: relative;
    background: rgba(8, 12, 22, 0.7) !important;
    border: 2px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 14px !important;
    padding: 5px !important;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}

.kfarm-tab-indicator {
    position: absolute;
    top: 5px;
    left: 5px;
    width: calc(33.333% - 6px);
    height: calc(100% - 10px);
    border-radius: 10px;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25), 0 0 14px rgba(139, 92, 246, 0.35);
    transition: transform var(--dur-med) var(--ease-bounce);
    z-index: 0;
    pointer-events: none;
}

.kfarm-tab-indicator--pos-1 { transform: translateX(calc(100% + 4px)); }
.kfarm-tab-indicator--pos-2 { transform: translateX(calc(200% + 8px)); }

.kfarm-tab {
    position: relative;
    z-index: 1;
    border: none !important;
    background: transparent !important;
    font-family: var(--font-heading) !important;
    border-radius: 10px !important;
    transition: color var(--dur-fast) !important;
}

.kfarm-tab.active {
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    background: transparent !important;
    border: none !important;
}

.kfarm-hub-panel {
    border: 3px solid rgba(255, 255, 255, 0.08) !important;
}

.kfarm-level-node {
    transition: transform var(--dur-fast) var(--ease-bounce), box-shadow var(--dur-fast) !important;
}

.kfarm-level-node:hover:not(:disabled) {
    transform: scale(1.08) translateY(-2px) !important;
}

.gamecenter-card {
    border: 3px solid rgba(139, 92, 246, 0.35) !important;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

.gamecenter-card:hover {
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.22), 0 0 20px rgba(139, 92, 246, 0.3) !important;
}

.floating-menu {
    border: 3px solid rgba(16, 185, 129, 0.22) !important;
    border-radius: 18px !important;
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.3), 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 20px rgba(16, 185, 129, 0.08) !important;
    /* Enter animation only when .floating-menu--enter is added (after layout) */
    background: linear-gradient(160deg, rgba(14, 22, 34, 0.97), rgba(8, 12, 22, 0.95)) !important;
    transform-origin: center center;
}

/* Desktop open: scale only — left/top already set (no centering transform) */
.floating-menu.floating-menu--enter:not(.floating-menu--mobile) {
    animation: floating-menu-in 0.28s ease-out both;
}

@keyframes floating-menu-in {
    0% { opacity: 0; transform: scale(0.96); }
    100% { opacity: 1; transform: none; }
}

/*
 * Mobile: left/top 50% + translate(-50%,-50%). Scale keyframes MUST keep translate
 * or the panel animates from a corner then jumps to center.
 */
.floating-menu.floating-menu--mobile {
    /* No !important on transform — allows enter animation to include translate(-50%,-50%) */
    transform: translate(-50%, -50%);
    transform-origin: center center;
}

.floating-menu.floating-menu--mobile.floating-menu--enter {
    animation: floating-menu-in-mobile 0.28s ease-out both;
}

@keyframes floating-menu-in-mobile {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.96); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.floating-menu-title {
    font-family: var(--font-heading) !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.08) !important;
}

.floating-seed-item {
    border: 2px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18) !important;
    transition: transform var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast), box-shadow var(--dur-fast) !important;
}

/* Hover: no translateX (caused horizontal scroll in 240px menu) — glow only */
.floating-seed-item:hover:not(.locked) {
    transform: none !important;
    border-color: rgba(16, 185, 129, 0.35) !important;
    background: rgba(16, 185, 129, 0.1) !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18), inset 0 0 0 1px rgba(16, 185, 129, 0.12) !important;
}

@media (hover: hover) and (pointer: fine) {
    /* Desktop only: tiny inset lift without widening layout box */
    .floating-seed-item:hover:not(.locked) {
        transform: scale(1.015) !important;
        transform-origin: center center;
    }
}

.floating-seed-item.locked {
    border-style: dashed !important;
}

.floating-crop-menu .btn-primary,
.floating-crop-menu .btn-secondary {
    font-family: var(--font-heading) !important;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.22) !important;
}

/* ── Global chat side panel ── */
#global-chat-panel {
    border: 3px solid rgba(6, 182, 212, 0.18) !important;
    box-shadow: var(--clay-shadow-out), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    background: linear-gradient(160deg, rgba(18, 28, 42, 0.85), rgba(12, 18, 30, 0.75)) !important;
}

#global-chat-panel .panel-title {
    font-family: var(--font-heading) !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

.global-chat-panel-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

#global-chat-panel .chat-input {
    border: 2px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px !important;
    transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

#global-chat-panel .chat-input:focus {
    border-color: rgba(6, 182, 212, 0.45) !important;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12);
}

#global-chat-panel .chat-send-btn {
    font-family: var(--font-heading) !important;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25) !important;
    transition: transform var(--dur-fast) !important;
}

#global-chat-panel .chat-send-btn:hover {
    transform: translateY(-2px);
}

/* World chat + friend chat — K-Life custom scrollbar (not OS default) */
#global-chat-panel .chat-messages,
#friend-chat-messages,
.klife-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(167, 139, 250, 0.5) rgba(15, 23, 42, 0.35);
    scrollbar-gutter: stable;
}

#global-chat-panel .chat-messages::-webkit-scrollbar,
#friend-chat-messages::-webkit-scrollbar,
.klife-scroll::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#global-chat-panel .chat-messages::-webkit-scrollbar-track,
#friend-chat-messages::-webkit-scrollbar-track,
.klife-scroll::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.45);
    border-radius: 999px;
    margin: 4px 0;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

#global-chat-panel .chat-messages::-webkit-scrollbar-thumb,
#friend-chat-messages::-webkit-scrollbar-thumb,
.klife-scroll::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(167, 139, 250, 0.65), rgba(6, 182, 212, 0.4));
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
    min-height: 36px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

#global-chat-panel .chat-messages::-webkit-scrollbar-thumb:hover,
#friend-chat-messages::-webkit-scrollbar-thumb:hover,
.klife-scroll::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(196, 181, 253, 0.85), rgba(34, 211, 238, 0.55));
    background-clip: padding-box;
}

#global-chat-panel .chat-messages::-webkit-scrollbar-corner,
#friend-chat-messages::-webkit-scrollbar-corner,
.klife-scroll::-webkit-scrollbar-corner {
    background: transparent;
}

#global-chat-panel .chat-messages {
    padding-right: 6px;
}

/* ── Leaderboard modal — fixed frame ── */
#leaderboard-overlay {
    align-items: center;
    justify-content: center;
}

/* Leaderboard: audit INCREASE_OK (long list + free viewport) */
#leaderboard-overlay .leaderboard-modal-panel {
    height: var(--klife-modal-fixed-h-list);
    max-height: var(--klife-modal-fixed-h-list);
    min-height: var(--klife-modal-fixed-h-list);
    overflow: hidden;
    flex-shrink: 0;
    gap: 0;
    border: 3px solid rgba(251, 191, 36, 0.28) !important;
    box-shadow: var(--clay-shadow-out), 0 0 24px rgba(251, 191, 36, 0.1) !important;
    display: flex !important;
    flex-direction: column !important;
}

.leaderboard-modal-icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

#leaderboard-overlay .lb-period-tabs,
#leaderboard-overlay .lb-sort-tabs {
    flex-shrink: 0;
    padding: 0 2px;
}

#leaderboard-overlay .lb-sort-tabs {
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.22);
    padding: 5px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.06);
    margin: 8px 0;
}

#lb-daily-date-indicator {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-align: center;
    margin: -2px 0 6px;
    flex-shrink: 0;
}

/* Kill game.css .leaderboard-list { max-height: 280px } so list fills panel */
#leaderboard-overlay #modal-leaderboard-list,
#leaderboard-overlay .leaderboard-list {
    flex: 1 1 auto;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: auto;
    overscroll-behavior: contain;
    height: auto !important;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lb-row--podium.lb-row--gold .lb-rank { color: #fbbf24; text-shadow: 0 0 8px rgba(251, 191, 36, 0.4); }
.lb-row--podium.lb-row--silver .lb-rank { color: #cbd5e1; }
.lb-row--podium.lb-row--bronze .lb-rank { color: #fb923c; }

/* ── Logs / Craft / Factory sub-modals ── */
#farm-logs-overlay .farm-sub-panel {
    border: 3px solid rgba(236, 72, 153, 0.22) !important;
    box-shadow: var(--clay-shadow-out), 0 0 20px rgba(236, 72, 153, 0.08) !important;
}

#farm-craft-overlay .farm-sub-panel {
    border: 3px solid rgba(139, 92, 246, 0.28) !important;
}

#factory-overlay .factory-sub-panel {
    height: var(--klife-modal-fixed-h-sm);
    max-height: var(--klife-modal-fixed-h-sm);
    min-height: var(--klife-modal-fixed-h-sm);
    overflow: hidden;
    flex-shrink: 0;
    gap: 0;
    display: flex !important;
    flex-direction: column !important;
    border: 3px solid rgba(139, 92, 246, 0.25) !important;
    box-shadow: var(--clay-shadow-out), 0 0 20px rgba(139, 92, 246, 0.1) !important;
}

#factory-slots-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#factory-overlay .shop-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#farm-logs-overlay .farm-sub-panel,
#farm-craft-overlay .farm-sub-panel {
    height: var(--klife-modal-fixed-h);
    max-height: var(--klife-modal-fixed-h);
    min-height: var(--klife-modal-fixed-h);
    overflow: hidden;
    flex-shrink: 0;
    gap: 0;
    display: flex !important;
    flex-direction: column !important;
}

#logs-diary {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    max-height: none !important;
    padding: 4px 2px;
}

.log-entry {
    border: 2px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 14px !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18) !important;
    transition: transform var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast) !important;
}

.log-entry:hover {
    transform: translateX(3px);
}

.log-entry.log-entry-clickable:hover {
    border-color: rgba(139, 92, 246, 0.3) !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18), 0 0 12px rgba(139, 92, 246, 0.15) !important;
}

.log-avatar {
    border: 2px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

.craft-factory-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.14), rgba(109, 40, 217, 0.08));
    border: 2px solid rgba(139, 92, 246, 0.28);
    padding: 10px 14px;
    border-radius: 14px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: transform var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.craft-factory-banner:hover {
    transform: translateY(-2px);
    border-color: rgba(139, 92, 246, 0.45);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2), 0 0 14px rgba(139, 92, 246, 0.2);
}

.craft-tab-intro {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-align: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 8px;
    flex-shrink: 0;
}

#craft-recipes-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    max-height: none !important;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

.craft-recipe-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    border: 2px solid rgba(139, 92, 246, 0.22);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
    transition: transform var(--dur-fast), border-color var(--dur-fast);
}

.craft-recipe-card:hover:not(.craft-recipe-card--locked) {
    transform: translateX(3px);
    border-color: rgba(139, 92, 246, 0.4);
}

.craft-recipe-card--locked {
    opacity: 0.5;
    border-color: rgba(255, 255, 255, 0.06);
    border-style: dashed;
}

.craft-recipe-card--ready {
    border-color: rgba(16, 185, 129, 0.35);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2), 0 0 10px rgba(16, 185, 129, 0.12);
}

.craft-recipe-card__icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.craft-subtab-btn {
    flex: 1;
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-heading);
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform var(--dur-fast), box-shadow var(--dur-fast);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.craft-subtab-btn--active {
    background: linear-gradient(135deg, #a78bfa, #7c3aed) !important;
    color: #fff !important;
}

.craft-subtab-btn--idle {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
}

/* ── Toast polish ── */
.toast {
    border: 2px solid rgba(255, 255, 255, 0.12) !important;
    font-family: var(--font-body);
    font-weight: 600 !important;
    border-radius: 14px !important;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.35) !important;
    background: linear-gradient(145deg, rgba(24, 32, 48, 0.96), rgba(12, 18, 30, 0.94)) !important;
}

.toast--enter {
    animation: toast-slide-in 0.4s var(--ease-bounce);
}

@keyframes toast-slide-in {
    0% { opacity: 0; transform: translateX(120%) scale(0.92); }
    100% { opacity: 1; transform: translateX(0) scale(1); }
}

.toast--success {
    border-color: rgba(16, 185, 129, 0.4) !important;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25), 0 0 16px rgba(16, 185, 129, 0.2) !important;
}

.toast--error {
    border-color: rgba(239, 68, 68, 0.4) !important;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25), 0 0 16px rgba(239, 68, 68, 0.18) !important;
}

.toast--info {
    border-color: rgba(59, 130, 246, 0.35) !important;
}

.toast--steal {
    border-color: rgba(236, 72, 153, 0.4) !important;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25), 0 0 16px rgba(236, 72, 153, 0.2) !important;
}

/* ============================================================
   PHASE 3 — Complete UI coverage
   ============================================================ */

.ui-panel-enter {
    animation: modal-panel-in 0.38s var(--ease-bounce);
}

.ui-stagger-enter {
    animation: ui-stagger-in 0.42s var(--ease-bounce) both;
}

@keyframes ui-stagger-in {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Tool mode bars + floating seed picker — pop in (not hard cut-in) */
.ui-pop-in {
    animation: ui-pop-in 0.36s var(--ease-bounce) both;
}

@keyframes ui-pop-in {
    0% { opacity: 0; transform: translateY(10px) scale(0.92); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Research tree / merchant list host when content swaps */
.ui-content-enter {
    animation: ui-content-fade 0.28s ease-out both;
}

@keyframes ui-content-fade {
    0% { opacity: 0.35; }
    100% { opacity: 1; }
}

#seeding-mode-toggle,
#water-mode-toggle,
#harvest-mode-toggle {
    transform-origin: center bottom;
}

#floating-seed-selector.ui-pop-in {
    transform-origin: bottom center;
}

.ui-pulse-once {
    animation: ui-pulse-once 0.55s var(--ease-bounce);
}

@keyframes ui-pulse-once {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

/* Login */
#login-screen {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(ellipse 70% 50% at 20% 15%, rgba(236, 72, 153, 0.14), transparent 55%),
        radial-gradient(ellipse 60% 45% at 85% 85%, rgba(139, 92, 246, 0.12), transparent 50%),
        radial-gradient(ellipse 50% 40% at 50% 50%, rgba(16, 185, 129, 0.07), transparent 60%);
}

.login-bg-fx {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.login-bg-orb {
    position: absolute;
    left: var(--x, 50%);
    top: var(--y, 50%);
    width: var(--s, 160px);
    height: var(--s, 160px);
    margin: calc(var(--s, 160px) / -2) 0 0 calc(var(--s, 160px) / -2);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.22), rgba(139, 92, 246, 0.08) 55%, transparent 70%);
    filter: blur(2px);
    animation: login-orb-drift var(--d, 14s) ease-in-out infinite alternate;
    animation-delay: var(--delay, 0s);
    opacity: 0.85;
}

.login-bg-orb:nth-child(even) {
    background: radial-gradient(circle, rgba(16, 185, 129, 0.18), rgba(59, 130, 246, 0.08) 55%, transparent 70%);
}

@keyframes login-orb-drift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(24px, -30px) scale(1.12); }
}

.login-cursor-glow {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 280px;
    z-index: 1;
    pointer-events: none;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.16), rgba(236, 72, 153, 0.08) 40%, transparent 70%);
    opacity: 0;
    transition: opacity 0.35s ease;
    mix-blend-mode: screen;
    will-change: transform;
}

.login-cursor-glow--on {
    opacity: 1;
}

#login-screen .login-card {
    position: relative;
    z-index: 2;
}

.login-card {
    border: 3px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: var(--clay-shadow-out), var(--clay-shadow-in), 0 0 40px rgba(236, 72, 153, 0.08) !important;
    animation: modal-panel-in 0.5s var(--ease-bounce);
    position: relative;
    overflow: hidden;
    transform: translate3d(var(--mx, 0px), var(--my, 0px), 0);
    transition: transform 0.2s ease-out;
}

.auth-extra-links {
    display: flex;
    justify-content: flex-end;
    margin: 4px 0 2px;
}

.auth-link-btn {
    appearance: none;
    background: none;
    border: none;
    padding: 4px 2px;
    color: #a78bfa;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    font-family: inherit;
}

.auth-link-btn:hover {
    color: #c4b5fd;
}

.auth-step-hint,
.auth-field-hint {
    margin: 0 0 12px;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-secondary);
    text-align: left;
}

.auth-field-hint {
    margin: 6px 0 0;
    font-size: 0.72rem;
    opacity: 0.9;
}

#auth-step-forgot .btn-primary,
#auth-step-register .btn-primary {
    margin-top: 4px;
}

.login-card::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(236, 72, 153, 0.08), transparent 65%);
}

.login-card--glow .login-logo-icon {
    animation: login-logo-float 3s ease-in-out infinite alternate;
}

@keyframes login-logo-float {
    0% { transform: translateY(0) scale(1); filter: drop-shadow(0 4px 12px rgba(236, 72, 153, 0.3)); }
    100% { transform: translateY(-4px) scale(1.04); filter: drop-shadow(0 8px 20px rgba(139, 92, 246, 0.4)); }
}

.login-logo-icon {
    border-radius: 22px !important;
    border: 3px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25);
}

.logo-title {
    font-family: var(--font-heading) !important;
    background: linear-gradient(135deg, #ec4899, #8b5cf6, #10b981) !important;
    -webkit-background-clip: text !important;
}

.auth-step--enter {
    animation: auth-step-in 0.38s var(--ease-bounce) both;
}

@keyframes auth-step-in {
    0% { opacity: 0; transform: translateX(12px); }
    100% { opacity: 1; transform: translateX(0); }
}

.btn-primary {
    font-family: var(--font-heading) !important;
    border: 2px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25) !important;
    transition: transform var(--dur-fast) var(--ease-bounce), box-shadow var(--dur-fast) !important;
}

.btn-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25), 0 0 14px rgba(236, 72, 153, 0.2) !important;
}

.btn-primary:active {
    transform: translateY(1px) !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25) !important;
}

.input-field {
    border: 2px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 14px !important;
    transition: border-color var(--dur-fast), box-shadow var(--dur-fast) !important;
}

.input-field:focus {
    border-color: #ec4899 !important;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.2) !important;
}

.back-link {
    transition: color var(--dur-fast), transform var(--dur-fast) !important;
}

.back-link:hover {
    color: #ec4899 !important;
    transform: translateX(-2px);
}

/* Farm panel launcher icons */
#farm-grid-launcher .farm-grid-card img {
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35));
    transition: transform var(--dur-fast) var(--ease-bounce);
}

#farm-grid-launcher .farm-grid-card:hover img {
    transform: scale(1.12) rotate(4deg);
}

#farm-panel-overlay .glass-panel {
    border: 3px solid rgba(139, 92, 246, 0.2) !important;
}

/* Chat polish */
.chat-box {
    border: 3px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.25), 0 4px 0 rgba(0, 0, 0, 0.2) !important;
    border-radius: 16px !important;
}

.chat-messages .chat-msg-card {
    transition: transform var(--dur-fast), box-shadow var(--dur-fast) !important;
}

.chat-messages .chat-msg-card:hover {
    transform: translateX(2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.chat-msg--enter {
    animation: chat-msg-in 0.42s var(--ease-bounce) both;
}

@keyframes chat-msg-in {
    0% { opacity: 0; transform: translateY(10px) scale(0.97); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-msg--enter .chat-msg-card {
    animation: chat-card-pop 0.45s var(--ease-bounce) both;
}

@keyframes chat-card-pop {
    0% { opacity: 0; transform: scale(0.92); }
    100% { opacity: 1; transform: scale(1); }
}

/* HUD stat pulse */
.hud-stat-pulse {
    animation: hud-stat-pulse 0.6s var(--ease-bounce);
}

@keyframes hud-stat-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.06); }
    40% { transform: scale(1.06); box-shadow: 0 5px 0 rgba(0, 0, 0, 0.2), 0 0 16px rgba(251, 191, 36, 0.35); }
}

.exp-bar-pulse {
    animation: exp-bar-pulse 0.65s var(--ease-bounce);
}

@keyframes exp-bar-pulse {
    0%, 100% { box-shadow: 0 0 10px rgba(236, 72, 153, 0.5); }
    50% { box-shadow: 0 0 22px rgba(139, 92, 246, 0.75), 0 0 8px rgba(16, 185, 129, 0.4); }
}

.profile-section:hover .avatar {
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3), 0 0 24px rgba(236, 72, 153, 0.45);
}

.level-badge {
    transition: transform var(--dur-fast) var(--ease-bounce);
}

.profile-section:hover .level-badge {
    transform: scale(1.05);
}

/* Splash */
.app-splash-title { font-family: var(--font-heading) !important; }

.app-splash-bg img {
    animation: splash-ken-burns 14s ease-in-out infinite alternate;
    transform-origin: center center;
}

@keyframes splash-ken-burns {
    0% { transform: scale(1); }
    100% { transform: scale(1.07); }
}

.app-splash-overlay {
    background: linear-gradient(
        180deg,
        rgba(6, 10, 22, 0.25) 0%,
        rgba(6, 10, 22, 0.55) 45%,
        rgba(6, 10, 22, 0.82) 100%
    ) !important;
}

.app-splash-content {
    animation: splash-content-glow 3s ease-in-out infinite alternate;
}

@keyframes splash-content-glow {
    0% { filter: drop-shadow(0 0 0 rgba(245, 158, 11, 0)); }
    100% { filter: drop-shadow(0 0 18px rgba(236, 72, 153, 0.25)); }
}

#world-grid-launcher .farm-grid-card img {
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35));
    transition: transform var(--dur-fast) var(--ease-bounce);
}

#world-grid-launcher .farm-grid-card:hover img {
    transform: scale(1.1) rotate(-4deg);
}

.kfarm-level-map {
    position: relative;
}

.kfarm-level-map::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 60% 40% at 20% 30%, rgba(139, 92, 246, 0.12), transparent 60%),
        radial-gradient(ellipse 50% 35% at 80% 70%, rgba(16, 185, 129, 0.1), transparent 55%);
    animation: kfarm-map-shimmer 10s ease-in-out infinite alternate;
}

@keyframes kfarm-map-shimmer {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

.app-splash-spinner {
    width: 36px; height: 36px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: #ec4899;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

/* HUD button variants */
#hud-farm-panel-btn { background: linear-gradient(135deg, #8b5cf6, #6d28d9) !important; }
#hud-world-btn { background: linear-gradient(135deg, #0ea5e9, #0284c7) !important; }
#hud-quests-btn { background: linear-gradient(135deg, #a78bfa, #8b5cf6) !important; }

.btn-checkin {
    font-family: var(--font-heading) !important;
    border: 2px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25), 0 0 12px rgba(244, 63, 94, 0.25) !important;
}

.checkin-pulse {
    animation: checkin-pulse-glow 1.8s ease-in-out infinite;
}

@keyframes checkin-pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.5); }
    50% { box-shadow: 0 0 0 8px rgba(244, 63, 94, 0); }
}

/* Farm panel grid */
#farm-grid-launcher {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    padding: 16px !important;
}

#farm-grid-launcher .farm-grid-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    aspect-ratio: 1 !important;
    padding: 22px 10px !important;
    border: 3px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 18px !important;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
    cursor: pointer !important;
    transition: transform var(--dur-med) var(--ease-bounce), box-shadow var(--dur-med) !important;
    background-color: transparent !important;
}

#farm-grid-launcher .farm-grid-card:nth-child(1) { background: linear-gradient(135deg, rgba(139,92,246,0.18), rgba(109,40,217,0.08)) !important; border-color: rgba(139,92,246,0.3) !important; }
#farm-grid-launcher .farm-grid-card:nth-child(2) { background: linear-gradient(135deg, rgba(245,158,11,0.18), rgba(217,119,6,0.08)) !important; border-color: rgba(245,158,11,0.3) !important; }
#farm-grid-launcher .farm-grid-card:nth-child(3) { background: linear-gradient(135deg, rgba(16,185,129,0.18), rgba(5,150,105,0.08)) !important; border-color: rgba(16,185,129,0.3) !important; }
#farm-grid-launcher .farm-grid-card:nth-child(4) { background: linear-gradient(135deg, rgba(251,191,36,0.18), rgba(234,179,8,0.08)) !important; border-color: rgba(251,191,36,0.3) !important; }
#farm-grid-launcher .farm-grid-card:nth-child(5) { background: linear-gradient(135deg, rgba(236,72,153,0.18), rgba(219,39,119,0.08)) !important; border-color: rgba(236,72,153,0.3) !important; }

#farm-grid-launcher .farm-grid-card:hover {
    transform: translateY(-4px) scale(1.02) !important;
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.22), 0 0 18px rgba(139, 92, 246, 0.15) !important;
}

#farm-panel-overlay > .glass-panel,
#world-panel-overlay > .glass-panel {
    border: 3px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: var(--clay-shadow-out) !important;
}

.panel-launcher-header {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(109, 40, 217, 0.15)) !important;
}

#world-panel-overlay .panel-launcher-header {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.28), rgba(2, 132, 199, 0.15)) !important;
}

/* Quests */
.quests-modal-panel { position: relative; }

.quest-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.82rem;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    border: 2px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
    transition: transform var(--dur-fast), border-color var(--dur-fast);
}

.quest-row--done {
    border-color: rgba(16, 185, 129, 0.25);
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.08), rgba(255, 255, 255, 0.02));
}

.quest-row:hover { transform: translateX(3px); }

.quest-row__icon { font-size: 1.2rem; flex-shrink: 0; }
.quest-row__body { flex: 1; text-align: left; min-width: 0; }
.quest-row__title { font-weight: 700; color: var(--text-primary); font-family: var(--font-heading); }
.quest-row__reward { font-size: 0.7rem; color: #fbcfe8; margin-top: 3px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

.quest-btn {
    border: none;
    padding: 6px 12px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.72rem;
    font-family: var(--font-heading);
    cursor: pointer;
    white-space: nowrap;
    transition: transform var(--dur-fast);
}

.quest-btn--progress { background: #4b5563; color: #9ca3af; cursor: default; }
.quest-btn--claim {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #fff;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
}
.quest-btn--claim:hover { transform: translateY(-2px); }
.quest-btn--claimed { background: rgba(16, 185, 129, 0.12); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.25); cursor: default; }

.quest-gift-btn {
    width: 100%;
    padding: 12px;
    border-radius: 14px;
    font-weight: 800;
    font-size: 0.84rem;
    font-family: var(--font-heading);
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: transform var(--dur-fast), box-shadow var(--dur-fast);
}

.quest-gift-btn--ready {
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    color: #fff;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25), 0 0 16px rgba(167, 139, 250, 0.3);
    animation: quest-gift-glow 2s ease-in-out infinite;
}

@keyframes quest-gift-glow {
    0%, 100% { box-shadow: 0 4px 0 rgba(0,0,0,0.25), 0 0 12px rgba(167,139,250,0.25); }
    50% { box-shadow: 0 4px 0 rgba(0,0,0,0.25), 0 0 24px rgba(167,139,250,0.45); }
}

.quest-gift-btn--locked { background: #4b5563; color: #9ca3af; cursor: default; border: none; }
.quest-gift-btn--opened { background: rgba(255,255,255,0.05); color: var(--text-secondary); cursor: default; }

.quest-loading, .quest-error, .lb-loading, .lb-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 100px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.quest-error { color: #f87171; }
.quest-loading-spinner, .lb-loading-spinner {
    width: 28px; height: 28px;
    border: 3px solid rgba(255,255,255,0.08);
    border-top-color: #a78bfa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.lb-empty--icon span:first-child { font-size: 2rem; }

/* Leaderboard */
.lb-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    border-radius: 14px;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(145deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
    transition: transform var(--dur-fast), background var(--dur-fast), border-color var(--dur-fast);
}

.lb-row--enter { animation: ui-stagger-in 0.4s var(--ease-bounce) both; }
.lb-row--self { border-color: rgba(16, 185, 129, 0.35); background: linear-gradient(145deg, rgba(16,185,129,0.1), rgba(255,255,255,0.02)); }
.lb-row--gold { border-color: rgba(251, 191, 36, 0.35); }
.lb-row--silver { border-color: rgba(203, 213, 225, 0.3); }
.lb-row--bronze { border-color: rgba(251, 146, 60, 0.3); }

.lb-row:hover {
    transform: translateX(4px);
    background: linear-gradient(145deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
    border-color: rgba(236, 72, 153, 0.2);
}

.lb-rank {
    font-weight: 800;
    font-size: 1.1rem;
    min-width: 40px;
    width: 40px;
    min-height: 40px;
    font-family: var(--font-heading);
    overflow: visible;
}
.lb-row { overflow: visible; }
.lb-name { flex: 1; margin-left: 10px; text-align: left; min-width: 0; }
.lb-name__display { font-size: 0.85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-name__user { font-size: 0.7rem; color: var(--text-secondary); }
.lb-stat { font-weight: 700; font-size: 0.85rem; white-space: nowrap; }

#leaderboard-overlay .lb-sort-btn,
#leaderboard-overlay .shop-tab-btn {
    font-family: var(--font-heading) !important;
    border-radius: 10px !important;
    transition: all var(--dur-fast) !important;
}

#leaderboard-overlay .lb-sort-btn.active,
#leaderboard-overlay .shop-tab-btn.active {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9) !important;
    box-shadow: 0 2px 0 rgba(0,0,0,0.25) !important;
}

/* Neighbors */
#neighbors-panel {
    border: 3px solid rgba(6, 182, 212, 0.18) !important;
    box-shadow: var(--clay-shadow-out), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    background: linear-gradient(160deg, rgba(18, 28, 42, 0.85), rgba(12, 18, 30, 0.75)) !important;
}

#neighbors-panel .panel-title {
    font-family: var(--font-heading) !important;
}

.neighbors-friends-btn {
    padding: 6px 12px !important;
    font-size: 0.75rem !important;
    border-radius: 10px !important;
    background: linear-gradient(135deg, #06b6d4, #0891b2) !important;
    border: 2px solid rgba(6, 182, 212, 0.4) !important;
    color: #fff !important;
    cursor: pointer;
    font-weight: 700;
    font-family: var(--font-heading);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25), 0 0 10px rgba(6, 182, 212, 0.2);
    transition: transform var(--dur-fast) var(--ease-bounce), box-shadow var(--dur-fast);
    display: flex;
    align-items: center;
    gap: 4px;
}

.neighbors-friends-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 0 rgba(0, 0, 0, 0.22), 0 0 16px rgba(6, 182, 212, 0.35);
}

.neighbors-friends-btn:active {
    transform: translateY(1px);
}

.player-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 10px 12px !important;
    border-radius: 12px !important;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)) !important;
    border: 2px solid rgba(255, 255, 255, 0.06) !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18) !important;
    transition: transform var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast) !important;
}

.player-row:hover:not(.player-row--empty) {
    border-color: rgba(6, 182, 212, 0.25) !important;
    transform: translateX(3px);
}

.player-row--highlight {
    animation: neighbor-highlight 1.1s var(--ease-bounce);
}

@keyframes neighbor-highlight {
    0%, 100% { border-color: rgba(6, 182, 212, 0.25); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18); }
    40% { border-color: rgba(6, 182, 212, 0.55); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18), 0 0 16px rgba(6, 182, 212, 0.3); transform: translateX(6px) scale(1.01); }
}

.player-row__profile .avatar,
.player-row__profile img[style*="border-radius"] {
    border: 2px solid rgba(6, 182, 212, 0.35) !important;
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.2);
}

.player-row--enter { animation: ui-stagger-in 0.4s var(--ease-bounce) both; }

.player-row__profile {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.player-row__name {
    font-weight: 600;
    font-size: 0.85rem;
    color: #f3f4f6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-row__visit-btn {
    padding: 6px 12px;
    font-size: 0.72rem;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(6,182,212,0.2), rgba(8,145,178,0.12));
    border: 2px solid rgba(6, 182, 212, 0.35);
    color: #22d3ee;
    cursor: pointer;
    font-weight: 700;
    font-family: var(--font-heading);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
    transition: transform var(--dur-fast);
}

.player-row__visit-btn:hover { transform: translateY(-2px); }

.player-row--empty {
    justify-content: center !important;
    border: 2px dashed rgba(255, 255, 255, 0.08) !important;
    min-height: 40px;
    color: rgba(255, 255, 255, 0.2) !important;
    font-size: 0.75rem;
    font-style: italic;
    background: transparent !important;
    cursor: default !important;
}

.player-row--empty:hover { transform: none !important; border-color: rgba(255,255,255,0.08) !important; }

/* Animal detail */
.animal-detail-panel {
    border: 3px solid rgba(245, 158, 11, 0.2) !important;
    box-shadow: var(--clay-shadow-out), 0 0 30px rgba(245, 158, 11, 0.08) !important;
}

.animal-detail-summary {
    border: 2px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 14px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

#animal-modal-collect-btn {
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25), 0 0 12px rgba(16, 185, 129, 0.3) !important;
    font-family: var(--font-heading) !important;
    transition: transform var(--dur-fast) !important;
}

#animal-modal-collect-btn:hover { transform: translateY(-2px); }

.animal-detail-panel .btn-primary {
    font-family: var(--font-heading);
}

/*
 * Check-in — ONLY panel intentionally reworked for height:
 * Before: fixed min=max=640px → body always scrolled even when
 * desktop still had free viewport below 640px.
 * Now: height:auto (shrink to content); max-height uses free space
 * (fit-max). Inner scroll only after hitting that max.
 */
#checkin-overlay {
    align-items: center;
    justify-content: center;
}

#checkin-overlay .checkin-modal {
    height: auto;
    min-height: 0;
    max-height: var(--klife-modal-fit-max);
    max-width: min(400px, 96vw);
    width: 100%;
    overflow: hidden;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px;
    padding: 10px 14px 14px !important;
}
#checkin-overlay .checkin-modal-header {
    width: 100%;
}
#checkin-overlay .checkin-modal-title {
    font-size: clamp(1.05rem, 4vw, 1.25rem);
}

#checkin-overlay .checkin-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#checkin-overlay .checkin-state-content {
    gap: 8px;
}

/* Calendar: fixed cell size — do not scale with unused viewport height */
#checkin-overlay .checkin-calendar-wrap {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    flex-shrink: 0;
}

#checkin-overlay .checkin-weekdays {
    gap: 4px;
    margin-bottom: 4px;
}

#checkin-overlay .checkin-days {
    grid-template-columns: repeat(7, var(--klife-checkin-day-size));
    justify-content: center;
    gap: 4px;
}

#checkin-overlay .checkin-day {
    width: var(--klife-checkin-day-size);
    height: var(--klife-checkin-day-size);
    min-height: 0;
    max-height: var(--klife-checkin-day-size);
    aspect-ratio: auto;
    font-size: 0.7rem;
}

#checkin-overlay .checkin-milestone-section {
    flex-shrink: 0;
    padding: 10px 10px 8px;
}

#checkin-overlay .checkin-milestone-rail-area {
    --checkin-rail-center: 32px;
    height: 70px;
    padding: 0 6px 26px;
}

#checkin-overlay .checkin-milestone-orb {
    width: 34px;
    height: 34px;
}

#checkin-overlay .checkin-milestone-egg-img {
    width: 20px;
    height: 20px;
}

#checkin-overlay .checkin-legend {
    gap: 4px 8px;
    font-size: 0.62rem;
}

#checkin-overlay .checkin-today-box {
    flex-shrink: 0;
    padding: 8px 10px;
}

#checkin-overlay .checkin-actions {
    flex-shrink: 0;
    margin-top: 2px;
}

@media (max-width: 768px) {
    #checkin-overlay .checkin-calendar-wrap {
        max-width: 300px;
    }
}

.checkin-modal {
    border: 3px solid rgba(245, 158, 11, 0.2) !important;
    box-shadow: var(--clay-shadow-out), 0 0 24px rgba(245, 158, 11, 0.08) !important;
}

.checkin-modal--enter {
    animation: checkin-modal-enter 0.45s var(--ease-bounce);
}

@keyframes checkin-modal-enter {
    0% { opacity: 0; transform: scale(0.92) translateY(12px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.checkin-day--stamp {
    animation: checkin-day-stamp 0.75s var(--ease-bounce);
}

@keyframes checkin-day-stamp {
    0% { transform: scale(1); }
    35% { transform: scale(1.18); box-shadow: 0 0 20px rgba(16, 185, 129, 0.6); }
    100% { transform: scale(1); }
}

.checkin-today-box--pulse {
    animation: checkin-today-pulse 0.65s var(--ease-bounce);
}

@keyframes checkin-today-pulse {
    0%, 100% { box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2); }
    50% { box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2), 0 0 20px rgba(245, 158, 11, 0.45); transform: scale(1.02); }
}

.checkin-milestone-marker.claimable .checkin-milestone-orb {
    animation: checkin-milestone-glow 2s ease-in-out infinite;
}

@keyframes checkin-milestone-glow {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.4)); }
    50% { filter: drop-shadow(0 0 14px rgba(251, 191, 36, 0.85)); transform: scale(1.06); }
}

.checkin-btn-primary:not(:disabled) {
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25), 0 0 14px rgba(245, 158, 11, 0.25) !important;
}

.checkin-modal-title { font-family: var(--font-heading) !important; }

.checkin-today-box {
    border: 2px solid rgba(245, 158, 11, 0.25) !important;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2) !important;
}

.checkin-calendar-wrap .checkin-day-cell {
    transition: transform var(--dur-fast), box-shadow var(--dur-fast);
}

.checkin-calendar-wrap .checkin-day-cell:hover:not(.checkin-day-cell--disabled) {
    transform: scale(1.06);
}

/* ── Friends modal — fixed frame ── */
#friends-overlay {
    align-items: center;
    justify-content: center;
}

#friends-overlay .friends-modal-panel {
    height: var(--klife-modal-fixed-h);
    max-height: var(--klife-modal-fixed-h);
    min-height: var(--klife-modal-fixed-h);
    width: min(500px, calc(100vw - 24px)) !important;
    max-width: min(500px, calc(100vw - 24px)) !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    overflow-x: hidden !important;
    flex-shrink: 0;
    gap: 0;
    border: 3px solid rgba(6, 182, 212, 0.22) !important;
    box-shadow: var(--clay-shadow-out), 0 0 24px rgba(6, 182, 212, 0.08) !important;
}

#friends-overlay .shop-header,
#friends-overlay .shop-nav {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

#friends-overlay .shop-nav {
    flex-wrap: wrap;
    overflow-x: hidden;
}

#friends-overlay .shop-content {
    flex: 1;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden !important;
    overflow-y: auto;
    overscroll-behavior: contain;
    max-height: none !important;
}

#friends-overlay #friends-add-tab,
.friends-add-tab-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 4px 8px !important;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden !important;
}

.friends-modal-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.friend-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    border: 2px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
    transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.friend-row:hover {
    border-color: rgba(6, 182, 212, 0.28);
    /* no translateX — caused horizontal scroll inside modal */
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(6, 182, 212, 0.12);
}

.friend-row--enter { animation: ui-stagger-in 0.4s var(--ease-bounce) both; }

.friend-row__info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.friend-row__name {
    font-size: 0.88rem;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.friend-row__level {
    font-size: 0.72rem;
    color: #10b981;
    margin-top: 2px;
}

.friend-row__actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 46%;
}

.friend-row__btn-row {
    display: flex;
    gap: 6px;
}

.friend-btn {
    flex: 1;
    padding: 6px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: var(--font-heading);
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform var(--dur-fast);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

.friend-btn:hover { transform: translateY(-2px); }

.friend-btn--visit {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(8, 145, 178, 0.15));
    border-color: rgba(6, 182, 212, 0.35);
    color: #22d3ee;
}

.friend-btn--chat {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    border-color: rgba(124, 58, 237, 0.3);
    color: #fff;
}

.friend-btn--accept {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: rgba(16, 185, 129, 0.3);
    color: #fff;
}

.friend-btn--decline,
.friend-btn--remove {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: rgba(239, 68, 68, 0.25);
    color: #fff;
}

.friend-unread-dot {
    background: #ef4444;
    color: #fff;
    border-radius: 10px;
    padding: 1px 5px;
    font-size: 0.62rem;
    font-weight: 800;
    animation: pulse-dot 2s infinite;
}

.friends-empty {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 24px;
    padding: 0 12px;
    line-height: 1.5;
}

/*
 * Find-friend row — design rules:
 * - Single horizontal row always
 * - Input is PRIMARY field (grows); button is secondary CTA (auto width, same height)
 * - Equal visual height 44px, 16px gap (space-md), no width:0 hacks
 */
.friends-add-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 12px;
    row-gap: 0;
    margin-bottom: 4px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.friends-add-input {
    grid-column: 1;
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 44px;
    outline: none;
    font-family: var(--font-body);
    transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
    box-sizing: border-box;
}

.friends-add-input::placeholder {
    color: rgba(148, 163, 184, 0.85);
    font-weight: 500;
}

.friends-add-input:focus {
    border-color: rgba(6, 182, 212, 0.5);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.14);
}

#friends-add-submit-btn,
.friends-add-form .btn-primary {
    grid-column: 2;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 18px !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
    white-space: nowrap;
    box-sizing: border-box;
    line-height: 1 !important;
    /* Match input visual weight — not oversized */
    min-width: 7.5rem;
}

.friends-add-hint {
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-align: center;
    line-height: 1.45;
    padding: 4px 2px 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 420px) {
    .friend-row {
        flex-wrap: wrap;
    }
    .friend-row__actions {
        max-width: 100%;
        width: 100%;
        flex-direction: row;
    }
    #friends-add-submit-btn,
    .friends-add-form .btn-primary {
        padding: 0 14px !important;
        font-size: 0.8rem !important;
        min-width: 6.5rem;
    }
}

/* ── Settings modal ── */
#settings-overlay {
    align-items: center;
    justify-content: center;
}

#settings-overlay .settings-modal-panel {
    width: min(360px, 92vw);
    max-height: min(92svh, 760px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    text-align: center;
    padding: 24px 20px !important;
    border: 3px solid rgba(139, 92, 246, 0.22) !important;
    box-shadow: var(--clay-shadow-out), 0 0 24px rgba(139, 92, 246, 0.1) !important;
    border-radius: 20px !important;
}

.settings-modal-head {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 0 2px 14px;
    text-align: left;
}

.settings-modal-head .settings-modal-icon {
    margin: 0;
}

.settings-modal-head h2 {
    margin: 0;
}

.settings-modal-head #settings-subtitle {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.settings-modal-scroll {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #66d6ad rgba(6, 31, 38, 0.55);
    -webkit-overflow-scrolling: touch;
}

.settings-modal-scroll::-webkit-scrollbar {
    width: 8px;
}

.settings-modal-scroll::-webkit-scrollbar-track {
    margin-block: 5px;
    border-radius: 999px;
    background: rgba(6, 31, 38, 0.55);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.settings-modal-scroll::-webkit-scrollbar-thumb {
    min-height: 34px;
    border: 2px solid rgba(6, 31, 38, 0.75);
    border-radius: 999px;
    background: linear-gradient(180deg, #9be8bf, #31a982);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 0 8px rgba(81, 220, 170, 0.25);
}

.settings-modal-scroll:focus-visible {
    outline: 2px solid rgba(110, 231, 183, 0.55);
    outline-offset: -2px;
    border-radius: 14px;
}

.settings-modal-panel--enter {
    animation: settings-modal-enter 0.45s var(--ease-bounce);
}

@keyframes settings-modal-enter {
    0% { opacity: 0; transform: scale(0.92) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.settings-modal-icon {
    width: 52px;
    height: 52px;
    object-fit: contain;
    margin: 0 auto 8px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
}

#settings-overlay h2 {
    font-family: var(--font-heading) !important;
    font-size: 1.35rem !important;
    background: linear-gradient(135deg, #a78bfa, #7c3aed) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

.settings-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0 6px 14px 0;
    text-align: left;
}

#settings-btn-close {
    margin-top: 14px;
    flex-shrink: 0;
}

@media (max-height: 620px), (max-width: 360px) {
    #settings-overlay .settings-modal-panel {
        width: min(372px, 96vw);
        max-height: calc(100svh - max(14px, env(safe-area-inset-top)) - max(14px, env(safe-area-inset-bottom)));
        padding: 16px 14px !important;
    }

    .settings-modal-head {
        grid-template-columns: 42px minmax(0, 1fr);
        gap: 9px;
        padding-bottom: 10px;
    }

    .settings-modal-head .settings-modal-icon {
        width: 42px;
        height: 42px;
    }

    .settings-row {
        padding: 10px 12px;
    }

    #settings-btn-close {
        margin-top: 10px;
    }
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    border: 2px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.settings-row--telegram {
    background: linear-gradient(145deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.04));
    border-color: rgba(59, 130, 246, 0.2);
}

.settings-row--install {
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.13), rgba(14, 116, 144, 0.06));
    border-color: rgba(52, 211, 153, 0.24);
}

.settings-install-btn {
    flex-shrink: 0;
    min-width: 5.6rem;
    min-height: 38px;
    padding: 7px 11px;
    border-radius: 14px !important;
    border-color: rgba(255, 255, 255, 0.16) !important;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.055)) !important;
    color: var(--text-primary) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 2px 0 rgba(0, 0, 0, 0.18) !important;
    white-space: nowrap;
}

.settings-install-btn:hover,
.settings-install-btn:focus-visible {
    border-color: rgba(110, 231, 183, 0.45) !important;
    background: linear-gradient(145deg, rgba(52, 211, 153, 0.2), rgba(14, 116, 144, 0.1)) !important;
}

.settings-install-btn:disabled {
    opacity: 0.6;
}

.settings-install-guide-panel {
    width: min(390px, 92vw) !important;
    padding: 0 !important;
    overflow: hidden;
}

.settings-install-guide-body {
    display: grid;
    place-items: center;
    gap: 14px;
    padding: 18px;
    text-align: center;
}

.settings-install-guide-body img {
    width: 76px;
    height: 76px;
    border-radius: 22px;
    object-fit: cover;
    box-shadow: 0 12px 28px rgba(3, 35, 35, 0.42);
}

.settings-install-guide-body p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.55;
}

.settings-install-guide-body .btn-primary {
    width: 100%;
}

.settings-row__label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-heading);
}

.settings-row__desc {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.settings-row__status {
    font-size: 0.72rem;
    color: #93c5fd;
    font-weight: 600;
    margin-top: 2px;
}

.settings-toggle {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.settings-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.settings-toggle__slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 26px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    transition: background var(--dur-fast), border-color var(--dur-fast);
}

.settings-toggle__slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--dur-fast) var(--ease-bounce);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.settings-toggle input:checked + .settings-toggle__slider {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: rgba(16, 185, 129, 0.4);
}

.settings-toggle input:checked + .settings-toggle__slider::before {
    transform: translateX(20px);
}

.settings-row--gfx {
    align-items: flex-start;
}

.settings-select {
    flex-shrink: 0;
    max-width: 46%;
    min-width: 7.5rem;
    margin-top: 2px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.28);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-body, inherit);
    cursor: pointer;
    outline: none;
}

.settings-select:focus {
    border-color: rgba(16, 185, 129, 0.45);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

.settings-select option {
    background: #1e293b;
    color: #f8fafc;
}

/* ── Quests modal — fixed frame ── */
#quests-overlay {
    align-items: center;
    justify-content: center;
}

#quests-overlay .quests-modal-panel {
    height: var(--klife-modal-fixed-h);
    max-height: var(--klife-modal-fixed-h);
    min-height: var(--klife-modal-fixed-h);
    overflow: hidden;
    flex-shrink: 0;
    gap: 0;
    border: 3px solid rgba(167, 139, 250, 0.28) !important;
    box-shadow: var(--clay-shadow-out), 0 0 24px rgba(167, 139, 250, 0.1) !important;
    display: flex !important;
    flex-direction: column !important;
}

#quests-list-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quests-gift-section {
    flex-shrink: 0;
    border-top: 2px solid rgba(255, 255, 255, 0.08);
    padding-top: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.quests-gift-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #f472b6;
    font-family: var(--font-heading);
    display: flex;
    align-items: center;
    gap: 6px;
}

.quests-gift-desc {
    font-size: 0.76rem;
    color: var(--text-secondary);
    max-width: 400px;
    line-height: 1.4;
}

.quest-row--claim-flash {
    animation: quest-claim-flash 0.7s var(--ease-bounce);
}

@keyframes quest-claim-flash {
    0%, 100% { border-color: rgba(16, 185, 129, 0.25); }
    40% { border-color: rgba(251, 191, 36, 0.65); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2), 0 0 18px rgba(251, 191, 36, 0.35); transform: scale(1.02); }
}

.quest-btn--claimable-glow {
    animation: quest-btn-glow 1.8s ease-in-out infinite;
}

@keyframes quest-btn-glow {
    0%, 100% { box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25); }
    50% { box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25), 0 0 14px rgba(251, 191, 36, 0.5); }
}

/* ── Player profile popup ── */
#player-profile-overlay {
    align-items: center;
    justify-content: center;
}

#player-profile-overlay .player-profile-card {
    border: 3px solid rgba(167, 139, 250, 0.28) !important;
    overflow: hidden;
    max-width: 400px;
    width: 95%;
    padding: 25px !important;
    text-align: center;
    position: relative;
    box-shadow: var(--clay-shadow-out), 0 0 28px rgba(139, 92, 246, 0.12) !important;
}

.player-profile-card--enter {
    animation: profile-popup-enter 0.45s var(--ease-bounce);
}

@keyframes profile-popup-enter {
    0% { opacity: 0; transform: scale(0.94) translateY(14px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

#player-profile-overlay .profile-header-glow {
    background: radial-gradient(circle, rgba(167, 139, 250, 0.28) 0%, transparent 70%) !important;
}

#player-profile-avatar-container {
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.3), 0 0 22px rgba(139, 92, 246, 0.4) !important;
    border: 3px solid rgba(167, 139, 250, 0.5) !important;
    transition: transform var(--dur-med) var(--ease-bounce);
}

#player-profile-overlay .player-profile-card:hover #player-profile-avatar-container {
    transform: scale(1.03);
}

#player-profile-name {
    font-family: var(--font-heading) !important;
}

#player-profile-badges img {
    transition: transform var(--dur-fast) var(--ease-bounce);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

#player-profile-badges img:hover {
    transform: scale(1.15) translateY(-2px);
}

#player-profile-overlay .stat-pill {
    border: 2px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px !important;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)) !important;
}

#player-profile-actions .btn-primary {
    font-family: var(--font-heading) !important;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25) !important;
    transition: transform var(--dur-fast) !important;
}

#player-profile-actions .btn-primary:hover {
    transform: translateY(-2px);
}

/* Bag / warehouse */
.bag-slot {
    border: 2px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2) !important;
    transition: transform var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast) !important;
}

.bag-slot:hover {
    transform: scale(1.08) !important;
    border-color: #8b5cf6 !important;
}

.bag-slot.active {
    border-color: #10b981 !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2), 0 0 12px rgba(16, 185, 129, 0.35) !important;
}

/* Research */
.research-panel-modal {
    border: 3px solid rgba(16, 185, 129, 0.2) !important;
}

/* Shelter action modals */
.shelter-action-modal {
    border: 3px solid rgba(251, 191, 36, 0.25) !important;
}

/* Pikachu */
.pikachu-game-panel {
    border: 3px solid rgba(139, 92, 246, 0.3) !important;
    box-shadow: var(--clay-shadow-out), 0 0 24px rgba(139, 92, 246, 0.12) !important;
}

/* ── Friend chat — fixed frame ── */
#friend-chat-overlay {
    align-items: center;
    justify-content: center;
}

#friend-chat-overlay .friend-chat-panel {
    height: var(--klife-modal-fixed-h-sm);
    max-height: var(--klife-modal-fixed-h-sm);
    min-height: var(--klife-modal-fixed-h-sm);
    overflow: hidden;
    flex-shrink: 0;
    gap: 10px;
    border: 3px solid rgba(167, 139, 250, 0.28) !important;
    box-shadow: var(--clay-shadow-out), 0 0 24px rgba(167, 139, 250, 0.1) !important;
    display: flex !important;
    flex-direction: column !important;
}

.friend-chat-panel--enter {
    animation: friend-chat-enter 0.45s var(--ease-bounce);
}

@keyframes friend-chat-enter {
    0% { opacity: 0; transform: scale(0.94) translateY(12px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.friend-chat-modal-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

#friend-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.22) !important;
    border: 2px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 14px !important;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.friend-chat-empty {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.78rem;
    padding: 24px 12px;
    line-height: 1.5;
}

.friend-chat-msg {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 88%;
}

.friend-chat-msg--mine { align-self: flex-end; align-items: flex-end; }
.friend-chat-msg--them { align-self: flex-start; align-items: flex-start; }

.friend-chat-msg--enter {
    animation: friend-chat-bubble-in 0.38s var(--ease-bounce);
}

@keyframes friend-chat-bubble-in {
    0% { opacity: 0; transform: translateY(8px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.friend-chat-msg__meta {
    font-size: 0.62rem;
    font-weight: 700;
    opacity: 0.55;
}

.friend-chat-msg__time { font-weight: 400; }

.friend-chat-bubble {
    padding: 9px 13px;
    font-size: 0.82rem;
    line-height: 1.4;
    word-break: break-word;
    border-radius: 14px;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.friend-chat-bubble--me {
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    color: #fff;
    border-radius: 14px 14px 4px 14px;
    border: 2px solid rgba(167, 139, 250, 0.35);
}

.friend-chat-bubble--them {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    color: var(--text-primary);
    border-radius: 14px 14px 14px 4px;
    border: 2px solid rgba(255, 255, 255, 0.08);
}

.friend-chat-emoji-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    white-space: nowrap;
    border-top: 2px solid rgba(255, 255, 255, 0.06);
    padding-top: 8px;
    flex-shrink: 0;
}

.friend-chat-emoji-bar__label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    align-self: center;
    margin-right: 4px;
    flex-shrink: 0;
}

.friend-chat-emoji {
    cursor: pointer;
    font-size: 1.1rem;
    padding: 3px 4px;
    border-radius: 8px;
    transition: transform var(--dur-fast), background var(--dur-fast);
}

.friend-chat-emoji:hover {
    transform: scale(1.15);
    background: rgba(255, 255, 255, 0.06);
}

#friend-chat-overlay .chat-input-row {
    flex-shrink: 0;
    margin-top: 0 !important;
}

#friend-chat-overlay .chat-input {
    border: 2px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px !important;
    transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

#friend-chat-overlay .chat-input:focus {
    border-color: rgba(167, 139, 250, 0.45) !important;
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.12);
}

#friend-chat-overlay .chat-send-btn {
    font-family: var(--font-heading) !important;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25) !important;
    transition: transform var(--dur-fast) !important;
}

#friend-chat-overlay .chat-send-btn:hover {
    transform: translateY(-2px);
}

/* ── Gift box reward modal ── */
#giftbox-reward-overlay {
    align-items: center;
    justify-content: center;
}

#giftbox-reward-overlay .giftbox-reward-panel {
    max-width: 400px;
    width: 92%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 26px 22px !important;
    border: 3px solid rgba(251, 191, 36, 0.3) !important;
    box-shadow: var(--clay-shadow-out), 0 0 28px rgba(251, 191, 36, 0.12) !important;
}

.giftbox-reward-panel--enter {
    animation: giftbox-reward-enter 0.5s var(--ease-bounce);
}

@keyframes giftbox-reward-enter {
    0% { opacity: 0; transform: scale(0.88) rotate(-2deg); }
    60% { transform: scale(1.03) rotate(1deg); }
    100% { opacity: 1; transform: scale(1) rotate(0); }
}

.giftbox-reward-icon-wrap {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: giftbox-icon-bounce 2s ease-in-out infinite;
}

@keyframes giftbox-icon-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.giftbox-reward-icon {
    width: 56px;
    height: 56px;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(251, 191, 36, 0.4));
}

#giftbox-reward-overlay h2 {
    font-family: var(--font-heading) !important;
    font-size: 1.35rem !important;
    margin: 0 !important;
    background: linear-gradient(135deg, #a78bfa, #7c3aed) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

.giftbox-reward-rows {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 6px 0;
}

.giftbox-reward-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 15px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.88rem;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border: 2px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
    animation: ui-stagger-in 0.4s var(--ease-bounce) both;
}

.giftbox-reward-row:nth-child(1) { animation-delay: 0.08s; }
.giftbox-reward-row:nth-child(2) { animation-delay: 0.14s; }
.giftbox-reward-row:nth-child(3) { animation-delay: 0.2s; }

.giftbox-reward-row__label {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
}

#giftbox-reward-overlay .btn-primary {
    width: 100%;
    font-family: var(--font-heading) !important;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25), 0 0 14px rgba(124, 58, 237, 0.25) !important;
}

/* ── Bag / Warehouse / Research — fixed frame ── */
#farm-bag-overlay,
#farm-warehouse-overlay,
#farm-research-overlay {
    align-items: center;
    justify-content: center;
}

#farm-bag-overlay .farm-sub-panel,
#farm-warehouse-overlay .farm-sub-panel,
#farm-research-overlay .farm-sub-panel {
    height: var(--klife-modal-fixed-h);
    max-height: var(--klife-modal-fixed-h);
    min-height: var(--klife-modal-fixed-h);
    overflow: hidden;
    flex-shrink: 0;
    gap: 0;
    display: flex !important;
    flex-direction: column !important;
}

#farm-bag-overlay .farm-sub-panel {
    border: 3px solid rgba(167, 139, 250, 0.25) !important;
    box-shadow: var(--clay-shadow-out), 0 0 20px rgba(167, 139, 250, 0.08) !important;
}

#farm-warehouse-overlay .farm-sub-panel {
    border: 3px solid rgba(245, 158, 11, 0.28) !important;
    box-shadow: var(--clay-shadow-out), 0 0 20px rgba(245, 158, 11, 0.08) !important;
}

#farm-research-overlay .farm-sub-panel {
    border: 3px solid rgba(16, 185, 129, 0.22) !important;
}

#farm-bag-overlay .shop-content,
#farm-warehouse-overlay .shop-content,
#farm-research-overlay .shop-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#bag-grid-container .bag-slot {
    animation: ui-stagger-in 0.35s var(--ease-bounce) both;
}

#bag-item-details {
    border: 2px solid rgba(167, 139, 250, 0.2) !important;
    border-radius: 14px !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)) !important;
}

#bag-upgrade-section,
#warehouse-upgrade-section {
    border: 2px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 14px !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18) !important;
    flex-shrink: 0;
}

.warehouse-cap-bar {
    background: rgba(255, 255, 255, 0.08);
    height: 12px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.warehouse-cap-bar__fill {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    height: 100%;
    border-radius: 8px;
    transition: width 0.4s var(--ease-bounce);
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.35);
}

.warehouse-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 0.82rem;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    border: 2px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
    transition: transform var(--dur-fast), border-color var(--dur-fast);
}

.warehouse-row:hover {
    border-color: rgba(245, 158, 11, 0.28);
    transform: translateX(3px);
}

.warehouse-row__qty {
    font-weight: 800;
    color: #fbbf24;
    font-family: var(--font-heading);
}

#warehouse-items-container {
    max-height: none !important;
    flex: 1;
    min-height: 80px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Pasture decorative overlay (CSS-only) */
#farm-animals-container::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 50% 40% at 20% 80%, rgba(16, 185, 129, 0.12), transparent 60%),
        radial-gradient(ellipse 45% 35% at 80% 20%, rgba(245, 158, 11, 0.1), transparent 55%);
    border-radius: inherit;
}

#animal-shelters-grid { position: relative; z-index: 2; }

/* ── Shop — fixed frame height (tab switches don't resize modal) ── */
#shop-overlay {
    align-items: center;
    justify-content: center;
}

/* Shop: audit INCREASE_OK (list scroll + free viewport) → list height token */
#shop-overlay .shop-modal {
    height: var(--klife-modal-fixed-h-list);
    max-height: var(--klife-modal-fixed-h-list);
    min-height: var(--klife-modal-fixed-h-list);
    margin: auto;
    flex-shrink: 0;
    overflow: hidden;
    gap: 0;
    border: 3px solid rgba(236, 72, 153, 0.22) !important;
    box-shadow: var(--clay-shadow-out), 0 0 24px rgba(236, 72, 153, 0.1) !important;
}

/* Shell: header + tabs fixed; only list scrolls (fills leftover, no void growth) */
#shop-overlay .shop-header,
#shop-overlay .shop-nav {
    flex-shrink: 0;
}

#shop-overlay .shop-content {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#shop-overlay #shop-sell-tab {
    min-height: 0 !important;
}

/* Shared fixed-panel shell constraints */
#friends-overlay .shop-header,
#friends-overlay .shop-nav,
#quests-overlay .shop-header,
#leaderboard-overlay .shop-header,
#leaderboard-overlay .lb-period-tabs,
#leaderboard-overlay .lb-sort-tabs,
#farm-bag-overlay .shop-header,
#farm-warehouse-overlay .shop-header,
#farm-research-overlay .shop-header,
#farm-logs-overlay .shop-header,
#farm-craft-overlay .shop-header,
#factory-overlay .shop-header,
#world-gamecenter-overlay .shop-header,
#world-merchants-overlay .shop-header,
#world-market-overlay .shop-header,
#world-lottery-overlay .shop-header,
#world-maps-overlay .shop-header,
#friend-chat-overlay .shop-header {
    flex-shrink: 0;
}

/* Bag slots — cap size so tall panels don't look sparse */


/* ── World / Craft modals — fixed frame ── */
#farm-craft-overlay .shop-modal,
#world-lottery-overlay .shop-modal,
#world-merchants-overlay .shop-modal,
#world-market-overlay .shop-modal {
    height: var(--klife-modal-fixed-h-lg);
    max-height: var(--klife-modal-fixed-h-lg);
    min-height: var(--klife-modal-fixed-h-lg);
    overflow: hidden;
    flex-shrink: 0;
    gap: 0;
}

#farm-craft-overlay .shop-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#merchants-list-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#market-columns-wrapper {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#world-lottery-overlay .shop-modal {
    overflow: hidden;
}

#world-merchants-overlay .shop-modal,
#world-market-overlay .shop-modal {
    display: flex !important;
    flex-direction: column !important;
}

#world-lottery-overlay .shop-modal {
    border: 3px solid rgba(250, 204, 21, 0.25) !important;
    box-shadow: var(--clay-shadow-out), 0 0 24px rgba(250, 204, 21, 0.1) !important;
    display: flex !important;
    flex-direction: column !important;
}

#world-merchants-overlay .shop-modal {
    border: 3px solid rgba(14, 165, 233, 0.22) !important;
}

#world-market-overlay .shop-modal {
    border: 3px solid rgba(16, 185, 129, 0.22) !important;
}

#farm-craft-overlay .shop-modal {
    border: 3px solid rgba(139, 92, 246, 0.25) !important;
}

#lottery-jackpot-pool {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: 0;
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.12), rgba(245, 158, 11, 0.06)) !important;
    border: 2px solid rgba(250, 204, 21, 0.25) !important;
    border-radius: 14px !important;
    padding: 10px 12px !important;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 16px rgba(250, 204, 21, 0.08);
}

#lottery-pool-amount {
    font-size: clamp(1.4rem, 5vw, 2.2rem);
    font-weight: 900;
    color: #facc15;
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.5);
    font-family: monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#merchants-list-container .shop-item-row,
#craft-recipes-container .shop-item-row {
    animation: ui-stagger-enter 0.4s var(--ease-bounce) both;
}

/* ============================================================
   PHASE 12-15 — Final modal & overlay coverage
   ============================================================ */

/* World sub-panels */
#world-gamecenter-overlay,
#world-merchants-overlay,
#world-market-overlay,
#world-lottery-overlay,
#world-maps-overlay {
    align-items: center;
    justify-content: center;
}

#world-gamecenter-overlay .world-sub-panel,
#world-merchants-overlay .world-sub-panel,
#world-market-overlay .world-sub-panel,
#world-lottery-overlay .world-sub-panel,
#world-maps-overlay .world-sub-panel {
    height: var(--klife-modal-fixed-h-lg);
    max-height: var(--klife-modal-fixed-h-lg);
    min-height: var(--klife-modal-fixed-h-lg);
    overflow: hidden;
    flex-shrink: 0;
    gap: 0;
    display: flex !important;
    flex-direction: column !important;
}

#world-gamecenter-overlay .world-sub-panel {
    border: 3px solid rgba(139, 92, 246, 0.28) !important;
    box-shadow: var(--clay-shadow-out), 0 0 22px rgba(139, 92, 246, 0.1) !important;
}

#world-maps-overlay .world-sub-panel {
    border: 3px solid rgba(14, 165, 233, 0.25) !important;
}

.farm-modal-icon,
.world-modal-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

#gamecenter-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.market-countdown-banner {
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(2, 132, 199, 0.06));
    padding: 10px 14px;
    border-radius: 14px;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 600;
    color: #7dd3fc;
    border: 2px solid rgba(14, 165, 233, 0.2);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.market-countdown-banner #market-countdown-timer {
    font-family: monospace;
    font-size: 0.9rem;
    color: #38bdf8;
    font-weight: 800;
}

.market-crop-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 10px 14px;
    cursor: pointer;
    transition: transform var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.market-crop-row:hover {
    transform: translateY(-1px);
    border-color: rgba(14, 165, 233, 0.28);
}

.market-crop-row--active {
    border-color: rgba(14, 165, 233, 0.45) !important;
    background: linear-gradient(145deg, rgba(14, 165, 233, 0.1), rgba(14, 165, 233, 0.04)) !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18), 0 0 12px rgba(14, 165, 233, 0.12);
}

#market-chart-container {
    border: 2px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 16px !important;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.merchant-card {
    padding: 14px !important;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 2px solid rgba(16, 185, 129, 0.22) !important;
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.06), rgba(255, 255, 255, 0.02)) !important;
    border-radius: 14px !important;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2) !important;
    transition: transform var(--dur-fast), border-color var(--dur-fast);
}

.merchant-card:hover {
    transform: translateY(-2px);
    border-color: rgba(16, 185, 129, 0.38) !important;
}

.merchant-card--cooldown {
    border-color: rgba(255, 255, 255, 0.08) !important;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)) !important;
}

.merchant-demand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.22);
    border-radius: 12px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Factory slots */
.factory-slot-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    border: 2px solid rgba(139, 92, 246, 0.2);
    padding: 12px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
    transition: border-color var(--dur-fast);
}

.factory-slot-card--active {
    border-color: rgba(139, 92, 246, 0.35);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2), 0 0 12px rgba(139, 92, 246, 0.12);
}

.factory-slot-card--empty {
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.1);
}

.factory-slot-card--locked {
    opacity: 0.65;
    border-color: rgba(255, 255, 255, 0.06);
}

.factory-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.factory-progress-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #fbbf24);
    border-radius: 6px;
    transition: width 0.4s var(--ease-bounce);
}

.factory-btn-collect {
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-heading);
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.22);
}

.factory-btn-cancel {
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.7rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
    cursor: pointer;
}

/* Compact / action modals */
.klife-compact-modal,
#craft-qty-overlay .shop-modal,
#seed-details-overlay .seed-details-panel,
#unlock-overlay .shop-modal,
#register-confirm-modal .glass-panel,
#buy-materials-overlay .shop-modal,
#egg-cracking-overlay .glass-panel,
#chicken-action-overlay .glass-panel,
#husbandry-lock-overlay .glass-panel,
#slaughter-warning-overlay .glass-panel,
#collect-partial-overlay .glass-panel,
#kfarm-buy-life-overlay .shop-modal,
#friends-unfriend-overlay .shop-modal,
#settings-link-overlay .shop-modal,
#settings-unlink-confirm-overlay .shop-modal,
.shelter-action-modal:not(.friends-modal-panel) {
    border: 3px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: var(--clay-shadow-out) !important;
}

#craft-qty-overlay .shop-modal {
    border-color: rgba(139, 92, 246, 0.25) !important;
}

#unlock-overlay .shop-modal {
    border-color: rgba(16, 185, 129, 0.25) !important;
}

.craft-qty-item-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    border: 2px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.craft-qty-stepper {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.22);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    height: 40px;
}

.craft-qty-stepper button {
    width: 36px;
    height: 100%;
    border: none;
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    transition: background var(--dur-fast);
}

.craft-qty-stepper button:hover {
    background: rgba(139, 92, 246, 0.2);
}

.craft-qty-stepper input {
    flex: 1;
    border: none;
    background: none;
    color: #fff;
    text-align: center;
    font-weight: 700;
    font-size: 0.88rem;
    outline: none;
}

/* Check-in sub-modals */
.checkin-milestone-modal,
.checkin-egg-hatch-modal,
.checkin-day-detail-modal {
    border: 3px solid rgba(245, 158, 11, 0.28) !important;
    box-shadow: var(--clay-shadow-out), 0 0 24px rgba(245, 158, 11, 0.1) !important;
}

/* Telegram / register */
#telegram-link-overlay .glass-panel,
#telegram-conflict-overlay .glass-panel,
#register-confirm-modal .glass-panel {
    border: 3px solid rgba(59, 130, 246, 0.25) !important;
    box-shadow: var(--clay-shadow-out), 0 0 20px rgba(59, 130, 246, 0.08) !important;
}

/* ============================================================
   PHASE 27 — KFarm hub, buy-life, Pikachu result/actions
   ============================================================ */

#kfarm-hub-overlay {
    align-items: center;
    justify-content: center;
    padding: calc(10px + var(--klife-pad-top)) calc(10px + var(--klife-pad-right)) calc(10px + var(--klife-pad-bottom)) calc(10px + var(--klife-pad-left));
    box-sizing: border-box;
}

#kfarm-hub-overlay .kfarm-hub-panel {
    border: 3px solid rgba(16, 185, 129, 0.28) !important;
    box-shadow: var(--clay-shadow-out), 0 0 28px rgba(16, 185, 129, 0.1) !important;
    height: var(--klife-modal-fixed-h);
    max-height: var(--klife-modal-fixed-h);
    min-height: var(--klife-modal-fixed-h);
    overflow: hidden;
    animation: modal-panel-in 0.42s var(--ease-bounce);
}

#kfarm-buy-life-overlay {
    display: none;
    z-index: 10020;
    align-items: center;
    justify-content: center;
    padding: calc(10px + var(--klife-pad-top)) calc(10px + var(--klife-pad-right)) calc(10px + var(--klife-pad-bottom)) calc(10px + var(--klife-pad-left));
    box-sizing: border-box;
}

#kfarm-buy-life-overlay .kfarm-buy-life-modal {
    max-width: 400px;
    width: min(96vw, 400px);
    border: 3px solid rgba(248, 113, 113, 0.28) !important;
    box-shadow: var(--clay-shadow-out), 0 0 24px rgba(248, 113, 113, 0.1) !important;
    animation: modal-panel-in 0.38s var(--ease-bounce);
}

#kfarm-buy-life-overlay .kfarm-buy-life-header {
    border-bottom: 1px solid rgba(248, 113, 113, 0.2);
    padding-bottom: 8px;
}

#kfarm-buy-life-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #fca5a5;
}

.kfarm-buy-life-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 0;
}

.kfarm-buy-life-icon {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

#kfarm-buy-life-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.kfarm-buy-life-cost-block {
    text-align: center;
    margin: 0;
}

#kfarm-buy-life-cost {
    font-size: 0.88rem;
    font-weight: 700;
    color: #fbbf24;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.kfarm-buy-life-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.kfarm-buy-life-btn {
    flex: 1;
}

#kfarm-buy-life-cancel {
    background: rgba(255, 255, 255, 0.06);
    box-shadow: none;
}

#kfarm-buy-life-confirm {
    background: linear-gradient(135deg, #f87171, #dc2626);
}

#pikachu-game-overlay {
    align-items: center;
    justify-content: center;
}

.pikachu-result-box {
    border: 3px solid rgba(139, 92, 246, 0.35) !important;
    box-shadow: var(--clay-shadow-out), 0 0 30px rgba(139, 92, 246, 0.2) !important;
    border-radius: 20px !important;
    background: linear-gradient(155deg, rgba(30, 27, 75, 0.96), rgba(22, 20, 55, 0.92)) !important;
    animation: modal-panel-in 0.4s var(--ease-bounce);
}

.pikachu-result-box h3 {
    font-family: var(--font-heading);
    text-shadow: 0 2px 8px rgba(251, 191, 36, 0.25);
}

.pikachu-result-actions button {
    border: 2px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.22) !important;
    transition: transform var(--dur-fast), box-shadow var(--dur-fast) !important;
}

.pikachu-result-actions button:hover {
    transform: translateY(-2px);
}

.pikachu-action-btn {
    border: 2px solid rgba(245, 158, 11, 0.45) !important;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2) !important;
    transition: transform var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast) !important;
}

.pikachu-action-btn:hover:not(:disabled):not(.pikachu-action-btn--disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.22), 0 0 12px rgba(139, 92, 246, 0.2) !important;
}

/* Side panels */
.side-panels > .glass-panel.panel:not(#global-chat-panel):not(#neighbors-panel) {
    border: 3px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: var(--clay-shadow-out), inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}

/* Floating menu mobile — compact density, more seed rows visible */
@media (max-width: 600px) {
    .floating-menu--mobile {
        width: min(84vw, 300px) !important;
        max-width: min(84vw, 300px) !important;
        max-height: min(82dvh, 560px) !important;
        padding: 8px 8px 10px !important;
        gap: 3px !important;
        border-radius: 14px !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    .floating-menu--mobile .floating-seed-item,
    .floating-seed-item {
        padding: 6px 8px !important;
        gap: 6px !important;
        border-radius: 8px !important;
        min-height: 0 !important;
    }

    .floating-seed-item:hover:not(.locked) {
        transform: none !important; /* no scale/translate on touch hover glitches */
    }

    .floating-seed-icon {
        width: 22px !important;
        height: 22px !important;
    }

    .floating-seed-name {
        font-size: 0.78rem !important;
    }

    .floating-seed-count,
    .floating-seed-req {
        font-size: 0.68rem !important;
    }

    .floating-seed-plot-header {
        padding: 4px 2px 6px !important;
    }

    .floating-seed-plot-header > div:first-child {
        font-size: 0.82rem !important;
    }

    .floating-seed-list {
        gap: 2px !important;
    }

    .floating-menu--mobile .btn-primary {
        padding: 7px 10px !important;
        font-size: 0.76rem !important;
        min-height: 34px !important;
    }
}

@media (max-width: 768px) {
    /* FIXED_TAB default: original density */
    #friends-overlay .friends-modal-panel,
    #quests-overlay .quests-modal-panel,
    #friend-chat-overlay .friend-chat-panel,
    #farm-bag-overlay .farm-sub-panel,
    #farm-warehouse-overlay .farm-sub-panel,
    #farm-research-overlay .farm-sub-panel,
    #farm-logs-overlay .farm-sub-panel,
    #farm-craft-overlay .farm-sub-panel,
    #farm-craft-overlay .shop-modal,
    #factory-overlay .factory-sub-panel,
    #world-gamecenter-overlay .world-sub-panel,
    #world-merchants-overlay .world-sub-panel,
    #world-market-overlay .world-sub-panel,
    #world-lottery-overlay .world-sub-panel,
    #world-maps-overlay .world-sub-panel,
    #kfarm-hub-overlay .kfarm-hub-panel {
        width: min(96vw, 660px);
        height: var(--klife-modal-fixed-h);
        max-height: var(--klife-modal-fixed-h);
        min-height: var(--klife-modal-fixed-h);
        padding: 12px 14px !important;
        border-radius: 18px;
    }
    /* Long-list panels only (measured scroll + free room) */
    #shop-overlay .shop-modal,
    #leaderboard-overlay .leaderboard-modal-panel,
    body.profile-page .badges-modal-panel {
        width: min(96vw, 660px);
        height: var(--klife-modal-fixed-h-list);
        max-height: var(--klife-modal-fixed-h-list);
        min-height: var(--klife-modal-fixed-h-list);
        padding: 12px 14px !important;
        border-radius: 18px;
    }

    .friend-row {
        flex-direction: column;
        align-items: stretch;
    }

    .friend-row__actions {
        min-width: 0;
        width: 100%;
    }

    .animal-shelter-card__icon {
        width: min(58cqw, 64cqh, 180px) !important;
        height: min(58cqw, 64cqh, 180px) !important;
    }
}

/* ============================================================
   PHASE 17-18 — Lottery, seed details, maps, farm icons
   ============================================================ */

.lottery-panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 2px;
}

.lottery-jackpot-banner {
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(202, 138, 4, 0.1));
    border: 2px dashed rgba(234, 179, 8, 0.4);
    border-radius: 16px;
    padding: 16px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 0 15px rgba(234, 179, 8, 0.15) inset;
}

.lottery-jackpot-banner__title {
    font-size: 0.75rem;
    font-weight: 800;
    color: #fef08a;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.lottery-jackpot-banner__unit {
    font-size: 0.75rem;
    font-weight: 700;
    color: #fef08a;
    flex-shrink: 0;
}

.lottery-buy-tabs {
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.25);
    padding: 4px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.lottery-tab-btn {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-heading);
    transition: background var(--dur-fast), color var(--dur-fast), transform var(--dur-fast);
}

.lottery-tab-btn--active {
    background: rgba(255, 255, 255, 0.1) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

.lottery-buy-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lottery-section-hint {
    font-size: 0.76rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.45;
}

.lottery-ready-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.lottery-field {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    width: 100%;
}

.lottery-field__label {
    font-size: 0.82rem;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--text-primary);
    line-height: 1.35;
    text-align: center;
}

/*
 * Lucky-number input — hero field of lottery form.
 * Overrides .qty-val-input (45–60px shop qty) so the field is full-width & balanced.
 */
input.lottery-guess-input.qty-val-input,
input.lottery-guess-input,
.lottery-guess-input {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 56px !important;
    min-height: 56px !important;
    flex: none !important;
    flex-grow: 0 !important;
    margin: 0 auto !important;
    padding: 0 16px !important;
    box-sizing: border-box !important;
    border-radius: 14px !important;
    border: 2px solid rgba(250, 204, 21, 0.35) !important;
    background:
        radial-gradient(ellipse 80% 120% at 50% 0%, rgba(250, 204, 21, 0.12), transparent 60%),
        rgba(0, 0, 0, 0.35) !important;
    color: #fde047 !important;
    text-align: center !important;
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace !important;
    font-size: 1.55rem !important;
    font-weight: 800 !important;
    font-variant-numeric: tabular-nums !important;
    letter-spacing: 0.08em !important;
    line-height: 1 !important;
    outline: none !important;
    box-shadow:
        0 3px 0 rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease !important;
    -moz-appearance: textfield !important;
}

.lottery-guess-input::placeholder {
    color: rgba(250, 204, 21, 0.35) !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.02em !important;
}

.lottery-guess-input:focus {
    border-color: rgba(250, 204, 21, 0.75) !important;
    box-shadow:
        0 0 0 3px rgba(250, 204, 21, 0.18),
        0 3px 0 rgba(0, 0, 0, 0.22),
        0 0 20px rgba(250, 204, 21, 0.12) !important;
    background:
        radial-gradient(ellipse 90% 140% at 50% 0%, rgba(250, 204, 21, 0.18), transparent 55%),
        rgba(0, 0, 0, 0.4) !important;
}

.lottery-guess-input::-webkit-outer-spin-button,
.lottery-guess-input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

.lottery-action-btn {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    font-size: 0.9rem;
    border-radius: 14px;
    font-family: var(--font-heading);
    font-weight: 800;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.22);
}

@media (max-width: 420px) {
    .lottery-guess-input {
        height: 52px !important;
        min-height: 52px !important;
        font-size: 1.4rem !important;
    }
}

.lottery-action-btn--paid {
    background: linear-gradient(135deg, #eab308, #ca8a04) !important;
}

.lottery-action-btn--free {
    background: linear-gradient(135deg, #34d399, #059669) !important;
}

.lottery-waiting-box {
    background: rgba(0, 0, 0, 0.22);
    padding: 15px;
    border-radius: 14px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-secondary);
    border: 2px solid rgba(255, 255, 255, 0.06);
}

.lottery-waiting-box #free-ticket-countdown {
    font-family: monospace;
    font-size: 1.1rem;
    color: #facc15;
    font-weight: 800;
    display: inline-block;
    margin-top: 6px;
}

.lottery-price-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
    padding: 12px 14px;
    border-radius: 14px;
    background:
        linear-gradient(135deg, rgba(250, 204, 21, 0.12), rgba(234, 179, 8, 0.04)),
        rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(250, 204, 21, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.lottery-price-info__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
}

.lottery-price-info__val {
    color: #facc15;
    font-size: 1.05rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.lottery-price-info__sub {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.35;
}

.lottery-my-tickets-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-top: 6px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 2px solid rgba(251, 191, 36, 0.28);
    background:
        linear-gradient(135deg, rgba(251, 191, 36, 0.14), rgba(120, 53, 15, 0.18)),
        rgba(15, 23, 42, 0.55);
    color: var(--text-primary);
    font-weight: 800;
    font-size: 0.88rem;
    cursor: pointer;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
    transition: transform 0.12s ease, border-color 0.15s ease, filter 0.15s ease;
}

.lottery-my-tickets-btn:hover {
    border-color: rgba(251, 191, 36, 0.5);
    filter: brightness(1.05);
}

.lottery-my-tickets-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.lottery-my-tickets-btn__icon {
    font-size: 1.15rem;
    line-height: 1;
}

.lottery-my-tickets-btn__text {
    flex: 1;
    text-align: left;
}

.lottery-my-tickets-btn__count {
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1c1917;
    font-size: 0.78rem;
    font-weight: 900;
    box-shadow: 0 2px 0 rgba(180, 83, 9, 0.4);
}

.lottery-tickets-popup {
    max-height: min(88vh, 640px);
    display: flex;
    flex-direction: column;
}

.lottery-tickets-popup__body {
    padding: 12px 14px 16px;
    min-height: 0;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.lottery-winner-banner {
    border-radius: 14px;
    padding: 12px;
    text-align: center;
    font-size: 0.8rem;
}

.lottery-winner-banner--has-winner {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.12), rgba(245, 158, 11, 0.06));
    border: 2px solid rgba(234, 179, 8, 0.28);
    box-shadow: 0 0 14px rgba(250, 204, 21, 0.1);
}

.lottery-winner-banner--empty {
    background: rgba(255, 255, 255, 0.02);
    border: 2px solid rgba(255, 255, 255, 0.06);
    font-size: 0.76rem;
    color: var(--text-secondary);
    padding: 10px;
}

.lottery-winner-banner__title {
    font-weight: 800;
    color: #fbbf24;
    margin-bottom: 4px;
}

.lottery-winner-banner__body {
    color: var(--text-primary);
    font-size: 0.82rem;
    line-height: 1.45;
}

.lottery-winner-banner__body strong {
    color: #facc15;
}

.lottery-winner-number {
    background: rgba(234, 179, 8, 0.25);
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 900;
    color: #fbbf24;
}

.lottery-tickets-list {
    max-height: min(62vh, 460px);
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overscroll-behavior: contain;
    padding: 2px 2px 8px 0;
    min-width: 0;
    flex: 1;
}

.lottery-tickets-list--popup {
    max-height: none;
}

/*
 * Ticket cards — full-bleed art + horizontal content row (no blur panel, no clip).
 */
.lottery-ticket-card {
    position: relative;
    display: block;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    height: auto; /* grow with content — never clip chips/number */
    min-height: 70px;
    box-sizing: border-box;
    border-radius: 12px;
    border: 1.5px solid rgba(251, 191, 36, 0.45);
    box-shadow:
        0 3px 0 rgba(0, 0, 0, 0.3),
        0 10px 20px rgba(0, 0, 0, 0.28);
    animation: lottery-ticket-in 0.32s ease-out both;
    isolation: isolate;
    overflow: hidden; /* round bg corners only */
    background: #1e1b4b;
}

.lottery-ticket-card__bg-img {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    object-position: center;
    pointer-events: none;
    user-select: none;
    display: block;
}

/* No blur / frosted overlay — solid chips handle contrast */

@keyframes lottery-ticket-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

.lottery-ticket-card--win {
    border-color: rgba(253, 224, 71, 0.75);
    box-shadow:
        0 3px 0 rgba(180, 120, 20, 0.4),
        0 0 18px rgba(251, 191, 36, 0.32);
}

.lottery-ticket-card--free:not(.lottery-ticket-card--win) {
    border-color: rgba(110, 231, 183, 0.55);
}

.lottery-ticket-card--miss:not(.lottery-ticket-card--win) {
    filter: saturate(0.95);
}

/* Horizontal strip: [num block] …… [status] [kind] */
.lottery-ticket-card__body {
    position: relative;
    z-index: 2;
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    /* Leave left band for ticket stub art */
    padding: 10px 12px 10px clamp(48px, 16%, 72px);
}

.lottery-ticket-card__num-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    min-width: 0;
    flex: 0 1 auto;
}

.lottery-ticket-card__label {
    display: inline-block;
    max-width: 100%;
    padding: 0;
    border: none;
    background: none;
    border-radius: 0;
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fffbeb;
    line-height: 1.15;
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.9),
        0 0 6px rgba(0, 0, 0, 0.6);
    white-space: nowrap;
}

.lottery-ticket-card__number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.2rem;
    min-height: 34px;
    padding: 4px 12px;
    margin: 0;
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.72);
    border: 1.5px solid rgba(253, 224, 71, 0.55);
    box-sizing: border-box;
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
    font-size: clamp(1.15rem, 3.8vw, 1.35rem);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
    line-height: 1;
    color: #fffbeb;
    white-space: nowrap;
    text-shadow:
        0 0 8px rgba(253, 224, 71, 0.4),
        0 2px 2px rgba(0, 0, 0, 0.85);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        0 2px 0 rgba(0, 0, 0, 0.35);
}

.lottery-ticket-card--win .lottery-ticket-card__number {
    color: #1c1917;
    background: linear-gradient(180deg, #fef08a 0%, #fbbf24 55%, #f59e0b 100%);
    border-color: rgba(255, 255, 255, 0.45);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
    box-shadow:
        0 2px 0 rgba(146, 64, 14, 0.45),
        0 0 12px rgba(251, 191, 36, 0.4);
}

.lottery-ticket-card--miss:not(.lottery-ticket-card--win) .lottery-ticket-card__number {
    color: #f8fafc;
    background: rgba(15, 23, 42, 0.82);
    border-color: rgba(226, 232, 240, 0.28);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.lottery-ticket-card--free:not(.lottery-ticket-card--win) .lottery-ticket-card__number {
    border-color: rgba(110, 231, 183, 0.55);
}

.lottery-ticket-card__chips {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
    flex: 0 1 auto;
}

.lottery-ticket-status {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 900;
    line-height: 1.2;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.lottery-ticket-status--win {
    background: linear-gradient(135deg, #fde047, #f59e0b);
    color: #1c1917;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 2px 0 rgba(146, 64, 14, 0.4);
}

.lottery-ticket-status--miss {
    background: rgba(15, 23, 42, 0.9);
    color: #f1f5f9;
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.lottery-ticket-kind {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    border: 1px solid transparent;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.28);
}

.lottery-ticket-kind--free {
    color: #ecfdf5;
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: rgba(167, 243, 208, 0.4);
}

.lottery-ticket-kind--paid {
    color: #1c1917;
    background: linear-gradient(135deg, #fde68a, #fbbf24);
    border-color: rgba(255, 255, 255, 0.35);
}

.lottery-ticket-kind img {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
}

@media (max-width: 380px) {
    .lottery-ticket-card__body {
        padding-left: clamp(40px, 14%, 56px);
        gap: 8px;
    }
    .lottery-ticket-card__number {
        min-height: 32px;
        padding: 3px 10px;
        font-size: 1.1rem;
    }
    .lottery-ticket-status,
    .lottery-ticket-kind {
        padding: 3px 8px;
        font-size: 0.64rem;
    }
}

.lottery-tickets-empty {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.82rem;
    padding: 28px 14px;
    border-radius: 14px;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.18);
    line-height: 1.45;
}

/* legacy class names kept for stagger / reduced-motion selectors */
.lottery-ticket-row {
    /* no-op shell — cards use .lottery-ticket-card */
}

/* Seed details */
#seed-details-overlay {
    align-items: center;
    justify-content: center;
}

#seed-details-overlay .seed-details-panel {
    border: 3px solid rgba(16, 185, 129, 0.25) !important;
    box-shadow: var(--clay-shadow-out), 0 0 24px rgba(16, 185, 129, 0.08) !important;
}

.seed-details-panel--enter {
    animation: seed-details-enter 0.45s var(--ease-bounce);
}

@keyframes seed-details-enter {
    0% { opacity: 0; transform: scale(0.92) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.seed-details-hero {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    border: 2px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.seed-details-hero__icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.seed-details-hero-title {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-primary);
}

.seed-details-hero-sub {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.seed-details-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.22);
    border-radius: 14px;
    padding: 12px;
    border: 2px solid rgba(255, 255, 255, 0.06);
}

.seed-detail-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.seed-detail-stat-row span {
    color: var(--text-secondary);
}

.seed-detail-stat-row__val {
    color: #fbbf24;
    display: flex;
    align-items: center;
    gap: 3px;
}

.seed-detail-stat-row__val--time { color: #fbbf24; }
.seed-detail-stat-row__val--yield { color: #10b981; }
.seed-detail-stat-row__val--profit { color: #10b981; font-size: 0.9rem; }
.seed-detail-stat-row__val--loss { color: #ef4444; font-size: 0.9rem; }

.seed-detail-stat-row--divider {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 6px;
    margin-bottom: 2px;
}

.seed-detail-stat-row--total {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 6px;
    margin-top: 2px;
}

.seed-detail-stat-row--total span {
    font-weight: 600;
}

.seed-details-close-btn {
    width: 100%;
    padding: 10px;
    border-radius: 12px;
    font-weight: 700;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    cursor: pointer;
    font-family: var(--font-heading);
    transition: background var(--dur-fast), transform var(--dur-fast);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

.seed-details-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

/* World maps popups */
.world-maps-save-popup {
    border: 3px solid rgba(14, 165, 233, 0.28) !important;
    box-shadow: var(--clay-shadow-out), 0 0 24px rgba(14, 165, 233, 0.1) !important;
}

.world-maps-cluster-popup {
    border: 3px solid rgba(139, 92, 246, 0.28) !important;
    box-shadow: var(--clay-shadow-out), 0 0 28px rgba(139, 92, 246, 0.12) !important;
}

.world-maps-cluster-row {
    border: 2px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
    border-radius: 14px !important;
}

.world-maps-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================================
   PHASE 19-20 — Bag, warehouse, research internals
   ============================================================ */

.bag-page-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 5px 0;
}

.bag-page-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    cursor: pointer;
    font-family: var(--font-heading);
    transition: background var(--dur-fast), transform var(--dur-fast);
}

.bag-page-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    transform: translateY(-1px);
}

.bag-page-indicator {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.bag-grid-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    padding: 8px 0;
    /* 4 rows visible: slots size from column width; page holds 4×cols */
    align-content: start;
}
#farm-bag-overlay #bag-grid-container {
    /* Prefer ~4 rows in view before page scroll; detail/upgrade stay below */
    max-height: calc(4 * (min(64px, 18vw) + 10px));
    overflow: hidden;
}
#farm-bag-overlay .bag-slot {
    max-width: 64px;
    max-height: 64px;
    width: 100%;
    margin: 0 auto;
}

.bag-slot--empty {
    background: rgba(255, 255, 255, 0.02) !important;
    border-style: dashed !important;
}

.bag-slot--locked {
    background: rgba(0, 0, 0, 0.22) !important;
    cursor: not-allowed !important;
    opacity: 0.55;
}

.bag-slot-lock {
    font-size: 0.8rem;
    opacity: 0.45;
}

.bag-detail-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    border: 2px solid rgba(139, 92, 246, 0.2);
    border-radius: 14px;
    padding: 12px 12px 44px;
    font-size: 0.82rem;
    text-align: left;
    min-height: 95px;
    margin-bottom: 12px;
    position: relative;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.bag-detail-card__name {
    font-weight: 700;
    color: #a78bfa;
    margin-bottom: 4px;
}

.bag-detail-card__desc {
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding-right: 70px;
}

.bag-detail-card__desc--egg {
    padding-left: 88px;
    padding-right: 88px;
}

.bag-detail-card__actions {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.bag-detail-btn {
    padding: 6px 12px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.75rem;
    border: none;
    cursor: pointer;
    font-family: var(--font-heading);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

.bag-detail-btn--use {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

.bag-detail-btn--discard {
    margin-left: auto;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

.bag-upgrade-banner {
    background: linear-gradient(145deg, rgba(139, 92, 246, 0.08), rgba(139, 92, 246, 0.03));
    border: 2px solid rgba(139, 92, 246, 0.22);
    border-radius: 14px;
    padding: 12px;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.bag-upgrade-banner__title {
    font-weight: 700;
    color: #c084fc;
    margin-bottom: 3px;
}

.bag-upgrade-banner__req {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.bag-upgrade-banner__btn {
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    color: #fff;
    font-family: var(--font-heading);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.22);
    flex-shrink: 0;
}

.bag-upgrade-banner--maxed {
    justify-content: center;
}

.bag-upgrade-banner__maxed {
    font-weight: 700;
    color: var(--color-success);
    text-align: center;
    width: 100%;
}

.warehouse-cap-section {
    padding: 5px 0 12px;
}

.warehouse-cap-head {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.warehouse-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 5px;
    margin-bottom: 15px;
}

.warehouse-empty {
    text-align: center;
    padding: 15px;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.warehouse-row__main {
    display: flex;
    align-items: center;
    gap: 8px;
}

.warehouse-row__icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.warehouse-row__info {
    display: flex;
    flex-direction: column;
}

.warehouse-row__name {
    font-weight: 700;
    color: var(--text-primary);
}

.warehouse-row__expiry {
    font-size: 0.68rem;
    margin-top: 2px;
    color: var(--text-secondary);
}

.warehouse-upgrade-banner {
    background: linear-gradient(145deg, rgba(245, 158, 11, 0.08), rgba(245, 158, 11, 0.03));
    border: 2px solid rgba(245, 158, 11, 0.22);
    border-radius: 14px;
    padding: 12px;
    font-size: 0.8rem;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.warehouse-upgrade-banner__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 10px;
}

.warehouse-upgrade-banner__title {
    font-weight: 700;
    color: #fbbf24;
}

.warehouse-upgrade-banner__desc {
    color: var(--text-secondary);
    font-size: 0.72rem;
    margin-top: 2px;
}

.warehouse-upgrade-banner__btn {
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: #fff;
    font-family: var(--font-heading);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.22);
    flex-shrink: 0;
}

.warehouse-upgrade-reqs {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 8px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    font-size: 0.75rem;
}

.research-detail-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    border: 2px solid rgba(16, 185, 129, 0.22) !important;
    border-radius: 14px !important;
    padding: 14px !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
    flex-shrink: 0;
}

.research-node--done .research-skill-circle {
    border-color: #10b981 !important;
}

.research-node--in_progress .research-skill-circle {
    border-color: #fbbf24 !important;
}

.research-node--locked .research-skill-circle {
    opacity: 0.65;
}

.research-node--selected .research-skill-circle {
    border-color: #f43f5e !important;
    box-shadow: 0 0 16px rgba(244, 63, 94, 0.45) !important;
}

#research-tabbar {
    display: flex;
    gap: 6px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.06) !important;
    padding-bottom: 8px !important;
    overflow-x: auto;
    user-select: none;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
}

#research-tabbar .shop-tab-btn {
    flex: 1;
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Friends tab panels — default visibility (JS toggles on switch) */
#friends-overlay #friends-list-tab {
    display: block;
}

#friends-overlay #friends-requests-tab,
#friends-overlay #friends-add-tab {
    display: none;
}

/* ── Custom farm cursor (desktop) ── */
body.klife-cursor-farm {
    cursor: url('../assets/cursor_farm.png') 4 4, auto;
}

body.klife-cursor-farm button,
body.klife-cursor-farm a,
body.klife-cursor-farm [role="button"],
body.klife-cursor-farm .bag-slot,
body.klife-cursor-farm .shop-item-row,
body.klife-cursor-farm .farm-grid-card,
body.klife-cursor-farm .animal-shelter-card,
body.klife-cursor-farm .farm-tab-btn,
body.klife-cursor-farm .hud-btn,
body.klife-cursor-farm label,
body.klife-cursor-farm .lang-btn,
body.klife-cursor-farm .badge-row,
body.klife-cursor-farm .modal-header-close,
body.klife-cursor-farm .modal-header-btn,
body.klife-cursor-farm .checkin-day-tappable,
body.klife-cursor-farm .checkin-milestone-marker {
    cursor: url('../assets/cursor_farm.png') 4 4, pointer;
}

/* Profile badges modal — fixed frame on all viewports; taller on desktop */
/* Profile badges: audit INCREASE_OK (27 rows + free viewport) */
body.profile-page .badges-modal-panel {
    height: var(--klife-modal-fixed-h-list);
    max-height: var(--klife-modal-fixed-h-list);
    min-height: var(--klife-modal-fixed-h-list);
    overflow: hidden;
    flex-shrink: 0;
}

/* ── Leaf trail + click ripples ── */
#klife-leaf-layer,
#klife-ripple-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
    overflow: hidden;
}

.klife-leaf-particle {
    position: fixed;
    font-size: clamp(12px, 1.2vw, 16px);
    line-height: 1;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%);
    animation: klife-leaf-drift var(--dur, 1.5s) ease-out forwards;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

@keyframes klife-leaf-drift {
    0% { opacity: 0.85; transform: translate(-50%, -50%) rotate(0deg) scale(1); }
    100% { opacity: 0; transform: translate(calc(-50% + var(--drift-x, 0px)), calc(-50% + 28px)) rotate(120deg) scale(0.6); }
}

.klife-click-ripple {
    position: fixed;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border-radius: 50%;
    border: 2px solid rgba(16, 185, 129, 0.75);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.35);
    pointer-events: none;
    animation: klife-click-ripple 0.65s ease-out forwards;
}

.klife-click-ripple::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.35), transparent 70%);
}

@keyframes klife-click-ripple {
    0% { transform: scale(0.4); opacity: 1; }
    100% { transform: scale(3); opacity: 0; }
}

/* ============================================================
   PHASE 28 — Login screen, splash enter, register confirm
   ============================================================ */

#login-screen {
    padding: calc(20px + var(--klife-pad-top)) 20px calc(20px + var(--klife-pad-bottom));
    box-sizing: border-box;
}

#register-confirm-modal {
    display: none;
    align-items: center;
    justify-content: center;
    padding: calc(12px + var(--klife-pad-top)) calc(12px + var(--klife-pad-right)) calc(12px + var(--klife-pad-bottom)) calc(12px + var(--klife-pad-left));
}

.register-confirm-box {
    max-width: 400px;
    width: min(94vw, 400px);
    text-align: center;
    padding: 30px;
    border-radius: 16px;
    border: 3px solid rgba(59, 130, 246, 0.25) !important;
    box-shadow: var(--clay-shadow-out), 0 0 20px rgba(59, 130, 246, 0.08) !important;
    animation: modal-panel-in 0.45s var(--ease-bounce);
}

.register-confirm-box h3 {
    margin-bottom: 15px;
    background: linear-gradient(135deg, #10b981, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    font-size: 1.5rem;
    font-family: var(--font-heading);
}

.register-confirm-desc {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.register-confirm-box .confirm-info-box {
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    text-align: left;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.register-confirm-user-row {
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.register-confirm-username {
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
    float: right;
}

.register-confirm-pass-row {
    margin-top: 15px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.register-confirm-pass-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

#confirm-password-text {
    background: transparent;
    border: none;
    color: #fff;
    text-align: right;
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 600;
    width: 140px;
    outline: none;
}

#confirm-toggle-eye {
    cursor: pointer;
    font-size: 1.1rem;
}

.register-confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.register-confirm-actions .btn-secondary,
.register-confirm-actions .btn-primary {
    flex: 1;
    padding: 12px;
}

/* Splash boot enter */
.app-splash.show .app-splash-icon {
    animation: splash-icon-pop 0.55s var(--ease-bounce) 0.08s both;
}

.app-splash.show .app-splash-content {
    animation:
        splash-content-enter 0.55s var(--ease-bounce) both,
        splash-content-glow 3s ease-in-out 0.55s infinite alternate;
}

@keyframes splash-content-enter {
    0% { opacity: 0; transform: translateY(18px) scale(0.96); filter: blur(3px); }
    100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes splash-icon-pop {
    0% { opacity: 0; transform: scale(0.82); }
    70% { transform: scale(1.06); }
    100% { opacity: 1; transform: scale(1); }
}

/* ============================================================
   PHASE 29 — Mobile QA touch targets & modal heights
   ============================================================ */

@media (max-width: 768px) {
    .lottery-tab-btn {
        min-height: 44px;
        padding: 10px 8px;
    }

    .craft-qty-stepper {
        height: 44px;
    }

    .craft-qty-stepper button {
        width: 44px;
        min-width: 44px;
    }

    .maps-labeled-btn {
        min-height: 44px;
        padding: 8px 10px 8px 6px;
    }

    .maps-icon-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .pikachu-action-btn {
        min-height: 44px;
        padding: 8px 12px;
    }

    #pikachu-game-overlay .pikachu-game-panel {
        width: min(96vw, 520px);
        height: var(--klife-modal-fixed-h);
        max-height: var(--klife-modal-fixed-h);
        min-height: var(--klife-modal-fixed-h);
        border-radius: 18px;
    }
}

/* PHASE COMPLETE — UI clay coverage v2.0.189 */

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    body::before,
    body::after { animation: none; }
    #login-screen,
    #game-screen { transition: none; animation: none !important; opacity: 1; transform: none; }
    .app-splash-bg img,
    .app-splash-content,
    .app-splash.show .app-splash-icon,
    .app-splash.show .app-splash-content { animation: none !important; filter: none !important; }
    .register-confirm-box,
    #kfarm-hub-overlay .kfarm-hub-panel,
    #kfarm-buy-life-overlay .kfarm-buy-life-modal,
    .pikachu-result-box { animation: none !important; }
    .auth-step--enter,
    .chat-msg--enter,
    .chat-msg--enter .chat-msg-card,
    .hud-stat-pulse,
    .exp-bar-pulse,
    .login-card--glow .login-logo-icon,
    .checkin-modal--enter,
    .checkin-day--stamp,
    .checkin-today-box--pulse,
    .checkin-milestone-marker.claimable .checkin-milestone-orb,
    .player-row--highlight,
    .profile-card--enter,
    .settings-modal-panel--enter,
    .player-profile-card--enter,
    .quest-row--claim-flash,
    .quest-btn--claimable-glow,
    .quest-gift-btn--ready,
    .friend-chat-panel--enter,
    .friend-chat-msg--enter,
    .giftbox-reward-panel--enter,
    .giftbox-reward-icon-wrap,
    .giftbox-reward-row,
    .seed-details-panel--enter,
    .toast--enter,
    .floating-menu,
    .floating-seed-item { animation: none !important; }
}

/* ── Profile page (profile.html) ── */
body.profile-page {
    font-family: var(--font-body) !important;
    background-color: #090d16 !important;
    background-image:
        url('../assets/bg_leaves_pattern.png'),
        radial-gradient(at 10% 20%, rgba(139, 92, 246, 0.15) 0, transparent 50%),
        radial-gradient(at 90% 80%, rgba(16, 185, 129, 0.12) 0, transparent 50%) !important;
    background-size: 420px, auto, auto !important;
}

body.profile-page .profile-card {
    border: 3px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: var(--clay-shadow-out), var(--clay-shadow-in), 0 0 40px rgba(139, 92, 246, 0.1) !important;
    position: relative;
    overflow: hidden;
}

body.profile-page .profile-card::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(236, 72, 153, 0.08), transparent 65%);
}

body.profile-page .profile-card--enter {
    animation: profile-card-enter 0.5s var(--ease-bounce);
}

@keyframes profile-card-enter {
    0% { opacity: 0; transform: translateY(16px) scale(0.97); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

body.profile-page .logo-title {
    font-family: var(--font-heading) !important;
    background: linear-gradient(135deg, #ec4899, #8b5cf6, #10b981) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

body.profile-page .user-avatar-big {
    border: 3px solid rgba(236, 72, 153, 0.45) !important;
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25), 0 0 20px rgba(139, 92, 246, 0.35) !important;
    transition: transform var(--dur-med) var(--ease-bounce), box-shadow var(--dur-med);
}

body.profile-page .avatar-wrapper:hover .user-avatar-big {
    transform: scale(1.05);
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25), 0 0 28px rgba(236, 72, 153, 0.4) !important;
}

body.profile-page .profile-stat-box {
    border: 2px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)) !important;
}

body.profile-page .stat-val {
    font-family: var(--font-heading);
}

body.profile-page .btn-primary {
    font-family: var(--font-heading) !important;
    border: 2px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25) !important;
    transition: transform var(--dur-fast), box-shadow var(--dur-fast) !important;
}

body.profile-page .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25), 0 0 14px rgba(16, 185, 129, 0.25) !important;
}

body.profile-page .badge-card {
    transition: transform var(--dur-fast) var(--ease-bounce), box-shadow var(--dur-fast) !important;
}

body.profile-page .badge-card:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2), 0 0 12px rgba(139, 92, 246, 0.2) !important;
}

/* ============================================================
   PHASE 24 — Friends unfriend compact modal
   ============================================================ */

#friends-unfriend-overlay {
    align-items: center;
    justify-content: center;
}

#friends-unfriend-overlay .friends-unfriend-panel {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px;
    padding: 18px !important;
    border: 3px solid rgba(239, 68, 68, 0.25) !important;
    box-shadow: var(--clay-shadow-out), 0 0 20px rgba(239, 68, 68, 0.08) !important;
}

.friends-unfriend-header {
    border-bottom: 1px solid rgba(239, 68, 68, 0.2) !important;
    padding-bottom: 8px !important;
}

#friends-unfriend-overlay .friends-unfriend-title {
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    color: #f87171 !important;
}

.friends-unfriend-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 0;
}

.friends-unfriend-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.friends-unfriend-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.friends-unfriend-btn-cancel {
    flex: 1;
    background: rgba(255, 255, 255, 0.06) !important;
    box-shadow: none !important;
}

.friends-unfriend-btn-confirm {
    flex: 1;
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
}

/* ============================================================
   PHASE 25 — Settings link / unlink compact modals
   ============================================================ */

#settings-link-overlay,
#settings-unlink-confirm-overlay {
    align-items: center;
    justify-content: center;
}

#settings-link-overlay .settings-link-panel {
    border: 3px solid rgba(59, 130, 246, 0.22) !important;
    box-shadow: var(--clay-shadow-out), 0 0 20px rgba(59, 130, 246, 0.08) !important;
}

#settings-unlink-confirm-overlay .settings-unlink-panel {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px;
    padding: 18px !important;
    text-align: center;
    border: 3px solid rgba(59, 130, 246, 0.22) !important;
    box-shadow: var(--clay-shadow-out), 0 0 20px rgba(59, 130, 246, 0.08) !important;
}

.settings-unlink-header {
    border-bottom: none !important;
    margin-bottom: 0 !important;
}

.settings-unlink-desc {
    margin: 0;
    font-size: 0.86rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.settings-unlink-actions {
    display: flex;
    gap: 10px;
}

.settings-unlink-btn-cancel,
.settings-unlink-btn-confirm {
    flex: 1;
}

.settings-unlink-btn-confirm {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
}

.settings-row {
    transition: border-color var(--dur-fast), background var(--dur-fast);
}

.settings-row:hover {
    border-color: rgba(236, 72, 153, 0.25);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
}

/* ============================================================
   PHASE 26 — World panel i18n empty states
   ============================================================ */

.merchants-list-empty {
    text-align: center;
    padding: 30px 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* ============================================================
   PHASE 21 — Animal detail internals
   ============================================================ */

.animal-progress-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.animal-xp-card {
    background: linear-gradient(145deg, rgba(167, 139, 250, 0.08), rgba(139, 92, 246, 0.03));
    border: 2px solid rgba(167, 139, 250, 0.22);
    padding: 10px 12px;
    border-radius: 14px;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.animal-xp-card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.animal-xp-card__label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #a78bfa;
    text-transform: uppercase;
    font-family: var(--font-heading);
}

.animal-xp-card__level {
    font-size: 0.72rem;
    font-weight: 800;
    color: #c4b5fd;
}

.animal-xp-card__track {
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.animal-xp-card__fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
    border-radius: 4px;
    transition: width 0.3s var(--ease-smooth);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.45);
}

.animal-xp-card__text {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.animal-storage-card {
    background: linear-gradient(145deg, rgba(251, 191, 36, 0.08), rgba(245, 158, 11, 0.03));
    border: 2px solid rgba(251, 191, 36, 0.22);
    padding: 10px 12px;
    border-radius: 14px;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.animal-storage-card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.animal-storage-card__label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #fbbf24;
    text-transform: uppercase;
    font-family: var(--font-heading);
}

.animal-storage-card__level {
    font-size: 0.72rem;
    font-weight: 800;
    color: #fcd34d;
}

.animal-storage-card__caps {
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.animal-storage-card__warn {
    font-size: 0.65rem;
    color: #f59e0b;
    margin-top: 4px;
}

.animal-storage-card__upgrade-btn {
    display: none;
    margin-top: 8px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: #000;
    font-weight: 800;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: var(--font-heading);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.22);
    transition: transform var(--dur-fast);
}

.animal-storage-card__upgrade-btn:hover {
    transform: translateY(-2px);
}

.animal-slot-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    border: 2px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 8px 12px;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.16);
    transition: border-color var(--dur-fast), transform var(--dur-fast);
}

.animal-slot-row:hover {
    border-color: rgba(245, 158, 11, 0.22);
    transform: translateX(2px);
}

.animal-slot-row__title {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-primary);
    font-family: var(--font-heading);
}

.animal-slot-row__status {
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.animal-adopt-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    border: 2px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.animal-adopt-card__prompt {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}

.animal-adopt-card__qty-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 5px 0;
}

.animal-adopt-card__qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform var(--dur-fast), background var(--dur-fast);
}

.animal-adopt-card__qty-btn--plus10 {
    width: auto;
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 0.75rem;
}

.animal-adopt-card__qty-btn:hover {
    background: rgba(251, 191, 36, 0.12);
    transform: scale(1.05);
}

.animal-adopt-card__qty-val {
    font-size: 1.2rem;
    font-weight: 800;
    color: #fbbf24;
    min-width: 30px;
    text-align: center;
    font-family: var(--font-heading);
}

.animal-adopt-card__cost {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 4px;
}

.animal-adopt-card__cost-val {
    color: #fbbf24;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.animal-adopt-card__submit {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.85rem;
    border: none;
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: white;
    cursor: pointer;
    font-family: var(--font-heading);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.22);
    transition: transform var(--dur-fast);
}

.animal-adopt-card__submit:hover {
    transform: translateY(-2px);
}

/* ============================================================
   PHASE 22 — Shop rows + header icon
   ============================================================ */

.shop-modal-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.shop-buy-row {
    border-color: rgba(16, 185, 129, 0.14) !important;
}

.shop-buy-row:hover {
    border-color: rgba(16, 185, 129, 0.32) !important;
    box-shadow: 0 5px 0 rgba(0, 0, 0, 0.2), 0 0 12px rgba(16, 185, 129, 0.12) !important;
}

.shop-sell-row {
    border-color: rgba(245, 158, 11, 0.14) !important;
}

.shop-sell-row:hover {
    border-color: rgba(245, 158, 11, 0.32) !important;
    box-shadow: 0 5px 0 rgba(0, 0, 0, 0.2), 0 0 12px rgba(245, 158, 11, 0.12) !important;
}

.shop-row-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.shop-row-icon--clickable {
    cursor: pointer;
    transition: transform var(--dur-fast) var(--ease-bounce);
}

.shop-row-icon--clickable:hover {
    transform: scale(1.08);
}

.shop-row-name--link {
    cursor: pointer;
    text-decoration: underline;
}

.shop-row-meta {
    font-size: 0.75rem;
    color: #a7f3d0;
    margin-top: 2px;
}

.shop-row-qty {
    font-size: 0.72rem;
    color: #10b981;
    font-weight: normal;
    margin-left: 4px;
}

/* ============================================================
   PHASE 23 — Egg / chicken growth / shelter cost rows
   ============================================================ */

.gacha-egg-btn--selected,
.gacha-egg-btn.active {
    border-color: #fbbf24 !important;
    background: linear-gradient(145deg, rgba(251, 191, 36, 0.1), rgba(245, 158, 11, 0.04)) !important;
    box-shadow: 0 0 16px rgba(251, 191, 36, 0.25), 0 3px 0 rgba(0, 0, 0, 0.2) !important;
    transform: scale(1.02);
}

.egg-rates-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    border: 2px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 10px;
    text-align: left;
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.egg-rates-card__title {
    font-weight: bold;
    color: var(--text-primary);
    font-size: 0.75rem;
    margin-bottom: 2px;
    font-family: var(--font-heading);
}

.egg-rates-card__row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.chicken-growth-bar {
    width: 100px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
}

.chicken-growth-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
    border-radius: 3px;
    transition: width 0.3s var(--ease-smooth);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.45);
}

.shelter-cost-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    border: 2px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
    transition: border-color var(--dur-fast), transform var(--dur-fast);
}

.shelter-cost-row:hover {
    border-color: rgba(251, 191, 36, 0.25);
    transform: translateX(2px);
}

.shelter-cost-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shelter-cost-icon img {
    width: 40px !important;
    height: 40px !important;
}

.shelter-cost-label {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-primary);
    font-family: var(--font-heading);
}

.shelter-cost-sub {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.shelter-cost-sub--ok {
    color: #6ee7b7 !important;
}

.shelter-cost-sub--fail {
    color: #f87171 !important;
}

.shelter-cost-check {
    display: flex;
    align-items: center;
    gap: 6px;
}
/* ============================================================
   Daily Blessing / Divine Omen modal
   ============================================================ */

#blessing-overlay {
    align-items: center;
    justify-content: center;
    z-index: 10020;
}

.blessing-modal-panel {
    border: 2px solid rgba(251, 191, 36, 0.28) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 28px rgba(168, 85, 247, 0.12) !important;
}

.blessing-modal-header {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.22), rgba(139, 92, 246, 0.18)) !important;
}

.blessing-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 16px 8px;
    overscroll-behavior: contain;
}

.blessing-loading {
    text-align: center;
    padding: 36px 12px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.blessing-hero {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 12px;
    overflow: hidden;
    border: 1.5px solid rgba(255, 255, 255, 0.1);
}

.blessing-tone--bless {
    background: linear-gradient(145deg, rgba(251, 191, 36, 0.18), rgba(16, 185, 129, 0.1));
}
.blessing-tone--curse {
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.16), rgba(88, 28, 135, 0.14));
}
.blessing-tone--mixed {
    background: linear-gradient(145deg, rgba(56, 189, 248, 0.14), rgba(251, 191, 36, 0.12));
}

.blessing-hero-glow {
    position: absolute;
    inset: -40% -20% auto auto;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.35), transparent 70%);
    pointer-events: none;
}

.blessing-god-frame {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    flex-shrink: 0;
    padding: 3px;
    background: linear-gradient(145deg, rgba(251, 191, 36, 0.7), rgba(139, 92, 246, 0.55));
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.blessing-god-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    background: #0f172a;
}

.blessing-hero-text { min-width: 0; position: relative; z-index: 1; }

.blessing-god-name {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

.blessing-god-title {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.blessing-tone-pill {
    display: inline-block;
    margin-top: 8px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fde68a;
}

.blessing-tone--curse .blessing-tone-pill { color: #fca5a5; }
.blessing-tone--mixed .blessing-tone-pill { color: #7dd3fc; }

.blessing-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.blessing-meta-chip {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.blessing-scenario-title {
    margin: 0 0 8px;
    font-size: 1rem;
    font-weight: 800;
    font-family: var(--font-heading);
    color: var(--text-primary);
    line-height: 1.3;
}

.blessing-story {
    margin: 0 0 10px;
    font-size: 0.82rem;
    line-height: 1.55;
    color: rgba(226, 232, 240, 0.92);
}

.blessing-omen {
    margin: 0 0 14px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.45;
    color: #fde68a;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.18);
}

.blessing-effects-label {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.blessing-effects-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.blessing-effect-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.22);
}

.blessing-effect-card.is-bless {
    border-color: rgba(16, 185, 129, 0.28);
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.12), rgba(0, 0, 0, 0.18));
}

.blessing-effect-card.is-curse {
    border-color: rgba(239, 68, 68, 0.28);
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.12), rgba(0, 0, 0, 0.18));
}

.blessing-effect-crop {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.blessing-crop-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.blessing-crop-emoji { font-size: 1.25rem; }

.blessing-effect-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.blessing-effect-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.blessing-effect-kind {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.blessing-effect-card.is-bless .blessing-effect-delta { color: #34d399; font-weight: 800; font-size: 0.9rem; }
.blessing-effect-card.is-curse .blessing-effect-delta { color: #f87171; font-weight: 800; font-size: 0.9rem; }

.blessing-effect-mult {
    font-size: 0.68rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.blessing-footnote {
    margin: 0;
    font-size: 0.68rem;
    line-height: 1.45;
    color: var(--text-secondary);
    opacity: 0.9;
}

/* Blessing delta badges on seed picker rows */
.seed-bless-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    margin-left: 4px;
    padding: 1px 5px;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    line-height: 1.2;
    white-space: nowrap;
    vertical-align: middle;
}
.seed-bless-badge--up {
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.16);
    border: 1px solid rgba(52, 211, 153, 0.35);
}
.seed-bless-badge--down {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(248, 113, 113, 0.35);
}
.floating-seed-info {
    flex-wrap: wrap;
    align-items: center;
}
.seed-detail-stat-row--bless strong {
    font-variant-numeric: tabular-nums;
}
