/* =====================================================
   WATONSITO VPET - CSS
   Virtual Pet Device — Genrupto Slime Aesthetic
   ===================================================== */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@700;900&display=swap');

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: manipulation;
}

body {
    background: radial-gradient(circle at 50% 30%, #351545 0%, #200a2d 50%, #12041c 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Fredoka', 'Courier New', monospace;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* =====================================================
   SLIME DEVICE CARCASS — Genrupto Signature Aesthetic
   Iridescent Mint/Lavender/Bubblegum Slime, Sticker Outline,
   Deep Purple Puddle Base, Viscous Melting Drips & Gloss
   ===================================================== */

/* Responsive Device Scaler for Android & All Mobile Devices */
#device-scaler {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    height: 100dvh;
    padding: env(safe-area-inset-top, 6px) env(safe-area-inset-right, 6px) env(safe-area-inset-bottom, 6px) env(safe-area-inset-left, 6px);
    box-sizing: border-box;
    overflow: visible;
}

/* =====================================================
   CARCASA WRAPPER (PNG Carcass + Integrated Buttons)
   ===================================================== */
#carcasa-wrap {
    position: relative;
    width: min(480px, 98vw, 94dvh);
    height: min(480px, 98vw, 94dvh);
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    -webkit-user-select: none;
    filter: drop-shadow(0 16px 36px rgba(12, 3, 25, 0.85));
    touch-action: manipulation;
    transform-origin: center center;
    transition: transform 0.15s ease-out;
}

body.stats-mode #carcasa-wrap {
    width: min(640px, 98vw, 96dvh);
    height: min(640px, 98vw, 96dvh);
}

#carcasa-base {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    z-index: 2;
}

/* =====================================================
   SCREEN AREA — Nested precisely in the PNG Screen Cutout
   Cutout in 2048x2048:
   X: 590 to 1460 (28.81% to 71.29%, width 42.48%)
   Y: 416 to 1146 (20.31% to 55.95%, height 35.64%)
   ===================================================== */
#screen {
    position: absolute;
    left: 28.7%;
    top: 20.3%;
    width: 42.6%;
    height: 35.8%;
    background: #0d061a;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 18px rgba(160, 220, 255, 0.22);
    image-rendering: pixelated;
    filter: brightness(1.10) contrast(1.05);
    z-index: 4;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

#viewport {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    image-rendering: pixelated;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: pointer;
}

/* Touch Moon Sleep Button (Inside Screen Left side during night) */
#btn-night-sleep {
    position: absolute;
    left: 6px;
    top: 48%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(63, 35, 75, 0.72);
    border: 1px solid rgba(255, 229, 164, 0.8);
    z-index: 12;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 209, 102, 0.35);
    transition: transform 0.15s cubic-bezier(0.2, 0.9, 0.3, 1.2), box-shadow 0.15s ease, background 0.15s ease;
    touch-action: manipulation;
    outline: none;
    padding: 0;
}

#btn-night-sleep:hover {
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 0 14px rgba(255, 209, 102, 0.7);
}

#btn-night-sleep:active {
    transform: translateY(-50%) scale(0.92);
}

#btn-night-sleep.sleeping {
    background: rgba(36, 12, 68, 0.95);
    border-color: #fde047;
    box-shadow: 0 0 14px rgba(253, 224, 71, 0.75);
}

.sleep-moon-icon {
    width: 15px;
    height: 15px;
    display: block;
    pointer-events: none;
}

.sleep-label {
    font-size: 7px;
    font-weight: 900;
    color: #ffd166;
    line-height: 1;
    margin-top: 1px;
    pointer-events: none;
    letter-spacing: 0.5px;
}

/* SUDO Badge Button (For Nerume Admin users) */
#btn-sudo-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 12;
    background: linear-gradient(135deg, #7e22ce, #9333ea);
    color: #ffffff;
    font-size: 7.5px;
    font-weight: 900;
    letter-spacing: 0.6px;
    border: 1px solid #c084fc;
    border-radius: 5px;
    padding: 2px 5px;
    cursor: pointer;
    text-shadow: 0 1px 2px #000;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.6);
    transition: transform 0.15s cubic-bezier(0.2, 0.9, 0.3, 1.2), filter 0.15s ease;
    touch-action: manipulation;
}

