/* Combined CSS: common.css, home.css, results.css, writing.css */
/* common.css */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

:root {
    --gradient-primary: linear-gradient(45deg, #4a90e2, #50c878);
    --gradient-secondary: linear-gradient(45deg, #ff6b6b, #feca57);
    --gradient-accent: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-warning: linear-gradient(45deg, #ff8c00, #ffa500);
    --gradient-danger: linear-gradient(45deg, #ff6b6b, #ff4757);
    --gradient-light: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    --gradient-purple: linear-gradient(135deg, #9b59b6 0%, #e67e22 100%);
    --shadow-sm: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-md: 0 5px 20px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
    --shadow-blue: 0 8px 25px rgba(74, 144, 226, 0.4);
    --shadow-orange: 0 8px 25px rgba(255, 140, 0, 0.4);
    --shadow-red: 0 8px 25px rgba(255, 107, 107, 0.4);
    --shadow-purple: 0 8px 25px rgba(155, 89, 182, 0.4);
    --color-primary: #4a90e2;
    --color-success: #50c878;
    --color-danger: #ff6b6b;
    --color-text: #333;
    --color-text-light: #666;
    --color-border: #e9ecef;
    --color-bg: #f8f9fa;
    --button-shadow-color: rgba(74, 144, 226, 0.3);
    --button-shadow-hover-color: rgba(74, 144, 226, 0.4);
}

ruby rt {
    font-size: 0.8rem;
}

.feature-card,
.material-card,
.submit-btn,
.choice-button,
.answer-button,
.explanation-button,
.nav-button,
.back-button,
.category-card {
    transition: all 0.3s ease;
}

        body {
            font-family: 'Hiragino Kaku Gothic Pro', 'ヒラギノ角ゴ Pro W3', 'Meiryo', 'メイリオ', 'Osaka', 'MS PGothic', sans-serif;
            line-height: 1.6;
            color: var(--color-text);
            background: var(--gradient-accent);
            min-height: 100vh;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
        }

        /* ヘッダー */
        header {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            position: fixed;
            width: 100%;
            top: 0;
            z-index: 1000;
            box-shadow: 0 2px 20px rgba(0,0,0,0.1);
        }

        nav {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 1rem 0;
        }

        .logo {
            font-size: 1.8rem;
            font-weight: bold;
            color: var(--color-primary);
            text-decoration: none;
        }

        .nav-links {
            display: flex;
            list-style: none;
            gap: 2rem;
        }

        .nav-links a {
            text-decoration: none;
            color: var(--color-text);
            font-weight: 500;
            transition: color 0.3s ease;
        }

        .nav-links a:hover {
            color: var(--color-primary);
        }

        /* ハンバーガーメニュー */
        .hamburger {
            display: none;
            flex-direction: column;
            cursor: pointer;
        }

        .hamburger span {
            width: 25px;
            height: 3px;
            background: var(--color-text);
            margin: 2px 0;
            transition: 0.3s;
        }

        /* メインコンテンツ */
        main {
            margin-top: 80px;
            display: flex;
            gap: 2rem;
            align-items: flex-start;
        }

        .main-content {
            flex: 1;
        }

        .sidebar {
            width: 300px;
            background: rgba(255, 255, 255, 0.9);
            border-radius: 15px;
            padding: 2rem;
            box-shadow: var(--shadow-md);
            position: sticky;
            top: 100px;
            height: fit-content;
        }

        .sidebar h3 {
            color: var(--color-primary);
            margin-bottom: 1rem;
            text-align: center;
        }

        .ad-placeholder {
            height: 250px;
            background: linear-gradient(45deg, var(--color-bg), var(--color-border));
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--color-text-light);
            font-size: 1.1rem;
            margin-bottom: 1rem;
        }

        .hero {
            text-align: center;
            padding: 4rem 0;
            color: white;
        }

        .hero h1 {
            font-size: 3rem;
            margin-bottom: 1rem;
            animation: fadeInUp 1s ease-out;
        }

        .hero p {
            font-size: 1.2rem;
            margin-bottom: 2rem;
            animation: fadeInUp 1s ease-out 0.2s both;
        }

        .breadcrumb {
            background: rgba(255, 255, 255, 0.9);
            padding: 1rem;
            border-radius: 10px;
            margin: 1rem 0 2rem;
            box-shadow: var(--shadow-sm);
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .breadcrumb a {
            color: var(--color-primary);
            text-decoration: none;
            transition: color 0.3s ease;
        }

        .breadcrumb a:hover {
            color: #2e7bc7;
        }

        .breadcrumb span {
            color: var(--color-text-light);
            margin: 0 0.5rem;
        }


        /* フッター */
        footer {
            background: var(--color-text);
            color: white;
            text-align: center;
            padding: 2rem 0;
            margin-top: 2rem;
        }

        /* アニメーション */
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        /* レスポンシブデザイン */
        @media (max-width: 768px) {
            .nav-links {
                display: none;
                position: absolute;
                top: 100%;
                left: 0;
                width: 100%;
                background: white;
                flex-direction: column;
                padding: 1rem;
                box-shadow: var(--shadow-sm);
            }

            .nav-links.show {
                display: flex;
            }

            .hamburger {
                display: flex;
            }

            main {
                flex-direction: column;
            }

            .sidebar {
                width: 100%;
                position: static;
            }
        }

        /* 問題演習 */
        .quiz-section {
            background: white;
            padding: 4rem 0;
            margin: 2rem 0;
            border-radius: 20px;
            box-shadow: var(--shadow-lg);
        }

        .quiz-header {
            text-align: center;
            margin-bottom: 3rem;
        }

        .quiz-header h2 {
            font-size: 2.5rem;
            color: var(--color-text);
            margin-bottom: 1rem;
        }

        .progress-bar {
            width: 100%;
            max-width: 400px;
            margin: 0 auto 2rem;
            background: var(--color-border);
            border-radius: 10px;
            overflow: hidden;
            height: 20px;
        }

        .progress-fill {
            height: 100%;
            background: var(--gradient-primary);
            width: 10%;
            transition: width 0.5s ease;
        }

        .progress-text {
            text-align: center;
            color: var(--color-text-light);
            font-size: 1.1rem;
            margin-bottom: 1rem;
        }

        .quiz-container {
            max-width: 800px;
            margin: 0 auto;
        }

        .question-card {
            background: var(--gradient-light);
            border-radius: 15px;
            padding: 3rem;
            margin-bottom: 2rem;
            box-shadow: var(--shadow-md);
            scroll-margin-top: 90px;
        }

        .question-number {
            background: var(--gradient-primary);
            color: white;
            padding: 0.5rem 1rem;
            border-radius: 20px;
            font-size: 1rem;
            font-weight: bold;
            display: inline-block;
            margin-bottom: 1.5rem;
        }

        .question-text {
            font-size: 1.5rem;
            color: var(--color-text);
            margin-bottom: 2rem;
            text-align: center;
            line-height: 1.8;
        }

        .illustration-area {
            width: 600px;
            height: 450px;
            background: #fff;
            border: 1px solid var(--color-border);
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 2rem auto;
            font-size: 3rem;
            color: var(--color-text);
            font-weight: bold;
            overflow: hidden;
        }

        .illustration-area img {
            max-width: 100%;
            max-height: 100%;
            border-radius: 10px;
        }

        .choices {
            display: flex;
            flex-direction: column;
            gap: 1rem;
            margin-bottom: 2rem;
        }

        .choice-button {
            background: white;
            border: 2px solid var(--color-border);
            padding: 1.5rem;
            border-radius: 10px;
            font-size: 1.1rem;
            cursor: pointer;
            transition: all 0.3s ease;
            text-align: center;
            font-weight: 500;
        }

        .choice-button:hover {
            border-color: var(--color-primary);
            background: #f8f9ff;
            transform: translateY(-2px);
        }

        .choice-button.selected {
            background: var(--color-primary);
            color: white;
            border-color: var(--color-primary);
        }

        .choice-button.correct {
            background: var(--color-success);
            color: white;
            border-color: var(--color-success);
        }

        .choice-button.incorrect {
            background: var(--color-danger);
            color: white;
            border-color: var(--color-danger);
        }

        .answer-button {
            background: var(--gradient-warning);
            color: white;
            padding: 0.75rem 1rem;
            min-height: 48px;
            border: none;
            border-radius: 50px;
            font-size: 1.1rem;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
            display: block;
            margin: 0 auto 1rem;
            box-shadow: 0 4px 15px rgba(255, 140, 0, 0.3);
        }

        .answer-button:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow-orange);
        }

        .answer-button:disabled {
            background: #ccc;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        .answer-buttons {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
            width: 100%;
        }

        .answer-buttons .answer-button,
        .answer-buttons .explanation-button {
            margin: 0;
            display: inline-block;
        }

        .explanation-button {
            background: var(--gradient-warning);
            color: white;
            padding: 1rem 2rem;
            border: none;
            border-radius: 50px;
            font-size: 1.1rem;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(255, 140, 0, 0.3);
        }

        .explanation-button:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow-orange);
        }

        .explanation-button:disabled {
            background: #ccc;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        .result-message {
            text-align: center;
            font-size: 1.2rem;
            margin: 1rem 0;
            padding: 1rem;
            border-radius: 10px;
            display: none;
        }

        .result-message.correct {
            background: #d4edda;
            color: #155724;
            border: 1px solid #c3e6cb;
        }

        .result-message.incorrect {
            background: #f8d7da;
            color: #721c24;
            border: 1px solid #f5c6cb;
        }

        .explanation {
            background: var(--color-bg);
            border-radius: 10px;
            padding: 2rem;
            margin: 2rem 0;
            display: none;
            scroll-margin-top: 90px;
        }

        .explanation h4 {
            color: var(--color-primary);
            margin-bottom: 1rem;
        }

        .explanation p {
            line-height: 1.8;
            color: var(--color-text);
        }

        .navigation-buttons {
            display: flex;
            justify-content: space-between;
            margin-top: 2rem;
        }

        .nav-button {
            background: var(--gradient-accent);
            color: white;
            padding: 0.75rem 1rem;
            min-height: 48px;
            border: none;
            border-radius: 50px;
            font-size: 1rem;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
            text-decoration: none;
            display: inline-block;
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
        }

        .nav-button:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
        }

        .nav-button:disabled {
            background: #ccc;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        .quiz-complete {
            text-align: center;
            padding: 3rem;
            background: var(--gradient-primary);
            color: white;
            border-radius: 20px;
            margin: 2rem 0;
            display: none;
        }

        .quiz-complete h3 {
            font-size: 2rem;
            margin-bottom: 1rem;
        }

        .quiz-complete p {
            font-size: 1.2rem;
            margin-bottom: 2rem;
        }

        .score-display {
            font-size: 3rem;
            font-weight: bold;
            margin: 2rem 0;
        }

        .max-score {
            font-size: 0.5em;
        }

        .back-button {
            display: inline-block;
            background: var(--gradient-primary);
            color: white;
            padding: 1rem 2rem;
            border: none;
            border-radius: 50px;
            font-size: 1.1rem;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
            text-decoration: none;
            margin-bottom: 2rem;
            box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
        }

        .back-button:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow-blue);
        }

        /* フッター */
        footer {
            background: var(--color-text);
            color: white;
            text-align: center;
            padding: 2rem 0;
            margin-top: 2rem;
        }

        /* アニメーション */
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }


        /* レスポンシブデザイン */
        @media (max-width: 768px) {
            .nav-links {
                display: none;
                position: absolute;
                top: 100%;
                left: 0;
                width: 100%;
                background: white;
                flex-direction: column;
                padding: 1rem;
                box-shadow: var(--shadow-sm);
            }

            .nav-links.show {
                display: flex;
            }

            .hamburger {
                display: flex;
            }

            main {
                flex-direction: column;
            }

            .sidebar {
                width: 100%;
                position: static;
            }

            .hero h1 {
                font-size: 1.8rem;
            }

            .question-card {
                padding: 2rem;
            }

            .question-text {
                font-size: 1.3rem;
            }

            .choices {
                grid-template-columns: 1fr;
            }

            .answer-buttons {
                flex-wrap: wrap;
            }
            #answerButton {
                order: 1;
                width: 100%;
                margin-bottom: 0.5rem;
            }
            #explanationButton {
                order: 2;
                width: 100%;
                margin-bottom: 0.5rem;
            }
            #prevButtonTop {
                order: 3;
                width: 48%;
            }
            #nextButtonTop {
                order: 4;
                width: 48%;
            }

            .navigation-buttons {
                flex-direction: column;
                gap: 1rem;
            }

            .question-card .navigation-buttons #nextButton {
                order: 1;
            }

            .question-card .navigation-buttons #prevButton {
                order: 2;
            }

            .nav-button {
                width: 100%;
                text-align: center;
            }

            .category-grid {
                grid-template-columns: repeat(2, 1fr);
                gap: 1.5rem;
            }

            .category-card {
                padding: 1.5rem;
            }

        }

        /* カテゴリー選択ページ */
        .category-section {
            background: white;
            padding: 4rem 0;
            margin: 2rem 0;
            border-radius: 20px;
            box-shadow: var(--shadow-lg);
        }

        .category-section h2 {
            text-align: center;
            font-size: 2.5rem;
            margin-bottom: 2rem;
            color: var(--color-text);
        }

        .progress-info {
            text-align: center;
            margin-bottom: 3rem;
            padding: 2rem;
            background: var(--gradient-light);
            border-radius: 15px;
        }

        .progress-info h3 {
            color: var(--color-primary);
            margin-bottom: 1rem;
        }

        .progress-info p {
            color: var(--color-text-light);
            font-size: 1.1rem;
        }


        .category-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 2rem;
            margin-top: 2rem;
        }

        .category-card {
            background: var(--gradient-primary);
            width: 100%;
            padding: 0.75rem 1rem;
            min-height: 48px;
            border-radius: 15px;
            text-align: center;
            color: white;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: var(--shadow-md);
            border: none;
            font-family: inherit;
            font-size: 1rem;
            font-weight: bold;
        }

        .category-card:hover {
            transform: translateY(-5px);
            box-shadow: var(--shadow-blue);
        }

        .category-card h3 {
            font-size: 1.3rem;
            margin-bottom: 0.5rem;
        }


        .category-card .emoji-placeholder {
            font-size: 2rem;
            margin-bottom: 0.5rem;
            display: none;
        }

        .category-card p {
            font-size: 0.9rem;
            opacity: 0.9;
            font-weight: normal;
        }

        .category-card.group-2 {
            background: var(--gradient-secondary);
        }

        .category-card.group-2:hover {
            box-shadow: var(--shadow-red);
        }

        .category-card.group-3 {
            background: var(--gradient-purple);
        }

        .category-card.group-3:hover {
            box-shadow: var(--shadow-purple);
        }

