/* ═══════════════════════════════════════════════════════════════
   School Quest — Styles
   Arcade-style playful design for P1-P6 Singapore students
═══════════════════════════════════════════════════════════════ */

:root {
    --bg: #F0F4FF;
    --primary: #6366F1;
    --primary-dark: #4F46E5;
    --secondary: #EC4899;
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
    --text: #1E293B;
    --text-light: #64748B;
    --card: #FFFFFF;
    --radius: 16px;
    --radius-sm: 12px;
    --shadow: 0 4px 20px rgba(99, 102, 241, 0.15);
    --shadow-hover: 0 8px 30px rgba(99, 102, 241, 0.25);
}

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

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ─── Screens ─────────────────────────────────────────────── */
.screen { display: none; padding: 20px; max-width: 800px; margin: 0 auto; }
.screen.active { display: block; animation: fadeIn 0.3s ease; }

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

/* ─── Welcome Screen ─────────────────────────────────────── */
.welcome-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 90vh;
    gap: 30px;
    text-align: center;
}

.logo-emoji { font-size: 80px; animation: bounce 2s infinite; }
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.logo-title {
    font-family: 'Poppins', sans-serif;
    font-size: 48px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-subtitle {
    font-size: 18px;
    color: var(--text-light);
    margin-top: 8px;
}

.name-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 30px 40px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 400px;
}

.name-prompt { font-size: 18px; font-weight: 600; }

