/* オカピゾーン学習ページ専用CSS - 中学受験対応版 */
.okapi-learning-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "ヒラギノ角ゴ ProN W3", Meiryo, sans-serif;
    line-height: 1.8;
    color: #333;
}

/* ページヘッダー */
.okapi-page-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.okapi-page-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="80" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="40" cy="60" r="1" fill="rgba(255,255,255,0.1)"/></svg>');
    pointer-events: none;
}

.okapi-header-content { position: relative; z-index: 2; }

.okapi-page-title {
    font-size: 2.2rem; font-weight: 700; margin: 0 0 1rem 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.okapi-page-meta { display: flex; gap: 1rem; flex-wrap: wrap; }

.okapi-category, .okapi-difficulty {
    background: rgba(255,255,255,0.2); padding: 0.4rem 0.8rem;
    border-radius: 20px; font-size: 0.9rem; backdrop-filter: blur(10px);
}

/* 学習進捗 */
.okapi-progress-container {
    display: flex; align-items: center; gap: 1rem; margin-top: 1.5rem;
    padding: 1rem; background: rgba(255,255,255,0.1);
    border-radius: 8px; backdrop-filter: blur(10px);
}

.okapi-progress-label { font-weight: 600; white-space: nowrap; }

.okapi-progress-bar {
    flex: 1; height: 8px; background: rgba(255,255,255,0.3);
    border-radius: 4px; overflow: hidden;
}

.okapi-progress-fill {
    height: 100%; background: linear-gradient(90deg, #4CAF50, #8BC34A);
    width: 0%; transition: width 0.5s ease; border-radius: 4px;
}

.okapi-progress-text { font-weight: 600; min-width: 3rem; }

/* 目次 */
.okapi-toc-wrapper {
    background: #f8f9fa; border: 2px solid #e9ecef;
    border-radius: 12px; margin: 2rem 0; overflow: hidden;
}

.okapi-toc-header {
    background: #343a40; color: white; padding: 1rem; cursor: pointer;
    display: flex; justify-content: space-between; align-items: center; user-select: none;
}

.okapi-toc-header h2 { margin: 0; font-size: 1.2rem; }

.okapi-toc-toggle { transition: transform 0.3s ease; font-size: 1.2rem; }

.okapi-toc-content { padding: 1.5rem; display: block; }
.okapi-toc-content.collapsed { display: none; }

.okapi-toc-content ol { list-style: none; counter-reset: toc-counter; margin: 0; padding: 0; }
.okapi-toc-content li { counter-increment: toc-counter; margin: 0.5rem 0; }
.okapi-toc-content li::before { content: counter(toc-counter) ". "; font-weight: 600; color: #667eea; }
.okapi-toc-content a { color: #495057; text-decoration: none; transition: color 0.2s ease; }
.okapi-toc-content a:hover { color: #667eea; }

/* キャラクターと導入 */
.okapi-story-intro {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    padding: 2rem; border-radius: 12px; margin: 2rem 0;
}

.okapi-character-box {
    display: flex; align-items: center; gap: 1.5rem;
    background: rgba(255,255,255,0.2); padding: 1.5rem;
    border-radius: 12px; backdrop-filter: blur(10px);
}

.okapi-character {
    font-size: 4rem; animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.okapi-speech-bubble {
    flex: 1; background: white; padding: 1rem;
    border-radius: 15px; position: relative; color: #333;
}

.okapi-speech-bubble::before {
    content: ''; position: absolute; left: -15px; top: 50%;
    transform: translateY(-50%); width: 0; height: 0;
    border: 15px solid transparent; border-right-color: white;
}

/* ビジュアルストーリー */
.okapi-visual-story {
    background: #f8f9fa; padding: 2rem; border-radius: 12px; margin: 2rem 0;
}

.okapi-cake-demo {
    display: flex; align-items: center; gap: 2rem; margin: 1.5rem 0;
}

.okapi-cake-whole {
    width: 150px; height: 150px; border-radius: 50%;
    background: #ffeaa7; border: 4px solid #fdcb6e;
    display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
    overflow: hidden; position: relative;
}

.okapi-cake-piece {
    background: #fdcb6e; border: 2px solid #e17055;
    transition: all 0.5s ease; cursor: pointer;
}

.okapi-cake-piece.cake-1 { 
    border-radius: 100% 0 0 0; 
    background: #55a3ff; 
    transform-origin: bottom right;
}

.okapi-cake-piece.cake-2 { 
    border-radius: 0 100% 0 0; 
    transform-origin: bottom left;
}

.okapi-cake-piece.cake-3 { 
    border-radius: 0 0 0 100%; 
    transform-origin: top right;
}

.okapi-cake-piece.cake-4 { 
    border-radius: 0 0 100% 0; 
    transform-origin: top left;
}

.okapi-cake-piece.eaten {
    opacity: 0.3; transform: scale(0.8);
}

.fraction-display, .decimal-display {
    font-weight: bold; padding: 0.2rem 0.4rem;
    border-radius: 4px; margin: 0 0.2rem;
}

.fraction-display {
    background: #74b9ff; color: white;
}

.decimal-display {
    background: #00b894; color: white;
}

.okapi-demo-button {
    background: #ff7675; color: white; border: none;
    padding: 0.8rem 1.5rem; border-radius: 20px; cursor: pointer;
    font-weight: 600; transition: all 0.3s ease;
    margin-top: 1rem;
}

.okapi-demo-button:hover {
    background: #e84393; transform: translateY(-2px);
}

/* メンタルイメージ */
.okapi-mental-image {
    display: flex; align-items: center; justify-content: center;
    gap: 2rem; margin: 2rem 0; flex-wrap: wrap;
}

.okapi-fraction-house, .okapi-decimal-house {
    text-align: center;
}

.house-roof {
    font-size: 3rem; margin-bottom: 0.5rem;
}

.house-content {
    background: white; padding: 1.5rem; border-radius: 12px;
    border: 3px solid #ddd; min-width: 120px;
}

.fraction-parts {
    font-size: 1.5rem; font-weight: bold;
}

.fraction-numerator { color: #e17055; }
.fraction-line { color: #333; margin: 0.2rem 0; }
.fraction-denominator { color: #0984e3; }

.house-arrow {
    font-size: 2rem; margin: 0 1rem;
    animation: moveRight 2s ease-in-out infinite;
}

@keyframes moveRight {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(10px); }
}

.decimal-display {
    font-size: 2rem; font-weight: bold; color: #00b894;
}

.mental-explanation {
    text-align: center; font-style: italic; color: #666;
    margin-top: 1rem;
}

/* ルールカード */
.okapi-rules-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem; margin: 2rem 0;
}

.rule-card {
    background: white; padding: 1.5rem; border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); text-align: center;
    border: 2px solid #e9ecef; transition: all 0.3s ease;
}

.rule-card:hover {
    transform: translateY(-4px); border-color: #667eea;
}

.rule-icon {
    font-size: 3rem; margin-bottom: 1rem;
}

.rule-card h4 {
    color: #343a40; margin-bottom: 1rem;
}

.rule-example {
    background: #f8f9fa; padding: 0.8rem; border-radius: 8px;
    font-family: monospace; color: #666; margin-top: 1rem;
}

/* マジックショー */
.okapi-magic-show {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    padding: 2rem; border-radius: 12px; margin: 2rem 0; color: white;
}

.magic-demo {
    display: flex; flex-direction: column; align-items: center;
    gap: 2rem; margin: 2rem 0;
}

.magic-input {
    display: flex; align-items: center; gap: 2rem;
}

.fraction-input {
    display: flex; flex-direction: column; align-items: center;
    background: rgba(255,255,255,0.2); padding: 1.5rem;
    border-radius: 12px; backdrop-filter: blur(10px);
}

.magic-number {
    font-size: 2rem; font-weight: bold;
}

.magic-line {
    font-size: 1.5rem; margin: 0.5rem 0;
}

.magic-wand {
    font-size: 3rem; animation: wiggle 1s ease-in-out infinite;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(10deg); }
    75% { transform: rotate(-10deg); }
}

.magic-process {
    text-align: center;
}

.process-step {
    background: rgba(255,255,255,0.2); padding: 1rem;
    border-radius: 8px; margin: 0.5rem 0;
}

.magic-arrow {
    font-size: 2rem; animation: pulse 1s infinite;
}

.magic-result {
    text-align: center;
}

.result-display {
    font-size: 3rem; font-weight: bold; background: rgba(255,255,255,0.3);
    padding: 1rem 2rem; border-radius: 12px; margin-bottom: 0.5rem;
}

.sparkles {
    font-size: 1.5rem; animation: sparkle 1s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.magic-button {
    background: #fd79a8; color: white; border: none;
    padding: 1rem 2rem; border-radius: 20px; cursor: pointer;
    font-weight: 600; font-size: 1.1rem; transition: all 0.3s ease;
}

.magic-button:hover {
    background: #e84393; transform: scale(1.05);
}

/* タブ機能 */
.method-tabs {
    display: flex; gap: 0.5rem; margin-bottom: 2rem;
}

.tab-button {
    background: #e9ecef; color: #495057; border: none;
    padding: 0.8rem 1.5rem; border-radius: 8px 8px 0 0;
    cursor: pointer; transition: all 0.3s ease;
}

.tab-button.active {
    background: #667eea; color: white;
}

.tab-button:hover {
    background: #343a40; color: white;
}

.tab-content {
    display: none; background: white; padding: 2rem;
    border-radius: 0 8px 8px 8px; border: 2px solid #e9ecef;
}

.tab-content.active {
    display: block;
}

/* ステップビジュアル */
.method-steps {
    display: flex; flex-direction: column; gap: 2rem;
}

.step-visual {
    display: flex; align-items: flex-start; gap: 1.5rem;
}

.step-icon {
    width: 3rem; height: 3rem; background: #667eea; color: white;
    border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-weight: bold; flex-shrink: 0;
}

.step-explanation {
    flex: 1;
}

.step-explanation h4 {
    margin: 0 0 1rem 0; color: #343a40;
}

.calculation-demo {
    background: #f8f9fa; padding: 1rem; border-radius: 8px;
    font-family: monospace; margin-top: 1rem;
}

.calc-step {
    color: #666;
}

.calc-result {
    color: #00b894; font-weight: bold;
}

.handwriting-demo {
    margin-top: 1rem;
}

.division-work {
    background: #f8f9fa; padding: 1rem; border-radius: 8px;
}

.math-work {
    font-family: monospace; font-size: 0.9rem; color: #333;
    margin: 0; line-height: 1.4;
}

/* 上級テクニック */
.advanced-tricks {
    display: flex; flex-direction: column; gap: 2rem;
}

.trick-card {
    background: #f8f9fa; padding: 1.5rem; border-radius: 12px;
    border-left: 4px solid #667eea;
}

.trick-icon {
    font-size: 2rem; margin-bottom: 1rem;
}

.trick-examples {
    margin-top: 1rem;
}

.trick-example {
    background: white; padding: 0.8rem; border-radius: 6px;
    font-family: monospace; margin: 0.5rem 0;
    border-left: 3px solid #00b894;
}

.memory-chart {
    display: flex; flex-direction: column; gap: 0.5rem;
    margin-top: 1rem;
}

.memory-row {
    background: white; padding: 0.8rem; border-radius: 6px;
    font-family: monospace; text-align: center;
    border: 2px solid #e9ecef;
}

/* パターン表示 */
.pattern-display {
    text-align: center;
}

.pattern-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 2rem;
    margin-top: 2rem;
}

.pattern-family {
    background: #f8f9fa; padding: 1.5rem; border-radius: 12px;
}

.pattern-family h5 {
    margin: 0 0 1rem 0; color: #343a40;
}

.pattern-items {
    display: flex; flex-direction: column; gap: 0.5rem;
}

.pattern-item {
    background: white; padding: 0.8rem; border-radius: 6px;
    font-family: monospace; border-left: 3px solid #667eea;
}

/* 例題カード */
.exam-level-examples {
    display: flex; flex-direction: column; gap: 3rem;
}

.example-card {
    background: white; border-radius: 12px; overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); border: 2px solid #e9ecef;
}

.example-header {
    background: #f8f9fa; padding: 1rem; border-bottom: 2px solid #e9ecef;
    display: flex; justify-content: space-between; align-items: center;
}

.level-badge {
    padding: 0.4rem 0.8rem; border-radius: 20px; font-size: 0.9rem;
    font-weight: 600;
}

.level-badge.basic {
    background: #d4edda; color: #155724;
}

.level-badge.intermediate {
    background: #fff3cd; color: #856404;
}

.level-badge.advanced {
    background: #f8d7da; color: #721c24;
}

.example-title {
    font-weight: bold; color: #343a40;
}

.example-content {
    padding: 2rem;
}

.problem-statement {
    margin-bottom: 2rem;
}

.problem-text {
    font-size: 1.2rem; font-weight: 600; margin-bottom: 1rem;
}

.problem-visual {
    text-align: center; margin: 1.5rem 0;
}

.fraction-display-large {
    font-size: 3rem; font-weight: bold; color: #667eea;
    background: #f8f9fa; padding: 1rem 2rem; border-radius: 12px;
    display: inline-block;
}

.solution-detailed h4 {
    color: #343a40; margin-bottom: 1.5rem;
}

.solution-steps-visual {
    display: flex; flex-direction: column; gap: 1.5rem;
}

.step-box {
    background: #f8f9fa; padding: 1.5rem; border-radius: 12px;
    border-left: 4px solid #667eea; display: flex; align-items: flex-start; gap: 1rem;
}

.step-box.important {
    border-left-color: #e17055; background: #fff5f5;
}

.step-number {
    width: 2.5rem; height: 2.5rem; background: #667eea; color: white;
    border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-weight: bold; flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content h5 {
    margin: 0 0 0.8rem 0; color: #343a40;
}

.handcalc-visual {
    margin-top: 1rem;
}

.math-calculation {
    background: white; padding: 1rem; border-radius: 8px;
    font-family: monospace; font-size: 0.9rem; color: #333;
    margin: 0; line-height: 1.4; border: 1px solid #e9ecef;
}

.verification {
    color: #00b894; font-weight: bold; margin-top: 0.5rem;
}

.pattern-highlight {
    background: #fff3cd; color: #856404; padding: 0.5rem 1rem;
    border-radius: 6px; font-family: monospace; font-weight: bold;
    display: inline-block; margin-top: 0.5rem;
}

.verification-work {
    background: white; padding: 1rem; border-radius: 8px;
    border: 1px solid #e9ecef; margin-top: 1rem;
}

.answer-highlight {
    background: linear-gradient(135deg, #00b894, #55a3ff);
    color: white; padding: 1.5rem; border-radius: 12px;
    margin-top: 2rem; text-align: center;
}

.answer-icon {
    font-size: 2rem; margin-bottom: 0.5rem;
}

.answer-text {
    font-size: 1.3rem; font-weight: bold;
}

/* 練習問題の進化版 */
.difficulty-progress {
    margin-top: 1.5rem;
}

.difficulty-bar {
    height: 8px; background: #e9ecef; border-radius: 4px;
    overflow: hidden; margin-bottom: 0.5rem;
}

.difficulty-fill {
    height: 100%; background: linear-gradient(90deg, #28a745, #ffc107, #fd7e14, #dc3545);
    width: 0%; transition: width 0.5s ease; border-radius: 4px;
}

.difficulty-labels {
    display: flex; justify-content: space-between; font-size: 0.9rem;
    color: #666;
}

.problem-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.5rem;
}

.difficulty-badge {
    padding: 0.3rem 0.8rem; border-radius: 15px; font-size: 0.8rem;
    font-weight: 600;
}

.difficulty-badge.basic {
    background: #d4edda; color: #155724;
}

.difficulty-badge.standard {
    background: #fff3cd; color: #856404;
}

.difficulty-badge.advanced {
    background: #f8d7da; color: #721c24;
}

.difficulty-badge.expert {
    background: #d1ecf1; color: #0c5460;
}

.problem-statement {
    font-size: 1.1rem; margin-bottom: 1.5rem;
}

.visual-hint {
    background: #f8f9fa; padding: 1.5rem; border-radius: 8px;
    margin: 1rem 0; text-align: center;
}

/* ビジュアル要素 */
.fraction-visual .circle-parts {
    display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
    width: 100px; height: 100px; border-radius: 50%;
    overflow: hidden; margin: 0 auto 1rem auto; border: 3px solid #333;
}

.circle-piece {
    background: #e9ecef;
}

.circle-piece.active {
    background: #667eea; animation: glow 2s infinite;
}

@keyframes glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.bar-visual .bar-parts {
    display: flex; gap: 2px; justify-content: center; margin-bottom: 1rem;
}

.bar-piece {
    width: 30px; height: 20px; border: 2px solid #333;
}

.bar-piece.filled {
    background: #00b894;
}

.bar-piece.empty {
    background: #e9ecef;
}

.decimal-grid .grid-squares {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
    width: 200px; margin: 0 auto 1rem auto;
}

.square {
    width: 35px; height: 35px; border: 1px solid #333;
}

.square.filled {
    background: #fd79a8;
}

.square.empty {
    background: #f8f9fa;
}

.calculation-hint {
    font-family: monospace; color: #666;
}

.mini-calc {
    font-family: monospace; font-size: 1rem; line-height: 1.4;
    margin: 0;
}

.repeating-visual {
    background: #fff3cd; padding: 1rem; border-radius: 8px;
    color: #856404;
}

/* 入力とフィードバック */
.okapi-hint {
    background: #e3f2fd; color: #1565c0; padding: 0.8rem;
    border-radius: 8px; margin: 1rem 0; border-left: 4px solid #2196f3;
}

.okapi-input-group { display: flex; gap: 1rem; margin: 1.5rem 0; }

.okapi-answer-input {
    flex: 1; padding: 0.8rem; border: 2px solid #ddd; border-radius: 8px; font-size: 1rem;
}

.okapi-check-button {
    background: #00b894; color: white; border: none; padding: 0.8rem 1.5rem;
    border-radius: 8px; cursor: pointer; font-weight: 600; transition: background 0.2s ease;
}

.okapi-check-button:hover { background: #00a085; }

.okapi-feedback {
    padding: 1rem; border-radius: 8px; margin-top: 1rem; font-weight: 600; display: none;
}

.okapi-feedback.correct {
    background: #d4edda; color: #155724; border: 2px solid #c3e6cb; display: block;
}

.okapi-feedback.incorrect {
    background: #f8d7da; color: #721c24; border: 2px solid #f5c6cb; display: block;
}

/* 完了メッセージ */
.okapi-completion-message { text-align: center; margin: 2rem 0; }

.okapi-success-box {
    background: white; padding: 2rem; border-radius: 12px; border: 3px solid #28a745;
}

.okapi-success-icon { font-size: 4rem; margin-bottom: 1rem; }

.achievement-stats {
    display: flex; gap: 2rem; justify-content: center; margin-top: 1.5rem;
}

.stat-item {
    background: #f8f9fa; padding: 1rem; border-radius: 8px;
    min-width: 120px; text-align: center;
}

.stat-label {
    display: block; font-size: 0.9rem; color: #666; margin-bottom: 0.5rem;
}

.stat-value {
    display: block; font-size: 1.5rem; font-weight: bold; color: #28a745;
}

/* FAQ */
.okapi-faq-section { margin: 3rem 0; }
.okapi-faq-section h2 { text-align: center; margin-bottom: 2rem; color: #343a40; }

.okapi-faq-item {
    background: white; border: 2px solid #e9ecef; border-radius: 8px;
    margin: 1rem 0; overflow: hidden; transition: all 0.2s ease;
}

.okapi-faq-item:hover { border-color: #667eea; }

.okapi-faq-question {
    padding: 1rem; cursor: pointer; display: flex; align-items: center;
    gap: 1rem; user-select: none;
}

.okapi-faq-icon {
    background: #667eea; color: white; width: 2rem; height: 2rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; flex-shrink: 0;
}

.okapi-faq-toggle {
    margin-left: auto; font-weight: 600; font-size: 1.2rem; transition: transform 0.2s ease;
}

.okapi-faq-item.active .okapi-faq-toggle { transform: rotate(45deg); }

.okapi-faq-answer { display: none; background: #f8f9fa; border-top: 1px solid #e9ecef; }
.okapi-faq-answer.show { display: block; }

.okapi-faq-content {
    padding: 1rem; display: flex; align-items: flex-start; gap: 1rem;
}

.okapi-faq-content .okapi-faq-icon { background: #28a745; }

/* 関連コンテンツ */
.okapi-related-section { margin: 3rem 0; padding: 2rem; background: #f8f9fa; border-radius: 12px; }
.okapi-related-section h2 { text-align: center; margin-bottom: 2rem; color: #343a40; }
.okapi-related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; }

.okapi-related-card {
    background: white; padding: 1.5rem; border-radius: 12px; text-align: center;
    border: 2px solid #e9ecef; transition: all 0.3s ease;
}

.okapi-related-card:hover { transform: translateY(-4px); box-shadow: 0 8px 25px rgba(0,0,0,0.1); }
.okapi-related-icon { font-size: 3rem; margin-bottom: 1rem; }
.okapi-related-card h3 { margin: 0 0 1rem 0; color: #343a40; }
.okapi-related-card p { color: #6c757d; margin: 0 0 1.5rem 0; }

.okapi-related-link {
    display: inline-block; background: #667eea; color: white;
    padding: 0.6rem 1.2rem; border-radius: 20px; text-decoration: none;
    font-weight: 600; transition: background 0.2s ease;
}

.okapi-related-link:hover { background: #5a67d8; }

/* エラーページ */
.okapi-no-content { text-align: center; padding: 4rem 2rem; }
.okapi-error-icon { font-size: 4rem; margin-bottom: 1rem; }

.okapi-home-button {
    display: inline-block; background: #667eea; color: white;
    padding: 1rem 2rem; border-radius: 8px; text-decoration: none;
    font-weight: 600; margin-top: 1rem;
}

/* レスポンシブデザイン - モバイル最適化 */
@media (max-width: 768px) {
    /* 全体のページ幅を最大活用 */
    .okapi-learning-page {
        padding: 0 10px;
        margin: 0;
        width: 100vw;
        box-sizing: border-box;
    }
    
    .okapi-page-header {
        margin: 0 -10px 1rem -10px;
        padding: 1.5rem 15px;
        border-radius: 0;
    }
    
    .okapi-page-title { font-size: 1.8rem; }
    .okapi-page-meta { flex-direction: column; gap: 0.5rem; }
    .okapi-progress-container { flex-direction: column; text-align: center; }
    .okapi-character-box { flex-direction: column; text-align: center; }
    .okapi-mental-image { flex-direction: column; }
    .okapi-cake-demo { flex-direction: column; }
    .okapi-rules-grid { grid-template-columns: 1fr; }
    .method-tabs { flex-direction: column; }
    .tab-button { border-radius: 8px; }
    .step-visual { flex-direction: column; }
    .pattern-grid { grid-template-columns: 1fr; }
    .achievement-stats { flex-direction: column; }
    .okapi-input-group { flex-direction: column; }
    .okapi-related-grid { grid-template-columns: 1fr; }
    .problem-header { flex-direction: column; gap: 0.5rem; }
    
    /* 計算式の横スクロール対応 */
    .math-work, .math-calculation, .handcalc-visual, .division-work {
        overflow-x: auto;
        white-space: nowrap;
        padding: 1rem;
        border: 1px solid #e9ecef;
        border-radius: 8px;
        background: #f8f9fa;
        margin: 1rem 0;
    }
    
    .math-work::-webkit-scrollbar,
    .math-calculation::-webkit-scrollbar {
        height: 8px;
    }
    
    .math-work::-webkit-scrollbar-track,
    .math-calculation::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }
    
    .math-work::-webkit-scrollbar-thumb,
    .math-calculation::-webkit-scrollbar-thumb {
        background: #667eea;
        border-radius: 4px;
    }
    
    /* 長い数式の改行防止とスクロール */
    .fraction-display-large {
        white-space: nowrap;
        overflow-x: auto;
        display: block;
        padding: 1rem;
        text-align: center;
        min-width: 100%;
    }
    
    /* テーブルの横スクロール */
    .okapi-learning-page table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        min-width: 100%;
    }
    
    .okapi-learning-page thead,
    .okapi-learning-page tbody,
    .okapi-learning-page tr {
        display: table;
        width: 100%;
    }
}

@media (max-width: 480px) {
    /* より小さな画面での最適化 */
    .okapi-learning-page {
        padding: 0 5px;
    }
    
    .okapi-page-header { 
        padding: 1rem;
        margin: 0 -5px 1rem -5px;
    }
    
    .okapi-story-intro { padding: 1rem; }
    .okapi-character-box { padding: 1rem; }
    .okapi-magic-show { padding: 1rem; }
    .example-content { padding: 1rem; }
    
    .fraction-display-large { 
        font-size: 2rem; 
        padding: 0.8rem 1rem;
        min-width: auto;
        overflow-x: auto;
        display: block;
    }
    
    /* 更に小さな画面での計算式スクロール */
    .math-work, .math-calculation {
        font-size: 0.8rem;
        padding: 0.8rem;
        overflow-x: auto;
        white-space: pre;
    }
    
    /* コンテンツエリア全体を画面いっぱいに */
    .okapi-main-content {
        margin: 0;
        padding: 10px 5px;
        width: 100vw;
        box-sizing: border-box;
    }
    
    /* 横スクロール可能な要素の統一スタイル */
    .scrollable-math {
        overflow-x: auto;
        white-space: nowrap;
        padding: 10px;
        background: #f8f9fa;
        border: 1px solid #dee2e6;
        border-radius: 5px;
        margin: 10px 0;
    }
}