/* ============================================
   PassMyExams - GCSE Maths
   Complete Stylesheet
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Primary */
    --primary-deep: #1a237e;
    --primary-mid: #3949ab;
    --primary-light: #7986cb;
    --primary-pale: #c5cae9;

    /* Topic accent colours */
    --topic1-color: #00897b; /* Number - Teal */
    --topic2-color: #7b1fa2; /* Algebra - Purple */
    --topic3-color: #f57f17; /* Ratio - Amber */
    --topic4-color: #1565c0; /* Geometry - Blue */
    --topic5-color: #2e7d32; /* Probability - Green */

    --topic1-light: #e0f2f1;
    --topic2-light: #f3e5f5;
    --topic3-light: #fff8e1;
    --topic4-light: #e3f2fd;
    --topic5-light: #e8f5e9;

    /* Backgrounds */
    --bg-paper: #f5f0e8;
    --bg-card: #fffef5;
    --bg-cork: #c19a6b;
    --bg-cork-dark: #a07850;

    /* Post-it colours */
    --postit-yellow: #fff9c4;
    --postit-pink: #fce4ec;
    --postit-blue: #e1f5fe;
    --postit-green: #e8f5e9;
    --postit-orange: #fff3e0;
    --postit-lavender: #ede7f6;

    /* Text */
    --text-dark: #212121;
    --text-mid: #424242;
    --text-light: #757575;
    --text-white: #ffffff;

    /* UI */
    --success: #43a047;
    --error: #e53935;
    --warning: #fb8c00;
    --border: #e0d8cc;
    --shadow: rgba(0,0,0,0.12);
    --shadow-md: rgba(0,0,0,0.18);

    /* Layout */
    --header-h: 64px;
    --sidebar-w: 280px;
    --content-max: 900px;
    --radius: 8px;
    --radius-lg: 16px;

    /* Fonts */
    --font-body: 'Nunito', sans-serif;
    --font-hand: 'Patrick Hand', cursive;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--bg-paper);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-mid); text-decoration: none; }
