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

:root {
    /* Theme: Clean Dark Modern (Not Cyberpunk) */
    --bg-core: #0f1014;
    --bg-surface: #1a1b20;
    --bg-element: #25262b;

    --primary: #4dadf7;
    /* Soft Blue */
    --accent: #ffd43b;
    /* Soft Yellow */
    --danger: #ff6b6b;
    /* Soft Red */

    --text-primary: #ffffff;
    --text-secondary: #909296;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 24px;
    --radius-full: 999px;

    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);

    --font-head: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-core);
    height: 100vh;
    font-family: var(--font-body);
    user-select: none;
    color: var(--text-primary);
    overflow: hidden;
}

canvas {
    display: block;
}

/* --- UI LAYER --- */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* Stats HUD */
#hud {
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    box-sizing: border-box;
}

/* Top Sections */
.hud-top-left,
.hud-top-right,
.hud-top-center {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hud-top-center {
    position: absolute;
    width: 100%;
    top: 30px;
    left: 0;
    align-items: center;
    pointer-events: none;
}

/* Stats Typography */
.stat-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-label {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 2rem;
    color: var(--text-primary);
}

/* XP Bar: Clean & Flat */
.xp-bar-container {
    width: 280px;
    height: 8px;
    background: var(--bg-surface);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.xp-bar-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    border-radius: var(--radius-full);
    transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Dash Indicator */
.dash-status {
    font-size: 0.75rem;
    /* Smaller font */
    font-weight: 600;
    padding: 4px 8px;
    /* Reduced padding */
    background: var(--bg-surface);
    border-radius: var(--radius-full);
    display: inline-block;
    color: var(--text-secondary);
    transition: all 0.2s;
    margin-top: 4px;
    /* Slight spacing adjustment */
    align-self: flex-start;
    /* Prevent stretching */
}

.dash-status.ready {
    background: var(--primary);
    color: #101113;
    /* Dark text on bright bg */
}

/* Boss Warning: Alarming & Central */
#hud-phase {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.2rem;
    color: #00ff88;
    text-shadow: 0 2px 8px rgba(0, 255, 136, 0.5);
    margin-bottom: 8px;
    letter-spacing: 2px;
}

#hud-zoom {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    color: #909296;
    margin-bottom: 4px;
    opacity: 0.7;
}

#hud-boss-timer {
    position: fixed;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 0, 0, 0.1);
    border: 2px solid var(--danger);
    color: var(--danger);
    padding: 15px 40px;
    border-radius: var(--radius-sm);
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 1.5rem;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.4);
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: alarmPulse 0.5s infinite alternate;
    z-index: 50;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

@keyframes alarmPulse {
    0% {
        transform: translateX(-50%) scale(1);
        opacity: 0.8;
        box-shadow: 0 0 10px rgba(255, 0, 0, 0.2);
    }

    100% {
        transform: translateX(-50%) scale(1.1);
        opacity: 1;
        box-shadow: 0 0 30px rgba(255, 0, 0, 0.6);
    }
}

/* Minimap: Clean Box */
#minimap-container {
    position: absolute;
    bottom: 30px;
    right: 30px;
    width: 140px;
    height: 140px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 4px solid var(--bg-surface);
    /* Inner padded border look */
    pointer-events: auto;
    box-shadow: var(--shadow-sm);
}

/* Combo: Clean Pop-in */
.combo-container {
    position: absolute;
    bottom: 200px;
    right: 60px;
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 3.5rem;
    color: var(--accent);
    transform: rotate(-6deg);
    text-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
}

.combo-active {
    animation: comboPulse 0.1s ease-out;
}

@keyframes comboPulse {
    0% {
        transform: rotate(-6deg) scale(1);
    }

    50% {
        transform: rotate(-6deg) scale(1.3);
    }

    100% {
        transform: rotate(-6deg) scale(1);
    }
}

/* --- MENUS & OVERLAYS --- */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(15, 16, 20, 0.85);
    /* Matte blur */
    backdrop-filter: blur(12px);
    z-index: 100;
    pointer-events: auto;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Global Hidden Utility (Fixes Boss Timer Animation override) */
.hidden {
    display: none !important;
}

