:root {
    --primary-red: #E52521;
    --primary-blue: #049CD8;
    --primary-yellow: #fbd000;
    --primary-green: #43B047;
    --bg-dark: #121212;
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-white: #ffffff;
    --btn-hover: rgba(255, 255, 255, 0.25);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-white);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Glassmorphism Styles */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.glass-inner {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

/* Overlay & Menus */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.menu-content {
    width: 90%;
    max-width: 500px;
    padding: 40px;
    text-align: center;
    position: relative;
    animation: slideIn 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.logo-container {
    margin-bottom: 30px;
}

.game-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 2rem;
    color: var(--primary-yellow);
    text-shadow: 4px 4px 0 var(--primary-red);
    letter-spacing: 2px;
}

.badge-new {
    display: inline-block;
    background: var(--primary-green);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-top: 8px;
    transform: rotate(-5deg);
}

.menu-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Premium Buttons */
.btn-premium {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.btn-premium:hover {
    background: var(--btn-hover);
    transform: translateX(5px);
}

.btn-premium .btn-icon {
    font-size: 1.5rem;
    margin-right: 16px;
}

.btn-premium .btn-text .main {
    display: block;
    font-weight: 700;
    font-size: 1.1rem;
}

.btn-premium .btn-text .sub {
    font-size: 0.8rem;
    opacity: 0.7;
}

.btn-premium.primary:hover { border-color: var(--primary-red); color: var(--primary-red); }
.btn-premium.secondary:hover { border-color: var(--primary-blue); color: var(--primary-blue); }
.btn-premium.tertiary:hover { border-color: var(--primary-yellow); color: var(--primary-yellow); }

/* Game Elements */
#game-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.game-header {
    height: 60px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: rgba(0,0,0,0.5);
    padding: 0 20px;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    z-index: 10;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-item .label { opacity: 0.7; font-size: 0.6rem; margin-bottom: 4px; }
.stat-item .value { font-size: 0.8rem; }
.stat-item .highlight { color: var(--primary-yellow); text-shadow: 0 0 10px rgba(251, 208, 0, 0.5); }

.canvas-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #5c94fc; /* Classic Mario Sky Blue */
    position: relative;
    overflow: hidden;
}

canvas {
    image-rendering: pixelated;
    display: block;
}

/* Mobile Controls */
#mobile-controls {
    display: none;
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    padding: 0 30px;
    justify-content: space-between;
    z-index: 20;
}

.d-pad, .action-buttons {
    display: flex;
    gap: 20px;
}

.touch-btn {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

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

.touch-btn.action {
    background: var(--primary-red);
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    margin-top: -10px;
}

.touch-btn.action.secondary {
    background: var(--primary-yellow);
    margin-top: 10px;
}

/* Media Queries */
@media screen and (max-width: 900px) {
    #mobile-controls {
        display: flex;
    }
}

.btn-icon-only {
    position: absolute;
    top: 70px;
    right: 20px;
    background: rgba(0,0,0,0.3);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 30;
}

.hidden { display: none !important; }

/* Multiplayer specific UI */
.action-card { padding: 20px; margin: 15px 0; }
.btn-small { padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer; font-weight: bold; margin-top: 10px; }
.btn-small:not(.secondary) { background: var(--primary-green); color: white; }
.btn-small.secondary { background: var(--primary-blue); color: white; }
input[type="text"] { background: rgba(0,0,0,0.3); border: 1px solid var(--glass-border); color: white; padding: 10px; border-radius: 8px; width: 100%; margin-top: 10px; text-align: center; }

.waiting-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    padding: 20px 40px;
    border-radius: 20px;
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--primary-yellow);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

/* Success Overlay Styles */
.success-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 2.5rem;
    color: var(--primary-yellow);
    text-shadow: 0 0 20px rgba(251, 208, 0, 0.6);
    margin-bottom: 20px;
}

.success-subtitle {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-green);
    letter-spacing: 2px;
    margin-bottom: 30px;
}

.stats-final {
    margin: 20px 0;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    line-height: 2;
}

.success-btn {
    background: var(--primary-red) !important;
    padding: 15px 30px !important;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7rem;
    border-radius: 12px;
}

.success-animate {
    animation: bounceIn 0.8s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); opacity: 1; }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

@keyframes spin { to { transform: rotate(360deg); } }
