/* --- 
HYDRIDE MODERN THEME V2
Updated by Gemini
--- */

:root {
    --bg: #0b0f14;
    --panel: #0f1720;
    --muted: #a0aec0; /* Lightened for better contrast */
    --card: #12171c;
    --emerald-1: #0fd48a;
    --emerald-2: #00b37a;
    --red-1: #ff4d4d;
    --glass: rgba(255, 255, 255, 0.03);
    --radius: 14px;
    
    /* --- NEW MODERN VARS --- */
    --text-primary: #f0f4f8;   /* Cleaner white for titles */
    --text-secondary: #e6fff6; /* Your original accent text */
    --accent-text: #e6fff6;    /* Alias for compatibility */
    --border-color: rgba(255, 255, 255, 0.08); /* Standardized border */
    --emerald-glow: 0 6px 25px rgba(15, 212, 138, 0.2); /* Re-usable glow */
    --panel-glass: rgba(15, 23, 32, 0.7); /* Standard glass bg */
    --card-glass: rgba(18, 23, 28, 0.7);  /* Standard card glass bg */

    /* --- Original Card Colors --- */
    --card-color-1: #4a72ff;
    --card-color-2: #aa53d1;
    --card-color-3: #f5b900;
    --card-color-4: #00b37a;
    --card-color-5: #3a579b;
    --dpp-orange: #e48d34;
    --dpp-green: #37c087;
    --dpp-blue: #4a72ff;
}

/* Light Theme */
[data-theme="light"] {
    --bg: #f8fafc;
    --panel: #ffffff;
    --card: #f1f5f9;
    --emerald-1: #2563eb;
    --emerald-2: #1d4ed8;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-text: #2563eb;
    --border-color: rgba(0, 0, 0, 0.08);
    --glass: rgba(0, 0, 0, 0.05);
    --emerald-glow: 0 6px 25px rgba(37, 99, 235, 0.1);
    --panel-glass: rgba(255, 255, 255, 0.8);
    --card-glass: rgba(241, 245, 249, 0.8);
    --muted: #64748b;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    /* UPDATED: Modern radial gradient background using variables */
    background: radial-gradient(circle at 50% 0%, var(--panel) 0%, var(--bg) 70%, #000 100%);
    background-attachment: fixed; /* Prevents gradient from scrolling */
    color: var(--text-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.3s ease, color 0.3s ease;
}

.app {
    display: flex;
    height: 100vh;
    gap: 24px;
    padding: 20px;
}

.sidebar {
    width: 260px;
    /* UPDATED: Glassmorphism */
    background: var(--panel-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: 0 8px 32px rgba(2, 6, 10, 0.6);
    transition: all 0.2s ease-in-out;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* --- Interactive Math Plotter Styles --- */
.plotter-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    background-color: var(--card); /* Changed from panel */
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.plotter-sidebar {
    background-color: var(--panel); /* Changed from card */
    padding: 16px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.plotter-sidebar h4 {
    margin: 0 0 10px 0;
    color: var(--text-primary);
    font-size: 16px;
}

.func-type-btn {
    width: 100%;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 10px;
    border: 1px solid var(--glass);
    background-color: transparent;
    color: var(--muted);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.func-type-btn:hover {
    background-color: var(--glass);
    border-color: rgba(255, 255, 255, 0.2);
}

.func-type-btn.active {
    background-color: var(--card-color-1);
    border-color: var(--card-color-1);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(74, 114, 255, 0.2);
}

.func-type-btn strong {
    display: block;
    font-size: 14px;
}

.func-type-btn span {
    font-size: 12px;
    opacity: 0.8;
}

.param-slider {
    margin-bottom: 16px;
}

.param-slider label {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 500;
}

.param-slider input[type="range"] {
    width: 100%;
    cursor: pointer;
}

.plotter-main {
    background-color: white;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.graph-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 0 8px;
}

/* CSS for PDF Viewer Navigation Buttons */
.pdf-viewer-container {
    position: relative; /* This is needed to position the buttons inside */
}

.pdf-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background-color: rgba(40, 40, 40, 0.6);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.pdf-nav-btn:hover {
    background-color: rgba(60, 60, 60, 0.8);
}

.pdf-nav-btn.prev {
    left: 15px;
}

.pdf-nav-btn.next {
    right: 15px;
}

#equation-display {
    color: #334155;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 16px;
    background-color: #f1f5f9;
    padding: 8px 12px;
    border-radius: 8px;
}

.graph-controls {
    display: flex;
    gap: 8px;
}

/* --- Projectile Simulator Styles --- */
.simulator-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    background-color: var(--card); /* Changed from panel */
    padding: 20px;
    border-radius: var(--radius);
    height: 600px; /* Give the layout a fixed height */
    border: 1px solid var(--border-color);
}

.simulator-main {
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--panel); /* Changed from card */
}

.simulator-canvas-wrapper {
    flex-grow: 1;
    position: relative;
}

#projectile-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.simulator-controls {
    background-color: var(--panel); /* Changed from card */
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-group h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: var(--text-primary);
}

.control-slider label {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 500;
}
/* --- Matrix Visualizer Styles --- */
.matrix-visualizer-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    background-color: var(--card); /* Changed from panel */
    padding: 20px;
    border-radius: var(--radius);
    height: 600px;
    border: 1px solid var(--border-color);
}

/* --- Electromagnetism Sandbox Styles --- */
.sandbox-layout {
    display: flex;
    gap: 20px;
    background-color: var(--card); /* Changed from panel */
    padding: 20px;
    border-radius: var(--radius);
    height: 700px;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.sandbox-sidebar {
    width: 260px;
    flex-shrink: 0;
    background-color: var(--panel); /* Changed from card */
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sandbox-sidebar h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    border-bottom: 1px solid var(--glass);
    padding-bottom: 10px;
}

.sandbox-palette-item {
    border: 1px solid var(--glass);
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: var(--panel);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}
.sandbox-palette-item:hover, .sandbox-palette-item.selected {
    background-color: var(--card-color-1);
    border-color: var(--card-color-1);
    color: white;
    transform: scale(1.05);
}
.sandbox-palette-item .icon {
    width: 24px; height: 24px;
    border-radius: 50%;
    font-size: 18px;
    display: grid;
    place-items: center;
    font-weight: bold;
}
.icon.positive { background-color: #ef4444; color: white; }
.icon.negative { background-color: #3b82f6; color: white; }
.icon.particle { background-color: #f5b900; color: #422006; }

.sandbox-controls-group {
    margin-top: 15px;
}
.sandbox-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
}

/* Simple toggle switch */
.switch { position: relative; display: inline-block; width: 34px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--emerald-1); }
input:checked + .slider:before { transform: translateX(14px); }

.sandbox-workspace {
    flex-grow: 1;
    background-color: #0c1116;
    border-radius: 12px;
    overflow: hidden;
}
#sandbox-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: default;
}

.matrix-controls {
    background-color: var(--panel); /* Changed from card */
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.matrix-controls h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: var(--text-primary);
    text-align: center;
}

.matrix-input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 20px 0;
}

.matrix-input-cell {
    background-color: var(--panel);
    border: 1px solid var(--glass);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
}

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

.matrix-input-cell input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    text-align: center;
    font-size: 20px;
    font-weight: bold;
}
/* Hides arrows from number inputs */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.shape-selector {
    margin-top: 20px;
}
.shape-selector label {
    font-weight: 500;
    margin-bottom: 8px;
    display: block;
}
.shape-selector select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    background: var(--panel);
    border: 1px solid var(--glass);
    color: var(--text-primary);
}

