/* Global Styles */
body {
    font-family: 'Inter', sans-serif;
    background-color: #fafafa;
    -webkit-tap-highlight-color: transparent;
    /* Mobile: prevent overscroll bounce, rubber-banding */
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    /* Prevent text size adjustment in TP Wallet WebView */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Carousel Indicator Dots - Force Perfect Circle */
[data-carousel-slide-to] {
    width: 8px !important;
    height: 8px !important;
    min-width: 8px !important;
    min-height: 8px !important;
    max-width: 8px !important;
    max-height: 8px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    aspect-ratio: 1 / 1 !important;
    flex-shrink: 0 !important;
}

/* Fix 100vh issue on mobile browsers / TP Wallet WebView */
:root {
    --app-height: 100vh;
}

html, body {
    /* Prevent pull-to-refresh in WebView */
    touch-action: manipulation;
}

.font-serif {
    font-family: 'Noto Serif SC', serif;
}

/* Glassmorphism */
.glass,
.glass-nav {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.glass-dark {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* Signin Page Specific */
.bg-tea-gradient {
    background: radial-gradient(circle at top right, #2f523b 0%, #111f17 100%);
}

.glass-card-signin {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Utilities */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Breathing Glow Animation for Community Zones */
@keyframes breathing-glow-a {
    0% { box-shadow: 0 8px 30px rgba(59,130,246,0.2); border-color: rgba(59,130,246,0.3); }
    50% { box-shadow: 0 0 30px 8px rgba(59,130,246,0.6); border-color: rgba(59,130,246,0.8); transform: scale(1.02); }
    100% { box-shadow: 0 8px 30px rgba(59,130,246,0.2); border-color: rgba(59,130,246,0.3); }
}

@keyframes breathing-glow-b {
    0% { box-shadow: 0 8px 30px rgba(59,130,246,0.2); border-color: rgba(59,130,246,0.3); }
    50% { box-shadow: 0 0 30px 8px rgba(59,130,246,0.6); border-color: rgba(59,130,246,0.8); transform: scale(1.02); }
    100% { box-shadow: 0 8px 30px rgba(59,130,246,0.2); border-color: rgba(59,130,246,0.3); }
}

.zone-breathing-a {
    animation: breathing-glow-a 2.5s infinite ease-in-out;
    z-index: 10;
}

.zone-breathing-b {
    animation: breathing-glow-b 2.5s infinite ease-in-out;
    z-index: 10;
}

/* Profile Tabs */
.tab-active {
    background: linear-gradient(135deg, #1f3629 0%, #2d4a3a 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(31, 54, 41, 0.25), 0 1px 3px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.tab-inactive {
    background-color: white;
    color: #52525b;
    border: 1px solid #e4e4e7;
    transition: all 0.2s ease;
}

.tab-inactive:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Tab Scroll Indicators */
#tabGradientLeft,
#tabGradientRight {
    transition: opacity 0.3s ease;
}

/* Shipping Timeline */
.timeline-line {
    position: absolute;
    left: 19px;
    top: 32px;
    bottom: -16px;
    width: 2px;
    background-color: #e4e4e7;
    z-index: 0;
}

.timeline-item:last-child .timeline-line {
    display: none;
}

/* Mask Gradient */
.mask-gradient-b {
    mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
}

/* ========== Tea Farm Game - Immersive Baba Farm Style ========== */

/* == Full-screen Game Scene == */
.game-scene {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: #87CEEB;
    /* Use dynamic viewport height for TP Wallet / mobile browsers */
    height: 100vh;
    height: 100dvh;
    /* Prevent any scrolling within the game */
    touch-action: none;
    /* TP钱包WebView适配 - 安全区域内缩 */
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 44px);
}

.game-bg {
    position: absolute;
    inset: 0;
    background-image: url('/images/farm-scene-bg.webp');
    background-size: cover;
    background-position: center bottom;
    z-index: 1;
}

.game-sky-overlay {
    display: none;
}

/* == Top HUD Bar == */
.game-hud-top {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 50;
    padding: max(env(safe-area-inset-top, 12px), 12px) 16px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Dark gradient veil behind top HUD for readability */
    background: linear-gradient(180deg, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.15) 60%, transparent 100%);
    padding-bottom: 12px;
}

.hud-btn-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.hud-btn-circle:active {
    transform: scale(0.9);
    background: rgba(0, 0, 0, 0.55);
}

.hud-resource-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 999px;
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* == Level & Progress HUD Strip == */
.game-hud-info {
    position: absolute;
    top: calc(max(env(safe-area-inset-top, 12px), 12px) + 52px);
    left: 12px; right: 12px;
    z-index: 50;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.hud-level-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.hud-progress-track {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hud-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #43a047, #66bb6a, #a5d6a7);
    transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.hud-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    100% { left: 100%; }
}

/* == Central Tree Area == */
.game-tree-area {
    position: absolute;
    top: 30%;
    bottom: 20%;
    left: 0; right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15;
}

.game-ground-shadow {
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 30%;
    height: 10px;
    background: radial-gradient(ellipse, rgba(0, 0, 0, 0.15), transparent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 14;
}

/* Ground ring — hidden */
.game-ground-ring {
    display: none;
}

/* Animated grass — hidden for cartoon style, bg already has grass */
.game-ground-grass {
    display: none;
}

.grass-tuft {
    position: absolute;
    bottom: 0;
    width: 12px;
    transform-origin: bottom center;
    animation: grass-sway var(--grass-dur, 3s) ease-in-out infinite;
    animation-delay: var(--grass-delay, 0s);
}

@keyframes grass-sway {
    0%, 100% { transform: rotate(var(--grass-from, -4deg)); }
    50% { transform: rotate(var(--grass-to, 4deg)); }
}

/* ===== Tree Container: Cartoon transparent PNG =====
   Cartoon game-art tree images with transparent backgrounds.
   Tree sits on the grass field of the cartoon farm scene. */
.tree-container {
    position: relative;
    width: min(85vw, 380px);
    height: min(50vh, 420px);
    height: min(50dvh, 420px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 17;
}

/* Tree Image Display */
.tree-img-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    position: relative;
}

.tree-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center bottom;
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    user-select: none;
    -webkit-user-drag: none;
    /* Subtle shadow for grounding on grass */
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

/* Mature tree golden glow */
.tree-mature-glow {
    animation: mature-aura 2.5s ease-in-out infinite;
}

.tree-mature-glow .tree-img {
    filter: brightness(1.1) saturate(1.2);
}

@keyframes mature-aura {
    0%, 100% { filter: drop-shadow(0 0 12px rgba(255, 200, 0, 0.15)); }
    50% { filter: drop-shadow(0 0 28px rgba(255, 200, 0, 0.35)); }
}

/* Tree Sway - now uses tree-breathe from Interactive Animations section */

/* == Harvest Button (above bottom actions, not overlapping tree) == */
.game-harvest-btn {
    position: absolute;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 115px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 28px;
    border-radius: 999px;
    background: linear-gradient(135deg, #ffd54f, #ff8f00);
    color: #4e342e;
    font-weight: 700;
    font-size: 15px;
    box-shadow: 0 4px 24px rgba(255, 143, 0, 0.5), 0 0 0 3px rgba(255, 213, 79, 0.3);
    border: none;
    z-index: 45;
    animation: harvest-float 2s ease-in-out infinite;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.game-harvest-btn:active {
    transform: translateX(-50%) scale(0.92);
}

@keyframes harvest-float {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
        box-shadow: 0 4px 24px rgba(255, 143, 0, 0.5), 0 0 0 3px rgba(255, 213, 79, 0.3);
    }
    50% {
        transform: translateX(-50%) translateY(-6px);
        box-shadow: 0 8px 32px rgba(255, 143, 0, 0.6), 0 0 0 6px rgba(255, 213, 79, 0.2);
    }
}

/* == Left Side Shortcut Buttons == */
.game-side-actions {
    position: absolute;
    left: 12px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 110px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 40;
}

.game-side-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 52px;
    padding: 8px 0;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: white;
    font-size: 10px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.game-side-btn:active {
    transform: scale(0.9);
    background: rgba(0, 0, 0, 0.45);
}

/* Task notification dot */
.game-side-dot {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ef5350;
    box-shadow: 0 0 6px rgba(239, 83, 80, 0.6);
    display: none;
}

.game-side-dot.active {
    display: block;
}

/* == Bottom Main Action Buttons == */
.game-main-actions {
    position: absolute;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
    left: 0; right: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    z-index: 40;
}

.game-action-circle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.game-action-circle:active {
    transform: scale(0.88);
}

.game-action-circle:disabled {
    opacity: 0.4;
}

.game-action-icon {
    width: 64px;
    height: 64px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.25);
    transition: all 0.3s;
}

.game-action-circle.water .game-action-icon {
    background: linear-gradient(145deg, #64b5f6, #1976d2);
    color: white;
}

.game-action-circle.fertilizer .game-action-icon {
    background: linear-gradient(145deg, #ffb74d, #ef6c00);
    color: white;
}

.game-action-label {
    font-size: 12px;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 0 8px rgba(0, 0, 0, 0.3);
}

/* == Popup Overlay System == */
.game-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
}

.game-popup-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.game-popup-sheet {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 28rem;
    width: calc(100% - 32px);
    background: white;
    border-radius: 24px;
    padding: 12px 24px 24px;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
    animation: popup-scale-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.game-popup-handle {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: #d1d5db;
    margin: 0 auto 16px;
}

/* == Floating Particles == */
@keyframes float-leaf {
    0% { transform: translate(0, 0) rotate(0deg); opacity: 0; }
    10% { opacity: 0.7; }
    90% { opacity: 0.7; }
    100% { transform: translate(var(--leaf-dx, 60px), var(--leaf-dy, 300px)) rotate(var(--leaf-rotate, 360deg)); opacity: 0; }
}

.floating-leaf {
    position: absolute;
    width: 12px;
    height: 12px;
    pointer-events: none;
    animation: float-leaf var(--leaf-duration, 8s) linear infinite;
    animation-delay: var(--leaf-delay, 0s);
}

.floating-leaf svg {
    width: 100%;
    height: 100%;
    fill: rgba(76, 175, 80, 0.5);
}

@keyframes sparkle {
    0%, 100% { transform: scale(0) rotate(0deg); opacity: 0; }
    50% { transform: scale(1) rotate(180deg); opacity: 0.8; }
}

.sparkle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.9), transparent);
    border-radius: 50%;
    pointer-events: none;
    animation: sparkle var(--sparkle-duration, 3s) ease-in-out infinite;
    animation-delay: var(--sparkle-delay, 0s);
}

/* == Water Drop Animation == */
@keyframes water-drop-fall {
    0% { transform: translateY(-20px) scale(1); opacity: 1; }
    70% { transform: translateY(80px) scale(0.8); opacity: 0.8; }
    100% { transform: translateY(100px) scale(0); opacity: 0; }
}

@keyframes water-ripple {
    0% { transform: scale(0); opacity: 0.6; }
    100% { transform: scale(2.5); opacity: 0; }
}

.water-drop-anim {
    animation: water-drop-fall 1s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
}

.water-ripple {
    position: absolute;
    width: 30px;
    height: 10px;
    border-radius: 50%;
    background: rgba(100, 200, 255, 0.3);
    animation: water-ripple 0.8s ease-out forwards;
}

/* == Fertilizer Animation == */
@keyframes fertilizer-sprinkle {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    50% { transform: translateY(-30px) scale(1.2); opacity: 0.9; }
    100% { transform: translateY(60px) scale(0.3); opacity: 0; }
}

.fertilizer-anim {
    animation: fertilizer-sprinkle 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* == Collectible Water Drops == */
@keyframes float-drop {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.05); }
}

.collect-drop {
    position: absolute;
    width: 36px;
    height: 36px;
    cursor: pointer;
    animation: float-drop 2s ease-in-out infinite;
    animation-delay: var(--drop-delay, 0s);
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 20;
    -webkit-tap-highlight-color: transparent;
}

.collect-drop:active {
    transform: scale(1.3);
}

@keyframes collect-fly {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--fly-x, 0), var(--fly-y, -100px)) scale(0.3); opacity: 0; }
}