\n/* home.css */
        /* 特徴セクション */
        .features {
            background: white;
            padding: 4rem 0;
            margin: 2rem 0;
            border-radius: 20px;
            box-shadow: var(--shadow-lg);
        }

        .features h2 {
            text-align: center;
            font-size: 2.5rem;
            margin-bottom: 3rem;
            color: var(--color-text);
        }

        .feature-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 2rem;
            margin-top: 2rem;
        }

.feature-card {
            background: var(--gradient-primary);
            padding: 2rem;
            border-radius: 15px;
            text-align: center;
            color: white;
            cursor: pointer;
            text-decoration: none;
            transition: all 0.3s ease;
            box-shadow: var(--shadow-md);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: var(--shadow-blue);
        }

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

        .feature-card h3 {
            font-size: 1.5rem;
            margin-bottom: 1rem;
        }

        /* 教材セクション */
        .materials {
            background: white;
            padding: 4rem 0;
            margin: 2rem 0;
            border-radius: 20px;
            box-shadow: var(--shadow-lg);
        }

        .materials h2 {
            text-align: center;
            font-size: 2.5rem;
            margin-bottom: 3rem;
            color: var(--color-text);
        }

        .material-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 2rem;
            margin-top: 2rem;
        }

.material-card {
            background: var(--gradient-light);
            border-radius: 15px;
            padding: 2rem;
            text-align: center;
            border: 2px solid var(--color-border);
            transition: all 0.3s ease;
            cursor: pointer;
            text-decoration: none;
        }

        .material-card:hover {
            transform: translateY(-5px);
            box-shadow: var(--shadow-blue);
        }


        .material-illustration {
            width: 100%;
            height: 150px;
            background: var(--gradient-secondary);
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 1rem;
            font-size: 3rem;
            color: white;
            font-weight: bold;
        }

 
        .material-card h3 {
            font-size: 1.5rem;
            color: var(--color-text);
            margin-bottom: 1rem;
        }

        .material-card p {
            color: var(--color-text-light);
            font-size: 1rem;
            margin-bottom: 1.5rem;
        }