.reset-matrix-btn {
    margin-top: auto;
}

#matrix-canvas-wrapper {
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden;
}

/* --- Profile Page Styles --- */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.profile-card {
    background: var(--panel);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

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

#user-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 16px;
    background: var(--emerald-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: bold;
    color: #01210f;
}

#user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

#user-display-name {
    margin: 0 0 8px 0;
    font-size: 24px;
    color: var(--text-primary);
}

#user-email {
    margin: 0 0 24px 0;
    color: var(--muted);
}

.stats-overview .stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.stats-overview .stat-item {
    background: var(--glass);
    padding: 16px;
    border-radius: 12px;
}

.stats-overview .stat-label {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 8px;
    display: block;
}

.stats-overview .stat-value {
    font-size: 28px;
    font-weight: bold;
    color: var(--text-primary);
}

.subject-performance .chart-container {
    height: 250px;
}

.activity-heatmap #heatmap-container {
    display: grid;
    grid-template-rows: repeat(7, 1fr);
    grid-auto-flow: column;
    gap: 4px;
}

.activity-heatmap .heatmap-day {
    width: 16px;
    height: 16px;
    background-color: var(--glass);
    border-radius: 3px;
}

.activity-heatmap .heatmap-day.level-1 { background-color: rgba(15, 212, 138, 0.2); }
.activity-heatmap .heatmap-day.level-2 { background-color: rgba(15, 212, 138, 0.5); }
.activity-heatmap .heatmap-day.level-3 { background-color: rgba(15, 212, 138, 0.8); }
.activity-heatmap .heatmap-day.level-4 { background-color: rgb(15, 212, 138); }

@media (max-width: 768px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }
}

.activity-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin: 24px 0;
}
.stat-card {
    background: var(--panel);
    padding: 20px;
    border-radius: var(--radius);
    border-left: 3px solid var(--card-color-1);
    border-top: 1px solid var(--border-color); /* Added */
    border-right: 1px solid var(--border-color); /* Added */
    border-bottom: 1px solid var(--border-color); /* Added */
}
.stat-card .label {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 6px;
}
.stat-card .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}
.stat-card .value-small {
    font-size: 16px;
    font-weight: 400;
    color: var(--muted);
}

.heatmap-container {
    background: var(--panel);
    padding: 20px;
    border-radius: var(--radius);
    margin-top: 24px;
    overflow-x: auto; /* This is the key fix */
    border: 1px solid var(--border-color); /* Added */
}
.heatmap-grid {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(7, 16px); /* 7 days for the week */
    grid-auto-columns: 16px; /* Each day column is 16px wide */
    gap: 4px;
}
.heatmap-day {
    width: 16px;
    height: 16px;
    background-color: var(--glass);
    border-radius: 3px;
    transition: transform 0.1s ease-in-out;
}
.heatmap-day:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(255,255,255,0.2);
}