#btn-sudo-badge:hover {
    filter: brightness(1.2);
    transform: scale(1.06);
}

#btn-sudo-badge:active {
    transform: scale(0.94);
}

/* =====================================================
   OVERLAY (for menus, inventory, lab, etc.)
   ===================================================== */
#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 5, 20, 0.88);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 8px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    z-index: 10;
    font-size: 11px;
    line-height: 1.4;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

#overlay::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

#overlay.hidden {
    display: none;
}

#overlay.immersive-bg {
    background-color: #170d22;
    background-image: linear-gradient(rgba(22, 12, 31, 0.46), rgba(12, 11, 25, 0.72)), url('../assets/bg/lab.png');
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

#overlay.immersive-bg .overlay-header {
    border-bottom-color: rgba(235, 203, 255, 0.58);
}

#overlay.immersive-bg .stat-row {
    background-color: rgba(19, 13, 30, 0.52);
    border-bottom-color: rgba(230, 207, 255, 0.18);
}

#overlay.immersive-bg .stat-name {
    color: #eadcf5;
}

#overlay.immersive-bg .stat-value {
    color: #fff;
}

#overlay input {
    user-select: text !important;
    -webkit-user-select: text !important;
}

#overlay input:focus {
    outline: 1px solid #00e5ff !important;
}

/* Overlay content styles */
.overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid rgba(255, 120, 160, 0.25);
    padding-bottom: 6px;
    margin-bottom: 8px;
    gap: 8px;
}

.overlay-header h3 {
    margin: 0 !important;
    border-bottom: none !important;
    padding: 0 !important;
    text-align: left !important;
    font-size: 13px;
    letter-spacing: 1.5px;
    color: #ffd166;
    text-shadow: 0 0 8px rgba(255, 209, 102, 0.5);
}

.overlay-close-btn {
    background: linear-gradient(180deg, #fecdd3 0%, #fb7185 50%, #e11d48 100%);
    color: #fff;
    font-family: 'Fredoka', 'Courier New', monospace;
    font-size: 11px;
    font-weight: 700;
    border: 1.5px solid #9f1239;
    border-radius: 12px;
    padding: 3px 9px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.6);
    transition: transform 0.12s, filter 0.12s;
}

.overlay-close-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.overlay-close-btn:active {
    transform: scale(0.95);
}

.overlay-bottom-btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 10px auto 4px auto;
    background: linear-gradient(180deg, #fecdd3 0%, #fb7185 50%, #e11d48 100%);
    color: #fff;
    font-family: 'Fredoka', 'Courier New', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border: 2px solid #9f1239;
    border-radius: 14px;
    padding: 7px 12px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), inset 0 2px 3px rgba(255, 255, 255, 0.6);
    transition: transform 0.12s, filter 0.12s;
}

.overlay-bottom-btn:hover {
    transform: scale(1.02);
    filter: brightness(1.1);
}

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

.lab-extract-btn {
    display: block;
    width: 90%;
    margin: 12px auto;
    padding: 10px 14px;
    font-family: 'Fredoka', 'Arial Black', sans-serif;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.8px;
    border-radius: 20px;
    border: 2px solid #ffaa00;
    background: linear-gradient(180deg, #ffe066 0%, #ff9f1c 50%, #d45d00 100%);
    color: #3d1400;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    box-shadow:
        0 4px 12px rgba(255, 159, 28, 0.5),
        inset 0 2px 4px rgba(255, 255, 255, 0.8),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3);
    animation: pulse-extract 1.2s infinite alternate ease-in-out;
    transition: transform 0.12s;
}