/* results.css */
        .result-list {
            margin-top: 1rem;
            margin-bottom: 2rem;
        }

        .result-row {
            padding: 0.5rem 1rem;
            border-bottom: 1px solid var(--color-border);
            white-space: pre;
            display: flex;
            justify-content: flex-start;
            align-items: center;
            gap: 1rem;
            flex-wrap: wrap;
        }


        .result-word {
            font-weight: bold;
        }

        .result-mark {
            width: 50px;
            text-align: center;
            font-weight: bold;
        }

        /* writing results specific layout */
        .writing-results .result-row {
            column-gap: 30px; /* ensure drawing and word do not overlap */
        }

        .writing-results .result-mark {
            width: 250px; /* match .result-drawing width */
            flex-shrink: 0;
        }

        .result-drawing {
            width: 250px;
            height: 250px;
            object-fit: contain;
            border: 1px solid var(--color-border);
        }

@media (max-width: 768px) {
    .result-row {
        flex-direction: column;
        align-items: flex-start;
        white-space: normal;
    }

    .result-drawing {
        width: 100%;
        height: auto;
    }

    .writing-results .result-row {
        column-gap: 0;
    }

    .result-mark {
        width: 100%;
        text-align: left;
    }
}
\n/* writing.css */
.handwriting-pad {
    border: 1px solid var(--color-border);
    display: block;
    margin: 1rem auto;
    touch-action: none;
    background: #fff;
    width: 100%;
    max-width: 600px;
}

