/* --- START OF FILE style.css --- */

/* 基本スタイル */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: #f0f0f0;
    display: flex; /* 中央揃えのため */
    justify-content: center; /* 中央揃えのため */
    align-items: flex-start; /* 上端揃え */
    min-height: 100vh;
    padding: 20px 0; /* 上下に余白 */
    box-sizing: border-box;
}

.screen {
    width: 100%; /* 横幅いっぱい */
    max-width: 400px; /* スマホ画面幅を想定 */
    background-color: #fff;
    border: 1px solid #ccc;
    min-height: 700px; /* 高さを確保 */
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column; /* 子要素を縦に並べる */
    overflow: hidden; /* はみ出しを隠す */
    position: relative; /* Correct Effectの基準になるかも */
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background-color: #f8f8f8;
    border-bottom: 1px solid #eee;
    flex-shrink: 0; /* ヘッダーが縮まないように */
}

.header .menu-btn, .header .action-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    color: #007bff; /* ボタンの色も少し設定 */
}
.header .menu-btn:active, .header .action-btn:active {
    opacity: 0.7;
}


.header .action-btn {
    /* 右上のボタンのデザイン例 (不要なら削除) */
    /* visibility: hidden; */ /* 表示しない場合はこれ */
    width: 30px; /* サイズ調整 */
    height: 30px;
    color: #007bff; /* アイコンの色 */
    /* background-color: #007bff; */ /* 背景色なし */
    /* border-radius: 50%; */
    /* padding: 0; */
    /* 必要ならアイコンや文字を配置 */
}


.header .title {
    font-size: 18px;
    font-weight: bold;
    margin: 0;
    text-align: center;
    flex-grow: 1; /* 中央に配置するために */
    padding: 0 5px; /* 左右ボタンとの間隔 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

main {
    padding: 15px;
    flex-grow: 1; /* 残りの高さを埋める */
    overflow-y: auto; /* 内容が多い場合にスクロール */
}

/* List Styles */
ul.list {
    list-style: none;
    padding: 0;
    margin: 0;
}

li.list-item {
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0; /* paddingはボタン側で調整 */
}
li.list-item:last-child {
    border-bottom: none;
}

/* ListItemをボタンとして使えるように */
.list-item-button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 15px;
    text-decoration: none;
    color: inherit;
    background-color: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
}
.list-item-button:hover {
    background-color: #f9f9f9;
}

.list-item-content {
    display: flex;
    align-items: center;
    flex-grow: 1; /* テキスト部分が幅を取るように */
    margin-right: 10px; /* 矢印とのスペース */
    overflow: hidden; /* はみ出し防止 */
}

.list-item-icon {
    margin-right: 12px;
    font-size: 22px;
    color: #007bff; /* アイコンの色 */
    width: 24px; /* 幅を固定して揃える */
    text-align: center;
    flex-shrink: 0;
}

.list-item-text {
    overflow: hidden; /* はみ出し防止 */
}


.list-item-text h3 {
    font-size: 16px;
    margin: 0 0 4px 0;
    font-weight: 500;
    white-space: nowrap; /* 長いタイトルを省略 */
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-text p {
    font-size: 13px;
    color: #777;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-arrow {
    color: #ccc;
    font-size: 20px;
    flex-shrink: 0; /* 矢印が縮まないように */
}

/* Learning Screen Card */
.card {
    background-color: #fff;
    padding: 30px 20px; /* 少し調整 */
    border-radius: 12px; /* 少し調整 */
    border: 1px solid #eee; /* 境界線を追加 */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    text-align: center;
    margin: 15px 0; /* 少し調整 */
    min-height: 180px; /* 少し調整 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; /* 中央揃え */
    cursor: pointer; /* タップ可能を示す */
    transition: background-color 0.2s; /* 背景色変更アニメーション */
}
.card:active {
    background-color: #f0f0f0; /* タップ時のフィードバック */
}

.card p.main-text {
    margin: 0;
    line-height: 1.7; /* 行間調整 */
    font-size: 16px;
    max-width: 100%; /* はみ出し防止 */
}
.card p.answer-text {
    margin-top: 15px;
    font-size: 18px;
    font-weight: bold;
    color: #007bff;
    max-width: 100%; /* はみ出し防止 */
}
.tap-to-show {
    text-align: center;
    color: #888;
    font-size: 14px;
    margin-top: 10px;
    cursor: pointer; /* タップ可能を示す */
    padding: 5px; /* タップしやすく */
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0 5px 0; /* 下の余白を少し減らす */
    flex-shrink: 0; /* 縮まないように */
}
.pagination button {
    background: none;
    border: none;
    font-size: 30px;
    color: #007bff;
    cursor: pointer;
    padding: 5px 15px; /* タップしやすく */
    border-radius: 8px; /* 視覚的フィードバック用 */
    transition: background-color 0.2s;
}
.pagination button:active:not(:disabled) {
     background-color: rgba(0, 123, 255, 0.1); /* タップフィードバック */
}

.pagination button:disabled {
    color: #ccc;
    cursor: default;
}
.pagination span {
    font-size: 16px;
    font-weight: 500;
}

/* Settings Screen */
.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.settings-item span {
    flex-grow: 1;
    padding-left: 12px; /* アイコンとのスペース */
}

/* Toggle Switch (簡易版) */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0; /* 縮まないように */
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 24px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: #007bff;
}
input:checked + .slider:before {
    transform: translateX(26px);
}

