/* ============ CSS Variables & Reset ============ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.6);
    --bg-card-hover: rgba(51, 65, 85, 0.8);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --accent-1: #6366f1;
    --accent-2: #8b5cf6;
    --accent-3: #ec4899;
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #fb7185 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    --gradient-info: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 100%);
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.2);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.6;
    overflow-x: hidden;
    height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    min-height: 100%;
    position: relative;
}

/* ============ Page Transition ============ */
.page {
    display: none;
    min-height: 100vh;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

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

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    33% { transform: translateY(-10px) rotate(2deg); }
    66% { transform: translateY(5px) rotate(-1deg); }
}

@keyframes ringProgress {
    from { stroke-dashoffset: 339.292; }
}

/* ============ Home Header ============ */
.home-header {
    position: relative;
    padding: calc(48px + var(--safe-top)) 24px 40px;
    background: var(--gradient-primary);
    border-radius: 0 0 36px 36px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.header-bg-shapes {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.1;
}

.shape-1 {
    width: 200px;
    height: 200px;
    background: white;
    top: -60px;
    right: -40px;
    animation: float 8s ease-in-out infinite;
}

.shape-2 {
    width: 150px;
    height: 150px;
    background: white;
    bottom: -30px;
    left: -30px;
    animation: float 6s ease-in-out infinite reverse;
}

.shape-3 {
    width: 80px;
    height: 80px;
    background: white;
    top: 40%;
    left: 60%;
    animation: float 10s ease-in-out infinite;
}

.header-content {
    position: relative;
    z-index: 1;
}

.app-title {
    font-size: 28px;
    font-weight: 900;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.title-icon {
    font-size: 32px;
    animation: pulse 3s ease-in-out infinite;
}

.app-subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    margin-top: 4px;
    font-weight: 300;
    letter-spacing: 2px;
}

.daily-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-top: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: white;
}

.stat-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 2px;
}

.stat-divider {
    width: 1px;
    height: 30px;
    background: rgba(255, 255, 255, 0.2);
}

/* ============ Home Main ============ */
.home-main {
    padding: 20px 16px;
    padding-bottom: calc(30px + var(--safe-bottom));
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 18px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

/* ============ Subject Cards ============ */
.subject-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.subject-card {
    position: relative;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* Bouncy float */
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.subject-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.03), transparent);
    pointer-events: none;
}

.subject-card:active {
    transform: scale(0.98);
}

.subject-card:hover {
    border-color: rgba(102, 126, 234, 0.3);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.15);
}

