:root {
    --primary-color: #5D79C1FF; /* クリスマスレッド */
    --secondary-color: #2ecc71; /* クリスマスグリーン */
    --text-color: #34495e;
    --background-color: #ecf0f1;
    --border-color: #ccc;
    --progress-bar-color: #1ECB2DFF; /* ゴールド */
}

/* ページ全体のスクロールを禁止 */
html {
    height: 100%;
}
body {
    font-family: 'Arial', 'メイリオ', Meiryo, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    height: 100%; /* 高さを100%に */
    display: flex;
    flex-direction: column; /* 上からヘッダー、メイン、フッターの順に並べる */
    overflow: hidden; /* ページ全体のスクロールを禁止 */
}

header {
    background-color: #fff;
    padding: 15px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0; /* ヘッダーが縮まないように */
    z-index: 10;
}

header h1 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.8em;
}

.controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s ease-in-out;
}

.menu-toggle span {
    display: block;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 2px;
    transition: transform 0.3s ease;
}

.menu-toggle:hover,
.menu-toggle:focus-visible {
    background-color: rgba(93, 121, 193, 0.1);
    outline: none;
}

.progress-status {
    font-weight: bold;
    color: var(--primary-color);
}

.progress-container {
    width: 150px;
    height: 10px;
    background-color: #ddd;
    border-radius: 5px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--progress-bar-color);
    border-radius: 5px;
    transition: width 0.3s ease-in-out;
}

ruby {
    ruby-position: over;
}

rt {
    font-size: 0.6em;
    color: #7f8c8d;
    letter-spacing: 0.05em;
}

.question-point {
    margin-top: 20px;
    padding: 12px 16px;
    background-color: rgba(241, 196, 15, 0.2);
    border-left: 4px solid var(--primary-color);
    border-radius: 6px;
    font-weight: bold;
}

/* メインコンテンツエリア（スライドが表示される場所）*/
main {
    flex-grow: 1; /* ヘッダーとフッター以外の高さいっぱいを占める */
    position: relative; /* スライドを重ねる基準点 */
    overflow: hidden; /* メイン領域のスクロール禁止 */
}

.lesson-step {
    display: none; /* デフォルトでは非表示 */
    position: absolute; /* スライドを重ねる */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff;
    gap: 30px;
    padding: 20px;
    box-sizing: border-box; /* paddingを含めて高さ100% */
}

/* 表示中のスライド */
.lesson-step.active {
    display: flex; 
}

/* 左側：画像エリア */
.image-area {
    flex: 7;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f8f8f8;
    border-radius: 5px;
    overflow: hidden;
    height: 100%;
}

.scratch-screen-img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: contain; /* アスペクト比を保って収める */
}

/* 右側：説明エリア */
.text-area {
    flex: 3;
    overflow-y: auto; /* 説明が長い場合、ここだけスクロール */
    height: 100%;
    padding: 0 15px;
}

.step-header {
    margin-bottom: 20px;
}
.step-count {
    display: block;
    font-size: 1.1em;
    font-weight: bold;
    color: var(--secondary-color);
    margin-bottom: 5px;
}
.text-area h2 {
    color: var(--primary-color);
    font-size: 1.6em;
    margin-top: 0;
}
.download-section {
    margin-bottom: 15px;
}

.download-link {
    display: inline-block;
    padding: 8px 16px;
    background-color: var(--secondary-color);
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.2s ease-in-out;
}

.download-link:hover {
    background-color: #27ae60;
}
.text-area p {
    margin-bottom: 15px;
    font-size: 1.1em;
}

.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    z-index: 90;
}

.drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.drawer {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 260px;
    background-color: #fff;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
    overflow: hidden;
}

.drawer.open {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.drawer-header h2 {
    margin: 0;
    font-size: 1.4em;
    color: var(--primary-color);
}

.drawer-close {
    background: transparent;
    border: none;
    font-size: 1.6em;
    line-height: 1;
    cursor: pointer;
    color: var(--primary-color);
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease-in-out;
}

.drawer-close:hover,
.drawer-close:focus-visible {
    background-color: rgba(93, 121, 193, 0.1);
    outline: none;
}

.drawer-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
    padding-bottom: 30px;
    min-height: 0;
}

.drawer-link {
    width: 100%;
    text-align: left;
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

.drawer-link:hover,
.drawer-link:focus-visible {
    background-color: rgba(93, 121, 193, 0.1);
    border-color: var(--primary-color);
    outline: none;
}

.drawer-link.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* フッター：ナビゲーションボタン */
.navigation-controls {
    flex-shrink: 0; /* フッターが縮まないように */
    background-color: #fff;
    border-top: 1px solid var(--border-color);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.nav-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    transition: background-color 0.3s ease;
}
.nav-button:hover {
    background-color: #2B35C0FF; /* 少し暗い赤 */
}
/* 無効化されたボタン */
.nav-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* レスポンシブ対応 (スマホでは上下配置) */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 10px;
        padding: 10px 15px;
    }
    .menu-toggle {
        align-self: flex-start;
    }
    .controls {
        width: 100%;
        justify-content: space-between;
    }
    .lesson-step {
        flex-direction: column; /* 上下に配置 */
        padding: 10px;
        gap: 10px;
    }
    .image-area {
        flex: none;
        height: 40%; /* 高さを指定 (例: 40%) */
        width: 100%;
        min-height: 200px;
    }
    .text-area {
        flex: none;
        height: 60%; /* 残りの高さ */
        width: 100%;
        padding: 0 5px;
    }
    .navigation-controls {
        padding: 10px 15px;
    }
    .nav-button {
        padding: 8px 15px;
        font-size: 1em;
    }
    .drawer {
        width: min(80%, 320px);
    }
}