@keyframes pulse-extract {
    0% { transform: scale(1); filter: brightness(1); }
    100% { transform: scale(1.04); filter: brightness(1.15) drop-shadow(0 0 10px #ff9f1c); }
}

.lab-extract-btn:active {
    transform: scale(0.95);
}

.lab-phase-heating {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

/* Selector de dificultad en Estadísticas */
.diff-choice-btn {
    padding: 5px 3px;
    font-size: 8.5px;
    font-weight: 700;
    border-radius: 4px;
    background: rgba(30, 20, 52, 0.7);
    border: 1px solid rgba(168, 85, 247, 0.4);
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    touch-action: manipulation;
}

.diff-choice-btn:hover {
    background: rgba(168, 85, 247, 0.25);
    border-color: #c084fc;
    color: #fff;
    transform: scale(1.02);
}

.diff-choice-btn.active {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.35), rgba(168, 85, 247, 0.4));
    border: 1.5px solid #ffd700;
    color: #ffd700;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.35);
    font-weight: 900;
}

#overlay h3 {
    color: #d4a6f5;
    text-align: center;
    margin-bottom: 6px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 1px solid #3a2255;
    padding-bottom: 4px;
    text-shadow: 0 0 8px rgba(180, 100, 255, 0.4);
}

#overlay .stat-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 4px;
    border-bottom: 1px solid #1a1028;
}

#overlay .stat-row:nth-child(even) {
    background: rgba(180, 140, 220, 0.04);
}

#overlay .stat-name {
    color: #a088bb;
}

#overlay .stat-value {
    color: #e0d0f0;
    font-weight: bold;
}

#overlay .stat-bar {
    display: inline-block;
    width: 60px;
    height: 8px;
    background: #1a1028;
    border-radius: 4px;
    overflow: hidden;
    vertical-align: middle;
    margin-left: 4px;
}

#overlay .stat-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

/* Inventory items in overlay */
#overlay .inv-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px;
    margin: 2px 0;
    background: rgba(150, 100, 200, 0.08);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid transparent;
}

#overlay .inv-item:hover {
    background: rgba(150, 100, 200, 0.2);
}

#overlay .inv-item.selected {
    background: rgba(200, 160, 255, 0.15);
    border: 1px solid #b896d4;
    box-shadow: 0 0 6px rgba(180, 100, 255, 0.2);
}

#overlay .inv-item .item-name {
    color: #ccc;
    font-size: 10px;
}

#overlay .inv-item .item-count {
    color: #d4a6f5;
    font-weight: bold;
    font-size: 11px;
}

#overlay .inv-item .item-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    flex-shrink: 0;
    box-shadow: 0 0 4px currentColor;
}

#overlay .inv-item-row {
    display: flex;
    align-items: center;
}

/* Scrollable inventory sections */
#overlay .inv-section {
    margin-top: 6px;
}

#overlay .inv-section-title {
    color: #7a5daa;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
    padding-left: 4px;
}

.inv-gem-summary {
    display: flex;
    justify-content: center;
    gap: 18px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(226, 190, 255, 0.28);
}

.inv-gem-summary > div {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #fff;
    font-weight: 700;
}

.inv-gem-summary img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.inventory-serum-icon {
    width: 28px;
    height: 34px;
    object-fit: contain;
    margin-right: 5px;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

/* =====================================================
   LAB MINIGAME UI (in overlay)
   ===================================================== */

#overlay .lab-phase {
    text-align: center;
    margin: 4px 0;
}

#overlay .lab-viewport {
    width: 220px;
    height: 140px;
    margin: 4px auto;
    position: relative;
    background: #0a080f;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #3a2255;
}

#overlay .lab-viewport canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}

#overlay .lab-progress {
    width: 100%;
    height: 16px;
    background: #1a1028;
    border-radius: 8px;
    overflow: hidden;
    margin: 6px 0;
    position: relative;
    border: 1px solid #3a2255;
}

#overlay .lab-progress-fill {
    height: 100%;
    border-radius: 8px;
    transition: width 0.1s;
}

#overlay .lab-progress .hot-zone {
    position: absolute;
    top: 0;
    height: 100%;
    background: linear-gradient(180deg, rgba(255, 235, 59, 0.55), rgba(245, 158, 11, 0.6));
    border-left: 2px solid #ffd700;
    border-right: 2px solid #ffd700;
    box-shadow: inset 0 0 8px rgba(255, 215, 0, 0.5), 0 0 10px rgba(255, 215, 0, 0.4);
}

