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

:root {
    --bg-color: #0d1117;
    --card-bg: rgba(22, 27, 34, 0.85);
    --accent: #21a1f1;
    --gold: #f1c40f;
    --text: #ffffff;
    --text-dim: #8b949e;
}

body {
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    overflow: hidden;
    touch-action: none;
    font-family: 'Outfit', sans-serif;
    color: var(--text);
}

#gameArea {
    position: absolute;
    top: 58%;
    /* Shifted down to avoid HUD overlap */
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

canvas {
    display: block;
    max-width: 95vw;
    max-height: 78vh;
    /* Optimized size to stay under HUD */
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    background-color: #1a1a1a;
}

.top-corner-buttons {
    position: fixed;
    top: 15px;
    z-index: 100;
    display: flex;
    gap: 12px;
}

.top-left {
    left: 20px;
}

.top-right {
    right: 20px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.2s;
    pointer-events: auto;
}

.icon-btn:hover {
    background: rgba(45, 51, 59, 0.95);
    border-color: var(--accent);
    transform: translateY(-2px);
}

#hud-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.top-bar {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
}

.player-container {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px 15px;
    width: 250px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.player-container.active {
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(33, 161, 241, 0.4);
    transform: scale(1.05);
}

.avatar {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    background: #30363d;
    margin-right: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.player-info {
    flex-grow: 1;
}

.player-name {
    font-weight: 700;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
}

.player-level {
    font-size: 12px;
    color: var(--gold);
}

.center-display {
    margin: 0 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.coin-box {
    background: rgba(0, 0, 0, 0.6);
    padding: 5px 20px;
    border-radius: 20px;
    border: 1px solid var(--gold);
    color: var(--gold);
    font-weight: 700;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#power-meter-ui {
    position: fixed;
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
    width: 35px;
    height: 300px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    overflow: hidden;
    display: none;
}

#power-fill {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(to top, #2ecc71, #f1c40f, #e74c3c);
    transition: height 0.05s ease-out;
}

/* Dashboard Menu Styles */
#menu-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1a1a1a 0%, #0d1117 100%);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.menu-content {
    width: 90%;
    max-width: 1000px;
    text-align: center;
}

.game-logo {
    font-size: 80px;
    font-weight: 900;
    margin-bottom: 40px;
    letter-spacing: -2px;
    color: white;
}

.game-logo span {
    color: var(--accent);
}

.dashboard-grid,
.difficulty-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.difficulty-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 600px;
    margin: 0 auto;
}

.menu-card {
    background: rgba(22, 27, 34, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(15px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    pointer-events: auto;
    touch-action: manipulation;
}

.menu-card:hover {
    transform: translateY(-10px);
    background: rgba(33, 161, 241, 0.1);
    border-color: var(--accent);
    box-shadow: 0 10px 30px rgba(33, 161, 241, 0.2);
}

.menu-card.primary {
    background: linear-gradient(135deg, #1a73e8 0%, #21a1f1 100%);
    border: none;
}

.menu-card.disabled {
    opacity: 0.2;
    cursor: not-allowed;
    filter: grayscale(1);
}

.card-icon {
    font-size: 50px;
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    color: white;
}

.card-desc {
    font-size: 14px;
    color: var(--text-dim);
}

.diff-item {
    padding: 20px;
    font-weight: 800;
    font-size: 24px;
}

.back-item {
    grid-column: span 2;
    padding: 15px;
    color: #e74c3c;
    border-color: rgba(231, 76, 60, 0.3);
}

#orientation-warning {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #096834;
    color: white;
    z-index: 10000;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

@media screen and (orientation: portrait) {
    #orientation-warning {
        display: flex;
    }
}

/* Result Screen Overlay */
#end-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 5000;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Outfit', sans-serif;
}

.result-modal {
    background: rgba(33, 45, 60, 0.95);
    border: 3px solid var(--accent);
    padding: 60px;
    border-radius: 40px;
    text-align: center;
    backdrop-filter: blur(30px);
    box-shadow: 0 0 100px rgba(33, 161, 241, 0.4);
    animation: modalPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    from {
        transform: scale(0.7);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}