.collect-fly {
    animation: collect-fly 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
    pointer-events: none !important;
}

/* == Task Cards (in popup) == */
.task-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.task-card:active {
    background: #f5f7f6;
    transform: scale(0.98);
}

.task-card.completed {
    opacity: 0.5;
    background: #f8f9fa;
}

.task-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.task-reward {
    min-width: 36px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    padding: 0 8px;
}

.task-go-btn {
    min-width: 56px;
    height: 28px;
    padding: 0 12px;
    border-radius: 14px;
    background: #1f3629;
    color: white;
    font-size: 11px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.task-go-btn:active {
    transform: scale(0.95);
    background: #2a4a3a;
}

.task-go-btn:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

/* Task status indicator */
.task-card[data-completed="true"] .task-go-btn {
    background: #e5e7eb;
    color: #9ca3af;
}

/* == Friend Avatar == */
.friend-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    object-fit: cover;
    background: linear-gradient(135deg, #c8e6c9, #a5d6a7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2f523b;
    font-weight: 600;
    font-size: 14px;
}

/* == Harvest Pulse == */
@keyframes harvest-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(184, 140, 50, 0.4); }
    50% { box-shadow: 0 0 20px 10px rgba(184, 140, 50, 0.2); }
}

/* == Token Rain == */
@keyframes token-rain {
    0% { transform: translateY(-20px) rotate(0deg); opacity: 0; }
    20% { opacity: 1; }
    100% { transform: translateY(200px) rotate(720deg); opacity: 0; }
}

.token-rain-item {
    position: absolute;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: #7a5221;
    box-shadow: 0 2px 8px rgba(255, 170, 0, 0.4);
    animation: token-rain 1.5s ease-in forwards;
    animation-delay: var(--rain-delay, 0s);
    pointer-events: none;
}

