* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent !important;
}

*:focus {
    outline: none;
}

*:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
}

html, body {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
}

body {
    background-color: #080a0f;
    background-image: radial-gradient(ellipse at 50% 35%, #141a26 0%, #080a0f 85%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #f8fafc;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation;
    padding: 10px;
    padding-bottom: env(safe-area-inset-bottom, 12px);
}

.game-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    max-width: min(95vw, calc((92vh - 65px) * (640 / 384)));
    margin: 0 auto;
}

.canvas-container {
    position: relative;
    width: 100%;
    aspect-ratio: 640 / 384;
    border-radius: 6px;
    overflow: hidden;
    border: 3px solid #2a3547;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.9), 0 0 24px rgba(56, 189, 248, 0.12);
    background-color: #090c12;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    background-color: #090c12;
    cursor: pointer;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none !important;
    -webkit-tap-highlight-color: transparent !important;
    outline: none;
}

button, input, select, a {
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
    outline: none;
}

/* --- MOBILE GAMEPAD & TOUCH CONTROLS (RETRO ARCADE DUAL-MODE DECK) --- */
.mobile-controls,
.mobile-controls * {
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* 1. RETRO ARCADE CROSS D-PAD (MINIMALIST TRANSLUCENT) */
.dpad-container {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dpad-cross {
    display: grid;
    grid-template-columns: 50px 50px 50px;
    grid-template-rows: 50px 50px 50px;
    gap: 4px;
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
}

.dpad-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.22);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f8fafc;
    font-family: 'Press Start 2P', monospace;
    font-size: 17px;
    box-shadow: none;
    cursor: pointer;
    touch-action: none;
    transition: background 0.05s, transform 0.05s, border-color 0.05s;
    outline: none;
    user-select: none;
}

.dpad-btn:active, .dpad-btn.active {
    background: rgba(59, 130, 246, 0.45);
    border-color: rgba(147, 197, 253, 0.95);
    color: #ffffff;
    transform: scale(0.92);
}

.dpad-arrow {
    font-size: 17px;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

.dpad-up {
    grid-column: 2;
    grid-row: 1;
}

.dpad-left {
    grid-column: 1;
    grid-row: 2;
}

.dpad-center {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: 9px;
    box-shadow: none;
    pointer-events: none;
}

.dpad-center-gem {
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    pointer-events: none;
}

.dpad-right {
    grid-column: 3;
    grid-row: 2;
}

.dpad-down {
    grid-column: 2;
    grid-row: 3;
}

/* 2. UTILITY VERTICAL COLUMN (PAUSE, FULLSCREEN, RESTART, SHOP, TROPHY, SFX) */
.mobile-center-bar {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    background: rgba(13, 18, 28, 0.85);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: 9px;
    padding: 3px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    width: fit-content;
}

.mobile-util-btn {
    background: rgba(22, 30, 46, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 6px;
    padding: 2px 4px;
    min-height: 25px;
    min-width: 40px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5px;
    cursor: pointer;
    color: #f8fafc;
    font-family: 'Press Start 2P', monospace;
    touch-action: none;
    outline: none;
    transition: transform 0.05s, background 0.05s, border-color 0.05s, box-shadow 0.05s;
    backdrop-filter: blur(4px);
}

.mobile-util-btn:hover {
    background: rgba(30, 42, 64, 0.95);
    border-color: rgba(56, 189, 248, 0.5);
}

.mobile-util-btn:active, .mobile-util-btn.active {
    transform: scale(0.92);
    background: rgba(30, 41, 59, 0.95);
    border-color: #38bdf8;
    color: #38bdf8;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

.util-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    line-height: 1;
}

.pixel-art-icon {
    width: 16px;
    height: 16px;
    display: block;
    image-rendering: pixelated;
    shape-rendering: crispEdges;
}

.util-label {
    font-size: 5px;
    color: #cbd5e1;
    font-weight: bold;
    letter-spacing: 0.2px;
    line-height: 1;
    pointer-events: none;
}

/* 3. ERGONOMIC RADIAL THUMB ARC (SKILLS & ATTACK CLUSTER) - ZERO OVERLAP */
.action-cluster {
    position: relative;
    width: 160px;
    height: 160px;
    pointer-events: auto;
    flex-shrink: 0;
}

.skill-buttons-row {
    display: contents;
}

.mobile-skill-btn {
    position: absolute;
    width: 48px;
    height: 48px;
    background: rgba(18, 24, 36, 0.75);
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5px;
    color: #f8fafc;
    font-family: 'Press Start 2P', monospace;
    cursor: pointer;
    touch-action: none;
    overflow: hidden;
    outline: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.05s, border-color 0.05s, background 0.05s;
    backdrop-filter: blur(4px);
}

/* Ergonomic Thumb Arc Positions around Attack Button - Strict Zero Overlap Guarantee */
#btnSkill1 {
    bottom: 100px;
    right: 4px;
}

#btnSkill0 {
    bottom: 90px;
    right: 74px;
}

