:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --bg: #f3f4f6;
    --white: #ffffff;
    --text: #1f2937;
    --gray: #9ca3af;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    color: var(--text);
}

.container {
    background: var(--white);
    padding: 30px 20px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    text-align: center;
    width: 100%;
    max-width: 400px;
    margin-top: 20px;
}

h1 { font-size: 24px; margin: 0 0 5px; color: var(--text); }
.subtitle { color: var(--gray); font-size: 14px; margin-bottom: 20px; }

/* Stats Board */
.stats-board {
    display: flex;
    justify-content: space-around;
    background: #f8fafc;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
}
.stat-item { display: flex; flex-direction: column; }
.stat-item .label { font-size: 11px; color: var(--gray); font-weight: bold; letter-spacing: 1px; }
.stat-item .value { font-size: 20px; font-weight: 800; color: var(--primary); }

/* Mode Badge */
.mode-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}
.mode-normal { background: #e0e7ff; color: var(--primary); }
.mode-reverse { background: #fef3c7; color: var(--warning); border: 1px solid var(--warning); animation: pulse 1.5s infinite; }

/* Game Area */
.game-area { min-height: 250px; display: flex; flex-direction: column; justify-content: center; position: relative; }

.number-box {
    font-size: 42px;
    font-weight: 900;
    letter-spacing: 5px;
    margin: 10px 0;
    color: var(--text);
    word-break: break-all;
    line-height: 1.2;
}

.message-box { font-size: 18px; font-weight: 600; color: #4b5563; margin: 10px 0; }

/* Leaderboard Specific Styles */
.leaderboard-container h2 { font-size: 18px; margin-bottom: 15px; color: #333; }
.ranking-list { text-align: left; max-height: 300px; overflow-y: auto; }
.rank-item { 
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px; border-bottom: 1px solid #f1f5f9; font-size: 14px;
}
.rank-item:last-child { border-bottom: none; }
.rank-idx { font-weight: bold; width: 25px; color: #666; }
.rank-item:nth-child(1) .rank-idx { color: #d97706; } /* Gold */
.rank-item:nth-child(2) .rank-idx { color: #94a3b8; } /* Silver */
.rank-item:nth-child(3) .rank-idx { color: #b45309; } /* Bronze */
.rank-name { flex: 1; font-weight: 600; color: #333; }
.rank-score { font-weight: bold; color: var(--primary); }

/* Submission Form */
.submit-form { margin-top: 15px; background: #f9fafb; padding: 15px; border-radius: 10px; }
.submit-input { 
    width: 100%; padding: 10px; margin-bottom: 10px; 
    border: 1px solid #ddd; border-radius: 8px; font-size: 16px; text-align: center;
}

/* Timer Bar */
.timer-container {
    width: 100%; height: 6px; background: #e5e7eb;
    border-radius: 3px; margin: 20px 0; overflow: hidden;
}
.timer-bar { height: 100%; background: var(--primary); width: 100%; transform-origin: left; }

/* Input */
input#answerInput {
    width: 100%; padding: 15px; font-size: 24px; font-weight: bold;
    border-radius: 12px; border: 2px solid #e5e7eb; text-align: center;
    outline: none; letter-spacing: 2px; transition: border-color 0.2s;
}
input#answerInput:focus { border-color: var(--primary); }
.helper-text { font-size: 13px; color: var(--gray); margin-top: 8px; }

/* Buttons */
.buttons { margin-top: 20px; }
.btn {
    width: 100%; padding: 16px; border: none; border-radius: 12px;
    font-size: 18px; font-weight: bold; cursor: pointer;
    transition: transform 0.1s, background 0.2s;
}
.btn:active { transform: scale(0.98); }
.primary { background: var(--primary); color: white; }
.primary:hover { background: var(--primary-dark); }
.btn.danger { background: var(--text); color: white; }
.btn.small { padding: 10px; font-size: 14px; margin-top: 5px; }

/* Animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
.shake { animation: shake 0.3s ease-in-out; border-color: var(--danger) !important; color: var(--danger); }
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.seo { max-width: 600px; margin-top: 50px; font-size: 14px; color: #6b7280; line-height: 1.6; padding: 0 20px; }