/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;700&display=swap');

:root {
    --primary-color: #FFFFFF;
    --secondary-color: #3388BB;
    --text-color: #333;
    --light-gray: #f4f4f4;
    --correct-color: #28a745;
    --incorrect-color: #dc3545;
    --border-radius: 12px;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    margin: 0;
    background-color: var(--light-gray);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(var(--vh, 1vh) * 100);
    overflow: hidden;
}

.container {
    width: 100%;
    max-width: 500px;
    height: calc(var(--vh, 1vh) * 100);
    max-height: 900px;
    background-color: var(--primary-color);
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* 屏幕切换动画 */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease-in-out, visibility 0.4s;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 20px 20px 60px 20px;
    box-sizing: border-box;
    text-align: center;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* --- 首页样式 --- */
#home-screen {
    justify-content: space-around;
}

.main-header h1 {
    font-size: 3.5rem;
    color: var(--secondary-color);
    margin: 0;
    font-weight: 700;
}

.main-header h2 {
    font-size: 2rem;
    color: var(--text-color);
    margin: 10px 0 0;
    font-weight: 400;
}
.main-header h2 ruby {
    ruby-position: under;
    font-size: 0.8rem;
}

#home-screen .home-content {
    margin-top: auto;
    margin-bottom: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

/* --- 按钮样式 --- */
.button-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 80%;
    max-width: 300px;
    margin-top: auto;
    margin-bottom: 20px; /* 控制按钮离底部的距离 */
}

.btn {
    padding: 15px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 700;
}

.btn-primary {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #2a7aaa;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(51, 136, 187, 0.4);
}

.btn-secondary {
    background-color: var(--light-gray);
    color: var(--text-color);
    border: 2px solid var(--light-gray);
}

.btn-secondary:hover {
    background-color: #e2e2e2;
    border-color: #dcdcdc;
}

/* --- 答题页 --- */
#quiz-screen, #result-screen {
    justify-content: space-between;
}

.quiz-progress {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 1rem;
    color: #888;
}

.question-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.kana-char {
    font-size: 10rem;
    font-weight: bold;
    color: var(--secondary-color);
    margin: 0;
    line-height: 1;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 15px;
    width: 100%;
    padding: 0 10%;
    box-sizing: border-box;
    margin-bottom: 20px;
}

.option-btn {
    padding: 20px;
    font-size: 1.8rem;
    background-color: var(--primary-color);
    color: var(--secondary-color);
    border: 2px solid var(--secondary-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-btn:hover {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

/* --- 结果页 --- */
#result-status {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 20px 0;
}
#result-status.correct { color: var(--correct-color); }
#result-status.incorrect { color: var(--incorrect-color); }

.result-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: 100%;
    gap: 20px;
}

.result-image-placeholder {
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background-color: #e0e0e0;
    border-radius: var(--border-radius);
    background-size: cover;
    background-position: center;
    box-shadow: var(--shadow);
}

.sentence-container {
    background: var(--light-gray);
    padding: 15px;
    border-radius: var(--border-radius);
}

.japanese-sentence {
    font-size: 1.4rem;
    margin: 0 0 10px 0;
}
.japanese-sentence ruby rt {
    font-size: 0.8rem;
    color: #555;
    opacity: 0.8;
}
.japanese-sentence .highlight {
    color: var(--incorrect-color);
    font-weight: bold;
}
.japanese-sentence .highlight rt {
    color: var(--incorrect-color) !important;
}

.chinese-translation {
    font-size: 0.9rem;
    color: #666;
    margin: 0 0 15px 0;
}

.speaker-name {
    font-size: 0.9rem;
    color: var(--text-color);
    margin: 0;
    text-align: right;
    font-weight: bold;
}

#result-screen .button-container {
    width: 100%;
    flex-direction: row;
    justify-content: space-around;
}

/* --- 得分页 --- */
.score-title {
    font-size: 2rem;
    color: var(--secondary-color);
}
.final-score-text {
    font-size: 1.5rem;
    margin: 20px 0;
}

/* --- 作者信息弹窗 --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: var(--primary-color);
    margin: 15% auto;
    padding: 25px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    position: relative;
    animation: slideIn 0.4s;
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.close-btn:hover, .close-btn:focus {
    color: black;
}

@keyframes fadeIn { from {opacity: 0;} to {opacity: 1;} }
@keyframes slideIn { from {transform: translateY(-50px); opacity: 0;} to {transform: translateY(0); opacity: 1;} }

/* --- 桌面端和响应式设计 --- */
@media (min-width: 520px) {
    .container {
        border-radius: 20px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
        height: 95vh;
    }

    #home-screen {
        padding-bottom: 50px;
    }
}