.recognized-text {
    text-align: center;
    font-size: 1.5rem;
    margin: 1rem 0;
}

.reading-box {
    background: #fff;
    border: 1px solid var(--color-border);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 10px;
    text-align: center;
    font-size: 1.2rem;
}

.canvas-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1rem auto;
}

.clear-button {
    background: var(--gradient-danger);
    color: #fff;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.clear-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-red);
}

@media (max-width: 768px) {
    .canvas-container {
        flex-direction: column;
    }

    .clear-button {
        width: 100%;
        margin-top: 0.5rem;
    }
}

@media (max-width: 768px) {
  main { flex-direction: column; gap: 1rem; }
  .sidebar { width: 100%; position: static; margin-top: 1rem; }
  .category-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.5rem; }
  .material-grid { display: grid; grid-template-columns: 1fr; gap: 0.5rem; }
  .illustration-area {
    width: 100%;
    height: auto;
    max-width: 100%;
  }
  .illustration-area img {
    width: 100%;
    height: auto;
  }
  .feature-card, .material-card, .category-card { padding: 1rem; font-size: 1rem; }
  .hero h1 { font-size: 2rem; }
  .hero p { font-size: 1rem; }
}

/* 小型デバイス（〜480px）対応強化 */
@media (max-width: 480px) {
  .hero h1 { font-size: 1.8rem; }
  .hero p { font-size: 0.9rem; }
  .feature-grid { grid-template-columns: 1fr; gap: 1rem; }
  .feature-card { padding: 1.5rem; font-size: 1rem; }
  .material-grid { grid-template-columns: 1fr; gap: 1rem; }
  .category-grid { grid-template-columns: 1fr; gap: 0.75rem; }
  .quiz-header h2 { font-size: 2rem; }
  .question-card { padding: 1.5rem; }
  .question-text { font-size: 1.2rem; }
  .nav-links a { padding: 0.75rem 1rem; }
  .sidebar { display: none; }
  .canvas-container canvas { width: 100%; height: auto; }
}

/* スマホ向け (max-width:600px) */
@media (max-width: 600px) {
  body { font-size: 14px; padding: 0 1rem; }
  .nav-menu { display: none; }
}
/* タブレット向け (601–1024px) */
@media (min-width: 601px) and (max-width: 1024px) {
  body { font-size: 16px; padding: 0 2rem; }
}