/* == General Animations == */
@keyframes bounce-in {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

.bounce-in {
    animation: bounce-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes fade-in-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.fade-in-up {
    animation: fade-in-up 0.5s ease-out forwards;
}

@keyframes number-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.number-pop {
    animation: number-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes level-up-glow {
    0% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.6); }
    50% { box-shadow: 0 0 40px 20px rgba(76, 175, 80, 0.3); }
    100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}

.level-up-glow {
    animation: level-up-glow 1.5s ease-out;
}

@keyframes slide-up-panel {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes popup-scale-in {
    from { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.slide-up-panel {
    animation: slide-up-panel 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes reward-toast {
    0% { transform: translateY(20px) scale(0.8); opacity: 0; }
    20% { transform: translateY(0) scale(1); opacity: 1; }
    80% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-20px) scale(0.8); opacity: 0; }
}

.reward-toast {
    animation: reward-toast 2s ease-in-out forwards;
}

/* ========== Interactive Animations ========== */

/* == Enhanced Tree Breathing (replaces simple sway) == */
@keyframes tree-breathe {
    0%   { transform: scale(1) rotate(-0.3deg); }
    25%  { transform: scale(1.008) rotate(0.4deg); }
    50%  { transform: scale(1.015) rotate(-0.2deg); }
    75%  { transform: scale(1.005) rotate(0.3deg); }
    100% { transform: scale(1) rotate(-0.3deg); }
}

.tree-sway {
    animation: tree-breathe 5s ease-in-out infinite;
    transform-origin: bottom center;
}

/* == Tree Tap Bounce == */
@keyframes tree-tap-bounce {
    0%   { transform: scale(1); }
    12%  { transform: scale(0.9) rotate(0deg); }
    35%  { transform: scale(1.12) rotate(1.5deg); }
    55%  { transform: scale(0.97) rotate(-0.8deg); }
    75%  { transform: scale(1.04) rotate(0.3deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.tree-tap-bounce {
    animation: tree-tap-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
    transform-origin: bottom center;
}

/* Tap sparkle burst */
.tap-sparkle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 1), rgba(255, 180, 50, 0.8));
    pointer-events: none;
    z-index: 35;
    box-shadow: 0 0 6px 2px rgba(255, 200, 50, 0.5);
    animation: sparkle-burst 0.6s ease-out forwards;
}

@keyframes sparkle-burst {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--burst-x), var(--burst-y)) scale(0); opacity: 0; }
}

/* Tap +1 tooltip */
.tap-plus-one {
    position: absolute;
    color: #ffd54f;
    font-size: 16px;
    font-weight: 800;
    pointer-events: none;
    z-index: 36;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
    animation: tap-float-up 0.8s ease-out forwards;
}

@keyframes tap-float-up {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-50px) scale(1.2); opacity: 0; }
}

/* == Scene Touch Ripple == */
.scene-touch-ripple {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 3;
    background: radial-gradient(circle, rgba(255,255,255,0.25) 0%, rgba(200,230,201,0.15) 40%, transparent 70%);
    animation: scene-ripple-expand 0.8s ease-out forwards;
}

@keyframes scene-ripple-expand {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

/* == Floating Clouds == */
.game-clouds-layer {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    overflow: hidden;
}

.game-cloud {
    position: absolute;
    height: 40px;
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.2) 50%, transparent 70%);
    border-radius: 50%;
    animation: cloud-drift linear infinite;
    will-change: transform;
    filter: blur(1px);
}

@keyframes cloud-drift {
    0% { transform: translateX(-150px); }
    100% { transform: translateX(calc(100vw + 150px)); }
}

/* == Butterflies (detailed SVG with 3D wing flap) == */
.game-butterfly {
    position: absolute;
    pointer-events: none;
    z-index: 12;
    animation: butterfly-path ease-in-out infinite;
    will-change: transform;
}

.game-butterfly svg {
    overflow: visible;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.12));
}

.game-butterfly .bfly-left-wing {
    transform-origin: 50% 50%;
    animation: bfly-flap-left 0.22s ease-in-out infinite alternate;
}

.game-butterfly .bfly-right-wing {
    transform-origin: 50% 50%;
    animation: bfly-flap-right 0.22s ease-in-out infinite alternate;
}

@keyframes bfly-flap-left {
    0%   { transform: perspective(60px) rotateY(0deg) rotate(-3deg); }
    100% { transform: perspective(60px) rotateY(50deg) rotate(5deg); }
}

@keyframes bfly-flap-right {
    0%   { transform: perspective(60px) rotateY(0deg) rotate(3deg); }
    100% { transform: perspective(60px) rotateY(-50deg) rotate(-5deg); }
}