/* Color levels for the heatmap */
.heatmap-day.level-1 { background-color: rgba(15, 212, 138, 0.2); }
.heatmap-day.level-2 { background-color: rgba(15, 212, 138, 0.5); }
.heatmap-day.level-3 { background-color: rgba(15, 212, 138, 0.8); }
.heatmap-day.level-4 { background-color: rgb(15, 212, 138); }

#matrix-canvas {
    display: block;
    width: 100%;
    height: 100%;
}
.control-slider input[type="range"] {
    width: 100%;
    cursor: pointer;
}

.launch-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: auto; /* Pushes to the bottom */
}

.data-readout {
    background-color: var(--glass);
    border-radius: 10px;
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    border: 1px solid rgba(255,255,255,0.05);
}
.readout-item {
    font-size: 13px;
}
.readout-item .label {
    color: var(--muted);
    display: block;
    margin-bottom: 4px;
}
.readout-item .value {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
}

.trace-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--glass);
    padding: 10px 14px;
    border-radius: 10px;
}

.graph-controls button {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background-color: #f8fafc;
    color: #475569;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 18px;
}
.graph-controls button.active {
    background-color: #eef2ff;
    border-color: #4338ca;
    color: #4338ca;
}

/* --- Logic Gate Builder Styles --- */
.gate-builder-layout {
    display: flex;
    gap: 20px;
    background-color: var(--card); /* Changed from panel */
    padding: 20px;
    border-radius: var(--radius);
    height: 650px;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.gate-palette {
    width: 200px;
    flex-shrink: 0;
    background-color: var(--panel); /* Changed from card */
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gate-palette h4 {
    margin: 0 0 10px 0;
    text-align: center;
    border-bottom: 1px solid var(--glass);
    padding-bottom: 10px;
}

.custom-test-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: linear-gradient(135deg, var(--card), var(--panel));
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    min-height: 120px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    grid-column: 1 / -1;
}

.custom-test-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--emerald-glow);
    border-color: var(--emerald-1);
}

.custom-test-card .card-content {
    flex-grow: 1;
}

.custom-test-card .card-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: var(--text-primary);
}

.custom-test-card .card-title .arrow-icon {
    display: inline-block;
    color: var(--muted);
    transition: transform 0.2s ease;
}

.custom-test-card:hover .card-title .arrow-icon {
    transform: translateX(4px);
}

.custom-test-card .card-caption {
    font-size: 14px;
    color: var(--muted);
    margin: 0;
    line-height: 1.5;
}

/* This is now the icon on the right */
.custom-test-card .card-badge {
    padding: 12px;
    background-color: var(--emerald-1);
    color: #01210f; /* High contrast text color for the icon */
    border-radius: 12px;
    font-size: 28px;
    display: grid;
    place-items: center;
}

.palette-item {
    border: 1px solid var(--glass);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: var(--panel);
}

.palette-item:hover, .palette-item.selected {
    background-color: var(--card-color-1);
    border-color: var(--card-color-1);
    color: white;
    transform: scale(1.05);
}

.palette-section {
    margin-bottom: 15px;
}

.gate-workspace-wrapper {
    flex-grow: 1;
    background-color: #0c1116;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

#gate-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: default;
}

.gate-builder-info {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background-color: rgba(0,0,0,0.4);
    backdrop-filter: blur(5px);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--muted);
    pointer-events: none; /* So it doesn't interfere with canvas clicks */
}

#plotter-canvas {
    width: 100%;
    height: 450px; /* Or adjust as needed */
    border-radius: 8px;
}
.brand .logo {
    width: 90px;
    height: 60px;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0, 179, 122, 0.12);
    overflow: hidden;
}
.brand .logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.brand .title {
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
    letter-spacing: 0.2px;
}
nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}
.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 12px;
    color: var(--muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all .16s ease;
    font-size: 15px;
}
.nav-btn svg {
    width: 22px;
    height: 22px;
}
.nav-btn:hover:not(:disabled) {
    background: var(--glass);
    color: var(--text-primary);
    transform: translateY(-1px);
}
.nav-btn.active {
    /* UPDATED: Modern gradient button */
    background: linear-gradient(90deg, var(--emerald-1), var(--emerald-2));
    color: #01210f;
    box-shadow: 0 4px 15px rgba(15, 212, 138, 0.2);
    font-weight: 600;
}
.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.sidebar .spacer {
    flex: 1;
}

/* Theme Toggle Styles */
.theme-switcher {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.theme-toggle-btn {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.theme-toggle-btn:hover {
    border-color: var(--emerald-1);
    background: var(--panel);
}

.theme-toggle-btn svg {
    width: 18px;
    height: 18px;
}

.bottom-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.small-btn {
    background: transparent;
    border: 1px solid var(--border-color); /* Updated */
    padding: 10px;
    border-radius: 10px;
    color: var(--muted);
    cursor: pointer;
    transition: all .16s ease;
}
.small-btn:hover:not(:disabled) {
    background: var(--glass);
    color: var(--text-primary);
}
.small-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow: hidden;
}
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: relative;
}
.greeting {
    display: flex;
    align-items: center;
    gap: 12px;
}
.profile-pill {
    display: flex;
    align-items: center;
    gap: 12px;
    /* UPDATED: Glassmorphism */
    background: var(--panel-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    box-shadow: 0 6px 24px rgba(1, 8, 10, 0.35);
}
.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--panel-glass);
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.mobile-menu-toggle span {
    width: 22px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}
