/* style.css */
:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --secondary-hover: #475569;
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #475569;
    --success: #10b981;
    --success-bg: #d1fae5;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --border: #e2e8f0;
    --radius-md: 12px;
    --radius-lg: 24px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
}

body {
    font-family: 'Inter', 'Noto Sans TC', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background-color: var(--card-bg);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: transform 0.2s;
    user-select: none;
}

.logo-area:hover {
    transform: scale(1.02);
}

.home-icon {
    font-size: 1.8rem;
}

h1 {
    font-size: 1.5rem;
    margin: 0;
    background: linear-gradient(135deg, #2563eb, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

#header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#timer-container {
    display: flex;
    align-items: center;
    background: #fef2f2;
    border-radius: var(--radius-md);
}

.pause-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    transition: background 0.2s;
}

.pause-btn:hover {
    background: #fee2e2;
}

#timer {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--danger);
    padding: 0.5rem 1rem 0.5rem 0.25rem;
    letter-spacing: 1px;
}

#progress-container {
    font-weight: 600;
    color: var(--primary-color);
    background: #eff6ff;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
}

main {
    flex: 1;
    max-width: 900px;
    margin: 0.5rem auto;
    padding: 0 1.5rem;
    width: 100%;
    box-sizing: border-box;
    animation: fadeIn 0.4s ease-in-out;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.25rem 2rem;
    box-shadow: var(--shadow-md);
    transition: opacity 0.3s ease;
}

.hidden {
    display: none !important;
}

.btn {
    border: none;
    padding: 0.8rem 1.8rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--secondary-hover);
    transform: translateY(-2px);
}

.btn-large {
    width: 100%;
    max-width: 350px;
    padding: 1.2rem;
    font-size: 1.2rem;
}

.action-bar {
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.badge {
    display: inline-block;
    padding: 0.35rem 1rem;
    border-radius: 99px;
    font-size: 0.9rem;
    font-weight: 700;
    background: #dbeafe;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.badge-warning { background: #fef3c7; color: #b45309; }

.q-nav-info {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-color);
}

.nav-btns {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.btn-success:hover {
    background-color: #059669 !important;
}

.intro-text p {
    font-size: 1rem;
    line-height: 1.5;
    margin: 0.5rem 0;
    color: var(--text-muted);
}

.scoring-legend {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius-md);
    padding: 0.7rem 1rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.legend-label {
    font-weight: 700;
    color: var(--primary-color);
    margin-right: 0.25rem;
}

/* Dashboard Styles */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem 0;
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.stats-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.stats-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.stats-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-top: 0.25rem;
}

.stages-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
}

.stage-btn {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.stage-btn:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
    transform: translateY(-2px);
}

.stage-btn.completed {
    background: #f8fafc;
    border-color: #cbd5e1;
}

h2 {
    margin: 0 0 0.5rem 0;
}

.stage-btn .st-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-main);
}

.stage-btn .st-status {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.stage-btn.completed .st-status.perfect { color: var(--success); }
.stage-btn.completed .st-status.good { color: #f59e0b; }
.stage-btn.completed .st-status.bad { color: var(--danger); }

/* Test Screen Styles */
.test-header {
    text-align: center;
    margin-bottom: 0.75rem;
}

.stage-title {
    font-size: 2rem;
    margin: 0;
    color: var(--primary-color);
}

.score-announcement {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1.25rem;
}

.passage {
    background: #f8fafc;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    border-left: 5px solid var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-main);
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.02);
}

.question-block {
    margin-bottom: 1rem;
    padding: 0.75rem 1.25rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: box-shadow 0.2s;
}

.question-text {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.option-label {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    color: var(--text-muted);
}

.option-label:hover:not(.disabled) {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* Post Submission Highlights */
.option-label.disabled {
    cursor: default;
}

.option-label.selected-wrong {
    border-color: var(--danger);
    background: var(--danger-bg);
    color: var(--danger);
    font-weight: 600;
}

.option-label.correct {
    border-color: var(--success);
    background: var(--success-bg);
    color: var(--success);
    font-weight: 600;
}

.question-block.wrong-q {
    border: 2px solid var(--danger);
    background: #fffafa;
}

.question-block.correct-q {
    border: 2px solid var(--success);
}

.explanation-badge {
    display: inline-block;
    margin-left: auto;
    font-size: 0.9rem;
    font-weight: 700;
}
.explanation-badge.wrong-badge { color: var(--danger); }
.explanation-badge.correct-badge { color: var(--success); }

input[type="radio"] {
    margin-right: 1.2rem;
    transform: scale(1.3);
    accent-color: var(--primary-color);
}

input[type="radio"]:checked + .option-label:not(.disabled),
.option-label:not(.disabled):has(input[type="radio"]:checked) {
    border-color: var(--primary-color);
    background: #eff6ff;
    color: var(--primary-color);
    font-weight: 600;
}

.footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}
