/* 基本設定 */
body {
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    line-height: 1.8;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
    color: #343a40;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 90%;
    max-width: 900px;
    margin: 20px auto;
    padding: 25px;
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    flex-grow: 1;
}

/* ヘッダー */
header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: #ffffff;
    padding: 1.5rem 0;
    text-align: center;
    border-bottom: 5px solid #004085;
}

header h1 {
    margin: 0;
    font-size: 2.8rem;
    font-weight: bold;
    letter-spacing: 1px;
}

/* ナビゲーション（主にページ下部で使用） */
.page-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

.page-navigation a {
    text-decoration: none;
    color: #007bff;
    padding: 10px 18px;
    border: 1px solid #007bff;
    border-radius: 5px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.page-navigation a:hover {
    background-color: #007bff;
    color: #ffffff;
}

.page-navigation .disabled {
    color: #adb5bd;
    border-color: #adb5bd;
    pointer-events: none;
}


/* メインコンテンツ */
main h2 {
    color: #0056b3;
    border-bottom: 2px solid #007bff;
    padding-bottom: 8px;
    margin-top: 30px;
    margin-bottom: 20px;
    font-size: 2rem;
}

main h3 {
    color: #0067cc;
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.6rem;
    border-left: 5px solid #007bff;
    padding-left: 10px;
}

p {
    margin-bottom: 1.2em;
    font-size: 1.05rem;
}

ul, ol {
    margin-bottom: 1.2em;
    padding-left: 25px;
}

li {
    margin-bottom: 0.5em;
}

/* キーワード・専門用語 */
.keyword {
    font-weight: bold;
    color: #d63384; /* ピンク系 */
    cursor: pointer;
    display: inline-block; /* 読み上げのため */
}
.keyword:hover {
    text-decoration: underline;
}


/* 例文 */
.example {
    background-color: #e9ecef;
    border-left: 5px solid #007bff;
    padding: 15px;
    margin: 20px 0;
    border-radius: 5px;
}

.example-sentence {
    font-style: italic;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.example-sentence-english { /* 英語例文に適用 */
    cursor: pointer;
    display: inline-block;
}
.example-sentence-english:hover {
    text-decoration: underline;
    color: #0056b3;
}


.translation {
    color: #495057;
    font-size: 0.95rem;
}

/* コードブロック */
.code-block {
    position: relative;
    background-color: #282c34; /* ダークテーマ */
    color: #abb2bf; /* やや明るいグレー */
    padding: 20px;
    margin: 20px 0;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    font-size: 0.95em;
    line-height: 1.5;
}

.code-block pre {
    margin: 0;
    padding: 0;
    white-space: pre;
}

.copy-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #6c757d;
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.85em;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.code-block:hover .copy-button {
    opacity: 1;
}

.copy-button:hover {
    background-color: #5a6268;
}

/* JSアプリコンテナ */
.js-app-container {
    border: 1px solid #ced4da;
    padding: 25px;
    margin: 25px 0;
    background-color: #f8f9fa;
    border-radius: 6px;
}

.js-app-container h4 {
    margin-top: 0;
    color: #0056b3;
    font-size: 1.4rem;
}

/* クイズアプリ */
.quiz-container {
    border: 1px solid #dee2e6;
    padding: 25px;
    margin-top: 25px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.quiz-question {
    font-size: 1.25rem;
    margin-bottom: 15px;
    font-weight: 500;
}

.quiz-options button {
    display: block;
    width: 100%;
    padding: 12px;
    margin-bottom: 8px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-align: left;
    font-size: 1rem;
    transition: background-color 0.2s ease;
}

.quiz-options button:hover {
    background-color: #0056b3;
}

.quiz-options button.correct {
    background-color: #28a745; /* 緑 */
}

.quiz-options button.incorrect {
    background-color: #dc3545; /* 赤 */
}


.quiz-feedback {
    margin-top: 15px;
    font-weight: bold;
    padding: 10px;
    border-radius: 4px;
}

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

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


/* 目次スタイル */
.toc ul {
    list-style-type: none;
    padding-left: 0;
}
.toc > ul > li {
    margin-bottom: 15px;
}
.toc > ul > li > span { /* 章タイトル */
    font-weight: bold;
    font-size: 1.3rem;
    color: #0056b3;
    display: block;
    margin-bottom: 5px;
}
.toc ul ul {
    list-style-type: disc;
    padding-left: 20px;
    margin-top: 5px;
}
.toc ul ul li {
    margin-bottom: 8px;
}
.toc a {
    text-decoration: none;
    color: #007bff;
    font-size: 1.05rem;
}
.toc a:hover {
    text-decoration: underline;
    color: #0056b3;
}


/* 英単語リスト */
.vocabulary-list {
    margin-top: 40px;
    padding-top: 25px;
    border-top: 1px solid #dee2e6;
}

.vocabulary-list h3 {
    font-size: 1.5rem;
    color: #0056b3;
    margin-bottom: 15px;
}

.vocabulary-item {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #e0e0e0;
}
.vocabulary-item:last-child {
    border-bottom: none;
}

.vocabulary-item .term-container {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.vocabulary-item strong {
    font-size: 1.15rem;
    margin-right: 8px;
}

.vocabulary-item .term { /* 英語の単語自体 */
    cursor: pointer;
    color: #d63384;
    font-weight: bold;
}
.vocabulary-item .term:hover {
    text-decoration: underline;
}

.vocabulary-item .meaning {
    font-size: 1rem;
    color: #343a40;
    margin-left: 5px; /* strongとの間隔 */
}

.vocabulary-item .example-sentence-container {
    margin-top: 8px;
    padding-left: 15px;
    border-left: 3px solid #007bff;
}

.vocabulary-item .example-sentence-english {
    font-style: italic;
    color: #007bff;
    display: block; /* 例として改行させる */
    margin-bottom: 3px;
}

.vocabulary-item .example-translation {
    font-size: 0.9rem;
    color: #495057;
}

/* フッター */
footer {
    text-align: center;
    padding: 20px;
    background-color: #343a40;
    color: #f8f9fa;
    margin-top: auto; /* ページ内容が少なくてもフッターを最下部に固定 */
}
footer p {
    margin: 0;
    font-size: 0.9rem;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 20px;
    }

    header h1 {
        font-size: 2.2rem;
    }

    main h2 {
        font-size: 1.8rem;
    }
    main h3 {
        font-size: 1.4rem;
    }

    .page-navigation {
        flex-direction: column;
    }

    .page-navigation a {
        margin-bottom: 10px;
        text-align: center;
    }
    .page-navigation a:last-child {
        margin-bottom: 0;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    .code-block {
        font-size: 0.85em;
        padding: 15px;
    }
    .copy-button {
        padding: 4px 8px;
        font-size: 0.75em;
    }
    .js-app-container {
        padding: 15px;
    }
}

/* style.css の既存のコードに追加または修正 */

/* ヘッダー */
header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: #ffffff;
    padding: 1rem 0; /* 上下のpaddingを少し調整 */
    text-align: center;
    border-bottom: 5px solid #004085;
}

header h1 {
    margin: 0 0 10px 0; /* 下に少しマージンを追加 */
    font-size: 2.5rem; /* 少し調整 */
    font-weight: bold;
    letter-spacing: 1px;
}

/* ヘッダーナビゲーション */
.header-nav {
    background-color: rgba(0, 0, 0, 0.2); /* 少し背景色をつけて区別 */
    padding: 0.5rem 0;
    margin-top: 10px; /* h1との間にマージン */
}

.header-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: center;
}

.header-nav ul li {
    display: inline-block; /* 横並び */
    margin: 0 15px; /* リンク間のマージン */
}

.header-nav ul li a {
    color: #ffffff;
    text-decoration: none;
    font-size: 1rem; /* 文字サイズ調整 */
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.header-nav ul li a:hover,
.header-nav ul li a.active { /* 現在地を示すスタイル */
    background-color: rgba(255, 255, 255, 0.2);
    text-decoration: none;
}


/* --- レスポンシブ調整 (ヘッダーナビゲーション) --- */
@media (max-width: 768px) {
     header h1 {
        font-size: 2rem; /* スマホでは小さめに */
    }
    .header-nav ul li {
        display: block; /* 縦並びにする */
        margin: 8px 0; /* 上下のマージン */
    }
     .header-nav {
         padding: 0.3rem 0;
     }
}

/* --- 既存のスタイル ... --- */
footer a {
    color: #66bb6a; /* Light Green Link */
    text-decoration: none;
    transition: color 0.2s ease;
}

footer a:hover {
    color: #81c784; /* Brighter Green Link */
    text-decoration: underline;
}