@keyframes butterfly-path {
    0%   { transform: translate(0, 0) rotate(0deg); }
    20%  { transform: translate(var(--bfly-x1), var(--bfly-y1)) rotate(8deg); }
    40%  { transform: translate(var(--bfly-x2), var(--bfly-y2)) rotate(-5deg); }
    60%  { transform: translate(var(--bfly-x3), var(--bfly-y3)) rotate(10deg); }
    80%  { transform: translate(var(--bfly-x1), var(--bfly-y3)) rotate(-3deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

/* == Fireflies / Light Orbs == */
.game-firefly {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 11;
    background: radial-gradient(circle, rgba(255, 230, 100, 0.95), rgba(255, 200, 50, 0.4), transparent);
    box-shadow: 0 0 8px 3px rgba(255, 220, 80, 0.4);
    animation: firefly-float ease-in-out infinite;
    will-change: transform, opacity;
}

@keyframes firefly-float {
    0%, 100% { transform: translate(0, 0); opacity: 0; }
    15% { opacity: 0.9; }
    50% { transform: translate(var(--ff-x), var(--ff-y)); opacity: 0.5; }
    85% { opacity: 0.9; }
}

/* == Gyroscope Parallax Base == */
.game-bg {
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    transform: scale(1.06);
}

.game-clouds-layer {
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* Reduce particle count on low-end devices */
@media (prefers-reduced-motion: reduce) {
    .floating-leaf,
    .sparkle,
    .game-butterfly,
    .game-firefly,
    .grass-tuft {
        animation: none !important;
    }
    .tree-sway {
        animation: none !important;
    }
    .game-cloud {
        animation: none !important;
    }
}

/* ========== Mobile / TP Wallet Responsive ========== */

/* Small phones (iPhone SE, small Android, TP Wallet with nav bars) */
@media screen and (max-height: 667px) {
    .game-tree-area {
        top: 22%;
        bottom: 12%;
    }
    .tree-container {
        width: min(75vw, 280px);
        height: min(38vh, 280px);
        height: min(38dvh, 280px);
    }
    .game-hud-info {
        padding: 8px 12px;
    }
    .game-action-icon {
        width: 56px;
        height: 56px;
        border-radius: 18px;
    }
    .game-harvest-btn {
        padding: 10px 24px;
        font-size: 14px;
    }
    .game-side-btn {
        width: 46px;
        padding: 6px 0;
        font-size: 9px;
        border-radius: 14px;
    }
}

/* Medium phones */
@media screen and (min-height: 668px) and (max-height: 812px) {
    .tree-container {
        width: min(80vw, 340px);
        height: min(44vh, 360px);
        height: min(44dvh, 360px);
    }
}

/* Prevent content from going behind notch/camera cutout */
@supports (padding-top: env(safe-area-inset-top)) {
    .game-hud-top {
        padding-top: max(env(safe-area-inset-top), 12px);
    }
    .game-main-actions {
        padding-bottom: env(safe-area-inset-bottom);
    }
}




/* ========== Tea Thief Game v3 (采茶大盗 — RPG Map) ========== */

/* === Scene & Background === */
.tt-scene {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: #1a2a1a;
    height: 100vh;
    height: 100dvh;
    touch-action: none;
    /* TP钱包WebView适配 - 安全区域内缩 */
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 44px);
}

.tt-bg {
    position: absolute;
    inset: 0;
    background-image: url('/images/tea-map-bg.webp');
    background-size: cover;
    background-position: center 30%;
    z-index: 1;
    filter: brightness(0.75) saturate(0.9) blur(0.5px);
    transform: scale(1.02);
}

.tt-vignette {
    position: absolute;
    inset: 0;
    z-index: 2;
    background:
        linear-gradient(to bottom, rgba(15,25,15,0.4) 0%, transparent 10%, transparent 85%, rgba(15,25,15,0.5) 100%);
    pointer-events: none;
}

.tt-particles {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    overflow: hidden;
}

/* === Top HUD — two compact rows === */
.tt-hud {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 50;
    padding: max(env(safe-area-inset-top, 10px), 10px) 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: linear-gradient(180deg, rgba(15,25,15,0.88) 0%, rgba(15,25,15,0.5) 70%, transparent 100%);
}

.tt-hud-row1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tt-hud-logo {
    font-family: 'Noto Serif SC', serif;
    font-size: 18px;
    font-weight: 700;
    color: #f0e6d2;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
    white-space: nowrap;
}

.tt-hud-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.tt-hud-row2 {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: rgba(240,230,210,0.5);
}

.tt-hud-stat {
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}
.tt-hud-stat i { font-size: 11px; }
.tt-hud-stat b { color: rgba(240,230,210,0.9); font-weight: 700; }
.tt-hud-stat.tt-gold,
.tt-hud-stat.tt-gold i,
.tt-hud-stat.tt-gold b { color: #fbbf24; }
.tt-hud-divider {
    color: rgba(240,230,210,0.2);
    font-size: 10px;
}

.tt-hud-status {
    font-size: 13px;
    font-weight: 600;
    color: rgba(240,230,210,0.5);
    white-space: nowrap;
}

/* === Timer Ring === */
.tt-timer-ring {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}
.tt-timer-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.tt-timer-track { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 3; }
.tt-timer-fill {
    fill: none;
    stroke: #4ade80;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 150.80;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}
.tt-timer-num {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: rgba(240,230,210,0.6);
    font-family: 'Inter', sans-serif;
}

/* ===============================================
   MAP & MOUNTAIN NODES — RPG World Map Style
   =============================================== */

.tt-map {
    position: absolute;
    top: 10%;
    left: 0; right: 0;
    bottom: 12%;
    z-index: 10;
    overflow: hidden;
}

/* === Mountain Node === */
.tt-mt {
    position: absolute;
    left: var(--mt-x, 50%);
    top: var(--mt-y, 50%);
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease;
    z-index: 10;
    /* Gentle floating animation — staggered per mountain via inline --d */
    animation: tt-float 3s ease-in-out infinite;
    animation-delay: var(--d, 0s);
}
.tt-mt:active { transform: translate(-50%, -50%) scale(0.92); }

@keyframes tt-float {
    0%, 100% { transform: translate(-50%, -50%) translateY(0); }
    50% { transform: translate(-50%, -50%) translateY(-5px); }
}

/* Glow aura — always visible as breathing pulse */
.tt-mt-glow {
    position: absolute;
    top: -30px; left: -30px; right: -30px; bottom: -30px;
    border-radius: 50%;
    opacity: 0.3;
    background: radial-gradient(ellipse at 50% 45%, var(--mt-glow, rgba(255,255,255,0.2)), transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: tt-breathe 2.5s ease-in-out infinite;
    animation-delay: var(--d, 0s);
}

@keyframes tt-breathe {
    0%, 100% { opacity: 0.15; transform: scale(0.95); }
    50% { opacity: 0.4; transform: scale(1.08); }
}

/* Token Badge — above mountain */
.tt-mt-token-badge {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: linear-gradient(135deg, rgba(251,191,36,0.9), rgba(245,158,11,0.85));
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.25);
    white-space: nowrap;
    pointer-events: none;
}
.tt-mt-token-badge i {
    font-size: 10px;
    color: #78350f;
}
.tt-mt-token-badge span {
    font-size: 12px;
    font-weight: 800;
    color: #451a03;
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.3px;
    text-shadow: 0 1px 0 rgba(255,255,255,0.3);
}

/* Mountain Illustration — BIGGER */
.tt-mt-icon {
    width: 130px;
    height: 130px;
    overflow: visible;
    position: relative;
    z-index: 1;
    background: transparent;
}
.tt-mt-icon::after { display: none; }

.tt-mt-icon img {
    width: 145%;
    height: 145%;
    margin: -22.5% 0 0 -22.5%;
    object-fit: cover;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    filter: brightness(1.05) saturate(1.1) drop-shadow(0 4px 16px rgba(0,0,0,0.35));
    transition: filter 0.35s ease, transform 0.35s ease;
    -webkit-mask-image: radial-gradient(ellipse 60% 60% at center, rgba(0,0,0,1) 50%, rgba(0,0,0,0.4) 62%, rgba(0,0,0,0.1) 75%, transparent 90%);
    mask-image: radial-gradient(ellipse 60% 60% at center, rgba(0,0,0,1) 50%, rgba(0,0,0,0.4) 62%, rgba(0,0,0,0.1) 75%, transparent 90%);
}

/* Clickable indicator ring — subtle pulsing circle under the image */
.tt-mt-icon::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 60px; height: 60px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px solid rgba(240,230,210,0.15);
    box-shadow: 0 0 12px rgba(240,230,210,0.08);
    animation: tt-ring-pulse 2.5s ease-in-out infinite;
    animation-delay: var(--d, 0s);
    pointer-events: none;
    z-index: 0;
}

@keyframes tt-ring-pulse {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(0.9); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
}

/* Name + Stats label (game map style) */
.tt-mt-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: -10px;
    position: relative;
    z-index: 2;
}

.tt-mt-name {
    font-family: 'Noto Serif SC', serif;
    font-size: 13px;
    font-weight: 700;
    color: #f0e6d2;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.7);
    white-space: nowrap;
    padding: 2px 10px;
    background: rgba(20,30,20,0.6);
    border-radius: 4px;
    border: 1px solid rgba(240,230,210,0.12);
}

.tt-mt-stats {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    color: rgba(240,230,210,0.45);
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    margin-top: 2px;
}
.tt-mt-dot { opacity: 0.3; }
.tt-mt-tea { color: rgba(251,191,36,0.6); font-weight: 700; }

/* ============================
   Mountain States
   ============================ */

/* Selected — stop float, lock scale, bright glow */
.tt-mt.tt-selected {
    transform: translate(-50%, -50%) scale(1.12);
    z-index: 15;
    animation: none;
}
.tt-mt.tt-selected .tt-mt-glow {
    opacity: 0.7;
    animation: none;
    transform: scale(1.1);
}
.tt-mt.tt-selected .tt-mt-icon::before {
    border-color: var(--mt-glow, rgba(240,230,210,0.4));
    box-shadow: 0 0 20px var(--mt-glow, rgba(255,255,255,0.3));
    animation: none;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
}
.tt-mt.tt-selected .tt-mt-icon img {
    filter: brightness(1.25) saturate(1.3) drop-shadow(0 4px 20px rgba(0,0,0,0.4));
    transform: scale(1.06);
    -webkit-mask-image: radial-gradient(ellipse 65% 65% at center, rgba(0,0,0,1) 52%, rgba(0,0,0,0.45) 65%, rgba(0,0,0,0.12) 78%, transparent 92%);
    mask-image: radial-gradient(ellipse 65% 65% at center, rgba(0,0,0,1) 52%, rgba(0,0,0,0.45) 65%, rgba(0,0,0,0.12) 78%, transparent 92%);
}
.tt-mt.tt-selected .tt-mt-name {
    color: #fff;
    background: rgba(20,30,20,0.7);
    border-color: var(--mt-glow, rgba(240,230,210,0.3));
    box-shadow: 0 0 10px var(--mt-glow, rgba(255,255,255,0.2));
}

/* === Thief Overlay — cinematic sequence === */
.tt-thief-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    pointer-events: none;
    overflow: hidden;
}

/* Dark mask fades in */
.tt-thief-mask {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0);
    transition: background 0.6s ease;
}
.tt-thief-overlay.tt-phase-alert .tt-thief-mask,
.tt-thief-overlay.tt-phase-drop .tt-thief-mask {
    background: rgba(0,0,0,0.55);
}
.tt-thief-overlay.tt-phase-fly .tt-thief-mask {
    background: rgba(0,0,0,0.35);
}
.tt-thief-overlay.tt-phase-hit .tt-thief-mask {
    background: rgba(0,0,0,0.2);
}

/* Warning text */
.tt-thief-alert {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 210;
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: 'Noto Serif SC', serif;
    font-size: 42px;
    font-weight: 900;
    color: #ef4444;
    text-shadow: 0 0 40px rgba(239,68,68,0.8), 0 6px 16px rgba(0,0,0,0.9);
    letter-spacing: 6px;
    opacity: 0;
    white-space: nowrap;
}
.tt-thief-alert i {
    font-size: 36px;
    animation: tt-alert-flash 0.4s ease-in-out infinite alternate;
}
@keyframes tt-alert-flash {
    from { opacity: 0.5; }
    to { opacity: 1; }
}
.tt-thief-overlay.tt-phase-alert .tt-thief-alert {
    animation: tt-alert-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes tt-alert-in {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    60% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Thief sprite — cloud riding thief */
.tt-thief-sprite {
    position: absolute;
    width: 100px;
    height: 100px;
    z-index: 220;
    opacity: 0;
    will-change: transform, left, top;
    overflow: visible;
}

/* Thief image container */
.tt-thief-frames {
    width: 100px;
    height: 100px;
    position: relative;
    background: url('/images/thief-cloud.webp') no-repeat center center;
    background-size: contain;
    image-rendering: -webkit-optimize-contrast;
}

/* Floating hover animation — gentle up-down bob */
.tt-thief-sprite.tt-flying {
    animation: tt-cloud-float 1.8s ease-in-out infinite;
}
@keyframes tt-cloud-float {
    0%   { transform: translateY(0) var(--tt-flip, scaleX(1)); }
    50%  { transform: translateY(-10px) var(--tt-flip, scaleX(1)); }
    100% { transform: translateY(0) var(--tt-flip, scaleX(1)); }
}

/* Cloud glow aura */
.tt-thief-sprite::before {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 70px;
    height: 30px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(180,160,255,0.4) 0%, rgba(140,120,220,0.15) 50%, transparent 75%);
    animation: tt-cloud-glow 2s ease-in-out infinite alternate;
    z-index: -1;
}
@keyframes tt-cloud-glow {
    0%   { opacity: 0.5; transform: translateX(-50%) scale(0.9); }
    100% { opacity: 1; transform: translateX(-50%) scale(1.15); }
}

/* Cloud trail particles when flying */
.tt-thief-sprite::after {
    content: '';
    position: absolute;
    bottom: 10px;
    left: -15px;
    width: 50px;
    height: 30px;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.8), rgba(200,190,255,0.5) 40%, transparent 75%);
    opacity: 0;
    pointer-events: none;
    filter: blur(3px);
}
.tt-thief-sprite.tt-flying::after {
    animation: tt-cloud-trail 0.6s ease-out infinite;
}
@keyframes tt-cloud-trail {
    0%   { opacity: 0.9; transform: translateX(0) scale(0.6); }
    40%  { opacity: 0.5; transform: translateX(-20px) scale(1.2); }
    100% { opacity: 0; transform: translateX(-50px) scale(1.8); }
}

