/* ─── RESET & BASE ─── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #060b18;
    color: #e2e8f0;
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
    border-radius: 6px;
}

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: #0f1a2e;
}

::-webkit-scrollbar-thumb {
    background: #2a4a7a;
    border-radius: 8px;
}

/* ─── MOBILE TOP BAR (hidden by default, shown <768px) ─── */
.mobile-topbar {
    display: none;
    align-items: center;
    gap: 0.7rem;
    position: sticky;
    top: 0;
    z-index: 30;
    background: #0b1428;
    border-bottom: 1px solid #1a2d4a;
    padding: 0.7rem 1rem;
    padding-top: calc(0.7rem + env(safe-area-inset-top));
}

.hamburger-btn {
    background: #14233e;
    border: 1px solid #1a2d4a;
    border-radius: 10px;
    width: 38px;
    height: 38px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    flex-shrink: 0;
    transition: 0.2s;
}

.hamburger-btn:hover {
    border-color: #3b82f6;
}

.hamburger-btn span {
    display: block;
    width: 16px;
    height: 2px;
    background: #93bbfc;
    border-radius: 2px;
    transition: 0.25s;
}

.hamburger-btn.open span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.hamburger-btn.open span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.open span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: #60a5fa;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-mastered {
    font-size: 0.75rem;
    color: #fbbf24;
    background: #14233e;
    border: 1px solid #1a2d4a;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    flex-shrink: 0;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 16, 0.65);
    backdrop-filter: blur(2px);
    z-index: 19;
    opacity: 0;
    transition: opacity 0.25s;
}

/* ─── SIDEBAR ─── */
.sidebar {
    width: 250px;
    background: #0b1428;
    border-right: 1px solid #1a2d4a;
    padding: 1.6rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1.2rem;
    color: #60a5fa;
    letter-spacing: -0.5px;
}

.logo .badge {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    padding: 0.15rem 0.6rem;
    border-radius: 6px;
    font-size: 0.65rem;
    color: #fff;
    letter-spacing: 0.3px;
}

.logo .neon-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 12px #4ade80;
    animation: pulse-dot 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.nav button {
    background: transparent;
    border: none;
    color: #7a8da8;
    font-size: 0.88rem;
    padding: 0.65rem 1rem;
    border-radius: 10px;
    text-align: left;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    font-weight: 500;
    position: relative;
}

.nav button .icon {
    font-size: 1.1rem;
    width: 1.6rem;
    text-align: center;
}

.nav button.active,
.nav button:hover {
    background: #14233e;
    color: #f0f4ff;
    box-shadow: inset 0 0 0 1px #2a4a7a;
}

.nav button.active .icon {
    color: #60a5fa;
}

.nav button .notif {
    margin-left: auto;
    background: #3b82f6;
    color: #fff;
    font-size: 0.6rem;
    padding: 0.1rem 0.5rem;
    border-radius: 20px;
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    background: #0f1a2e;
    border-radius: 14px;
    padding: 1rem;
    border: 1px solid #1a2d4a;
}

.sidebar-footer .row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.sidebar-footer .avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-footer .name {
    font-weight: 600;
    font-size: 0.85rem;
}

.sidebar-footer .title {
    font-size: 0.65rem;
    color: #6b8aa8;
}

.sidebar-footer .streak {
    font-size: 0.7rem;
    color: #fbbf24;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: auto;
}

