/* --- 基本設定のインポート --- */
:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --secondary-color: #6c757d;
    --secondary-hover: #5a6268;
    --correct-color: #28a745;
    --incorrect-color: #dc3545;
    --bg-color: #ffffff;
    --panel-bg: #f8f9fa;
    --text-color: #333;
    --light-text: #666;
    --border-color: #dee2e6;
}
body {
    font-family: 'Helvetica Neue', 'Arial', 'Hirino Kaku Gothic ProN', 'Hirino Sans', 'Meiryo', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
}
.hidden { display: none !important; }

/* --- レイアウト (共通) --- */
.main-header { width: 100%; background-color: #2d3748; padding: 0 2em; box-sizing: border-box; border-bottom: 1px solid #4a5568;}
.main-nav { display: flex; gap: 1em; }
.nav-link { color: #a0aec0; text-decoration: none; padding: 1em 1.5em; font-weight: bold; border-bottom: 4px solid transparent; transition: color 0.2s; }
.nav-link:hover { color: #e2e8f0; }
.nav-link.active { border-bottom-color: var(--primary-color); color: #e2e8f0; }

.app-layout { display: flex; height: calc(100vh - 58px); }
#settings-panel { width: 320px; background-color: var(--panel-bg); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; height: 100%; }
.panel-body { padding: 1.5em; overflow-y: auto; flex-grow: 1; }
.settings-section { margin-bottom: 2em; }
.step-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1em; }
.step-label { font-weight: bold; color: var(--primary-color); margin: 0; }
.select-toggle-btn { font-size: 0.8em; padding: 4px 10px; border-radius: 5px; border: 1px solid var(--primary-color); background-color: white; color: var(--primary-color); cursor: pointer; transition: all 0.2s ease; }
.select-toggle-btn:hover { background-color: var(--primary-color); color: white; }
.selection-grid { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.category-btn { padding: 12px 8px; border: 2px solid var(--border-color); background: white; border-radius: 8px; cursor: pointer; font-size: 0.8em; transition: all 0.2s ease; }
.category-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.category-btn.selected { background-color: var(--primary-color); color: white; font-weight: bold; border-color: var(--primary-color); }
.action-btn { width: 100%; padding: 15px; font-size: 1.1em; font-weight: bold; border: none; border-radius: 8px; cursor: pointer; transition: all 0.2s ease; margin-bottom: 10px; }
.action-btn.primary { background-color: var(--primary-color); color: white; }
.action-btn.primary:hover { background-color: var(--primary-hover); }
.action-btn.secondary { background-color: var(--secondary-color); color: white; }
.action-btn.secondary:hover { background-color: var(--secondary-hover); }

#main-content { flex-grow: 1; padding: 2em 3em; overflow-y: auto; height: 100%; box-sizing: border-box; }
.main-actions { max-width: 400px; margin: 2em auto 3em; }

/* --- モード選択ボタン --- */
#mode-selector { display: flex; justify-content: center; margin-bottom: 2em; border-bottom: 1px solid var(--border-color); }
.mode-btn { padding: 0.8em 1.5em; border: none; background: none; font-size: 1.1em; font-weight: bold; color: var(--light-text); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.mode-btn.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }

/* --- 単語帳モード --- */
#flashcard-container { height: 300px; perspective: 1000px; }
.flashcard { position: relative; width: 100%; height: 100%; cursor: pointer; transform-style: preserve-3d; transition: transform 0.6s; }
.flashcard.is-flipped { transform: rotateY(180deg); }
.card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; justify-content: center; align-items: center; border: 1px solid var(--border-color); border-radius: 12px; background-color: white; box-shadow: 0 4px 15px rgba(0,0,0,0.08); }
.card-back { transform: rotateY(180deg); }
.card-face .ja { font-size: 2.5em; font-weight: bold; }
.card-face .en { font-size: 2em; font-weight: bold; color: var(--primary-color); }
.speaker-btn { background: none; border: none; font-size: 1.5em; cursor: pointer; margin-top: 10px; color: var(--secondary-color); }
#flashcard-nav { display: flex; justify-content: space-between; align-items: center; max-width: 500px; margin: 1.5em auto 0; }
#card-counter { font-size: 1em; color: var(--light-text); }
.nav-arrow-btn { font-size: 2em; padding: 0 20px; border-radius: 50%; border: none; background-color: #f8f9fa; color: var(--secondary-color); cursor: pointer; }
.nav-arrow-btn:hover { background-color: #e2e6ea; }

/* --- テストモード --- */
#test-view { max-width: 700px; margin: 0 auto; }
#test-question-counter { text-align: right; font-weight: bold; color: var(--light-text); }
#test-question-text { font-size: 2em; margin: 1em 0; text-align: center; font-weight: bold; }
#test-answer-options .choice-btn { display: block; width: 100%; padding: 15px; margin-bottom: 10px; font-size: 1.1em; border: 2px solid var(--border-color); border-radius: 8px; background-color: white; cursor: pointer; transition: all 0.2s ease; }
#test-answer-options .choice-btn:hover { border-color: var(--primary-color); }
#test-answer-options .choice-btn.selected { background-color: #e0f7ff; border-color: var(--primary-color); }
#test-feedback-area { margin-top: 1.5em; font-size: 1.2em; font-weight: bold; text-align: center; }
.correct { color: var(--correct-color); }
.incorrect { color: var(--incorrect-color); }
.incorrect-answer { color: var(--text-color); font-size: 1em; font-weight: normal; margin-top: 0.5em; }
.quiz-action-btn { background-color: var(--primary-color); color: white; border: none; padding: 12px 25px; font-size: 1em; border-radius: 8px; cursor: pointer; transition: background-color 0.2s ease; margin-top: 1em; }

/* --- 結果表示 --- */
#result-view { text-align: center; padding-top: 3em; }
#result-view h2 { font-size: 2em; }
#score-text { font-size: 1.5em; margin: 1em 0; }
#result-message { font-size: 1.2em; color: var(--light-text); }
#restart-btn { font-size: 1.1em; padding: 15px 30px; margin-top: 2em; background-color: var(--primary-color); color: white; border: none; border-radius: 8px; cursor: pointer; }

/* --- フッター --- */
#credit-footer { margin-top: 4em; padding-top: 1.5em; border-top: 1px solid var(--border-color); text-align: center; font-size: 0.8em; color: var(--light-text); }
#credit-footer a { color: var(--primary-color); text-decoration: none; }
#credit-footer a:hover { text-decoration: underline; }
/* --- スマートフォン対応 (レスポンシブ) --- */
@media (max-width: 768px) {
    body {
        overflow-y: auto; /* ページ全体のスクロールを許可 */
    }

    .app-layout {
        flex-direction: column; /* 2列レイアウトを縦1列に */
        height: auto;
    }

    #settings-panel {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    #main-content {
        padding: 1.5em; /* 余白を調整 */
    }

    #flashcard-container {
        height: 250px; /* カードの高さを調整 */
    }
    .card-face .ja { font-size: 2em; }
    .card-face .en { font-size: 1.8em; }

    #test-question-text {
        font-size: 1.5em;
    }
}