* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-color: #1a1a2e;
    --card-bg: #16213e;
    --text-color: #eee;
    --accent-color: #0f3460;
    --border-color: #533483;
    --block-color-1: #00d4ff;
    --block-color-2: #ff006e;
    --block-color-3: #8338ec;
    --block-color-4: #fb5607;
    --block-color-5: #ffbe0b;
    --block-color-6: #06ffa5;
    --block-color-7: #ff006e;
}

html, body {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    touch-action: none;
    -webkit-overflow-scrolling: none;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    margin: 0;
    overscroll-behavior: none;
    -webkit-user-select: none;
    user-select: none;
}

.game-area {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 1200px;
    width: 100%;
    overflow-y: auto;
    max-height: 100vh;
    -webkit-overflow-scrolling: touch;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.game-header h1 {
    font-size: 2.5em;
    background: linear-gradient(45deg, #00d4ff, #8338ec);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-wrapper {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.game-info-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 150px;
}

.info-box {
    background: var(--accent-color);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid var(--border-color);
}

.info-box h3 {
    font-size: 0.9em;
    margin-bottom: 8px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-box .score,
.info-box .level,
.info-box .lines,
.info-box .best-score {
    font-size: 2em;
    font-weight: bold;
    color: #00d4ff;
}

.canvas-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#game-canvas {
    background: #0a0e27;
    border: 3px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.canvas-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.control-btn {
    padding: 10px 20px;
    background: linear-gradient(45deg, var(--block-color-3), var(--block-color-1));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn.hidden {
    display: none;
}

.next-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 150px;
}

.next-panel h3 {
    font-size: 1.2em;
    color: var(--text-color);
}

#next-canvas {
    background: #0a0e27;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.controls-info {
    margin-top: 30px;
    padding: 20px;
    background: var(--accent-color);
    border-radius: 10px;
    border: 2px solid var(--border-color);
}

.controls-info h3 {
    margin-bottom: 15px;
    color: #00d4ff;
}

.controls-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.controls-list p {
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    font-size: 0.9em;
}

.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.game-over-overlay.show {
    display: flex;
}

.game-over-content {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    border: 3px solid var(--border-color);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.game-over-content h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: #ff006e;
}

.game-over-content p {
    font-size: 1.3em;
    margin: 10px 0;
    color: var(--text-color);
}

.restart-btn {
    margin-top: 20px;
    padding: 15px 40px;
    background: linear-gradient(45deg, var(--block-color-2), var(--block-color-4));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.restart-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(255, 0, 110, 0.4);
}

#comments-container {
    margin-top: 30px;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .game-area {
        padding: 15px;
    }

    .game-header h1 {
        font-size: 1.8em;
    }

    .game-wrapper {
        flex-direction: column;
        align-items: center;
    }

    .game-info-panel {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }

    .info-box {
        flex: 1;
        min-width: 120px;
    }

    #game-canvas {
        width: 100%;
        max-width: 300px;
        height: auto;
    }

    #next-canvas {
        width: 100px;
        height: 100px;
    }

    .controls-list {
        grid-template-columns: 1fr;
    }
}

/* 전체화면 모드 */
.game-area:fullscreen,
.game-area:-webkit-full-screen,
.game-area:-moz-full-screen,
.game-area:-ms-fullscreen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.game-area:fullscreen .game-wrapper,
.game-area:-webkit-full-screen .game-wrapper,
.game-area:-moz-full-screen .game-wrapper,
.game-area:-ms-fullscreen .game-wrapper {
    max-width: none;
    justify-content: center;
}

.game-area:fullscreen #game-canvas,
.game-area:-webkit-full-screen #game-canvas,
.game-area:-moz-full-screen #game-canvas,
.game-area:-ms-fullscreen #game-canvas {
    width: auto;
    height: 80vh;
    max-height: 800px;
}