#overlay .lab-progress .hot-zone::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.22),
        rgba(255, 255, 255, 0.22) 3px,
        transparent 3px,
        transparent 7px
    );
    pointer-events: none;
}

#overlay .lab-instruction {
    color: #a088bb;
    text-align: center;
    font-size: 10px;
    margin: 4px 0;
}

/* Lab serum selection */
#overlay .serum-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    margin: 4px 0;
}

#overlay .serum-option {
    padding: 6px;
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    font-size: 9px;
    border: 1px solid #3a2255;
    transition: all 0.2s;
}

#overlay .serum-option:hover {
    border-color: #b896d4;
    transform: scale(1.02);
}

#overlay .serum-option.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.lab-topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 24px;
    margin-bottom: 2px;
}

.lab-resource {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-shadow: 0 1px 4px #160c24;
}

.lab-resource img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.lab-topline .overlay-close-btn {
    padding: 2px 7px;
    background: rgba(26, 13, 37, 0.76);
    border-color: rgba(245, 220, 255, 0.7);
    border-radius: 4px;
}

.lab-refine {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 30px;
    margin: 0 auto 4px;
    padding: 2px 12px;
    border: 1px solid rgba(229, 198, 255, 0.48);
    border-radius: 4px;
    background: rgba(20, 12, 32, 0.54);
}

.lab-piece-icon {
    width: 23px;
    height: 23px;
    object-fit: contain;
}

.lab-piece-count {
    min-width: 22px;
    color: #fff;
    font-weight: 700;
}

.lab-piece-count small {
    color: #d7c5e8;
    font-size: 9px;
}

.lab-refine-arrow {
    color: #f0d7ff;
    font-size: 22px;
    line-height: 1;
}

.lab-craft-btn {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 0;
    border: 0;
    background: none;
    color: #fff;
    cursor: pointer;
}

.lab-craft-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.lab-craft-btn img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.lab-craft-count {
    color: #e9d5ff;
    font-size: 9px;
}

.lab-choice-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lab-choice-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 3px;
}

.lab-choice-row.combat {
    padding-top: 4px;
    border-top: 1px solid rgba(245, 218, 255, 0.48);
}

.lab-choice {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    height: 56px;
    padding: 2px;
    overflow: hidden;
    border: 1px solid rgba(240, 218, 255, 0.5);
    border-radius: 4px;
    background: rgba(25, 15, 38, 0.52);
    cursor: pointer;
    touch-action: manipulation;
}

.lab-choice.combat {
    background: rgba(17, 26, 39, 0.58);
    border-color: rgba(171, 224, 255, 0.58);
}

.lab-choice.selected,
.lab-choice:focus-visible {
    outline: 2px solid #fff1a8;
    outline-offset: -2px;
    box-shadow: 0 0 10px rgba(255, 227, 159, 0.48);
}

.lab-choice.disabled {
    opacity: 0.46;
}

.lab-choice > img {
    width: 32px;
    height: 42px;
    object-fit: contain;
    filter: drop-shadow(0 1px 4px rgba(8, 4, 17, 0.8));
}

.lab-choice-cost {
    position: absolute;
    right: 2px;
    bottom: 1px;
    display: flex;
    align-items: center;
    gap: 1px;
    padding: 0 2px;
    border-radius: 2px;
    background: rgba(13, 8, 22, 0.78);
    color: #fff;
    font-size: 8px;
    line-height: 12px;
}

.lab-choice-cost img {
    width: 10px;
    height: 10px;
    object-fit: contain;
}

.lab-result-icon img {
    width: 54px;
    height: 64px;
    object-fit: contain;
}