a:hover { color: var(--primary-deep); text-decoration: underline; }
img { max-width: 100%; display: block; }
ul, ol { padding-left: 1.5em; }
h1, h2, h3, h4 { line-height: 1.3; color: var(--primary-deep); }
h1 { font-size: 2.2rem; }
h2 { font-size: 1.6rem; margin-bottom: 0.8rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
h4 { font-size: 1.1rem; margin-bottom: 0.4rem; }

/* --- Header / Nav --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--primary-deep);
    color: var(--text-white);
    box-shadow: 0 2px 8px var(--shadow-md);
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: var(--header-h);
}
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-white);
    font-weight: 700;
    font-size: 1.2rem;
    text-decoration: none;
}
.logo:hover { color: var(--text-white); text-decoration: none; }
.logo-icon { font-size: 1.5rem; }
.logo-subtitle {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.85;
    display: block;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    padding: 0;
}
.nav-links a {
    color: var(--primary-pale);
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
    text-decoration: none;
}
.nav-links a:hover, .nav-links a.active {
    background: rgba(255,255,255,0.15);
    color: var(--text-white);
    text-decoration: none;
}
.nav-progress-bar {
    height: 3px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin-top: 2px;
    overflow: hidden;
}
.nav-progress-fill {
    height: 100%;
    background: #4fc3f7;
    border-radius: 2px;
    width: 0%;
    transition: width 0.4s ease;
}

/* Hamburger */
.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* --- Hero Section --- */
.hero {
    background: linear-gradient(135deg, var(--primary-deep) 0%, #7b1fa2 100%);
    color: var(--text-white);
    padding: 4rem 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Ctext x='30' y='35' font-size='20' text-anchor='middle' fill='rgba(255,255,255,0.04)'%3E%CF%80%3C/text%3E%3C/svg%3E");
    pointer-events: none;
}
.hero-content { position: relative; max-width: 700px; margin: 0 auto; }
.hero h1 {
    font-size: 2.8rem;
    color: var(--text-white);
    margin-bottom: 1rem;
}
.hero h1 span {
    background: linear-gradient(90deg, #4fc3f7, #81d4fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero p {
    font-size: 1.15rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}
.stat-item {
    text-align: center;
}
.stat-number {
    font-size: 2rem;
    font-weight: 800;
    display: block;
}
.stat-label {
    font-size: 0.85rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.2); text-decoration: none; }
.btn-primary {
    background: #4fc3f7;
    color: var(--primary-deep);
}
.btn-primary:hover { background: #81d4fa; color: var(--primary-deep); }

/* --- Corkboard / Topic Cards --- */
.corkboard {
    background: var(--bg-cork);
    background-image:
        radial-gradient(circle, rgba(0,0,0,0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    padding: 3rem 1.5rem;
    border-top: 4px solid var(--bg-cork-dark);
    border-bottom: 4px solid var(--bg-cork-dark);
}
.corkboard h2 {
    text-align: center;
    color: var(--text-white);
    margin-bottom: 2rem;
    font-size: 1.8rem;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

.topic-grid {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.topic-card {
    background: var(--bg-card);
    border-radius: 2px;
    padding: 1.8rem 1.5rem 1.5rem;
    position: relative;
    box-shadow: 2px 3px 10px rgba(0,0,0,0.15);
    transition: transform 0.3s, box-shadow 0.3s;
    transform: rotate(var(--rotation, 0deg));
}
.topic-card:hover {
    transform: rotate(0deg) translateY(-4px);
    box-shadow: 4px 6px 20px rgba(0,0,0,0.2);
}
.topic-card::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #d32f2f 40%, #b71c1c 50%, transparent 55%);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 1;
}

.topic-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}
.topic-card-icon { font-size: 1.8rem; }
.topic-card h3 {
    font-size: 1.15rem;
    color: var(--primary-deep);
    margin: 0;
}

.topic-card ul {
    list-style: none;
    padding: 0;
    margin-bottom: 1rem;
}
.topic-card li {
    padding: 0.2rem 0;
    font-size: 0.9rem;
    color: var(--text-mid);
}
.topic-card li::before {
    content: '\2713';
    margin-right: 0.5rem;
    color: var(--success);
    font-weight: 700;
}

.topic-card-progress {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 1rem;
}
.topic-card-progress-fill {
    height: 100%;
    border-radius: 3px;
    width: 0%;
    transition: width 0.4s ease;
}

.topic-card .btn-topic {
    display: block;
    text-align: center;
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-white);
    transition: opacity 0.2s;
    text-decoration: none;
}
.topic-card .btn-topic:hover { opacity: 0.9; text-decoration: none; }

/* Topic-specific card colours */
.topic-card[data-topic="1"] .topic-card-progress-fill,
.topic-card[data-topic="1"] .btn-topic { background: var(--topic1-color); }
.topic-card[data-topic="2"] .topic-card-progress-fill,
.topic-card[data-topic="2"] .btn-topic { background: var(--topic2-color); }
.topic-card[data-topic="3"] .topic-card-progress-fill,
.topic-card[data-topic="3"] .btn-topic { background: var(--topic3-color); }
.topic-card[data-topic="4"] .topic-card-progress-fill,
.topic-card[data-topic="4"] .btn-topic { background: var(--topic4-color); }
.topic-card[data-topic="5"] .topic-card-progress-fill,
.topic-card[data-topic="5"] .btn-topic { background: var(--topic5-color); }

/* --- Mind Map Section --- */
.mindmap-section {
    padding: 3rem 1.5rem;
    text-align: center;
    background: var(--bg-paper);
}
.mindmap-section h2 { margin-bottom: 1rem; }
.mindmap-section p { color: var(--text-light); margin-bottom: 2rem; }
#mindmap-container {
    max-width: 1000px;
    margin: 0 auto;
    overflow: visible;
}
#mindmap-container svg { width: 100%; height: auto; }

.mindmap-node {
    cursor: pointer;
    transition: transform 0.2s;
}
.mindmap-node:hover { filter: brightness(1.1); }
.mindmap-tooltip {
    position: absolute;
    background: var(--primary-deep);
    color: var(--text-white);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 50;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
}
.mindmap-tooltip.show { opacity: 1; }

/* --- Exam Info Section --- */
.exam-info-section {
    padding: 3rem 1.5rem;
    background: white;
}
.exam-info-section h2 { text-align: center; margin-bottom: 2rem; }
.exam-grid {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}
.exam-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
}
.exam-card h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--primary-mid);
}
.exam-card table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.exam-card td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.exam-card td:first-child {
    font-weight: 700;
    color: var(--text-mid);
    width: 50%;
}