.content-box {
    background: var(--bg-surface);
    padding: 40px 60px;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-md);
    min-width: 420px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.content-box.wide-box {
    min-width: 800px;
    background: var(--bg-core);
    /* Slightly darker for large modal */
}

/* Typography */
h1 {
    font-family: var(--font-head);
    font-size: 3.5rem;
    margin: 0;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -2px;
    /* Tight modern heading */
}

.danger-title {
    color: var(--danger);
}

.upgrade-title {
    font-size: 2.5rem;
}

h1[data-text]::before,
h1[data-text]::after {
    display: none;
}

/* Remove Glitch */

.subtitle {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 12px 0 20px 0;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Language Selector */
.language-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
}

.lang-btn {
    background: var(--bg-element);
    border: 2px solid var(--text-secondary);
    color: var(--text-secondary);
    padding: 8px 20px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.lang-btn:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.lang-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--bg-core);
}

/* Controls Info */
.controls-info {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 40px;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.key {
    background: var(--bg-element);
    padding: 6px 10px;
    border-radius: 6px;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.8rem;
    min-width: 20px;
    text-align: center;
}

/* Primary Button */
.cyber-btn {
    background: var(--text-primary);
    color: var(--bg-core);
    border: none;
    padding: 16px 48px;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-head);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cyber-btn::before {
    display: none;
}

/* Remove slide effect */

.cyber-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

.danger-btn {
    background: var(--danger);
    color: white;
}

.danger-btn:hover {
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 20px;
}

.upgrade-card {
    background: var(--bg-surface);
    padding: 30px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Hover Effect: Simple lift & colorful border */
.upgrade-card:hover {
    transform: translateY(-8px);
    border-color: var(--card-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.card-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    border-radius: var(--radius-md);
    background: rgba(var(--card-color-rgb, 255, 255, 255), 0.1);
    color: var(--card-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.module-icon {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    stroke-width: 2;
    filter: drop-shadow(0 0 5px currentColor);
}

.upgrade-card h3 {
    margin: 0 0 8px 0;
    font-family: var(--font-head);
    font-size: 1.25rem;
    color: var(--text-primary);
}

.upgrade-card p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

@keyframes bounceIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Final Stats (Game Over) */
/* Final Stats (Game Over) */
.final-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 40px 0;
    width: 100%;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 30px;
    background: var(--bg-element);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-width: 120px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
}

.stat-box:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.1);
}

.stat-box .label {
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.stat-box .value {
    font-family: var(--font-head);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Specific styling for High Score context if needed */
.stat-box:nth-child(3) {
    background: linear-gradient(135deg, var(--bg-element), rgba(255, 212, 59, 0.05));
    border-color: rgba(255, 212, 59, 0.2);
}

.stat-box:nth-child(3) .value {
    color: var(--accent);
    text-shadow: 0 0 15px rgba(255, 212, 59, 0.2);
}

/* --- CODEX / DATABASE --- */
.menu-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.secondary-btn {
    background: transparent;
    border: 2px solid var(--text-secondary);
    color: var(--text-secondary);
}

.secondary-btn:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    box-shadow: none;
    background: rgba(255, 255, 255, 0.05);
}

.codex-tabs {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 30px;
    background: var(--bg-element);
    border-radius: var(--radius-full);
    padding: 4px;
    display: inline-flex;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 10px 30px;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-family: var(--font-head);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--primary);
    color: var(--bg-core);
}

.codex-content {
    display: none;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 10px;
}

.codex-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.codex-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    text-align: left;
}

.codex-card {
    background: var(--bg-element);
    padding: 15px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.codex-card h3 {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin: 8px 0 4px 0;
}

.codex-card p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.3;
}

.icon-box {
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.codex-card:hover .icon-box {
    color: var(--primary);
    background: rgba(var(--primary-rgb, 77, 173, 247), 0.1);
}

/* CSS Shapes matching Game Entities */
.shape {
    width: 30px;
    height: 30px;
}

.tank-shape {
    background: #aa00ff;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

.speeder-shape {
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-bottom: 30px solid #ffff00;
}

.boss-shape {
    background: #ff0055;
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
}

.shooter-shape {
    background: #ff8800;
    border-radius: 50%;
    border: 4px solid #1a1b20;
    box-sizing: border-box;
}

.kamikaze-shape {
    background: #ff0000;
    border-radius: 50%;
    animation: pulse 1s infinite alternate;
}

.buffer-shape {
    background: #00ff00;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    position: relative;
    display: flex;
    /* Para centralizar o núcleo se usássemos pseudo-elementos, mas aqui é simples */
}

.buffer-shape::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
}

/* Skills Bar (Dynamic) */
.skills-bar {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    z-index: 100;
}

.skill-slot {
    position: relative;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

.skill-slot.active {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(var(--primary-rgb, 77, 173, 247), 0.3);
}

.skill-slot .skill-key {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--bg-core);
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
    font-size: 0.6rem;
    padding: 1px 4px;
    border-radius: 3px;
    font-family: var(--font-head);
    font-weight: bold;
    z-index: 10;
    pointer-events: none;
}

.skill-slot .skill-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.skill-slot .skill-name {
    display: none;
    /* Keep it minimalist */
}

/* Cooldown Sweep Overlay */
.skill-cooldown-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 8;
    transition: height 0.1s linear;
}

.skill-slot.on-cooldown .skill-icon {
    opacity: 0.4;
    filter: grayscale(1);
}

.skill-slot .charge-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 12;
}

