:root {
    --bg-color: #f6efe5; --glass-bg: rgba(255, 248, 238, 0.72); --glass-border: rgba(255, 220, 198, 0.75);
    --text-primary: #5a3e3b; --text-secondary: #8a6d68;
    --color-health: #ff8fa3; --color-hunger: #f7b267; --color-happiness: #8ad7b7; --color-energy: #8ec9ff; --color-exp: #c7a6ff;
    --hud-shadow: 0 10px 22px rgba(180, 139, 122, 0.22);
    --radius-lg: 24px; --radius-md: 16px; --radius-sm: 8px;
}
* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; }
body { background: radial-gradient(circle at 20% 10%, #fff5e9 0%, #f7eee4 50%, #efe4d6 100%); font-family: 'Outfit', sans-serif; color: var(--text-primary); overflow: hidden; touch-action: none; display: flex; justify-content: center; align-items: center; min-height: 100vh; }
.app-container { position: relative; width: 100%; max-width: 450px; height: 100vh; max-height: 800px; aspect-ratio: 9/16; background-color: var(--bg-color); overflow: hidden; box-shadow: 0 18px 40px rgba(137, 98, 84, 0.22); }
/* Android APK uses the same .app-container rules as web (see above) so layout matches mobile browser. */
body.platform-android #boot-overlay,
body[data-platform-profile="android"] #boot-overlay {
    background-color: #f6efe5;
    background-image: url('splash.webp');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}
#game-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }
.boot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    min-width: 100%;
    min-height: 100%;
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background-color: #f6efe5;
    box-sizing: border-box;
}

.boot-overlay-card {
    width: 100%;
    max-width: 320px;
    padding: 1.25rem 1.15rem 1.05rem;
    border-radius: 24px;
    text-align: center;
}

.boot-overlay-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: #6e4a45;
    margin-bottom: 0.8rem;
}

.boot-overlay-label {
    font-size: 0.95rem;
    font-weight: 800;
    color: #7d544d;
    margin-bottom: 0.6rem;
}

.boot-overlay-sub {
    margin-top: 0.55rem;
    font-size: 0.78rem;
    color: #96766f;
    min-height: 1.05em;
}

.boot-overlay-bar {
    width: 100%;
    height: 14px;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(255, 214, 192, 0.88);
    background: rgba(255, 251, 245, 0.85);
    box-shadow: inset 0 2px 4px rgba(160, 118, 106, 0.16);
}

.boot-overlay-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #ffd39f, #ff9fc8);
    transition: width 0.18s ease-out;
}

/* Hide everything on body during boot — stat bars + nav are direct body children outside .app-container */
body.booting > *:not(#boot-overlay) {
    display: none !important;
    visibility: hidden !important;
}
.ui-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10; display: flex; flex-direction: column; justify-content: space-between; padding: 1rem; }
.pointer-events-none { pointer-events: none; } .pointer-events-auto { pointer-events: auto; }
.mt-1 { margin-top: 0.25rem; } .mt-2 { margin-top: 0.5rem; } .hidden { display: none !important; }

/* Event Banner */
.event-banner {
    position: absolute; top: 0; left: 0; width: 100%; z-index: 100;
    background: linear-gradient(90deg, #ef4444, #f59e0b);
    color: white; text-align: center; padding: 0.25rem; font-weight: bold; font-size: 0.85rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); animation: slideDown 0.3s ease-out;
}
@keyframes slideDown { 0% { transform: translateY(-100%); } 100% { transform: translateY(0); } }

.glass-panel {
    background: linear-gradient(155deg, rgba(255, 251, 245, 0.86), rgba(255, 240, 228, 0.74));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--hud-shadow);
}

/* Header / Stats */
.stats-header { border-radius: var(--radius-lg); padding: 1rem; display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem 1rem; box-shadow: 0 10px 25px rgba(173, 125, 110, 0.24); }
.stat-group { display: flex; align-items: center; gap: 0.5rem; } .stat-icon { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.stat-group-exp { grid-column: 1 / -1; }
.stat-bar-bg { flex-grow: 1; height: 10px; background: rgba(255,255,255,0.78); border-radius: 99px; overflow: hidden; box-shadow: inset 0 2px 4px rgba(160, 118, 106, 0.16); }
.stat-bar { height: 100%; width: 100%; border-radius: 99px; transition: width 0.3s ease-out, background-color 0.3s; }
.fill-health { background: linear-gradient(90deg, #ffb3c2, var(--color-health)); } .fill-hunger { background: linear-gradient(90deg, #ffd29a, var(--color-hunger)); }
.fill-happiness { background: linear-gradient(90deg, #b8ead5, var(--color-happiness)); } .fill-energy { background: linear-gradient(90deg, #bddfff, var(--color-energy)); }
.fill-exp { background: linear-gradient(90deg, #dbc8ff, var(--color-exp)); }
.exp-text { min-width: 32px; font-size: 0.8rem; font-weight: 800; color: #8f6f66; }

#top-stats-bar .stats-header {
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 14px;
}

#top-stats-bar {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
}

.top-stats-bar-center {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: min(96vw, 420px);
    margin: 0 auto;
}

.stats-header-below-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.42rem;
    padding: 0 0.12rem;
    width: 100%;
}

.stats-header-left-actions {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}

.stats-side-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}

@keyframes hubShineSpin {
    to { transform: rotate(360deg); }
}

@keyframes hubIconNudge {
    0%, 88%, 100% { transform: rotate(0deg) scale(1); }
    90% { transform: rotate(-7deg) scale(1.08); }
    92% { transform: rotate(7deg) scale(1.08); }
    94% { transform: rotate(-5deg) scale(1.05); }
    96% { transform: rotate(5deg) scale(1.05); }
}

.hub-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 14px;
    -webkit-tap-highlight-color: transparent;
}

.hub-icon-btn::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 16px;
    background: conic-gradient(
        #ff6b9d,
        #ffc857,
        #7bed9f,
        #70a1ff,
        #c56cf0,
        #ff9a62,
        #ff6b9d
    );
    animation: hubShineSpin 2.4s linear infinite;
    z-index: 0;
    filter: drop-shadow(0 0 7px rgba(255, 120, 160, 0.5));
    transform-origin: center center;
}

.hub-icon-btn::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 12px;
    background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.55), rgba(255, 248, 239, 0.15) 55%, transparent 72%);
    z-index: 1;
    pointer-events: none;
}

.hub-icon-btn .hub-icon-img {
    position: relative;
    z-index: 2;
    width: 34px;
    height: 34px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(95, 61, 66, 0.25));
    pointer-events: none;
}

.hub-icon-btn.hub-has-alert .hub-icon-img {
    animation: hubIconNudge 5s ease-in-out infinite;
    transform-origin: center center;
}

.hub-icon-btn:active .hub-icon-img {
    transform: scale(0.94);
}

.missions-popup-card,
.wheel-popup-card {
    max-width: 440px;
    width: min(94vw, 440px);
    max-height: min(88vh, 720px);
    overflow: auto;
}

.mission-tabs {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.mission-tab {
    flex: 1;
    border: 1px solid rgba(210, 170, 150, 0.5);
    background: rgba(255, 255, 255, 0.65);
    color: #7a5a52;
    border-radius: 999px;
    padding: 0.45rem 0.5rem;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
}

.mission-tab.active {
    background: linear-gradient(135deg, #ffd8ee, #ffe4ba);
    color: #5f3d42;
}

.missions-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.missions-empty {
    color: #8f6f66;
    font-size: 0.85rem;
    margin: 0.4rem 0;
}

.mission-card {
    border: 1px solid rgba(210, 170, 150, 0.45);
    border-radius: 12px;
    padding: 0.65rem 0.75rem;
    background: rgba(255, 255, 255, 0.55);
}

.mission-card.claimable {
    border-color: rgba(232, 93, 117, 0.55);
    box-shadow: 0 0 0 1px rgba(232, 93, 117, 0.15);
}

.mission-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.mission-card-head h4 {
    margin: 0;
    font-size: 0.92rem;
    color: #5f3d42;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem;
}

.mission-daily-reset {
    font-size: 0.68rem;
    font-weight: 700;
    color: #a67c72;
    text-transform: lowercase;
}

.mission-desc {
    margin: 0.25rem 0 0.45rem;
    font-size: 0.78rem;
    color: #8f6f66;
}

.mission-progress {
    height: 8px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.8);
    overflow: hidden;
    margin-bottom: 0.45rem;
}

.mission-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffb3c2, #e85d75);
    border-radius: 99px;
    transition: width 0.25s ease;
}