.mobile-menu-toggle:hover {
    border-color: var(--emerald-1);
    color: var(--emerald-1);
}
.mobile-menu-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(280px, 90vw);
    background: var(--panel-glass);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 14px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
    display: none;
    flex-direction: column;
    gap: 10px;
    z-index: 30;
}
.mobile-menu-dropdown.open {
    display: flex;
}
.mobile-menu-label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}
.mobile-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--panel);
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.mobile-menu-item span:last-child {
    font-size: 13px;
    color: var(--muted);
}
.mobile-menu-item:hover {
    border-color: var(--emerald-1);
}
.mobile-menu-pill {
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--glass);
    border: 1px solid var(--border-color);
}
.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--emerald-1), var(--emerald-2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #01210f;
    overflow: hidden;
}
.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.greet-txt {
    line-height: 1;
}
.greet-txt .hey {
    font-size: 15px;
    color: var(--text-primary); /* Updated */
    font-weight: 600;
}
.greet-txt .sub {
    font-size: 13px;
    color: var(--muted);
}
.top-icons {
    display: flex;
    gap: 10px;
    align-items: center;
}
.banner-container {
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
}
.banner-scroll {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.banner-scroll::-webkit-scrollbar {
    display: none;
}
.banner-item {
    flex: 0 0 100%;
    width: 100%;
    scroll-snap-align: center;
    border-radius: 16px;
}
.banner-item img {
    width: 100%;
    height: auto;
    max-height: 250px;
    object-fit: cover;
    display: block;
}
.content {
    /* UPDATED: Glassmorphism */
    background: var(--panel-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    
    border-radius: 18px;
    padding: 26px;
    flex: 1;
    overflow: auto;
    box-shadow: 0 10px 40px rgba(2, 6, 10, 0.6);
    color: var(--text-secondary); /* Updated */
}
#content-area:not([data-content="loaded"]) {
    display: flex;
    justify-content: center;
    align-items: center;
}
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.section-head h3 {
    color: var(--text-primary); /* Updated */
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}
.section-head h5 {
    color: var(--muted);
    font-weight: 400;
    margin: 4px 0 0 0;
}
.view-all {
    color: var(--emerald-1);
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}
.exam-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding-bottom: 8px;
    overflow-x: auto;
}
.exam-chip {
    min-width: 180px;
    height: 90px;
    padding: 16px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--glass); /* Updated */
    border: 1px solid var(--border-color); /* Updated */
    margin-top: 4px;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    cursor: pointer;
}
.exam-chip:hover {
    box-shadow: var(--emerald-glow); /* UPDATED: Emerald glow */
    border-color: var(--emerald-1);
    transform: translateY(-4px); /* Added lift */
}
.chip-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary); /* Updated */
}
.chip-badge {
    align-self: flex-start;
    font-size: 11px;
    padding: 6px 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, #ffd6db, #ffb3c7);
    color: #2b0710;
    font-weight: 700;
}
.dpp-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    background: linear-gradient(90deg, rgba(30, 35, 42, 0.8), rgba(35, 41, 49, 0.7));
    border-radius: 14px;
    border: 1px solid #c88125;
    box-shadow: 0 4px 20px rgba(200, 129, 37, 0.1);
    cursor: pointer;
    transition: all .2s ease;
    margin-top: 24px;
}
.dpp-banner:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(200, 129, 37, 0.15);
    border-color: #e69a3b;
}
.dpp-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.dpp-title {
    font-weight: 700;
    font-size: 17px;
    color: var(--text-primary); /* Updated */
}
.dpp-subtitle {
    font-size: 14px;
    color: var(--muted);
}
.dpp-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}
/* --- Premium Page Styles --- */
.premium-container {
    background: var(--panel);
    padding: 30px;
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid var(--border-color); /* Added */
}
.premium-hero h2 {
    font-size: 28px;
    color: var(--text-primary);
    margin-top: 0;
    background: -webkit-linear-gradient(45deg, var(--emerald-1), #67e8f9);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.premium-hero p {
    font-size: 16px;
    max-width: 600px;
    margin: 15px auto 40px;
    line-height: 1.6;
}

.premium-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    text-align: left;
    margin-bottom: 50px;
}
.premium-feature-card {
    background: var(--glass);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color); /* Updated */
}
.premium-feature-card .icon {
    font-size: 24px;
    margin-bottom: 12px;
}
.premium-feature-card h4 {
    margin: 0 0 8px 0;
    color: var(--text-primary);
}
.premium-feature-card p {
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    color: var(--muted);
}

