/* ===== CSS VARIABLES & RESET ===== */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: #1a2035;
    --bg-card-hover: #1f2a45;
    --bg-glass: rgba(26, 32, 53, 0.8);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-1: #6366f1;
    --accent-2: #8b5cf6;
    --accent-3: #a78bfa;
    --green: #22c55e;
    --green-bg: rgba(34, 197, 94, 0.1);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.1);
    --yellow: #f59e0b;
    --yellow-bg: rgba(245, 158, 11, 0.1);
    --blue: #3b82f6;
    --blue-bg: rgba(59, 130, 246, 0.1);
    --cyan: #06b6d4;
    --border: rgba(99, 102, 241, 0.2);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.4);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== PARTICLES ===== */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--accent-1);
    border-radius: 50%;
    opacity: 0.3;
    animation: float linear infinite;
}

@keyframes float {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 0.3; }
    90% { opacity: 0.3; }
    100% { transform: translateY(-10vh) rotate(720deg); opacity: 0; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
    background: var(--accent-1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-2);
}

/* ===== NAVIGATION ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 1000;
    transition: all 0.3s ease;
}

.navbar.scrolled {
    background: rgba(10, 14, 26, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-3);
}

.nav-brand i {
    font-size: 1.5rem;
    color: var(--accent-1);
}

.nav-links {
    display: flex;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.1);
}

.nav-link.active {
    color: var(--accent-3);
    background: rgba(99, 102, 241, 0.15);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
}

.mobile-nav {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(10, 14, 26, 0.95);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 16px;
    z-index: 999;
    border-bottom: 1px solid var(--border-subtle);
}

.mobile-nav.open {
    display: flex;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mobile-nav-link:hover {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.1);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    position: relative;
    z-index: 1;
    padding-top: 64px;
}

.section {
    display: none;
    padding: 40px 32px;
    max-width: 1400px;
    margin: 0 auto;
    animation: fadeIn 0.4s ease;
}

.section.active {
    display: block;
}

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

.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.section-header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-header h1 i {
    -webkit-text-fill-color: var(--accent-1);
    margin-right: 8px;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ===== HERO SECTION ===== */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    padding: 60px 0;
}

.hero-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid var(--border);
    color: var(--accent-3);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 16px;
}

.gradient-text {
    display: block;
    background: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-text-2 {
    display: block;
    background: linear-gradient(135deg, #06b6d4, #3b82f6, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.hero-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 32px;
    max-width: 500px;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: var(--accent-1);
    transform: translateY(-2px);
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--accent-3);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.hero-actions {
    display: flex;
    gap: 16px;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: white;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-1);
}

/* ===== CPU ANIMATION ===== */
.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.cpu-animation {
    position: relative;
    width: 320px;
    height: 320px;
}

.cpu-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.5rem;
    color: white;
    z-index: 2;
}

.cpu-pulse {
    position: absolute;
    inset: -10px;
    border-radius: 24px;
    border: 2px solid var(--accent-1);
    opacity: 0;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.5); opacity: 0; }
}

.component {
    position: absolute;
    width: 70px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-3);
}

.comp-alu { top: 10px; left: 50%; transform: translateX(-50%); }
.comp-cu { bottom: 10px; left: 50%; transform: translateX(-50%); }
.comp-reg { left: 10px; top: 50%; transform: translateY(-50%); }
.comp-mem { right: 10px; top: 50%; transform: translateY(-50%); }

.data-flow {
    position: absolute;
    background: var(--accent-1);
    opacity: 0.4;
}

.flow-1 { top: 50px; left: 50%; width: 2px; height: 60px; transform: translateX(-50%); animation: flowV 1.5s infinite; }
.flow-2 { bottom: 50px; left: 50%; width: 2px; height: 60px; transform: translateX(-50%); animation: flowV 1.5s infinite 0.5s; }
.flow-3 { top: 50%; left: 80px; width: 60px; height: 2px; transform: translateY(-50%); animation: flowH 1.5s infinite 0.25s; }
.flow-4 { top: 50%; right: 80px; width: 60px; height: 2px; transform: translateY(-50%); animation: flowH 1.5s infinite 0.75s; }

@keyframes flowV {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.8; }
}

@keyframes flowH {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.8; }
}

/* ===== EXAM INFO ===== */
.exam-info {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-top: 20px;
}

