/* =============================================
   디노 런 게임 스타일
   테마: 다크 + 에메랄드 그린
   ============================================= */

html { background: #0f0f23; }

.dr-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 */
.dr-game {
    width: 100%;
    height: 100dvh;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #0f0f23;
}

/* Top Bar */
.dr-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    z-index: 10;
    flex-shrink: 0;
}
.dr-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);
}
.dr-back:hover { color: #fff; }
.dr-info-badge {
    font-size: 13px;
    font-weight: 600;
    color: #34D399;
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.2);
}

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

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

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

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

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

.dr-challenge {
    background: rgba(52, 211, 153, 0.15);
    border: 1px solid rgba(52, 211, 153, 0.3);
    border-radius: 12px;
    padding: 14px 20px;
    margin-bottom: 20px;
    font-size: 16px;
    color: #34D399;
    text-align: center;
}
.dr-challenge strong { font-size: 22px; }

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

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

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

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

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

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

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

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

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

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

/* Toast */
.dr-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;
}
.dr-toast-show {
    opacity: 1;
    pointer-events: auto;
}

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

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