@media (max-width: 500px) {
    #overlay {
        padding: 4px;
    }

    .lab-topline {
        min-height: 17px;
        margin-bottom: 1px;
    }

    .lab-resource img {
        width: 18px;
        height: 18px;
    }

    .lab-refine {
        min-height: 22px;
        margin-bottom: 2px;
        padding: 1px 6px;
    }

    .lab-piece-icon,
    .lab-craft-btn img {
        width: 18px;
        height: 18px;
    }

    .lab-choice {
        height: 32px;
        padding: 1px;
    }

    .lab-choice > img {
        width: 22px;
        height: 27px;
    }

    .lab-choice-cost {
        right: 0;
        bottom: 0;
        gap: 0;
        padding: 0 1px;
        font-size: 7px;
        line-height: 9px;
    }

    .lab-choice-cost img {
        width: 8px;
        height: 8px;
    }
}


/* =====================================================
   CARCASA INTERACTIVE BUTTONS (Integrated in PNG Carcass)
   Buttons 1, 2, 3, 4: stat1.png, inv2.png, lab3.png, fuera4.png
   Exact alignment in 2048x2048:
   1: stat1   (X: 433/2048 = 21.14%, Y: 1239/2048 = 60.50%, W: 12.70%, H: 16.70%)
   2: inv2    (X: 727/2048 = 35.50%, Y: 1239/2048 = 60.50%, W: 11.96%, H: 16.85%)
   3: lab3    (X: 1015/2048 = 49.56%, Y: 1243/2048 = 60.69%, W: 12.45%, H: 14.70%)
   4: fuera4  (X: 1304/2048 = 63.67%, Y: 1246/2048 = 60.84%, W: 12.94%, H: 16.90%)
   ===================================================== */
#carcasa-buttons {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 6;
}

.carcasa-btn {
    position: absolute;
    pointer-events: auto;
    border: none;
    background: transparent;
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.carcasa-btn-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
    /* Animación suave, elástica y orgánica */
    transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.25), filter 0.2s ease;
    transform-origin: center center;
    will-change: transform, filter;
}

.carcasa-btn:hover .carcasa-btn-img {
    filter: brightness(1.1) drop-shadow(0 6px 10px rgba(0, 0, 0, 0.55));
}

/* Suave compresión táctil cuando se pulsa (sin quedarse aplastado) */
.carcasa-btn.is-pressing .carcasa-btn-img,
.carcasa-btn:active .carcasa-btn-img {
    transform: scale(0.91) translateY(3px);
    filter: brightness(1.22) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
    transition: transform 0.08s ease-out, filter 0.08s ease-out;
}

/* Suave y elegante rebote elástico al soltar */
.carcasa-btn.btn-pop .carcasa-btn-img,
.carcasa-btn.btn-bounce .carcasa-btn-img {
    transform: scale(1.05) translateY(-2px);
    transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Indicador de pantalla activa: glow halo elegante, NUNCA aplastado */
.carcasa-btn.active .carcasa-btn-img {
    filter: brightness(1.16) drop-shadow(0 0 10px rgba(255, 255, 255, 0.8));
}

/* Button 1 (STAT 1): Yellow stat button */
#btn-stats {
    left: 21.14%;
    top: 60.50%;
    width: 12.70%;
    height: 16.70%;
}

/* Button 2 (INV 2): Pink inventory button */
#btn-inventory {
    left: 35.50%;
    top: 60.50%;
    width: 11.96%;
    height: 16.85%;
}

/* Button 3 (LAB 3): Purple alchemy lab button */
#btn-lab {
    left: 49.56%;
    top: 60.69%;
    width: 12.45%;
    height: 14.70%;
}

/* Button 4 (FUERA 4): Blue outside expedition button */
#btn-door {
    left: 63.67%;
    top: 60.84%;
    width: 12.94%;
    height: 16.90%;
}

.carcasa-btn.in-combat-disabled {
    filter: grayscale(0.85) brightness(0.6) !important;
    opacity: 0.3 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* ==============================================
   ACTION BUTTONS (A/B) — Jelly Slime Orbs
   ============================================== */
#action-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    position: relative;
    z-index: 5;
    margin-top: 2px;
}

#action-buttons.hidden {
    display: none;
}

