:root {
    --ink: #211a35;
    --muted: #716b83;
    --line: #e8e3f0;
    --surface: #fff;
    --background: #f7f5fb;
    --purple: #7048e8;
    --purple-dark: #5431c7;
    --shadow: 0 18px 48px rgba(48, 34, 91, .09);
    --shadow-hover: 0 24px 54px rgba(48, 34, 91, .15);
}

html {
    scroll-behavior: smooth;
    background: var(--background);
}

body {
    background:
        radial-gradient(ellipse at 12% 0%, rgba(196, 179, 255, .18), transparent 35rem),
        radial-gradient(ellipse at 92% 18%, rgba(255, 215, 187, .17), transparent 30rem),
        var(--background);
    color: var(--ink);
    line-height: 1.55;
    text-rendering: optimizeLegibility;
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    content: "";
    opacity: .17;
    background-image: radial-gradient(rgba(99, 78, 151, .24) .55px, transparent .55px);
    background-size: 15px 15px;
    mask-image: linear-gradient(to bottom, black, transparent 82%);
}

.site-header {
    width: min(1320px, calc(100% - 40px));
    height: 72px;
    margin: 14px auto 0;
    padding: 0 20px;
    border: 1px solid rgba(226, 219, 240, .9);
    border-radius: 22px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 8px 30px rgba(45, 32, 81, .07);
}

.brand {
    gap: 9px;
    font-size: 18px;
    letter-spacing: -.8px;
}

.brand-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    filter: drop-shadow(0 5px 9px rgba(91, 56, 186, .16));
}

.brand-wordmark > span {
    color: var(--purple);
}

.main-nav {
    gap: 8px;
}

.main-nav .nav-action {
    height: 42px;
    padding: 0 14px;
    border-radius: 13px;
    color: #635c75;
    font-size: 13px;
    font-weight: 750;
    transition: color .18s ease, background .18s ease, transform .18s ease;
}

.main-nav .nav-action:hover,
.main-nav .nav-action.active {
    color: var(--purple-dark);
    background: #f0ebff;
    transform: translateY(-1px);
}

.header-actions {
    position: relative;
    gap: 10px;
}

.theme-toggle,
.profile-button {
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    box-shadow: 0 4px 12px rgba(44, 32, 77, .05);
    transition: transform .18s ease, box-shadow .18s ease;
}

.theme-toggle:hover,
.profile-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(70, 47, 133, .14);
}

.profile-menu-backdrop {
    position: fixed;
    z-index: 20;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    border: 0;
    background: rgba(27, 21, 43, .22);
    backdrop-filter: blur(3px);
}

.profile-menu {
    position: absolute;
    z-index: 21;
    top: calc(100% + 13px);
    right: 0;
    width: min(320px, calc(100vw - 28px));
    padding: 14px;
    border: 1px solid rgba(224, 216, 240, .94);
    border-radius: 21px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(35, 25, 67, .2);
    transform-origin: top right;
    animation: ui-pop-in .18s ease-out both;
}

.profile-menu-resources {
    gap: 9px;
    margin-bottom: 12px;
}

.resource-pill {
    min-width: 0;
    border-radius: 14px;
}

.profile-menu-link {
    min-height: 44px;
    border-radius: 12px;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}

.profile-menu-link:hover,
.profile-menu-link.active {
    color: var(--purple-dark);
    background: #f3efff;
    transform: translateX(2px);
}