.section-title {
    color: #666; /* 少し濃く */
    font-size: 14px;
    font-weight: 500;
    margin: 20px 0 8px 0;
    padding-left: 15px;
}

.logout {
    color: red;
    font-weight: bold;
}

/* Input Screen */
.input-area {
    text-align: center;
    padding-top: 40px; /* ヘッダーがない場合の余白 */
}
.input-area h2 {
    font-size: 20px; /* 少し大きく */
    font-weight: bold;
    margin-bottom: 25px;
    line-height: 1.4;
}
.input-area input[type="text"] {
    width: calc(100% - 44px); /* 左右padding分引く */
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 20px;
    box-sizing: border-box;
}
.input-area .generate-button {
    background-color: #ff3b30; /* iOS風の赤 */
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    display: inline-flex; /* アイコンとテキストを横並び */
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px auto;
    transition: background-color 0.2s, opacity 0.2s;
}
.input-area .generate-button:hover {
    background-color: #e03024;
}
.input-area .generate-button:disabled {
    background-color: #ff3b30; /* 色は変えず */
    opacity: 0.6; /* 薄くする */
    cursor: not-allowed;
}
.input-area .generate-button .button-text {
    /* display: inline-block; */ /* 縦中央揃えのためFlexで十分 */
}
.input-area .generate-button .icon { /* 再生ボタン風アイコン */
    margin-left: 8px;
    font-size: 14px;
}
.input-area .loading-spinner {
    /* Spinnerは下の共通スタイルで定義 */
}
@keyframes spin {
    to { transform: rotate(360deg); }
}


.image-placeholder {
    width: 85%; /* 画面幅に対する割合 */
    max-width: 300px; /* 最大幅 */
    aspect-ratio: 16 / 9; /* 縦横比 */
    background-color: #e9e9e9;
    border: 1px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    margin: 0 auto;
    border-radius: 10px;
    overflow: hidden; /* 画像表示用 */
}
.image-placeholder img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.error-message {
    color: red;
    font-size: 13px;
    margin-top: -15px; /* ボタンとの間を詰める */
    margin-bottom: 15px;
    min-height: 1em; /* エラーなくても高さを確保 */
    text-align: center; /* 中央揃え */
    padding: 0 15px; /* 左右に余白 */
}
/* static/style.css に追加 */

/* --- フッターナビゲーション --- */
.footer-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #f8f8f8;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-around;
    padding: 4px 0 calc(env(safe-area-inset-bottom, 0px) + 8px) 0; /* iPhone下部対応 + 少し余白 */
    box-shadow: 0 -1px 4px rgba(0,0,0,0.08);
    z-index: 100; /* Correct Effectより下 */
}

.footer-nav button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 10px;
    color: #888; /* 非アクティブ時の色 */
    flex-grow: 1; /* ボタンが均等に幅を取るように */
    transition: color 0.2s ease;
}
.footer-nav button:active {
    opacity: 0.7;
}

.footer-nav .nav-icon {
    font-size: 22px;
    margin-bottom: 2px;
}

.footer-nav button.active {
    color: #007bff; /* アクティブ時の色 (例: 青) */
}

/* --- main要素の底上げ --- */
/* フッターにコンテンツが隠れないように */
main {
   padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 80px); /* フッターの高さ + iPhone下部 + 余白 */
}

/* --- ローディングスピナー (共通) --- */
.loading-spinner {
    border: 3px solid rgba(0, 0, 0, 0.1); /* generate button以外でのデフォルト */
    border-left-color: #007bff; /* デフォルトの色 */
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
    display: inline-block; /* ボタン内で表示 */
    margin-right: 8px; /* ボタンテキストとの間隔 */
    vertical-align: middle;
}
/* input.html の generate-button 内のスピナー */
.generate-button .loading-spinner {
    border-color: rgba(255, 255, 255, 0.3);
    border-left-color: #fff;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- learning.html のローディング（簡易版）--- */
/* 必要であれば .loading-indicator-large などを定義 */
#mode-indicator.loading {
    color: #888;
}