.action-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 16px;
    font-weight: 900;
    font-family: 'Fredoka', 'Arial Black', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    border: 2px solid #3b0764;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s;
    box-shadow:
        0 4px 10px rgba(35, 6, 58, 0.5),
        inset 0 2px 4px rgba(255, 255, 255, 0.8),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 20%;
    width: 60%;
    height: 7px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.1) 100%);
    border-radius: 10px;
    pointer-events: none;
}

#btn-a {
    background: linear-gradient(180deg, #fef08a 0%, #f59e0b 50%, #d97706 100%);
    color: #78350f;
    border-color: #92400e;
}

#btn-b {
    background: linear-gradient(180deg, #fecdd3 0%, #fb7185 50%, #e11d48 100%);
    color: #881337;
    border-color: #9f1239;
}

.action-btn:hover {
    transform: translateY(-2px) scale(1.08);
    box-shadow:
        0 6px 14px rgba(50, 8, 80, 0.6),
        inset 0 2px 5px rgba(255, 255, 255, 0.9);
}

.action-btn:active {
    transform: translateY(2px) scale(0.94);
    box-shadow:
        0 2px 4px rgba(35, 6, 58, 0.4),
        inset 0 3px 6px rgba(0, 0, 0, 0.35);
}

/* =====================================================
   NOTIFICATION
   ===================================================== */
#notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 15, 50, 0.95);
    color: #d4a6f5;
    padding: 8px 20px;
    border-radius: 12px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    z-index: 1000;
    border: 2px solid #9b7bc4;
    box-shadow: 0 0 16px rgba(180, 100, 255, 0.3);
    transition: opacity 0.3s;
}

#notification.hidden {
    display: none;
}

.pwa-install-btn {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 11px;
    border: 1px solid rgba(255, 232, 179, 0.9);
    border-radius: 7px;
    background: rgba(37, 20, 52, 0.92);
    color: #fff1c4;
    font: 700 12px 'Fredoka', 'Courier New', monospace;
    box-shadow: 0 3px 12px rgba(13, 5, 20, 0.5), 0 0 10px rgba(255, 209, 102, 0.2);
    cursor: pointer;
    touch-action: manipulation;
}

.pwa-install-btn svg {
    width: 16px;
    height: 16px;
    flex: none;
}

.pwa-install-btn:hover {
    filter: brightness(1.12);
}

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

.pwa-install-btn.hidden {
    display: none;
}

.back-to-genrupto {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    left: max(10px, env(safe-area-inset-left));
    z-index: 21;
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: calc(50vw - 20px);
    padding: 8px 10px;
    border: 1px solid rgba(232, 210, 255, 0.82);
    border-radius: 7px;
    background: rgba(25, 16, 38, 0.94);
    color: #f5eaff;
    font: 700 12px 'Fredoka', 'Courier New', monospace;
    line-height: 1.15;
    text-decoration: none;
    box-shadow: 0 3px 12px rgba(13, 5, 20, 0.5);
}

.back-to-genrupto svg {
    width: 16px;
    height: 16px;
    flex: none;
}

.back-to-genrupto.hidden {
    display: none;
}

@media (max-width: 500px) {
    body.stats-mode #carcasa-wrap {
        width: min(98vw, 96dvh);
        height: min(98vw, 96dvh);
    }

    .back-to-genrupto,
    .pwa-install-btn {
        top: max(8px, env(safe-area-inset-top));
        padding: 7px 8px;
        font-size: 11px;
    }

    .back-to-genrupto {
        max-width: calc(50vw - 16px);
    }

    .pwa-install-btn {
        right: max(8px, env(safe-area-inset-right));
    }

    body.stats-mode #overlay {
        padding: 5px;
        font-size: 12px;
        line-height: 1.3;
    }

    body.stats-mode .overlay-header h3 {
        font-size: 11px;
        letter-spacing: 0;
    }

    body.stats-mode #overlay .stat-row {
        gap: 4px;
        padding: 4px 3px;
    }
}