.mission-reward {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #74464a;
}

.mission-reward img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.mission-claim-btn,
.mission-ad-btn {
    border: none;
    border-radius: 999px;
    padding: 0.28rem 0.65rem;
    background: linear-gradient(135deg, #ff9bb0, #e85d75);
    color: #fff;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.mission-ad-btn {
    background: linear-gradient(135deg, #8ec5ff, #5b9fd4);
}

.mission-ad-btn:disabled,
.mission-claim-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: #d4c4bc;
    color: #fff;
}

.mission-status {
    font-size: 0.72rem;
    font-weight: 800;
    color: #8f6f66;
}

.mission-status.claimed {
    color: #5a9a6e;
}

.wheel-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.9rem;
    font-size: 0.78rem;
    color: #74464a;
    margin-bottom: 0.65rem;
}

.wheel-stage {
    position: relative;
    width: min(72vw, 280px);
    height: min(72vw, 280px);
    margin: 0 auto 0.85rem;
}

.wheel-spinner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 6px solid rgba(255, 223, 198, 0.95);
    box-shadow: 0 10px 28px rgba(160, 112, 108, 0.28);
    position: relative;
    will-change: transform;
}

.wheel-prize-label {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    pointer-events: none;
    text-align: center;
}

.wheel-prize-label img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.wheel-prize-label span {
    font-size: 0.62rem;
    font-weight: 800;
    color: #5f3d42;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.wheel-pointer {
    position: absolute;
    top: auto;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 22px solid #e85d75;
    border-bottom: none;
    z-index: 3;
    filter: drop-shadow(0 2px 4px rgba(120, 40, 55, 0.35));
}