/* Phase: fly — soaring with heavy glow trails */
.tt-thief-overlay.tt-phase-fly .tt-thief-sprite {
    opacity: 1;
    filter: drop-shadow(0 0 20px rgba(140,120,220,0.8))
            drop-shadow(-12px 0 20px rgba(180,160,255,0.4))
            drop-shadow(-24px 0 30px rgba(140,120,220,0.2))
            drop-shadow(-36px 0 40px rgba(140,120,220,0.08));
}

/* Phase: hit — thief disappears with flash */
.tt-thief-overlay.tt-phase-hit .tt-thief-sprite {
    transition: opacity 0.3s ease;
    opacity: 0 !important;
    filter: drop-shadow(0 0 40px rgba(140,120,220,1)) brightness(2);
}

/* Smoke burst at impact */
.tt-thief-smoke {
    position: absolute;
    width: 200px;
    height: 200px;
    z-index: 215;
    opacity: 0;
    pointer-events: none;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(239,68,68,0.4) 0%, rgba(239,68,68,0.15) 35%, transparent 70%);
}
.tt-thief-overlay.tt-phase-hit .tt-thief-smoke {
    animation: tt-smoke-burst 1s ease-out forwards;
}
@keyframes tt-smoke-burst {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(2.5); }
}

/* Enhanced robbed mountain effect */
.tt-mt.tt-robbed {
    animation: tt-shake-heavy 0.6s cubic-bezier(.36,.07,.19,.97) 3;
}
.tt-mt.tt-robbed .tt-mt-glow {
    opacity: 0.8;
    background: radial-gradient(circle, rgba(239,68,68,0.6), transparent 65%);
    animation: tt-glow-danger 0.5s ease-in-out infinite alternate;
}
.tt-mt.tt-robbed .tt-mt-icon img {
    filter: brightness(0.4) saturate(0.3) sepia(0.4) drop-shadow(0 0 20px rgba(239,68,68,0.5));
}
.tt-mt.tt-robbed .tt-mt-name {
    color: #ef4444 !important;
}
@keyframes tt-shake-heavy {
    0%, 100% { transform: translate(-50%, -50%) translateX(0); }
    10% { transform: translate(-50%, -50%) translate(-8px, -3px) rotate(-2deg); }
    20% { transform: translate(-50%, -50%) translate(6px, 2px) rotate(2deg); }
    30% { transform: translate(-50%, -50%) translate(-6px, 1px) rotate(-1deg); }
    40% { transform: translate(-50%, -50%) translate(5px, -2px) rotate(1.5deg); }
    50% { transform: translate(-50%, -50%) translate(-4px, 1px); }
    60% { transform: translate(-50%, -50%) translate(3px, -1px); }
    70% { transform: translate(-50%, -50%) translate(-2px, 1px); }
}
@keyframes tt-glow-danger {
    from { opacity: 0.5; }
    to { opacity: 0.9; }
}