/* =====================================================
   ANIMATIONS
   ===================================================== */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes slime-wobble {
    0%, 100% { border-radius: 40px 42px 36px 38px; }
    25% { border-radius: 42px 38px 40px 36px; }
    50% { border-radius: 38px 40px 42px 40px; }
    75% { border-radius: 36px 44px 38px 42px; }
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 360px) {
    #carcasa-wrap {
        width: 98vw;
        height: 98vw;
    }
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Sparkle star twinkle animation */
#sparkle-stars path {
    transform-origin: center;
    animation: star-twinkle 4s ease-in-out infinite alternate;
}

#sparkle-stars path:nth-child(2) {
    animation-delay: 1.5s;
}

#sparkle-stars path:nth-child(3) {
    animation-delay: 2.8s;
}

@keyframes star-twinkle {
    0% {
        opacity: 0.75;
        transform: scale(0.92);
    }
    100% {
        opacity: 1;
        transform: scale(1.08);
        filter: drop-shadow(0 0 4px #fbcfe8);
    }
}

.btn-icon-img {
    width: 20px;
    height: 20px;
    image-rendering: auto;
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
    pointer-events: none;
}

/* =====================================================
   OSU!-STYLE SPINNER WHEEL (LAB MINIGAME)
   ===================================================== */
.lab-osu-spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 6px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.osu-spinner-wrapper {
    position: relative;
    width: 130px;
    height: 130px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
    touch-action: none;
}

.osu-spinner-wrapper:active {
    cursor: grabbing;
}

.osu-progress-ring {
    position: absolute;
    width: 130px;
    height: 130px;
    top: 0;
    left: 0;
    transform: rotate(-90deg);
    pointer-events: none;
}

.osu-progress-ring .ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.12);
    stroke-width: 6;
}

.osu-progress-ring .ring-fill {
    fill: none;
    stroke-width: 7;
    stroke-linecap: round;
    stroke-dasharray: 452; /* 2 * PI * 72 */
    stroke-dashoffset: 452;
    transition: stroke-dashoffset 0.05s ease-out;
    filter: drop-shadow(0 0 6px currentColor);
}