/* --- Footer --- */
.site-footer {
    background: var(--primary-deep);
    color: var(--primary-pale);
    padding: 3rem 1.5rem 1.5rem;
}
.footer-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
}
.footer-col h4 {
    color: var(--text-white);
    margin-bottom: 0.8rem;
    font-size: 1rem;
}
.footer-col p, .footer-col a {
    font-size: 0.9rem;
    color: var(--primary-pale);
    line-height: 1.8;
}
.footer-col a:hover { color: var(--text-white); }
.footer-col ul { list-style: none; padding: 0; }
.footer-col li { margin-bottom: 0.3rem; }

.donate-btns {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.donate-btn {
    padding: 0.4rem 1rem;
    background: rgba(255,255,255,0.1);
    color: var(--text-white);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}
.donate-btn:hover { background: rgba(255,255,255,0.2); color: var(--text-white); text-decoration: none; }

.footer-bottom {
    max-width: 1000px;
    margin: 2rem auto 0;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    font-size: 0.8rem;
    opacity: 0.7;
}

/* ============================================
   TOPIC PAGE STYLES
   ============================================ */

/* --- Topic Page Layout --- */
.topic-page {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: calc(100vh - var(--header-h));
}

/* --- Sidebar --- */
.sidebar {
    background: white;
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    overflow-y: auto;
}
.sidebar h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--primary-deep);
}
.sidebar-progress {
    margin-bottom: 1.5rem;
}
.sidebar-progress-text {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.3rem;
}
.sidebar-progress-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}
.sidebar-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
    width: 0%;
}

.sidebar-nav { list-style: none; padding: 0; }
.sidebar-nav li { margin-bottom: 0.15rem; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text-mid);
    transition: background 0.2s;
    text-decoration: none;
}
.sidebar-nav a:hover { background: var(--bg-paper); text-decoration: none; }
.sidebar-nav a.active { background: var(--primary-pale); color: var(--primary-deep); font-weight: 700; }

.sidebar-nav .check-icon {
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    flex-shrink: 0;
    transition: all 0.2s;
}
.sidebar-nav .check-icon.completed {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.btn-reset {
    margin-top: 1rem;
    width: 100%;
    padding: 0.5rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-light);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-reset:hover { border-color: var(--error); color: var(--error); }

/* Sidebar overlay toggle for mobile */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 90;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-deep);
    color: white;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--shadow-md);
}

/* --- Content Area --- */
.topic-content {
    padding: 2rem 2.5rem;
    max-width: var(--content-max);
}

/* Section header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}
.section-header h2 { margin-bottom: 0; }

/* Progress checkbox */
.progress-checkbox {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--success);
}

/* Content sections */
.content-section {
    margin-bottom: 3rem;
    padding-top: 1rem;
}

.content-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}
.content-card p { margin-bottom: 0.8rem; color: var(--text-mid); }

/* Formula box */
.formula-box {
    background: var(--postit-blue);
    border-left: 4px solid var(--topic4-color);
    padding: 1rem 1.2rem;
    margin: 1rem 0;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 1.1rem;
    text-align: center;
}

/* Math rendering */
.frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    margin: 0 0.2em;
    font-size: 0.9em;
}
.frac-num {
    padding: 0 0.3em 0.15em;
    border-bottom: 2px solid var(--text-dark);
    line-height: 1.2;
}
.frac-den {
    padding: 0.15em 0.3em 0;
    line-height: 1.2;
}
.sqrt {
    display: inline-block;
    position: relative;
    padding-left: 0.6em;
    margin: 0 0.15em;
}
.sqrt::before {
    content: '\221A';
    position: absolute;
    left: 0;
    top: 0;
}
.sqrt-inner {
    border-top: 2px solid var(--text-dark);
    padding: 0 0.2em;
}

/* Worked example */
.worked-example {
    background: var(--postit-lavender);
    border-radius: var(--radius);
    padding: 1.2rem 1.5rem;
    margin: 1rem 0;
}
.worked-example h4 { color: var(--topic2-color); margin-bottom: 0.8rem; }
.example-question {
    font-weight: 700;
    color: var(--text-dark) !important;
    margin-bottom: 0.8rem !important;
}
.example-steps {
    border-left: 3px solid var(--topic2-color);
    padding-left: 1rem;
}
.example-steps p {
    margin-bottom: 0.4rem !important;
    font-size: 0.95rem;
}