.skill-slot .charge-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.2s ease-out;
}

@keyframes skill-unlock {
    0% {
        transform: scale(0.5) translateY(20px);
        opacity: 0;
    }

    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.skill-slot {
    animation: skill-unlock 0.4s ease-out forwards;
}

.skill-slot.ready {
    border-color: var(--primary);
}

.skill-slot.ready:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid var(--primary);
    border-radius: var(--radius-md);
    animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
    opacity: 0;
    pointer-events: none;
}

@keyframes ping {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    75%,
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Icon Shapes for HUD */
.hud-icon {
    width: 20px;
    height: 20px;
    background: currentColor;
}

.hud-icon.circle {
    border-radius: 50%;
}

.hud-icon.square {
    border-radius: 4px;
}

.hud-icon.triangle {
    background: none;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 18px solid currentColor;
}

.hud-icon.hexagon {
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

/* ========================================
   MOBILE CONTROLS
   ======================================== */

/* Hide mobile controls on desktop */
.mobile-only {
    display: none;
}

/* Show mobile controls on touch devices */
@media (pointer: coarse),
(max-width: 768px) {
    .mobile-only {
        display: block;
    }

    /* Hide keyboard controls info on mobile */
    .controls-info {
        display: none;
    }

    /* Adjust HUD for mobile */
    #hud {
        padding: 10px;
        grid-template-columns: 1fr;
    }

    .hud-top-left,
    .hud-top-right {
        position: static;
        display: flex;
        justify-content: space-between;
        width: 100%;
        margin-bottom: 5px;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .xp-bar-container {
        width: auto;
        flex-grow: 1;
        margin: 0 10px;
    }

    #minimap-container {
        width: 80px;
        height: 80px;
        top: auto;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .combo-container {
        font-size: 2rem;
        bottom: 180px;
        right: 15px;
    }

    /* Move Score to top-right on mobile to avoid joystick overlap */
    .hud-top-right {
        position: absolute;
        top: 40px;
        right: 10px;
        text-align: right;
    }

    /* Hide keyboard cues on mobile HUD and controls */
    .skill-key,
    .key,
    .skills-bar .skill-slot::after {
        display: none !important;
    }

    /* Skills bar adjustments for mobile */
    .skills-bar {
        bottom: 20px !important;
        left: 15px !important;
        transform: none !important;
        flex-direction: column;
        gap: 5px !important;
        pointer-events: none;
    }

    .skill-slot {
        width: 36px !important;
        height: 36px !important;
        border-width: 1px !important;
    }

    /* Content boxes responsive */
    .content-box {
        padding: 20px 30px;
        min-width: 90vw !important;
        max-width: 95vw;
    }

    .content-box.wide-box {
        min-width: 95vw !important;
        max-height: 90vh;
        overflow-y: auto;
    }

    h1 {
        font-size: 2rem;
    }

    .upgrade-title {
        font-size: 1.5rem;
    }

    /* Upgrade cards responsive */
    .cards-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .upgrade-card {
        padding: 15px !important;
    }

    /* Codex responsive */
    .codex-grid {
        grid-template-columns: 1fr !important;
        /* Single column for better readability */
        gap: 15px !important;
    }

    .codex-card {
        padding: 15px !important;
        display: flex;
        align-items: center;
        text-align: left;
        gap: 15px;
    }

    .codex-card .icon-box {
        width: 40px !important;
        height: 40px !important;
        flex-shrink: 0;
    }

    .codex-card h3 {
        font-size: 1rem !important;
        margin: 0 !important;
    }

    .codex-card p {
        font-size: 0.8rem !important;
        margin-top: 5px !important;
    }
}

/* Mobile Controls Container */
#mobile-controls {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

/* Joystick Container (Left Side) */
#joystick-container {
    position: absolute;
    bottom: 30px;
    left: 30px;
    pointer-events: auto;
}

#joystick-base {
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
    backdrop-filter: blur(8px);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.4), inset 0 0 20px rgba(0, 0, 0, 0.2);
}