/* Safe — green atmosphere */
.tt-mt.tt-safe .tt-mt-glow {
    opacity: 0.3;
    background: radial-gradient(circle, rgba(34,197,94,0.35), transparent 65%);
}
.tt-mt.tt-safe .tt-mt-icon img {
    filter: brightness(1.1) saturate(1.15) drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

/* === Bottom Bet Area (Compact) === */
.tt-bottom {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    z-index: 40;
    padding: 0 14px calc(env(safe-area-inset-bottom, 0px) + 8px);
}

.tt-bet-panel {
    background: rgba(20,30,20,0.82);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 16px;
    padding: 10px 12px;
    border: 1px solid rgba(240,230,210,0.06);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
}

.tt-bet-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tt-bet-mt-name {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    font-size: 11px;
    font-weight: 700;
    color: rgba(240,230,210,0.4);
    font-family: 'Noto Serif SC', serif;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.2;
}

/* Custom dropdown — opens upward */
.tt-dropdown {
    position: relative;
    flex: 1;
    min-width: 0;
}

.tt-dropdown-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(240,230,210,0.12);
    border-radius: 10px;
    color: #f0e6d2;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.15s ease;
}

.tt-dropdown-trigger:active {
    border-color: rgba(99,102,241,0.5);
}

.tt-coin-icon {
    font-size: 13px;
    color: #fbbf24;
    flex-shrink: 0;
}

.tt-dropdown-value {
    flex: 1;
    text-align: left;
}

.tt-dropdown-arrow {
    font-size: 10px;
    color: rgba(240,230,210,0.35);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.tt-dropdown.open .tt-dropdown-arrow {
    transform: rotate(180deg);
}

.tt-dropdown.open .tt-dropdown-trigger {
    border-color: rgba(99,102,241,0.5);
}

.tt-dropdown-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    right: 0;
    background: rgba(20,30,20,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(240,230,210,0.1);
    border-radius: 10px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 100;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.4);
}

.tt-dropdown.open .tt-dropdown-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.tt-dropdown-item {
    padding: 10px 14px;
    color: rgba(240,230,210,0.6);
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.12s ease, color 0.12s ease;
    border-bottom: 1px solid rgba(240,230,210,0.05);
}

.tt-dropdown-item:last-child {
    border-bottom: none;
}

.tt-dropdown-item:active {
    background: rgba(99,102,241,0.15);
}

.tt-dropdown-item.active {
    color: #a5b4fc;
    background: rgba(99,102,241,0.12);
}

/* Bet button */
.tt-bet-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 16px;
    height: 38px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(99,102,241,0.3);
    white-space: nowrap;
}
.tt-bet-btn:disabled {
    background: rgba(255,255,255,0.05);
    color: rgba(240,230,210,0.18);
    box-shadow: none;
    cursor: not-allowed;
}
.tt-bet-btn:not(:disabled):active { transform: scale(0.97); }
.tt-bet-btn i { font-size: 12px; }