.premium-plan-card {
    max-width: 400px;
    margin: 0 auto;
    background: linear-gradient(135deg, var(--card), var(--panel));
    border: 1px solid var(--emerald-2);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: 0 10px 40px rgba(15, 212, 138, 0.1);
}
.premium-plan-card .price {
    font-size: 32px;
    font-weight: bold;
    color: var(--text-primary);
}
.premium-plan-card .price .period {
    font-size: 16px;
    font-weight: normal;
    color: var(--muted);
}
.premium-plan-card ul {
    list-style: none;
    padding: 0;
    margin: 24px 0;
    text-align: left;
}
.premium-plan-card ul li {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.premium-plan-card ul li .check {
    color: var(--emerald-1);
}
.dpp-premium-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #f5d8a9;
    color: #5d3d0c;
    font-weight: 700;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 8px;
}
.dpp-arrow {
    color: var(--muted);
}
.dpp-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 8px;
}
.dpp-header h3 {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 20px;
    color: var(--text-primary);
}
.dpp-header .back-btn {
    background: var(--glass);
    border: 1px solid var(--border-color); /* Updated */
    color: var(--muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
}
.dpp-header .dpp-premium-badge {
    transform: translateY(-1px);
}
.dpp-info-banner {
    text-align: center;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #c88125;
    color: #f5d8a9;
    font-weight: 600;
    font-size: 13px;
    margin: 20px 0;
    background: linear-gradient(90deg, rgba(200, 129, 37, 0.1), rgba(200, 129, 37, 0.05));
}
.dpp-subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 24px;
}
.dpp-subject-card {
    background-color: var(--card); /* Updated */
    border: 1px solid var(--border-color); /* Updated */
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all .2s ease;
    position: relative;
    overflow: hidden;
}
.dpp-subject-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-color: var(--border-color); /* Keep border subtle */
}
.dpp-subject-card:nth-child(1) {
    border-left: 3px solid var(--dpp-orange);
}
.dpp-subject-card:nth-child(2) {
    border-left: 3px solid var(--dpp-green);
}
.dpp-subject-card:nth-child(3) {
    border-left: 3px solid var(--dpp-blue);
}
.dpp-subject-card .subject-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
}
.dpp-subject-card .subject-chapters {
    font-size: 14px;
    color: var(--muted);
}
.dpp-subject-card .icon-wrapper {
    position: absolute;
    bottom: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 32px;
    opacity: 0.1;
}
.dpp-subject-card:nth-child(1) .icon-wrapper {
    background-color: var(--dpp-orange);
}
.dpp-subject-card:nth-child(2) .icon-wrapper {
    background-color: var(--dpp-green);
}
.dpp-subject-card:nth-child(3) .icon-wrapper {
    background-color: var(--dpp-blue);
}
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 18px;
}
.subject-card {
    height: 120px;
    border-radius: 14px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    background: var(--glass); /* Updated */
    border: 1px solid var(--border-color); /* Updated */
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    cursor: pointer;
}
.subject-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--emerald-glow); /* Updated */
    border-color: var(--emerald-1); /* Updated */
}
.subject-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--emerald-1), var(--emerald-2));
    color: #01210f;
    box-shadow: 0 6px 18px rgba(0, 179, 122, 0.12);
    padding: 4px;
}
.subject-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.subject-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.book-card {
    height: 190px;
    border-radius: 12px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #ffffff;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
    border: none;
    box-shadow: inset 6px 0px 12px -4px rgba(0, 0, 0, 0.35); /* Spine shadow */
}
.book-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3), inset 6px 0px 12px -4px rgba(0, 0, 0, 0.35);
}
.subject-grid .book-card:nth-child(5n + 1) {
    background-color: var(--card-color-1);
}
.subject-grid .book-card:nth-child(5n + 2) {
    background-color: var(--card-color-2);
}
.subject-grid .book-card:nth-child(5n + 3) {
    background-color: var(--card-color-3);
}
.subject-grid .book-card:nth-child(5n + 4) {
    background-color: var(--card-color-4);
}
.subject-grid .book-card:nth-child(5n + 5) {
    background-color: var(--card-color-5);
}
.book-card .book-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}
.book-card .book-class {
    font-size: 13px;
    font-weight: 500;
    background-color: rgba(0, 0, 0, 0.15);
    padding: 6px 10px;
    border-radius: 8px;
    align-self: flex-start;
}
.formula-card {
    height: 190px;
    border-radius: 20px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #ffffff;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
    border: none;
}
.formula-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}
.subject-grid .formula-card:nth-child(5n + 1) {
    background-color: var(--card-color-1);
}
.subject-grid .formula-card:nth-child(5n + 2) {
    background-color: var(--card-color-2);
}
.subject-grid .formula-card:nth-child(5n + 3) {
    background-color: var(--card-color-3);
}
.subject-grid .formula-card:nth-child(5n + 4) {
    background-color: var(--card-color-4);
}
.subject-grid .formula-card:nth-child(5n + 5) {
    background-color: var(--card-color-5);
}
.formula-card .card-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}
.formula-card .card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(0, 0, 0, 0.15);
    padding: 8px 12px;
    border-radius: 12px;
}
.formula-card .card-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 500;
}
.analysis-btn-premium {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    border: 1px solid var(--card-color-2);
    background: linear-gradient(90deg, rgba(170, 83, 209, 0.15), rgba(170, 83, 209, 0.05));
    color: #e6cffc;
    transition: all .2s ease;
    animation: pulse-glow 2.5s infinite ease-in-out;
}
.analysis-btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(170, 83, 209, 0.2);
    animation-play-state: paused; /* Pause animation on hover for better UX */
}
@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 5px rgba(170, 83, 209, 0.2), 0 0 10px rgba(170, 83, 209, 0.1);
    }
    50% {
        box-shadow: 0 0 15px rgba(170, 83, 209, 0.4), 0 0 25px rgba(170, 83, 209, 0.2);
    }
    100% {
        box-shadow: 0 0 5px rgba(170, 83, 209, 0.2), 0 0 10px rgba(170, 83, 209, 0.1);
    }
}
.formula-card .card-action-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    cursor: pointer;
}
.question-list-item {
    transition: background-color .18s ease;
}
.question-list-item:hover {
    background-color: var(--glass) !important;
}
.question-image {
    max-width: 100%;
    max-height: 400px;
    height: auto;
    border-radius: 10px;
    margin-top: 15px;
    margin-bottom: 20px;
    background-color: var(--glass);
}
.option-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 10px;
}
.option-btn {
    border: 1px solid var(--border-color); /* Updated */
    padding: 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: all .18s ease;
}
.option-btn:hover {
    background-color: var(--glass);
    border-color: rgba(255, 255, 255, 0.2); /* Updated */
}
.option-btn.selected {
    border-color: var(--emerald-1);
    background-color: rgba(15, 212, 144, 0.1);
    box-shadow: 0 0 15px rgba(15, 212, 144, 0.1);
}
.option-btn.correct {
    border-color: var(--emerald-2);
    background-color: rgba(15, 212, 144, 0.15);
    color: var(--text-primary);
    font-weight: bold;
}
.option-btn.incorrect {
    border-color: var(--red-1);
    background-color: rgba(255, 77, 77, 0.1);
}
.quiz-footer {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
#submit-btn, .action-button {
    padding: 12px 28px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 12px;
    cursor: pointer;
    border: none;
    /* UPDATED: Modern gradient button */
    background: linear-gradient(90deg, var(--emerald-1), var(--emerald-2));
    color: #01210f;
    box-shadow: 0 4px 15px rgba(15, 212, 138, 0.15);
    transition: all .18s ease;
}
#submit-btn:hover, .action-button:hover {
    /* UPDATED: Hover state */
    background: linear-gradient(90deg, var(--emerald-2), var(--emerald-1));
    box-shadow: 0 6px 20px rgba(15, 212, 138, 0.3);
    transform: translateY(-2px);
}
#submit-btn:disabled, .action-button:disabled {
    background-color: var(--muted);
    background-image: none; /* Disable gradient when disabled */
    color: var(--panel);
    cursor: not-allowed;
    transform: none;
    box-shadow: none; /* Disable glow when disabled */
}
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    gap: 16px;
}
.login-container .logo-big {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(0, 179, 122, 0.18);
    object-fit: cover;
}
.login-container h2 {
    color: var(--text-primary);
    font-size: 24px;
    margin: 10px 0 0;
}
.login-container p {
    color: var(--muted);
    font-size: 16px;
    max-width: 300px;
    line-height: 1.5;
}
.google-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    border-radius: 12px;
    background: var(--panel);
    border: 1px solid var(--border-color); /* Updated */
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all .18s ease;
}
.google-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(2, 8, 12, 0.5);
}
.katex {
    font-size: 1.1em;
}
.pdf-viewer-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}
.exam-chip.highlight {
    animation: pulse-glow-purple 2.5s infinite ease-in-out;
}

