/* =============================================
   갤러그 게임 스타일
   테마: 다크 스페이스 + 레드
   ============================================= */

html { background: #0a0a1a; }

.gl-body {
    overflow: hidden;
    height: 100dvh;
    max-width: 480px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #f0f0f0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* Game Area */
.gl-game {
    width: 100%;
    height: 100dvh;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #0a0a1a;
}

/* Top Bar */
.gl-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    z-index: 10;
    flex-shrink: 0;
}
.gl-back {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}
.gl-back:hover { color: #fff; }
.gl-info-badge {
    font-size: 13px;
    font-weight: 600;
    color: #EF4444;
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Canvas Wrapper */
.gl-canvas-wrap {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    position: relative;
    flex-shrink: 0;
    padding: 0 8px;
}
.gl-canvas-wrap canvas {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    border: 1px solid #1a1a30;
    touch-action: none;
}

/* Content area */
.gl-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 16px 20px;
    overflow-y: auto;
}

/* ===== INTRO ===== */
.state-intro .gl-canvas-wrap { display: none; }
.state-intro .gl-info-badge { display: none; }
.state-intro .gl-content {
    justify-content: center;
    padding-top: 0;
}

.gl-intro-emoji { font-size: 72px; margin-bottom: 16px; }
.gl-intro-title {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
}
.gl-intro-desc {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
    margin-bottom: 20px;
    text-align: center;
}
.gl-intro-desc strong { color: #EF4444; }

.gl-best {
    background: rgba(239, 68, 68, 0.1);
    border-radius: 10px;
    padding: 10px 18px;
    margin-bottom: 12px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.gl-challenge {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 14px 20px;
    margin-bottom: 20px;
    font-size: 16px;
    color: #EF4444;
    text-align: center;
}
.gl-challenge strong { font-size: 22px; }

.gl-rules {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    justify-content: center;
}
.gl-rule-chip {
    padding: 6px 14px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 20px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.gl-btn-start {
    display: inline-block;
    padding: 16px 48px;
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s;
}
.gl-btn-start:active { transform: scale(0.95); }

/* ===== COUNTDOWN ===== */
.state-countdown { background: #0a0a1a; }
.state-countdown .gl-canvas-wrap { display: none; }
.state-countdown .gl-info-badge { display: none; }
.state-countdown .gl-content {
    justify-content: center;
    padding: 0;
}
.gl-countdown-wrap { text-align: center; }
.gl-countdown-num {
    font-size: 120px;
    font-weight: 900;
    color: #fff;
    line-height: 1;
    animation: glCountPop 0.5s ease-out;
}
.gl-countdown-num.gl-countdown-pop {
    animation: glCountPop 0.5s ease-out;
}
.gl-countdown-label {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 16px;
}
@keyframes glCountPop {
    0% { transform: scale(1.6); opacity: 0.3; }
    50% { transform: scale(0.95); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* ===== PLAYING ===== */
.state-playing .gl-content { display: none; }

/* ===== GAMEOVER overlay ===== */
.gl-gameover-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 10, 26, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    animation: glFadeIn 0.3s ease;
}
@keyframes glFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.gl-gameover-text {
    font-size: 32px;
    font-weight: 900;
    color: #EF4444;
    margin-bottom: 16px;
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

.gl-gameover-score {
    font-size: 48px;
    font-weight: 900;
    color: #fff;
    margin-bottom: 4px;
}
.gl-gameover-score small { font-size: 18px; color: rgba(255,255,255,0.5); }

.gl-gameover-detail {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 24px;
}

.gl-btn-result {
    padding: 16px 48px;
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s;
}
.gl-btn-result:active { transform: scale(0.95); }

/* ===== RESULT ===== */
.state-result .gl-canvas-wrap { display: none; }
.state-result .gl-info-badge { display: none; }
.state-result .gl-content {
    justify-content: flex-start;
    padding-top: 24px;
}

/* Result -- 공통 game-result.css 사용 */

/* Toast */
.gl-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.gl-toast-show {
    opacity: 1;
    pointer-events: auto;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .gl-canvas-wrap {
        max-width: calc(100vw - 16px);
    }
    .gl-intro-title { font-size: 24px; }
    .gl-intro-emoji { font-size: 56px; }
    .gl-gameover-score { font-size: 40px; }
}

@media (max-width: 360px) {
    .gl-canvas-wrap {
        max-width: calc(100vw - 12px);
        padding: 0 4px;
    }
    .gl-top-bar { padding: 10px 12px; }
    .gl-content { padding: 12px 16px; }
}
