/* 3秒有多長 遊戲樣式表 */
:root {
    --primary-color: #fbbf24;
    --primary-glow: rgba(251, 191, 36, 0.4);
    --success-color: #10b981;
    --error-color: #ef4444;
    --bg-dark: #0f172a;
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-family: 'Outfit', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 遊戲主容器 */
.app-container {
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    padding: 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* 頂部標頭 */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 4px 0;
}

.game-header .logo {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.05em;
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* 遊戲佈局 */
.game-layout {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.game-container {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 24px;
    box-sizing: border-box;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 遊戲標題與說明 */
h1 {
    font-size: 1.8rem;
    font-weight: 900;
    margin: 0 0 10px;
    text-align: center;
    background: linear-gradient(135deg, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.instruction {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    text-align: center;
    margin-bottom: 30px;
    max-width: 320px;
}

/* 數據儀表板 */
.stats-dashboard {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    width: 100%;
    max-width: 340px;
    margin-bottom: 36px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 12px;
    text-align: center;
    transition: background 0.3s ease;
}

.stat-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
    font-family: 'Share Tech Mono', monospace;
}

/* 大按鈕設計 */
.button-outer {
    position: relative;
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 36px;
}

/* 雷達波紋背景 */
.button-pulse {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: var(--primary-glow);
    opacity: 0;
    transform: scale(1);
    pointer-events: none;
    transition: all 0.5s ease;
}

.button-outer.active .button-pulse {
    animation: ripple 1.6s infinite ease-out;
}

.time-btn {
    width: 160px;
    height: 160px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: #111827;
    font-weight: 900;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(217, 119, 6, 0.3), 
                inset 0 4px 6px rgba(255, 255, 255, 0.35);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    z-index: 2;
}

.time-btn:hover {
    background: linear-gradient(135deg, #fcd34d, #d97706);
}

.time-btn:active, .button-outer.active .time-btn {
    transform: scale(0.92);
    box-shadow: 0 6px 15px rgba(217, 119, 6, 0.2), 
                inset 0 2px 3px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #fff;
}

.time-btn .btn-text {
    font-weight: 900;
    font-size: 1.15rem;
    letter-spacing: 0.05em;
}

.time-btn .btn-icon {
    font-size: 2.2rem;
    transition: transform 0.2s ease;
}

.button-outer.active .time-btn .btn-icon {
    animation: rotateIcon 1.2s infinite linear;
}

/* 結果與回饋 */
.result-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 120px;
    justify-content: center;
}

.result-time {
    font-size: 2.8rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 6px;
    font-family: 'Share Tech Mono', monospace;
    line-height: 1;
}

.accuracy-badge {
    font-size: 1.05rem;
    font-weight: 800;
    padding: 6px 14px;
    border-radius: 99px;
    margin-bottom: 12px;
}

.accuracy-badge.excellent {
    background: rgba(251, 191, 36, 0.12);
    color: var(--primary-color);
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.accuracy-badge.good {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.accuracy-badge.normal {
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-light);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.feedback-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 700;
    text-align: center;
    max-width: 320px;
}

/* 排行榜登入面板 */
.record-panel {
    width: 100%;
    max-width: 340px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 20px;
    margin-top: 24px;
    box-sizing: border-box;
    text-align: center;
    display: none;
}

.record-panel.visible {
    display: block;
    animation: fadeInUp 0.4s ease-out;
}

.record-panel .glow-title {
    font-size: 1rem;
    font-weight: 800;
    color: #fbbf24;
    margin-bottom: 12px;
    animation: pulse 1.5s infinite;
}

.record-panel input {
    width: 100%;
    height: 44px;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: #fff;
    padding: 0 16px;
    font-size: 1rem;
    text-align: center;
    box-sizing: border-box;
    margin-bottom: 12px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.record-panel input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.25);
}

.btn-submit {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #111827;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(251, 191, 36, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(251, 191, 36, 0.3);
}

.btn-submit:active {
    transform: translateY(1px);
}

/* 遊戲說明指南 */
.game-instruction {
    margin-top: 30px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.6;
    text-align: center;
    max-width: 100%;
}

.game-instruction strong {
    color: #94a3b8;
}

/* 動畫細節 */
@keyframes ripple {
    0% { transform: scale(1.0); opacity: 0.45; }
    50% { opacity: 0.15; }
    100% { transform: scale(1.35); opacity: 0; }
}

@keyframes rotateIcon {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.02); opacity: 1; }
    100% { transform: scale(1); opacity: 0.9; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
    body {
        padding-top: 98px !important;
    }
    .app-container {
        padding: 4px 8px;
    }
    .game-container {
        padding: 12px 14px 16px;
    }
    h1 {
        font-size: 1.4rem;
        margin-bottom: 4px;
    }
    .instruction {
        font-size: 0.85rem;
        margin-bottom: 14px;
        line-height: 1.4;
    }
    .stats-dashboard {
        margin-bottom: 18px;
        gap: 10px;
    }
    .stat-card {
        padding: 8px;
    }
    .stat-value {
        font-size: 1rem;
    }
    .button-outer {
        width: 140px;
        height: 140px;
        margin-bottom: 20px;
    }
    .time-btn {
        width: 124px;
        height: 124px;
        font-size: 1rem;
    }
    .time-btn .btn-icon {
        font-size: 1.6rem;
    }
    .result-section {
        min-height: 90px;
    }
    .result-time {
        font-size: 2.1rem;
    }
    .accuracy-badge {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }
    .feedback-text {
        font-size: 0.82rem;
    }
    .record-panel {
        margin-top: 14px;
        padding: 12px;
    }
    .game-instruction {
        margin-top: 16px;
        padding: 10px;
        font-size: 0.78rem;
    }
}