.exam-info h2 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    color: var(--accent-3);
}

.exam-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.exam-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    transition: all 0.3s ease;
}

.exam-card:hover {
    border-color: var(--accent-1);
}

.exam-percent {
    font-size: 2.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-1), var(--cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.exam-type {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 8px 0 4px;
}

.exam-detail {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.exam-topics h3 {
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.topic-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    padding: 6px 14px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--accent-3);
    transition: all 0.2s ease;
}

.tag:hover {
    background: rgba(99, 102, 241, 0.2);
}

/* ===== ACCORDION ===== */
.accordion-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.accordion {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.3s ease;
}

.accordion:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.accordion-header:hover {
    background: rgba(99, 102, 241, 0.05);
}

.accordion-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.accordion-header h3 i {
    color: var(--accent-1);
    width: 20px;
}

.accordion-icon {
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.accordion.open .accordion-icon {
    transform: rotate(180deg);
}

.accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
    padding: 0 24px;
}

.accordion.open .accordion-body {
    max-height: 5000px;
    padding: 0 24px 24px;
}

/* ===== TIMELINE ===== */
.timeline {
    position: relative;
    padding-left: 40px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--accent-1), var(--accent-2), var(--cyan));
}

.timeline-item {
    position: relative;
    margin-bottom: 24px;
}

.timeline-badge {
    position: absolute;
    left: -40px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8rem;
    color: white;
    z-index: 1;
}

.gen0 { background: #64748b; }
.gen1 { background: #f59e0b; }
.gen2 { background: #22c55e; }
.gen3 { background: #3b82f6; }
.gen4 { background: linear-gradient(135deg, var(--accent-1), var(--accent-2)); }

.timeline-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 16px;
}

.timeline-content h4 {
    color: var(--accent-3);
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.timeline-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== TABLES ===== */
table {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

th, td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.9rem;
}

th {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-3);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    color: var(--text-secondary);
}

tr:hover td {
    background: rgba(99, 102, 241, 0.05);
}

.highlight-row td {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-primary);
    font-weight: 500;
}

.ic-table, .instruction-table, .register-table {
    overflow-x: auto;
    margin-top: 12px;
}

code {
    font-family: var(--font-mono);
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--cyan);
}

/* ===== CARD GRID ===== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.info-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.3s ease;
}

.info-card:hover {
    border-color: var(--accent-1);
    transform: translateY(-2px);
}

.info-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: rgba(99, 102, 241, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--accent-1);
    margin-bottom: 12px;
}

.info-card h4 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--accent-3);
}

.info-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== COMPARISON TABLE ===== */
.comparison-table {
    overflow-x: auto;
}

/* ===== KEY POINT ===== */
.key-point {
    display: flex;
    gap: 12px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent-1);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    margin-top: 16px;
}

.key-point i {
    color: var(--accent-1);
    margin-top: 3px;
    flex-shrink: 0;
}

.key-point p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== VON NEUMANN ===== */
.von-neumann-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 0;
}

.vn-cpu {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
    border: 2px solid var(--accent-1);
    border-radius: var(--radius-lg);
    padding: 20px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.vn-cpu h4 {
    color: var(--accent-3);
    margin-bottom: 12px;
}

.vn-inner {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.vn-cu, .vn-alu {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.vn-cu {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--green);
}

.vn-alu {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--yellow);
}

.vn-arrows {
    font-size: 1.5rem;
    color: var(--accent-1);
}

.vn-memory {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius);
    padding: 16px 24px;
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.vn-memory h4 {
    color: var(--blue);
}

.vn-memory p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.vn-io {
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: var(--radius);
    padding: 16px 24px;
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.vn-io h4 {
    color: var(--cyan);
}

/* ===== MEMORY HIERARCHY ===== */
.memory-hierarchy {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.mem-level {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mem-level span {
    font-weight: 400;
    font-size: 0.8rem;
    opacity: 0.7;
}

.mem-reg {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--red);
    width: 60%;
}

.mem-cache {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--yellow);
    width: 75%;
}

.mem-ram {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--blue);
    width: 90%;
}

.mem-disk {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--green);
    width: 100%;
}

/* ===== COMPILATION PIPELINE ===== */
.compilation-pipeline {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    padding: 16px 0;
    flex-wrap: wrap;
}

.pipeline-step {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.pipeline-step.highlight {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--border);
    color: var(--accent-3);
}