/* Bet Placed State */
.tt-bet-done {
    background: rgba(20,30,20,0.82);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid rgba(99,102,241,0.12);
    box-shadow: 0 -8px 32px rgba(0,0,0,0.35);
}
.tt-done-row { display: flex; align-items: center; gap: 12px; }
.tt-done-icon { font-size: 20px; color: #4ade80; flex-shrink: 0; }
.tt-done-title { color: #f0e6d2; font-size: 14px; font-weight: 700; }
.tt-done-sub { color: rgba(240,230,210,0.35); font-size: 11px; margin-top: 2px; }
.tt-done-amount { color: #fbbf24; font-weight: 700; }

/* === Side Action Buttons === */
.tt-side-actions {
    position: absolute;
    right: 14px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 110px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 41;
}
.tt-side-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 46px;
    padding: 8px 0;
    border-radius: 14px;
    background: rgba(20,30,20,0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: rgba(240,230,210,0.45);
    font-size: 9px;
    font-weight: 600;
    border: 1px solid rgba(240,230,210,0.06);
    cursor: pointer;
    transition: all 0.2s ease;
}
.tt-side-btn i { font-size: 17px; }
.tt-side-btn:active { transform: scale(0.9); background: rgba(255,255,255,0.08); }

/* === Result Modal === */
.tt-modal {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tt-modal.hidden { display: none; }

.tt-modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.tt-modal-body {
    position: relative;
    z-index: 1;
    padding: 24px;
    width: 100%;
    max-width: 340px;
}

.tt-modal-card {
    background: rgba(25,35,25,0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 24px;
    border: 1px solid rgba(240,230,210,0.08);
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
    animation: tt-modal-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes tt-modal-pop {
    0% { transform: scale(0.8) translateY(20px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.tt-result-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.tt-modal-inner {
    position: relative;
    z-index: 1;
    padding: 28px 24px 24px;
    text-align: center;
}

.tt-result-icon {
    width: 72px; height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tt-result-icon i { font-size: 34px; color: #f0e6d2; }

.tt-result-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 20px;
    font-weight: 700;
    color: #f0e6d2;
    margin-bottom: 6px;
}

.tt-result-desc {
    font-size: 13px;
    color: rgba(240,230,210,0.35);
    margin-bottom: 16px;
}

.tt-result-amount {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 16px;
    padding: 10px 20px;
    margin-bottom: 12px;
}
.tt-result-num {
    font-family: 'Inter', sans-serif;
    font-size: 24px;
    font-weight: 800;
}
.tt-result-unit { font-size: 13px; opacity: 0.5; color: #f0e6d2; }

.tt-result-detail {
    font-size: 11px;
    color: rgba(240,230,210,0.2);
    margin-bottom: 20px;
    line-height: 1.5;
}

.tt-result-btn {
    width: 100%;
    padding: 13px;
    border-radius: 14px;
    border: none;
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease;
}
.tt-result-btn:active { transform: scale(0.97); }

/* === Popup Panels === */
.tt-popup {
    background: rgba(25,35,25,0.97) !important;
    border: 1px solid rgba(240,230,210,0.06) !important;
    border-bottom: none !important;
}
.tt-popup-handle { background: rgba(240,230,210,0.12) !important; }

.tt-popup-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 18px;
    font-weight: 700;
    color: #f0e6d2;
    margin-bottom: 16px;
}

.tt-popup-scroll {
    max-height: 400px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.tt-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    color: rgba(240,230,210,0.18);
}
.tt-empty-state i { font-size: 32px; margin-bottom: 8px; }
.tt-empty-state p { font-size: 13px; }

/* Rules Panel */
.tt-rules-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.tt-rule-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.tt-rule-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 15px;
}
.tt-rule-item p {
    font-size: 13px;
    color: rgba(240,230,210,0.5);
    line-height: 1.6;
    padding-top: 6px;
}
.tt-rule-item p b { color: rgba(240,230,210,0.8); }

.tt-rule-tip-box {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
    margin-top: 4px;
    border-radius: 14px;
    background: rgba(251,191,36,0.06);
    border: 1px solid rgba(251,191,36,0.1);
}
.tt-rule-tip-box i { color: #fbbf24; font-size: 14px; margin-top: 2px; flex-shrink: 0; }
.tt-rule-tip-box p { font-size: 12px; color: rgba(240,230,210,0.3); line-height: 1.5; }

/* === Win Particles === */
@keyframes tt-particle-fall {
    0% { transform: translateY(-10px) translateX(0) rotate(0); opacity: 0; }
    15% { opacity: 1; }
    100% { transform: translateY(250px) translateX(var(--px, 20px)) rotate(720deg); opacity: 0; }
}
.tt-win-particle {
    position: absolute;
    width: 8px; height: 8px;
    border-radius: 2px;
    animation: tt-particle-fall 1.8s ease-in forwards;
    animation-delay: var(--pd, 0s);
    pointer-events: none;
}

/* === Ambient Tea Leaf Particles === */
@keyframes tt-leaf-float {
    0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
    10% { opacity: 0.4; }
    90% { opacity: 0.4; }
    100% { transform: translateY(-100vh) translateX(var(--fx, 30px)) rotate(var(--fr, 360deg)); opacity: 0; }
}
.tt-leaf {
    position: absolute;
    bottom: -20px;
    width: 6px; height: 6px;
    background: rgba(180,220,120,0.2);
    border-radius: 50% 0;
    animation: tt-leaf-float linear infinite;
    pointer-events: none;
}

/* === Responsive === */
@media screen and (max-height: 667px) {
    .tt-map {
        top: 10%;
        bottom: 12%;
    }
    .tt-mt-icon { width: 100px; height: 100px; }
    .tt-mt-icon::before { width: 48px; height: 48px; }
    .tt-mt-name { font-size: 11px; }
    .tt-bet-panel { padding: 8px 10px; }
    .tt-side-actions { bottom: calc(env(safe-area-inset-bottom, 0px) + 100px); }
}

@media screen and (min-height: 812px) {
    .tt-map {
        top: 10%;
        bottom: 12%;
    }
    .tt-mt-icon { width: 145px; height: 145px; }
    .tt-mt-icon::before { width: 70px; height: 70px; }
    .tt-mt-name { font-size: 14px; }
}

/* === CPL Trade Panel Styles === */
.trade-popup {
    max-height: 92vh !important;
    background: linear-gradient(180deg, #1a2332 0%, #0d1420 100%) !important;
}

.trade-balance-bar {
    display: flex;
    justify-content: space-around;
    padding: 12px 16px;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    margin: 0 16px 12px;
}

.trade-balance-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.trade-balance-label {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    font-weight: 500;
}

.trade-balance-value {
    font-size: 18px;
    font-weight: 700;
    color: #f0e6d2;
    font-family: 'Inter', sans-serif;
}

.trade-orderbook-section {
    margin: 0 16px 12px;
    background: rgba(255,255,255,0.02);
    border-radius: 12px;
    padding: 12px;
}

.trade-orderbook-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.trade-latest-price {
    font-size: 20px;
    font-weight: 700;
    color: #4ade80;
}

.trade-spread {
    font-size: 11px;
    color: rgba(255,255,255,0.3);
}

.trade-orderbook-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.trade-orderbook-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.trade-col-header {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.trade-col-header.sell { color: #f87171; }
.trade-col-header.buy { color: #4ade80; }

.trade-order-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 120px;
    overflow-y: auto;
}

.trade-order-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 4px;
    padding: 5px 6px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s;
}

.trade-order-row:hover {
    background: rgba(255,255,255,0.05);
}

.trade-order-row.sell .trade-price { color: #f87171; }
.trade-order-row.buy .trade-price { color: #4ade80; }

.trade-price {
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}

.trade-price.up { color: #4ade80; }
.trade-price.down { color: #f87171; }

.trade-amount {
    color: rgba(255,255,255,0.6);
    text-align: right;
}

.trade-count {
    font-size: 9px;
    color: rgba(255,255,255,0.3);
    text-align: right;
}

.trade-empty-row {
    text-align: center;
    color: rgba(255,255,255,0.2);
    font-size: 11px;
    padding: 20px 0;
}

.trade-form-section {
    margin: 0 16px 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    padding: 12px;
}

.trade-tab-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.trade-tab {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: transparent;
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.trade-tab.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-color: rgba(255,255,255,0.2);
}

.trade-tab-bar .trade-tab:nth-child(1).active {
    background: rgba(74,222,128,0.15);
    border-color: rgba(74,222,128,0.3);
    color: #4ade80;
}

.trade-tab-bar .trade-tab:nth-child(2).active {
    background: rgba(248,113,113,0.15);
    border-color: rgba(248,113,113,0.3);
    color: #f87171;
}

.trade-form-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.trade-form-row label {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}

.trade-form-row input {
    width: 55%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-align: right;
    outline: none;
    transition: border-color 0.2s;
}

.trade-form-row input:focus {
    border-color: rgba(74,222,128,0.5);
}

.trade-form-row input::placeholder {
    color: rgba(255,255,255,0.2);
}

.trade-form-row.preview {
    padding: 10px 0;
    border-top: 1px solid rgba(255,255,255,0.05);
    margin-top: 8px;
}

.trade-form-row.preview span:first-child {
    color: rgba(255,255,255,0.4);
}

.trade-form-row.preview span:last-child {
    color: #f0e6d2;
    font-weight: 600;
}

.trade-submit-btn {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: none;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.trade-submit-btn.buy {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    box-shadow: 0 4px 15px rgba(34,197,94,0.3);
}

.trade-submit-btn.sell {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 15px rgba(239,68,68,0.3);
}

.trade-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.trade-my-orders-section,
.trade-trades-section {
    margin: 0 16px 12px;
}

.trade-section-title {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.trade-my-orders-list {
    max-height: 100px;
    overflow-y: auto;
}

.trade-my-order-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
    margin-bottom: 4px;
}

.trade-my-order-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.trade-type {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

.trade-type.up {
    background: rgba(74,222,128,0.15);
    color: #4ade80;
}

.trade-type.down {
    background: rgba(248,113,113,0.15);
    color: #f87171;
}

.trade-my-order-info .trade-price,
.trade-my-order-info .trade-amount {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
}

.trade-cancel-btn {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(248,113,113,0.3);
    background: rgba(248,113,113,0.1);
    color: #f87171;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.trade-cancel-btn:hover {
    background: rgba(248,113,113,0.2);
}

.trade-trades-list {
    max-height: 150px;
    overflow-y: auto;
}

.trade-record-row {
    display: grid;
    grid-template-columns: auto 1fr 1fr;
    gap: 8px;
    padding: 6px 0;
    font-size: 11px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.trade-record-row .trade-time {
    color: rgba(255,255,255,0.3);
}

.trade-record-row .trade-price {
    color: rgba(255,255,255,0.6);
}

.trade-record-row .trade-amount {
    color: rgba(255,255,255,0.5);
    text-align: right;
}



/* ========== Small Screen Phone Optimizations (≤375px) ========== */
@media screen and (max-width: 375px) {
    /* Reduce top nav height */
    nav .h-11 {
        height: 44px !important;
    }
    
    /* Reduce bottom nav height */
    .glass-dark {
        height: 46px !important;
    }
    
    .glass-dark a, .glass-dark button {
        width: 42px !important;
        height: 38px !important;
    }
    
    .glass-dark i {
        font-size: 15px !important;
    }
    
    .glass-dark span {
        font-size: 7px !important;
    }
    
    /* Game center button */
    .glass-dark .rounded-xl {
        width: 46px !important;
        height: 46px !important;
        margin-top: -8px !important;
    }
    

    
    /* Reduce card shadows */
    .shadow-soft, .shadow-lg, .shadow-xl {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
    }
    
    /* Reduce gaps and paddings globally */
    .gap-3 {
        gap: 0.5rem !important;
    }
    
    .gap-4 {
        gap: 0.75rem !important;
    }
    
    .p-4 {
        padding: 0.75rem !important;
    }
    
    .p-5 {
        padding: 0.875rem !important;
    }
    
    /* Profile tabs */
    .tab-active, .tab-inactive {
        padding: 0.375rem 0.5rem !important;
        font-size: 0.625rem !important;
    }
    
    /* Reduce member card aspect ratio */
    #profileHeader {
        aspect-ratio: 2.2 / 1 !important;
    }
    
    /* Reduce font sizes */
    .text-base {
        font-size: 0.875rem !important;
    }
    
    .text-lg {
        font-size: 1rem !important;
    }
    
    .text-xl {
        font-size: 1.125rem !important;
    }
    
    /* Form inputs */
    input, textarea, select {
        font-size: 14px !important;
        padding: 0.625rem 0.75rem !important;
    }
    
    /* Buttons */
    button, .btn {
        min-height: 36px !important;
    }
}

/* ========== Extra Small Screen (iPhone SE, ≤320px) ========== */
@media screen and (max-width: 320px) {
    /* Even more compact for very small screens */
    nav .h-11 {
        height: 40px !important;
    }
    
    .glass-dark {
        height: 42px !important;
    }
    
    .glass-dark a, .glass-dark button {
        width: 38px !important;
        height: 34px !important;
        gap: 2px !important;
    }
    
    .glass-dark i {
        font-size: 14px !important;
    }
    
    .glass-dark span {
        font-size: 6px !important;
    }
    
    /* Reduce all spacing further */
    .px-2 {
        padding-left: 0.375rem !important;
        padding-right: 0.375rem !important;
    }
    
    .py-2 {
        padding-top: 0.375rem !important;
        padding-bottom: 0.375rem !important;
    }
    
    /* Reduce card padding */
    .p-3 {
        padding: 0.5rem !important;
    }
}

/* ========== Token Pocket Wallet WebView Optimizations ========== */
/* TP钱包WebView有额外的顶部状态栏和底部浏览器控件，需要特殊处理 */
@supports (padding-top: env(safe-area-inset-top)) {
    /* TP钱包内的页面顶部导航需要考虑状态栏 */
    body {
        padding-top: env(safe-area-inset-top) !important;
    }
    
    /* TP钱包底部浏览器控件约44px - 底部导航紧贴其上方 */
    body {
        padding-bottom: 0 !important;
    }
    
    /* 底部导航栏紧贴TP浏览器控件上方 */
    nav.fixed.bottom-0 {
        bottom: 0 !important;
        padding-bottom: env(safe-area-inset-bottom) !important;
    }
}

/* TP钱包专用紧凑模式 */
@media screen and (max-height: 700px) {
    /* 小屏手机在TP钱包中，内容区域更紧张 */
    
    /* 压缩个人中心会员卡 */
    #profileHeader {
        aspect-ratio: 2.2 / 1 !important;
        margin-bottom: 0.875rem !important;
    }

    #profileHeader .p-4 {
        padding: 0.875rem !important;
    }

    /* 压缩统计卡片 */
    #statsCards {
        gap: 0.625rem !important;
        margin-bottom: 0.875rem !important;
    }

    #statsCards > div {
        padding: 0.75rem !important;
    }

    /* 压缩Tab栏 */
    .tab-active, .tab-inactive {
        padding: 0.375rem 0.5rem !important;
        font-size: 0.625rem !important;
    }

    /* 压缩内容区间距 */
    main > section,
    main > div {
        margin-bottom: 0.625rem !important;
    }
}

/* ========== SweetAlert2 Purchase Modal Content Styles ========== */
/* 仅自定义弹框内容区域样式，保留 Swal 默认弹窗样式 */

/* 内容容器 */
.swal-purchase-container {
    text-align: left;
    padding: 4px 0;
}

/* 区块 */
.swal-section {
    margin-bottom: 12px;
}

.swal-section:last-of-type {
    margin-bottom: 0;
}

.swal-label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.swal-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.swal-link {
    font-size: 11px;
    color: #059669;
    text-decoration: none;
    font-weight: 500;
}

/* 数量控制 - 紧凑 */
.swal-quantity-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 4px 8px;
}

.swal-qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #374151;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.swal-qty-btn:active {
    transform: scale(0.92);
    background: #f9fafb;
}

.swal-quantity-control input {
    width: 40px;
    text-align: center;
    border: none;
    background: transparent;
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    font-family: 'Inter', sans-serif;
}

/* 支付方式 - 一行显示 */
.swal-payment-grid {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.swal-payment-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1.5px solid #e5e7eb;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
}

.swal-payment-option:active {
    background: #f9fafb;
}

.swal-payment-option.selected {
    border-color: #2c3e2e;
    background: rgba(44, 62, 46, 0.03);
}

.swal-payment-option input {
    display: none;
}

.swal-payment-content {
    flex: 1;
    min-width: 0;
}

.swal-payment-title {
    font-size: 12px;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.swal-payment-desc {
    font-size: 10px;
    color: #6b7280;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.swal-payment-check {
    font-size: 14px;
    color: #2c3e2e;
    opacity: 0;
    flex-shrink: 0;
}

.swal-payment-option.selected .swal-payment-check {
    opacity: 1;
}

/* 下拉选择 - 紧凑 */
.swal-select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #fff;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 10px center;
    background-repeat: no-repeat;
    background-size: 14px;
    padding-right: 32px;
}

/* 汇总信息 - 紧凑 */
.swal-summary {
    background: linear-gradient(135deg, #f8faf8 0%, #f0f4f0 100%);
    border-radius: 12px;
    padding: 12px;
    margin-top: 2px;
}

.swal-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.swal-summary-row span:first-child {
    font-size: 12px;
    color: #6b7280;
}

.swal-summary-amount {
    display: flex;
    align-items: baseline;
    gap: 3px;
}

.swal-summary-amount span:first-child {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    font-family: 'Inter', sans-serif;
}

.swal-summary-amount span:last-child {
    font-size: 11px;
    color: #6b7280;
}

.swal-summary-reward {
    display: flex;
    align-items: center;
    gap: 5px;
    padding-top: 8px;
    border-top: 1px dashed rgba(0, 0, 0, 0.06);
    margin-top: 8px;
}

.swal-summary-reward i {
    color: #f59e0b;
    font-size: 12px;
}

.swal-summary-reward span {
    font-size: 11px;
    color: #6b7280;
}

.swal-summary-reward strong {
    color: #f59e0b;
    font-weight: 700;
}

/* 加载状态 */
.swal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
}

.swal-loading p {
    margin-top: 10px;
    font-size: 13px;
    color: #6b7280;
}

.swal-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #2c3e2e;
    border-radius: 50%;
    animation: swal-spin 0.8s linear infinite;
}

@keyframes swal-spin {
    to { transform: rotate(360deg); }
}