.name-card input {
    padding: 14px 18px;
    border: 2px solid #E2E8F0;
    border-radius: var(--radius-sm);
    font-size: 18px;
    font-family: 'Nunito', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

.name-card input:focus { border-color: var(--primary); }

.token-info {
    background: #FEF9C3;
    border: 2px solid #FDE68A;
    border-radius: var(--radius-sm);
    padding: 16px 24px;
    font-size: 15px;
    color: #92400E;
    line-height: 1.6;
}

/* ─── Buttons ─────────────────────────────────────────────── */
.btn-primary {
    background: linear-gradient(135deg, #7C3AED, #6366F1, #A855F7);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35);
    width: 100%;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(124, 58, 237, 0.45); }
.btn-primary:active { transform: translateY(0); }

/* Make primary button full-width inside exam paper steps */
.filter-section .btn-primary { width: calc(100% - 40px); margin: 0 20px 4px; }

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-secondary:hover { background: var(--primary); color: white; }

.btn-text {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
    font-family: 'Nunito', sans-serif;
}

.btn-back {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}
.btn-back:hover { color: var(--primary); }

/* ─── Screen Header ─────────────────────────────────────── */
.screen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.screen-title {
    font-family: 'Poppins', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

.screen-subtitle {
    color: var(--text-light);
    font-size: 15px;
    margin-top: 4px;
}

/* ─── Student Bar ─────────────────────────────────────────── */
.student-bar {
    display: flex;
    align-items: center;
    gap: 16px;
}

.student-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.student-avatar-small {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.student-name {
    font-weight: 700;
    font-size: 15px;
}

.token-display {
    background: #FEF9C3;
    border: 2px solid #FDE68A;
    border-radius: 20px;
    padding: 4px 12px;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.token-icon { font-size: 16px; }

/* ─── Level Grid ──────────────────────────────────────────── */
.level-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 10px;
}

.level-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
}
.level-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}
.level-card:active { transform: translateY(-1px); }

/* ─── Colourful Level Cards (P1–P6) ─────────────────────── */
.p1-color { background: linear-gradient(135deg, #FF6B6B, #FF8E53); color: white; }
.p1-color .level-number, .p1-color .level-label { color: white; }
.p1-color .level-label { opacity: 0.85; }

.p2-color { background: linear-gradient(135deg, #FF9A3C, #FFDB58); color: white; }
.p2-color .level-number, .p2-color .level-label { color: white; }
.p2-color .level-label { opacity: 0.85; }

.p3-color { background: linear-gradient(135deg, #4ECDC4, #44CF6C); color: white; }
.p3-color .level-number, .p3-color .level-label { color: white; }
.p3-color .level-label { opacity: 0.85; }

.p4-color { background: linear-gradient(135deg, #5B9BD5, #6C5CE7); color: white; }
.p4-color .level-number, .p4-color .level-label { color: white; }
.p4-color .level-label { opacity: 0.85; }

.p5-color { background: linear-gradient(135deg, #8E44AD, #C0392B); color: white; }
.p5-color .level-number, .p5-color .level-label { color: white; }
.p5-color .level-label { opacity: 0.85; }

.p6-color { background: linear-gradient(135deg, #EC4899, #F59E0B); color: white; }
.p6-color .level-number, .p6-color .level-label { color: white; }
.p6-color .level-label { opacity: 0.85; }

/* Hover — keep gradient but lift */
.p1-color:hover { box-shadow: 0 8px 24px rgba(255,107,107,0.5); border-color: transparent; }
.p2-color:hover { box-shadow: 0 8px 24px rgba(255,154,60,0.5); border-color: transparent; }
.p3-color:hover { box-shadow: 0 8px 24px rgba(78,205,196,0.5); border-color: transparent; }
.p4-color:hover { box-shadow: 0 8px 24px rgba(91,155,213,0.5); border-color: transparent; }
.p5-color:hover { box-shadow: 0 8px 24px rgba(142,68,173,0.5); border-color: transparent; }
.p6-color:hover { box-shadow: 0 8px 24px rgba(236,72,153,0.5); border-color: transparent; }

.level-emoji { font-size: 48px; display: block; margin-bottom: 8px; }
.level-number {
    font-family: 'Poppins', sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
}
.level-label { font-size: 13px; color: var(--text-light); margin-top: 2px; }

/* ─── Subject Grid ────────────────────────────────────────── */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 10px;
}

.subject-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px 20px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
    border-left: 6px solid;
    display: flex;
    align-items: center;
    gap: 14px;
}
.subject-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}
.subject-card:active { transform: translateY(0); }

.subject-emoji { font-size: 36px; }
.subject-info { flex: 1; }
.subject-name { font-family: 'Poppins', sans-serif; font-size: 18px; font-weight: 700; }
.subject-count { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* Subject colors */
.subject-english { border-color: #6366F1; }
.subject-maths { border-color: #10B981; }
.subject-science { border-color: #F59E0B; }
.subject-chinese { border-color: #EF4444; }
.subject-higher-chinese { border-color: #8B5CF6; }

/* ─── Stage Grid ─────────────────────────────────────────── */
.stage-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

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

.stage-card {
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 18px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
    position: relative;
}
.stage-card:hover:not(.locked) { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.stage-card.locked { opacity: 0.5; cursor: not-allowed; }
.stage-card.locked::after { content: '🔒'; position: absolute; top: 6px; right: 6px; font-size: 12px; }

.stage-num {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 700;
}
.stage-stars { font-size: 12px; margin-top: 4px; color: var(--warning); }
.stage-label { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* Difficulty colors */
.stage-easy { border-top: 4px solid #10B981; }
.stage-medium { border-top: 4px solid #F59E0B; }
.stage-hard { border-top: 4px solid #EF4444; }
.stage-psle { border-top: 4px solid #8B5CF6; }

/* ─── Subject Badge ───────────────────────────────────────── */
.subject-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    color: white;
}
.subject-badge.small { font-size: 12px; padding: 4px 10px; }
.subject-badge.english { background: #6366F1; }
.subject-badge.maths { background: #10B981; }
.subject-badge.science { background: #F59E0B; }
.subject-badge.chinese { background: #EF4444; }
.subject-badge.higher-chinese { background: #8B5CF6; }

/* ─── Quiz Screen ─────────────────────────────────────────── */
#screen-quiz { max-width: 700px; padding: 0; }

.quiz-header {
    background: white;
    padding: 12px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 10;
}

.quiz-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.btn-quit {
    background: #FEE2E2;
    color: var(--error);
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
}

.quiz-progress-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 16px;
}

.quiz-tokens {
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.progress-bar {
    height: 8px;
    background: #E2E8F0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 4px;
    transition: width 0.4s ease;
    width: 10%;
}

.quiz-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.streak-label { color: var(--secondary); font-weight: 700; }
.stage-label { color: var(--text-light); }

.quiz-area {
    padding: 20px;
    position: relative;
}

.question-card {
    background: white;
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.question-text {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 20px;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.option-btn {
    background: #F8FAFC;
    border: 2px solid #E2E8F0;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-size: 15px;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}
.option-btn:hover:not(:disabled) {
    border-color: var(--primary);
    background: #EEF2FF;
    transform: translateY(-1px);
}
.option-btn:disabled { cursor: default; }
.option-btn.correct { background: #D1FAE5; border-color: var(--success); color: #065F46; }
.option-btn.wrong { background: #FEE2E2; border-color: var(--error); color: #991B1B; animation: shake 0.3s; }
.option-btn.show-correct { background: #D1FAE5; border-color: var(--success); }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.option-letter {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.short-answer-area {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}
.short-answer-area input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid #E2E8F0;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: 'Nunito', sans-serif;
    outline: none;
}
.short-answer-area input:focus { border-color: var(--primary); }

/* ─── Feedback Overlay ────────────────────────────────────── */
.feedback-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.2s;
}

.feedback-box {
    background: white;
    border-radius: var(--radius);
    padding: 32px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.feedback-icon { font-size: 60px; margin-bottom: 12px; }
.feedback-text { font-size: 22px; font-weight: 800; margin-bottom: 16px; }

.feedback-rule {
    font-size: 14px;
    color: #1E293B;
    background: linear-gradient(135deg, #EEF2FF, #F0F4FF);
    border-left: 4px solid #6366F1;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 16px;
    text-align: left;
    line-height: 1.6;
}

.feedback-example-wrap {
    background: #F0FDF4;
    border: 2px solid #86EFAC;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 20px;
    text-align: left;
}
.feedback-example-label {
    font-size: 11px;
    font-weight: 700;
    color: #16A34A;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.feedback-example {
    font-size: 14px;
    color: #15803D;
    line-height: 1.5;
}
.feedback-example2 {
    font-size: 14px;
    color: #15803D;
    line-height: 1.5;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #86EFAC;
}

.feedback-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-answer {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-answer:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

/* ─── Quiz Avatar ─────────────────────────────────────────── */
.quiz-avatar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 50;
}

.mini-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    border: 3px solid white;
}

.avatar-tokens {
    background: #FEF9C3;
    border: 2px solid #FDE68A;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* ─── Stage Complete ──────────────────────────────────────── */
.complete-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 85vh;
    text-align: center;
    gap: 24px;
}

.complete-stars { font-size: 48px; letter-spacing: 4px; }
.complete-title {
    font-family: 'Poppins', sans-serif;
    font-size: 32px;
    font-weight: 800;
}

.complete-stats {
    display: flex;
    gap: 24px;
    background: white;
    border-radius: var(--radius);
    padding: 24px 32px;
    box-shadow: var(--shadow);
}

.stat-item { text-align: center; }
.stat-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}
.stat-label { font-size: 13px; color: var(--text-light); margin-top: 2px; }

.complete-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ─── Avatar Screen ────────────────────────────────────────── */
.avatar-main {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    margin-top: 16px;
}

.avatar-preview {
    background: linear-gradient(135deg, #C7D2FE, #E0E7FF);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.avatar-display {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 72px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 4px solid white;
}

.avatar-name-label {
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
}

.avatar-shop {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 70vh;
    overflow-y: auto;
}

.shop-category {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}

.shop-category-title {
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.shop-items {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.shop-item {
    background: #F8FAFC;
    border: 2px solid #E2E8F0;
    border-radius: var(--radius-sm);
    padding: 10px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 13px;
}
.shop-item:hover:not(.owned) { border-color: var(--primary); background: #EEF2FF; }
.shop-item.owned { background: #D1FAE5; border-color: var(--success); cursor: default; }
.shop-item.equipped { background: #EEF2FF; border-color: var(--primary); }

.shop-item-emoji { font-size: 24px; display: block; margin-bottom: 4px; }
.shop-item-name { font-weight: 600; font-size: 12px; }
.shop-item-price { color: var(--warning); font-size: 11px; font-weight: 700; }
.shop-item-owned { color: var(--success); font-size: 11px; font-weight: 700; }

/* ─── Stats Grid ──────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin: 16px 0;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
}
.stat-card-emoji { font-size: 32px; display: block; margin-bottom: 8px; }
.stat-card-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}
.stat-card-label { font-size: 13px; color: var(--text-light); margin-top: 2px; }

/* ─── Confetti ────────────────────────────────────────────── */
.confetti-piece {
    position: fixed;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    animation: confettiFall 1s ease-out forwards;
    pointer-events: none;
    z-index: 999;
}
@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(200px) rotate(720deg); opacity: 0; }
}

/* ─── Toast ───────────────────────────────────────────────── */
.token-toast {
    position: fixed;
    top: 80px;
    right: 20px;
    background: #FEF9C3;
    border: 2px solid #FDE68A;
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-weight: 700;
    font-size: 15px;
    color: #92400E;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 1.5s forwards;
    z-index: 200;
}
@keyframes toastIn {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100px); opacity: 0; }
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
    .level-grid { grid-template-columns: repeat(2, 1fr); }
    .subject-grid { grid-template-columns: 1fr; }
    .stage-grid { grid-template-columns: repeat(5, 1fr); }
    .options-grid { grid-template-columns: 1fr; }
    .avatar-main { grid-template-columns: 1fr; }
    .shop-items { grid-template-columns: repeat(2, 1fr); }
    .complete-stats { flex-direction: column; gap: 16px; }
    .logo-title { font-size: 36px; }
    .stats-grid { grid-template-columns: 1fr; }
}

/* ─── Parents Corner ──────────────────────────────────── */
.parents-corner {
    margin-top: 32px;
    padding: 24px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border-radius: 16px;
    border: 1px solid #334155;
    text-align: center;
}
.parents-corner h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    color: #e2e8f0;
    margin-bottom: 8px;
}
.parents-corner p {
    color: #94a3b8;
    font-size: 0.85rem;
    margin-bottom: 16px;
    line-height: 1.5;
}
.parents-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
}
.parents-link {
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    color: #fff;
    transition: transform 0.2s, opacity 0.2s;
}
.parents-link:hover { transform: scale(1.06); opacity: 0.9; }
.parents-link.eng { background: #6366F1; }
.parents-link.math { background: #10B981; }
.parents-link.sci { background: #F59E0B; }
.parents-link.chi { background: #EF4444; }
.parents-link.high-chi { background: #8B5CF6; }

/* ═══════════════════════════════════════════════════════════
   NEW v2: AI TUTOR
═══════════════════════════════════════════════════════════ */

/* Floating Button */
.ai-float-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5);
    z-index: 999;
    animation: ai-pulse 2s infinite;
    transition: transform 0.2s;
}
.ai-float-btn:hover { transform: scale(1.1); }
.ai-float-icon { font-size: 28px; }
@keyframes ai-pulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5); }
    50% { box-shadow: 0 4px 30px rgba(99, 102, 241, 0.8); }
}

/* AI Tutor Overlay */
.ai-overlay {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 380px;
    height: 600px;
    background: #0f172a;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 40px rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #1e293b;
}
@media (max-width: 480px) {
    .ai-overlay { width: 100%; border-radius: 20px 20px 0 0; }
}

.ai-header {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #1e293b;
}
.ai-avatar { font-size: 36px; }
.ai-header-info { flex: 1; }
.ai-title { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1.1rem; color: #fff; }
.ai-subtitle { font-size: 0.75rem; color: #94a3b8; }
.ai-header-actions { display: flex; gap: 8px; }
.btn-icon {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    color: #94a3b8;
    transition: background 0.2s;
}
.btn-icon:hover { background: #1e293b; color: #fff; }

.ai-subject-chips {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    overflow-x: auto;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    flex-shrink: 0;
}
.chip {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid #334155;
    background: #1e293b;
    color: #94a3b8;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.chip:hover, .chip.active { background: #334155; color: #fff; }
.chip-maths { border-color: #10B98140; }
.chip-science { border-color: #F59E0B40; }
.chip-english { border-color: #6366F140; }
.chip-chinese { border-color: #EF444440; }

.ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ai-message { display: flex; }
.ai-message-student { justify-content: flex-end; }
.ai-message-ai { justify-content: flex-start; }
.ai-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
}
.ai-message-ai .ai-bubble {
    background: #1e293b;
    color: #e2e8f0;
    border-bottom-left-radius: 4px;
}
.ai-message-student .ai-bubble {
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.ai-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: #1e293b;
    border-radius: 16px;
    width: fit-content;
}
.ai-typing span {
    width: 6px; height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing-dot 1.2s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-dot {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50% { transform: translateY(-4px); opacity: 1; }
}

.ai-input-area {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: #0f172a;
    border-top: 1px solid #1e293b;
    flex-shrink: 0;
}
.ai-input-area input {
    flex: 1;
    padding: 10px 16px;
    border-radius: 24px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
}
.ai-input-area input:focus { border-color: #6366F1; }
.btn-send {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.2s;
}
.btn-send:hover { transform: scale(1.05); }

/* ═══════════════════════════════════════════════════════════
   NEW v2: COMPOSITION EDITOR
═══════════════════════════════════════════════════════════ */

.composition-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 16px;
}
.comp-topic-picker {
    margin-bottom: 12px;
}
.comp-topic-picker label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #94a3b8;
    font-size: 0.85rem;
}
.comp-topic-picker select {
    width: 100%;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #fff;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
}
.comp-word-count {
    text-align: right;
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 8px;
}
#comp-text {
    width: 100%;
    height: 300px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #fff;
    font-size: 1rem;
    line-height: 1.8;
    font-family: 'Nunito', sans-serif;
    resize: vertical;
    outline: none;
}
#comp-text:focus { border-color: #EF4444; }
#comp-text::placeholder { color: #475569; }
.comp-hint {
    font-size: 0.75rem;
    color: #64748b;
    margin: 8px 0 16px;
}
.comp-loading {
    text-align: center;
    padding: 24px;
    color: #94a3b8;
}
.spinner {
    width: 40px; height: 40px;
    border: 3px solid #334155;
    border-top-color: #6366F1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.comp-feedback-area {
    max-width: 680px;
    margin: 24px auto;
    padding: 0 16px;
}
.comp-feedback-area h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    color: #F59E0B;
    margin-bottom: 16px;
}
#comp-feedback-content {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 16px;
    padding: 20px;
    color: #e2e8f0;
    font-size: 0.95rem;
    line-height: 1.7;
    white-space: pre-wrap;
}
.comp-feedback-area .btn-secondary {
    margin-top: 16px;
    width: 100%;
}

/* ═══════════════════════════════════════════════════════════
   NEW v2: STATS ACTIONS + LINK PARENT
═══════════════════════════════════════════════════════════ */

.stats-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
    padding: 0 16px;
}
.stats-actions button { flex: 1; min-width: 140px; }

/* Link Parent Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-card {
    background: #1e293b;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    overflow: hidden;
    border: 1px solid #334155;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: #0f172a;
    border-bottom: 1px solid #334155;
}
.modal-header h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    color: #fff;
}
.modal-header button {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}
.modal-body {
    padding: 24px;
    color: #94a3b8;
    font-size: 0.9rem;
}
.modal-body p { margin-bottom: 16px; line-height: 1.5; }
.modal-body input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #fff;
    font-size: 1rem;
    margin-bottom: 12px;
    text-align: center;
    letter-spacing: 4px;
    font-size: 1.2rem;
    outline: none;
}
.modal-body input:focus { border-color: #6366F1; }
.modal-body .btn-primary { width: 100%; }

/* ═══════════════════════════════════════════════════════════
   PARENT DASHBOARD (parent.html) — also uses these shared styles
═══════════════════════════════════════════════════════════ */

.parent-body {
    background: #F0F4FF;
    font-family: 'Nunito', sans-serif;
    min-height: 100vh;
    margin: 0;
}
.parent-nav {
    background: #1a2332;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.parent-nav-brand {
    font-family: 'Poppins', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}
.parent-nav-brand span { color: #EF4444; }
.parent-nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.parent-nav-right button {
    background: none;
    border: 1px solid #334155;
    color: #94a3b8;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}
.parent-nav-right button:hover { background: #334155; color: #fff; }

.parent-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* Auth cards */
.auth-container {
    max-width: 420px;
    margin: 60px auto;
    background: #fff;
    border-radius: 24px;
    padding: 40px 32px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    text-align: center;
}
.auth-logo { font-size: 48px; margin-bottom: 8px; }
.auth-title { font-family: 'Poppins', sans-serif; font-size: 1.5rem; font-weight: 700; color: #1e293b; margin-bottom: 4px; }
.auth-subtitle { color: #64748b; margin-bottom: 28px; font-size: 0.9rem; }
.auth-tabs { display: flex; gap: 0; margin-bottom: 24px; background: #f1f5f9; border-radius: 12px; padding: 4px; }
.auth-tab { flex: 1; padding: 10px; border: none; background: none; border-radius: 10px; font-weight: 600; cursor: pointer; font-size: 0.9rem; color: #64748b; transition: all 0.2s; }
.auth-tab.active { background: #fff; color: #1e293b; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.auth-form { text-align: left; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; color: #1e293b; font-size: 0.85rem; }
.form-group input { width: 100%; padding: 12px 16px; border-radius: 12px; border: 1.5px solid #e2e8f0; font-size: 1rem; outline: none; transition: border-color 0.2s; font-family: inherit; }
.form-group input:focus { border-color: #6366F1; }
.btn-auth { width: 100%; padding: 14px; border-radius: 12px; border: none; background: linear-gradient(135deg, #6366F1, #8B5CF6); color: #fff; font-size: 1rem; font-weight: 700; cursor: pointer; transition: transform 0.2s; font-family: inherit; }
.btn-auth:hover { transform: scale(1.02); }

/* Dashboard */
.dashboard-header { margin-bottom: 24px; }
.dashboard-greeting { font-family: 'Poppins', sans-serif; font-size: 1.4rem; font-weight: 700; color: #1e293b; }
.dashboard-sub { color: #64748b; font-size: 0.9rem; }

/* Child cards */
.child-card {
    background: #fff;
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.child-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.child-avatar { width: 48px; height: 48px; border-radius: 50%; background: #6366F1; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.child-name { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1.1rem; color: #1e293b; }
.child-tokens { font-size: 0.8rem; color: #F59E0B; font-weight: 600; }
.child-subjects { display: flex; flex-direction: column; gap: 8px; }
.subject-progress-row { display: flex; align-items: center; gap: 10px; }
.subject-label { font-size: 0.8rem; font-weight: 600; width: 80px; flex-shrink: 0; }
.subject-bar-wrap { flex: 1; height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.subject-bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.subject-score { font-size: 0.75rem; color: #64748b; width: 36px; text-align: right; }
.subject-score strong { color: #1e293b; }

/* Weekly goal */
.weekly-goal-card {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 16px;
    color: #fff;
}
.goal-title { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1rem; margin-bottom: 16px; color: #e2e8f0; }
.goal-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.goal-icon { font-size: 20px; }
.goal-label { flex: 1; font-size: 0.9rem; color: #94a3b8; }
.goal-value { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.1rem; }
.goal-bar { height: 8px; background: #334155; border-radius: 4px; overflow: hidden; margin-top: 4px; }
.goal-fill { height: 100%; background: linear-gradient(90deg, #6366F1, #10B981); border-radius: 4px; transition: width 0.6s ease; }
.goal-achieved { text-align: center; padding: 16px; }
.goal-achieved .trophy { font-size: 40px; }
.goal-achieved p { color: #94a3b8; font-size: 0.9rem; margin-top: 8px; }

/* Activity feed */
.activity-feed { background: #fff; border-radius: 20px; padding: 24px; margin-bottom: 16px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.activity-title { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1rem; color: #1e293b; margin-bottom: 16px; }
.activity-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; font-size: 0.85rem; color: #64748b; }
.activity-item:last-child { border-bottom: none; }
.activity-emoji { font-size: 18px; }
.activity-time { margin-left: auto; font-size: 0.75rem; color: #94a3b8; white-space: nowrap; }

/* Add child / link */
.add-child-card {
    background: #fff;
    border: 2px dashed #e2e8f0;
    border-radius: 20px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.add-child-card:hover { border-color: #6366F1; background: #fafafa; }
.add-child-icon { font-size: 36px; margin-bottom: 8px; }
.add-child-title { font-weight: 700; color: #1e293b; margin-bottom: 4px; }
.add-child-sub { font-size: 0.85rem; color: #64748b; }

/* Linking code display */
.link-code-display {
    background: #f0fdf4;
    border: 2px solid #10B981;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
}
.link-code-label { font-size: 0.85rem; color: #64748b; margin-bottom: 8px; }
.link-code-value {
    font-family: 'Space Grotesk', monospace;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 8px;
    color: #10B981;
    margin-bottom: 8px;
}
.link-code-hint { font-size: 0.75rem; color: #94a3b8; }
.link-code-expires { font-size: 0.75rem; color: #64748b; margin-top: 4px; }

/* Subject color helpers */
.subj-english { color: #6366F1; }
.subj-maths { color: #10B981; }
.subj-science { color: #F59E0B; }
.subj-chinese { color: #EF4444; }
.subj-higher { color: #8B5CF6; }
.bar-english { background: linear-gradient(90deg, #6366F1, #818cf8); }
.bar-maths { background: linear-gradient(90deg, #10B981, #34d399); }
.bar-science { background: linear-gradient(90deg, #F59E0B, #fbbf24); }
.bar-chinese { background: linear-gradient(90deg, #EF4444, #f87171); }
.bar-higher { background: linear-gradient(90deg, #8B5CF6, #a78bfa); }

/* ─── Exam Paper Mode Toggle ─── */
.mode-toggle {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 12px 16px;
}
.mode-btn {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s;
}
.mode-btn.active {
    border-color: #6366F1;
    background: #eef2ff;
    color: #6366F1;
}

/* ─── Filter Section (Exam Papers) ─── */
.filter-section {
    background: white;
    border-radius: 20px;
    padding: 0 0 20px;
    box-shadow: 0 4px 20px rgba(99,102,241,0.1);
    overflow: hidden;
    margin: 0 0 16px;
}

/* Step header bar — purple gradient banner */
.exam-step-header {
    padding: 14px 20px;
    background: linear-gradient(135deg, #F59E0B, #FCD34D);
    color: white;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Back buttons — nice gradient pill */
.btn-back-small {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: 24px;
    background: linear-gradient(135deg, #F59E0B, #FCD34D);
    color: white;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    margin: 14px 16px 4px;
    box-shadow: 0 2px 10px rgba(245,158,11,0.3);
    transition: all 0.2s;
}
.btn-back-small:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(245,158,11,0.4);
}

/* Filter label */
.filter-label {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
    padding: 12px 20px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.filter-label.year-label  { color: #2563EB; }
.filter-label.school-label { color: #059669; }

/* School Groups — collapsible sections */
.school-groups {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.school-group {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #FDE68A;
    background: #FFFBEB;
    transition: all 0.2s;
}
.school-group-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    border: none;
    border-bottom: 1px solid #FDE68A;
    font-size: 0.85rem;
    font-weight: 700;
    color: #92400E;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
}
.school-group-header:hover {
    background: linear-gradient(135deg, #FDE68A, #FCD34D);
}
.school-group-header.has-selection {
    background: linear-gradient(135deg, #F59E0B, #FCD34D);
    color: white;
}
.school-group-header .sg-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
}
.school-group-header .sg-count {
    font-size: 0.7rem;
    font-weight: 500;
    opacity: 0.8;
}
.school-group-header.has-selection .sg-count {
    color: #FEF3C7;
}
.school-group-body {
    display: none;
    padding: 8px 12px;
    background: #FFFBEB;
}
.school-group.expanded .school-group-body {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;

}
.school-group-body .school-chip {
    border-color: #FDE68A;
    background: white;
    color: #92400E;
    padding: 6px 14px;
    font-size: 0.82rem;
    border-width: 2px;
    border-radius: 20px;
}
.school-group-body .school-chip:hover {
    border-color: #F59E0B;
    color: #F59E0B;
    background: #FFFBEB;
}
.school-group-body .school-chip.selected {
    border-color: #F59E0B;
    background: linear-gradient(135deg, #F59E0B, #FCD34D);
    color: white;
}

/* Grouped schools - flex with space-between for even distribution */
.school-group-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
    width: 100%;
    box-sizing: border-box;
}

/* Ungrouped schools row - CSS grid for better row fill */
.school-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    justify-content: flex-start;
}

/* All schools in CSS grid with evenly-sized columns */
.school-chips-flex {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    padding-bottom: 16px;
}

/* School chips — fill their grid cell */
.school-chips-row .filter-chip,
.school-chips-flex .filter-chip {
    width: 100%;
    box-sizing: border-box;
}

/* Ungrouped schools - same as Year chips */
.school-groups .filter-chip:not(.school-chip) {
    margin-top: 4px;
    padding: 6px 14px !important;
    font-size: 0.82rem !important;
    border: 2px solid #FDE68A !important;
    border-radius: 20px !important;
}

/* Small school chips */
/* School chips base - overridden by .filter-chip.school-chip below */
.school-chip {
    padding: 3px 7px;
    font-size: 0.68rem;
    border: 2px solid #FDE68A;
    background: white;
    color: #92400E;
    border-radius: 20px;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px;
}

/* Year / School chips */
.filter-chip {
    padding: 6px 14px;
    border: 2px solid #E2E8F0;
    border-radius: 20px;
    background: white;
    font-size: 0.82rem;
    cursor: pointer;
    color: #475569;
    transition: all 0.2s;
}

/* School chips - same styling as Year chips (specificity beats .filter-chip + later source order) */
.filter-chip.school-chip {
    padding: 6px 14px !important;
    font-size: 0.82rem !important;
    border: 2px solid #FDE68A !important;
    background: white !important;
    color: #92400E !important;
    border-radius: 20px !important;
}
.filter-chip:hover {
    border-color: #F59E0B;
    color: #F59E0B;
    background: #FFFBEB;
    transform: translateY(-1px);
}
.filter-chip.selected,
.filter-chip.school-chip.selected {
    border-color: #F59E0B !important;
    background: linear-gradient(135deg, #F59E0B, #FCD34D) !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(245,158,11,0.3);
}

/* WA1 / WA2 grouped buttons — larger and bold purple */
.filter-chip.filter-chip-group {
    padding: 8px 20px;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 24px;
    border: 2px solid #F59E0B;
    color: #F59E0B;
    background: #FFFBEB;
}
.filter-chip.filter-chip-group:hover {
    background: linear-gradient(135deg, #F59E0B, #FCD34D);
    color: white;
    border-color: #F59E0B;
    transform: translateY(-1px);
}
.filter-chip.filter-chip-group.selected {
    background: linear-gradient(135deg, #F59E0B, #FCD34D);
    color: white;
    border-color: #F59E0B;
    box-shadow: 0 4px 14px rgba(245,158,11,0.4);
}

/* Individual assessment chips (Practice, Term Review, Topical, etc.) */
.semester-body .filter-chip:not(.filter-chip-group) {
    border-radius: 20px;
    font-size: 0.82rem;
    padding: 6px 14px;
    border-color: #FDE68A;
    background: #FFFBEB;
    color: #92400E;
}
.semester-body .filter-chip:not(.filter-chip-group):hover {
    border-color: #F59E0B;
    color: #F59E0B;
    background: #FFFBEB;
}
.semester-body .filter-chip:not(.filter-chip-group).selected {
    border-color: #F59E0B;
    background: linear-gradient(135deg, #F59E0B, #FCD34D);
    color: white;
}

/* ─── Semester Sections ─── */
.semester-section {
    border-radius: 16px;
    overflow: hidden;
    margin: 16px 0 14px;
    box-shadow: 0 4px 16px rgba(124,58,237,0.12);
}
.semester-header-bar {
    padding: 12px 20px;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}
.semester-header-bar.sem1 {
    background: linear-gradient(135deg, #7C3AED, #A855F7);
}
.semester-header-bar.sem2 {
    background: linear-gradient(135deg, #7C3AED, #A855F7);
}
.semester-body {
    background: white;
    padding: 14px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.semester-divider {
    height: 12px;
}

/* ─── Paper Card ─── */
.paper-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    margin: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.paper-card:hover {
    border-color: #6366F1;
    box-shadow: 0 2px 8px rgba(99,102,241,0.1);
}
.paper-card.selected {
    border-color: #6366F1;
    background: #eef2ff;
}
.paper-school { font-weight: 700; font-size: 0.95rem; color: #1e293b; flex: 1; }
.paper-year { font-size: 0.8rem; color: #94a3b8; }
.paper-count { font-size: 0.75rem; background: #f1f5f9; padding: 3px 8px; border-radius: 10px; color: #64748b; }
.paper-stars { font-size: 0.8rem; }

/* PDF Viewer Overlay */
.pdf-overlay {
    position: fixed;
    inset: 0;
    background: #0f172a;
    z-index: 3000;
    display: flex;
    flex-direction: column;
}
.pdf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    flex-shrink: 0;
}
.pdf-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #f1f5f9;
}
.pdf-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.pdf-actions .btn-icon {
    background: #334155;
    border: none;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 1rem;
    color: #f1f5f9;
    text-decoration: none;
    transition: background 0.2s;
}
.pdf-actions .btn-icon:hover {
    background: #475569;
}
.pdf-viewer-wrap {
    flex: 1;
    overflow: hidden;
    display: flex;
}
#pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #666;
}

/* PDF Viewer Screen */
.pdf-viewer-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    background: #0f172a;
}
.pdf-viewer-title {
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: #94a3b8;
    padding: 8px 16px 4px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    flex-shrink: 0;
}
#pdf-iframe-inline {
    flex: 1;
    width: 100%;
    border: none;
    background: #525252;
}

/* ─── Study Guides (SGExamPapers.com) ──────────────────────── */
.site-header { background: #0f172a; padding: 16px 0; border-bottom: 1px solid #1e293b; position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand-mark { background: linear-gradient(135deg, #10b981, #6366f1); width: 36px; height: 36px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-family: 'Poppins', sans-serif; }
/* Generic page container — centers content within the viewport (matches .guides-main ~760px). */
.container { max-width: 760px; margin: 0 auto; padding: 0 16px; box-sizing: border-box; }
.container.header-inner { max-width: 1100px; }
.brand-text { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1.05rem; }
.primary-nav { display: flex; flex-wrap: wrap; gap: 14px; }
.primary-nav a { color: #cbd5e1; text-decoration: none; font-weight: 600; font-size: 0.95rem; padding: 6px 10px; border-radius: 8px; }
.primary-nav a:hover { background: #1e293b; color: #fff; }
.primary-nav a.active { background: #10b981; color: #fff; }
/* Level-link highlight: brand indigo to differentiate from "Study Guides" green. */
.primary-nav a[href^="/primary-"].active {
    background: #6366f1;
    color: #fff;
    box-shadow: 0 4px 12px -2px rgba(99, 102, 241, 0.4);
}
.breadcrumb { margin: 20px 0 12px; font-size: 0.85rem; color: #64748b; }
.breadcrumb-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumb-list li + li::before { content: '›'; margin-right: 6px; color: #94a3b8; }
.breadcrumb-list a { color: #2563eb; text-decoration: none; }
.breadcrumb-list [aria-current="page"] { color: #0f172a; font-weight: 600; }

.guides-hero, .guides-level-hero, .guides-article-hero { background: linear-gradient(135deg, #ecfdf5, #eef2ff); border: 1px solid #c7d2fe; border-radius: 16px; padding: 28px; margin: 20px 0; }
.guides-hero h1, .guides-level-hero h1, .guides-article-hero h1 { font-family: 'Poppins', sans-serif; color: #0f172a; font-size: 1.8rem; line-height: 1.3; margin-bottom: 8px; }
.guides-lede { color: #475569; font-size: 1.05rem; line-height: 1.6; }
.guides-byline { color: #64748b; font-size: 0.85rem; margin-top: 8px; }

.levels-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin: 16px 0 24px; }
.level-card { display: block; padding: 18px; border-radius: 14px; background: #fff; border: 2px solid #e2e8f0; text-decoration: none; color: #0f172a; transition: transform .15s, border-color .15s, box-shadow .15s; }
.level-card:hover { transform: translateY(-2px); border-color: #6366f1; box-shadow: 0 8px 24px rgba(99,102,241,0.18); }
.level-card-grade { font-family: 'Poppins', sans-serif; font-weight: 800; color: #6366f1; font-size: 1.4rem; }
.level-card-title { font-weight: 700; margin-top: 4px; }
.level-card-desc { color: #475569; font-size: 0.85rem; margin-top: 4px; }

.guides-what, .guides-moe-source, .guides-articles-list, .guides-psle-banner { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 22px; margin: 16px 0; }
.guides-what h2, .guides-moe-source h2, .guides-articles-list h2, .guides-psle-banner h2 { font-family: 'Poppins', sans-serif; color: #0f172a; font-size: 1.25rem; margin-bottom: 12px; }
.guides-list { padding-left: 22px; line-height: 1.7; color: #334155; }
.guides-list a { color: #2563eb; }
.guides-moe-links a { display: inline-block; margin-right: 14px; color: #2563eb; font-weight: 600; }
.guides-moe-link { margin-top: 8px; font-size: 0.9rem; color: #475569; }
.guides-moe-link a { color: #2563eb; font-weight: 600; }

.guides-articles { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.guides-articles li { background: #f8fafc; padding: 14px 16px; border-radius: 10px; border: 1px solid #e2e8f0; }
.guides-articles a { color: #0f172a; font-weight: 700; text-decoration: none; }
.guides-articles a:hover { color: #2563eb; }
.guides-snippet { color: #64748b; font-weight: 400; }

.guides-psle-banner { background: linear-gradient(135deg, #fef3c7, #fde68a); border-color: #fbbf24; }

.guides-coming-soon { background: #f1f5f9; border: 1px dashed #cbd5e1; padding: 14px 18px; border-radius: 10px; color: #475569; }

.guides-article h2 { font-family: 'Poppins', sans-serif; color: #0f172a; margin-top: 22px; margin-bottom: 10px; font-size: 1.2rem; }
.guides-article p { line-height: 1.75; color: #334155; margin-bottom: 12px; }
.guides-article a { color: #2563eb; }

.guides-sources { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 14px; padding: 22px; margin: 16px 0; }
.guides-sources h2 { font-family: 'Poppins', sans-serif; color: #0f172a; font-size: 1.1rem; margin-bottom: 10px; }
.guides-sources ul { padding-left: 22px; }
.guides-sources li { margin-bottom: 4px; }

.guides-articles-section { background: linear-gradient(135deg, #1e293b, #0f172a); border-radius: 16px; padding: 28px; margin: 24px 0; border: 1px solid #334155; }
.guides-articles-section h2 { color: #f1f5f9; font-family: 'Poppins', sans-serif; margin-bottom: 8px; }
.guides-articles-section .guides-lede { color: #94a3b8; margin-bottom: 16px; }
.guides-articles-section .guides-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.guides-articles-section .guides-tile { background: #334155; color: #f1f5f9; padding: 14px 16px; border-radius: 10px; text-decoration: none; font-weight: 700; display: block; transition: transform .15s, background .15s; }
.guides-articles-section .guides-tile:hover { background: #475569; transform: translateY(-2px); }

.site-footer { background: #0f172a; color: #94a3b8; padding: 24px 0; margin-top: 36px; font-size: 0.9rem; }
.site-footer p { margin: 4px 0; text-align: center; }
.site-footer a { color: #cbd5e1; text-decoration: none; }
.site-footer a:hover { color: #fff; }
.footer-links a + a { margin-left: 10px; }

/* Study Guides — level page subject cards */
.guides-subjects { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 22px; margin: 16px 0; }
.guides-subjects h2 { font-family: 'Poppins', sans-serif; color: #0f172a; font-size: 1.25rem; margin-bottom: 12px; }
.guides-subjects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 16px; }
.guides-subject-card { display: block; padding: 18px 16px; border-radius: 12px; background: linear-gradient(135deg, #eef2ff, #ecfdf5); border: 2px solid #c7d2fe; text-decoration: none; color: #1e293b; transition: transform .15s, box-shadow .15s, border-color .15s; }
.guides-subject-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(99,102,241,0.18); border-color: #6366f1; }
.guides-subject-card-name { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1.05rem; color: #0f172a; }
.guides-subject-card-cta { color: #2563eb; font-weight: 600; font-size: 0.85rem; margin-top: 6px; }

/* Cross-link sections on level pages */
.guides-papers { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 22px; margin: 16px 0; }
.guides-papers h2 { font-family: 'Poppins', sans-serif; color: #0f172a; font-size: 1.15rem; margin-bottom: 8px; }
.guides-papers p { color: #475569; margin-bottom: 12px; line-height: 1.6; }
.guides-link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.guides-link-card { display: block; padding: 12px 14px; border-radius: 10px; background: #10b981; color: #fff; font-weight: 700; text-decoration: none; transition: transform .15s, background .15s; }
.guides-link-card:hover { background: #059669; transform: translateY(-2px); }
.guides-link-card-secondary { background: #475569; }
.guides-link-card-secondary:hover { background: #334155; }

/* ─── Study Guides — clean redesign ───────────────────────── */
.guides-page-hero { padding: 12px 0 28px; border-bottom: 1px solid #e2e8f0; margin-bottom: 32px; }
.guides-eyebrow { color: #6366f1; font-weight: 700; font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px; }
.guides-page-hero h1 { font-family: 'Poppins', sans-serif; color: #0f172a; font-size: 2rem; line-height: 1.2; margin-bottom: 12px; font-weight: 800; }
.guides-page-hero .guides-lede { color: #475569; font-size: 1.05rem; line-height: 1.6; max-width: 720px; }

.guides-block { margin-bottom: 36px; }
.guides-block h2 { font-family: 'Poppins', sans-serif; color: #0f172a; font-size: 1.35rem; font-weight: 700; margin-bottom: 12px; }
.guides-block p { color: #475569; line-height: 1.7; margin-bottom: 16px; max-width: 720px; }
.guides-block a { color: #6366f1; }

.guides-block-note { padding: 16px 20px; background: #f8fafc; border-left: 3px solid #6366f1; border-radius: 0 8px 8px 0; }
.guides-block-note p { margin-bottom: 0; color: #64748b; font-size: 0.92rem; }

.guides-pills { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.guides-pill { display: inline-block; padding: 10px 18px; border-radius: 999px; background: #6366f1; color: #fff !important; font-weight: 600; font-size: 0.95rem; text-decoration: none; transition: background .15s, transform .15s; white-space: nowrap; }
.guides-pill:hover { background: #4f46e5; transform: translateY(-1px); }
.guides-pill-ghost { background: transparent; color: #6366f1 !important; border: 1.5px solid #c7d2fe; }
.guides-pill-ghost:hover { background: #eef2ff; }

/* Hub page hero */
.guides-hero { background: linear-gradient(135deg, #eef2ff, #ecfdf5); border-radius: 16px; padding: 32px 28px; margin: 20px 0; border: 1px solid #c7d2fe; }
.guides-hero h1 { font-family: 'Poppins', sans-serif; color: #0f172a; font-size: 1.9rem; line-height: 1.25; margin-bottom: 10px; font-weight: 800; }

/* Article hero on guide pages */
.guides-article-hero { padding: 12px 0 24px; border-bottom: 1px solid #e2e8f0; margin-bottom: 28px; }
.guides-article-hero h1 { font-family: 'Poppins', sans-serif; color: #0f172a; font-size: 1.85rem; line-height: 1.25; margin-bottom: 8px; font-weight: 800; }
.guides-byline { color: #94a3b8; font-size: 0.85rem; }

/* Final polish */
.guides-pills-label { color: #94a3b8; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 10px !important; }
.guides-block-note-muted { background: #fafafa; border-left-color: #cbd5e1; }
.guides-block-note-muted h2 { font-size: 1rem; color: #475569; margin-bottom: 8px; }
.guides-block-note-muted p { color: #64748b; font-size: 0.9rem; }
.guides-moe-links a { display: inline-block; margin: 4px 6px 4px 0; padding: 6px 14px; border-radius: 999px; background: #eef2ff; color: #4f46e5 !important; font-weight: 600; font-size: 0.85rem; text-decoration: none; }
.guides-moe-links a:hover { background: #c7d2fe; }
.breadcrumb-list [aria-current="page"] { color: #6366f1; }

/* ─── Study Guides v3 — article-style, uniform buttons, clean citations ─── */
.guides-main { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }

.guides-article { font-family: 'Inter', sans-serif; }
.guides-article-header { margin-bottom: 40px; padding-bottom: 24px; border-bottom: 1px solid #e2e8f0; }
.guides-article-header h1 { font-family: 'Poppins', sans-serif; color: #0f172a; font-size: 2.25rem; line-height: 1.2; font-weight: 800; margin: 8px 0 12px; }
.guides-eyebrow { color: #6366f1; font-weight: 700; font-size: 0.85rem; letter-spacing: 0.05em; text-transform: uppercase; }
.guides-summary { color: #475569; font-size: 1.1rem; line-height: 1.65; max-width: 680px; }

.guides-section { margin-bottom: 44px; }
.guides-section h2 { font-family: 'Poppins', sans-serif; color: #0f172a; font-size: 1.35rem; font-weight: 700; margin-bottom: 10px; }
.guides-section p { color: #334155; line-height: 1.75; margin-bottom: 16px; max-width: 680px; }
.guides-section a { color: #6366f1; }

.guides-citation { font-size: 0.85rem; color: #94a3b8; font-style: italic; margin-top: -8px; margin-bottom: 0 !important; }
.guides-citation a { color: #6366f1; }

.guides-pills { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.guides-pill { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 999px; background: #6366f1; color: #fff; font-weight: 600; font-size: 0.95rem; text-decoration: none; transition: background .15s, transform .15s; white-space: nowrap; line-height: 1.2; }
.guides-pill:hover { background: #4f46e5; transform: translateY(-1px); }
.guides-pill-cta { background: #6366f1; }
.guides-arrow { font-size: 1rem; line-height: 1; }

.guides-footer-meta { background: #f8fafc; border-top: 1px solid #e2e8f0; border-radius: 8px; padding: 20px 24px; margin-top: 48px; margin-bottom: 24px; }
.guides-footer-meta p { color: #64748b; font-size: 0.9rem; line-height: 1.65; margin: 0; }
.guides-footer-links { margin-top: 12px !important; display: flex; flex-wrap: wrap; gap: 8px; }
.guides-footer-links a { color: #4f46e5 !important; font-weight: 600; padding: 4px 12px; border-radius: 999px; background: #eef2ff; font-size: 0.85rem; text-decoration: none; }
.guides-footer-links a:hover { background: #c7d2fe; }

@media (max-width: 600px) {
  .guides-main { padding: 16px; }
  .guides-article-header h1 { font-size: 1.75rem; }
  .guides-section h2 { font-size: 1.2rem; }
}

/* v3 polish — differentiate rows, tighter rhythm, icons */
.guides-pill-primary { background: #6366f1; }
.guides-pill-primary:hover { background: #4f46e5; }
.guides-pill-secondary { background: #fff; color: #6366f1 !important; border: 1.5px solid #c7d2fe; }
.guides-pill-secondary:hover { background: #eef2ff; border-color: #6366f1; }
.guides-pill-icon { font-size: 1.05rem; line-height: 1; margin-right: 4px; }

/* Tighter vertical rhythm */
.guides-section { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid #f1f5f9; }
.guides-section:last-of-type { border-bottom: none; padding-bottom: 0; }
.guides-article-header { margin-bottom: 32px; }

/* Hero header gets a colored accent bar */
.guides-article-header { position: relative; padding-left: 16px; }
.guides-article-header::before { content: ""; position: absolute; left: 0; top: 0; bottom: 24px; width: 4px; background: #6366f1; border-radius: 4px; }

/* ════════════════════════════════════════════════════════════════════════
   STUDY GUIDES v4 — colorful cards, subject-coded blocks, warm practice
   Adds on top of v3 .guides-* classes.
   ════════════════════════════════════════════════════════════════════════ */

/* Hero accent — colourful gradient banner above the article */
.guides-hero {
    position: relative;
    padding: 36px 36px 32px !important;
    background: linear-gradient(135deg, #eef2ff 0%, #fae8ff 60%, #fff7ed 100%) !important;
    border-radius: 18px !important;
    margin-bottom: 32px !important;
    border-bottom: none !important;
    border: 1px solid rgba(99, 102, 241, 0.12) !important;
    overflow: hidden;
}
.guides-hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 6px;
    background: linear-gradient(180deg, #6366f1, #ec4899 50%, #f59e0b);
}
.guides-hero .guides-eyebrow {
    background: linear-gradient(90deg, #6366f1, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800 !important;
    letter-spacing: 0.06em;
    font-size: 0.85rem !important;
}
.guides-hero h1 {
    margin-top: 6px !important;
    font-size: 2.4rem !important;
    background: linear-gradient(135deg, #1e293b 0%, #4f46e5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.025em;
    line-height: 1.15 !important;
}
.guides-hero .guides-summary {
    font-size: 1.05rem !important;
    color: #475569 !important;
}

/* Card grid (subjects + level cards) */
.guides-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin: 18px 0 8px;
}
.guides-card-grid .guides-card:nth-child(2) { animation-delay: 60ms; }
.guides-card-grid .guides-card:nth-child(3) { animation-delay: 120ms; }
.guides-card-grid .guides-card:nth-child(4) { animation-delay: 180ms; }
.guides-card-grid .guides-card:nth-child(5) { animation-delay: 240ms; }

/* Base card (subject-coloured) */
.guides-card {
    --card-color: #6366f1;
    --card-color-dark: #4338ca;
    --card-color-light: #e0e7ff;
    position: relative;
    display: grid;
    grid-template-columns: 56px 1fr auto;
    align-items: center;
    gap: 18px;
    padding: 18px 22px 18px 18px;
    border-radius: 14px;
    text-decoration: none;
    background: var(--card-color-light);
    color: #0f172a;
    border: 1.5px solid transparent;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
    overflow: hidden;
}
.guides-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 4px;
    background: var(--card-color);
    border-radius: 14px 0 0 14px;
}
.guides-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px -8px rgba(99, 102, 241, 0.25);
    border-color: var(--card-color);
    color: #0f172a;
}
.guides-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--card-color);
    color: white;
    font-weight: 800;
    font-size: 1.5rem;
    line-height: 1;
    box-shadow: 0 4px 10px -3px var(--card-color-dark);
}
.guides-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.guides-card-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--card-color-dark);
    line-height: 1.3;
}
.guides-card-desc {
    font-size: 0.9rem;
    color: #475569;
    line-height: 1.45;
}
.guides-card-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    color: var(--card-color);
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1.5px var(--card-color);
    transition: transform 160ms ease;
}
.guides-card:hover .guides-card-arrow {
    transform: translateX(4px);
}

/* Level variant — wider, more pillowy, used on the hub */
.guides-card-level {
    padding: 22px 24px 22px 20px;
    border-radius: 16px;
}
.guides-card-level .guides-card-icon {
    width: 64px;
    height: 64px;
    font-size: 1.4rem;
}

/* Section accent variants (left colour bar) */
.guides-section-color {
    border-left: 4px solid #6366f1;
    padding-left: 22px !important;
}
.guides-section-info {
    border-left: 4px solid #0891b2;
    padding-left: 22px !important;
    background: linear-gradient(90deg, #ecfeff 0%, transparent 40%);
}
.guides-section-warm {
    border-left: 4px solid #f97316;
    padding-left: 22px !important;
    background: linear-gradient(90deg, #fff7ed 0%, transparent 40%);
}
.guides-section-warm h2 { color: #c2410c; }
.guides-section-info h2 { color: #0e7490; }
.guides-section-color h2 { color: #4338ca; }

/* Practice section — warm coral pills */
.guides-practice-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 18px 0 8px;
}
.guides-practice-pill {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: white;
    border: 1.5px solid #fed7aa;
    border-radius: 12px;
    text-decoration: none;
    color: #9a3412;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 160ms ease;
}
.guides-practice-pill:hover {
    border-color: #f97316;
    background: #fff7ed;
    color: #7c2d12;
    transform: translateX(2px);
}
.guides-practice-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f97316, #ec4899);
    flex-shrink: 0;
}

/* Section H2 with emoji — keep emoji inline, large weight */
.guides-article h2 {
    font-size: 1.4rem !important;
    margin-bottom: 12px !important;
    font-weight: 800 !important;
    letter-spacing: -0.015em;
}

/* Improve the old-school pill row fallback (just in case a build still has them) */
.guides-pills {
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.guides-pills li { margin: 0; padding: 0; }
.guides-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: transform 120ms ease;
}
.guides-pill:hover { transform: translateY(-1px); }
.guides-pill-primary {
    background: #6366f1;
    color: white;
}
.guides-pill-secondary {
    background: white;
    color: #6366f1;
    border: 1.5px solid #c7d2fe;
}

/* Footer meta links — colorful MOE chip style */
.guides-footer-meta {
    margin-top: 36px;
    padding: 24px 28px;
    border-radius: 14px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border: 1px solid #e2e8f0;
}
.guides-footer-links { margin-top: 10px; }
.guides-footer-links a {
    display: inline-block;
    margin: 4px 4px 4px 0;
    padding: 6px 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-size: 0.85rem;
    text-decoration: none;
    color: #4f46e5;
    font-weight: 600;
    transition: all 160ms ease;
}
.guides-footer-links a:hover {
    border-color: #6366f1;
    background: #eef2ff;
    color: #4338ca;
}

/* Mobile reflow — keep cards full-width, larger touch targets */
@media (max-width: 600px) {
    .guides-article-header.guides-hero {
        padding: 24px 20px !important;
    }
    .guides-hero h1 { font-size: 1.75rem !important; }
    .guides-card {
        padding: 14px 16px;
        gap: 12px;
        grid-template-columns: 44px 1fr auto;
    }
    .guides-card-icon {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
        border-radius: 10px;
    }
    .guides-card-arrow {
        width: 26px;
        height: 26px;
    }
    .guides-section-color,
    .guides-section-info,
    .guides-section-warm {
        padding-left: 16px !important;
    }
}

/* ─── Popular Schools grid (homepage) ───────────────────────────────────── */
.schools-section h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    margin: 36px 0 16px;
    letter-spacing: -0.01em;
}
.schools-section h2 .schools-count {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    margin-left: 8px;
}
.schools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}
.school-card {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12px 14px;
    min-height: 80px;
    border-radius: 14px;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.2;
    text-decoration: none;
    box-shadow: 0 4px 14px -4px rgba(0, 0, 0, 0.08);
    transition: transform 160ms ease, box-shadow 160ms ease;
    border: 1px solid rgba(255, 255, 255, 0.6);
    /* gradient + color still come from inline style attribute */
}
.school-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px -6px rgba(0, 0, 0, 0.15);
}