/* Key facts (post-it) */
.key-facts {
    background: var(--postit-yellow);
    border-radius: 2px;
    padding: 1.2rem 1.5rem;
    margin: 1rem 0;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.1);
    font-family: var(--font-hand);
    font-size: 1.05rem;
    transform: rotate(-0.5deg);
}
.key-facts h4 { color: var(--text-dark); font-family: var(--font-hand); font-size: 1.2rem; }
.key-facts ul { list-style: disc; }
.key-facts li { margin-bottom: 0.3rem; }

/* Tip box */
.tip-box {
    background: var(--postit-green);
    border-left: 4px solid var(--success);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 1rem 1.2rem;
    margin: 1rem 0;
}
.tip-box h4 { color: var(--success); }

/* Warning box */
.warning-box {
    background: var(--postit-orange);
    border-left: 4px solid var(--warning);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 1rem 1.2rem;
    margin: 1rem 0;
}
.warning-box h4 { color: var(--warning); }

/* ============================================
   INTERACTIVE COMPONENT STYLES
   ============================================ */

/* --- Tab container for switching between revision/flashcards/quiz/mock --- */
.tab-nav {
    display: flex;
    gap: 0.25rem;
    background: var(--primary-pale);
    padding: 0.3rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
}
.tab-btn {
    flex: 1;
    padding: 0.6rem 1rem;
    background: none;
    border: none;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--primary-deep);
    transition: all 0.2s;
}
.tab-btn.active {
    background: var(--primary-deep);
    color: var(--text-white);
}
.tab-btn:hover:not(.active) { background: rgba(255,255,255,0.5); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* --- Flashcards --- */
.flashcard-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.flashcard-counter {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 600;
}
.flashcard-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--primary-mid);
    background: white;
    color: var(--primary-mid);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.flashcard-btn:hover { background: var(--primary-mid); color: white; }

.flashcard-viewport {
    perspective: 1000px;
    width: 100%;
    max-width: 500px;
    height: 280px;
    margin: 0 auto 1.5rem;
    cursor: pointer;
}
.flashcard {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}
.flashcard-front {
    background: linear-gradient(135deg, var(--primary-deep), var(--primary-mid));
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
}
.flashcard-back {
    background: white;
    border: 2px solid var(--primary-mid);
    color: var(--text-dark);
    transform: rotateY(180deg);
    font-size: 1.1rem;
    line-height: 1.5;
}
.flashcard-label {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
}
.flashcard-hint {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 1rem;
}

