:root {
    --primary: #64748B;
    --secondary: #94A3B8;
    --accent: #38BDF8;
    --bg: #0F1219;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --glass-bg: rgba(15, 18, 25, 0.7);
    --glass-border: rgba(148, 163, 184, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg);
    color: var(--secondary);
    font-family: 'Press Start 2P', 'Inter', system-ui, sans-serif;
    overflow: hidden;
    touch-action: none;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 100vh;
    max-height: 900px;
    background: #111;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(0,0,0,0.8);
}

@media (min-width: 600px) {
    #game-container {
        height: 90vh;
        border-radius: 12px;
        border: 1px solid var(--glass-border);
    }
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#top-bar {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: linear-gradient(to bottom, rgba(15,18,25,0.9), transparent);
    font-size: 10px;
}

.stat-box {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 8px;
    border-radius: 8px;
    backdrop-filter: blur(4px);
    color: #fff;
    text-shadow: 1px 1px 0 #000;
}

#center-text {
    text-align: center;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 20px;
    border-radius: 12px;
    margin: 0 20px;
    pointer-events: auto;
    transition: opacity 0.3s;
}

#center-text.hidden, .hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important;
}

h1 {
    font-size: 20px;
    color: var(--accent);
    margin-bottom: 10px;
    text-shadow: 0 0 10px var(--accent);
    line-height: 1.4;
}

p {
    font-size: 10px;
    color: var(--secondary);
    font-family: 'Inter', sans-serif;
    letter-spacing: 1px;
}

#controls {
    padding: 20px;
    pointer-events: auto;
    padding-bottom: 40px;
}

#action-btn {
    width: 100%;
    padding: 25px;
    font-family: 'Press Start 2P', cursive;
    font-size: 16px;
    border: 2px solid var(--accent);
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    border-radius: 16px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
    transition: all 0.1s;
    text-shadow: 0 0 5px var(--accent);
}

#action-btn:active {
    transform: scale(0.95);
    background: rgba(56, 189, 248, 0.3);
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.5);
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-height: 70%;
    overflow-y: auto;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
}

#score-list {
    list-style: none;
    margin: 15px 0;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
}

#score-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--glass-border);
    color: #fff;
}

.glass-btn {
    padding: 10px;
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: 8px;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    cursor: pointer;
    margin-top: 10px;
}
.glass-btn:hover { background: rgba(255,255,255,0.1); }

/* Juice classes */
.shake-light { animation: shake 0.2s cubic-bezier(.36,.07,.19,.97) both; }
.shake-heavy { animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.flash-white { animation: flashWhite 0.2s ease-out; }
.flash-red { animation: flashRed 0.3s ease-out; }
@keyframes flashWhite {
    0% { filter: brightness(3) contrast(2); }
    100% { filter: brightness(1) contrast(1); }
}
@keyframes flashRed {
    0% { filter: sepia(1) hue-rotate(-50deg) saturate(5) brightness(1.5); }
    100% { filter: none; }
}

#floater-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
}
.floating-text {
    position: absolute;
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    color: #fff;
    text-shadow: 2px 2px 0 #000;
    animation: floatUp 1s ease-out forwards;
}
.floater-damage { color: var(--danger); }
.floater-crit { color: var(--warning); font-size: 18px; }
.floater-heal { color: var(--success); }
.floater-xp { color: var(--accent); font-size: 10px; }

@keyframes floatUp {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-50px) scale(1.5); opacity: 0; }
}