#btnSkill2 {
    bottom: 4px;
    right: 100px;
}

.mobile-skill-btn:active, .mobile-skill-btn.active {
    transform: scale(0.92);
    background: rgba(30, 41, 59, 0.95);
    border-color: #f8fafc;
}

.skill-key {
    font-size: 7px;
    color: #94a3b8;
}

.skill-name {
    font-size: 7px;
    color: #38bdf8;
    text-align: center;
    font-weight: bold;
}

.skill-cooldown-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 14, 22, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    color: #f59e0b;
    font-size: 8.5px;
    font-family: 'Press Start 2P', monospace;
}

.mobile-skill-btn.on-cooldown .skill-cooldown-overlay,
.mobile-skill-btn.skill-locked .skill-cooldown-overlay {
    display: flex;
}

.mobile-skill-btn.skill-locked {
    opacity: 0.55;
    border-color: #334155;
}

.mobile-skill-btn.skill-locked .skill-name {
    color: #64748b;
}

/* 4. PRIMARY ROLE-ADAPTIVE ATTACK BUTTON */
.mobile-attack-btn {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 88px;
    height: 88px;
    border-radius: 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    touch-action: none;
    outline: none;
    transition: transform 0.05s, box-shadow 0.05s, border-color 0.05s;
    user-select: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
}