/* --- Quiz --- */
.quiz-container { max-width: 700px; }
.quiz-score {
    background: var(--primary-pale);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    display: none;
}
.quiz-score.show { display: block; }
.quiz-score.perfect { background: #c8e6c9; color: #2e7d32; }

.quiz-question {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}
.quiz-question-text {
    font-weight: 700;
    margin-bottom: 1rem;
    font-size: 1.05rem;
}
.quiz-question-number {
    display: inline-block;
    background: var(--primary-deep);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    text-align: center;
    line-height: 28px;
    font-size: 0.85rem;
    margin-right: 0.5rem;
}

.quiz-options { list-style: none; padding: 0; }
.quiz-options li {
    margin-bottom: 0.5rem;
}
.quiz-option {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}
.quiz-option:hover { border-color: var(--primary-mid); background: var(--primary-pale); }
.quiz-option input[type="radio"] { display: none; }
.quiz-option .radio-circle {
    width: 20px;
    height: 20px;
    border: 2px solid #bbb;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.quiz-option.selected .radio-circle {
    border-color: var(--primary-mid);
    background: var(--primary-mid);
}
.quiz-option.selected .radio-circle::after {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

/* Quiz answer states */
.quiz-option.correct {
    border-color: var(--success);
    background: #e8f5e9;
}
.quiz-option.correct .radio-circle { border-color: var(--success); background: var(--success); }
.quiz-option.incorrect {
    border-color: var(--error);
    background: #ffebee;
}
.quiz-option.incorrect .radio-circle { border-color: var(--error); background: var(--error); }

.quiz-short-answer {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font-body);
    transition: border-color 0.2s;
}
.quiz-short-answer:focus { border-color: var(--primary-mid); outline: none; }
.quiz-short-answer.correct { border-color: var(--success); background: #e8f5e9; }
.quiz-short-answer.incorrect { border-color: var(--error); background: #ffebee; }

.quiz-explanation {
    display: none;
    margin-top: 0.8rem;
    padding: 0.8rem 1rem;
    background: var(--postit-blue);
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--text-mid);
}
.quiz-explanation.show { display: block; }

.quiz-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}
.btn-quiz {
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: opacity 0.2s;
}
.btn-check { background: var(--primary-mid); color: white; }
.btn-check:hover { opacity: 0.9; }
.btn-show { background: var(--topic1-color); color: white; }
.btn-show:hover { opacity: 0.9; }
.btn-retry { background: var(--text-light); color: white; }
.btn-retry:hover { opacity: 0.9; }

/* --- Mock Exam --- */
.mock-question {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.mock-question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.mock-marks {
    background: var(--primary-deep);
    color: white;
    padding: 0.2rem 0.8rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
}
.mock-question-text {
    font-size: 1.05rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}
.mock-answer-area {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.95rem;
    resize: vertical;
    margin-bottom: 0.8rem;
}
.mock-answer-area:focus { border-color: var(--primary-mid); outline: none; }

.mock-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.btn-hint, .btn-mark-scheme {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.2s;
}
.btn-hint { background: var(--postit-orange); color: var(--text-dark); }
.btn-mark-scheme { background: var(--primary-mid); color: white; }
.btn-hint:hover, .btn-mark-scheme:hover { opacity: 0.85; }

.mock-hint {
    display: none;
    margin-top: 0.8rem;
    padding: 0.8rem 1rem;
    background: var(--postit-orange);
    border-radius: var(--radius);
    font-size: 0.9rem;
}
.mock-hint.show { display: block; }

.mock-mark-scheme {
    display: none;
    margin-top: 0.8rem;
    padding: 1rem;
    background: var(--postit-green);
    border-radius: var(--radius);
}
.mock-mark-scheme.show { display: block; }
.mock-mark-scheme h4 { color: var(--success); margin-bottom: 0.5rem; }
.mock-mark-scheme ul { list-style: none; padding: 0; }
.mock-mark-scheme li {
    padding: 0.3rem 0;
    font-size: 0.9rem;
}
.mock-mark-scheme .mark-tag {
    display: inline-block;
    background: var(--primary-deep);
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 0.3rem;
}

.mock-actions {
    margin-top: 2rem;
    text-align: center;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .nav-links { display: none; }
    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: var(--header-h);
        left: 0;
        right: 0;
        background: var(--primary-deep);
        padding: 1rem;
        box-shadow: 0 4px 12px var(--shadow-md);
        z-index: 99;
    }
    .hamburger { display: block; }

    .topic-page { grid-template-columns: 1fr; }
    .sidebar {
        display: none;
        position: fixed;
        top: var(--header-h);
        left: 0;
        bottom: 0;
        width: var(--sidebar-w);
        z-index: 80;
        box-shadow: 4px 0 16px var(--shadow-md);
    }
    .sidebar.open { display: block; }
    .sidebar-toggle { display: flex; align-items: center; justify-content: center; }
    .topic-content { padding: 1.5rem; }
}

@media (max-width: 768px) {
    h1 { font-size: 1.8rem; }
    .hero { padding: 2.5rem 1rem; }
    .hero h1 { font-size: 2rem; }
    .stats-bar { gap: 1.2rem; }
    .stat-number { font-size: 1.5rem; }
    .corkboard { padding: 2rem 1rem; }
    .topic-grid { gap: 1.5rem; }
    .tab-nav { flex-wrap: wrap; }
    .tab-btn { font-size: 0.8rem; padding: 0.5rem 0.6rem; }
    .flashcard-viewport { height: 240px; }
    .flashcard-front { font-size: 1.1rem; }
    .exam-grid { grid-template-columns: 1fr; }
    .footer-inner { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    body { font-size: 14px; }
    .hero h1 { font-size: 1.6rem; }
    .topic-card { padding: 1.2rem 1rem 1rem; }
    .topic-content { padding: 1rem; }
    .flashcard-viewport { height: 200px; }
    .flashcard-front { font-size: 1rem; padding: 1.2rem; }
    .flashcard-back { font-size: 0.95rem; padding: 1.2rem; }
    .quiz-question { padding: 1rem; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}


.skip-link {
  position: absolute; top: -40px; left: 0;
  background: #1a237e; color: #fff; padding: 0.5rem 1rem;
  z-index: 1000; text-decoration: none; font-weight: 700;
}
.skip-link:focus { top: 0; }