.exam-chip.highlight:hover {
    animation-play-state: paused;
}

@keyframes pulse-glow-green {
    0% {
        box-shadow: 0 0 5px rgba(15, 212, 138, 0.2), 0 0 10px rgba(15, 212, 138, 0.1);
    }
    50% {
        box-shadow: 0 0 15px rgba(15, 212, 138, 0.4), 0 0 25px rgba(15, 212, 138, 0.2);
    }
    100% {
        box-shadow: 0 0 5px rgba(15, 212, 138, 0.2), 0 0 10px rgba(15, 212, 138, 0.1);
    }
}

@keyframes pulse-glow-purple {
    0% {
        box-shadow: 0 0 15px rgba(168, 85, 247, 0.3), 0 0 20px rgba(168, 85, 247, 0.2);
    }
    50% {
        box-shadow: 0 0 25px rgba(168, 85, 247, 0.5), 0 0 40px rgba(168, 85, 247, 0.3);
    }
    100% {
        box-shadow: 0 0 15px rgba(168, 85, 247, 0.3), 0 0 20px rgba(168, 85, 247, 0.2);
    }
}

.pdf-viewer-container.iframe-mode {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
}
.pdf-viewer-container.iframe-mode .section-head {
    padding: 0 26px;
    margin-bottom: 18px;
    flex-shrink: 0;
}
.pdf-viewer-container.iframe-mode iframe {
    flex-grow: 1;
    border: none;
    width: 100%;
    height: 100%;
    border-radius: 18px;
    background: #fff;
}
.pdf-scroller {
    flex: 1;
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    gap: 20px;
    padding: 10px;
    background-color: var(--glass);
    border-radius: var(--radius);
}
.pdf-scroller::-webkit-scrollbar {
    display: none;
}
.pdf-scroller {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.pdf-page-card {
    flex: 0 0 100%;
    scroll-snap-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}
.pdf-page-card canvas {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    width: auto;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}
.pdf-page-counter {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}
.loading-spinner {
    margin: auto;
    border: 4px solid var(--glass);
    border-top: 4px solid var(--emerald-1);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}
.config-card {
    background: var(--panel);
    padding: 20px;
    border-radius: 14px;
    border: 1px solid var(--border-color); /* Added */
}
.config-card h4 {
    margin: 0 0 16px;
    color: var(--text-primary);
}
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    cursor: pointer;
}
.checkbox-group input {
    width: 18px;
    height: 18px;
}
#chapters-container {
    max-height: 250px;
    overflow-y: auto;
    padding-right: 10px;
}
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}
.form-group input, .form-group select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    background: var(--glass);
    border: 1px solid var(--border-color); /* Updated */
    color: var(--text-primary);
}
.test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--panel);
    padding: 15px 22px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    border: 1px solid var(--border-color); /* Added */
}
.test-timer {
    font-size: 18px;
    font-weight: 700;
    color: var(--emerald-1);
}
.mock-test-layout {
    display: flex;
    height: 100%;
    gap: 18px;
}
.mock-test-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.mock-test-sidebar {
    width: 280px;
    background: var(--panel);
    border-radius: var(--radius);
    padding: 15px;
    display: flex;
    flex-direction: column;
}
.subject-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
}
.subject-tab {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--glass);
    cursor: pointer;
    text-align: center;
    font-weight: 600;
}
.subject-tab.active {
    background: var(--emerald-1);
    color: #01210f;
    border-color: var(--emerald-1);
}
.question-palette {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
    overflow-y: auto;
    flex: 1;
}
.palette-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--glass);
    cursor: pointer;
    font-weight: 600;
}
.palette-btn.current {
    border-color: var(--emerald-1);
    background: var(--glass);
}
.palette-btn.answered {
    background: var(--card-color-1);
    color: white;
    border: none;
}
.goal-container {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass);
    border: 1px solid var(--border-color); /* Added */
}
.goal-container .small-btn {
    border: none;
    background: none;
    padding: 0;
    width: 100%;
    height: 100%;
    font-size: 18px;
    line-height: 1;
}
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}
.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}
.modal-content {
    /* UPDATED: Glassmorphism */
    background: var(--panel-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    
    padding: 28px;
    border-radius: var(--radius);
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* --- PYQ ANALYSIS STYLES --- */
.analysis-container {
    background: var(--card); /* Updated */
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-top: 20px;
}
.summary-card {
    background: var(--glass);
    border-radius: 12px;
    padding: 16px;
    border-left: 3px solid var(--emerald-1);
}
.summary-card .label {
    font-size: 13px;
    color: var(--muted);
    margin: 0 0 6px 0;
}
.summary-card .value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.chart-container {
    margin-top: 24px;
    background: var(--glass);
    padding: 20px;
    border-radius: 12px;
    height: 300px;
}
.practice-btn-container {
    text-align: center;
    margin-top: 24px;
}

/* --- STRATEGY CREATOR STYLES --- */
.strategy-creator {
    padding: 10px;
    max-width: 1200px;
    margin: 0 auto;
}
.strategy-step {
    display: none;
}
.strategy-step.active {
    display: block;
    animation: fadeIn .5s ease;
}
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-header {
    text-align: center;
    margin-bottom: 24px;
}
.step-header h2 {
    color: var(--text-primary);
    font-size: 24px;
}
.step-header p {
    color: var(--muted);
    font-size: 16px;
    max-width: 500px;
    margin: 8px auto 0;
}

.progress-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    position: relative;
}
.progress-bar::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--panel);
    transform: translateY(-50%);
    z-index: -1;
}
.progress-bar .step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
}
.progress-bar .step .dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--panel);
    border: 2px solid var(--muted);
    transition: all .3s ease;
}
.progress-bar .step.active .dot {
    background: var(--emerald-1);
    border-color: var(--emerald-1);
    transform: scale(1.2);
}
.progress-bar .step.active .label {
    color: var(--emerald-1);
    font-weight: 600;
}