.wheel-center-cap {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 52px;
    height: 52px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: linear-gradient(135deg, #fff8ef, #ffe4ba);
    border: 3px solid rgba(255, 223, 198, 0.95);
    box-shadow: 0 4px 12px rgba(160, 112, 108, 0.25);
    z-index: 2;
    pointer-events: none;
}

.wheel-spin-btn {
    display: block;
    width: 100%;
    border: none;
    border-radius: 999px;
    padding: 0.7rem 1rem;
    background: linear-gradient(135deg, #ff9bb0, #e85d75);
    color: #fff;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(160, 112, 108, 0.28);
}

.wheel-spin-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.wheel-result {
    margin-top: 0.75rem;
}

.wheel-result-card {
    text-align: center;
    padding: 0.85rem;
    border-radius: 14px;
}

.wheel-result-title {
    margin: 0 0 0.5rem;
    font-weight: 800;
    color: #5f3d42;
}

.wheel-result-icon {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin: 0 auto 0.35rem;
    display: block;
}

.wheel-result-name {
    margin: 0;
    font-weight: 800;
    color: #74464a;
}

.wheel-result-total {
    margin: 0.25rem 0 0.65rem;
    color: #8f6f66;
}

.wheel-result-close {
    border: none;
    border-radius: 999px;
    padding: 0.45rem 1.2rem;
    background: linear-gradient(135deg, #ffd8ee, #ffe4ba);
    color: #74464a;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.evolve-widget {
    position: absolute;
    right: 0.35rem;
    top: 120px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
    z-index: 36;
}

.evolve-btn {
    border: 1px solid rgba(255, 223, 198, 0.9);
    background: linear-gradient(135deg, #ffd8ee, #ffe4ba);
    color: #74464a;
    border-radius: 999px;
    padding: 0.28rem 0.7rem;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 7px 16px rgba(160, 112, 108, 0.25);
}

.evolve-btn:active {
    transform: scale(0.96);
}

.evolve-btn.busy {
    background: linear-gradient(135deg, #ffd4c1, #ffd1ea);
}

.evolve-countdown {
    background: rgba(255, 251, 245, 0.92);
    border: 1px solid rgba(255, 220, 195, 0.92);
    border-radius: 999px;
    padding: 0.17rem 0.52rem;
    color: #815b54;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 5px 12px rgba(165, 119, 105, 0.2);
}

/* Screens */
.screen { opacity: 0; pointer-events: none; transition: opacity 0.3s; padding-top: 150px; padding-bottom: 210px; }
.screen.active { opacity: 1; pointer-events: auto; }

/* Shop / bag / tamer popups must cover the persistent stats header */
#screen-shop.screen.active,
#screen-bag.screen.active,
#screen-workers.screen.active {
    z-index: 40;
}

.map-minimap-controls {
    position: absolute;
    right: 10px;
    top: 220px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 7px;
    border-radius: 12px;
    border: 1px solid rgba(255, 219, 194, 0.95);
    background: linear-gradient(145deg, rgba(255, 248, 239, 0.9), rgba(255, 233, 214, 0.86));
    box-shadow: 0 8px 16px rgba(167, 121, 103, 0.24);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 62;
}

.map-mini-btn {
    border: 1px solid rgba(255, 214, 192, 0.95);
    border-radius: 8px;
    padding: 4px 9px;
    font-family: 'Outfit', sans-serif;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #74483f;
    background: linear-gradient(145deg, rgba(255, 252, 248, 0.95), rgba(255, 240, 228, 0.92));
    cursor: pointer;
    box-shadow: 0 3px 7px rgba(170, 126, 108, 0.18);
}

.map-mini-btn.is-active {
    background: linear-gradient(135deg, #ffa3af, #ffc4a7);
    color: #6d3f3f;
    border-color: rgba(255, 231, 219, 0.98);
    box-shadow: 0 4px 10px rgba(176, 127, 108, 0.25);
}

/* Home Screen */
.pet-info { position: absolute; top: 0.2rem; left: 0.35rem; transform: none; padding: 0.42rem 0.8rem; border-radius: 99px; display: flex; align-items: center; gap: 0.65rem; box-shadow: 0 6px 16px rgba(166, 120, 103, 0.22); white-space: nowrap; z-index: 35; border: 1px solid rgba(255, 218, 198, 0.9); cursor: pointer; }
.pet-info h2 { font-size: 1.25rem; font-weight: 600; line-height: 1; }
.pet-info:active { transform: scale(0.98); }
.level-badge { background: linear-gradient(135deg, #ffc0da, #d8b6ff); color: #6a425a; padding: 0.1rem 0.6rem; border-radius: var(--radius-sm); font-size: 0.875rem; font-weight: 800; display: inline-block; line-height: 1.2; border: 1px solid rgba(255, 239, 248, 0.95); }

.home-header-actions {
    position: absolute;
    top: 0.2rem;
    right: 0.35rem;
    z-index: 40;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 0.38rem;
    max-width: min(78vw, 340px);
}

.home-coin-badge {
    position: static;
    margin: 0;
    padding: 0.42rem 0.72rem;
    border-radius: 99px;
    font-weight: 800;
    color: #d48721;
    font-size: 0.95rem;
    border: 1px solid rgba(255, 225, 168, 0.88);
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    flex-shrink: 0;
    max-width: min(46vw, 11.5rem);
    white-space: nowrap;
    box-shadow: 0 6px 14px rgba(166, 120, 103, 0.2);
}

.home-coin-badge #home-coin-count {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 7.5rem;
}

.info-hub-btn {
    position: absolute;
    top: 0.2rem;
    right: 6.05rem;
    z-index: 40;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(255, 218, 190, 0.9);
    background: linear-gradient(135deg, #ffd8ea, #ffe3c8);
    color: #714941;
    font-size: 1.12rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(166, 120, 103, 0.2);
}

.info-hub-btn:active {
    transform: scale(0.95);
}

.info-hub-layer {
    position: fixed;
    inset: 0;
    z-index: 2800;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(82, 57, 52, 0.38);
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.info-hub-layer.hidden {
    display: none !important;
}

.info-hub-card {
    width: min(390px, 94vw);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(255, 216, 193, 0.92);
    box-shadow: 0 16px 34px rgba(122, 87, 80, 0.28);
    pointer-events: auto;
    touch-action: manipulation;
}

#info-hub-card .info-tab,
#info-hub-card #btn-info-hub-close {
    pointer-events: auto;
    touch-action: manipulation;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(232, 171, 132, 0.35);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.pet-manager-btn {
    position: static;
    z-index: 40;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(255, 218, 190, 0.9);
    background: linear-gradient(135deg, #ffe1cd, #ffd6e4);
    color: #714941;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.75rem;
    min-width: 68px;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 6px 14px rgba(166, 120, 103, 0.2);
}
.pet-manager-btn:active {
    transform: scale(0.95);
}

.language-picker-btn {
    position: static;
    z-index: 40;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(255, 218, 190, 0.9);
    background: linear-gradient(135deg, #ffe1cd, #ffd6e4);
    font-size: 1.05rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(166, 120, 103, 0.2);
}

.language-picker-btn:active {
    transform: scale(0.95);
}

.language-picker-flag {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    object-fit: cover;
    display: block;
}

.pet-stats-info-btn {
    position: static;
    z-index: 40;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(255, 218, 190, 0.9);
    background: linear-gradient(135deg, #ffe1cd, #ffd6e4);
    color: #714941;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(166, 120, 103, 0.2);
}

.pet-stats-info-btn:active {
    transform: scale(0.95);
}

@media (max-width: 560px) {
    .stats-header-below-row {
        margin-top: 0.32rem;
        gap: 0.35rem;
    }
    .stats-side-actions {
        gap: 0.32rem;
    }
    .stats-side-actions .hub-icon-btn {
        width: 42px;
        height: 42px;
    }
    .stats-side-actions .hub-icon-btn .hub-icon-img {
        width: 30px;
        height: 30px;
    }
    .home-header-actions {
        gap: 0.28rem;
        max-width: min(82vw, 300px);
    }
    .home-coin-badge {
        padding: 0.36rem 0.58rem;
        font-size: 0.88rem;
        max-width: min(50vw, 9.5rem);
    }
    .home-coin-badge #home-coin-count {
        max-width: 5.5rem;
    }
    .language-picker-btn,
    .pet-stats-info-btn {
        width: 36px;
        height: 36px;
    }
    .pet-manager-btn {
        height: 36px;
        font-size: 0.75rem;
        min-width: 58px;
        max-width: 96px;
        padding: 0 0.52rem;
    }
}

/* Toggles */
.season-toggle { position: absolute; top: 210px; left: 50%; transform: translateX(-50%); background: linear-gradient(135deg, rgba(255, 247, 238, 0.95), rgba(255, 232, 214, 0.9)); border: 1px solid rgba(255, 217, 190, 0.9); color: #80554a; padding: 0.28rem 0.82rem; border-radius: 99px; font-size: 0.8rem; cursor: pointer; box-shadow: 0 6px 14px rgba(166, 120, 103, 0.2); }
.season-toggle:active { transform: translateX(-50%) scale(0.95); }
.season-toggle { top: 250px; background: linear-gradient(135deg, #ffc7e8, #d9b8ff); color: #6f3f68; border: 1px solid rgba(255, 228, 249, 0.96); font-weight: bold; }

.wakeup-btn {
    position: absolute;
    top: 294px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 46;
    border: 1px solid rgba(255, 219, 202, 0.95);
    border-radius: 999px;
    padding: 0.42rem 1rem;
    background: linear-gradient(135deg, #d9f6ff, #cfe7ff);
    color: #3f5b7a;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(125, 160, 192, 0.24);
}
.wakeup-btn:active { transform: translateX(-50%) scale(0.96); }

.pet-away-panel {
    position: absolute;
    top: 294px;
    left: 50%;
    transform: translateX(-50%);
    width: min(88%, 360px);
    z-index: 45;
    padding: 0.7rem 0.85rem;
    border-radius: 14px;
    text-align: center;
    border: 1px solid rgba(255, 216, 188, 0.94);
    background: linear-gradient(140deg, rgba(255, 248, 238, 0.95), rgba(255, 230, 211, 0.9));
}

.pet-away-message {
    font-size: 0.82rem;
    font-weight: 700;
    color: #7a5248;
    line-height: 1.3;
}

.call-pet-btn {
    margin-top: 0.5rem;
    border: 1px solid rgba(255, 219, 202, 0.95);
    border-radius: 999px;
    padding: 0.36rem 0.9rem;
    background: linear-gradient(135deg, #ffd3e5, #ffcba7);
    color: #704840;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
}

.call-pet-btn:disabled {
    opacity: 0.72;
    cursor: default;
}

.pet-call-countdown {
    margin-top: 0.4rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #845248;
}

.action-bar { position: absolute; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); left: 1rem; right: 1rem; border-radius: var(--radius-lg); padding: 0.8rem; display: flex; justify-content: space-around; gap: 0.55rem; background: linear-gradient(145deg, rgba(255, 248, 239, 0.88), rgba(255, 236, 218, 0.72)); border: 1px solid rgba(255, 222, 198, 0.85); box-shadow: 0 12px 20px rgba(156, 116, 100, 0.2); }
.action-btn { background: linear-gradient(155deg, rgba(255, 255, 255, 0.92), rgba(255, 243, 231, 0.94)); border: 1px solid rgba(255, 218, 190, 0.82); color: #7a574f; border-radius: var(--radius-md); padding: 0.72rem 0.25rem; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; font-family: inherit; font-weight: 700; font-size: 0.85rem; cursor: pointer; box-shadow: 0 6px 12px rgba(177, 132, 113, 0.2); min-height: 78px; justify-content: center; }
.action-btn:active { transform: scale(0.94); } .btn-icon { font-size: 1.75rem; line-height: 1; margin-bottom: 2px; display: inline-flex; align-items: center; justify-content: center; }

/* Sub-screen Content */
.screen-content { border-radius: var(--radius-lg); padding: 1.5rem; height: 100%; display: flex; flex-direction: column; overflow-y: auto; pointer-events: none; }
.screen.active .screen-content { pointer-events: auto; }
.screen-title { font-size: 1.5rem; margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.45rem; } .subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 1rem; }
.coin-display { font-weight: 800; color: #d48721; margin-bottom: 1rem; font-size: 1.2rem; display: flex; align-items: center; gap: 0.35rem; }

/* Map / Shop / Guilds Lists */
.map-zone-list, .guild-list { display: flex; flex-direction: column; gap: 1rem; }
.shop-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
    padding-right: 0.2rem;
}
.map-zone, .shop-item { background: linear-gradient(145deg, rgba(255, 251, 246, 0.95), rgba(255, 237, 224, 0.9)); border: 1px solid rgba(255, 219, 198, 0.85); border-radius: var(--radius-md); padding: 1rem; display: flex; align-items: center; gap: 1rem; box-shadow: 0 8px 16px rgba(170, 125, 107, 0.16); }
.pvp-zone { background: linear-gradient(135deg, rgba(255, 205, 215, 0.45), rgba(255, 231, 221, 0.8)); border-color: rgba(255, 170, 183, 0.75); }
.zone-icon, .shop-icon { font-size: 2.5rem; } .zone-info, .shop-info { flex-grow: 1; }
.zone-info h3, .shop-info h3 { font-size: 1.1rem; margin-bottom: 0.25rem; }
.zone-info p, .shop-info p { font-size: 0.8rem; color: var(--text-secondary); }
.explore-btn, .buy-btn { background: linear-gradient(135deg, #ffb9d8, #ffc8a8); color: #71453f; border: 1px solid rgba(255, 227, 212, 0.95); padding: 0.5rem 1rem; border-radius: var(--radius-sm); font-weight: 700; cursor: pointer; box-shadow: 0 4px 10px rgba(175, 127, 108, 0.2); }
.pvp-btn { background: linear-gradient(135deg, #ff9fb1, #ffb7a4); color: #6d3f3f; }
.explore-btn:active, .buy-btn:active { transform: scale(0.95); }

.equip-btn {
    margin-top: 0.45rem;
    padding: 0.42rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 224, 206, 0.96);
    background: linear-gradient(135deg, #ffd7e8, #ffe5c7);
    color: #71453f;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(175, 127, 108, 0.18);
    align-self: flex-start;
}

.equip-btn:hover {
    filter: brightness(1.01);
}

.equip-btn:active {
    transform: scale(0.96);
}

.equip-btn:disabled {
    opacity: 0.82;
    cursor: default;
}

.exit-scene-btn {
    background: linear-gradient(135deg, #ffa4b0, #ffb8a3) !important;
    color: #6f3f3f;
    border: 1px solid rgba(255, 225, 213, 0.95);
    border-radius: 14px;
    padding: 0.55rem 1rem;
    font-weight: 800;
}

.tabs {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 15px;
    background: rgba(255, 246, 236, 0.82);
    border: 1px solid rgba(255, 221, 198, 0.82);
    border-radius: 14px;
    padding: 0.28rem;
}

.tab-btn {
    flex: 1;
    padding: 0.38rem 0.45rem;
    border: 1px solid transparent;
    background: transparent;
    color: #8a6d68;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.82rem;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: linear-gradient(135deg, #ffd8ea, #ffe2c7);
    color: #714941;
    border-color: rgba(255, 226, 210, 0.95);
    box-shadow: 0 3px 8px rgba(170, 125, 107, 0.16);
}

/* Admin Panel */
.admin-controls { display: flex; flex-direction: column; gap: 0.5rem; }
.admin-btn { background: #3b82f6; color: white; border: none; padding: 1rem; border-radius: var(--radius-sm); font-weight: bold; font-family: inherit; font-size: 1rem; cursor: pointer; }
.admin-btn:active { transform: scale(0.98); opacity: 0.9; }
.admin-user-tools {
    margin-top: 0.8rem;
    border: 1px solid rgba(255, 216, 193, 0.9);
    border-radius: 14px;
    padding: 0.75rem;
    background: rgba(255, 247, 236, 0.65);
}
.admin-tools-title {
    margin: 0 0 0.55rem;
    font-size: 0.96rem;
    color: #7a5045;
}
.admin-search-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.45rem;
    align-items: center;
}
.admin-search-row .admin-btn {
    padding: 0.65rem 0.95rem;
    font-size: 0.86rem;
}
.admin-search-results {
    margin-top: 0.55rem;
    max-height: 200px;
    overflow-y: auto;
    display: grid;
    gap: 0.35rem;
}
.admin-search-item {
    border: 1px solid rgba(232, 194, 175, 0.95);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.85);
    color: #6f4740;
    font: inherit;
    padding: 0.5rem 0.6rem;
    text-align: left;
    cursor: pointer;
}
.admin-user-detail-panel {
    margin-top: 0.65rem;
    display: grid;
    gap: 0.4rem;
}
.admin-json-box {
    margin: 0;
    padding: 0.5rem;
    border: 1px solid rgba(236, 181, 156, 0.85);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.88);
    color: #5a403b;
    font-size: 0.75rem;
    line-height: 1.35;
    max-height: 210px;
    overflow: auto;
}

.language-list {
    display: grid;
    gap: 0.35rem;
}

.language-item {
    width: 100%;
    border: 1px solid rgba(232, 194, 175, 0.95);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.88);
    color: #6f4740;
    font: inherit;
    padding: 0.45rem 0.55rem;
    text-align: left;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.language-item .flag {
    width: 1.25rem;
    text-align: center;
}

.language-flag-img {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    object-fit: cover;
    display: inline-block;
    vertical-align: middle;
}

/* Season Pass UI */
.season-progress { background: rgba(0,0,0,0.3); padding: 1rem; border-radius: var(--radius-md); text-align: center; margin-bottom: 1rem; }
.season-rewards { display: flex; flex-direction: column; gap: 0.5rem; }
.reward-item { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); padding: 0.75rem; border-radius: var(--radius-sm); display: flex; justify-content: space-between; align-items: center; }
.reward-item.locked { opacity: 0.5; }
.reward-item.claimed { background: rgba(16, 185, 129, 0.2); border-color: #10b981; }
.claim-btn { background: #3b82f6; color: white; border: none; padding: 0.25rem 0.75rem; border-radius: 99px; font-weight: bold; font-size: 0.8rem; cursor: pointer; }
.claim-btn:disabled { background: #64748b; cursor: not-allowed; }

/* 2D Farm Overlay */
.farm-top-left { display: flex; align-items: center; gap: 0.5rem; }
.farm-info-btn {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(255, 218, 196, 0.9);
    background: linear-gradient(135deg, #fff4e8, #ffd8b8);
    color: #7a4c3e;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(166, 120, 103, 0.25);
}
.farm-info-btn:active { transform: scale(0.96); }
.farm-building-btn {
    height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(255, 213, 183, 0.9);
    background: linear-gradient(135deg, #ffe4c7, #ffd2de);
    color: #744940;
    font-family: 'Outfit', sans-serif;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    padding: 0 0.75rem;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(166, 120, 103, 0.25);
}
.farm-building-btn:active { transform: scale(0.96); }

.farm-building-popup-layer {
    position: absolute;
    inset: 0;
    z-index: 64;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(73, 48, 44, 0.26);
    backdrop-filter: blur(2px);
}

.farm-building-popup {
    width: min(390px, 94vw);
    border-radius: 18px;
    border: 1px solid rgba(255, 216, 193, 0.92);
    padding: 0.9rem;
    max-height: 78vh;
    overflow: auto;
}

.farm-building-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.farm-building-head h3 {
    margin: 0;
    color: #744940;
    font-size: 1.05rem;
}

.farm-building-close-btn {
    border: 1px solid rgba(255, 210, 191, 0.96);
    border-radius: 10px;
    padding: 0.4rem 0.7rem;
    font: inherit;
    font-weight: 700;
    color: #6e463e;
    cursor: pointer;
    background: linear-gradient(135deg, #ffe4d0, #ffd6c7);
}

.farm-building-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
}

.farm-building-item {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 0.65rem;
    align-items: center;
    border: 1px solid rgba(255, 221, 201, 0.9);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.68);
    padding: 0.55rem;
}

.farm-building-image {
    width: 88px;
    height: 88px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid rgba(255, 222, 200, 0.95);
}

.farm-building-info h4 {
    margin: 0;
    color: #6f463e;
    font-size: 0.95rem;
}

.farm-building-info p {
    margin: 0.25rem 0 0;
    color: #745a54;
    font-size: 0.82rem;
    line-height: 1.35;
}

.food-factory-fuel-meter {
    margin-top: 0.3rem;
    width: 100%;
    height: 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 211, 189, 0.9);
    background: linear-gradient(135deg, rgba(255, 246, 236, 0.95), rgba(255, 236, 222, 0.9));
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(172, 128, 112, 0.14);
}

.food-factory-fuel-meter-fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #ffd28f, #ff9d6f);
    transition: width 0.25s ease;
}

.food-factory-fuel-meter-text {
    margin-top: 0.18rem;
    font-size: 0.76rem;
    color: #8a685f;
    font-weight: 700;
}

.farm-building-action-row {
    display: flex;
    align-items: stretch;
    gap: 0.45rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.farm-building-action-row .farm-building-upgrade-btn {
    flex: 1 1 auto;
    margin-top: 0;
    min-width: 0;
}

.farm-building-info-btn {
    flex: 0 0 auto;
    margin-top: 0;
    min-width: 3.2rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid rgba(255, 210, 191, 0.96);
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(255, 248, 240, 0.98), rgba(255, 232, 214, 0.95));
    color: #6f463e;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(172, 128, 112, 0.12);
}

.farm-building-info-btn:hover {
    filter: brightness(1.03);
}

.farm-building-upgrade-btn {
    margin-top: 0.5rem;
    border: 1px solid rgba(255, 210, 191, 0.96);
    border-radius: 10px;
    padding: 0.42rem 0.75rem;
    font: inherit;
    font-weight: 800;
    color: #6e463e;
    cursor: pointer;
    background: linear-gradient(135deg, #ffd0b2, #ffc6da);
}

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

@media (max-width: 420px) {
    .farm-building-item {
        grid-template-columns: 72px 1fr;
    }

    .farm-building-image {
        width: 72px;
        height: 72px;
    }
}

.farm-toolbar {
    position: absolute;
    left: 50%;
    bottom: max(12px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: min(96vw, 440px);
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    background: linear-gradient(180deg, rgba(255, 252, 246, 0.95), rgba(255, 235, 217, 0.92));
    border: 1px solid rgba(235, 184, 160, 0.72);
    box-shadow: 0 10px 20px rgba(123, 88, 76, 0.22);
    border-radius: 18px;
    padding: 0.32rem;
    z-index: 46;
}

.farm-tool-btn {
    border: 1px solid rgba(239, 193, 170, 0.85);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 242, 231, 0.9));
    color: #734f47;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.14rem;
    padding: 0.28rem 0.12rem;
    border-radius: 12px;
    width: 56px;
    min-width: 56px;
    min-height: 46px;
    transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
    cursor: pointer;
}

.farm-tool-btn.active {
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.22), 0 6px 12px rgba(89, 114, 161, 0.2);
    transform: translateY(-1px);
}

.farm-tool-btn .tool-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.farm-tool-btn .tool-icon .icon-img {
    width: 19px;
    height: 19px;
}

.farm-tool-btn .tool-name {
    font-size: 0.52rem;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    letter-spacing: 0.01em;
}

@media (max-width: 420px) {
    .farm-toolbar {
        width: min(98vw, 392px);
        gap: 0.2rem;
        padding: 0.26rem;
        border-radius: 14px;
    }

    .farm-tool-btn {
        width: 50px;
        min-width: 50px;
        min-height: 42px;
        border-radius: 10px;
        padding: 0.22rem 0.08rem;
    }

    .farm-tool-btn .tool-icon .icon-img {
        width: 16px;
        height: 16px;
    }

    .farm-tool-btn .tool-name {
        font-size: 0.46rem;
    }
}

.farm-seed-picker { position: absolute; left: 50%; bottom: 165px; transform: translateX(-50%); width: min(92%, 370px); max-height: 235px; padding: 0.75rem; z-index: 45; }
.farm-seed-picker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.35rem; }
.farm-seed-close-btn { border: 1px solid rgba(148, 163, 184, 0.4); background: #334155; color: #fff; border-radius: 8px; padding: 0.25rem 0.5rem; font-size: 0.72rem; cursor: pointer; }
.farm-seed-current { font-size: 0.78rem; margin-bottom: 0.45rem; color: #475569; font-weight: 600; }
.farm-seed-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem; max-height: 150px; overflow-y: auto; padding-right: 0.2rem; }
.farm-seed-option { display: flex; align-items: center; gap: 0.4rem; width: 100%; text-align: left; border: 1px solid #cbd5e1; background: #fff; border-radius: 10px; padding: 0.3rem 0.45rem; cursor: pointer; }
.farm-seed-option.active { border-color: #22c55e; box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.18); background: #f0fdf4; }
.farm-seed-option img { width: 24px; height: 24px; object-fit: cover; border-radius: 6px; }

/* BATTLE SCREEN */
.battle-screen { z-index: 50; padding: 1rem !important; background: radial-gradient(circle at 20% 10%, #fff4e6 0%, #f6e9da 50%, #f0dfcf 100%); }
.battle-bg-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}
.battle-bg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
}
.battle-bg-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(36, 22, 20, 0.18) 0%, rgba(36, 22, 20, 0.06) 28%, rgba(36, 22, 20, 0.18) 100%),
        radial-gradient(circle at center, rgba(255, 248, 239, 0.04) 0%, rgba(255, 248, 239, 0) 55%);
}
.battle-arena {
    position: relative;
    z-index: 3;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1rem 0;
}
.vs-divider { text-align: center; font-size: 2rem; font-weight: 800; color: rgba(255,255,255,0.2); margin: 1rem 0; font-style: italic; }
.battle-lane { display: flex; align-items: flex-end; justify-content: space-between; } .enemy-lane { align-items: flex-start; } .player-lane { align-items: flex-end; }
.battle-sprite { font-size: 6rem; animation: battleFloat 2s infinite ease-in-out; }
.battle-screen { position: relative; overflow: hidden; }
#battle-effect-layer { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.battle-stats { border-radius: var(--radius-md); padding: 1rem; min-width: 150px; width: 45%; border: 1px solid rgba(255, 219, 198, 0.85); }
.stat-name { font-weight: bold; font-size: 1.1rem; display: flex; align-items: center; justify-content: space-between; gap: 0.45rem; } .elem-badge { display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.battle-mini-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: #78524a;
}
.battle-ui { position: relative; z-index: 5; border-radius: var(--radius-lg); padding: 1rem; display: flex; flex-direction: column; gap: 1rem; border: 1px solid rgba(255, 220, 196, 0.82); }
.battle-log { background: rgba(255,255,255,0.72); color: #734f47; padding: 0.75rem; border-radius: var(--radius-sm); font-size: 0.9rem; text-align: center; min-height: 2.5rem; border: 1px solid rgba(255, 220, 196, 0.72); }
.battle-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.battle-btn { background: linear-gradient(155deg, rgba(255, 255, 255, 0.92), rgba(255, 243, 231, 0.94)); border: 1px solid rgba(255, 218, 190, 0.82); color: #6f4c44; border-radius: 12px; padding: 0.75rem; font-family: inherit; font-weight: 800; cursor: pointer; box-shadow: 0 6px 12px rgba(177, 132, 113, 0.16); }
.battle-btn:active { transform: scale(0.95); } .battle-btn:disabled { opacity: 0.45; pointer-events: none; }
.battle-surrender-btn {
    position: absolute;
    left: 12px;
    top: 10px;
    padding: 0.42rem 0.7rem;
    font-size: 0.78rem;
    background: linear-gradient(135deg, #ffb7ca, #ffcbad);
    color: #6f3f3f;
    border: 1px solid rgba(255, 223, 212, 0.96);
}

.battle-move-float {
    position: absolute;
    transform: translate(-50%, -50%);
    padding: 0.26rem 0.65rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: linear-gradient(135deg, var(--battle-float-color), var(--battle-float-shadow));
    box-shadow: 0 8px 16px rgba(56, 31, 31, 0.24);
    white-space: nowrap;
    pointer-events: none;
    z-index: 6;
    animation: battleMoveFloat 0.9s ease-out forwards;
}

@keyframes battleMoveFloat {
    0% { opacity: 0; transform: translate(-50%, -30%) scale(0.9); }
    15% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -120%) scale(1.02); }
}
.move-particle {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    opacity: 0.96;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.55);
    animation: moveParticleFly 520ms ease-out forwards;
}
@keyframes moveParticleFly {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(0.8); }
    100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.3); }
}
@keyframes battleFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.hit-anim { animation: hitShake 0.4s; } @keyframes hitShake { 0%, 100% { transform: translateX(0); } 25%, 75% { transform: translateX(-10px); } 50% { transform: translateX(10px); } }

/* Inventory */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 1rem;
    align-content: start;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
    padding-right: 0.2rem;
}
.item-slot { background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-md); aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; position: relative; }
.item-slot:active { transform: scale(0.95); } .item-icon { font-size: 2rem; } .item-count { position: absolute; bottom: -5px; right: -5px; background: #3b82f6; border-radius: 99px; padding: 2px 6px; font-size: 0.7rem; font-weight: bold; }
.big-action-btn { background: linear-gradient(135deg, #3b82f6, #2563eb); color: white; border: none; padding: 1rem; border-radius: var(--radius-md); font-size: 1.2rem; font-weight: bold; font-family: inherit; cursor: pointer; } .big-action-btn:active { transform: scale(0.95); }

/* Main Nav */
.main-nav-container { position: absolute; bottom: 0; left: 0; width: 100%; padding: 0.8rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px)); z-index: 50; }
.main-nav { display: flex; justify-content: space-between; padding: 0.42rem; border-radius: 22px; width: 100%; background: linear-gradient(145deg, rgba(255, 248, 240, 0.94), rgba(255, 233, 216, 0.9)); border: 1px solid rgba(255, 220, 193, 0.84); box-shadow: 0 10px 20px rgba(166, 120, 104, 0.2); }
.nav-btn { flex: 1; background: none; border: none; color: #8a6d68; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: inherit; font-size: 0.65rem; font-weight: 700; transition: color 0.2s, background 0.2s, transform 0.2s; cursor: pointer; border-radius: 14px; padding: 0.22rem 0.1rem; }
.nav-btn.active { color: #6e4a42; background: linear-gradient(135deg, #ffe5cf, #ffd8e8); transform: translateY(-1px); box-shadow: 0 3px 8px rgba(171, 124, 106, 0.2); }
.nav-btn:disabled { opacity: 0.45; cursor: default; pointer-events: none; filter: grayscale(0.25); }
.nav-icon { font-size: 1.2rem; margin-bottom: 2px; display: inline-flex; align-items: center; justify-content: center; min-height: 26px; }

body.platform-telegram .main-nav-container {
    bottom: 0;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 0.35rem);
}

body.platform-telegram .action-bar {
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

body.platform-telegram #ad-banner-slot {
    bottom: calc(186px + env(safe-area-inset-bottom, 0px));
}

.more-menu-layer {
    position: absolute;
    inset: 0;
    z-index: 48;
    display: flex;
    align-items: center;
    justify-content: center;
}

.more-menu-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(69, 45, 42, 0.38);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.more-menu-sheet {
    position: relative;
    width: min(390px, 94vw);
    border-radius: 18px;
    padding: 0.9rem 0.9rem 1.15rem;
    background: linear-gradient(165deg, rgba(255, 250, 244, 0.98), rgba(255, 233, 214, 0.95));
    border: 1px solid rgba(255, 220, 193, 0.88);
    box-shadow: 0 14px 28px rgba(143, 99, 86, 0.28);
    animation: moreMenuRise 180ms ease-out;
}

.more-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.more-menu-head h3 {
    margin: 0;
    font-size: 1.02rem;
    color: #6c4a43;
}

.more-menu-close {
    border: 1px solid rgba(255, 214, 194, 0.95);
    background: linear-gradient(135deg, #ffe6d3, #ffd8e9);
    color: #744b43;
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.more-menu-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.more-menu-btn {
    position: relative;
    min-height: 68px;
    border: 1px solid rgba(255, 217, 193, 0.92);
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.96), rgba(255, 238, 222, 0.9));
    border-radius: 14px;
    color: #73524a;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.more-menu-badge {
    position: absolute;
    top: 7px;
    right: 9px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1;
    pointer-events: none;
}

.more-menu-btn:active {
    transform: scale(0.97);
}

.more-menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
}

@keyframes moreMenuRise {
    0% { transform: translateY(16px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.icon-img { width: 20px; height: 20px; object-fit: contain; display: inline-block; vertical-align: middle; }
.ui-icon { flex-shrink: 0; }
.element-icon { width: 18px; height: 18px; }
.rank-icon { width: 18px; height: 18px; }
.slot-icon { width: 18px; height: 18px; }
.stat-icon .icon-img { width: 20px; height: 20px; }
.btn-icon .icon-img { width: 34px; height: 34px; }
.nav-icon .icon-img { width: 26px; height: 26px; margin-bottom: 2px; }
.zone-icon .icon-img, .shop-icon .icon-img { width: 38px; height: 38px; }
.tool-icon .icon-img { width: 24px; height: 24px; }
.screen-title .icon-img { width: 26px; height: 26px; }
.coin-display .icon-img, .home-coin-badge .icon-img { width: 20px; height: 20px; }

/* Animations */
@keyframes pop { 0% { transform: scale(1) translateX(-50%); } 100% { transform: scale(1.2) translateX(-40%); } }

/* Auth Screens (Cozy Style) */
.auth-screen {
    position: absolute;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
    background:
        radial-gradient(circle at 15% 20%, rgba(255, 223, 186, 0.42), transparent 38%),
        radial-gradient(circle at 80% 75%, rgba(255, 198, 222, 0.4), transparent 38%),
        linear-gradient(180deg, #fff4e6 0%, #f7e9d9 52%, #f1e1d0 100%);
}

.auth-box {
    width: 100%;
    max-width: 390px;
    padding: 1.5rem;
    border-radius: 20px;
    text-align: center;
    background: linear-gradient(160deg, rgba(255, 251, 246, 0.95), rgba(255, 236, 222, 0.9));
    border: 1px solid rgba(255, 215, 188, 0.92);
    box-shadow: 0 16px 34px rgba(174, 129, 111, 0.26);
}

.auth-box h2 {
    margin: 0 0 1rem;
    font-size: 1.45rem;
    color: #744f47;
}

.auth-field-hint {
    margin: -0.45rem 0 0.55rem;
    font-size: 0.72rem;
    line-height: 1.35;
    color: #8a6d68;
}

.auth-input {
    width: 100%;
    padding: 0.8rem 0.9rem;
    margin-bottom: 0.75rem;
    border-radius: 12px;
    border: 1px solid rgba(236, 181, 156, 0.85);
    background: rgba(255, 255, 255, 0.88);
    color: #644943;
    font: inherit;
    outline: none;
}

.auth-input:focus {
    border-color: #f1a98d;
    box-shadow: 0 0 0 3px rgba(255, 190, 162, 0.28);
}

.auth-btn {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.55rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 211, 191, 0.95);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    color: #71473e;
    background: linear-gradient(135deg, #ffd4b8, #ffc3d9);
    box-shadow: 0 7px 14px rgba(174, 126, 106, 0.2);
}

.auth-btn.alt {
    color: #7a5b55;
    border-color: rgba(231, 198, 184, 0.9);
    background: linear-gradient(135deg, #fff0de, #ffe8df);
}

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

.pet-choice {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
    margin-bottom: 1rem;
}

.pet-card {
    border: 1px solid rgba(224, 182, 160, 0.86);
    border-radius: 14px;
    background: linear-gradient(155deg, rgba(255, 248, 239, 0.95), rgba(255, 237, 228, 0.9));
    padding: 0.65rem;
    cursor: pointer;
    color: #714941;
}

.pet-card.selected {
    border-color: rgba(248, 162, 188, 0.95);
    box-shadow: 0 0 0 3px rgba(255, 196, 220, 0.35);
}

.pet-card span {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.35rem;
}

.background-shop-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
}

.background-bought-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 215, 191, 0.95);
    background: linear-gradient(135deg, #e6f7e8, #d6f0df);
    color: #3b6b4b;
    font-size: 0.72rem;
    font-weight: 800;
}

.preview-btn {
    background: linear-gradient(135deg, #fff1d9, #ffd6e8);
    color: #71453f;
}

.background-preview-layer {
    position: absolute;
    inset: 0;
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(70, 50, 45, 0.28);
    backdrop-filter: blur(3px);
}

.background-preview-close-btn {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 2;
    border: 1px solid rgba(255, 214, 194, 0.95);
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    background: linear-gradient(135deg, #ffd3e5, #ffcaa8);
    color: #704840;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(161, 116, 102, 0.22);
}

.background-preview-card {
    width: min(92vw, 420px);
    border-radius: 20px;
    padding: 1rem;
}

.background-preview-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.background-preview-head h3 {
    margin: 0;
    font-size: 1.1rem;
}

.background-preview-image-wrap {
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 220, 198, 0.88);
    background: rgba(255, 251, 246, 0.9);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.4);
}

.background-preview-image-wrap img {
    display: block;
    width: 100%;
    max-height: 56vh;
    object-fit: cover;
}

.background-preview-name {
    margin-top: 0.7rem;
    text-align: center;
    color: #75514a;
    font-weight: 700;
}

/* Cozy Popup */
.cozy-popup-layer {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.1rem;
    background: rgba(82, 57, 52, 0.22);
    backdrop-filter: blur(2px);
}

/* Above account overlay (1265) when linking Google from More → Account */
#cozy-popup-layer.cozy-above-account {
    z-index: 1280 !important;
}

#language-layer {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2600 !important;
}

.cozy-popup-card,
.farm-building-popup {
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
}

.cozy-popup-card {
    width: min(420px, 94vw);
    border-radius: 18px;
    padding: 1.05rem 1.05rem 0.95rem;
    border: 1px solid rgba(255, 216, 193, 0.96);
    background: linear-gradient(165deg, rgba(255, 250, 244, 0.95), rgba(255, 238, 225, 0.92));
    box-shadow: 0 14px 34px rgba(95, 63, 56, 0.24);
    color: #4d352f;
    max-height: min(78vh, 560px);
    overflow-y: auto;
    animation: cozyPopIn 0.2s ease-out;
}

.cozy-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(233, 172, 150, 0.82);
    background: linear-gradient(160deg, #fff2e8, #ffe2d2);
    color: #7a4a3f;
    font-size: 1.28rem;
    font-weight: 800;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(121, 76, 64, 0.2);
    z-index: 2;
}

.cozy-popup-close:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(121, 76, 64, 0.26);
}

.cozy-popup-close:active {
    transform: translateY(0);
}

.pet-info-card {
    width: min(380px, 94vw);
}

.pet-info-modal-body {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.pet-info-row {
    font-size: 0.92rem;
    color: #5a3e3b;
}

.pet-info-label {
    font-size: 0.78rem;
    color: #7a5b55;
    font-weight: 700;
}

.pet-info-input {
    width: 100%;
    border: 1px solid rgba(236, 181, 156, 0.85);
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
    font: inherit;
    background: rgba(255, 255, 255, 0.88);
    color: #644943;
    outline: none;
}

.pet-info-input:focus {
    border-color: #f1a98d;
    box-shadow: 0 0 0 3px rgba(255, 190, 162, 0.28);
}

.pet-info-stats {
    margin-top: 0.2rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 0.55rem;
}

.pet-attr-upgrade-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 0.45rem;
}

.pet-attr-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 220, 198, 0.72);
    border-radius: 8px;
    padding: 0.26rem 0.35rem;
    font-size: 0.73rem;
    color: #6a483f;
}

.pet-attr-row button {
    border: 1px solid rgba(255, 212, 197, 0.95);
    border-radius: 999px;
    width: 22px;
    height: 22px;
    line-height: 1;
    background: linear-gradient(135deg, #ffd6e7, #ffd3b7);
    color: #6c423d;
    font-weight: 800;
    cursor: pointer;
    padding: 0;
}

.pet-attr-row button:disabled {
    opacity: 0.55;
    cursor: default;
}

.pet-info-stat {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(255, 220, 198, 0.7);
    border-radius: 8px;
    padding: 0.35rem 0.45rem;
    font-size: 0.76rem;
    color: #6e4b43;
}

.cozy-popup-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.62rem;
    padding-bottom: 0.42rem;
    border-bottom: 1px solid rgba(228, 184, 164, 0.38);
}

.pet-manager-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 180px;
    overflow: auto;
    padding-right: 0.2rem;
}
.pet-manager-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border: 1px solid rgba(255, 220, 195, 0.9);
    background: rgba(255, 255, 255, 0.74);
    border-radius: 10px;
    padding: 0.45rem 0.55rem;
}
.pet-manager-entry.is-active {
    border-color: rgba(255, 176, 161, 0.95);
    background: linear-gradient(135deg, rgba(255, 238, 227, 0.95), rgba(255, 230, 244, 0.9));
}
.pet-manager-meta {
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
    color: #72514a;
    font-size: 0.76rem;
}
.pet-manager-meta strong {
    font-size: 0.84rem;
}
.pet-manager-switch-btn {
    border: 1px solid rgba(255, 213, 186, 0.95);
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    font-family: inherit;
    font-size: 0.74rem;
    font-weight: 800;
    color: #724741;
    background: linear-gradient(135deg, #ffd6b7, #ffc7dc);
    cursor: pointer;
}
.pet-manager-switch-btn:disabled {
    opacity: 0.7;
    cursor: default;
}
.pet-manager-create {
    border-top: 1px solid rgba(255, 220, 194, 0.86);
    margin-top: 0.55rem;
    padding-top: 0.6rem;
}

.pet-manager-starter-preview {
    margin-top: 0.55rem;
    border: 1px solid rgba(255, 220, 195, 0.9);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.75);
    padding: 0.45rem;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.35rem;
}

.pet-manager-stage-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    min-width: 0;
    flex: 1 1 0;
}

.pet-manager-starter-preview img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    image-rendering: auto;
}

.pet-manager-starter-preview-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: #6f4a42;
    text-align: center;
}

.pet-manager-starter-preview-level {
    font-size: 0.72rem;
    font-weight: 700;
    color: #82564c;
}

.pet-manager-stage-arrow {
    font-size: 1.1rem;
    font-weight: 800;
    color: #8c5b52;
    flex: 0 0 auto;
}

.cozy-popup-head h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: #5c3e37;
    letter-spacing: 0.01em;
}

#cozy-popup-message {
    margin: 0;
    color: #5f4742;
    font-size: 0.98rem;
    line-height: 1.56;
    white-space: pre-line;
}

.cozy-popup-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.95rem;
    padding-top: 0.62rem;
    border-top: 1px solid rgba(228, 184, 164, 0.36);
}

.cozy-popup-btn {
    border: 1px solid rgba(255, 210, 191, 0.96);
    border-radius: 10px;
    min-height: 38px;
    padding: 0.52rem 1rem;
    font: inherit;
    font-weight: 800;
    color: #5c3e37;
    cursor: pointer;
    background: linear-gradient(135deg, #ffd0b2, #ffc6da);
}

.cozy-popup-btn:active {
    transform: scale(0.96);
}

.cozy-popup-btn.secondary {
    color: #7b635e;
    background: linear-gradient(135deg, #fff0e0, #ffe8db);
    border-color: rgba(233, 205, 193, 0.95);
}

.referral-popup-body {
    display: grid;
    gap: 0.48rem;
}

.referral-popup-note {
    margin: 0 0 0.18rem;
    color: #6a4e48;
    font-size: 0.88rem;
    line-height: 1.45;
}

.referral-link-value {
    width: 100%;
    min-height: 74px;
    resize: vertical;
    border: 1px solid rgba(236, 181, 156, 0.85);
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
    font: inherit;
    font-size: 0.84rem;
    background: rgba(255, 255, 255, 0.9);
    color: #5a403b;
    line-height: 1.36;
}

.referral-popup-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
    margin-top: 0.4rem;
}

.referral-redeem-actions {
    grid-template-columns: 1fr;
}

@media (max-width: 520px) {
    .referral-popup-actions {
        grid-template-columns: 1fr;
    }
}

.move-replace-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.45rem;
    margin-top: 0.35rem;
}

.move-replace-option {
    border: 1px solid rgba(255, 210, 191, 0.96);
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
    font: inherit;
    font-weight: 700;
    color: #6e463e;
    cursor: pointer;
    background: linear-gradient(135deg, #ffd0b2, #ffc6da);
    text-align: left;
}

.move-replace-option small {
    display: block;
    font-size: 0.74rem;
    color: #7b635e;
    margin-top: 0.15rem;
}

.move-replace-option:active {
    transform: scale(0.98);
}

.scrollable-list {
    scrollbar-width: thin;
    scrollbar-color: #cb9382 rgba(255, 239, 227, 0.72);
    cursor: grab;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: auto;
    overscroll-behavior: contain;
}

.scrollable-list.dragging {
    cursor: grabbing;
    touch-action: none;
    scroll-behavior: auto;
    user-select: none;
}

#tamer-tamed-view {
    width: 100%;
    max-height: min(56vh, 420px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-right: 0.15rem;
}

#workers-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    width: 100%;
    box-sizing: border-box;
}

#workers-list .worker-tamed-card {
    display: grid;
    grid-template-columns: minmax(44px, auto) minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    box-sizing: border-box;
    padding: 0.65rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
}

#workers-list .worker-tamed-card .worker-tamed-main {
    min-width: 0;
}

#workers-list .worker-tamed-card .worker-tamed-actions {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.35rem;
    justify-content: flex-start;
    min-width: 6.5rem;
}

