body {
    font-family: 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
    background-color: #f0f8ff;
    color: #333;
    margin: 0;
    padding: 20px;
}

h1 { text-align: center; color: #00796b; font-size: 26px; }
h2 { color: #fff; background-color: #4caf50; padding: 10px 15px; border-radius: 8px; font-size: 20px; margin-top: 0; }
.instruction { text-align: center; font-weight: bold; margin-bottom: 20px; color: #555; }

.container {
    max-width: 750px;
    margin: 0 auto;
    background-color: #fff;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}

/* タブデザイン */
.tabs { display: flex; justify-content: center; gap: 5px; margin-bottom: 20px; flex-wrap: wrap;}
.tab-btn {
    font-size: 16px; font-weight: bold; padding: 12px 20px;
    border: 2px solid #ccc; border-bottom: none; border-radius: 10px 10px 0 0;
    background-color: #e0e0e0; cursor: pointer; transition: 0.2s;
}
.tab-btn:hover { background-color: #f5f5f5; }
.tab-btn.active-tab { background-color: #fff; border-color: #4caf50; color: #2e7d32; border-top: 4px solid #4caf50; }

.panel {
    border: 3px solid #4caf50; border-radius: 10px; padding: 20px; background-color: #f9fdf9;
    animation: fadeIn 0.4s ease-in;
}
.hidden { display: none !important; }

/* 活動エリア */
.activity-box { background: #fff; border: 2px dashed #4caf50; padding: 20px; border-radius: 10px; margin-bottom: 20px; text-align: center; }
.hint-text { color: #e65100; font-weight: bold; background: #fff3e0; padding: 5px 10px; border-radius: 5px; display: inline-block; margin-top: 10px;}
.visual-area { min-height: 50px; margin: 15px 0; text-align: center; }

/* 修正箇所：青い四角のデザイン（文字が見切れないように自動調整） */
.lap-box { 
    display: inline-block; 
    padding: 0 15px; /* 左右に余白を持たせる */
    min-width: 50px; /* 最低限の幅 */
    height: 50px; 
    background-color: #2196f3; 
    color: white; 
    line-height: 50px; 
    border-radius: 8px; 
    margin: 0 5px; 
    font-weight: bold; 
    font-size: 20px; /* 文字サイズを少し調整 */
    letter-spacing: normal; /* 文字間隔をリセット */
    box-sizing: border-box;
}

/* 入力ボックス */
input[type="number"] { text-align: center; font-weight: bold; border: 2px solid #aaa; border-radius: 8px; color: #d32f2f; background: #fff; outline: none; }
input[type="number"]:focus { border-color: #ff9800; background: #fff3e0; }
.input-sm { width: 60px; height: 40px; font-size: 24px; }
.input-md { width: 80px; height: 40px; font-size: 24px; }
.input-lg { width: 100px; height: 45px; font-size: 26px; }
.input-pv { width: 60px; height: 50px; font-size: 32px; }

/* さくらんぼ計算 */
.sakuranbo { text-align: center; margin: 15px 0; font-weight: bold; }
.top-val { font-size: 30px; display: inline-block; border: 3px solid #ff9800; padding: 10px 30px; border-radius: 20px; background: #fff; }
.branches { font-size: 30px; color: #888; margin: 5px 0; }
.bottom-vals { display: flex; justify-content: center; gap: 40px; }

/* 位取り表 */
.pv-table { width: 100%; max-width: 500px; margin: 0 auto; border-collapse: collapse; font-size: 20px; }
.pv-table th, .pv-table td { border: 2px solid #ccc; padding: 15px 5px; text-align: center; background: #fff; }
.pv-table th { background-color: #e0f7fa; font-size: 16px; }
.pink-bg { background-color: #fce4ec !important; }

/* ボタンと解答欄 */
.math-line { font-size: 24px; font-weight: bold; margin: 15px 0; }
.answer-box { text-align: center; font-size: 24px; font-weight: bold; background: #e8f5e9; padding: 20px; border-radius: 10px; }
.action-btn { padding: 10px 20px; font-size: 18px; font-weight: bold; border: none; border-radius: 8px; cursor: pointer; color: white; margin-bottom: 10px;}
.blue-btn { background-color: #2196f3; box-shadow: 0 4px 0 #1565c0; }
.blue-btn:active { transform: translateY(4px); box-shadow: none; }
.check-btn { background-color: #ff9800; color: white; font-size: 20px; font-weight: bold; border: none; padding: 10px 25px; border-radius: 30px; cursor: pointer; margin-left: 20px; box-shadow: 0 4px 0 #e65100; transition: 0.1s; }
.check-btn:active { transform: translateY(4px); box-shadow: none; }

.feedback { font-size: 22px; margin-top: 15px; min-height: 30px; }
.correct { color: #e91e63; }
.incorrect { color: #757575; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }