/* 1. CSS 變數與基本設定 */
:root {
    --font-family-main: 'Noto Sans JP', sans-serif;
    --primary-color: #435ebe;
    --success-color: #43a047;
    --error-color: #e53935;
    --background-color: #f4f7f9;
    --card-background-color: #ffffff;
    --text-color-main: #2c3e50;
    --text-color-light: #6c757d;
    --text-color-japanese: #d32f2f;
    --text-color-translation: #388e3c;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    --card-hover-shadow: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.08);
    --border-radius: 12px;
}

/* 萬用 reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* 2. 整體頁面樣式 */
html {
    font-size: 16px;
}

body {
    font-family: var(--font-family-main);
    line-height: 1.7;
    background-color: var(--background-color);
    color: var(--text-color-main);
}

main {
    max-width: 800px;
    margin: 0 auto;
}

h1, h2 {
    text-align: center;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-color-main);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 3rem;
}

h2 {
    font-size: 2rem;
    margin: 4rem 0 2rem 0;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.section-title {
    text-align: center;
}

/* 3. 卡片式設計 (核心佈局) */
.sentence-container {
    background-color: var(--card-background-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease-in-out;
    border: 1px solid #e0e0e0;
}

.sentence-container:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-hover-shadow);
}

.main-sentence-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.main-sentence {
    font-size: 1.75rem;
    font-weight: 500;
    flex-grow: 1;
}

.translation {
    color: var(--text-color-light);
    font-style: italic;
    font-size: 1.1rem;
    margin-top: 0.75rem;
}

.word-analysis {
    margin-top: 1.5rem;
    border-top: 1px solid #eeeeee;
    padding-top: 1rem;
}

.word {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

.word:not(:last-child) {
    border-bottom: 1px solid #f5f5f5;
}

.word-details {
    flex-grow: 1;
}

.japanese-word {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-color-japanese);
}

.romaji {
    color: var(--text-color-light);
    font-size: 1rem;
}

.word-translation {
    color: var(--text-color-translation);
    font-size: 1rem;
}

.play-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.word .play-button {
    margin-left: 1rem;
}

.play-button:hover {
    background-color: #3147a5;
    transform: scale(1.1);
}

/* 4. 測驗區塊樣式 */
.quiz-card {
    background: var(--card-background-color);
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

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

.quiz-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.quiz-option-btn {
    background-color: #fdfdff;
    border: 1px solid #dcdfe6;
    border-radius: 8px;
    padding: 1rem;
    font-family: var(--font-family-main);
    font-size: 1.1rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.5;
}

.quiz-option-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.quiz-option-btn .romaji {
    font-size: 0.9rem;
}

.quiz-option-btn.correct {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
    font-weight: 500;
}

.quiz-option-btn.incorrect {
    background-color: var(--error-color);
    border-color: var(--error-color);
    color: white;
    font-weight: 500;
}

/* 雖然可以重選，但為以防萬一保留:disabled樣式 */
.quiz-option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.9;
}

.quiz-option-btn.correct .romaji,
.quiz-option-btn.incorrect .romaji {
    color: white;
    opacity: 0.8;
}

.hr-light {
    border: 0;
    border-top: 1px solid #ccc; /* #ccc 是一個淺灰色，您可以換成 #ddd 或 #eee 讓它更淺 */
    margin: 1em 0; /* 可選：增加上下間距 */
}

/* 5. RWD */
@media (max-width: 600px) {
    h1 { font-size: 2rem; margin-bottom: 2rem; }
    h2 { font-size: 1.75rem; }
    .sentence-container, .quiz-card { padding: 1.5rem; }
    .main-sentence { font-size: 1.5rem; }
    .play-button { width: 45px; height: 45px; }
    .quiz-options { grid-template-columns: 1fr; }
}