.subject-emoji {
    font-size: 40px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.subject-card-info {
    flex: 1;
    min-width: 0;
}

.subject-card-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.subject-card-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.subject-card-progress {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.subject-card-arrow {
    font-size: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ============ Quick Grid ============ */
.quick-section {
    margin-top: 28px;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.quick-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.quick-item:active {
    transform: scale(0.92);
}

.quick-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.3s;
}

.quick-item:hover .quick-icon {
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.quick-item span {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============ Progress Cards (Plan) ============ */
.plan-section {
    margin-top: 28px;
}

.progress-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.progress-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--border-color);
}

.progress-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.progress-card-name {
    font-size: 14px;
    font-weight: 600;
}

.progress-card-count {
    font-size: 12px;
    color: var(--text-muted);
}

.progress-bar-large {
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill-large {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ Sub Header ============ */
.sub-header {
    display: flex;
    align-items: center;
    padding: calc(16px + var(--safe-top)) 20px 16px;
    background: rgba(15, 23, 42, 0.75);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.06);
}

.sub-title {
    flex: 1;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
}

.header-spacer {
    width: 40px;
}

.clear-btn {
    background: none;
    border: none;
    color: var(--accent-1);
    cursor: pointer;
    padding: 8px 12px;
    font-size: 14px;
    font-family: var(--font-family);
}

/* ============ Subject Detail ============ */
.subject-main {
    padding: 20px 16px;
    padding-bottom: calc(30px + var(--safe-bottom));
}

.subject-info {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    padding: 30px 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.subject-info-emoji {
    font-size: 48px;
    margin-bottom: 8px;
}

.subject-info-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.subject-info-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
}

.info-stat {
    text-align: center;
}

.info-stat-value {
    font-size: 20px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.info-stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============ Mode Cards ============ */
.mode-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mode-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.mode-card:hover {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.mode-card:active {
    transform: scale(0.98);
}

.mode-icon {
    font-size: 28px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(102, 126, 234, 0.1);
    border-radius: var(--radius-md);
}

.mode-info {
    flex: 1;
}

.mode-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.mode-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

.mode-arrow {
    font-size: 18px;
    color: var(--text-muted);
    transition: transform 0.3s;
}

.mode-card:hover .mode-arrow {
    transform: translateX(4px);
}

/* ============ Chapter List ============ */
.chapter-list {
    margin-top: 20px;
    animation: slideUp 0.3s ease;
}

.chapter-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.chapter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chapter-item:hover {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
    transform: translateX(4px);
}

.chapter-item:active {
    transform: scale(0.98) translateX(2px);
}

.chapter-item-name {
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

.chapter-item-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-right: 8px;
}

.chapter-item-arrow {
    color: var(--text-muted);
    font-size: 14px;
}

/* ============ Practice Page ============ */
.practice-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.practice-progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.progress-bar-mini {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill-mini {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.practice-actions {
    display: flex;
    gap: 4px;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px;
    font-size: 20px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.06);
}

.action-btn.favorited #favorite-icon {
    color: #ffd700;
}

/* Exam Timer */
.exam-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    background: rgba(245, 87, 108, 0.15);
    color: #f5576c;
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.timer-icon {
    font-size: 18px;
}

/* ============ Question Card ============ */
.practice-main {
    padding: 16px;
    padding-bottom: 100px;
}

.question-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    animation: scaleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.question-type {
    display: inline-block;
    padding: 3px 10px;
    background: var(--gradient-primary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: white;
    margin-bottom: 14px;
}

.question-text {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-color);
    user-select: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.option-item:hover {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.05);
    transform: translateY(-1px);
}

.option-item.selected {
    border-color: var(--accent-1);
    background: rgba(99, 102, 241, 0.12);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.option-item.correct {
    border-color: #10b981 !important;
    background: rgba(16, 185, 129, 0.12) !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.option-item.wrong {
    border-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.12) !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.option-item.disabled {
    pointer-events: none;
}

.option-label {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
    transition: all 0.25s;
}

.option-item.selected .option-label {
    border-color: var(--accent-1);
    background: var(--accent-1);
    color: white;
}

.option-item.correct .option-label {
    border-color: #43e97b;
    background: #43e97b;
    color: white;
}

.option-item.wrong .option-label {
    border-color: #f5576c;
    background: #f5576c;
    color: white;
}

.option-text {
    flex: 1;
    font-size: 15px;
    line-height: 1.6;
    padding-top: 3px;
    color: var(--text-primary);
}

/* Multi-select checkbox style */
.option-item.multi .option-label {
    border-radius: 6px;
}

/* ============ Answer Analysis ============ */
.answer-analysis {
    margin-top: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border-color);
    animation: slideUp 0.3s ease;
}

.analysis-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
}

.analysis-header.correct {
    color: #43e97b;
}

.analysis-header.wrong {
    color: #f5576c;
}

.result-icon {
    font-size: 20px;
}

.analysis-answer {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
}

.analysis-detail {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.analysis-detail strong {
    color: var(--text-primary);
}

/* ============ Practice Footer ============ */
.practice-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 12px;
    padding: 16px 20px calc(16px + var(--safe-bottom));
    background: rgba(30, 41, 59, 0.85);
    border-top: 1px solid var(--border-color);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    z-index: 100;
}

.footer-btn {
    flex: 1;
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.footer-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.footer-btn.primary {
    background: var(--gradient-primary);
    border: none;
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.footer-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.footer-btn:not(:disabled):active {
    transform: scale(0.96);
}

/* ============ List Pages (Wrong & Favorites) ============ */
.list-main {
    padding: 0 16px;
    padding-bottom: calc(30px + var(--safe-bottom));
}

.filter-tabs {
    display: flex;
    gap: 8px;
    padding: 16px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.filter-tab {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-family);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.filter-tab.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
}

.question-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.question-list-item {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.question-list-item:hover {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.question-list-item:active {
    transform: scale(0.98);
}

.question-list-item-subject {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
    margin-bottom: 6px;
    font-weight: 500;
}

.question-list-item-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 15px;
}

/* ============ Stats Page ============ */
.stats-main {
    padding: 20px 16px;
    padding-bottom: calc(30px + var(--safe-bottom));
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.overview-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    padding: 24px 16px;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.overview-value {
    font-size: 28px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.overview-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.subject-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.subject-stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.subject-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.subject-stat-name {
    font-size: 14px;
    font-weight: 600;
}

.subject-stat-accuracy {
    font-size: 13px;
    font-weight: 600;
}

.subject-stat-bar {
    display: flex;
    gap: 4px;
    align-items: center;
}

.stat-bar-segment {
    height: 8px;
    border-radius: 4px;
    transition: width 0.8s ease;
}

.stat-bar-correct {
    background: var(--gradient-success);
}

.stat-bar-wrong {
    background: var(--gradient-danger);
}

.stat-bar-remaining {
    background: rgba(255, 255, 255, 0.06);
    flex: 1;
}

/* Chart Section */
.chart-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border-color);
}

.chart-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
}

.chart-container {
    width: 100%;
    overflow: hidden;
}

.chart-container canvas {
    width: 100% !important;
    height: auto !important;
}

/* ============ Result Page ============ */
.result-main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
    padding: 20px;
}

.result-card {
    width: 100%;
    max-width: 400px;
    text-align: center;
    animation: scaleIn 0.5s ease;
}

.result-score-ring {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto 24px;
}

.score-ring-svg {
    width: 100%;
    height: 100%;
}

.score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: baseline;
}

.score-number {
    font-size: 42px;
    font-weight: 900;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-unit {
    font-size: 16px;
    color: var(--text-muted);
    margin-left: 4px;
}

.result-details {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 32px;
    padding: 24px 20px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.result-detail-item {
    text-align: center;
}

.detail-label {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.result-detail-item.correct .detail-value {
    color: #43e97b;
}

.result-detail-item.wrong .detail-value {
    color: #f5576c;
}

.result-actions {
    display: flex;
    gap: 12px;
}

.result-btn {
    flex: 1;
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.result-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.result-btn.primary:hover {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.result-btn:active {
    transform: scale(0.96);
}

.result-btn.primary {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
}

.result-btn:active {
    transform: scale(0.97);
}

/* ============ Toast ============ */
.toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 24px;
    background: rgba(30, 30, 50, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 24px;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 14px;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
}

/* ============ Judge Question Badge ============ */
.question-type.judge {
    background: linear-gradient(135deg, #f6d365, #fda085);
}

.question-type.short_answer {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
}

.question-type.essay {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
}

/* ============ Subjective Answer Area ============ */
.subjective-area {
    margin-top: 16px;
}

.answer-textarea {
    width: 100%;
    min-height: 160px;
    padding: 16px;
    background: rgba(15, 23, 42, 0.5);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.7;
    font-family: var(--font-family);
    resize: vertical;
    transition: all 0.25s;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.answer-textarea:focus {
    outline: none;
    border-color: var(--accent-1);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2), inset 0 2px 4px rgba(0,0,0,0.1);
}

.answer-textarea::placeholder {
    color: var(--text-muted);
}

.word-count {
    text-align: right;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Reference answer for subjective questions */
.analysis-reference {
    margin-top: 12px;
    padding: 14px;
    background: rgba(102, 126, 234, 0.06);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-1);
}

.analysis-reference strong {
    color: var(--accent-1);
    display: block;
    margin-bottom: 6px;
}

.analysis-reference p {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-secondary);
    white-space: pre-line;
}

/* ============ Utility Classes ============ */
.hidden {
    display: none !important;
}

/* ============ Scrollbar ============ */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* ============ Responsive ============ */
@media (min-width: 768px) {
    .home-main, .subject-main, .list-main, .stats-main, .practice-main {
        max-width: 600px;
        margin: 0 auto;
    }
    
    .home-header .header-content {
        max-width: 600px;
        margin: 0 auto;
    }
    
    .practice-footer {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
    }
}