/* ─── MAIN ─── */
.main {
    flex: 1;
    padding: 1.4rem 2rem 2rem 2rem;
    overflow-y: auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    background: radial-gradient(ellipse at 20% 30%, #0e1a2e, #060b18 80%);
    min-width: 0;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #1a2d4a;
}

.top-bar h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #e2e8f0, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.top-bar h1 .highlight {
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.top-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.day-badge {
    background: #0f1a2e;
    padding: 0.3rem 1.2rem;
    border-radius: 30px;
    color: #60a5fa;
    border: 1px solid #1a2d4a;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.focus-mode-btn {
    background: #14233e;
    border: 1px solid #2a4a7a;
    color: #e2e8f0;
    padding: 0.3rem 1rem;
    border-radius: 30px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.focus-mode-btn:hover {
    background: #1a2d4a;
    border-color: #3b82f6;
}

.focus-mode-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

/* ─── CARDS ─── */
.card {
    background: rgba(13, 24, 48, 0.85);
    border: 1px solid #1a2d4a;
    border-radius: 18px;
    padding: 1.4rem 1.6rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    transition: border-color 0.25s, transform 0.2s;
    min-width: 0;
}

.card:hover {
    border-color: #2a4a7a;
}

.card h2 {
    font-size: 1.05rem;
    color: #f0f4ff;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.card h2 .sub {
    font-size: 0.7rem;
    font-weight: 400;
    color: #6b8aa8;
    margin-left: 0.3rem;
}

.card h2 .pill {
    background: #14233e;
    padding: 0.1rem 0.7rem;
    border-radius: 20px;
    font-size: 0.6rem;
    color: #60a5fa;
    border: 1px solid #1a2d4a;
    font-weight: 400;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
}

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

.full {
    grid-column: 1 / -1;
}

/* ─── STATS ─── */
.stat-box {
    background: rgba(11, 20, 40, 0.7);
    border: 1px solid #1a2d4a;
    border-radius: 14px;
    padding: 0.9rem 1.2rem;
    text-align: center;
    transition: border-color 0.2s;
    min-width: 0;
}

.stat-box:hover {
    border-color: #2a4a7a;
}

.stat-box .num {
    font-size: 1.8rem;
    font-weight: 700;
    color: #f0f4ff;
    line-height: 1.1;
}

.stat-box .num.accent {
    color: #60a5fa;
}

.stat-box .num.green {
    color: #4ade80;
}

.stat-box .num.pink {
    color: #f472b6;
}

.stat-box .num.orange {
    color: #fb923c;
}

.stat-box .num.purple {
    color: #a78bfa;
}

.stat-box .lbl {
    font-size: 0.7rem;
    color: #6b8aa8;
    margin-top: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─── PROGRESS ─── */
.progress-item {
    margin-bottom: 0.7rem;
}

.progress-item .label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #b0c4e0;
    gap: 0.5rem;
}

.progress-item .label span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-item .label span:last-child {
    flex-shrink: 0;
}

.progress-track {
    height: 6px;
    background: #1a2d4a;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 0.15rem;
}

.progress-fill {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transition: width 0.8s ease;
}

.progress-fill.green {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.progress-fill.orange {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.progress-fill.pink {
    background: linear-gradient(90deg, #ec4899, #db2777);
}

.progress-fill.cyan {
    background: linear-gradient(90deg, #06b6d4, #0891b2);
}

/* ─── SYLLABUS TOOLBAR (search + filters) ─── */
.syllabus-toolbar {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 0.9rem;
}

.syllabus-search {
    position: relative;
    flex: 1 1 220px;
    min-width: 0;
}

.syllabus-search input {
    width: 100%;
    background: #0f1a2e;
    border: 1px solid #1a2d4a;
    border-radius: 30px;
    padding: 0.55rem 1rem 0.55rem 2.2rem;
    color: #e2e8f0;
    font-size: 0.85rem;
    outline: none;
    transition: 0.2s;
}

.syllabus-search input::placeholder {
    color: #5a7497;
}

.syllabus-search input:focus {
    border-color: #3b82f6;
    background: #14233e;
}

.syllabus-search .search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: #5a7497;
    pointer-events: none;
}

.filter-chip-group {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.filter-chip {
    background: #14233e;
    border: 1px solid #1a2d4a;
    color: #9fb6d4;
    padding: 0.4rem 0.9rem;
    border-radius: 30px;
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
}

.filter-chip:hover {
    border-color: #3b82f6;
}

.filter-chip.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.syllabus-toolbar .expand-controls {
    display: flex;
    gap: 0.4rem;
    margin-left: auto;
}

.syllabus-toolbar .expand-controls button {
    background: transparent;
    border: 1px solid #1a2d4a;
    color: #6b8aa8;
    padding: 0.4rem 0.8rem;
    border-radius: 30px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
}

.syllabus-toolbar .expand-controls button:hover {
    border-color: #3b82f6;
    color: #93bbfc;
}

.no-results {
    text-align: center;
    color: #6b8aa8;
    font-size: 0.85rem;
    padding: 1.6rem 0.5rem;
}

/* ─── SYLLABUS ─── */
.syllabus-level {
    margin-bottom: 1rem;
    cursor: default;
}

.syllabus-level .level-title {
    font-weight: 600;
    color: #60a5fa;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    padding: 0.5rem 0.3rem;
    border-bottom: 1px solid #1a2d4a;
    user-select: none;
    border-radius: 6px;
}

.syllabus-level .level-title:hover {
    background: #0f1a2e;
}

.syllabus-level .level-title .level-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.syllabus-level .level-title .arrow {
    transition: transform 0.2s;
    font-size: 0.7rem;
}

.syllabus-level .level-title .arrow.open {
    transform: rotate(90deg);
}

.syllabus-level .level-title .count {
    font-size: 0.7rem;
    color: #6b8aa8;
    font-weight: 400;
    flex-shrink: 0;
}

.syllabus-level .level-title .mini-track {
    flex: 1;
    height: 5px;
    background: #1a2d4a;
    border-radius: 8px;
    overflow: hidden;
    min-width: 40px;
    max-width: 140px;
}

.syllabus-level .level-title .mini-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 8px;
}

.topic-list {
    padding-left: 0.5rem;
    margin-top: 0.3rem;
    display: none;
}

.topic-list.open {
    display: block;
}

.topic-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.5rem;
    border-radius: 8px;
    font-size: 0.82rem;
    color: #c8d6e8;
    transition: background 0.15s, border-color 0.2s;
    cursor: pointer;
    border: 1px solid transparent;
    margin-bottom: 2px;
    flex-wrap: wrap;
}

.topic-item:hover {
    background: #14233e;
    border-color: #2a4a7a;
}

.topic-item .check {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    border: 2px solid #2a4a7a;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    flex-shrink: 0;
    font-size: 0.65rem;
    color: transparent;
}

.topic-item .check.done {
    background: #22c55e;
    border-color: #22c55e;
    color: #fff;
}

.topic-item .topic-label {
    flex: 1;
    font-weight: 500;
    min-width: 100px;
}

.topic-item .topic-difficulty {
    font-size: 0.6rem;
    padding: 0.15rem 0.55rem;
    border-radius: 12px;
    background: #14233e;
    color: #6b8aa8;
    border: 1px solid #1a2d4a;
    flex-shrink: 0;
}

.topic-item .topic-difficulty.easy {
    color: #4ade80;
    border-color: #22c55e;
}

.topic-item .topic-difficulty.medium {
    color: #fbbf24;
    border-color: #f59e0b;
}

.topic-item .topic-difficulty.hard {
    color: #f87171;
    border-color: #ef4444;
}

.topic-item .topic-detail-btn {
    background: transparent;
    border: none;
    color: #6b8aa8;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: 0.2s;
    flex-shrink: 0;
}

.topic-item .topic-detail-btn:hover {
    color: #60a5fa;
    background: #1a2d4a;
}

/* ─── TOPIC DETAIL MODAL ─── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    padding: 1rem;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: #0b1428;
    border: 1px solid #2a4a7a;
    border-radius: 20px;
    max-width: 720px;
    width: 94%;
    max-height: 88vh;
    overflow-y: auto;
    padding: 2rem;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
    transform: scale(0.95) translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.open .modal-box {
    transform: scale(1) translateY(0);
}

.modal-box .modal-close {
    float: right;
    background: #14233e;
    border: 1px solid #1a2d4a;
    color: #6b8aa8;
    font-size: 1.1rem;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    transition: 0.2s;
    line-height: 1;
}

.modal-box .modal-close:hover {
    color: #f0f4ff;
    border-color: #3b82f6;
    transform: rotate(90deg);
}

.modal-box .modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #f0f4ff;
    margin-bottom: 0.2rem;
    padding-right: 2.5rem;
}

.modal-box .modal-meta {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: #6b8aa8;
    margin-bottom: 1rem;
}

.modal-box .modal-meta .diff-badge {
    padding: 0.1rem 0.7rem;
    border-radius: 12px;
    background: #14233e;
    border: 1px solid #1a2d4a;
}

.modal-box .modal-meta .diff-badge.easy {
    color: #4ade80;
    border-color: #22c55e;
}

.modal-box .modal-meta .diff-badge.medium {
    color: #fbbf24;
    border-color: #f59e0b;
}

.modal-box .modal-meta .diff-badge.hard {
    color: #f87171;
    border-color: #ef4444;
}

.modal-box .modal-section {
    margin-top: 1rem;
}

.modal-box .modal-section h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b8aa8;
    margin-bottom: 0.3rem;
}

.modal-box .modal-section p,
.modal-box .modal-section li {
    font-size: 0.9rem;
    line-height: 1.7;
    color: #c8d6e8;
}

.modal-box .modal-section .code-block {
    background: #060b18;
    border-radius: 8px;
    padding: 0.8rem 1rem;
    font-family: 'Fira Code', 'Menlo', monospace;
    font-size: 0.8rem;
    color: #c8d6e8;
    border: 1px solid #1a2d4a;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.6;
    margin: 0.2rem 0;
}

.modal-box .modal-section .code-block .comment {
    color: #6b8aa8;
}

.modal-box .modal-section .code-block .keyword {
    color: #a78bfa;
}

.modal-box .modal-section .code-block .string {
    color: #4ade80;
}

.modal-box .modal-section .code-block .func {
    color: #60a5fa;
}

.modal-box .modal-section .code-block .number {
    color: #fbbf24;
}

.modal-box .resource-list {
    list-style: none;
    padding: 0;
}

.modal-box .resource-list li {
    padding: 0.3rem 0;
    border-bottom: 1px solid #0f1a2e;
}

.modal-box .resource-list a {
    color: #60a5fa;
    text-decoration: none;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: 0.2s;
}

.modal-box .resource-list a:hover {
    color: #93bbfc;
    text-decoration: underline;
}

.modal-box .resource-list a .icon {
    font-size: 1rem;
}

/* ─── LAB ─── */
.lab-panel {
    background: rgba(6, 11, 24, 0.7);
    border-radius: 12px;
    border: 1px solid #1a2d4a;
    padding: 1rem;
    min-height: 200px;
}

.lab-panel .lab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
    gap: 0.5rem;
}

.lab-panel .lab-header .badge {
    font-size: 0.6rem;
    background: #14233e;
    padding: 0.1rem 0.6rem;
    border-radius: 12px;
    color: #60a5fa;
    border: 1px solid #1a2d4a;
}

.code-editor {
    background: #060b18;
    border-radius: 8px;
    padding: 0.8rem;
    font-family: 'Fira Code', 'Menlo', monospace;
    font-size: 0.8rem;
    border: 1px solid #1a2d4a;
    min-height: 120px;
    color: #c8d6e8;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.6;
    outline: none;
    max-height: 300px;
    overflow-y: auto;
}

.code-editor:focus {
    border-color: #3b82f6;
}

.lab-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.6rem;
}

.lab-controls button,
.lab-controls select {
    background: #14233e;
    border: 1px solid #1a2d4a;
    color: #e2e8f0;
    padding: 0.45rem 1rem;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
}

.lab-controls button:hover {
    background: #1a2d4a;
    border-color: #3b82f6;
}

.lab-controls button.primary {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.lab-controls button.primary:hover {
    background: #2563eb;
}

.lab-controls button.green {
    background: #22c55e;
    border-color: #22c55e;
    color: #fff;
}

.lab-controls button.green:hover {
    background: #16a34a;
}

.lab-controls select option {
    background: #0b1428;
}

.lab-output {
    background: #060b18;
    border-radius: 8px;
    padding: 0.8rem;
    border: 1px solid #1a2d4a;
    min-height: 60px;
    font-size: 0.8rem;
    color: #b0c4e0;
    margin-top: 0.6rem;
    font-family: 'Fira Code', 'Menlo', monospace;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
}

.lab-output .success {
    color: #4ade80;
}

.lab-output .error {
    color: #f87171;
}

.lab-output .info {
    color: #60a5fa;
}

/* ─── TIMER ─── */
.timer-display {
    font-size: 2.8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #f0f4ff;
    text-align: center;
    letter-spacing: 2px;
    font-family: 'Fira Code', 'Menlo', monospace;
}

.timer-display .blink {
    animation: blink 1s step-end infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.timer-controls {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 0.6rem;
    flex-wrap: wrap;
}

.timer-controls button {
    background: #14233e;
    border: 1px solid #1a2d4a;
    color: #e2e8f0;
    padding: 0.4rem 1.2rem;
    border-radius: 30px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: 0.2s;
}

.timer-controls button:hover {
    background: #1a2d4a;
    border-color: #3b82f6;
}

.timer-controls button.primary {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.timer-controls button.primary:hover {
    background: #2563eb;
}

.timer-controls button.danger {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

.timer-controls button.danger:hover {
    background: #b91c1c;
}

.session-log {
    font-size: 0.75rem;
    color: #6b8aa8;
    max-height: 80px;
    overflow-y: auto;
    padding: 0.2rem 0;
}

.session-log div {
    padding: 0.15rem 0;
    border-bottom: 1px solid #0f1a2e;
}

.session-log .time {
    color: #60a5fa;
}

/* ─── KNOWLEDGE MAP ─── */
.knowledge-graph {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: center;
    padding: 0.6rem 0;
}

.kg-node {
    background: #14233e;
    border: 1px solid #1a2d4a;
    border-radius: 12px;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    color: #c8d6e8;
    transition: 0.2s;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.kg-node:hover {
    border-color: #60a5fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.15);
}

.kg-node .level-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.kg-node .level-dot.foundation {
    background: #4ade80;
}

.kg-node .level-dot.core {
    background: #60a5fa;
}

.kg-node .level-dot.advanced {
    background: #a78bfa;
}

.kg-node .level-dot.expert {
    background: #f472b6;
}

.kg-node .connector {
    color: #2a4a7a;
    font-size: 0.6rem;
    margin: 0 0.1rem;
}

.kg-legend {
    display: flex;
    gap: 1rem;
    justify-content: center;
    font-size: 0.7rem;
    color: #6b8aa8;
    flex-wrap: wrap;
    padding-top: 0.4rem;
    border-top: 1px solid #1a2d4a;
}

.kg-legend span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.kg-legend .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* ─── CHARTS ─── */
.chart-wrapper {
    height: 180px;
    position: relative;
}

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

.chart-wrapper.tall {
    height: 220px;
}

/* ─── MOBILE BOTTOM TAB BAR ─── */
.bottom-tabbar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #0b1428;
    border-top: 1px solid #1a2d4a;
    z-index: 25;
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-tabbar button {
    background: transparent;
    border: none;
    color: #7a8da8;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.5rem 0.2rem 0.45rem;
    font-size: 0.62rem;
    cursor: pointer;
    position: relative;
}

.bottom-tabbar button .icon {
    font-size: 1.1rem;
}

.bottom-tabbar button.active {
    color: #60a5fa;
}

.bottom-tabbar button .notif {
    position: absolute;
    top: 2px;
    right: 18%;
    background: #3b82f6;
    color: #fff;
    font-size: 0.55rem;
    min-width: 14px;
    height: 14px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

/* ─── RESPONSIVE: TABLET ─── */
@media(max-width:1024px) {
    .sidebar {
        width: 210px;
        padding: 1.4rem 1rem;
    }

    .main {
        padding: 1.2rem 1.4rem 1.6rem;
    }

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

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

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

    .syllabus-toolbar .expand-controls {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
    }
}

/* ─── RESPONSIVE: MOBILE & SMALL TABLET (drawer nav) ─── */
@media(max-width:768px) {
    body {
        flex-direction: column;
        overflow: auto;
        min-height: 100dvh;
    }

    .mobile-topbar {
        display: flex;
    }

    .sidebar-backdrop.open {
        display: block;
        opacity: 1;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100dvh;
        width: 78%;
        max-width: 300px;
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        z-index: 20;
        box-shadow: 8px 0 40px rgba(0, 0, 0, 0.5);
        padding-top: calc(1.6rem + env(safe-area-inset-top));
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar .logo {
        font-size: 1.05rem;
    }

    .sidebar .nav {
        flex-direction: column;
        width: 100%;
    }

    .sidebar .nav button {
        width: 100%;
        justify-content: flex-start;
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }

    .sidebar-footer {
        display: block;
    }

    .main {
        padding: 1rem 1rem calc(4.6rem + env(safe-area-inset-bottom));
        height: auto;
        overflow: visible;
        width: 100%;
    }

    .top-bar {
        display: none;
    }

    .bottom-tabbar {
        display: flex;
    }

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

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

    .timer-display {
        font-size: 2rem;
    }

    .stat-box .num {
        font-size: 1.3rem;
    }

    .modal-box {
        padding: 1.2rem;
        max-width: 98%;
        max-height: 92dvh;
    }

    .modal-box .modal-title {
        font-size: 1.1rem;
    }

    .syllabus-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .syllabus-toolbar .filter-chip-group {
        width: 100%;
    }

    .syllabus-toolbar .expand-controls {
        width: 100%;
    }

    .syllabus-toolbar .expand-controls button {
        flex: 1;
        text-align: center;
    }

    .syllabus-level .level-title .mini-track {
        display: none;
    }

    .topic-item .topic-label {
        flex-basis: 100%;
        order: 1;
    }

    .topic-item .check {
        order: 0;
    }

    .topic-item .topic-difficulty,
    .topic-item .topic-detail-btn {
        order: 2;
    }
}

@media(max-width:480px) {
    .grid-4 {
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
    }

    .card {
        padding: 1rem;
    }

    .card h2 {
        font-size: 0.95rem;
    }

    .stat-box {
        padding: 0.6rem;
    }

    .stat-box .num {
        font-size: 1.1rem;
    }

    .code-editor {
        font-size: 0.7rem;
        min-height: 80px;
    }

    .lab-controls button,
    .lab-controls select {
        font-size: 0.65rem;
        padding: 0.35rem 0.8rem;
    }

    .modal-box {
        padding: 1rem;
        border-radius: 14px;
    }

    .modal-box .modal-title {
        font-size: 1rem;
    }

    .topic-item {
        font-size: 0.78rem;
    }

    .mobile-logo {
        font-size: 0.85rem;
    }

    .bottom-tabbar button {
        font-size: 0.58rem;
    }
}

@media (hover: none) {

    .nav button,
    .topic-item,
    .filter-chip,
    .lab-controls button,
    .timer-controls button,
    .kg-node {
        -webkit-tap-highlight-color: transparent;
    }
}

/* ─── ANIMATIONS ─── */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeSlideUp 0.45s ease forwards;
}

.card:nth-child(2) {
    animation-delay: 0.05s;
}

.card:nth-child(3) {
    animation-delay: 0.1s;
}

.card:nth-child(4) {
    animation-delay: 0.15s;
}

.card:nth-child(5) {
    animation-delay: 0.2s;
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

.info-tip {
    color: #6b8aa8;
    font-size: 0.7rem;
    cursor: help;
    border-bottom: 1px dashed #2a4a7a;
}

.glow-text {
    text-shadow: 0 0 30px rgba(59, 130, 246, 0.15);
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-1 {
    gap: 0.5rem;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.text-muted {
    color: #6b8aa8;
    font-size: 0.8rem;
}

.text-sm {
    font-size: 0.75rem;
}

.fw-600 {
    font-weight: 600;
}

.hidden {
    display: none !important;
}

/* robot arm */
.robot-arm {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 80px;
    gap: 6px;
}

.robot-arm .segment {
    width: 12px;
    background: linear-gradient(180deg, #3b82f6, #8b5cf6);
    border-radius: 4px 4px 0 0;
    transition: height 0.4s ease;
    animation: arm-wave 2s ease-in-out infinite alternate;
}

.robot-arm .segment:nth-child(1) {
    animation-delay: 0s;
    height: 40px;
}

.robot-arm .segment:nth-child(2) {
    animation-delay: 0.2s;
    height: 60px;
}

.robot-arm .segment:nth-child(3) {
    animation-delay: 0.4s;
    height: 80px;
}

.robot-arm .segment:nth-child(4) {
    animation-delay: 0.6s;
    height: 50px;
}

.robot-arm .segment:nth-child(5) {
    animation-delay: 0.8s;
    height: 70px;
}

.robot-arm .segment:nth-child(6) {
    animation-delay: 1.0s;
    height: 30px;
}

.robot-arm .segment:nth-child(7) {
    animation-delay: 1.2s;
    height: 55px;
}

@keyframes arm-wave {
    0% {
        height: 30px;
    }

    100% {
        height: 80px;
    }
}

.particle-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #3b82f6;
    border-radius: 50%;
    opacity: 0.2;
    animation: float-particle 20s infinite linear;
}

@keyframes float-particle {
    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 for modal */
.modal-box::-webkit-scrollbar {
    width: 4px;
}

.modal-box::-webkit-scrollbar-track {
    background: #0b1428;
}

.modal-box::-webkit-scrollbar-thumb {
    background: #2a4a7a;
    border-radius: 8px;
}

/* quick experiment hover */
.quick-exp {
    transition: 0.2s;
}

.quick-exp:hover {
    border-color: #3b82f6 !important;
    background: #1a2d4a !important;
}