.pipeline-arrow {
    color: var(--accent-1);
    font-size: 1.2rem;
    font-weight: 700;
}

.note-text {
    color: var(--yellow);
    font-size: 0.9rem;
    margin-top: 8px;
}

/* ===== FORMULA CARDS ===== */
.formula-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.formula-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 18px;
}

.formula-card h4 {
    color: var(--accent-3);
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.formula {
    font-family: var(--font-mono);
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--cyan);
    font-size: 0.88rem;
    margin-bottom: 8px;
    word-break: break-all;
}

.formula-card p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== EXAMPLE BOX ===== */
.example-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.example-box h5 {
    color: var(--accent-3);
    margin-bottom: 10px;
    font-size: 1rem;
}

.example-box p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.solution {
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-top: 12px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.8;
}

.code-block {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin: 10px 0;
    overflow-x: auto;
}

.code-block pre {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    color: var(--cyan);
    white-space: pre;
    line-height: 1.7;
}

/* ===== FORMAT DIAGRAM ===== */
.format-diagram {
    margin: 12px 0;
    overflow-x: auto;
}

.format-row {
    display: flex;
    border: 2px solid var(--accent-1);
    border-radius: var(--radius-sm);
    overflow: hidden;
    min-width: 500px;
}

.format-field {
    padding: 12px 8px;
    text-align: center;
    font-weight: 700;
    font-size: 0.85rem;
    border-right: 1px solid var(--border);
}

.format-field:last-child {
    border-right: none;
}

.format-field small {
    display: block;
    font-weight: 400;
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 2px;
}

.f-op { flex: 6; background: rgba(99, 102, 241, 0.15); color: var(--accent-3); }
.f-rs { flex: 5; background: rgba(34, 197, 94, 0.1); color: var(--green); }
.f-rt { flex: 5; background: rgba(245, 158, 11, 0.1); color: var(--yellow); }
.f-rd { flex: 5; background: rgba(59, 130, 246, 0.1); color: var(--blue); }
.f-shamt { flex: 5; background: rgba(6, 182, 212, 0.1); color: var(--cyan); }
.f-funct { flex: 6; background: rgba(239, 68, 68, 0.1); color: var(--red); }
.f-imm { flex: 16; background: rgba(245, 158, 11, 0.1); color: var(--yellow); }
.f-addr { flex: 26; background: rgba(34, 197, 94, 0.1); color: var(--green); }

/* ===== SIMULATOR ===== */
.sim-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.sim-editor-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sim-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.sim-toolbar h3 {
    color: var(--accent-3);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sim-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-sim {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-assemble {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: white;
}

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

.btn-step {
    background: var(--yellow);
    color: #111;
}

.btn-reset {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-sim:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.btn-sim:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    filter: none;
}

.editor-wrapper {
    display: flex;
    background: #0d111e;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    overflow: hidden;
    height: 400px;
}

.line-numbers {
    padding: 16px 8px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.7;
    text-align: right;
    min-width: 40px;
    user-select: none;
    overflow: hidden;
    border-right: 1px solid var(--border-subtle);
}

#mipsEditor {
    flex: 1;
    padding: 16px;
    background: transparent;
    border: none;
    color: var(--cyan);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.7;
    resize: none;
    outline: none;
    tab-size: 4;
    white-space: pre;
    overflow: auto;
}

#mipsEditor::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

.sim-presets {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sim-presets span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.preset-btn {
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--border);
    color: var(--accent-3);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent-1);
}

.sim-output-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sim-console, .sim-registers, .sim-machine-code {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 16px;
}

.sim-console h3, .sim-registers h3, .sim-machine-code h3 {
    color: var(--accent-3);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.console-output {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    padding: 12px;
    max-height: 120px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--green);
}

.console-welcome {
    color: var(--text-muted);
}

.console-error {
    color: var(--red);
}

.console-info {
    color: var(--cyan);
}

.console-step {
    color: var(--yellow);
}

.register-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    max-height: 250px;
    overflow-y: auto;
}

.reg-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.reg-item.changed {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.reg-name {
    color: var(--accent-3);
    font-weight: 600;
}

.reg-value {
    color: var(--text-secondary);
}

.machine-code-output {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    padding: 12px;
    max-height: 120px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.6;
}

.mc-line {
    display: flex;
    gap: 16px;
}

.mc-addr {
    color: var(--text-muted);
}

.mc-hex {
    color: var(--yellow);
    font-weight: 600;
}

.mc-asm {
    color: var(--text-secondary);
}

/* ===== PRACTICE / QUIZ ===== */
.practice-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.practice-tab {
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.practice-tab.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent-1);
    color: var(--accent-3);
}