.osu-wheel {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    background: radial-gradient(circle, #2a1145 0%, #170727 75%, #0c0217 100%);
    border: 3px solid rgba(255, 255, 255, 0.4);
    box-shadow:
        0 0 16px rgba(0, 0, 0, 0.8),
        inset 0 0 12px rgba(255, 255, 255, 0.2);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.wheel-spoke {
    position: absolute;
    width: 2px;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
}
.wheel-spoke.sp2 { transform: rotate(45deg); }
.wheel-spoke.sp3 { transform: rotate(90deg); }
.wheel-spoke.sp4 { transform: rotate(135deg); }

.wheel-core {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid #ffffff;
    box-shadow: 0 0 10px currentColor;
    position: relative;
    z-index: 2;
}

.core-cube {
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
}

.wheel-needle {
    position: absolute;
    top: 3px;
    width: 4px;
    height: 12px;
    background: #ffffff;
    border-radius: 2px;
    box-shadow: 0 0 6px #ffffff;
}

.osu-center-label {
    position: absolute;
    font-family: 'Fredoka', sans-serif;
    font-weight: 900;
    font-size: 13px;
    color: #ffffff;
    letter-spacing: 1.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8), 0 0 8px #f43f5e;
    pointer-events: none;
    animation: pulse-spin 0.8s ease-in-out infinite alternate;
    top: 12px;
}

@keyframes pulse-spin {
    0% { transform: scale(0.95); opacity: 0.8; }
    100% { transform: scale(1.1); opacity: 1; }
}

.osu-rpm-counter {
    font-family: 'Fredoka', 'Courier New', monospace;
    font-weight: 900;
    font-size: 13px;
    color: #ffd166;
    margin-top: 4px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.osu-percent-bar {
    width: 140px;
    height: 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    overflow: hidden;
    margin: 4px 0 2px 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.osu-bar-fill {
    height: 100%;
    transition: width 0.08s ease-out;
    border-radius: 4px;
}

/* Disabled state for bottom navigation buttons during combat */
.carcasa-btn.in-combat-disabled,
.vpet-btn.in-combat-disabled {
    filter: grayscale(0.9) brightness(0.65) !important;
    opacity: 0.35 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    box-shadow: none !important;
    transform: none !important;
}

/* Combat Serum Selector Overlay */
.combat-serum-card {
    background: rgba(22, 10, 36, 0.92);
    border: 1px solid rgba(168, 85, 247, 0.35);
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 6px;
    transition: transform 0.15s, border-color 0.15s;
}

.combat-serum-card.disabled {
    opacity: 0.45;
    filter: grayscale(0.5);
    background: rgba(14, 7, 22, 0.85);
}

.combat-serum-card:not(.disabled):hover {
    border-color: #ffd700;
    transform: translateY(-1px);
}

.combat-serum-img {
    width: 22px;
    height: 22px;
    image-rendering: pixelated;
    vertical-align: middle;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.combat-inject-btn {
    background: linear-gradient(180deg, #ec4899 0%, #db2777 50%, #9d174d 100%);
    color: #ffffff;
    border: 1px solid #f472b6;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 8.5px;
    font-weight: 900;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.4);
    transition: transform 0.1s;
}

.combat-inject-btn:active {
    transform: scale(0.95);
}

/* Cube Icons for UI */
.item-cube-icon {
    width: 18px;
    height: 18px;
    image-rendering: pixelated;
    margin-right: 6px;
    vertical-align: middle;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
}

.mini-cube {
    width: 14px;
    height: 14px;
    image-rendering: pixelated;
    vertical-align: middle;
    margin-right: 2px;
}


/* =====================================================
   SUDO PANEL — Global Settings Sliders & Controls
   ===================================================== */

/* Sección title dentro del SUDO panel */
.sudo-section-title {
    font-size: 8px;
    font-weight: 900;
    color: #a78bfa;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 3px 0 2px 2px;
    border-bottom: 1px solid rgba(167, 139, 250, 0.25);
    margin-bottom: 3px;
}

/* Contenedor de sliders */
.sudo-sliders-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 1px 0;
}

/* Fila individual de slider */
.sudo-slider-row {
    display: grid;
    grid-template-columns: 68px 1fr 34px 44px;
    align-items: center;
    gap: 4px;
    padding: 2px 0;
}

.sudo-slider-label {
    font-size: 7.5px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sudo-slider-track {
    height: 6px;
    background: rgba(30, 20, 50, 0.8);
    border-radius: 3px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    overflow: hidden;
    position: relative;
}

.sudo-slider-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.15s ease;
    min-width: 2px;
}

.sudo-slider-val {
    font-size: 7.5px;
    font-weight: 900;
    text-align: right;
    white-space: nowrap;
}

.sudo-slider-btns {
    display: flex;
    gap: 2px;
}

/* Botones − / + del slider */
.sudo-adj-btn {
    flex: 1;
    height: 18px;
    min-width: 18px;
    border-radius: 4px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(30, 20, 50, 0.9);
    color: #e2e8f0;
    font-size: 10px;
    font-weight: 900;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.1s, transform 0.1s;
    line-height: 1;
    touch-action: manipulation;
}

.sudo-adj-btn:hover {
    background: rgba(100, 70, 160, 0.6);
    border-color: rgba(167, 139, 250, 0.7);
}

.sudo-adj-btn:active {
    transform: scale(0.88);
    background: rgba(139, 92, 246, 0.5);
}

/* Botones de acción rápida del sudo */
.sudo-action-btn {
    color: #fff;
    padding: 5px;
    font-size: 8.5px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: filter 0.1s, transform 0.1s;
}

.sudo-action-btn:hover {
    filter: brightness(1.15);
}

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

/* Preset buttons */
.sudo-preset-btn {
    color: #fff;
    padding: 5px 3px;
    font-size: 8px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 900;
    font-family: inherit;
    text-align: center;
    transition: filter 0.12s, transform 0.12s;
    touch-action: manipulation;
}

.sudo-preset-btn:hover {
    filter: brightness(1.2);
}

.sudo-preset-btn:active {
    transform: scale(0.95);
}

.sudo-preset-active {
    box-shadow: 0 0 8px currentColor, inset 0 1px 2px rgba(255,255,255,0.3);
    filter: brightness(1.1);
}
