:root {
    --bg-color: #050510;
    --primary-color: #00f3ff;
    --secondary-color: #bc13fe;
    --accent-color: #ffe600;
    --text-color: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-main: 'Inter', sans-serif;
    --font-display: 'Orbitron', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 800px;
    max-height: 900px;
    background: radial-gradient(circle at center, #1a1a2e 0%, #050510 100%);
    box-shadow: 0 0 50px rgba(0, 243, 255, 0.1);
    border: 1px solid var(--glass-border);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#score-board {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    font-family: var(--font-display);
    z-index: 10;
}

.score-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.label {
    font-size: 0.8rem;
    color: var(--primary-color);
    opacity: 0.8;
    letter-spacing: 2px;
}

#score-value,
#high-score-value {
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 0 10px var(--primary-color);
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(5, 5, 16, 0.8);
    backdrop-filter: blur(8px);
    transition: opacity 0.3s ease;
    pointer-events: auto;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.title {
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: 900;
    text-align: center;
    margin-bottom: 2rem;
    background: linear-gradient(to bottom, #fff, var(--primary-color));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(0, 243, 255, 0.5);
    letter-spacing: 4px;
}

.instruction {
    font-size: 1.2rem;
    margin-bottom: 3rem;
    letter-spacing: 2px;
    animation: pulse 2s infinite;
}

.controls {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.key {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    color: var(--primary-color);
    background: rgba(0, 243, 255, 0.1);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
    margin: 0 4px;
    font-weight: bold;
}

.btn-primary {
    background: transparent;
    color: var(--primary-color);
    font-family: var(--font-display);
    font-size: 1.5rem;
    padding: 1rem 3rem;
    border: 2px solid var(--primary-color);
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    background: var(--primary-color);
    color: var(--bg-color);
    box-shadow: 0 0 30px var(--primary-color);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .title {
        font-size: 2.5rem;
    }

    #game-container {
        border: none;
    }
}

/* Mobile Controls */
#mobile-controls {
    display: none;
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    padding: 0 20px;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
    /* Let clicks pass through container */
    z-index: 100;
}

.control-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    /* Re-enable clicks on buttons */
    backdrop-filter: blur(4px);
    touch-action: manipulation;
    /* Prevent double-tap zoom */
    user-select: none;
    -webkit-user-select: none;
}

.control-btn:active {
    background: var(--primary-color);
    color: var(--bg-color);
    transform: scale(0.95);
}

.d-pad {
    display: flex;
    gap: 20px;
}

.fire-btn {
    width: 80px;
    height: 80px;
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    font-size: 1rem;
    font-weight: bold;
}

.fire-btn:active {
    background: var(--secondary-color);
}

@media (max-width: 800px) {
    #mobile-controls {
        display: flex;
    }
}