.exam-section {
    display: none;
}

.exam-section.active {
    display: block;
}

.quiz-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.quiz-item {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.3s ease;
}

.quiz-item.correct {
    border-color: var(--green);
    background: rgba(34, 197, 94, 0.05);
}

.quiz-item.wrong {
    border-color: var(--red);
    background: rgba(239, 68, 68, 0.05);
}

.quiz-number {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 4px;
    color: var(--accent-3);
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.quiz-question {
    color: var(--text-primary);
    margin-bottom: 14px;
    font-size: 0.95rem;
    line-height: 1.7;
}

.quiz-question pre {
    font-family: var(--font-mono);
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    padding: 10px;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--cyan);
    overflow-x: auto;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.quiz-option:hover {
    border-color: var(--accent-1);
    background: rgba(99, 102, 241, 0.05);
}

.quiz-option.selected {
    border-color: var(--accent-1);
    background: rgba(99, 102, 241, 0.1);
}

.quiz-option.correct-answer {
    border-color: var(--green);
    background: rgba(34, 197, 94, 0.1);
    color: var(--green);
}

.quiz-option.wrong-answer {
    border-color: var(--red);
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
}

.quiz-option input[type="radio"] {
    accent-color: var(--accent-1);
}

.quiz-explanation {
    display: none;
    margin-top: 12px;
    padding: 12px;
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.quiz-explanation.show {
    display: block;
}

.quiz-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.score-display {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-3);
}

/* ===== ESSAY ===== */
.essay-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.essay-question {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 24px;
}

.essay-question h3 {
    color: var(--accent-3);
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.essay-prompt {
    margin-bottom: 16px;
}

.essay-prompt p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.essay-answer {
    width: 100%;
    min-height: 200px;
    padding: 14px;
    background: #0d111e;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--cyan);
    font-family: var(--font-mono);
    font-size: 0.88rem;
    line-height: 1.7;
    resize: vertical;
    outline: none;
    margin-bottom: 12px;
    tab-size: 4;
}

.essay-answer:focus {
    border-color: var(--accent-1);
}

.essay-solution {
    display: none;
    margin-top: 16px;
    background: rgba(34, 197, 94, 0.05);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: var(--radius);
    padding: 20px;
}

.essay-solution.show {
    display: block;
}

.essay-solution h4 {
    color: var(--green);
    margin-bottom: 10px;
}

.essay-solution pre {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.8;
    white-space: pre;
    overflow-x: auto;
}

/* ===== CHEAT SHEET ===== */
.cheat-sheet {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.cheat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.3s ease;
}

.cheat-card:hover {
    border-color: var(--accent-1);
}

.cheat-card h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.cheat-card p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-bottom: 4px;
}

.cheat-card pre {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--cyan);
    line-height: 1.7;
    margin-top: 8px;
}

/* ===== BACK TO TOP ===== */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    border: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
    transition: all 0.3s ease;
}

.back-to-top:hover {
    transform: translateY(-3px);
}

.back-to-top.show {
    display: flex;
}

/* ===== ILLUSTRATIONS ===== */
.illustration-container {
    margin: 16px 0;
    text-align: center;
}

.illustration {
    width: 100%;
    max-width: 700px;
    border-radius: var(--radius);
    border: 1px solid var(--border-subtle);
    transition: all 0.3s ease;
    cursor: zoom-in;
}

.illustration:hover {
    border-color: var(--accent-1);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
    transform: scale(1.02);
}

.illustration-caption {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
    margin-top: 8px;
}