#workers-list .worker-tamed-card .worker-tamed-actions button {
    width: 100%;
}

#workers-list .worker-tamed-card h3 {
    margin: 0;
    font-size: 0.95rem;
    word-break: break-word;
}

#workers-list .worker-tamed-card p {
    margin: 0;
    font-size: 0.75rem;
}

#workers-list .worker-tamed-card .worker-tamed-bars {
    width: min(100%, 110px);
}

.battle-move-sta-cost {
    display: block;
    font-size: 0.68rem;
    font-weight: 800;
    color: #3b82f6;
    line-height: 1.1;
    margin-top: 0.12rem;
}

.scrollable-list::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.scrollable-list::-webkit-scrollbar-track {
    background: linear-gradient(180deg, rgba(255, 243, 232, 0.86), rgba(255, 233, 216, 0.86));
    border-radius: 999px;
    border: 1px solid rgba(244, 210, 188, 0.75);
}

.scrollable-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #f6b899, #dfa086);
    border-radius: 999px;
    border: 1px solid rgba(210, 139, 115, 0.75);
}

.scrollable-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #f2ad8a, #d79277);
}

#feed-popup-options,
#play-popup-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    max-height: min(56vh, 420px);
    overflow-y: auto;
    padding-right: 0.12rem;
}

#feed-popup-options .feed-option,
#play-popup-options .play-option {
    min-height: 74px;
    padding: 0.55rem 0.6rem;
}

