/* =============================================
   수학 속도 테스트 게임 스타일
   ============================================= */

html { background: #000; }

.mt-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 */
.mt-game {
    width: 100%;
    height: 100dvh;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: background-color 0.15s;
}

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

/* Timer */
.mt-timer-wrap {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}
.mt-timer-bar {
    height: 100%;
    width: 100%;
    border-radius: 0 3px 3px 0;
    transition: width 0.1s linear, background 0.3s;
}

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

/* ===== States ===== */

/* Intro */
.state-intro { background: #0f0f23; }
.state-intro .mt-content {
    justify-content: flex-start;
    padding-top: 40px;
}

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

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

.mt-challenge {
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    padding: 14px 20px;
    margin-bottom: 24px;
    font-size: 16px;
    color: #ffd700;
    text-align: center;
}
.mt-challenge strong { font-size: 22px; }

.mt-btn-start {
    display: inline-block;
    padding: 16px 48px;
    background: #F59E0B;
    color: #000;
    border: none;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s;
}
.mt-btn-start:active { transform: scale(0.95); }

/* Playing */
.state-playing { background: #0f0f23; }
.state-playing .mt-content {
    justify-content: flex-start;
    padding-top: 16px;
}

.mt-status-bar {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 360px;
    margin-bottom: 20px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}
.mt-status-bar strong {
    color: #fff;
    font-weight: 700;
}

/* 문제 영역 */
.mt-problem-area {
    width: 100%;
    max-width: 360px;
    text-align: center;
    margin-bottom: 8px;
}
.mt-problem-level {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.3);
    margin-bottom: 8px;
    font-weight: 600;
}
.mt-problem-text {
    font-size: 48px;
    font-weight: 900;
    color: #fff;
    margin-bottom: 12px;
    letter-spacing: 4px;
}
.mt-problem-eq {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 24px;
}

/* 플래시 효과 */
.mt-flash-correct {
    animation: mtFlashGreen 0.3s ease;
}
.mt-flash-wrong {
    animation: mtFlashRed 0.3s ease;
}
@keyframes mtFlashGreen {
    0% { background: rgba(52, 211, 153, 0.3); }
    100% { background: transparent; }
}
@keyframes mtFlashRed {
    0% { background: rgba(239, 68, 68, 0.3); }
    100% { background: transparent; }
}

/* 답 입력 디스플레이 */
.mt-answer-display {
    width: 100%;
    max-width: 280px;
    height: 56px;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(245, 158, 11, 0.3);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 16px;
    letter-spacing: 4px;
    min-height: 56px;
}
.mt-answer-cursor {
    display: inline-block;
    width: 2px;
    height: 32px;
    background: #F59E0B;
    animation: mtBlink 0.8s step-end infinite;
    margin-left: 2px;
}
@keyframes mtBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* 숫자 키패드 */
.mt-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 280px;
}
.mt-key {
    height: 56px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
    -webkit-tap-highlight-color: transparent;
}
.mt-key:hover {
    background: rgba(255, 255, 255, 0.15);
}
.mt-key:active {
    transform: scale(0.95);
    background: rgba(245, 158, 11, 0.2);
}
.mt-key-negative {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    font-size: 20px;
}
.mt-key-delete {
    background: rgba(255, 255, 255, 0.04);
    font-size: 18px;
}
.mt-key-submit {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.4);
    color: #F59E0B;
    font-size: 18px;
    font-weight: 800;
}

/* Combo */
.mt-combo {
    font-size: 14px;
    color: #F59E0B;
    font-weight: 700;
    margin-bottom: 8px;
    min-height: 20px;
}

/* Result — 공통 game-result.css 사용 */
.state-result { background: #0f0f23; }
.state-result .mt-content {
    justify-content: flex-start;
    padding-top: 32px;
}

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

/* Responsive */
@media (max-width: 480px) {
    .mt-problem-text { font-size: 40px; }
    .mt-key { height: 50px; font-size: 22px; }
}