.chapter-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}
.subject-column {
    background: var(--card); /* Updated */
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color); /* Added */
}
.subject-column h3 {
    margin: 0 0 16px;
    border-bottom: 1px solid var(--glass);
    padding-bottom: 12px;
}
.chapter-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}
.chapter-item {
    background: var(--panel); /* Updated */
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chapter-item p {
    margin: 0;
}
.chapter-actions button {
    background: var(--glass);
    border: 1px solid transparent;
    color: var(--muted);
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all .2s ease;
    font-size: 12px;
}
.chapter-actions button:hover {
    background: rgba(255, 255, 255, 0.05);
}
.chapter-actions button.selected {
    border-color: var(--emerald-1);
    color: var(--emerald-1);
    font-weight: 600;
}

.categorized-chapters {
    margin-top: 24px;
}
.categorized-chapters h4 {
    color: var(--text-primary);
}
.drop-zone {
    background: var(--glass);
    border: 2px dashed var(--panel);
    border-radius: 12px;
    padding: 16px;
    min-height: 100px;
}
.drop-zone .chapter-tag {
    background: var(--panel);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    margin: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: grab;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.step-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
}
.btn-secondary {
    background: var(--panel);
    color: var(--muted);
    box-shadow: none; /* No glow for secondary */
}
.btn-secondary:hover {
    background: var(--card); /* Subtle hover */
    color: var(--text-primary);
    box-shadow: none;
    transform: translateY(-2px);
}

#plan-output {
    animation: fadeIn 1s ease;
}
.plan-summary {
    background: var(--panel);
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 24px;
    border: 1px solid var(--border-color); /* Added */
}
.plan-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--glass);
}
.plan-tab {
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--muted);
}
.plan-tab.active {
    color: var(--emerald-1);
    border-bottom-color: var(--emerald-1);
    font-weight: 600;
}
.plan-content {
    display: none;
}
.plan-content.active {
    display: block;
}
.weekly-schedule .week {
    margin-bottom: 24px;
}
.weekly-schedule h4 {
    color: var(--text-primary);
}
.day-plan {
    background: var(--glass);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 10px;
    border-left: 3px solid var(--card-color-1);
}
.day-plan h5 {
    margin: 0 0 10px;
}
.day-plan ul {
    margin: 0;
    padding-left: 20px;
}
.day-plan ul li {
    margin-bottom: 8px;
}
.task-tag {
    font-weight: bold;
    color: var(--emerald-2);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
@media (max-width:920px) {
    .app {
        padding: 12px 12px 80px 12px;
        gap: 0;
        flex-direction: column;
    }
    .greeting {
        flex: 1;
        justify-content: space-between;
    }
    .profile-pill {
        display: none;
    }
    .mobile-menu-toggle {
        display: flex;
    }
    .mobile-menu-dropdown {
        right: 12px;
        left: 12px;
        margin: 0 auto;
        width: calc(100% - 24px);
    }
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 65px;
        z-index: 100;
        flex-direction: row;
        align-items: center;
        padding: 0 10px;
        border-radius: 0;
        /* UPDATED: Glassmorphism for mobile nav */
        background: var(--panel-glass);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border: none; /* Remove side border */
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -5px 30px rgba(2, 6, 10, 0.8);
    }
    .sidebar .brand, .sidebar .spacer, .sidebar .bottom-actions, .sidebar .nav-btn[data-always-disabled], #nav-labs {
        display: none;
    }
    .sidebar nav {
        display: flex;
        flex-direction: row;
        justify-content: space-evenly;
        align-items: center;
        width: 100%;
        height: 100%;
        margin-top: 0;
    }
    .nav-btn {
        flex-direction: column;
        gap: 4px;
        height: 100%;
        justify-content: center;
        flex: 1;
        font-size: 13px;
        border-radius: 8px;
    }
    .nav-btn svg {
        width: 28px;
        height: 28px;
    }
    .nav-btn.active {
        background: var(--glass); /* More subtle active state for mobile */
        color: var(--emerald-1); /* Keep text color */
        box-shadow: none; /* Remove glow on mobile */
    }
    .nav-btn:hover:not(:disabled) {
        transform: none;
    }
    .dpp-subtitle {
        display: none;
    }
    .options-grid {
        grid-template-columns: 1fr;
    }
    body.strategy-creator-fullscreen .sidebar,
    body.strategy-creator-fullscreen .topbar,
    body.strategy-creator-fullscreen .banner-container {
        display: none;
    }
    body.strategy-creator-fullscreen .app {
        padding: 12px;
    }
    body.strategy-creator-fullscreen .main {
        overflow: auto;
    }
    body.strategy-creator-fullscreen .content {
        padding: 15px;
    }
}
.formula-card.locked {
    opacity: 0.7;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.formula-card.locked::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.formula-card.locked .card-title,
.formula-card.locked .card-footer {
    filter: blur(1px);
}

.premium-badge-small {
    display: inline-block;
    background-color: #f5d8a9;
    color: #5d3d0c;
    font-weight: 700;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 6px;
    z-index: 2;
    position: relative;
}

/* ===== PERFORMANCE MODE (low-end devices) ===== */
.performance-mode * {
    animation: none !important;
    transition: none !important;
}
.performance-mode .sidebar {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--panel) !important;
    box-shadow: 0 4px 16px rgba(2, 6, 10, 0.5) !important;
}
.performance-mode .nav-btn:hover:not(:disabled),
.performance-mode .subject-select-card:hover,
.performance-mode .chapter-chip:hover,
.performance-mode .saved-test-card:hover {
    transform: none !important;
    box-shadow: none !important;
}
.performance-mode .subject-select-card,
.performance-mode .chapter-chip,
.performance-mode .saved-test-card,
.performance-mode .custom-test-card {
    transition: none !important;
}

/* ===== REDUCED MOTION (user preference) ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}