.attack-icon-wrapper {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.atk-svg {
    width: 40px;
    height: 40px;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
}

.attack-text {
    font-size: 9px;
    letter-spacing: 0.5px;
    pointer-events: none;
    font-weight: bold;
}

/* Role: Knight Attack Button */
.mobile-attack-btn.role-knight {
    border: 2px solid #60a5fa;
    background: linear-gradient(180deg, rgba(29, 78, 216, 0.85) 0%, rgba(15, 23, 42, 0.9) 100%);
    color: #ffffff;
}
.mobile-attack-btn.role-knight:active, .mobile-attack-btn.role-knight.active {
    background: #2563eb;
    border-color: #ffffff;
    transform: scale(0.92);
}

/* Role: Mage Attack Button */
.mobile-attack-btn.role-mage {
    border: 2px solid #c084fc;
    background: linear-gradient(180deg, rgba(126, 34, 206, 0.85) 0%, rgba(15, 23, 42, 0.9) 100%);
    color: #ffffff;
}
.mobile-attack-btn.role-mage:active, .mobile-attack-btn.role-mage.active {
    background: #9333ea;
    border-color: #ffffff;
    transform: scale(0.92);
}

/* Role: Assassin Attack Button */
.mobile-attack-btn.role-assassin {
    border: 2px solid #34d399;
    background: linear-gradient(180deg, rgba(4, 120, 87, 0.85) 0%, rgba(15, 23, 42, 0.9) 100%);
    color: #ffffff;
}
.mobile-attack-btn.role-assassin:active, .mobile-attack-btn.role-assassin.active {
    background: #059669;
    border-color: #ffffff;
    transform: scale(0.92);
}

/* Contextual Attack Button Modes */
.mobile-attack-btn[data-context="start"] {
    background: linear-gradient(180deg, #16a34a 0%, #0f172a 100%) !important;
    border-color: #4ade80 !important;
    color: #ffffff !important;
}
.mobile-attack-btn[data-context="spin"] {
    background: linear-gradient(180deg, #d97706 0%, #0f172a 100%) !important;
    border-color: #facc15 !important;
    color: #ffffff !important;
}
.mobile-attack-btn[data-context="dialogue"] {
    background: linear-gradient(180deg, #0284c7 0%, #0f172a 100%) !important;
    border-color: #38bdf8 !important;
    color: #ffffff !important;
}
.mobile-attack-btn[data-context="retry"] {
    background: linear-gradient(180deg, #dc2626 0%, #0f172a 100%) !important;
    border-color: #f87171 !important;
    color: #ffffff !important;
}
.mobile-attack-btn[data-context="again"] {
    background: linear-gradient(180deg, #d97706 0%, #0f172a 100%) !important;
    border-color: #facc15 !important;
    color: #ffffff !important;
}
.mobile-attack-btn[data-context="play"] {
    background: linear-gradient(180deg, #15803d 0%, #0f172a 100%) !important;
    border-color: #22c55e !important;
    color: #ffffff !important;
}
.mobile-attack-btn[data-context="back"] {
    background: linear-gradient(180deg, #374151 0%, #0f172a 100%) !important;
    border-color: #9ca3af !important;
    color: #ffffff !important;
}

/* ==========================================================================
   STATE-BASED CLEANLINESS: HIDE IRRELEVANT BUTTONS DURING MODALS & DIALOGUES
   ========================================================================== */

/* State: SHOP Modal - Hide controller row completely, keep only top utility bar with BACK button */
.mobile-controls.state-shop .mobile-controller-row {
    display: none !important;
}

/* State: PAUSED Modal - Hide controller row completely */
.mobile-controls.state-paused .mobile-controller-row {
    display: none !important;
}

/* State: MENU (Character Select) - Hide D-pad, skills, and top bar; keep only clean centered START button */
.mobile-controls.state-menu .dpad-container,
.mobile-controls.state-menu .skill-buttons-row,
.mobile-controls.state-menu .mobile-deck-center,
.mobile-controls.state-menu .mobile-center-bar {
    display: none !important;
}
.mobile-controls.state-menu .mobile-controller-row {
    justify-content: center !important;
    align-items: center !important;
    min-height: 52px !important;
    padding: 6px 0 !important;
}
.mobile-controls.state-menu .action-cluster {
    width: auto !important;
    height: auto !important;
    display: flex !important;
    justify-content: center !important;
}
.mobile-controls.state-menu .mobile-attack-btn {
    position: static !important;
    width: min(220px, 75vw) !important;
    height: 44px !important;
    border-radius: 12px !important;
    flex-direction: row !important;
    gap: 8px !important;
    padding: 0 16px !important;
}
.mobile-controls.state-menu .attack-icon-wrapper {
    display: none !important;
}
.mobile-controls.state-menu .attack-text {
    font-size: 9px !important;
}

/* State: BOSS_DIALOGUE - Hide D-pad & skills to keep face portrait & text clean; floating NEXT button */
.mobile-controls.state-dialogue .dpad-container,
.mobile-controls.state-dialogue .skill-buttons-row,
.mobile-controls.state-dialogue .mobile-deck-center {
    display: none !important;
}
.mobile-controls.state-dialogue .mobile-attack-btn {
    width: auto !important;
    min-width: 96px !important;
    height: 40px !important;
    padding: 0 16px !important;
    border-radius: 20px !important;
    flex-direction: row !important;
    gap: 6px !important;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4) !important;
}
.mobile-controls.state-dialogue .attack-icon-wrapper {
    display: none !important;
}
.mobile-controls.state-dialogue .attack-text {
    font-size: 8px !important;
}

/* State: GAMEOVER & VICTORY - Hide D-pad & skills; floating RETRY / AGAIN button */
.mobile-controls.state-gameover .dpad-container,
.mobile-controls.state-gameover .skill-buttons-row,
.mobile-controls.state-gameover .mobile-deck-center,
.mobile-controls.state-victory .dpad-container,
.mobile-controls.state-victory .skill-buttons-row,
.mobile-controls.state-victory .mobile-deck-center {
    display: none !important;
}
.mobile-controls.state-gameover .mobile-attack-btn,
.mobile-controls.state-victory .mobile-attack-btn {
    width: auto !important;
    min-width: 104px !important;
    height: 42px !important;
    padding: 0 16px !important;
    border-radius: 21px !important;
    flex-direction: row !important;
    gap: 6px !important;
}
.mobile-controls.state-gameover .attack-icon-wrapper,
.mobile-controls.state-victory .attack-icon-wrapper {
    display: none !important;
}
.mobile-controls.state-gameover .attack-text,
.mobile-controls.state-victory .attack-text {
    font-size: 8px !important;
}

/* 5. DESKTOP CONTROLS HINT */
.controls-hint {
    margin-top: 10px;
    width: 100%;
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    background: #111622;
    border: 1px solid #253043;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    color: #94a3b8;
}

.controls-hint kbd {
    background: #20293a;
    color: #f1f5f9;
    padding: 3px 6px;
    border-radius: 3px;
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    box-shadow: 0 2px 0 #0f131a;
    border: 1px solid #37455d;
}

.key-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mobile-test-toggle {
    background: #1e293b;
    border: 1px solid #38bdf8;
    color: #38bdf8;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 4px;
}

.mobile-test-toggle:hover {
    background: #38bdf8;
    color: #0b0f19;
}

.mobile-test-toggle.active {
    background: #0284c7;
    color: #ffffff;
    border-color: #7dd3fc;
}

/* Desktop with mouse: hide mobile controls unless forced */
@media (min-width: 961px) and (pointer: fine) {
    .mobile-controls:not(.force-show) {
        display: none !important;
    }
}

.mobile-controls.force-show {
    display: flex !important;
    position: relative;
    width: 100%;
    margin-top: 12px;
    padding: 10px 16px;
    background: linear-gradient(180deg, #0d121c 0%, #080a0f 100%);
    border: 1.5px solid #1e2638;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
}

.mobile-controls.force-show .mobile-controller-row {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 560px;
    position: relative;
}

.mobile-controls.force-show .mobile-center-bar {
    position: static;
    transform: none;
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 0 12px;
}

.game-footer {
    margin-top: 8px;
    text-align: center;
    font-size: 11px;
    color: #64748b;
    font-family: 'Outfit', sans-serif;
    line-height: 1.4;
}

.game-footer a {
    color: #38bdf8;
    text-decoration: none;
    font-weight: 600;
}

.game-footer a:hover {
    text-decoration: underline;
}

/* Mobile & touch viewports: hide keyboard hints and desktop footer */
@media (max-width: 960px), (pointer: coarse) {
    .controls-hint,
    .game-footer {
        display: none !important;
    }
}

/* ==========================================================================
   DUAL-MODE MOBILE ADAPTATION
   1) PORTRAIT MODE: RETRO HANDHELD CONSOLE DECK (CANVAS TOP, GAMEPAD BOTTOM)
   2) LANDSCAPE MODE: FLOATING ARCADE OVERLAY (CANVAS FULL, PILLARBOX CONTROLS)
   ========================================================================== */

/* --- 1. PORTRAIT MODE (HANDHELD CONSOLE DECK) --- */
@media (orientation: portrait) and (max-width: 960px), (max-width: 600px) and (orientation: portrait) {
    body {
        margin: 0;
        padding: 0;
        min-height: 100vh;
        min-height: 100dvh;
        background: #080a0f;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        overflow-x: hidden;
    }

    .game-wrapper {
        position: relative;
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 500px;
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        margin: 0 auto;
        justify-content: flex-start;
        align-items: stretch;
        overflow: hidden;
    }

    .canvas-container {
        width: 100%;
        max-width: 100vw;
        aspect-ratio: 640 / 384;
        border-radius: 0;
        border: none;
        border-bottom: 2px solid #243044;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
        flex-shrink: 0;
        background-color: #090c12;
    }

    #gameCanvas {
        width: 100%;
        height: 100%;
        display: block;
        object-fit: contain;
    }

    .mobile-controls {
        position: relative;
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        padding: 4px 8px calc(env(safe-area-inset-bottom, 12px) + 4px) 8px;
        background: linear-gradient(180deg, #0d121c 0%, #080a0f 100%);
        border-top: 1.5px solid #1e2638;
        pointer-events: auto;
        z-index: 100;
        box-sizing: border-box;
    }

    .mobile-center-bar {
        position: absolute;
        left: 50%;
        bottom: calc(env(safe-area-inset-bottom, 12px) + 4px);
        transform: translateX(-50%);
        z-index: 105;
        display: flex;
        flex-direction: column;
        gap: 2.5px;
        padding: 3px;
        background: rgba(13, 18, 28, 0.88);
        border: 1.5px solid rgba(255, 255, 255, 0.14);
        border-radius: 9px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
        width: fit-content;
    }

    .mobile-center-bar .mobile-util-btn {
        min-height: 27px;
        min-width: 42px;
        padding: 2px 4px;
    }

    .mobile-controller-row {
        width: 100%;
        flex: 1;
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        position: relative;
        min-height: 200px;
        padding: 2px 2px;
    }

    .mobile-deck-center {
        position: absolute;
        top: 2px;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        pointer-events: none;
        opacity: 0.65;
        padding: 0 4px;
        z-index: 1;
    }

    @media (max-width: 420px) {
        .mobile-deck-center {
            display: none !important;
        }
    }

    .deck-brand-title {
        font-family: 'Press Start 2P', monospace;
        font-size: 7px;
        color: #f59e0b;
        letter-spacing: 0.5px;
    }

    .deck-brand-sub {
        font-family: 'Press Start 2P', monospace;
        font-size: 6px;
        color: #64748b;
    }

    .dpad-container, .action-cluster {
        pointer-events: auto;
    }
}

/* --- 2. LANDSCAPE MODE (FLOATING GLASS ARCADE CONTROLS) --- */
@media (orientation: landscape) and (max-height: 640px), (orientation: landscape) and (pointer: coarse) {
    body {
        margin: 0;
        padding: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
        justify-content: center;
        align-items: center;
        background: #080a0f;
        touch-action: none;
    }

    .game-wrapper {
        position: relative;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-width: 100vw;
        overflow: hidden;
    }

    .canvas-container {
        height: 100vh;
        height: 100dvh;
        width: auto;
        aspect-ratio: 640 / 384;
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background-color: #080a0f;
    }

    #gameCanvas {
        height: 100vh;
        height: 100dvh;
        width: auto;
        max-width: 100vw;
        aspect-ratio: 640 / 384;
        object-fit: contain;
    }

    .mobile-controls {
        position: fixed;
        inset: 0;
        pointer-events: none;
        margin-top: 0;
        display: block;
        z-index: 100;
    }

    /* Floating Capsule at top right */
    .mobile-center-bar {
        position: absolute;
        top: calc(env(safe-area-inset-top, 6px) + 6px);
        right: calc(env(safe-area-inset-right, 10px) + 8px);
        left: auto;
        bottom: auto;
        transform: none;
        pointer-events: auto;
        display: flex;
        flex-direction: column;
        gap: 3px;
        z-index: 102;
        background: rgba(10, 15, 25, 0.8);
        border: 1px solid rgba(255, 255, 255, 0.16);
        border-radius: 9px;
        padding: 3px;
        backdrop-filter: blur(8px);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
        width: fit-content;
    }

    .mobile-center-bar .mobile-util-btn {
        background: rgba(22, 30, 46, 0.85);
        border: 1px solid rgba(255, 255, 255, 0.12);
        min-height: 27px;
        min-width: 42px;
        padding: 2px 4px;
        border-radius: 6px;
    }
    .mobile-center-bar .mobile-util-btn:active, .mobile-center-bar .mobile-util-btn.active {
        background: rgba(56, 189, 248, 0.3);
        border-color: #38bdf8;
    }

    .mobile-controller-row {
        position: static;
        width: 100%;
        height: 100%;
        pointer-events: none;
    }

    .mobile-deck-center {
        display: none !important;
    }

    /* Floating Glass D-Pad */
    .dpad-container {
        position: absolute;
        bottom: calc(env(safe-area-inset-bottom, 8px) + 8px);
        left: calc(env(safe-area-inset-left, 10px) + 8px);
        pointer-events: auto;
        z-index: 101;
    }

    .dpad-cross {
        grid-template-columns: 46px 46px 46px;
        grid-template-rows: 46px 46px 46px;
        gap: 3.5px;
    }

    .dpad-btn {
        background: rgba(255, 255, 255, 0.07);
        border: 1.5px solid rgba(255, 255, 255, 0.18);
        border-radius: 11px;
        backdrop-filter: blur(4px);
    }

    .dpad-arrow {
        font-size: 16px;
    }

    /* Floating Glass Action Cluster */
    .action-cluster {
        position: absolute;
        bottom: calc(env(safe-area-inset-bottom, 8px) + 8px);
        right: calc(env(safe-area-inset-right, 10px) + 8px);
        pointer-events: auto;
        width: 154px;
        height: 154px;
        z-index: 101;
    }

    .action-cluster .mobile-attack-btn {
        width: 82px;
        height: 82px;
        border-radius: 20px;
        bottom: 4px;
        right: 4px;
        backdrop-filter: blur(6px);
    }
    .action-cluster .mobile-attack-btn .attack-icon-wrapper {
        width: 40px;
        height: 40px;
    }
    .action-cluster .mobile-attack-btn .atk-svg {
        width: 36px;
        height: 36px;
    }
    .action-cluster .mobile-attack-btn .attack-text {
        font-size: 8.5px;
    }

    .action-cluster .mobile-skill-btn {
        width: 44px;
        height: 44px;
        border-radius: 11px;
        backdrop-filter: blur(4px);
    }
    .action-cluster #btnSkill1 {
        bottom: 94px;
        right: 4px;
    }
    .action-cluster #btnSkill0 {
        bottom: 84px;
        right: 70px;
    }
    .action-cluster #btnSkill2 {
        bottom: 4px;
        right: 94px;
    }
    .action-cluster .mobile-skill-btn .skill-key {
        font-size: 6.5px;
    }
    .action-cluster .mobile-skill-btn .skill-name {
        font-size: 6.5px;
    }
}

