* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #232526 0%, #414345 100%);
    color: #eee;
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    min-height: 100vh;
}

body .container {
    background: none;
}

body header {
    background: rgba(30, 30, 30, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    position: relative;
}

body h1 {
    color: #fff;
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 0 2px 8px #000a;
}

body .progress-bar {
    background: rgba(255, 255, 255, 0.08);
}

body .stats {
    color: #eee;
    font-size: 1.1rem;
    font-weight: 500;
}

body .word-card {
    background: #23272e;
    color: #eee;
    box-shadow: 0 20px 40px #0006;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    min-height: 300px;
    padding: 40px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    animation: fadeIn 0.2s ease;
    margin: 0 auto;
    /* 水平方向の中央配置を追加 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* 垂直方向の中央配置を追加 */
}

body .word-type {
    color: #bbb;
    font-size: 1rem;
    margin-bottom: 20px;
    font-weight: 500;
}

body .word-display,
body .answer-display,
#mcWordDisplay {
    color: #fff;
    font-size: 2.5rem;
    font-weight: bold;
    margin: 30px 0;
    line-height: 1.2;
    font-family: "UD デジタル 教科書体 N-R", "UD Digi Kyokasho N-R", "游教科書体", "Yu Kyokasho", "メイリオ", Meiryo, sans-serif;
}

body .word-display.kanji,
body .answer-display.kanji,
#mcWordDisplay.kanji {
    font-weight: 400;
}

body .answer-display {
    color: #81c784;
}

body .show-answer-btn,
body .primary-btn {
    background: linear-gradient(135deg, #232526, #764ba2);
    color: #fff;
}

body .show-answer-btn:hover,
body .primary-btn:hover {
    box-shadow: 0 10px 20px #764ba288;
}

body .secondary-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid #444;
}

body .secondary-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

body .correct-btn {
    background: linear-gradient(135deg, #388e3c, #2e7d32);
    color: #fff;
    border: 2px solid #66bb6a;
}

body .incorrect-btn {
    background: linear-gradient(135deg, #b71c1c, #d32f2f);
    color: #fff;
    border: 2px solid #e57373;
}

body .completion-screen {
    background: rgba(30, 30, 30, 0.7);
    border: 1px solid #444;
    text-align: center;
    padding: 40px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    margin-top: 50px;
}

body .final-stats {
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 30px;
}

body .mc-option-btn {
    background: linear-gradient(90deg, #23272e 80%, #414345 100%);
    color: #fff;
    border: 2px solid #666;
}

body .mc-option-btn:hover,
body .mc-option-btn:focus {
    background: linear-gradient(90deg, #333 80%, #764ba2 100%);
    border-color: #9575cd;
    outline: 2px solid #9575cd;
}

body .mc-option-btn.correct {
    background: linear-gradient(90deg, #388e3c 80%, #81c784 100%);
    border-color: #66bb6a;
    color: #fff;
}

body .mc-option-btn.incorrect {
    background: linear-gradient(90deg, #b71c1c 80%, #e57373 100%);
    border-color: #e57373;
    color: #fff;
}

body #resultList table {
    background: #23272e;
}

body #resultList th {
    background: #333;
    color: #fff;
}

body #resultList tr.correct-row {
    background: #2e7d32;
}

body #resultList tr.incorrect-row {
    background: #b71c1c;
}

body #resultList table,
body #resultList th,
body #resultList td {
    color: #fff !important;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

#themeToggleBtn {
    min-width: 120px;
    font-size: 1rem;
    padding: 8px 18px;
    top: 20px;
    right: 30px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    width: 0%;
    transition: width 0.3s ease;
}

.loading {
    text-align: center;
    color: white;
    font-size: 1.2rem;
    margin-top: 50px;
}

.card-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    min-height: 60vh;
    /* 最小高さを設定して中央配置を強化 */
}

.word-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.show-answer-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.show-answer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.answer-buttons {
    display: flex;
    gap: 32px;
    justify-content: center;
    margin-top: 30px;
}

.btn {
    padding: 18px 36px;
    border: none;
    border-radius: 20px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.correct-btn:focus,
.correct-btn:hover {
    outline: 3px solid #81c784;
    box-shadow: 0 0 0 4px #c8e6c9;
}

.incorrect-btn:focus,
.incorrect-btn:hover {
    outline: 3px solid #e57373;
    box-shadow: 0 0 0 4px #ffcdd2;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.completion-screen h2 {
    color: white;
    font-size: 2rem;
    margin-bottom: 20px;
}

.final-stats p {
    margin: 10px 0;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 2rem;
    }

    .word-card {
        padding: 30px 20px;
        min-height: 250px;
    }

    .word-display,
    .answer-display {
        font-size: 2rem;
    }

    .controls {
        flex-direction: column;
        align-items: center;
    }

    .answer-buttons {
        flex-direction: row;
        gap: 16px;
    }

    .btn {
        width: 100%;
        max-width: 180px;
        font-size: 1.1rem;
        padding: 16px 0;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem;
    }

    .word-display,
    .answer-display {
        font-size: 1.5rem;
    }

    .word-card {
        padding: 20px 15px;
    }

    .answer-buttons {
        flex-direction: column;
        gap: 18px;
    }

    .btn {
        max-width: 100%;
        font-size: 1rem;
        padding: 14px 0;
    }
}

/* アニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* カードフリップアニメーション */
.card-flip {
    animation: flipCard 0.25s ease-in-out;
}

@keyframes flipCard {
    0% {
        transform: rotateY(0deg);
    }

    50% {
        transform: rotateY(90deg);
    }

    100% {
        transform: rotateY(0deg);
    }
}

.multiple-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    width: 100%;
    margin: 0 auto;
}

.mc-options {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
    margin-top: 32px;
    align-items: center;
}

.mc-option-btn {
    width: 100%;
    max-width: 400px;
    padding: 18px 0;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 16px;
    border: 2px solid #bbb;
    background: linear-gradient(90deg, #f5f5f5 80%, #e0e0e0 100%);
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.mc-option-btn:hover,
.mc-option-btn:focus {
    background: linear-gradient(90deg, #e3f2fd 80%, #bbdefb 100%);
    border-color: #1976d2;
    outline: 2px solid #1976d2;
}

.mc-option-btn.correct {
    background: linear-gradient(90deg, #c8e6c9 80%, #81c784 100%);
    border-color: #388e3c;
    color: #1b5e20;
}

.mc-option-btn.incorrect {
    background: linear-gradient(90deg, #ffcdd2 80%, #e57373 100%);
    border-color: #b71c1c;
    color: #b71c1c;
}

@media (max-width: 768px) {
    .mc-option-btn {
        max-width: 100%;
        font-size: 1.1rem;
        padding: 14px 0;
    }
}

.pc-help {
    background: rgba(255, 255, 255, 0.7);
    color: #222;
    border-radius: 10px;
    padding: 12px 18px;
    margin: 0 auto 18px auto;
    max-width: 700px;
    font-size: 1.05rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #eee;
    text-align: left;
}

body[data-theme="dark"] .pc-help {
    background: rgba(30, 30, 30, 0.85);
    color: #eee;
    border: 1px solid #444;
}

/* カスタムチェックボックスのスタイル */
.checkbox-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin: 6px 8px 6px 0;
    cursor: pointer;
    user-select: none;
}

/* デフォルトのチェックボックスを隠す */
.checkbox-container input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* カスタムチェックボックスのスタイル */
.checkbox-container .checkmark {
    position: relative;
    display: inline-block;
    height: 18px;
    width: 18px;
    background: rgba(30, 30, 30, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    margin-right: 8px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ホバー時のスタイル */
.checkbox-container:hover .checkmark {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* チェック時のスタイル */
.checkbox-container input:checked~.checkmark {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* チェックマーク（✓）のスタイル */
.checkbox-container .checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 5px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* チェック時にチェックマークを表示 */
.checkbox-container input:checked~.checkmark:after {
    display: block;
}

/* チェックボックスのラベルテキスト */
.checkbox-container .checkbox-label {
    color: #eee;
    font-size: 14px;
    font-weight: normal;
    vertical-align: top;
    line-height: 18px;
    transition: color 0.3s ease;
}

.checkbox-container:hover .checkbox-label {
    color: #fff;
}

/* 数字入力欄のスタイル */
input[type="number"] {
    background: rgba(30, 30, 30, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: #eee;
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    min-width: 60px;
    text-align: center;
}

/* フォーカス時のスタイル */
input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
}

/* ホバー時のスタイル */
input[type="number"]:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* プレースホルダーのスタイル */
input[type="number"]::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* 数字入力欄の矢印ボタンをカスタマイズ（Webkit系ブラウザ） */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox用 */
input[type="number"] {
    -moz-appearance: textfield;
}

/* 既存のwordFileCheckboxesのスタイルを調整 */
#wordFileCheckboxes {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 8px 0;
}

#wordFileCheckboxes label {
    color: white !important;
    font-weight: normal !important;
    margin-right: 0 !important;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    #wordFileCheckboxes {
        flex-direction: column;
        gap: 8px;
    }

    .checkbox-container {
        margin: 4px 0;
    }

    input[type="number"] {
        min-width: 50px;
        font-size: 13px;
        padding: 6px 10px;
    }
}