#feed-popup-options .feed-option small,
#play-popup-options .play-option small {
    line-height: 1.25;
}

.battle-bag-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    max-height: min(52vh, 380px);
    overflow-y: auto;
    padding-right: 0.12rem;
}

.battle-bag-option {
    border: 1px solid rgba(255, 210, 191, 0.96);
    border-radius: 10px;
    padding: 0.55rem 0.6rem;
    background: linear-gradient(135deg, #ffd0b2, #ffc6da);
    color: #6e463e;
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.battle-bag-option small {
    display: block;
    color: #7b635e;
    font-size: 0.74rem;
    margin-top: 0.2rem;
}

.battle-bag-option:active {
    transform: scale(0.98);
}

.toast-layer {
    position: absolute;
    left: 0.65rem;
    right: 0.65rem;
    bottom: 5.25rem;
    z-index: 1350;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.42rem;
    pointer-events: none;
}

.toast-item {
    width: min(100%, 430px);
    border-radius: 14px;
    padding: 0.5rem 0.62rem;
    display: grid;
    grid-template-columns: 24px 1fr;
    align-items: center;
    gap: 0.52rem;
    font-size: 0.81rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #6f4c45;
    background: linear-gradient(145deg, rgba(255, 248, 239, 0.98), rgba(255, 234, 218, 0.95));
    border: 1px solid rgba(255, 218, 194, 0.92);
    box-shadow: 0 10px 22px rgba(160, 114, 99, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.75);
    transform: translateY(12px) scale(0.97);
    opacity: 0;
    transition: transform 0.22s ease, opacity 0.22s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
}

.toast-item.show {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.toast-item::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(125deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0));
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 900;
    color: #6f4a43;
    border: 1px solid rgba(255, 211, 190, 0.92);
    background: linear-gradient(145deg, rgba(255, 252, 248, 0.96), rgba(255, 235, 217, 0.9));
    box-shadow: 0 3px 8px rgba(171, 127, 112, 0.18);
    text-transform: uppercase;
}

.toast-text {
    line-height: 1.25;
}

.toast-item.success {
    color: #295d3f;
    background: linear-gradient(145deg, rgba(236, 253, 241, 0.97), rgba(211, 248, 224, 0.95));
    border-color: rgba(137, 227, 173, 0.94);
}

.toast-item.success .toast-icon {
    color: #20633f;
    border-color: rgba(146, 232, 182, 0.95);
    background: linear-gradient(145deg, rgba(243, 255, 248, 0.96), rgba(218, 252, 230, 0.94));
}

.toast-item.warn {
    color: #89511f;
    background: linear-gradient(145deg, rgba(255, 244, 225, 0.98), rgba(255, 224, 189, 0.96));
    border-color: rgba(249, 193, 124, 0.95);
}

.toast-item.warn .toast-icon {
    color: #8f4f1f;
    border-color: rgba(249, 197, 136, 0.95);
    background: linear-gradient(145deg, rgba(255, 249, 239, 0.98), rgba(255, 229, 200, 0.95));
}

.toast-item.error {
    color: #7b3740;
    background: linear-gradient(145deg, rgba(255, 238, 240, 0.98), rgba(255, 213, 218, 0.96));
    border-color: rgba(246, 162, 177, 0.96);
}

.toast-item.error .toast-icon {
    color: #7f3240;
    border-color: rgba(245, 174, 186, 0.96);
    background: linear-gradient(145deg, rgba(255, 246, 247, 0.98), rgba(255, 223, 229, 0.95));
}

.toast-item.info {
    color: #5d4f87;
    background: linear-gradient(145deg, rgba(241, 238, 255, 0.98), rgba(224, 216, 255, 0.96));
    border-color: rgba(184, 170, 255, 0.94);
}

.toast-item.info .toast-icon {
    color: #5b4e8a;
    border-color: rgba(188, 175, 255, 0.95);
    background: linear-gradient(145deg, rgba(248, 246, 255, 0.98), rgba(227, 220, 255, 0.95));
}

@keyframes cozyPopIn {
    from {
        transform: translateY(8px) scale(0.96);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}