/* ===== INLINE QUIZ ===== */
.inline-quiz {
    margin-top: 24px;
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.inline-quiz > summary {
    background: rgba(99, 102, 241, 0.1);
    padding: 12px 16px;
    font-weight: 600;
    color: var(--accent-3);
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.inline-quiz > summary::marker,
.inline-quiz > summary::-webkit-details-marker {
    display: none;
}

.inline-quiz-content {
    padding: 16px;
}

.inline-quiz-content p {
    margin-bottom: 12px;
    color: var(--text-primary);
}

.inline-quiz-content ol {
    margin-left: 20px;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.inline-quiz-content li {
    margin-bottom: 6px;
}

.inline-solution {
    margin-top: 12px;
}

.inline-solution > summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-desc {
        margin: 0 auto 32px;
    }

    .hero-actions {
        justify-content: center;
    }

    .hero-visual {
        display: none;
    }

    .sim-container {
        grid-template-columns: 1fr;
    }

    .score-breakdown {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .nav-toggle {
        display: block;
    }

    .section {
        padding: 24px 16px;
    }

    .hero-title {
        font-size: 2.2rem;
    }

    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .exam-grid {
        grid-template-columns: 1fr;
    }

    .formula-cards {
        grid-template-columns: 1fr;
    }

    .register-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .format-row {
        min-width: 400px;
    }

    .cheat-sheet {
        grid-template-columns: 1fr;
    }

    .sim-presets {
        gap: 4px;
    }

    .preset-btn {
        font-size: 0.75rem;
        padding: 4px 10px;
    }

    .editor-wrapper {
        height: 300px;
    }

    .exam-control-bar {
        padding: 16px;
    }

    .exam-actions-row {
        flex-direction: column;
    }

    .exam-actions-row .btn {
        width: 100%;
        justify-content: center;
    }

    .exam-format-info {
        flex-direction: column;
    }

    .score-breakdown {
        grid-template-columns: 1fr 1fr;
    }

    .cpi-inline-inputs {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.8rem;
    }

    .section-header h1 {
        font-size: 1.5rem;
    }

    .accordion-header {
        padding: 14px 16px;
    }

    .accordion-header h3 {
        font-size: 0.95rem;
    }

    .score-breakdown {
        grid-template-columns: 1fr;
    }

    .exam-info-row {
        flex-direction: column;
        gap: 8px;
    }
}

/* ===== EXAM CONTROL BAR ===== */
.exam-control-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.exam-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.exam-seed-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
    border: 1px solid var(--border);
    color: var(--accent-3);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 700;
}

.exam-seed-badge i {
    color: var(--accent-1);
}

.exam-timer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: 24px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--yellow);
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
}

.exam-actions-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.btn-accent {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    color: white;
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.3);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(6, 182, 212, 0.4);
}

.exam-format-info {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.format-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.format-chip i {
    color: var(--accent-1);
    font-size: 0.8rem;
}

/* ===== EXAM SCORE SUMMARY ===== */
.exam-score-summary {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
    animation: fadeIn 0.5s ease;
}

.score-header h2 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    text-align: center;
    color: var(--accent-3);
}

.score-breakdown {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.score-item {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.score-item:hover {
    border-color: var(--accent-1);
    transform: translateY(-2px);
}

.score-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.score-value {
    font-size: 1.8rem;
    font-weight: 800;
    font-family: var(--font-mono);
    margin-bottom: 6px;
}

.score-mc .score-value { color: var(--blue); }
.score-essay1 .score-value { color: var(--cyan); }
.score-essay2 .score-value { color: var(--accent-2); }

.score-total .score-value {
    font-size: 2.2rem;
    background: linear-gradient(135deg, var(--accent-1), var(--cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-total {
    border-color: var(--accent-1);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(6, 182, 212, 0.05));
}

.score-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.grade-pass {
    color: var(--green) !important;
    font-weight: 700;
}

.grade-fail {
    color: var(--red) !important;
    font-weight: 700;
}

/* ===== PRACTICE TABS UPDATED ===== */
.practice-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 4px;
    border: 1px solid var(--border-subtle);
}

.practice-tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.practice-tab:hover {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.1);
}

.practice-tab.active {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: white;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.3);
}

.practice-tab i {
    font-size: 0.85rem;
}

.exam-section {
    display: none;
}

.exam-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ===== ESSAY SECTION UPDATES ===== */
.essay-header {
    margin-bottom: 16px;
}

.essay-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent-3);
    font-size: 1.15rem;
}

.essay-header h3 i {
    color: var(--accent-1);
}

.essay-ccode {
    margin-bottom: 16px;
}

.essay-ccode pre {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--cyan);
    line-height: 1.7;
    margin: 0;
}

.essay-btn-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.essay-self-grade {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.essay-self-grade label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.essay-self-grade input {
    width: 70px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--accent-3);
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    outline: none;
    transition: border-color 0.2s ease;
}