/* --- learning.html の解答ボタン スタイル --- */
.option-button {
    display: block;
    width: calc(100% - 20px); /* 左右の余白を考慮 */
    margin: 10px auto; /* 中央寄せ */
    padding: 15px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background-color: #fff;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, opacity 0.2s;
    text-align: left; /* テキスト左寄せ */
}
.option-button:hover:not(:disabled) {
     background-color: #f0f0f0;
}
.option-button:active:not(:disabled) {
    background-color: #e0e0e0;
}


.option-button.correct {
    background-color: #d4edda; /* 緑系 */
    color: #155724;
    border-color: #c3e6cb;
    font-weight: bold; /* 正解を強調 */
}

.option-button.incorrect { /* 不正解を選んだ場合のスタイル */
    background-color: #f8d7da; /* 赤系 */
    color: #721c24;
    border-color: #f5c6cb;
    opacity: 0.8; /* 少し薄く */
}

.option-button:disabled { /* 正解・不正解表示後の状態 */
    cursor: default;
    opacity: 0.7; /* すべての無効ボタンを少し薄く */
}
.option-button.correct:disabled {
    opacity: 1; /* 正解ボタンは薄くしない */
}
.option-button.incorrect:disabled {
     opacity: 0.7; /* 不正解ボタンは薄くする */
}
/* 選ばれなかった他の選択肢（不正解）のスタイル */
.option-button.other-disabled:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    border-color: #ced4da;
    opacity: 0.6;
}


/* --- ★★★ 正解エフェクトのスタイルを追加 ★★★ --- */
.correct-effect {
    position: fixed; /* 画面に固定 */
    top: 45%; /* 少し上に調整 (フッターを考慮) */
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8); /* 中央揃え & 少し小さめから開始 */
    font-size: 15rem; /* 〇の大きさ */
    color: rgba(0, 190, 0, 0.8); /* 〇の色 (例: 少し透明な明るい緑) */
    font-weight: bold;
    display: none; /* 初期状態では非表示 */
    align-items: center;
    justify-content: center;
    z-index: 1001; /* フッターより手前に表示 */
    opacity: 0; /* 初期状態では透明 */
    transition: opacity 0.3s ease-out, transform 0.3s ease-out; /* フェードインと拡大のアニメーション */
    pointer-events: none; /* エフェクトがクリック操作を妨げないように */
    width: 20rem; /* 幅と高さを指定 */
    height: 20rem;
    /* background-color: rgba(255, 255, 255, 0.1); */ /* 必要なら背景 */
    /* border-radius: 50%; */ /* 円形背景にしたい場合 */
    line-height: 1; /* 〇の縦位置調整 */
}

/* エフェクト表示時のスタイル */
.correct-effect.show {
    display: flex; /* 表示状態にする (flexで中央揃え) */
    opacity: 1; /* 不透明にする */
    transform: translate(-50%, -50%) scale(1); /* 元のサイズに戻す */
}
/* --- ★★★ ここまで追加 ★★★ --- */