#joystick-stick {
    width: 55px;
    height: 55px;
    background: radial-gradient(circle, var(--primary) 0%, #3a9de8 100%);
    border-radius: 50%;
    box-shadow: 0 0 25px rgba(77, 173, 247, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.4);
    transition: transform 0.05s ease-out;
    pointer-events: none;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* Action Buttons Container (Right Side) */
#action-buttons {
    position: absolute;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    pointer-events: auto;
}

/* Base Action Button */
.action-btn {
    border: none;
    border-radius: 50%;
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.1s, box-shadow 0.1s;
}

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

/* Dash Button (Ergonomic Large) */
.dash-btn {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, var(--primary) 0%, #3a9de8 100%);
    font-size: 1rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4), 0 0 30px rgba(77, 173, 247, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.dash-btn:active,
.dash-btn.active {
    transform: scale(0.85);
    box-shadow: 0 0 40px rgba(77, 173, 247, 0.9);
}

.dash-btn.on-cooldown {
    filter: grayscale(1);
    opacity: 0.5;
}

/* Skill Buttons Grid (Compact Thumb Arc) */
.skill-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 12px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.skill-btn {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
}

.skill-btn .btn-icon {
    width: 24px;
    height: 24px;
}

.skill-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.2);
}

.skill-btn.locked {
    display: none;
    /* Only show unlocked skills to clean up UI */
}

.skill-btn.ready {
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(255, 212, 59, 0.4);
}

/* Landscape mode adjustments */
@media (orientation: landscape) and (max-height: 500px) {
    #joystick-base {
        width: 90px;
        height: 90px;
    }

    #joystick-stick {
        width: 40px;
        height: 40px;
    }

    .dash-btn {
        width: 60px;
        height: 60px;
        font-size: 0.7rem;
    }

    .skill-btn {
        width: 40px;
        height: 40px;
        font-size: 0.8rem;
    }

    #action-buttons {
        bottom: 15px;
        right: 15px;
        gap: 10px;
    }

    #joystick-container {
        bottom: 15px;
        left: 15px;
    }

    .skills-bar {
        display: none !important;
    }

    /* Skills within action buttons cooldown styles */
    .action-btn {
        position: relative;
        overflow: hidden;
    }

    .action-btn .btn-cooldown-overlay {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 0%;
        background: rgba(0, 0, 0, 0.5);
        pointer-events: none;
        transition: height 0.1s linear;
    }

    .action-btn .btn-charge-bar {
        position: absolute;
        bottom: 5px;
        left: 50%;
        transform: translateX(-50%);
        width: 70%;
        height: 3px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 2px;
        overflow: hidden;
    }

    .action-btn .btn-charge-fill {
        height: 100%;
        background: var(--primary);
        width: 0%;
        transition: width 0.2s ease-out;
    }

    .skill-btn.locked {
        display: none;
    }
}

/* Prevent text selection and context menu on mobile */
@media (pointer: coarse) {
    * {
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
    }

    body {
        touch-action: manipulation;
    }
}