:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --success: #22c55e;
    --warning: #f59e0b;
    --purple: #8b5cf6;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #334155;
}

body {
    font-family: 'Hiragino Maru Gothic ProN', 'Rounded M+ 1c', sans-serif;
    background-color: var(--bg);
    margin: 0;
    display: flex; justify-content: center; padding: 20px 0; color: var(--text);
}

.app-container {
    background: var(--card); padding: 25px 30px; border-radius: 20px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.05); width: 100%; max-width: 600px;
}

.header-title { font-size: 22px; font-weight: bold; color: var(--primary-dark); text-align: center; margin-bottom: 20px; }

/* タブデザイン */
.tabs { display: flex; justify-content: space-between; margin-bottom: 20px; gap: 8px; }
.tab-btn {
    flex: 1; padding: 12px 5px; font-size: 14px; font-weight: bold; border: 2px solid #cbd5e1;
    border-radius: 12px; background: white; color: #64748b; cursor: pointer; transition: 0.2s;
}
.tab-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.tab-content { display: none; animation: fadeIn 0.3s; }
.tab-content.active-content { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* 問題ボックス */
.question-box {
    background: #f0fdf4; padding: 15px; border-radius: 12px; margin-bottom: 20px;
    font-size: 16px; font-weight: bold; border-left: 6px solid var(--success); line-height: 1.5;
}

/* 計算カード */
.step-card { border: 2px solid #e2e8f0; border-radius: 12px; padding: 15px; margin-bottom: 15px; }
.calc-row { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: bold; margin-bottom: 10px; flex-wrap: wrap; }
.q-label { color: var(--primary); font-size: 20px; }

.num-input { width: 50px; padding: 6px; border: 2px solid #cbd5e1; border-radius: 8px; text-align: center; font-size: 18px; font-weight: bold; }
.num-input:focus { border-color: var(--primary); outline: none; }
.num-input.correct { background: #dcfce7; border-color: var(--success); color: var(--success); }

/* ボタン類 */
.btn-check { background: var(--primary); color: white; border: none; padding: 8px 15px; border-radius: 8px; font-weight: bold; cursor: pointer; margin-left: auto; }
.btn-check:disabled { background: #cbd5e1; cursor: not-allowed; }
.btn-reset-all { background: #94a3b8; display: block; width: 100%; margin-top: 20px; font-size: 15px; color: white; border: none; padding: 12px 20px; border-radius: 10px; cursor: pointer; font-weight: bold; }

/* メッセージボックス */
.message-box { font-size: 14px; font-weight: bold; color: #475569; background: #f1f5f9; padding: 10px; border-radius: 8px; margin-top: 5px; }

/* ゲームエリア */
.game-area { text-align: center; padding: 20px 0; }
.time-select { font-size: 18px; padding: 5px 10px; border-radius: 8px; border: 2px solid var(--warning); font-weight: bold; outline: none; }
.btn-giant {
    background: var(--success); color: white; border: none; width: 100%; padding: 25px 20px; margin: 20px 0;
    border-radius: 15px; font-size: 22px; font-weight: bold; cursor: pointer; box-shadow: 0 6px 0 #166534; transition: 0.1s;
}
.btn-giant:active { transform: translateY(6px); box-shadow: none; }
.btn-giant.stop { background: #ef4444; box-shadow: 0 6px 0 #991b1b; }
.game-result { background: #fffbeb; padding: 20px; border-radius: 12px; border: 3px dashed var(--warning); font-size: 18px; font-weight: bold; }
.highlight-text { font-size: 28px; color: #d97706; }
.feedback-text { display: block; margin-top: 10px; color: #b45309; }

/* 単位えらびエリア */
.q-text { font-size: 16px; font-weight: bold; margin-bottom: 15px; }
.ans-blank { display: inline-block; width: 50px; text-align: center; border-bottom: 2px solid #94a3b8; color: var(--purple); }
.unit-buttons { display: flex; gap: 10px; margin-bottom: 10px; justify-content: center; }
.btn-unit { flex: 1; padding: 10px; font-size: 16px; font-weight: bold; background: white; border: 2px solid var(--purple); color: var(--purple); border-radius: 8px; cursor: pointer; }
.btn-unit:hover { background: #f3e8ff; }
.btn-unit.selected { background: var(--purple); color: white; }

.hidden { display: none !important; }