/* --- ダークモード用スタイル (一部) --- */
body.dark-mode {
    background-color: #121212;
    color: #e0e0e0;
}
body.dark-mode .screen { background-color: #1e1e1e; border-color: #333; }
body.dark-mode .header { background-color: #1f1f1f; border-bottom-color: #333; }
body.dark-mode .header .title, body.dark-mode .header .menu-btn, body.dark-mode .header .action-btn { color: #e0e0e0; }
body.dark-mode .footer-nav { background-color: #1f1f1f; border-top-color: #333; }
body.dark-mode .footer-nav button { color: #888; }
body.dark-mode .footer-nav button.active { color: #58a6ff; } /* ダークモードでのアクティブ色 */
body.dark-mode .card { background-color: #2c2c2c; border-color: #444; color: #e0e0e0; }
body.dark-mode .card:active { background-color: #3a3a3a; }
body.dark-mode .list-item-button:hover { background-color: #3a3a3a; }
body.dark-mode li.list-item { border-bottom-color: #444; }
body.dark-mode .list-item-text h3 { color: #e0e0e0; }
body.dark-mode .list-item-text p { color: #aaa; }
body.dark-mode .list-arrow { color: #aaa; }
body.dark-mode .settings-item span { color: #e0e0e0; }
body.dark-mode .section-title { color: #aaa; }
body.dark-mode input[type="text"] { background-color: #333; border-color: #555; color: #e0e0e0; }
body.dark-mode .generate-button { background-color: #e53e3e; color: white; } /* 少し調整した赤 */
body.dark-mode .generate-button:hover { background-color: #c53030; }
body.dark-mode .generate-button:disabled { background-color: #e53e3e; opacity: 0.6; }
body.dark-mode .error-message { color: #ff7f7f; }
body.dark-mode .option-button { background-color: #444; color: #e0e0e0; border-color: #666; }
body.dark-mode .option-button:hover:not(:disabled) { background-color: #555; }
body.dark-mode .option-button:active:not(:disabled) { background-color: #666; }
body.dark-mode .option-button.correct { background-color: #2a6831; color: #e0e0e0; border-color: #41984b; }
body.dark-mode .option-button.incorrect { background-color: #8b3a3e; color: #ffdddd; border-color: #a85055; opacity: 0.8; }
body.dark-mode .option-button.other-disabled:disabled { background-color: #333; color: #888; border-color: #555; opacity: 0.6; }
body.dark-mode .pagination button { color: #58a6ff; }
body.dark-mode .pagination button:active:not(:disabled) { background-color: rgba(88, 166, 255, 0.15); }
body.dark-mode .pagination button:disabled { color: #666; }
body.dark-mode .tap-to-show { color: #aaa; }
body.dark-mode .mode-indicator { color: #bbb; }
body.dark-mode .toggle-switch .slider { background-color: #555; }
body.dark-mode .toggle-switch input:checked + .slider { background-color: #58a6ff; }
/* ダークモードの正解エフェクトの色 */
body.dark-mode .correct-effect { color: rgba(50, 220, 50, 0.85); }

/* --- END OF FILE style.css --- */
/* --- START OF FILE style.css (追記部分) --- */

/* --- サイドメニュー --- */
.side-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px; /* メニューの幅 */
    height: 100%;
    background-color: #ffffff; /* メニューの背景色 */
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    transform: translateX(-100%); /* 初期状態は画面外（左側） */
    transition: transform 0.3s ease-in-out;
    z-index: 1100; /* オーバーレイより手前 */
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* メニュー項目が多い場合にスクロール */
}

.side-menu.open {
    transform: translateX(0); /* 表示状態 */
}

.side-menu h2 {
    margin-top: 30px; /* 閉じるボタンとのスペース */
    margin-bottom: 20px;
    font-size: 20px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.side-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}

.side-menu li {
    margin-bottom: 5px;
}

.side-menu li button {
    background: none;
    border: none;
    padding: 12px 10px;
    width: 100%;
    text-align: left;
    font-size: 16px;
    color: #333;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s;
    display: flex; /* アイコンとテキストのため */
    align-items: center;
}
.side-menu li button:hover {
    background-color: #f0f0f0;
}
.side-menu li button:active {
    background-color: #e0e0e0;
}

.side-menu li hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 15px 0;
}

.side-menu .logout-menu-item {
    color: red; /* ログアウトは赤字 */
}
.side-menu .logout-menu-item:hover {
     background-color: rgba(255, 0, 0, 0.05);
}


.close-menu-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 30px;
    font-weight: bold;
    color: #888;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}
.close-menu-btn:hover {
    color: #333;
}

/* --- メニューオーバーレイ --- */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* 半透明の黒 */
    opacity: 0;
    visibility: hidden; /* 初期状態は非表示 */
    transition: opacity 0.3s ease-in-out, visibility 0s 0.3s; /* visibilityは遅延させる */
    z-index: 1050; /* サイドメニューより下、他コンテンツより上 */
}

.menu-overlay.open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease-in-out, visibility 0s 0s; /* 表示時は遅延なし */
}

/* --- メニュー表示中に背景をスクロールさせない (任意) --- */
body.menu-open {
    overflow: hidden; /* bodyのスクロールを禁止 */
}

/* --- ダークモード用サイドメニュー (追記) --- */
body.dark-mode .side-menu {
    background-color: #2c2c2c; /* ダークモードの背景色 */
    box-shadow: 2px 0 5px rgba(0,0,0,0.3);
}
body.dark-mode .side-menu h2 {
    color: #e0e0e0;
    border-bottom-color: #444;
}
body.dark-mode .side-menu li button {
    color: #e0e0e0;
}
body.dark-mode .side-menu li button:hover {
    background-color: #3a3a3a;
}
body.dark-mode .side-menu li button:active {
    background-color: #4a4a4a;
}
body.dark-mode .side-menu li hr {
    border-top-color: #444;
}
body.dark-mode .close-menu-btn {
    color: #aaa;
}
body.dark-mode .close-menu-btn:hover {
    color: #e0e0e0;
}
body.dark-mode .side-menu .logout-menu-item {
    color: #ff7f7f; /* ダークモードでの赤 */
}
body.dark-mode .side-menu .logout-menu-item:hover {
     background-color: rgba(255, 80, 80, 0.1);
}


/* --- END OF FILE style.css (追記部分) --- */