.essay-self-grade input:focus {
    border-color: var(--accent-1);
}

.essay-self-grade input::placeholder {
    color: var(--text-muted);
}

/* ===== CPI ANSWER GRID ===== */
.cpi-answer-grid {
    margin: 16px 0;
}

.cpi-input-group {
    margin-bottom: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

.cpi-input-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.cpi-input-group label strong {
    color: var(--text-primary);
}

.cpi-inline-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cpi-inline-inputs label {
    margin-bottom: 0;
    font-size: 0.85rem;
    white-space: nowrap;
}

.cpi-input {
    width: 140px;
    padding: 10px 14px;
    background: #0d111e;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--cyan);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
    outline: none;
    transition: border-color 0.2s ease;
}

.cpi-input:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.cpi-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.cpi-select {
    padding: 10px 14px;
    background: #0d111e;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--cyan);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.cpi-select:focus {
    border-color: var(--accent-1);
}

.cpi-unit {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

/* ===== CPI GRADE RESULT ===== */
.cpi-result-card {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin-top: 12px;
}

.cpi-result-card h4 {
    margin-bottom: 8px;
    font-size: 1.05rem;
}

.cpi-result-card p {
    margin-bottom: 4px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.cpi-result-card.grade-good {
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.cpi-result-card.grade-good h4 {
    color: var(--green);
}

.cpi-result-card.grade-ok {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.cpi-result-card.grade-ok h4 {
    color: var(--yellow);
}

.cpi-result-card.grade-bad {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.cpi-result-card.grade-bad h4 {
    color: var(--red);
}

/* ===== QUIZ ITEM ANIMATIONS ===== */
.quiz-item {
    animation: fadeIn 0.3s ease;
    animation-fill-mode: both;
}

.quiz-item:nth-child(1) { animation-delay: 0s; }
.quiz-item:nth-child(2) { animation-delay: 0.03s; }
.quiz-item:nth-child(3) { animation-delay: 0.06s; }
.quiz-item:nth-child(4) { animation-delay: 0.09s; }
.quiz-item:nth-child(5) { animation-delay: 0.12s; }
.quiz-item:nth-child(6) { animation-delay: 0.15s; }
.quiz-item:nth-child(7) { animation-delay: 0.18s; }
.quiz-item:nth-child(8) { animation-delay: 0.21s; }
.quiz-item:nth-child(9) { animation-delay: 0.24s; }
.quiz-item:nth-child(10) { animation-delay: 0.27s; }

/* Memory table in quiz questions */
.memory-layout-table {
    border-collapse: collapse;
    font-family: var(--font-mono);
}

.memory-layout-table th,
.memory-layout-table td {
    border: 1px solid rgba(99, 102, 241, 0.3) !important;
    padding: 6px 14px !important;
    font-size: 0.88rem;
}

.memory-layout-table th {
    background: rgba(99, 102, 241, 0.15) !important;
    color: var(--accent-3);
}

.memory-layout-table td {
    color: var(--cyan);
}

/* ===== MIPS GREEN SHEET SIDEBAR ===== */
.btn-greensheet {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    box-shadow: 0 4px 16px rgba(5, 150, 105, 0.3);
}

.btn-greensheet:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(5, 150, 105, 0.4);
}

.btn-greensheet.active {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.greensheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1100;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.greensheet-overlay.open {
    display: block;
    opacity: 1;
}

.greensheet-panel {
    position: fixed;
    top: 0;
    right: -600px;
    width: 580px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-primary);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.greensheet-panel.open {
    right: 0;
}

.greensheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(5, 150, 105, 0.08);
    border-bottom: 1px solid rgba(5, 150, 105, 0.2);
    flex-shrink: 0;
}

.greensheet-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #10b981;
    font-size: 1.05rem;
    font-weight: 700;
}

.greensheet-header h3 i {
    color: #059669;
}

.greensheet-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.greensheet-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--red);
    transform: scale(1.1);
}

.greensheet-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
}

.greensheet-pdf {
    width: 100%;
    height: 100%;
    border: none;
}

@media (max-width: 768px) {
    .greensheet-panel {
        width: 100vw;
        max-width: 100vw;
        right: -100vw;
    }

    .btn-greensheet {
        font-size: 0.8rem;
        padding: 10px 14px;
    }
}