.profile-menu-primary {
    margin-bottom: 8px;
    background: linear-gradient(110deg, #f1ecff, #f8f5ff);
}

.profile-menu-logout {
    width: 100%;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0 0 12px 12px;
    margin-top: 8px;
    padding-top: 8px;
    background: transparent;
    text-align: left;
}

.app-main {
    padding: 38px 24px 76px;
}

.page-container {
    width: 100%;
    max-width: 1220px;
}

h1,
h2,
h3,
h4 {
    color: var(--ink);
    text-wrap: pretty;
}

h1 {
    letter-spacing: -.045em;
    line-height: 1.08;
}

h2 {
    letter-spacing: -.035em;
}

.eyebrow {
    letter-spacing: .14em;
}

.subtitle {
    max-width: 66ch;
    line-height: 1.7;
}

.dashboard-head,
.subject-page-header,
.tool-page > header {
    margin-bottom: 28px;
}

.subjects-home,
.subject-page,
.profile-layout,
.tool-page {
    animation: ui-page-in .36s ease both;
}

.level-card,
.subject-card,
.subject-exercise-card,
.game-card,
.profile-hero,
.profile-controls-card,
.recent-panel,
.subject-filter-card,
.lesson-card,
.lesson-card-full,
.tool-card,
.diagnostic-card,
.theory-card,
.difficulty-screen,
.game-panel,
.result-screen,
.media-card,
.tournament-table-card,
.podium-card,
.achievement-card,
.practice-card {
    border: 1px solid rgba(228, 223, 239, .94);
    border-radius: 20px;
    background: rgba(255, 255, 255, .93);
    box-shadow: 0 8px 26px rgba(47, 34, 87, .055);
}

.subject-card,
.subject-exercise-card,
.game-card,
.lesson-card,
.media-card,
.practice-card {
    transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.subject-card:hover,
.subject-exercise-card:hover,
.game-card:not(.locked):hover,
.lesson-card:hover,
.media-card:hover,
.practice-card:hover {
    transform: translateY(-4px);
    border-color: #d3c5ff;
    box-shadow: var(--shadow-hover);
}

.subject-card {
    position: relative;
    min-height: 128px;
    padding: 22px;
    overflow: hidden;
}

.subject-card::after {
    position: absolute;
    right: -34px;
    bottom: -48px;
    width: 118px;
    height: 118px;
    border: 1px solid rgba(112, 72, 232, .09);
    border-radius: 50%;
    content: "";
}

.subject-card-copy strong {
    color: var(--ink);
    font-size: 17px;
    letter-spacing: -.025em;
}

.subject-card-copy small {
    max-width: 34ch;
    line-height: 1.55;
}

.subject-card-corner {
    z-index: 1;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(112, 72, 232, .14);
    border-radius: 12px;
    background: #f4f0ff;
    color: var(--purple-dark);
    font-size: 17px;
    font-weight: 800;
}

.level-card {
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.subject-page-layout {
    gap: 20px;
}

.subject-filters {
    gap: 12px;
}

.subject-filter-card {
    padding: 18px;
}

.filter-checkbox,
.filter-radio {
    min-height: 39px;
    border-radius: 10px;
    transition: background .16s ease;
}

.filter-checkbox:hover,
.filter-radio:hover {
    background: #f6f3ff;
}

.subject-exercise-card {
    padding: 20px;
}

.subject-exercise-card h3,
.game-card h3,
.lesson-card h3 {
    letter-spacing: -.025em;
}

.card-action,
.button {
    border-radius: 13px;
    font-weight: 750;
}

.button-primary {
    background: linear-gradient(135deg, #7955ef, #603bd4);
    box-shadow: 0 8px 18px rgba(93, 60, 208, .22);
}

.button-primary:hover:not(:disabled) {
    box-shadow: 0 12px 24px rgba(93, 60, 208, .29);
}

.button-secondary {
    border: 1px solid #e3dcf4;
    background: #f4f0ff;
    color: #5638bf;
}

.button-ghost:hover {
    background: #f1edfa;
    color: var(--purple-dark);
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    border-color: #e1dceb;
    border-radius: 12px;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #967bed;
    box-shadow: 0 0 0 4px rgba(112, 72, 232, .12);
}

.auth-shell {
    min-height: calc(100dvh - 180px);
    align-items: center;
}

.auth-card {
    border: 1px solid rgba(226, 219, 240, .9);
    border-radius: 26px;
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 25px 70px rgba(51, 35, 102, .12);
}

.profile-hero,
.profile-controls-card,
.recent-panel {
    border-radius: 22px;
    padding: 22px;
}

.profile-hero {
    width: min(100%, 340px);
}

.profile-controls-card {
    background: rgba(255, 255, 255, .94);
}

.game-header {
    gap: 16px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 19px;
    background: rgba(255, 255, 255, .88);
    box-shadow: 0 8px 24px rgba(47, 34, 87, .055);
}

.back-button {
    border-radius: 13px;
    transition: background .18s ease, transform .18s ease;
}

.back-button:hover {
    transform: translateX(-2px);
}

.game-panel,
.difficulty-screen,
.result-screen {
    padding: clamp(20px, 4vw, 36px);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.answer-area input,
.single-letter-answer input {
    min-height: 52px;
    border-radius: 14px;
    background: #fff;
}

.lesson-section,
.vocab-subtopic,
.grammar-card,
.theory-card {
    border-radius: 16px;
}

.lesson-section {
    margin-top: 18px;
    padding: 20px;
    background: #fbfaff;
}

.grade-tabs {
    gap: 10px;
    margin-bottom: 22px;
}

.grade-tab {
    min-width: 142px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #fff;
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.grade-tab:hover,
.grade-tab.active {
    border-color: #c8b7ff;
    background: #f4f0ff;
    transform: translateY(-2px);
}

.level-modal-backdrop {
    z-index: 60;
    background: rgba(25, 19, 40, .48);
    backdrop-filter: blur(7px);
}

.levels-modal {
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 24px;
    box-shadow: 0 30px 90px rgba(18, 12, 31, .3);
    animation: ui-page-in .2s ease both;
}

.achievement-toast {
    border: 1px solid rgba(226, 219, 240, .9);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow-hover);
}

.seo-prerender {
    max-width: 860px;
    margin: 0 auto;
    padding: clamp(24px, 5vw, 52px);
    border: 1px solid var(--line);
    border-radius: 26px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.seo-prerender > nav:first-child {
    margin-bottom: 30px;
    color: var(--muted);
    font-size: 13px;
}

.seo-prerender header {
    margin-bottom: 36px;
}

.seo-prerender h1 {
    max-width: 19ch;
    font-size: clamp(34px, 6vw, 54px);
}

.seo-prerender section {
    padding: 22px 0;
    border-top: 1px solid var(--line);
}

.seo-prerender section h2 {
    margin-bottom: 8px;
    font-size: 21px;
}

.seo-prerender section p {
    max-width: 72ch;
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.8;
}

.seo-related {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 18px;
}

.seo-related a,
.seo-cta a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 13px;
    border: 1px solid #e5def5;
    border-radius: 12px;
    background: #f7f4ff;
    color: #5431c7;
    font-size: 13px;
    font-weight: 750;
}

.seo-cta {
    margin: 24px 0 0;
    color: var(--muted);
    font-size: 13px;
}

:root[data-theme="dark"] .seo-related a,
:root[data-theme="dark"] .seo-cta a {
    border-color: #4a405e;
    background: #2b243b;
    color: #d7cbff;
}

.exit-confirm-dialog {
    width: min(440px, calc(100vw - 28px));
    padding: 28px;
    border: 1px solid rgba(226, 219, 240, .95);
    border-radius: 24px;
    background: #fff;
    color: var(--ink);
    box-shadow: 0 30px 100px rgba(23, 16, 43, .28);
}

.exit-confirm-dialog::backdrop {
    background: rgba(23, 17, 38, .48);
    backdrop-filter: blur(5px);
}

.exit-confirm-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 18px;
    border-radius: 16px;
    background: #f0ebff;
    color: var(--purple-dark);
    font-size: 25px;
}

.exit-confirm-dialog h2 {
    margin-bottom: 8px;
    font-size: 24px;
    letter-spacing: -.04em;
}

.exit-confirm-copy {
    margin-bottom: 22px;
    color: var(--muted);
}

.exit-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
}

:root[data-theme="dark"] {
    --ink: #f0ecfa;
    --muted: #b7afca;
    --line: #403752;
    --surface: #211c2c;
    --background: #16131e;
    --purple: #a38aff;
    --purple-dark: #c0afff;
    --shadow: 0 18px 48px rgba(0, 0, 0, .22);
    --shadow-hover: 0 24px 54px rgba(0, 0, 0, .32);
}

:root[data-theme="dark"] body {
    background:
        radial-gradient(ellipse at 12% 0%, rgba(104, 72, 173, .16), transparent 35rem),
        radial-gradient(ellipse at 92% 18%, rgba(156, 95, 78, .09), transparent 30rem),
        var(--background);
    color: var(--ink);
}

:root[data-theme="dark"] .site-header,
:root[data-theme="dark"] .profile-menu,
:root[data-theme="dark"] .auth-card,
:root[data-theme="dark"] .level-card,
:root[data-theme="dark"] .subject-card,
:root[data-theme="dark"] .subject-exercise-card,
:root[data-theme="dark"] .game-card,
:root[data-theme="dark"] .profile-hero,
:root[data-theme="dark"] .profile-controls-card,
:root[data-theme="dark"] .recent-panel,
:root[data-theme="dark"] .subject-filter-card,
:root[data-theme="dark"] .lesson-card,
:root[data-theme="dark"] .lesson-card-full,
:root[data-theme="dark"] .difficulty-screen,
:root[data-theme="dark"] .game-panel,
:root[data-theme="dark"] .result-screen,
:root[data-theme="dark"] .media-card,
:root[data-theme="dark"] .exit-confirm-dialog {
    border-color: var(--line);
    background: rgba(34, 28, 46, .96);
    color: var(--ink);
}

:root[data-theme="dark"] h1,
:root[data-theme="dark"] h2,
:root[data-theme="dark"] h3,
:root[data-theme="dark"] h4,
:root[data-theme="dark"] .subject-card-copy strong {
    color: var(--ink);
}

:root[data-theme="dark"] .main-nav .nav-action {
    color: #c7bfd8;
}

:root[data-theme="dark"] .main-nav .nav-action:hover,
:root[data-theme="dark"] .main-nav .nav-action.active,
:root[data-theme="dark"] .profile-menu-link:hover,
:root[data-theme="dark"] .profile-menu-link.active {
    background: #342b4c;
    color: #d7cbff;
}

:root[data-theme="dark"] .profile-menu-primary,
:root[data-theme="dark"] .lesson-section,
:root[data-theme="dark"] .grade-tab.active {
    background: #2b243b;
}

:root[data-theme="dark"] .grade-tab,
:root[data-theme="dark"] .twofa-input,
:root[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
    border-color: #4a405e;
    background: #211c2c;
    color: var(--ink);
}

:root[data-theme="dark"] .exit-confirm-dialog {
    background: #251e32;
}

@keyframes ui-page-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes ui-pop-in {
    from { opacity: 0; transform: translateY(-5px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 760px) {
    .site-header {
        position: sticky;
        top: 8px;
        z-index: 30;
        width: calc(100% - 24px);
        height: 62px;
        margin-top: 8px;
        padding: 0 12px;
        border-radius: 18px;
    }

    .brand-logo { width: 36px; height: 36px; }
    .brand { font-size: 16px; }
    .header-actions { margin-left: auto; }
    .mobile-nav-toggle { display: flex; }

    .site-header .main-nav {
        position: absolute;
        top: calc(100% + 9px);
        right: 0;
        left: 0;
        display: none;
        height: auto;
        padding: 10px;
        border: 1px solid var(--line);
        border-radius: 18px;
        background: #fff;
        box-shadow: 0 18px 48px rgba(33, 25, 56, .18);
    }

    .site-header .main-nav.mobile-open {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .site-header .main-nav .nav-action {
        width: 100%;
        min-height: 46px;
        justify-content: flex-start;
        background: transparent;
    }

    .site-header .main-nav .nav-action:hover,
    .site-header .main-nav .nav-action.active {
        background: #f1edfc;
    }

    :root[data-theme="dark"] .site-header .main-nav {
        border-color: var(--line);
        background: #211c2c;
    }

    :root[data-theme="dark"] .site-header .main-nav .nav-action:hover,
    :root[data-theme="dark"] .site-header .main-nav .nav-action.active {
        background: #342b4c;
    }

    .app-main { padding: 28px 14px 52px; }
    .dashboard-head { align-items: stretch; flex-direction: column; gap: 18px; }
    .dashboard-head .level-card { width: 100%; }
    .profile-hero { width: 100%; }
    .subject-page-layout { grid-template-columns: 1fr; }
    .subject-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .exit-confirm-dialog { padding: 22px; }
    .exit-confirm-actions { flex-direction: column-reverse; }
    .exit-confirm-actions .button { width: 100%; }
}

@media (max-width: 480px) {
    .subject-filters { grid-template-columns: 1fr; }
    .profile-menu { right: -3px; }
    .game-header { padding: 12px; }
    .game-panel,
    .difficulty-screen,
    .result-screen { padding: 20px 16px; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

.home-subject-card .subject-card-icon svg {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.home-subject-card.accent-violet .subject-card-icon { color: #8251d6; }
.home-subject-card.accent-blue .subject-card-icon { color: #3e78c2; }
.home-subject-card.accent-mint .subject-card-icon { color: #3d9572; }
.home-subject-card.accent-orange .subject-card-icon { color: #c97737; }
.home-subject-card.accent-green .subject-card-icon { color: #4a8f58; }
.home-subject-card.accent-cyan .subject-card-icon { color: #38859a; }

:root[data-theme="dark"] .home-subject-card .subject-card-icon svg {
    stroke: currentColor;
}

/* Dashboard inspired by the new classroom dashboard reference. */
.app-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    min-height: 100dvh;
}

.site-header {
    position: fixed;
    inset: 16px auto 16px 16px;
    z-index: 42;
    display: flex;
    width: 188px;
    height: auto;
    margin: 0;
    padding: 22px 12px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 25px;
    border-radius: 27px;
    background: rgba(255, 255, 255, .82);
}

.brand {
    min-height: 112px;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    font-size: 16px;
    letter-spacing: -.5px;
}

.brand-logo {
    width: 76px;
    height: 76px;
}

.main-nav {
    display: flex;
    height: auto;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.main-nav .nav-action {
    display: flex;
    width: 100%;
    min-height: 42px;
    height: auto;
    align-items: center;
    justify-content: flex-start;
    gap: 11px;
    padding: 0 12px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: #635c75;
    font: inherit;
    font-size: 12px;
    font-weight: 750;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    transition: color .18s ease, background .18s ease, transform .18s ease;
}

.main-nav .nav-action > span {
    display: grid;
    width: 20px;
    flex: 0 0 20px;
    place-items: center;
    color: var(--purple);
    font-size: 17px;
    line-height: 1;
}

.main-nav .nav-action:hover,
.main-nav .nav-action.active {
    background: linear-gradient(110deg, #6e35ed, #9362f7);
    box-shadow: 0 8px 18px rgba(105, 61, 221, .19);
    color: #fff;
    transform: translateX(2px);
}

.main-nav .nav-action:hover > span,
.main-nav .nav-action.active > span {
    color: #fff;
}

.sidebar-note {
    display: grid;
    gap: 7px;
    margin-top: auto;
    padding: 14px 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 19px;
    background:
        radial-gradient(circle at 100% 0, rgba(215, 91, 255, .47), transparent 44%),
        linear-gradient(155deg, #24106a, #5c22bc 75%, #a729d1);
    box-shadow: 0 12px 24px rgba(60, 26, 132, .2);
    color: #fff;
}

.sidebar-note > span {
    font-size: 22px;
}

.sidebar-note strong {
    font-size: 12px;
    line-height: 1.35;
}

.sidebar-note small {
    color: rgba(255, 255, 255, .78);
    font-size: 10px;
    line-height: 1.5;
}

.sidebar-note a {
    display: flex;
    min-height: 31px;
    align-items: center;
    justify-content: space-between;
    margin-top: 3px;
    padding: 0 10px;
    border-radius: 10px;
    background: #fff;
    color: #5927bd;
    font-size: 10px;
    font-weight: 800;
}

.header-actions {
    position: fixed;
    z-index: 45;
    top: 16px;
    right: clamp(20px, 4vw, 58px);
    gap: 8px;
    padding: 7px;
    border: 1px solid rgba(226, 219, 240, .9);
    border-radius: 22px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 8px 26px rgba(45, 32, 81, .07);
}

.header-energy,
.header-level {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    gap: 5px;
    padding: 0 11px;
    border: 1px solid #e8defc;
    border-radius: 18px;
    background: #f7f2ff;
    color: #30235b;
    font-size: 11px;
    font-weight: 850;
    white-space: nowrap;
}

.header-energy > span,
.header-level > span {
    color: #873ff2;
    font-size: 15px;
}

.header-energy small {
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
}

.header-level {
    border: 0;
    background: linear-gradient(110deg, #6731e9, #9648ef);
    color: #fff;
    cursor: pointer;
}

.header-level > span {
    color: #ffe274;
}

.header-actions .theme-toggle,
.header-actions .profile-button {
    width: 36px;
    height: 36px;
}

.header-actions .profile-button {
    position: relative;
    border: 2px solid #ede5fc;
    background: linear-gradient(140deg, #382183, #160b54);
    color: #fff;
}

.header-actions .profile-button > span {
    position: absolute;
    right: -9px;
    bottom: -3px;
    font-size: 11px;
}

.app-main {
    grid-column: 2;
    min-width: 0;
    padding: 22px clamp(20px, 3.2vw, 54px) 48px;
}

.page-container {
    width: 100%;
    max-width: 1460px;
}

.subjects-home.dashboard-home {
    gap: 20px;
}

.home-topline {
    display: flex;
    min-height: 34px;
    align-items: center;
    justify-content: space-between;
    padding-right: min(390px, 34vw);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.home-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
}

.home-breadcrumb > span {
    color: var(--purple);
    font-size: 16px;
}

.home-date {
    text-transform: capitalize;
}

.home-hero {
    position: relative;
    display: grid;
    min-height: 244px;
    grid-template-columns: minmax(260px, 1.1fr) minmax(190px, .92fr) minmax(205px, 235px);
    align-items: center;
    gap: 8px;
    padding: 26px clamp(20px, 3vw, 40px);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: 27px;
    background:
        radial-gradient(ellipse at 68% 115%, rgba(181, 111, 255, .34), transparent 44%),
        radial-gradient(ellipse at 100% 4%, rgba(255, 173, 219, .38), transparent 42%),
        linear-gradient(112deg, #fff 0%, #fbf8ff 48%, #f2e7ff 100%);
    box-shadow: 0 16px 34px rgba(91, 61, 155, .09);
}

.home-hero::before,
.home-hero::after {
    position: absolute;
    border: 1px solid rgba(132, 90, 233, .1);
    border-radius: 50%;
    content: "";
    pointer-events: none;
}

.home-hero::before {
    top: -176px;
    left: 44%;
    width: 430px;
    height: 430px;
}

.home-hero::after {
    right: 21%;
    bottom: -214px;
    width: 390px;
    height: 390px;
    background: rgba(255, 255, 255, .2);
}

.home-hero-copy {
    position: relative;
    z-index: 2;
    max-width: 510px;
}

.home-greeting {
    display: inline-flex;
    align-items: center;
    margin-bottom: 12px;
    padding: 6px 10px;
    border: 1px solid #e6dcff;
    border-radius: 20px;
    background: rgba(255, 255, 255, .72);
    color: #6332c8;
    font-size: 10px;
    font-weight: 850;
}

.home-hero h1 {
    margin: 0 0 10px;
    color: #1a1247;
    font-size: clamp(32px, 4vw, 48px);
    font-weight: 900;
    letter-spacing: -.055em;
    line-height: 1.05;
}

.home-hero h1 span {
    background: linear-gradient(100deg, #6228e8 12%, #a82fdd 75%, #eb419b);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.home-hero-copy > p {
    max-width: 41ch;
    margin: 0 0 17px;
    color: #615a7e;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
}

.home-hero-cta {
    min-height: 43px;
    padding: 0 18px;
    border-radius: 24px;
    box-shadow: 0 9px 18px rgba(99, 50, 222, .22);
    font-size: 12px;
}

.home-hero-art {
    position: relative;
    z-index: 1;
    display: grid;
    min-width: 0;
    height: 210px;
    place-items: center;
}

.home-hero-art img {
    position: relative;
    z-index: 1;
    width: min(100%, 220px);
    height: 205px;
    object-fit: contain;
    filter: drop-shadow(0 16px 16px rgba(91, 42, 196, .18));
    animation: hero-hover 4.5s ease-in-out infinite;
}

.hero-orbit {
    position: absolute;
    border: 1px solid rgba(121, 71, 231, .16);
    border-radius: 50%;
}

.hero-orbit-one {
    width: 185px;
    height: 185px;
}

.hero-orbit-two {
    width: 238px;
    height: 238px;
    border-style: dashed;
    opacity: .7;
}

.hero-spark {
    position: absolute;
    z-index: 2;
    color: #9c58f1;
    font-size: 22px;
    animation: spark-pulse 2.8s ease-in-out infinite;
}

.hero-spark-one { top: 23px; left: 13%; }
.hero-spark-two { top: 42px; right: 10%; color: #ed64ba; animation-delay: .6s; }
.hero-spark-three { right: 17%; bottom: 24px; color: #ffad53; animation-delay: 1.1s; }

.home-level-card {
    position: relative;
    z-index: 2;
    display: grid;
    min-height: 176px;
    grid-template-columns: 42px minmax(0, 1fr) 18px;
    align-content: center;
    align-items: center;
    gap: 9px 10px;
    padding: 17px;
    border: 1px solid rgba(229, 220, 247, .95);
    border-radius: 22px;
    background: rgba(255, 255, 255, .84);
    box-shadow: 0 12px 30px rgba(67, 45, 119, .1);
    text-align: left;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}

.home-level-card:hover {
    box-shadow: 0 17px 36px rgba(67, 45, 119, .16);
    transform: translateY(-3px);
}

.home-level-icon {
    display: grid;
    width: 42px;
    height: 42px;
    grid-row: span 2;
    place-items: center;
    border-radius: 15px;
    background: linear-gradient(140deg, #f1e7ff, #fff1fb);
    font-size: 22px;
}

.home-level-copy {
    display: grid;
    gap: 3px;
}

.home-level-copy strong,
.home-level-xp {
    color: #21164c;
    font-size: 16px;
    font-weight: 900;
}

.home-level-copy small {
    color: #756d8d;
    font-size: 9px;
    font-weight: 700;
}

.home-level-arrow {
    align-self: start;
    color: #9c68ee;
    font-size: 18px;
}

.home-level-progress,
.home-progress-track {
    display: block;
    height: 9px;
    grid-column: 1 / -1;
    overflow: hidden;
    border-radius: 20px;
    background: #ece5fa;
}

.home-level-progress i,
.home-progress-track i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #7029ed, #c15cf3);
}

.home-level-xp {
    grid-column: 1 / -1;
    font-size: 15px;
}

.home-level-streak {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid #eee9f5;
    color: #443766;
    font-size: 10px;
    font-weight: 800;
}

.home-level-streak > span:first-child { font-size: 15px; }
.home-level-streak > span:last-child { color: #8046e8; font-size: 15px; }

.home-subjects {
    scroll-margin-top: 24px;
}

.home-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 2px 0 12px;
}

.home-section-heading > div {
    display: flex;
    align-items: center;
    gap: 11px;
}

.home-heading-mark {
    width: 6px;
    height: 24px;
    border-radius: 9px;
    background: linear-gradient(#742cf0, #bd4bdd);
}

.home-section-heading h2 {
    margin: 0;
    color: #21164c;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: -.04em;
}

.home-section-heading > a {
    color: #6826dc;
    font-size: 11px;
    font-weight: 850;
}

.home-section-heading > a span { margin-left: 4px; }

.subjects-grid.home-subject-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 11px;
}

.home-subject-card {
    min-width: 0;
    min-height: 98px;
    grid-template-columns: 55px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    overflow: hidden;
    border-color: rgba(231, 224, 245, .95);
    border-radius: 19px;
    background: linear-gradient(112deg, rgba(255, 255, 255, .98), rgba(250, 247, 255, .93));
    box-shadow: 0 7px 18px rgba(56, 38, 103, .055);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.home-subject-card:hover:not(.is-disabled) {
    border-color: #cbb8fb;
    box-shadow: 0 12px 24px rgba(76, 48, 145, .12);
    transform: translateY(-3px);
}

.home-subject-card.is-disabled {
    opacity: .72;
    pointer-events: none;
}

.home-subject-card .subject-card-icon {
    z-index: 1;
    width: 53px;
    height: 53px;
    border-radius: 17px;
    box-shadow: 0 7px 14px rgba(55, 37, 91, .08);
    font-size: 22px;
}

.home-subject-card .subject-card-copy {
    z-index: 1;
    align-content: center;
    gap: 3px;
}

.home-subject-card .subject-card-copy strong {
    overflow: visible;
    color: #24194d;
    font-size: 13px;
    font-weight: 900;
    text-overflow: clip;
    white-space: normal;
}

.home-subject-card .subject-card-copy small {
    max-width: 34ch;
    color: #6f6689;
    font-size: 10px;
    line-height: 1.35;
}

.home-subject-count {
    margin-top: 2px;
    color: #76689a;
    font-size: 9px;
    font-weight: 800;
}

.home-subject-card .subject-card-corner {
    z-index: 2;
    top: auto;
    right: 10px;
    bottom: 10px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .86);
    color: #6e31df;
}

.home-subject-card .subject-card-corner-disabled {
    width: auto;
    height: 21px;
    padding: 0 7px;
    border-radius: 10px;
    color: #786b96;
}

.subject-card-art {
    position: absolute;
    right: 5px;
    bottom: -12px;
    color: currentColor;
    font-size: 76px;
    font-weight: 900;
    line-height: 1;
    opacity: .08;
    pointer-events: none;
    transform: rotate(-12deg);
}

.accent-violet { color: #c84692; background-color: #fff0f8; }
.accent-blue { color: #328dd8; background-color: #edf8ff; }
.accent-mint { color: #1aa568; background-color: #effcf4; }
.accent-orange { color: #d77819; background-color: #fff6ea; }
.accent-green { color: #179951; background-color: #effaf1; }
.accent-cyan { color: #188fa5; background-color: #eafcff; }

.home-subject-card.accent-violet { background: linear-gradient(110deg, #fff, #fff3fa); }
.home-subject-card.accent-blue { background: linear-gradient(110deg, #fff, #f1f8ff); }
.home-subject-card.accent-mint { background: linear-gradient(110deg, #fff, #f1fcf5); }
.home-subject-card.accent-orange { background: linear-gradient(110deg, #fff, #fff8f0); }
.home-subject-card.accent-green { background: linear-gradient(110deg, #fff, #f3fbf2); }
.home-subject-card.accent-cyan { background: linear-gradient(110deg, #fff, #f0fbff); }

.home-subject-card.accent-violet .subject-card-icon { background: #ffe0f0; }
.home-subject-card.accent-blue .subject-card-icon { background: #dcefff; }
.home-subject-card.accent-mint .subject-card-icon { background: #d9f6e2; }
.home-subject-card.accent-orange .subject-card-icon { background: #ffead0; }
.home-subject-card.accent-green .subject-card-icon { background: #dcf5df; }
.home-subject-card.accent-cyan .subject-card-icon { background: #d9f7fc; }

.home-insights {
    display: grid;
    grid-template-columns: 1.12fr 1.1fr .85fr;
    gap: 12px;
}

.home-progress-card,
.home-week-card,
.home-latest-card {
    display: flex;
    min-width: 0;
    min-height: 126px;
    align-items: center;
    gap: 15px;
    padding: 16px;
    border: 1px solid rgba(231, 224, 245, .95);
    border-radius: 20px;
    background: rgba(255, 255, 255, .91);
    box-shadow: 0 7px 20px rgba(56, 38, 103, .055);
}

.home-progress-card {
    position: relative;
    overflow: hidden;
    border-color: #271071;
    background:
        radial-gradient(circle at 90% 4%, rgba(170, 83, 255, .38), transparent 36%),
        linear-gradient(125deg, #18084b, #32108c 72%, #541293);
    color: #fff;
}

.home-progress-art {
    position: relative;
    display: flex;
    width: 40%;
    min-width: 100px;
    height: 86px;
    align-items: end;
    justify-content: center;
    gap: 7px;
}

.home-progress-art::before {
    position: absolute;
    right: 8%;
    bottom: 0;
    left: 8%;
    height: 13px;
    border: 2px solid #8a56ff;
    border-radius: 50%;
    background: rgba(123, 75, 255, .37);
    box-shadow: 0 5px 16px rgba(142, 70, 255, .42);
    content: "";
}

.home-progress-art > span {
    position: relative;
    z-index: 1;
    display: grid;
    width: 30px;
    height: 36px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .32);
    border-radius: 9px;
    background: linear-gradient(155deg, #a94cff, #5d36e8);
    box-shadow: 0 5px 14px rgba(4, 2, 35, .28);
    color: #fff;
    font-size: 21px;
    font-weight: 900;
    transform: rotate(-9deg);
}

.home-progress-art > span:nth-child(2) {
    height: 60px;
    background: linear-gradient(155deg, #ff68cc, #9232f6);
    transform: rotate(4deg);
}

.home-progress-art > span:nth-child(3) {
    height: 46px;
    background: linear-gradient(155deg, #46ccff, #5445ed);
    transform: rotate(10deg);
}

.home-progress-art > i {
    position: absolute;
    top: 2px;
    left: 8%;
    color: #38ceff;
}

.home-progress-copy {
    z-index: 1;
    display: grid;
    min-width: 0;
    flex: 1;
    gap: 4px;
}

.home-progress-label {
    margin: 0;
    color: #ddcbff;
    font-size: 11px;
    font-weight: 850;
}

.home-progress-copy > strong {
    font-size: 28px;
    letter-spacing: -.04em;
    line-height: 1;
}

.home-progress-copy > span {
    color: #ddd2ff;
    font-size: 9px;
}

.home-progress-track {
    height: 8px;
    margin-top: 3px;
    background: rgba(255, 255, 255, .16);
}

.home-week-card,
.home-latest-card {
    display: grid;
    align-content: center;
    gap: 13px;
}

.home-insight-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #291a55;
    font-size: 12px;
}

.home-insight-heading > span {
    color: #7230e6;
    font-size: 17px;
}

.home-week-days {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
}

.home-week-day {
    display: grid;
    justify-items: center;
    gap: 6px;
    color: #867d9e;
    font-size: 9px;
    font-weight: 800;
}

.home-week-day i {
    display: grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border: 1px solid #e5dcfa;
    border-radius: 50%;
    background: #f3edff;
    color: transparent;
    font-size: 11px;
    font-style: normal;
}

.home-week-day.is-active i {
    border-color: transparent;
    background: linear-gradient(140deg, #7433ed, #b047eb);
    box-shadow: 0 4px 8px rgba(111, 50, 224, .18);
    color: #fff;
}

.home-week-streak {
    display: grid;
    min-width: 51px;
    grid-template-columns: 22px auto;
    align-items: center;
    gap: 0 4px;
    margin-left: 5px;
    padding-left: 10px;
    border-left: 1px solid #e9e3f2;
}

.home-week-streak > span { grid-row: span 2; font-size: 19px; }
.home-week-streak strong { color: #21164c; font-size: 17px; }
.home-week-streak small { color: #746b89; font-size: 8px; white-space: nowrap; }

.home-latest-card {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 9px 11px;
}

.home-latest-card .home-insight-heading {
    grid-column: 1 / -1;
}

.home-latest-badge {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid #e5d7ff;
    border-radius: 14px;
    background: linear-gradient(140deg, #efe5ff, #f9e9ff);
    color: #8036e7;
    font-size: 20px;
}

.home-latest-card > div:last-child {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.home-latest-card > div:last-child strong {
    overflow: hidden;
    color: #302156;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-latest-card > div:last-child small {
    color: #786e91;
    font-size: 9px;
    line-height: 1.4;
}

.subject-page-header {
    position: relative;
    min-height: 176px;
    padding: 26px clamp(22px, 3vw, 38px);
    overflow: hidden;
    border: 1px solid #eee5fb;
    border-radius: 24px;
    background:
        radial-gradient(circle at 90% 20%, rgba(145, 84, 236, .12), transparent 25%),
        linear-gradient(110deg, #fff, #f4edff 95%);
    box-shadow: 0 10px 24px rgba(69, 45, 126, .06);
}

.subject-page-header::after {
    position: absolute;
    top: -26px;
    right: 4%;
    color: rgba(116, 72, 232, .11);
    content: "＋  ×  ÷  △";
    font-size: clamp(48px, 7vw, 92px);
    font-weight: 900;
    letter-spacing: .12em;
    pointer-events: none;
    transform: rotate(-9deg);
}

.subject-page-header > * {
    position: relative;
    z-index: 1;
}

.subject-page-header h1 {
    margin-bottom: 8px;
}

.subject-page-header > .subtitle {
    max-width: 65ch;
    font-size: 13px;
}

.subject-page-layout {
    grid-template-columns: 218px minmax(0, 1fr);
    gap: 16px;
}

.subject-filters {
    top: 20px;
}

.subject-filter-card {
    border-radius: 17px;
    box-shadow: 0 6px 18px rgba(56, 38, 103, .045);
}

.subject-exercise-card {
    min-height: 208px;
    border-radius: 19px;
    box-shadow: 0 7px 20px rgba(56, 38, 103, .055);
}

.subject-exercise-card h3 {
    padding-right: 22px;
}

.subject-exercise-card .card-action {
    min-height: 34px;
    border-radius: 18px;
    background: linear-gradient(110deg, #874cf1, #a260f3);
    color: #fff;
}

:root[data-theme="dark"] .site-header,
:root[data-theme="dark"] .header-actions {
    border-color: #3e3552;
    background: rgba(31, 25, 45, .92);
}

:root[data-theme="dark"] .main-nav .nav-action {
    color: #d3cbe4;
}

:root[data-theme="dark"] .main-nav .nav-action:hover,
:root[data-theme="dark"] .main-nav .nav-action.active {
    color: #fff;
}

:root[data-theme="dark"] .header-energy {
    border-color: #44365b;
    background: #2a203e;
    color: #f1eaff;
}

:root[data-theme="dark"] .header-level {
    background: linear-gradient(110deg, #6532da, #9746df);
}

:root[data-theme="dark"] .home-hero,
:root[data-theme="dark"] .home-level-card,
:root[data-theme="dark"] .home-subject-card,
:root[data-theme="dark"] .home-week-card,
:root[data-theme="dark"] .home-latest-card,
:root[data-theme="dark"] .subject-page-header {
    border-color: #403553;
    background-color: #241d33;
}

:root[data-theme="dark"] .home-hero {
    background:
        radial-gradient(ellipse at 68% 115%, rgba(128, 71, 206, .24), transparent 44%),
        radial-gradient(ellipse at 100% 4%, rgba(192, 66, 146, .15), transparent 42%),
        linear-gradient(112deg, #241d33, #29203d);
}

:root[data-theme="dark"] .home-greeting,
:root[data-theme="dark"] .home-level-card,
:root[data-theme="dark"] .home-week-card,
:root[data-theme="dark"] .home-latest-card,
:root[data-theme="dark"] .subject-page-header {
    color: var(--ink);
}

:root[data-theme="dark"] .home-hero h1,
:root[data-theme="dark"] .home-level-copy strong,
:root[data-theme="dark"] .home-level-xp,
:root[data-theme="dark"] .home-level-streak,
:root[data-theme="dark"] .home-section-heading h2,
:root[data-theme="dark"] .home-insight-heading,
:root[data-theme="dark"] .home-week-streak strong,
:root[data-theme="dark"] .home-latest-card > div:last-child strong,
:root[data-theme="dark"] .home-subject-card .subject-card-copy strong {
    color: var(--ink);
}

:root[data-theme="dark"] .home-hero-copy > p,
:root[data-theme="dark"] .home-level-copy small,
:root[data-theme="dark"] .home-level-streak,
:root[data-theme="dark"] .home-subject-card .subject-card-copy small,
:root[data-theme="dark"] .home-subject-count,
:root[data-theme="dark"] .home-week-day,
:root[data-theme="dark"] .home-week-streak small,
:root[data-theme="dark"] .home-latest-card > div:last-child small {
    color: #c0b5d4;
}

:root[data-theme="dark"] .home-subject-card.accent-violet { background: linear-gradient(110deg, #282035, #35233b); }
:root[data-theme="dark"] .home-subject-card.accent-blue { background: linear-gradient(110deg, #282035, #202f42); }
:root[data-theme="dark"] .home-subject-card.accent-mint { background: linear-gradient(110deg, #282035, #20382f); }
:root[data-theme="dark"] .home-subject-card.accent-orange { background: linear-gradient(110deg, #282035, #3c3028); }
:root[data-theme="dark"] .home-subject-card.accent-green { background: linear-gradient(110deg, #282035, #24372d); }
:root[data-theme="dark"] .home-subject-card.accent-cyan { background: linear-gradient(110deg, #282035, #20383d); }

@keyframes hero-hover {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes spark-pulse {
    0%, 100% { opacity: .55; transform: scale(.88) rotate(-8deg); }
    50% { opacity: 1; transform: scale(1.12) rotate(8deg); }
}

@media (max-width: 1100px) and (min-width: 901px) {
    .app-shell { grid-template-columns: 194px minmax(0, 1fr); }
    .site-header { width: 168px; left: 12px; }
    .app-main { padding-right: 22px; padding-left: 18px; }
    .home-hero { grid-template-columns: minmax(230px, 1fr) minmax(150px, .7fr) 195px; padding-right: 20px; padding-left: 24px; }
    .home-level-card { padding: 13px; }
    .subjects-grid.home-subject-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .home-insights { grid-template-columns: 1fr 1fr; }
    .home-latest-card { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
    .app-shell { display: block; }
    .site-header {
        position: sticky;
        inset: auto;
        z-index: 42;
        display: flex;
        width: calc(100% - 24px);
        height: 62px;
        margin: 8px 12px 0;
        padding: 0 12px;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        border-radius: 18px;
    }

    .brand {
        min-height: 0;
        flex-direction: row;
        justify-content: flex-start;
        gap: 7px;
        font-size: 15px;
    }

    .brand-logo { width: 38px; height: 38px; }
    .mobile-nav-toggle { display: flex; margin-left: auto; }
    .sidebar-note { display: none; }
    .header-actions {
        position: absolute;
        top: 7px;
        right: 56px;
        padding: 3px;
        border: 0;
        border-radius: 14px;
        background: transparent;
        box-shadow: none;
    }

    .header-actions .theme-toggle,
    .header-actions .profile-button { width: 36px; height: 36px; }
    .header-energy, .header-level { display: none; }
    .site-header .main-nav {
        position: absolute;
        top: calc(100% + 9px);
        right: 0;
        left: auto;
        display: none;
        width: min(300px, calc(100vw - 24px));
        height: auto;
        padding: 10px;
        border: 1px solid var(--line);
        border-radius: 17px;
        background: #fff;
        box-shadow: 0 18px 48px rgba(33, 25, 56, .18);
    }

    .site-header .main-nav.mobile-open { display: flex; }
    .site-header .main-nav .nav-action { min-height: 42px; padding: 0 12px; }
    .app-main { padding: 21px 18px 46px; }
    .home-topline { padding-right: 0; }
}

@media (max-width: 760px) {
    .home-hero {
        min-height: 0;
        grid-template-columns: minmax(0, 1fr) minmax(130px, .58fr);
        padding: 25px 21px;
    }

    .home-hero-art { position: absolute; right: 30%; bottom: 8px; width: 170px; height: 170px; opacity: .27; }
    .home-hero-art img { height: 160px; }
    .home-level-card { grid-column: 1 / -1; min-height: 126px; }
    .home-insights { grid-template-columns: 1fr 1fr; }
    .home-latest-card { grid-column: 1 / -1; }
    .subject-page-layout { grid-template-columns: 1fr; }
    .subject-filters { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .subject-exercise-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .app-main { padding: 17px 13px 36px; }
    .home-date { display: none; }
    .home-hero { grid-template-columns: 1fr; padding: 23px 18px; }
    .home-hero-art { right: -18px; bottom: 70px; width: 146px; height: 146px; opacity: .2; }
    .home-hero-art img { height: 138px; }
    .home-hero h1 { max-width: 12ch; font-size: clamp(32px, 10vw, 42px); }
    .home-hero-copy > p { max-width: 35ch; font-size: 12px; }
    .home-level-card { grid-column: auto; }
    .subjects-grid.home-subject-grid { grid-template-columns: 1fr; gap: 9px; }
    .home-subject-card { min-height: 86px; }
    .home-insights { grid-template-columns: 1fr; }
    .home-latest-card { grid-column: auto; }
    .home-week-card { min-height: 108px; }
    .home-section-heading h2 { font-size: 18px; }
    .subject-filters { grid-template-columns: 1fr; }
    .subject-exercise-grid { grid-template-columns: 1fr; }
    .subject-page-header { min-height: 0; padding: 22px 19px; }
    .subject-page-header::after { right: -8%; opacity: .6; }
    .subject-page-header h1 { font-size: 32px; }
}

@media (max-width: 380px) {
    .header-actions { right: 48px; }
    .header-actions .theme-toggle,
    .header-actions .profile-button { width: 32px; height: 32px; }
    .mobile-nav-toggle { width: 32px; height: 32px; }
    .brand-wordmark { font-size: 13px; }
    .home-progress-card { gap: 9px; padding: 13px; }
    .home-progress-art { min-width: 75px; }
}

@media (prefers-reduced-motion: reduce) {
    .home-hero-art img,
    .hero-spark { animation: none; }
}

:root {
    --font-sans: "Manrope", "Segoe UI Variable", "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

html,
body,
button,
input,
select,
textarea,
.button {
    font-family: var(--font-sans);
}

.app-shell {
    grid-template-columns: 264px minmax(0, 1fr);
}

.site-header {
    inset: 16px auto 16px 16px;
    width: 232px;
    max-height: calc(100dvh - 32px);
    gap: 16px;
    overflow: hidden;
    border: 1px solid #e8e4ef;
    border-radius: 24px;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 12px 36px rgba(37, 29, 59, .08);
}

.brand {
    min-height: 94px;
    gap: 4px;
}

.brand-logo {
    width: 66px;
    height: 66px;
}

.main-nav {
    min-height: 0;
    flex: 1 1 auto;
    gap: 5px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #d3cbe2 transparent;
}

.nav-section-label {
    margin: 4px 0 2px;
    padding: 5px 11px 2px;
    color: #8b8499;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .12em;
}

.nav-section-secondary {
    margin-top: 12px;
    border-top: 1px solid #eeeaf4;
    padding-top: 15px;
}

.main-nav .nav-action {
    min-height: 43px;
    justify-content: flex-start;
    gap: 12px;
    padding: 0 11px;
    border-radius: 12px;
    color: #5d586b;
    font-family: inherit;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.25;
    text-align: left;
    white-space: normal;
    transform: none;
}

.main-nav .nav-action > .nav-icon {
    display: block;
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    color: #777084;
    overflow: visible;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.main-nav .nav-action > span:not(.nav-icon) {
    display: block;
    width: auto;
    flex: 1 1 auto;
    color: inherit;
    font-size: inherit;
    line-height: inherit;
}

.main-nav .nav-action:hover,
.main-nav .nav-action.active {
    background: #f0edff;
    box-shadow: none;
    color: #5636c5;
    transform: none;
}

.main-nav .nav-action:hover > .nav-icon,
.main-nav .nav-action.active > .nav-icon {
    color: #6949da;
}

.sidebar-account {
    display: grid;
    gap: 7px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #eeeaf4;
}

.sidebar-account-link[class*="avatar-"] {
    display: flex;
    min-width: 0;
    min-height: 48px;
    align-items: center;
    gap: 9px;
    padding: 5px 6px;
    border-radius: 12px;
    color: var(--ink);
    text-decoration: none;
}

.sidebar-account-link:hover,
.sidebar-account-link.active {
    background: #f5f2fb;
    color: var(--ink);
}

.sidebar-account-link > .custom-avatar-image,
.sidebar-avatar-symbol {
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    place-items: center;
    overflow: hidden;
    border: 1px solid #e7e1f1;
    border-radius: 12px;
    background: #f0eaff;
    font-size: 20px;
    object-fit: cover;
}

.sidebar-account-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.sidebar-account-copy strong {
    overflow: hidden;
    font-size: 11px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-account-copy small,
.sidebar-account-coins small {
    color: #7d7789;
    font-size: 9px;
    font-weight: 600;
}

.sidebar-account-coins {
    margin-left: auto;
    color: #665c7d;
    font-size: 10px;
    font-weight: 750;
    white-space: nowrap;
}

.sidebar-tool-button {
    display: flex;
    width: 100%;
    min-height: 39px;
    align-items: center;
    gap: 11px;
    padding: 0 10px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: #5d586b;
    font-size: 11px;
    font-weight: 650;
    text-align: left;
    cursor: pointer;
    transition: background .16s ease, color .16s ease;
}

.sidebar-tool-button:hover {
    background: #f0edff;
    color: #5636c5;
}

.sidebar-tool-button .nav-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-logout {
    color: #756d7c;
}

.sidebar-note {
    gap: 8px;
    margin-top: 2px;
    padding: 13px;
    border-radius: 16px;
    background: linear-gradient(145deg, #332275, #6243bd);
    box-shadow: 0 8px 18px rgba(60, 42, 119, .13);
}

.sidebar-note-mark {
    color: #d8ccff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .12em;
}

.sidebar-note strong {
    font-size: 11px;
}

.sidebar-note a {
    min-height: 34px;
    margin-top: 2px;
    font-size: 10px;
}

.mobile-nav-toggle {
    display: none;
}

.mobile-nav-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.app-main {
    padding-top: 32px;
}

.subjects-home.dashboard-home {
    gap: 22px;
}

.home-topline {
    display: none;
}

.home-hero {
    min-height: 252px;
    border: 1px solid #e9e5f1;
    border-radius: 26px;
    background:
        radial-gradient(ellipse at 86% 30%, rgba(196, 174, 255, .28), transparent 38%),
        linear-gradient(112deg, #fff 0%, #fbfaff 60%, #f7f3ff 100%);
    box-shadow: 0 12px 32px rgba(47, 35, 83, .055);
}

.home-greeting {
    border: 0;
    background: transparent;
    color: #766a9a;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .14em;
}

.home-hero h1 {
    font-size: clamp(36px, 4vw, 52px);
    letter-spacing: -.045em;
}

.home-hero-copy > p {
    color: #696477;
    font-size: 14px;
    font-weight: 450;
    line-height: 1.7;
}

.home-hero-art img {
    animation: none;
}

.hero-spark {
    display: none;
}

.home-hero-cta {
    min-height: 46px;
    padding: 0 18px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}

.home-subject-card,
.home-level-card,
.home-progress-card,
.home-week-card,
.home-latest-card {
    border-radius: 18px;
    box-shadow: 0 6px 20px rgba(47, 35, 83, .045);
}

.home-subject-card {
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.home-subject-card:hover:not(.is-disabled) {
    box-shadow: 0 12px 28px rgba(47, 35, 83, .1);
    transform: translateY(-2px);
}

.home-section-heading h2 {
    font-size: 20px;
    font-weight: 750;
    letter-spacing: -.025em;
}

.home-insight-heading {
    font-size: 12px;
    font-weight: 700;
}

:root[data-theme="dark"] .site-header {
    border-color: #3b344a;
    background: rgba(30, 25, 42, .98);
    box-shadow: 0 12px 36px rgba(0, 0, 0, .2);
}

:root[data-theme="dark"] .nav-section-label {
    color: #a59bb8;
}

:root[data-theme="dark"] .nav-section-secondary,
:root[data-theme="dark"] .sidebar-account {
    border-color: #3b344a;
}

:root[data-theme="dark"] .main-nav .nav-action {
    color: #d0c9db;
}

:root[data-theme="dark"] .main-nav .nav-action > .nav-icon {
    color: #aaa0bd;
}

:root[data-theme="dark"] .main-nav .nav-action:hover,
:root[data-theme="dark"] .main-nav .nav-action.active {
    background: #342b4c;
    color: #e2d9ff;
}

:root[data-theme="dark"] .main-nav .nav-action:hover > .nav-icon,
:root[data-theme="dark"] .main-nav .nav-action.active > .nav-icon {
    color: #cbbaff;
}

:root[data-theme="dark"] .sidebar-account-link[class*="avatar-"],
:root[data-theme="dark"] .sidebar-account-link[class*="avatar-"]:hover,
:root[data-theme="dark"] .sidebar-account-link[class*="avatar-"].active {
    color: #f1edf8;
}

:root[data-theme="dark"] .sidebar-account-link:hover,
:root[data-theme="dark"] .sidebar-account-link.active,
:root[data-theme="dark"] .sidebar-tool-button:hover {
    background: #342b4c;
}

:root[data-theme="dark"] .sidebar-account-link > .custom-avatar-image,
:root[data-theme="dark"] .sidebar-avatar-symbol {
    border-color: #49405b;
    background: #342b4c;
}

:root[data-theme="dark"] .sidebar-account-copy small,
:root[data-theme="dark"] .sidebar-account-coins,
:root[data-theme="dark"] .sidebar-account-coins small,
:root[data-theme="dark"] .sidebar-tool-button {
    color: #bdb4cd;
}

:root[data-theme="dark"] .sidebar-tool-button:hover {
    color: #e2d9ff;
}

:root[data-theme="dark"] .sidebar-logout {
    color: #d2aeb8;
}

:root[data-theme="dark"] .home-greeting {
    color: #c2b5e3;
}

:root[data-theme="dark"] .home-hero-copy > p {
    color: #c8c0d5;
}

@media (max-width: 1100px) and (min-width: 901px) {
    .app-shell { grid-template-columns: 224px minmax(0, 1fr); }
    .site-header { left: 12px; width: 198px; }
    .app-main { padding-right: 22px; padding-left: 18px; }
    .home-hero { grid-template-columns: minmax(210px, 1fr) minmax(140px, .7fr) 185px; }
}

@media (max-width: 900px) {
    .app-shell { display: block; }

    .site-header {
        position: sticky;
        inset: auto;
        display: flex;
        width: calc(100% - 24px);
        height: 64px;
        max-height: none;
        margin: 8px 12px 0;
        padding: 0 13px;
        flex-direction: row;
        align-items: center;
        gap: 10px;
        overflow: visible;
        border-radius: 17px;
    }

    .brand {
        min-height: 0;
        flex-direction: row;
        justify-content: flex-start;
        gap: 7px;
        font-size: 15px;
    }

    .brand-logo { width: 38px; height: 38px; }

    .mobile-nav-toggle {
        display: grid;
        width: 40px;
        height: 40px;
        flex: 0 0 40px;
        margin-left: auto;
        place-items: center;
        border: 1px solid #e8e4ef;
        border-radius: 12px;
        background: #fff;
        color: #50466a;
        cursor: pointer;
    }

    .site-header .main-nav {
        position: absolute;
        top: calc(100% + 9px);
        right: 0;
        left: auto;
        display: none;
        width: min(360px, calc(100vw - 24px));
        max-height: calc(100dvh - 94px);
        padding: 12px;
        flex: initial;
        gap: 4px;
        overflow-y: auto;
        border: 1px solid #e7e2ef;
        border-radius: 18px;
        background: #fff;
        box-shadow: 0 20px 50px rgba(33, 25, 56, .17);
    }

    .site-header .main-nav.mobile-open { display: flex; }

    .main-nav .nav-action {
        min-height: 44px !important;
        height: auto !important;
        padding: 0 11px;
        font-size: 13px !important;
    }

    .sidebar-account { margin-top: 12px; }
    .sidebar-note { display: grid; }
    .app-main { padding: 24px 18px 46px; }
}

@media (max-width: 760px) {
    .home-hero {
        grid-template-columns: minmax(0, 1fr) minmax(110px, .5fr);
        padding: 25px 21px;
    }

    .home-level-card { grid-column: 1 / -1; }
    .subject-page-layout { grid-template-columns: 1fr; }
    .subject-filters { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .subject-exercise-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .app-main { padding: 19px 13px 36px; }
    .home-hero { grid-template-columns: 1fr; padding: 24px 19px; }
    .home-hero-art { right: -8px; bottom: 76px; width: 125px; height: 125px; opacity: .16; }
    .home-hero-art img { height: 120px; }
    .home-hero h1 { max-width: 13ch; font-size: clamp(34px, 10vw, 44px); }
    .home-level-card { grid-column: auto; }
    .home-insights,
    .subjects-grid.home-subject-grid,
    .subject-filters,
    .subject-exercise-grid { grid-template-columns: 1fr; }
    .home-latest-card { grid-column: auto; }
}

@media (max-width: 380px) {
    .brand-wordmark { font-size: 13px; }
    .mobile-nav-toggle { width: 36px; height: 36px; flex-basis: 36px; }
}

@media (max-width: 340px) {
    html,
    body { min-width: 0; }

    .site-header .main-nav {
        right: 0;
        width: min(360px, calc(100vw - 40px));
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

.profile-menu {
    position: fixed;
    top: 78px;
    right: clamp(20px, 4vw, 58px);
}

@media (max-width: 900px) {
    .profile-menu { right: 12px; }
}

.site-header .main-nav {
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.sidebar-account-link[class*="avatar-"] {
    min-height: 56px;
    padding: 7px;
    border: 1px solid rgba(112, 72, 232, .13);
    background: linear-gradient(120deg, rgba(246, 242, 255, .92), rgba(255, 255, 255, .96));
    box-shadow: 0 5px 16px rgba(58, 39, 114, .055);
}

.sidebar-account-link:hover,
.sidebar-account-link.active {
    border-color: rgba(112, 72, 232, .3);
    background: linear-gradient(120deg, #f1ebff, #fff);
}

.sidebar-account-copy strong { font-size: 11px; }
.sidebar-account-copy small { color: #675f78; font-size: 10px; }
.sidebar-account-coins { color: #4d3b88; font-size: 11px; }
.sidebar-account-coins small { color: #6b6380; font-size: 9px; }

:root[data-theme="dark"] .sidebar-account-link,
:root[data-theme="dark"] .sidebar-account-link:hover,
:root[data-theme="dark"] .sidebar-account-link.active {
    border-color: #49405f;
    background: linear-gradient(120deg, #302744, #272236);
    color: #f5f0ff;
}

:root[data-theme="dark"] .sidebar-account-copy small,
:root[data-theme="dark"] .sidebar-account-coins,
:root[data-theme="dark"] .sidebar-account-coins small {
    color: #c8bce6;
}

.home-level-card {
    isolation: isolate;
    border-color: color-mix(in srgb, var(--level-glow, #8b6cf0) 28%, white);
    background:
        radial-gradient(ellipse at 10% 12%, color-mix(in srgb, var(--level-glow, #8b6cf0) 15%, transparent), transparent 60%),
        rgba(255, 255, 255, .92);
    box-shadow: 0 12px 30px color-mix(in srgb, var(--level-glow, #8b6cf0) 16%, transparent);
}

.home-level-card::after {
    position: absolute;
    z-index: -1;
    inset: -1px;
    border: 1px solid color-mix(in srgb, var(--level-glow, #8b6cf0) 27%, transparent);
    border-radius: inherit;
    content: "";
    pointer-events: none;
}

.home-level-card:hover {
    box-shadow: 0 16px 38px color-mix(in srgb, var(--level-glow, #8b6cf0) 24%, transparent);
}

.home-level-icon {
    border: 1px solid color-mix(in srgb, var(--level-glow, #8b6cf0) 28%, white);
    box-shadow: 0 0 22px color-mix(in srgb, var(--level-glow, #8b6cf0) 20%, transparent);
}

.level-color-mint { --level-glow: #38b99a; }
.level-color-blue { --level-glow: #538de9; }
.level-color-violet { --level-glow: #8965ed; }
.level-color-gold { --level-glow: #dfa92f; }
.level-color-orange { --level-glow: #ed8250; }
.level-color-plum { --level-glow: #a64ad4; }
.level-color-pink { --level-glow: #df65a6; }
.level-color-cyan { --level-glow: #37aec2; }
.level-color-rainbow { --level-glow: #ac65da; }

.level-row.current {
    border-color: color-mix(in srgb, var(--level-glow, #8965ed) 40%, white);
    background: linear-gradient(110deg, color-mix(in srgb, var(--level-glow, #8965ed) 13%, white), #fff);
    box-shadow: 0 5px 16px color-mix(in srgb, var(--level-glow, #8965ed) 15%, transparent);
}

.level-row.current .level-badge {
    filter: drop-shadow(0 0 7px color-mix(in srgb, var(--level-glow, #8965ed) 55%, transparent));
}

:root[data-theme="dark"] .home-level-card {
    border-color: color-mix(in srgb, var(--level-glow, #a38aff) 38%, #39334a);
    background:
        radial-gradient(ellipse at 10% 12%, color-mix(in srgb, var(--level-glow, #a38aff) 20%, transparent), transparent 62%),
        linear-gradient(145deg, #282338, #211d30);
    box-shadow: 0 12px 30px color-mix(in srgb, var(--level-glow, #a38aff) 16%, transparent);
}

:root[data-theme="dark"] .home-level-card::after {
    border-color: color-mix(in srgb, var(--level-glow, #a38aff) 42%, transparent);
}

:root[data-theme="dark"] .level-row.current {
    border-color: color-mix(in srgb, var(--level-glow, #a38aff) 46%, #423951);
    background: linear-gradient(110deg, color-mix(in srgb, var(--level-glow, #a38aff) 20%, #282338), #282338);
}

.subject-page-layout {
    align-items: start;
}

.subject-filters {
    align-self: start;
    max-height: calc(100dvh - 112px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.subject-exercises {
    min-width: 0;
}

.subject-exercise-card {
    display: flex;
    min-height: 100%;
    flex-direction: column;
}

.subject-exercise-card .game-meta {
    margin-top: auto;
    padding-top: 12px;
}

.subject-exercise-card .card-action {
    margin-top: 14px;
}

.achievement-page {
    max-width: 1120px;
    margin: 0 auto;
    gap: 25px;
}

.achievement-page-header {
    position: relative;
    display: flex;
    min-height: 184px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    overflow: hidden;
    padding: 30px clamp(22px, 4vw, 42px);
    border: 1px solid #e7e0f3;
    border-radius: 26px;
    background:
        radial-gradient(ellipse at 84% 20%, rgba(183, 162, 255, .31), transparent 36%),
        linear-gradient(115deg, #fff, #f8f5ff);
    box-shadow: 0 12px 34px rgba(47, 35, 83, .06);
}

.achievement-page-header h1 {
    margin: 3px 0 7px;
    font-size: clamp(30px, 4vw, 42px);
    letter-spacing: -.045em;
}

.achievement-page-header .subtitle {
    max-width: 58ch;
    margin: 0;
    font-size: 13px;
}

.achievement-header-art {
    position: relative;
    display: grid;
    width: 124px;
    height: 124px;
    flex: 0 0 124px;
    place-items: center;
    border: 1px solid rgba(142, 113, 218, .2);
    border-radius: 38px;
    background: linear-gradient(145deg, rgba(255, 255, 255, .9), rgba(235, 226, 255, .78));
    box-shadow: 0 16px 34px rgba(95, 69, 160, .13), inset 0 1px 0 #fff;
    transform: rotate(4deg);
}

.achievement-header-art strong { font-size: 54px; filter: drop-shadow(0 8px 9px rgba(117, 76, 182, .23)); }
.achievement-header-art span,
.achievement-header-art i { position: absolute; color: #8d68e8; font-size: 22px; font-style: normal; }
.achievement-header-art span { top: 14px; left: 18px; }
.achievement-header-art i { right: 13px; bottom: 13px; color: #e6a848; }

.achievement-overview {
    display: grid;
    grid-template-columns: 1.25fr 1fr 1fr;
    gap: 13px;
}

.achievement-overview-card {
    position: relative;
    display: grid;
    min-height: 126px;
    grid-template-columns: 44px minmax(0, 1fr);
    align-content: center;
    align-items: center;
    gap: 4px 12px;
    padding: 17px;
    border: 1px solid #e7e2ef;
    border-radius: 20px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 8px 24px rgba(47, 35, 83, .045);
}

.achievement-overview-primary {
    background: linear-gradient(130deg, #fff, #f5f1ff);
}

.achievement-overview-icon {
    display: grid;
    width: 44px;
    height: 44px;
    grid-row: span 2;
    place-items: center;
    border-radius: 15px;
    background: #eee8ff;
    font-size: 23px;
}

.achievement-overview-icon.streak-icon { background: #fff0e4; }
.achievement-overview-icon.xp-icon { background: #e7f5ff; }
.achievement-overview-card > div:nth-child(2) { min-width: 0; }
.achievement-overview-card > div:nth-child(2) > small { color: #7d748d; font-size: 9px; font-weight: 850; letter-spacing: .1em; }
.achievement-overview-card strong { display: block; margin-top: 2px; font-size: 23px; letter-spacing: -.04em; }
.achievement-overview-card strong span { color: #8a8397; font-size: 13px; font-weight: 650; }
.achievement-overview-note { grid-column: 2; color: #827a90; font-size: 10px; }

.achievement-overview-meter {
    grid-column: 2;
    height: 6px;
    margin-top: 3px;
    overflow: hidden;
    border-radius: 999px;
    background: #e6dff4;
}

.achievement-overview-meter i,
.achievement-tile-progress i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #8a67ec, #c084fc);
    transition: width .45s ease;
}

.achievement-collection {
    padding: 23px;
    border: 1px solid #e8e3f0;
    border-radius: 24px;
    background: rgba(255, 255, 255, .76);
}

.achievement-collection-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 17px;
}

.achievement-collection-heading .eyebrow { margin-bottom: 4px; }
.achievement-collection-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.achievement-collection-heading > span { color: #786f89; font-size: 11px; font-weight: 700; }

.achievement-tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
}

.achievement-tile {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    gap: 13px;
    padding: 15px;
    border: 1px solid #e8e4ed;
    border-radius: 17px;
    background: #fff;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.achievement-tile.is-earned {
    border-color: #ddd2ff;
    background: linear-gradient(135deg, #fff, #faf8ff);
    box-shadow: 0 5px 16px rgba(112, 72, 232, .07);
}

.achievement-tile.is-earned:hover { transform: translateY(-2px); box-shadow: 0 11px 22px rgba(112, 72, 232, .11); }
.achievement-tile.is-locked .achievement-tile-icon { filter: grayscale(.85); opacity: .7; }

.achievement-tile-icon {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    place-items: center;
    border: 1px solid #eee8f8;
    border-radius: 14px;
    background: linear-gradient(145deg, #f5f1ff, #fff);
    font-size: 23px;
}

.achievement-tile-copy { min-width: 0; flex: 1; }
.achievement-tile-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.achievement-tile-title h3 { margin: 2px 0 0; font-size: 12px; font-weight: 800; }
.achievement-tile-title > span { flex: 0 0 auto; padding: 4px 6px; border-radius: 999px; background: #f0edf4; color: #777082; font-size: 7px; font-weight: 850; letter-spacing: .04em; }
.achievement-tile.is-earned .achievement-tile-title > span { background: #ece5ff; color: #6344bf; }
.achievement-tile-copy p { min-height: 30px; margin: 5px 0 9px; color: #777184; font-size: 10px; line-height: 1.45; }
.achievement-tile-progress { height: 5px; overflow: hidden; border-radius: 999px; background: #ece9f1; }
.achievement-tile.is-earned .achievement-tile-progress i { background: linear-gradient(90deg, #49bd9a, #7a67e9); }
.achievement-tile-count { display: block; margin-top: 5px; color: #817a8f; font-size: 9px; font-weight: 700; }

:root[data-theme="dark"] .achievement-page-header {
    border-color: #403650;
    background: radial-gradient(ellipse at 84% 20%, rgba(127, 95, 188, .23), transparent 36%), linear-gradient(115deg, #252033, #211c2c);
}

:root[data-theme="dark"] .achievement-header-art {
    border-color: #4a3d62;
    background: linear-gradient(145deg, #38304b, #292338);
    box-shadow: 0 16px 34px rgba(0, 0, 0, .2), inset 0 1px 0 rgba(255, 255, 255, .08);
}

:root[data-theme="dark"] .achievement-overview-card,
:root[data-theme="dark"] .achievement-collection,
:root[data-theme="dark"] .achievement-tile {
    border-color: #40384f;
    background: rgba(37, 32, 49, .96);
}

:root[data-theme="dark"] .achievement-overview-primary,
:root[data-theme="dark"] .achievement-tile.is-earned {
    background: linear-gradient(130deg, #282338, #302741);
}

:root[data-theme="dark"] .achievement-overview-card > div:nth-child(2) > small,
:root[data-theme="dark"] .achievement-overview-note,
:root[data-theme="dark"] .achievement-collection-heading > span,
:root[data-theme="dark"] .achievement-tile-copy p,
:root[data-theme="dark"] .achievement-tile-count {
    color: #b7aec8;
}

:root[data-theme="dark"] .achievement-overview-card strong span { color: #b7aec8; }
:root[data-theme="dark"] .achievement-overview-icon { background: #3c3152; }
:root[data-theme="dark"] .achievement-overview-icon.streak-icon { background: #4a342c; }
:root[data-theme="dark"] .achievement-overview-icon.xp-icon { background: #283d50; }
:root[data-theme="dark"] .achievement-tile-icon { border-color: #4a405d; background: linear-gradient(145deg, #38304b, #2b253a); }
:root[data-theme="dark"] .achievement-tile-title > span { background: #383244; color: #c3bbd1; }
:root[data-theme="dark"] .achievement-tile.is-earned .achievement-tile-title > span { background: #40355c; color: #d3c4ff; }
:root[data-theme="dark"] .achievement-overview-meter,
:root[data-theme="dark"] .achievement-tile-progress { background: #41394e; }

.loading-logo {
    animation: nsm-float 3.2s cubic-bezier(.45, 0, .55, 1) infinite;
    backface-visibility: hidden;
    transform: translate3d(0, 0, 0);
    will-change: transform;
}

@keyframes nsm-float {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(0, -5px, 0); }
}

@media (max-width: 760px) {
    .achievement-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .achievement-overview-primary { grid-column: 1 / -1; }
    .achievement-tiles { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .subject-filters { max-height: none; overflow: visible; }
    .achievement-page-header { min-height: 0; padding: 23px 20px; }
    .achievement-header-art { width: 78px; height: 78px; flex-basis: 78px; border-radius: 25px; }
    .achievement-header-art strong { font-size: 36px; }
    .achievement-header-art span,
    .achievement-header-art i { font-size: 15px; }
    .achievement-overview { grid-template-columns: 1fr; }
    .achievement-overview-primary { grid-column: auto; }
    .achievement-collection { padding: 17px 13px; }
    .achievement-collection-heading { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    .loading-logo { will-change: auto; }
    .achievement-tile,
    .achievement-overview-meter i,
    .achievement-tile-progress i { transition: none; }
}

body,
button,
input,
select,
textarea,
.button {
    font-family: var(--font-sans);
}

.seo-prerender {
    width: min(940px, calc(100% - 32px));
    max-width: none;
    margin: clamp(20px, 6vh, 58px) auto;
    padding: clamp(22px, 5vw, 52px);
    overflow: hidden;
    border: 1px solid rgba(220, 212, 238, .88);
    border-radius: 28px;
    background:
        radial-gradient(ellipse at 92% 3%, rgba(181, 157, 250, .19), transparent 30rem),
        linear-gradient(145deg, #fff, #fcfaff);
    box-shadow: 0 24px 70px rgba(48, 34, 91, .1);
}

.seo-prerender > nav:first-child {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: clamp(28px, 6vh, 52px);
    color: #777087;
    font-size: 12px;
    font-weight: 700;
}

.seo-brand {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #302748;
    font-size: 13px;
    font-weight: 850;
    letter-spacing: -.03em;
}

.seo-brand img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.seo-brand > span { color: #7653dc; }
.seo-breadcrumb { color: #b6aec7; }

.seo-prerender header {
    margin-bottom: 32px;
}

.seo-prerender .eyebrow {
    margin-bottom: 12px;
    color: #7553d5;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .16em;
}

.seo-prerender h1 {
    max-width: 20ch;
    margin-bottom: 10px;
    color: #241b3a;
    font-size: clamp(36px, 6vw, 56px);
    font-weight: 800;
    letter-spacing: -.06em;
    line-height: 1.08;
}

.seo-prerender header .subtitle {
    max-width: 66ch;
    color: #716a82;
    font-size: 15px;
    line-height: 1.75;
}

.seo-prerender section {
    padding: 21px 0;
    border-top: 1px solid #eae5f1;
}

.seo-prerender section h2 {
    margin-bottom: 7px;
    color: #302748;
    font-size: 19px;
    font-weight: 750;
    letter-spacing: -.035em;
}

.seo-prerender section p {
    max-width: 72ch;
    margin-bottom: 0;
    color: #746d85;
    font-size: 14px;
    line-height: 1.8;
}

.seo-related {
    gap: 9px;
    margin-top: 20px;
}

.seo-related a,
.seo-cta a {
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid #e5dcf5;
    border-radius: 13px;
    background: #f8f5ff;
    color: #6243c6;
    font-size: 12px;
    font-weight: 800;
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.seo-related a:hover,
.seo-cta a:hover {
    transform: translateY(-1px);
    border-color: #cbb9f5;
    background: #f1ebff;
}

.seo-related a span,
.seo-cta a span { margin-left: 5px; }

.seo-cta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    margin: 20px 0 0;
    color: #777087;
    font-size: 12px;
}

.seo-cta a:first-of-type {
    border-color: transparent;
    background: linear-gradient(135deg, #7955ef, #603bd4);
    color: #fff;
    box-shadow: 0 7px 17px rgba(93, 60, 208, .2);
}

:root[data-theme="dark"] .seo-prerender {
    border-color: #403650;
    background:
        radial-gradient(ellipse at 92% 3%, rgba(128, 99, 190, .19), transparent 30rem),
        linear-gradient(145deg, #252033, #1d1928);
}

:root[data-theme="dark"] .seo-brand,
:root[data-theme="dark"] .seo-prerender h1,
:root[data-theme="dark"] .seo-prerender section h2 { color: #f2ecff; }

:root[data-theme="dark"] .seo-prerender > nav:first-child,
:root[data-theme="dark"] .seo-prerender header .subtitle,
:root[data-theme="dark"] .seo-prerender section p,
:root[data-theme="dark"] .seo-cta { color: #bcb3ce; }

:root[data-theme="dark"] .seo-prerender section { border-color: #40384f; }

:root[data-theme="dark"] .seo-related a,
:root[data-theme="dark"] .seo-cta a:not(:first-of-type) {
    border-color: #483d61;
    background: #2b253a;
    color: #d3c4ff;
}

:root[data-theme="dark"] .seo-related a:hover,
:root[data-theme="dark"] .seo-cta a:not(:first-of-type):hover {
    border-color: #65518a;
    background: #352b49;
}

.main-nav {
    padding-right: 10px;
    scrollbar-width: none;
}

.main-nav::-webkit-scrollbar { display: none; }

.sidebar-account-link[class*="avatar-"] {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 3px 9px;
    min-height: 62px;
    padding: 8px;
    border-color: rgba(120, 84, 224, .34);
    background:
        radial-gradient(ellipse at 0% 50%, rgba(255, 255, 255, .26), transparent 55%),
        linear-gradient(115deg, #6347bc, #7957c6) !important;
    box-shadow: 0 8px 20px rgba(98, 68, 183, .2), inset 0 1px 0 rgba(255, 255, 255, .25);
    color: #fff !important;
}

.sidebar-account-link[class*="avatar-"]:hover,
.sidebar-account-link[class*="avatar-"].active {
    border-color: #8768e8;
    background:
        radial-gradient(ellipse at 0% 50%, rgba(255, 255, 255, .32), transparent 55%),
        linear-gradient(115deg, #583ba9, #704fc0) !important;
    color: #fff !important;
}

.sidebar-account-link > .custom-avatar-image,
.sidebar-avatar-symbol {
    grid-row: span 2;
    align-self: center;
    border-color: rgba(255, 255, 255, .5);
    background: rgba(255, 255, 255, .92);
}

.sidebar-account-copy { align-self: end; }
.sidebar-account-copy strong { color: #fff; font-size: 10px; }
.sidebar-account-copy small { color: rgba(255, 255, 255, .9); font-size: 9px; }
.sidebar-account-coins { grid-column: 2; justify-self: start; margin: 0; color: #fff; font-size: 9px; line-height: 1; }
.sidebar-account-coins small { display: inline; color: rgba(255, 255, 255, .9); }

:root[data-theme="dark"] .sidebar-account-link[class*="avatar-"],
:root[data-theme="dark"] .sidebar-account-link[class*="avatar-"]:hover,
:root[data-theme="dark"] .sidebar-account-link[class*="avatar-"].active {
    border-color: #886be4;
    background:
        radial-gradient(ellipse at 0% 50%, rgba(222, 207, 255, .22), transparent 55%),
        linear-gradient(115deg, #503691, #6849a7) !important;
    color: #fff !important;
}

:root[data-theme="dark"] .sidebar-account-link > .custom-avatar-image,
:root[data-theme="dark"] .sidebar-avatar-symbol {
    border-color: rgba(255, 255, 255, .24);
    background: #302742;
}

.home-level-card {
    min-width: 0;
    grid-template-columns: 46px minmax(0, 1fr) 18px;
    gap: 8px 11px;
    border: 1px solid color-mix(in srgb, var(--level-glow, #8b6cf0) 48%, white);
    background:
        radial-gradient(ellipse at 8% 12%, color-mix(in srgb, var(--level-glow, #8b6cf0) 23%, transparent), transparent 62%),
        linear-gradient(145deg, #fff, #faf8ff);
    box-shadow: 0 14px 32px color-mix(in srgb, var(--level-glow, #8b6cf0) 20%, transparent), inset 0 1px 0 rgba(255, 255, 255, .95);
}

.home-level-copy { min-width: 0; }
.home-level-copy strong { color: #2e2448; font-size: 14px; line-height: 1.25; }
.home-level-copy small { color: #665c78; font-size: 10px; line-height: 1.4; }
.home-level-xp { color: #4b357f; font-size: 12px; }
.home-level-streak { color: #685e7b; font-size: 10px; }

.home-level-icon {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: linear-gradient(145deg, color-mix(in srgb, var(--level-glow, #8b6cf0) 23%, white), #fff);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--level-glow, #8b6cf0) 30%, white), 0 0 22px color-mix(in srgb, var(--level-glow, #8b6cf0) 32%, transparent);
}

:root[data-theme="dark"] .home-level-card {
    border-color: color-mix(in srgb, var(--level-glow, #a38aff) 58%, #454052);
    background:
        radial-gradient(ellipse at 8% 12%, color-mix(in srgb, var(--level-glow, #a38aff) 30%, transparent), transparent 62%),
        linear-gradient(145deg, #302a40, #242031);
    box-shadow: 0 14px 34px color-mix(in srgb, var(--level-glow, #a38aff) 25%, transparent), inset 0 1px 0 rgba(255, 255, 255, .07);
}

:root[data-theme="dark"] .home-level-copy strong,
:root[data-theme="dark"] .home-level-xp { color: #f3edff; }

:root[data-theme="dark"] .home-level-copy small,
:root[data-theme="dark"] .home-level-streak { color: #d0c4e6; }

:root[data-theme="dark"] .home-level-progress,
:root[data-theme="dark"] .home-progress-track {
    background: #403751;
}

:root[data-theme="dark"] .brand-wordmark { color: #f0eaff; }

:root[data-theme="dark"] .home-level-icon {
    background: linear-gradient(145deg, color-mix(in srgb, var(--level-glow, #a38aff) 38%, #302a40), #282237);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--level-glow, #a38aff) 55%, #454052), 0 0 24px color-mix(in srgb, var(--level-glow, #a38aff) 42%, transparent);
}

.home-subject-card.is-disabled {
    opacity: 1;
    filter: saturate(.78);
}

.home-subject-card .subject-card-corner-disabled {
    z-index: 3;
    min-height: 24px;
    padding: 0 9px;
    border: 1px solid rgba(119, 89, 175, .24);
    border-radius: 999px;
    background: linear-gradient(135deg, #f3edff, #ebe4fb);
    box-shadow: 0 3px 10px rgba(30, 20, 50, .1);
    color: #5b4788;
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .07em;
}

:root[data-theme="dark"] .home-subject-card.is-disabled {
    filter: saturate(.88);
}

:root[data-theme="dark"] .home-subject-card .subject-card-corner-disabled {
    border-color: rgba(195, 164, 255, .32);
    background: linear-gradient(135deg, #493566, #362a50);
    box-shadow: 0 4px 13px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .09);
    color: #e2d3ff;
}

.subject-page-header {
    border: 1px solid #e8e2f1;
    border-radius: 24px;
    background:
        radial-gradient(ellipse at 90% 15%, rgba(173, 148, 245, .17), transparent 30rem),
        linear-gradient(140deg, #fff, #fbf9ff);
    box-shadow: 0 10px 28px rgba(48, 34, 91, .055);
}

.subject-page-header .eyebrow { color: #7251ce; }
.subject-page-header .subtitle { color: #706981; line-height: 1.75; }
.subject-filter-card { border-radius: 18px; }
.subject-filter-card h3 { font-size: 12px; font-weight: 800; letter-spacing: -.01em; }
.subject-exercise-card { min-width: 0; }
.subject-exercise-card h3 { color: #2e2644; font-size: 15px; }
.subject-exercise-card p { color: #706981; font-size: 12px; line-height: 1.65; }
.subject-exercise-card .card-action { justify-content: center; font-weight: 800; }

:root[data-theme="dark"] .subject-page-header {
    border-color: #403650;
    background:
        radial-gradient(ellipse at 90% 15%, rgba(126, 91, 190, .2), transparent 30rem),
        linear-gradient(140deg, #282338, #211c2c);
}

:root[data-theme="dark"] .subject-page-header .eyebrow { color: #c7b5ff; }
:root[data-theme="dark"] .subject-page-header .subtitle { color: #c3bad3; }
:root[data-theme="dark"] .subject-exercise-card h3 { color: #f0ebfb; }
:root[data-theme="dark"] .subject-exercise-card p { color: #beb5ce; }

:root[data-theme="dark"] .button-ghost,
:root[data-theme="dark"] .button-secondary,
:root[data-theme="dark"] .filter-chip,
:root[data-theme="dark"] .grade-tab,
:root[data-theme="dark"] .modal-close,
:root[data-theme="dark"] .mobile-nav-toggle,
:root[data-theme="dark"] .diagnostic-filter-toggle,
:root[data-theme="dark"] .profile-class-fixed,
:root[data-theme="dark"] .profile-class-option,
:root[data-theme="dark"] .hint-inline-button,
:root[data-theme="dark"] .accent-letter-button,
:root[data-theme="dark"] .lesson-exercise-link,
:root[data-theme="dark"] .lesson-exercise-link .exercise-icon {
    border-color: #4a405e;
    background-color: #2a2438;
    color: #e4dcf2;
}

:root[data-theme="dark"] .button-ghost:hover,
:root[data-theme="dark"] .button-secondary:hover,
:root[data-theme="dark"] .filter-chip:hover,
:root[data-theme="dark"] .filter-chip.active,
:root[data-theme="dark"] .grade-tab:hover,
:root[data-theme="dark"] .grade-tab.active,
:root[data-theme="dark"] .modal-close:hover,
:root[data-theme="dark"] .mobile-nav-toggle:hover,
:root[data-theme="dark"] .diagnostic-filter-toggle:hover,
:root[data-theme="dark"] .profile-class-option:hover,
:root[data-theme="dark"] .profile-class-option.selected,
:root[data-theme="dark"] .hint-inline-button:hover,
:root[data-theme="dark"] .accent-letter-button:hover,
:root[data-theme="dark"] .lesson-exercise-link:hover {
    border-color: #66568a;
    background-color: #39304d;
    color: #f4edff;
}

:root[data-theme="dark"] .button-primary {
    border-color: transparent;
    background: linear-gradient(135deg, #8d73f4, #714ce0);
    color: #fff;
}

:root[data-theme="dark"] .home-subject-card .subject-card-corner:not(.subject-card-corner-disabled) {
    border-color: #564671;
    background: #352c48;
    color: #d7c8ff;
}

:root[data-theme="dark"] .subject-filter-card,
:root[data-theme="dark"] .subject-exercise-card,
:root[data-theme="dark"] .lesson-card,
:root[data-theme="dark"] .lesson-card-full {
    border-color: #40384f;
    background: linear-gradient(145deg, #282338, #231f30);
}

:root[data-theme="dark"] .accent-letter,
:root[data-theme="dark"] .accent-drop-slot {
    border-color: #55496f;
    background: #292438;
    color: #e3dcf4;
}

:root[data-theme="dark"] .accent-letter-button.is-filled {
    border-color: #8f7de5;
    background: #352b56;
    color: #e2d9ff;
}

:root[data-theme="dark"] .button-light {
    border-color: #4a405e;
    background: #2d273b;
    color: #e5dcff;
}

:root[data-theme="dark"] .btn:not(.btn-primary) {
    border-color: #4a405e;
    background-color: #2a2438;
    color: #e4dcf2;
}

:root[data-theme="dark"] .btn-primary {
    border-color: #7555d6;
    background: linear-gradient(135deg, #8063e6, #6245c8);
    color: #fff;
}

:root[data-theme="dark"] .main-nav .nav-action:focus-visible,
:root[data-theme="dark"] .sidebar-tool-button:focus-visible {
    outline-color: #b7a3ff;
}

@media (max-width: 900px) {
    .main-nav { padding-right: 8px; }
    .subject-filters { max-height: none; overflow: visible; }
}

@media (max-width: 560px) {
    .seo-prerender { width: calc(100% - 20px); margin: 10px auto; padding: 22px 18px; border-radius: 21px; }
    .seo-prerender > nav:first-child { margin-bottom: 30px; }
    .seo-prerender header { margin-bottom: 22px; }
    .seo-prerender h1 { font-size: clamp(34px, 10vw, 46px); }
    .seo-prerender header .subtitle { font-size: 13px; }
}
