:root {
    --primary-color: #00f3ff;
    --secondary-color: #ff003c;
    --bg-color: #050510;
    --text-color: #ffffff;
    --font-main: 'Orbitron', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100dvh;
    width: 100dvw;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 600px; /* Mobile friendly aspect ratio */
    height: 100%;
    background: radial-gradient(circle at center, #111 0%, #000 100%);
    box-shadow: 0 0 50px rgba(0, 243, 255, 0.1);
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none; /* Prevent default scrolling on mobile */
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 100%);
    z-index: 10;
}

.stat {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--primary-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}



#health-bar {
    width: 100px;
    height: 15px;
    background: rgba(255, 0, 60, 0.2);
    border: 2px solid var(--secondary-color);
    border-radius: 10px;
    overflow: hidden;
}

#health-fill {
    width: 100%;
    height: 100%;
    background: var(--secondary-color);
    box-shadow: 0 0 10px var(--secondary-color);
    transition: width 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 16, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease;
    pointer-events: auto;
    z-index: 20;
    backdrop-filter: blur(10px);
    overflow-y: auto;
    padding: 30px 15px;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

.screen h1 {
    font-size: 3rem;
    color: var(--primary-color);
    text-shadow: 0 0 20px var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
    line-height: 1.2;
}

.screen p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    color: #ccc;
    text-align: center;
    max-width: 80%;
}

.controls-info {
    background: rgba(255,255,255,0.05);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    border: 1px solid rgba(255,255,255,0.1);
}

.controls-info p {
    margin-bottom: 10px;
    font-size: 1rem;
    text-align: left;
}
.controls-info p:last-child {
    margin-bottom: 0;
}

.table-selection {
    margin-bottom: 30px;
    background: rgba(255,255,255,0.05);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(255,255,255,0.1);
    width: 100%;
    max-width: 400px;
}

.table-selection p {
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: #fff;
    text-align: center;
}

#table-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.table-toggle {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 10px;
    width: 45px;
    height: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-family: var(--font-main);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    box-shadow: none;
}

.table-toggle.active {
    background: var(--primary-color);
    color: var(--bg-color);
    box-shadow: 0 0 10px var(--primary-color);
}

.table-toggle:hover {
    transform: scale(1.1);
}

button {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 15px 40px;
    font-size: 1.5rem;
    font-family: var(--font-main);
    font-weight: 700;
    cursor: pointer;
    border-radius: 30px;
    text-transform: uppercase;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.3) inset, 0 0 15px rgba(0, 243, 255, 0.3);
}

button:hover, button:active {
    background: var(--primary-color);
    color: var(--bg-color);
    box-shadow: 0 0 30px var(--primary-color) inset, 0 0 30px var(--primary-color);
    transform: scale(1.05);
}

/* Animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-10px); }
}

.shake {
    animation: shake 0.4s ease-in-out;
}

.damage-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 60, 0.4);
    pointer-events: none;
    z-index: 15;
    opacity: 0;
    transition: opacity 0.1s ease;
}

.damage-flash.active {
    opacity: 1;
}

.bonus-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 255, 100, 0.2);
    pointer-events: none;
    z-index: 15;
    opacity: 0;
    transition: opacity 0.1s ease;
}

.bonus-flash.active {
    opacity: 1;
}

/* Float Animation per il testo */
@keyframes floatUp {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-50px); opacity: 0; }
}

.floating-text {
    position: absolute;
    color: #fff;
    font-weight: 900;
    font-size: 1.5rem;
    pointer-events: none;
    animation: floatUp 1s ease forwards;
    text-shadow: 0 0 10px currentColor;
    z-index: 12;
    transform: translate(-50%, -50%); /* Centering relative to origin */
}
