* {
    box-sizing: border-box;
}

:root {
    color-scheme: light;
    --bg: #f7f5fa;
    --surface: #ffffff;
    --surface-subtle: #faf8fc;
    --surface-strong: #f0ebf5;
    --text: #24182e;
    --text-soft: #574661;
    --muted: #81718a;
    --line: #e3dce8;
    --line-strong: #cec2d6;
    --primary: #7a3db8;
    --primary-hover: #65309c;
    --primary-soft: #eee3f8;
    --primary-ink: #4f247b;
    --blue: #526fc4;
    --blue-soft: #e7ebfa;
    --amber: #ac7216;
    --amber-soft: #f8edcf;
    --coral: #bd5479;
    --coral-soft: #f7e2ea;
    --red: #b94262;
    --red-soft: #f7e1e7;
    --success: #247d5b;
    --success-soft: #e2f2eb;
    --nav-bg: #2b173b;
    --nav-text: #eee4f4;
    --nav-muted: #bda9c9;
    --shadow-sm: 0 1px 2px rgba(48, 27, 61, 0.07);
    --shadow-md: 0 12px 30px rgba(48, 27, 61, 0.1);
    --sidebar-width: 248px;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #120d18;
    --surface: #1c1424;
    --surface-subtle: #22182c;
    --surface-strong: #2d2039;
    --text: #f7f1fa;
    --text-soft: #d3c4da;
    --muted: #a791b1;
    --line: #3d2d48;
    --line-strong: #51405d;
    --primary: #b778e7;
    --primary-hover: #c992ef;
    --primary-soft: #3b2450;
    --primary-ink: #e2bdf7;
    --blue: #91a7ec;
    --blue-soft: #293553;
    --amber: #e5b85f;
    --amber-soft: #47391f;
    --coral: #ed8caf;
    --coral-soft: #4b2a3b;
    --red: #ef879f;
    --red-soft: #4b2935;
    --success: #70d2a7;
    --success-soft: #213e33;
    --nav-bg: #241130;
    --nav-text: #f1e7f6;
    --nav-muted: #ad97b9;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.18);
    --shadow-md: 0 14px 34px rgba(0, 0, 0, 0.24);
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
    letter-spacing: 0;
}

body.no-motion *,
body.no-motion *::before,
body.no-motion *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
}

button,
input,
select {
    font: inherit;
    letter-spacing: 0;
}

button,
a,
input,
select {
    -webkit-tap-highlight-color: transparent;
}

button {
    color: inherit;
}

a {
    color: inherit;
}

svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    stroke-width: 2;
}

[hidden] {
    display: none !important;
}

:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--blue) 42%, transparent);
    outline-offset: 3px;
}

.app-shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    display: flex;
    width: var(--sidebar-width);
    min-height: 100vh;
    flex-direction: column;
    padding: 24px 18px 18px;
    overflow-y: auto;
    background: var(--nav-bg);
    color: var(--nav-text);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
}

.brand {
    min-height: 50px;
    padding: 2px 8px 22px;
}

.brand-mark {
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    background: #f0e4f7;
    color: #51256f;
    font-size: 19px;
    font-weight: 850;
}

.brand-copy,
.profile-link > span:not(.avatar) {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.brand-copy strong {
    color: #ffffff;
    font-size: 17px;
    font-weight: 800;
}

.brand-copy small,
.profile-link small,
.sidebar-metric small {
    color: var(--nav-muted);
    font-size: 11px;
}

.primary-nav {
    display: grid;
    gap: 6px;
}

.nav-link {
    position: relative;
    display: flex;
    min-height: 46px;
    align-items: center;
    gap: 13px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--nav-text);
    font-size: 14px;
    font-weight: 650;
    text-decoration: none;
    transition: background-color 160ms ease, color 160ms ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
}

.nav-link.is-active {
    background: #efe2f7;
    color: #51256f;
}

.nav-link.is-active::before {
    position: absolute;
    left: -18px;
    width: 4px;
    height: 24px;
    border-radius: 0 4px 4px 0;
    background: #c38ce8;
    content: "";
}

.nav-link-mobile-only {
    display: none;
}

.sidebar-footer {
    display: grid;
    gap: 12px;
    margin-top: auto;
    padding-top: 26px;
}

.sidebar-metric,
.profile-link {
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
}

.sidebar-metric {
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-metric > span:last-child {
    display: flex;
    flex-direction: column;
}

.sidebar-metric strong,
.profile-link strong {
    color: #ffffff;
    font-size: 13px;
}

.profile-link {
    min-height: 58px;
    padding: 8px;
    text-decoration: none;
    transition: background-color 160ms ease;
}

.profile-link:hover,
.profile-link.is-active {
    background: rgba(255, 255, 255, 0.08);
}

.profile-link > svg {
    width: 17px;
    margin-left: auto;
    color: var(--nav-muted);
}

.avatar {
    display: inline-flex;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #eadcf2;
    color: #542972;
    font-size: 12px;
    font-weight: 800;
}

.app-main {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.course-switcher {
    position: fixed;
    top: 18px;
    right: 24px;
    z-index: 45;
}

.notification-center {
    position: fixed;
    top: 18px;
    right: 88px;
    z-index: 46;
}

.notification-trigger {
    position: relative;
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    color: var(--text-soft);
    cursor: pointer;
}

.notification-trigger:hover,
.notification-trigger:focus-visible,
.notification-center.is-open .notification-trigger {
    border-color: var(--primary);
    color: var(--primary);
}

.notification-trigger > svg {
    width: 19px;
    height: 19px;
}

.notification-badge {
    position: absolute;
    top: -6px;
    right: -7px;
    display: inline-grid;
    min-width: 20px;
    height: 20px;
    place-items: center;
    padding: 0 5px;
    border: 2px solid var(--bg);
    border-radius: 10px;
    background: var(--red);
    color: #ffffff;
    font-size: 9px;
    font-weight: 850;
}

.notification-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(370px, calc(100vw - 28px));
    max-height: min(590px, calc(100vh - 84px));
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.notification-heading {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.notification-heading > div {
    display: grid;
    gap: 2px;
}

.notification-heading small {
    color: var(--muted);
    font-size: 9px;
    font-weight: 750;
    text-transform: uppercase;
}

.notification-heading strong {
    font-size: 15px;
}

.notification-heading > span {
    display: inline-grid;
    min-width: 26px;
    height: 26px;
    place-items: center;
    padding: 0 7px;
    border-radius: 13px;
    background: var(--primary-soft);
    color: var(--primary-ink);
    font-size: 10px;
    font-weight: 850;
}

.notification-empty {
    display: grid;
    justify-items: center;
    gap: 7px;
    padding: 34px 22px;
    color: var(--muted);
    text-align: center;
}

.notification-empty > svg {
    width: 25px;
    height: 25px;
    color: var(--primary);
}

.notification-empty strong {
    color: var(--text);
    font-size: 13px;
}

.notification-empty p {
    max-width: 260px;
    margin: 0;
    font-size: 11px;
    line-height: 1.5;
}

.notification-list {
    display: grid;
}

.notification-item {
    display: grid;
    gap: 9px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.notification-item:last-child {
    border-bottom: 0;
}

.notification-sender {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
}

.notification-sender .avatar {
    width: 34px;
    height: 34px;
}

.notification-sender > span:last-child {
    display: grid;
    min-width: 0;
}

.notification-sender strong,
.notification-sender small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-sender strong {
    font-size: 12px;
}

.notification-sender small {
    color: var(--muted);
    font-size: 9px;
}

.notification-item > p {
    margin: 0;
    color: var(--text-soft);
    font-size: 11px;
    line-height: 1.5;
}

.notification-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.notification-actions form,
.notification-actions .button {
    width: 100%;
}

.notification-actions .button {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 10px;
}

.notification-actions .button svg {
    width: 14px;
    height: 14px;
}

.course-switcher-trigger {
    display: inline-flex;
    width: 54px;
    height: 42px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    color: var(--text-soft);
    cursor: pointer;
}

.course-switcher-trigger > svg {
    width: 14px;
    height: 14px;
    transition: transform 160ms ease;
}

.course-switcher.is-open .course-switcher-trigger > svg {
    transform: rotate(180deg);
}

.course-flag {
    position: relative;
    display: inline-block;
    width: 25px;
    height: 17px;
    flex: 0 0 auto;
    overflow: hidden;
    border: 1px solid rgba(32, 38, 50, 0.22);
    border-radius: 3px;
    background: #ffffff;
}

.course-flag-spanish {
    background: #f5c542;
}

.course-flag-spanish::before,
.course-flag-spanish::after {
    position: absolute;
    right: 0;
    left: 0;
    height: 4px;
    background: #c52b36;
    content: "";
}

.course-flag-spanish::before {
    top: 0;
}

.course-flag-spanish::after {
    bottom: 0;
}

.course-flag-polish::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 50%;
    background: #dc3550;
    content: "";
}

.course-flag-russian {
    background: linear-gradient(
        to bottom,
        #ffffff 0 33.333%,
        #0039a6 33.333% 66.666%,
        #d52b1e 66.666% 100%
    );
}

.course-flag-english {
    background:
        linear-gradient(to bottom, transparent 41%, #c8102e 41% 59%, transparent 59%),
        linear-gradient(to right, transparent 42%, #c8102e 42% 58%, transparent 58%),
        linear-gradient(to bottom, transparent 29%, #ffffff 29% 71%, transparent 71%),
        linear-gradient(to right, transparent 33%, #ffffff 33% 67%, transparent 67%),
        linear-gradient(33deg, transparent 39%, #ffffff 39% 44%, #c8102e 44% 50%, #ffffff 50% 61%, transparent 61%),
        linear-gradient(-33deg, transparent 39%, #ffffff 39% 50%, #c8102e 50% 56%, #ffffff 56% 61%, transparent 61%),
        #012169;
}

.course-flag-english::before,
.course-flag-english::after {
    content: none;
}

.course-switcher-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(300px, calc(100vw - 28px));
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.course-switcher-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 2px 10px;
}

.course-switcher-heading > div {
    display: grid;
    gap: 2px;
}

.course-switcher-heading small,
.course-add-options > small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 750;
    text-transform: uppercase;
}

.course-switcher-heading strong {
    font-size: 15px;
}

.course-add-trigger {
    width: 34px;
    height: 34px;
}

.course-switcher-list,
.course-add-options {
    display: grid;
    gap: 4px;
}

.course-switcher-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    align-items: center;
    gap: 3px;
}

.course-switch-form,
.course-delete-form {
    min-width: 0;
}

.course-switcher-option {
    display: grid;
    width: 100%;
    min-height: 48px;
    grid-template-columns: 27px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 9px;
    padding: 8px 9px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.course-switcher-option:hover:not(:disabled),
.course-switcher-option:focus-visible,
.course-switcher-option.is-active {
    background: var(--surface-subtle);
}

.course-switcher-option:disabled {
    color: var(--text);
    cursor: default;
    opacity: 1;
}

.course-switcher-option > span:nth-child(2) {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.course-switcher-option strong,
.course-switcher-option small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.course-switcher-option strong {
    font-size: 13px;
}

.course-switcher-option small {
    color: var(--muted);
    font-size: 10px;
}

.course-switcher-option > svg {
    width: 16px;
    height: 16px;
    color: var(--primary);
}

.course-delete-button {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.course-delete-button:hover,
.course-delete-button:focus-visible {
    background: var(--red-soft);
    color: var(--red);
}

.course-delete-button > svg {
    width: 16px;
    height: 16px;
}

.course-add-options {
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.course-add-options > small {
    padding: 0 9px 4px;
}

.course-switcher-error {
    margin: 9px 4px 2px;
    color: var(--red);
    font-size: 11px;
    line-height: 1.4;
}

.has-course-switcher .page-content {
    padding-top: 78px;
}

.icon-button {
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-soft);
    cursor: pointer;
    text-decoration: none;
    transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.icon-button:hover {
    border-color: var(--line-strong);
    background: var(--surface-subtle);
    color: var(--primary);
}

.page-content {
    width: min(1240px, calc(100% - 64px));
    margin: 0 auto;
    padding: 42px 0 24px;
}

.page-heading {
    max-width: 760px;
    margin-bottom: 30px;
}

.page-heading-actions {
    display: flex;
    max-width: none;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.eyebrow,
.overline,
.level-kicker,
.prompt-label {
    margin: 0 0 7px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h1,
h2,
h3 {
    color: var(--text);
    line-height: 1.18;
}

h1 {
    margin: 0;
    font-size: 38px;
    font-weight: 820;
}

h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 780;
}

h3 {
    margin: 0;
    font-size: 17px;
}

.page-lead {
    max-width: 680px;
    margin: 9px 0 0;
    color: var(--text-soft);
    font-size: 16px;
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 750;
    text-decoration: none;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.button-primary {
    background: var(--primary);
    color: #ffffff;
}

.button-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.button-secondary {
    border-color: var(--line-strong);
    background: var(--surface);
    color: var(--text);
}

.button-secondary:hover:not(:disabled),
.button-quiet:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary-ink);
}

.button-quiet {
    border-color: transparent;
    background: transparent;
    color: var(--text-soft);
}

.button-light {
    background: #faf5fd;
    color: #51256f;
}

.button-light:hover:not(:disabled) {
    background: #ffffff;
}

.button-wide {
    width: 100%;
}

.text-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 750;
    text-decoration: none;
}

.text-link svg {
    width: 17px;
    transition: transform 160ms ease;
}

.text-link:hover svg {
    transform: translateX(3px);
}

.icon-tile {
    display: inline-flex;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.icon-tile-green {
    background: var(--primary-soft);
    color: var(--primary);
}

.icon-tile-purple {
    background: var(--primary-soft);
    color: var(--primary);
}

.icon-tile-blue {
    background: var(--blue-soft);
    color: var(--blue);
}

.icon-tile-amber {
    background: var(--amber-soft);
    color: var(--amber);
}

.status-badge,
.xp-pill,
.language-chip {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.dashboard-hero {
    display: grid;
    min-height: 300px;
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
    align-items: center;
    gap: 48px;
    padding: 42px 48px;
    border: 1px solid #64358a;
    border-radius: 8px;
    background: #4b2468;
    box-shadow: var(--shadow-md);
    color: #eee2f4;
}

.dashboard-hero h2 {
    max-width: 580px;
    color: #ffffff;
    font-size: 32px;
}

.dashboard-hero p:not(.overline) {
    max-width: 580px;
    margin: 14px 0 24px;
    color: #ddc9e7;
}

.overline-light {
    color: #d7a8ee;
}

.session-orbit {
    display: flex;
    min-height: 216px;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
}

.session-orbit-ring {
    display: flex;
    width: 128px;
    height: 128px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border: 10px solid #c487e5;
    border-radius: 50%;
    background: #351849;
}

.session-orbit-ring strong {
    color: #ffffff;
    font-size: 36px;
    line-height: 1;
}

.session-orbit-ring span {
    margin-top: 5px;
    color: #d8c1e3;
    font-size: 12px;
}

.session-orbit-meta {
    display: grid;
    gap: 12px;
}

.session-orbit-meta span {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #eee2f4;
    font-size: 13px;
}

.session-orbit-meta svg {
    width: 17px;
    color: #d7a8ee;
}

.section-block {
    margin-top: 42px;
}

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

.section-heading.compact {
    align-items: flex-start;
    margin-bottom: 22px;
}

.section-heading .eyebrow {
    margin-bottom: 5px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.metric-card {
    display: grid;
    min-width: 0;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    padding: 20px;
    border: 1px solid var(--line);
    border-top: 3px solid transparent;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.metric-card .metric-icon {
    display: inline-flex;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.metric-card > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.metric-card strong {
    color: var(--text);
    font-size: 25px;
    line-height: 1.1;
}

.metric-card span:not(.metric-icon) {
    margin-top: 4px;
    color: var(--text-soft);
    font-size: 13px;
}

.metric-card small {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 12px;
}

.metric-green {
    border-top-color: var(--primary);
}

.metric-green .metric-icon {
    background: var(--primary-soft);
    color: var(--primary);
}

.metric-blue {
    border-top-color: var(--blue);
}

.metric-blue .metric-icon {
    background: var(--blue-soft);
    color: var(--blue);
}

.metric-amber {
    border-top-color: var(--amber);
}

.metric-amber .metric-icon {
    background: var(--amber-soft);
    color: var(--amber);
}

.metric-coral {
    border-top-color: var(--coral);
}

.metric-coral .metric-icon {
    background: var(--coral-soft);
    color: var(--coral);
}

.dashboard-columns,
.progress-layout,
.profile-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
    gap: 18px;
    margin-top: 22px;
}

.surface-panel {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.weekly-chart {
    display: grid;
    min-height: 150px;
    grid-template-columns: repeat(7, minmax(32px, 1fr));
    align-items: end;
    gap: 10px;
}

.chart-day {
    display: grid;
    min-width: 0;
    gap: 8px;
    text-align: center;
}

.chart-column {
    position: relative;
    display: flex;
    height: 112px;
    align-items: flex-end;
    justify-content: center;
    border-bottom: 1px solid var(--line);
}

.chart-column::before {
    position: absolute;
    inset: 25% 0 auto;
    border-top: 1px dashed var(--line);
    content: "";
}

.chart-column span {
    position: relative;
    z-index: 1;
    width: min(24px, 70%);
    min-height: 4px;
    border-radius: 4px 4px 1px 1px;
    background: var(--primary);
    transition: height 300ms ease;
}

.chart-day.is-today .chart-column span {
    background: var(--blue);
}

.chart-day > span {
    color: var(--muted);
    font-size: 11px;
    text-transform: capitalize;
}

.goal-progress {
    display: grid;
    gap: 13px;
}

.goal-progress-copy,
.course-progress-copy {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.goal-progress-copy span,
.course-progress-copy span {
    color: var(--text-soft);
    font-size: 13px;
}

.goal-progress-copy strong,
.course-progress-copy strong {
    color: var(--text);
    font-size: 18px;
}

.linear-progress,
.progress-track {
    position: relative;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-strong);
}

.linear-progress {
    height: 9px;
}

.linear-progress > span,
.progress-track > span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    transition: width 300ms ease;
}

.panel-note {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.page-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 54px;
    padding: 20px 0 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

/* Vocabulary */
.library-overview {
    display: flex;
    align-items: center;
    gap: 12px 32px;
    margin: -6px 0 26px;
    padding: 15px 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.library-overview > div {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
}

.library-overview > div + div {
    padding-left: 32px;
    border-left: 1px solid var(--line);
}

.library-overview > div > span:last-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.library-overview strong {
    font-size: 14px;
}

.library-overview small {
    color: var(--muted);
    font-size: 12px;
}

.level-tabs {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 26px;
    padding: 5px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-strong);
}

.level-tab {
    display: flex;
    min-width: 94px;
    min-height: 54px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
}

.level-tab strong {
    font-size: 15px;
}

.level-tab span {
    color: var(--muted);
    font-size: 11px;
}

.level-tab.is-active {
    border-color: var(--line);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    color: var(--primary);
}

.level-tab:disabled {
    cursor: not-allowed;
    opacity: 0.52;
}

.library-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    align-items: start;
    gap: 22px;
}

.level-panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.level-panel-heading p {
    max-width: 620px;
    margin: 7px 0 0;
    color: var(--text-soft);
}

.check-all {
    display: flex;
    min-height: 40px;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-soft);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.check-all input,
.category-card input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

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

.category-groups {
    display: grid;
    gap: 30px;
}

.category-group {
    min-width: 0;
}

.category-group-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--line);
}

.category-group-heading h3 {
    font-size: 15px;
}

.category-group-heading span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.category-card {
    position: relative;
    display: grid;
    min-height: 150px;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.category-card:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-sm);
}

.category-card:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.category-card > input,
.custom-category-selection > input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.category-check {
    position: absolute;
    top: 13px;
    right: 13px;
    display: inline-flex;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: var(--surface);
    color: transparent;
}

.category-check svg {
    width: 15px;
}

.category-card input:checked + .category-check {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
}

.category-icon {
    display: inline-flex;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--primary-soft);
    color: var(--primary);
}

.category-blue {
    border-left-color: var(--blue);
}

.category-blue .category-icon {
    background: var(--blue-soft);
    color: var(--blue);
}

.category-amber {
    border-left-color: var(--amber);
}

.category-amber .category-icon {
    background: var(--amber-soft);
    color: var(--amber);
}

.category-coral {
    border-left-color: var(--coral);
}

.category-coral .category-icon {
    background: var(--coral-soft);
    color: var(--coral);
}

.category-green {
    border-left-color: var(--success);
}

.category-green .category-icon {
    background: var(--success-soft);
    color: var(--success);
}

.custom-category-card {
    cursor: default;
}

.custom-category-selection {
    display: contents;
    cursor: pointer;
}

.custom-category-card .category-check {
    right: 51px;
}

.custom-category-edit,
.custom-word-remove {
    display: inline-grid;
    width: 32px;
    height: 32px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.custom-category-edit {
    position: absolute;
    top: 9px;
    right: 9px;
}

.custom-category-edit:hover,
.custom-category-edit:focus-visible {
    background: var(--surface-strong);
    color: var(--primary);
}

.custom-category-edit svg,
.custom-word-remove svg {
    width: 16px;
    height: 16px;
}

.category-copy {
    display: flex;
    min-width: 0;
    padding-right: 24px;
    flex-direction: column;
}

.category-copy strong {
    font-size: 16px;
}

.category-copy small {
    min-height: 38px;
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
}

.category-copy > span {
    margin-top: 9px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 750;
}

.selection-panel {
    position: sticky;
    top: 22px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.custom-vocabulary-dialog {
    width: min(980px, calc(100% - 32px));
    max-width: none;
    max-height: calc(100dvh - 32px);
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
}

.custom-vocabulary-dialog::backdrop {
    background: rgba(18, 13, 24, 0.62);
}

.custom-vocabulary-dialog > form {
    display: grid;
    max-height: calc(100dvh - 34px);
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.custom-vocabulary-dialog-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--line);
}

.custom-vocabulary-dialog-heading h2 {
    font-size: 21px;
}

.custom-vocabulary-dialog-body {
    padding: 20px 22px 24px;
    overflow-y: auto;
}

.custom-section-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    gap: 12px;
}

.custom-section-fields label,
.custom-word-fields label {
    display: grid;
    min-width: 0;
    gap: 6px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 750;
}

.custom-words-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 24px 0 12px;
}

.custom-words-heading h3 {
    font-size: 16px;
}

.custom-words-heading span {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
}

.custom-word-rows {
    display: grid;
    gap: 10px;
}

.custom-word-row {
    position: relative;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 32px;
    align-items: start;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-subtle);
}

.custom-word-number {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    margin-top: 24px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
}

.custom-word-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.custom-word-synonyms-field {
    grid-column: 1 / -1;
}

.custom-word-fields input[readonly] {
    background: var(--surface-strong);
    color: var(--text-soft);
}

.custom-word-source-field {
    position: relative;
}

.translation-suggestions {
    position: absolute;
    z-index: 5;
    top: calc(100% + 5px);
    right: 0;
    left: 0;
    display: grid;
    max-height: 210px;
    padding: 5px;
    overflow-y: auto;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.translation-suggestions button {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    text-align: left;
}

.translation-suggestions button:hover,
.translation-suggestions button:focus-visible {
    background: var(--primary-soft);
    color: var(--primary-ink);
}

.translation-suggestions button span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.translation-suggestions button strong {
    color: var(--text);
    font-size: 12px;
    text-align: right;
}

.custom-word-remove {
    margin-top: 22px;
}

.custom-word-remove:hover,
.custom-word-remove:focus-visible {
    background: var(--red-soft);
    color: var(--red);
}

.custom-word-status {
    min-height: 18px;
    grid-column: 2;
    margin: -3px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.custom-section-error {
    min-height: 20px;
    margin: 12px 0 0;
    color: var(--red);
    font-size: 12px;
    font-weight: 700;
}

.custom-vocabulary-dialog-actions {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    padding: 14px 22px;
    border-top: 1px solid var(--line);
    background: var(--surface-subtle);
}

.selection-panel h2 {
    font-size: 19px;
}

.selection-count {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 21px 0 15px;
    padding-bottom: 17px;
    border-bottom: 1px solid var(--line);
}

.selection-count strong {
    color: var(--primary);
    font-size: 34px;
    line-height: 1;
}

.selection-count span {
    color: var(--muted);
    font-size: 12px;
}

.selected-category-list {
    display: flex;
    min-height: 36px;
    align-content: flex-start;
    gap: 6px;
    flex-wrap: wrap;
}

.selected-category-list span {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
}

.selected-category-list .selection-empty {
    padding: 0;
    background: transparent;
    color: var(--muted);
    font-weight: 500;
}

.save-status {
    min-height: 21px;
    margin: 12px 0 7px;
    color: var(--primary);
    font-size: 12px;
}

.selection-panel .button + .button {
    margin-top: 6px;
}

.selection-panel .button {
    width: 100%;
}

.empty-state {
    display: flex;
    min-height: 260px;
    align-items: center;
    justify-content: center;
    padding: 36px;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    flex-direction: column;
    text-align: center;
}

.empty-state h3 {
    margin-top: 14px;
}

.empty-state p {
    max-width: 440px;
    margin: 7px 0 0;
    color: var(--muted);
}

/* Exercises */
.exercise-page {
    width: min(100%, 1040px);
    margin: 0 auto;
}

.session-start-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
    gap: 18px;
}

.session-preview,
.session-ready-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.session-preview {
    display: grid;
    min-height: 310px;
    grid-template-columns: auto minmax(0, 1fr);
    align-content: center;
    gap: 20px;
    padding: 34px;
}

.session-preview-icon {
    display: inline-flex;
    width: 66px;
    height: 66px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--primary-soft);
    color: var(--primary);
}

.session-preview-icon svg {
    width: 32px;
    height: 32px;
}

.session-preview-copy h2 {
    font-size: 28px;
}

.session-preview-copy > p:last-child {
    margin: 9px 0 0;
    color: var(--text-soft);
}

.session-facts {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.session-facts span {
    display: flex;
    min-height: 56px;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: 8px;
    background: var(--surface-subtle);
    color: var(--text-soft);
    font-size: 12px;
}

.session-facts svg {
    width: 17px;
    color: var(--primary);
}

.session-ready-panel {
    display: flex;
    min-height: 310px;
    justify-content: center;
    padding: 28px;
    flex-direction: column;
}

.session-ready-panel > div {
    display: flex;
    margin: 9px 0 24px;
    flex-direction: column;
}

.session-ready-panel strong {
    font-size: 16px;
}

.session-ready-panel span:not(.status-dot) {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--amber);
    box-shadow: 0 0 0 5px var(--amber-soft);
}

.status-dot.is-ready {
    background: var(--primary);
    box-shadow: 0 0 0 5px var(--primary-soft);
}

.learning-screen {
    max-width: 900px;
    margin: 0 auto;
}

.learning-header {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    align-items: center;
    gap: 15px;
}

.learning-progress-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.learning-progress-copy strong {
    font-size: 14px;
}

.learning-progress-copy span {
    color: var(--muted);
    font-size: 12px;
}

.xp-pill {
    background: var(--primary-soft);
    color: var(--primary-ink);
}

.xp-pill svg {
    width: 15px;
}

.progress-track {
    height: 8px;
    margin: 18px 0 28px;
}

.question-stage {
    min-height: 430px;
    padding: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.question-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 50px;
}

.question-meta span {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 750;
}

.question-stage > h1 {
    min-height: 54px;
    margin-top: 5px;
    font-size: 40px;
}

.question-stage > h1.question-answer-correct {
    color: var(--success);
}

.question-stage > h1.question-answer-wrong {
    color: var(--red);
}

.question-stage > h1.question-answer-hint {
    color: var(--muted);
}

.answer-form {
    margin-top: 43px;
}

.answer-form > label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
}

.answer-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

input[type="text"],
input:not([type]),
select {
    min-width: 0;
    min-height: 48px;
    padding: 11px 13px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}

input::placeholder {
    color: var(--muted);
}

input:focus,
select:focus {
    border-color: var(--primary);
    outline: 3px solid color-mix(in srgb, var(--primary) 15%, transparent);
}

.answer-row input {
    height: 52px;
    font-size: 17px;
}

.answer-row .button {
    min-width: 132px;
}

.answer-feedback {
    display: none;
    min-height: 54px;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
}

.answer-feedback.is-visible {
    display: flex;
}

.answer-feedback.answer-good {
    border-color: color-mix(in srgb, var(--primary) 36%, var(--line));
    background: var(--primary-soft);
    color: var(--primary-ink);
}

.answer-feedback.answer-bad {
    border-color: color-mix(in srgb, var(--red) 36%, var(--line));
    background: var(--red-soft);
    color: var(--red);
}

.summary-screen {
    max-width: 860px;
    margin: 14px auto 0;
    text-align: center;
}

.summary-mark {
    display: inline-flex;
    width: 74px;
    height: 74px;
    align-items: center;
    justify-content: center;
    margin-bottom: 19px;
    border-radius: 50%;
    background: var(--amber-soft);
    color: var(--amber);
}

.summary-mark svg {
    width: 34px;
    height: 34px;
}

.summary-screen .page-lead {
    margin-right: auto;
    margin-left: auto;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 34px;
}

.summary-stat {
    display: flex;
    min-height: 144px;
    align-items: center;
    justify-content: center;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    flex-direction: column;
}

.summary-stat svg {
    margin-bottom: 9px;
}

.summary-stat strong {
    font-size: 26px;
}

.summary-stat span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.summary-correct svg,
.summary-xp svg {
    color: var(--primary);
}

.summary-wrong svg {
    color: var(--red);
}

.summary-accuracy svg {
    color: var(--blue);
}

.summary-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 25px;
}

/* Progress */
.progress-metrics {
    margin-bottom: 22px;
}

.progress-layout {
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.65fr);
}

.weekly-chart-large {
    min-height: 230px;
}

.weekly-chart-large .chart-column {
    height: 185px;
}

.consistency-panel {
    display: flex;
    justify-content: center;
    flex-direction: column;
}

.consistency-panel .eyebrow {
    margin-top: 20px;
}

.consistency-panel > p:last-of-type {
    margin: 9px 0 22px;
    color: var(--text-soft);
    font-size: 13px;
}

.consistency-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
}

.consistency-day {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 6px;
    flex-direction: column;
    color: var(--muted);
    font-size: 10px;
}

.consistency-day span:first-child {
    width: 25px;
    height: 25px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface-strong);
}

.consistency-day.is-active span:first-child {
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: inset 0 0 0 5px var(--primary-soft);
}

.history-table {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.history-header,
.history-item {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) minmax(190px, 1.4fr) minmax(110px, 0.8fr) minmax(70px, 0.5fr);
    gap: 18px;
    align-items: center;
}

.history-header {
    padding: 11px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-subtle);
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    text-transform: uppercase;
}

.history-item {
    min-height: 64px;
    padding: 12px 18px;
    color: var(--text-soft);
    font-size: 13px;
}

.history-item + .history-item {
    border-top: 1px solid var(--line);
}

.history-item strong {
    color: var(--text);
}

.history-score {
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-score span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.history-score .history-correct {
    color: var(--primary);
}

.history-score .history-wrong {
    color: var(--red);
}

.history-empty {
    display: flex;
    min-height: 170px;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: var(--muted);
    text-align: center;
}

/* Profile */
.profile-hero {
    display: flex;
    min-height: 150px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.profile-identity,
.profile-xp {
    display: flex;
    align-items: center;
    gap: 17px;
}

.profile-avatar {
    display: inline-flex;
    width: 78px;
    height: 78px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-ink);
    font-size: 23px;
    font-weight: 850;
}

.profile-avatar-editor {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
}

.profile-avatar-edit {
    position: absolute;
    right: -3px;
    bottom: -3px;
    display: inline-flex;
    width: 31px;
    height: 31px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 2px solid var(--surface);
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.profile-avatar-edit:hover {
    background: var(--primary-ink);
}

.profile-avatar-edit svg {
    width: 15px;
    height: 15px;
}

.profile-identity h2 {
    margin-top: 8px;
    font-size: 25px;
}

.profile-public-id {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.profile-public-id code {
    color: var(--text-soft);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    letter-spacing: 0;
}

.profile-public-id .icon-button {
    width: 28px;
    height: 28px;
}

.profile-public-id .icon-button svg {
    width: 14px;
    height: 14px;
}

.profile-identity p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.status-active {
    color: var(--primary-ink);
}

.status-active > span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
}

.profile-xp {
    min-width: 200px;
    padding-left: 28px;
    border-left: 1px solid var(--line);
}

.profile-xp > span:last-child {
    display: flex;
    flex-direction: column;
}

.profile-xp strong {
    font-size: 24px;
}

.profile-xp small {
    color: var(--muted);
}

.profile-hero-side {
    display: flex;
    align-items: center;
    gap: 20px;
}

.profile-hero-side > .button {
    white-space: nowrap;
}

.profile-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-layout .surface-panel > p {
    color: var(--text-soft);
}

.profile-layout .linear-progress {
    margin: 12px 0 20px;
}

.language-chip {
    min-width: 40px;
    justify-content: center;
    background: var(--blue-soft);
    color: var(--blue);
}

/* Settings */
.settings-layout {
    display: grid;
    grid-template-columns: 210px minmax(0, 760px);
    align-items: start;
    gap: 24px;
}

.settings-nav {
    position: sticky;
    top: 22px;
    display: grid;
    gap: 5px;
}

.settings-nav a {
    display: flex;
    min-height: 42px;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    border-radius: 8px;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.settings-nav a:hover {
    background: var(--surface-strong);
    color: var(--primary);
}

.settings-nav svg {
    width: 17px;
}

.settings-sections {
    display: grid;
    gap: 16px;
}

.settings-section {
    scroll-margin-top: 18px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.settings-section-heading {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 20px;
    border-bottom: 1px solid var(--line);
}

.settings-section-heading h2 {
    font-size: 18px;
}

.settings-section-heading p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.setting-row,
.select-setting {
    display: flex;
    min-height: 78px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 20px;
}

.setting-row + .setting-row,
.select-setting {
    border-top: 1px solid var(--line);
}

.setting-row > span:first-child,
.select-setting > span:first-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.setting-row strong,
.select-setting strong {
    font-size: 14px;
}

.setting-row small,
.select-setting small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.switch-control {
    position: relative;
    display: inline-flex;
    width: 46px;
    height: 26px;
    flex: 0 0 auto;
}

.switch-control input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.switch-control > span {
    position: absolute;
    inset: 0;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface-strong);
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease;
}

.switch-control > span::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    content: "";
    transition: transform 160ms ease;
}

.switch-control input:checked + span {
    border-color: var(--primary);
    background: var(--primary);
}

.switch-control input:checked + span::after {
    transform: translateX(20px);
}

.switch-control input:focus-visible + span {
    outline: 3px solid color-mix(in srgb, var(--blue) 42%, transparent);
    outline-offset: 3px;
}

.select-setting select {
    width: 150px;
}

.class-session-form {
    display: grid;
}

.class-session-form .select-setting {
    border-top: 1px solid var(--line);
}

.settings-form-actions {
    display: flex;
    justify-content: flex-end;
    padding: 0 20px 18px;
}

.settings-meta {
    display: flex;
    justify-content: space-between;
    padding: 8px 2px;
    color: var(--muted);
    font-size: 12px;
}

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 80;
    max-width: min(360px, calc(100% - 32px));
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
    color: var(--text);
    font-size: 13px;
    font-weight: 650;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 160ms ease, transform 160ms ease;
}

.confirm-dialog {
    width: min(440px, calc(100% - 28px));
    max-width: none;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
}

.confirm-dialog::backdrop {
    background: rgba(18, 13, 24, 0.58);
}

.confirm-dialog form {
    display: grid;
}

.confirm-dialog-heading {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    padding: 22px;
}

.confirm-dialog-heading h2 {
    margin: 0;
    font-size: 19px;
}

.confirm-dialog-heading p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.confirm-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 22px;
    border-top: 1px solid var(--line);
    background: var(--surface-subtle);
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1120px) {
    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-hero {
        grid-template-columns: minmax(0, 1fr) 290px;
        gap: 30px;
        padding: 36px;
    }

    .session-orbit {
        flex-direction: column;
    }

    .session-orbit-meta {
        grid-template-columns: repeat(2, auto);
    }

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

@media (max-width: 900px) {
    .sidebar {
        inset: auto 0 0;
        width: auto;
        min-height: 72px;
        padding: 7px max(8px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
        overflow: visible;
        border-top: 1px solid var(--line);
        background: var(--surface);
        color: var(--text-soft);
    }

    .brand,
    .sidebar-footer {
        display: none;
    }

    .primary-nav {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 2px;
    }

    .nav-link-mobile-only {
        display: flex;
    }

    .nav-link {
        min-width: 0;
        min-height: 56px;
        justify-content: center;
        gap: 3px;
        padding: 5px 2px;
        border-radius: 6px;
        color: var(--muted);
        flex-direction: column;
        font-size: 10px;
    }

    .nav-link svg {
        width: 21px;
        height: 21px;
    }

    .nav-link:hover,
    .nav-link.is-active {
        background: var(--primary-soft);
        color: var(--primary-ink);
    }

    .nav-link.is-active::before {
        display: none;
    }

    .app-main {
        margin-left: 0;
        padding-bottom: 76px;
    }

    .page-content {
        width: min(100% - 40px, 900px);
        padding-top: 32px;
    }

    .has-course-switcher .page-content {
        padding-top: 76px;
    }

    .course-switcher {
        top: 12px;
        right: max(12px, env(safe-area-inset-right));
    }

    .notification-center {
        top: 12px;
        right: max(76px, calc(env(safe-area-inset-right) + 64px));
    }

    .dashboard-hero,
    .dashboard-columns,
    .progress-layout,
    .profile-layout,
    .session-start-layout {
        grid-template-columns: 1fr;
    }

    .dashboard-hero {
        min-height: 0;
    }

    .session-orbit {
        min-height: 0;
        flex-direction: row;
    }

    .library-layout {
        grid-template-columns: 1fr;
    }

    .selection-panel {
        position: static;
        order: -1;
    }

    .selection-panel .selected-category-list {
        min-height: 0;
    }

    .settings-layout {
        grid-template-columns: 1fr;
    }

    .settings-nav {
        position: static;
        display: flex;
        overflow-x: auto;
    }

    .settings-nav a {
        white-space: nowrap;
    }
}

@media (max-width: 700px) {
    .page-heading-actions,
    .level-panel-heading,
    .profile-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .page-heading-actions {
        display: flex;
    }

    .page-heading-actions > .button {
        width: 100%;
    }

    .custom-vocabulary-dialog {
        width: calc(100% - 20px);
        max-height: calc(100dvh - 20px);
    }

    .custom-vocabulary-dialog > form {
        max-height: calc(100dvh - 22px);
    }

    .custom-vocabulary-dialog-heading,
    .custom-vocabulary-dialog-body,
    .custom-vocabulary-dialog-actions {
        padding-right: 15px;
        padding-left: 15px;
    }

    .custom-section-fields,
    .custom-word-fields {
        grid-template-columns: 1fr;
    }

    .custom-word-synonyms-field {
        grid-column: auto;
    }

    .custom-words-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .custom-words-heading .button {
        width: 100%;
    }

    .custom-word-row {
        grid-template-columns: 24px minmax(0, 1fr) 30px;
        gap: 7px;
        padding: 11px;
    }

    .custom-word-number {
        width: 24px;
        height: 24px;
    }

    .custom-vocabulary-dialog-actions {
        grid-template-columns: 1fr 1fr;
    }

    .custom-vocabulary-dialog-actions > span {
        display: none;
    }

    .custom-vocabulary-dialog-actions .button {
        width: 100%;
    }

    .custom-vocabulary-dialog-actions .button-danger {
        grid-column: 1 / -1;
    }

    h1 {
        font-size: 32px;
    }

    .dashboard-hero h2 {
        font-size: 27px;
    }

    .dashboard-hero {
        padding: 28px;
    }

    .session-orbit-ring {
        width: 112px;
        height: 112px;
    }

    .session-orbit-meta {
        grid-template-columns: 1fr;
    }

    .library-overview {
        align-items: stretch;
        flex-direction: column;
    }

    .library-overview > div + div {
        padding-top: 12px;
        padding-left: 0;
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .level-tabs {
        grid-template-columns: repeat(6, 100px);
    }

    .session-facts,
    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .question-stage {
        min-height: 390px;
        padding: 28px;
    }

    .question-meta {
        margin-bottom: 38px;
    }

    .question-stage > h1 {
        font-size: 34px;
    }

    .answer-row {
        grid-template-columns: 1fr;
    }

    .answer-row .button {
        width: 100%;
    }

    .history-header {
        display: none;
    }

    .history-item {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px 14px;
    }

    .profile-xp {
        padding-top: 18px;
        padding-left: 0;
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .profile-hero {
        display: flex;
    }
}

@media (max-width: 520px) {
    .page-content {
        width: calc(100% - 28px);
        padding-top: 25px;
    }

    .page-heading {
        margin-bottom: 24px;
    }

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

    .dashboard-hero {
        padding: 24px;
    }

    .session-orbit {
        align-items: flex-start;
        flex-direction: column;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .weekly-chart {
        gap: 5px;
    }

    .chart-column span {
        width: 18px;
    }

    .category-card {
        min-height: 144px;
        padding: 16px;
    }

    .session-preview {
        grid-template-columns: 1fr;
        padding: 24px;
    }

    .session-facts {
        grid-template-columns: 1fr;
    }

    .learning-header {
        grid-template-columns: 40px minmax(0, 1fr);
    }

    .xp-pill {
        display: none;
    }

    .question-stage {
        min-height: 370px;
        padding: 22px;
    }

    .question-meta {
        margin-bottom: 31px;
    }

    .question-stage > h1 {
        font-size: 30px;
    }

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

    .summary-stat {
        min-height: 124px;
    }

    .summary-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .profile-identity {
        align-items: flex-start;
    }

    .profile-avatar {
        width: 62px;
        height: 62px;
        font-size: 18px;
    }

    .profile-picture-settings,
    .profile-picture-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .profile-picture-actions .button {
        width: 100%;
    }

    .setting-row,
    .select-setting {
        gap: 14px;
        padding: 15px;
    }

    .select-setting {
        align-items: stretch;
        flex-direction: column;
    }

    .select-setting select {
        width: 100%;
    }

    .toast {
        right: 14px;
        bottom: 88px;
    }
}

/* Accounts and data attribution */
.avatar-image,
.profile-avatar-image {
    object-fit: cover;
}

.profile-link > span:not(.avatar),
.profile-link strong,
.profile-link small {
    min-width: 0;
}

.profile-link strong,
.profile-link small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-layout {
    display: grid;
    min-height: min(640px, calc(100vh - 170px));
    place-items: center;
}

.auth-panel {
    width: min(100%, 510px);
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.auth-heading {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 24px;
}

.auth-heading h1 {
    margin-top: 3px;
    font-size: 27px;
}

.auth-heading p:last-child {
    margin: 6px 0 0;
    color: var(--text-soft);
    font-size: 13px;
}

.auth-form,
.profile-form {
    display: grid;
    gap: 16px;
}

.account-type-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.account-type-fieldset legend {
    margin-bottom: 7px;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
}

.account-type-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.account-type-option {
    position: relative;
    display: block;
    cursor: pointer;
}

.auth-form .account-type-option > input {
    position: absolute;
    width: 1px;
    height: 1px;
    min-height: 0;
    padding: 0;
    border: 0;
    opacity: 0;
}

.account-type-card {
    display: grid;
    min-height: 112px;
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    padding: 13px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.account-type-card .icon-tile {
    width: 40px;
    height: 40px;
}

.account-type-card > span:last-child {
    display: grid;
    gap: 4px;
}

.account-type-card strong {
    color: var(--text);
    font-size: 13px;
}

.account-type-card small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.45;
}

.account-type-option > input:checked + .account-type-card {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 14%, transparent);
}

.account-type-option > input:focus-visible + .account-type-card {
    outline: 3px solid color-mix(in srgb, var(--primary) 28%, transparent);
    outline-offset: 2px;
}

.auth-form label,
.profile-form label {
    display: grid;
    gap: 6px;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
}

.auth-form label small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

.auth-form input,
.auth-form select,
.profile-form input,
.profile-form select {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 11px 13px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}

.account-language-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.profile-form input:disabled {
    background: var(--surface-subtle);
    color: var(--muted);
}

.profile-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.profile-badges .status-badge svg {
    width: 14px;
    height: 14px;
}

.form-message {
    margin-bottom: 18px;
    padding: 11px 13px;
    border: 1px solid;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 650;
}

.form-message-error {
    border-color: color-mix(in srgb, var(--red) 34%, var(--line));
    background: var(--red-soft);
    color: var(--red);
}

.form-message-success {
    border-color: color-mix(in srgb, var(--primary) 30%, var(--line));
    background: var(--primary-soft);
    color: var(--primary-ink);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 21px 0;
    color: var(--muted);
    font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
    height: 1px;
    flex: 1;
    background: var(--line);
    content: "";
}

.google-button {
    position: relative;
}

.google-mark {
    display: inline-flex;
    width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #ffffff;
    color: #3c4043;
    font-size: 12px;
    font-weight: 800;
}

.auth-note,
.auth-switch {
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.auth-note {
    margin: 10px 0 0;
}

.auth-switch {
    margin: 22px 0 0;
}

.auth-switch a {
    color: var(--primary);
    font-weight: 750;
}

.profile-account {
    margin-top: 24px;
}

.profile-account > .form-message {
    margin: 16px 20px 0;
}

.profile-picture-settings {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
}

.profile-picture-settings > div:first-child {
    display: grid;
    gap: 4px;
}

.profile-picture-settings strong {
    font-size: 13px;
}

.profile-picture-settings small {
    color: var(--muted);
    font-size: 11px;
}

.profile-picture-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.profile-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 20px;
}

.profile-form-actions {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 4px;
}

.profile-role-field {
    grid-column: 1 / -1;
}

.account-provider {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.account-provider svg {
    width: 17px;
    color: var(--primary);
}

.logout-form {
    display: flex;
    justify-content: flex-end;
    padding: 15px 20px;
    border-top: 1px solid var(--line);
}

.profile-danger {
    margin-top: 24px;
    border-color: color-mix(in srgb, var(--red) 28%, var(--line));
}

.icon-tile-danger {
    background: var(--red-soft);
    color: var(--red);
}

.delete-account-form {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 20px 20px;
    border-top: 1px solid var(--line);
}

.delete-confirmation {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.5;
}

.delete-confirmation input {
    width: 17px;
    height: 17px;
    margin-top: 1px;
    accent-color: var(--red);
}

.button-danger {
    border-color: var(--red);
    background: var(--red);
    color: #ffffff;
}

.button-danger:hover {
    border-color: color-mix(in srgb, var(--red) 82%, #000000);
    background: color-mix(in srgb, var(--red) 82%, #000000);
}

.account-deleted-panel {
    display: grid;
    justify-items: start;
    gap: 12px;
}

.account-deleted-panel h1,
.account-deleted-panel p {
    margin: 0;
}

.account-deleted-panel .button {
    margin-top: 8px;
}

.progress-save-state {
    display: flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
    font-size: 13px;
    font-weight: 700;
}

.progress-save-state .is-saving {
    color: var(--muted);
}

.progress-save-state .is-saved {
    color: var(--green);
}

.progress-save-state .is-error {
    color: var(--red);
}

.source-list {
    display: grid;
    width: min(100%, 820px);
    gap: 16px;
}

.source-list .text-link {
    display: inline-flex;
    margin: 18px 20px 20px;
}

.data-note {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 16px 18px;
    border-left: 3px solid var(--primary);
    background: var(--primary-soft);
    color: var(--primary-ink);
}

.data-note p {
    margin: 0;
    font-size: 13px;
}

.page-footer a:hover {
    color: var(--primary);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

.managed-plan-note {
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.managed-plan-note svg {
    width: 17px;
}

.class-management-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 350px);
    align-items: start;
    gap: 22px;
}

.class-roster {
    min-width: 0;
}

.class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.class-card {
    display: grid;
    min-width: 0;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.class-card-heading {
    display: flex;
    align-items: center;
    gap: 9px;
}

.class-language {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.class-card-copy h3,
.class-card-copy p {
    margin: 0;
}

.class-card-copy h3 {
    overflow-wrap: anywhere;
    font-size: 19px;
}

.class-card-copy p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.class-card-stats {
    display: grid;
    grid-template-columns: minmax(52px, 0.75fr) minmax(72px, 1fr) minmax(84px, 1.2fr);
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--line);
}

.class-card-stats > span {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 10px;
    background: var(--surface-subtle);
}

.class-card-stats small {
    color: var(--muted);
    font-size: 9px;
}

.class-card-stats strong {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.class-card > .button {
    justify-self: start;
}

.add-class-panel {
    position: sticky;
    top: 22px;
}

.add-class-form {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.add-class-form label {
    display: grid;
    gap: 6px;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 750;
}

.add-class-form input,
.add-class-form select {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 18px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.back-link:hover {
    color: var(--primary);
}

.back-link svg {
    width: 16px;
}

.class-page-heading .page-lead {
    display: flex;
    align-items: center;
    gap: 7px;
}

.language-chip-inline {
    display: inline-grid;
    width: 30px;
    height: 24px;
    font-size: 10px;
}

.class-heading-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
}

.class-danger-zone {
    display: flex;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.button-danger-text {
    color: var(--red);
}

.button-danger-text:hover {
    border-color: color-mix(in srgb, var(--red) 35%, var(--line));
    background: var(--red-soft);
    color: var(--red);
}

.library-class-empty {
    min-height: 340px;
}

.student-management-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(310px, 370px);
    align-items: start;
    gap: 22px;
}

.student-management-single {
    grid-template-columns: minmax(0, 1fr);
}

.create-student-form {
    flex: 0 0 auto;
}

.generated-credentials {
    display: grid;
    grid-template-columns: auto minmax(220px, 0.75fr) minmax(420px, 1.25fr);
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
    padding: 20px;
    border: 1px solid color-mix(in srgb, var(--primary) 32%, var(--line));
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.generated-credentials-heading p:last-child {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.credential-values {
    display: grid;
    gap: 8px;
}

.credential-values > div {
    display: grid;
    min-width: 0;
    grid-template-columns: 52px minmax(0, 1fr) 40px;
    align-items: center;
    gap: 9px;
}

.credential-values span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
}

.credential-values code {
    overflow: hidden;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-subtle);
    color: var(--text);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.credential-values code:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--blue) 42%, transparent);
    outline-offset: 2px;
}

.student-roster {
    min-width: 0;
}

.student-list {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.student-row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(190px, 1fr) minmax(230px, 1.1fr);
    gap: 16px 24px;
    padding: 18px;
}

.student-row + .student-row {
    border-top: 1px solid var(--line);
}

.student-identity,
.matrix-student {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
}

.student-identity > span:last-child,
.matrix-student > span:last-child {
    display: grid;
    min-width: 0;
}

.student-identity strong,
.student-identity small,
.matrix-student strong,
.matrix-student small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.student-identity strong,
.matrix-student strong {
    color: var(--text);
    font-size: 14px;
}

.student-identity small,
.matrix-student small {
    color: var(--muted);
    font-size: 11px;
}

.student-mini-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.student-mini-stats > span {
    display: grid;
    align-content: center;
    min-width: 0;
}

.student-mini-stats strong {
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.student-mini-stats small {
    color: var(--muted);
    font-size: 10px;
}

.student-plan-form {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(130px, 190px) 1fr;
    align-items: end;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.student-plan-summary {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--line);
}

.student-plan-summary > span {
    display: grid;
    gap: 3px;
    padding: 11px 13px;
    background: var(--surface-subtle);
}

.student-plan-summary small {
    color: var(--muted);
    font-size: 10px;
}

.student-plan-summary strong {
    color: var(--text);
    font-size: 13px;
}

.student-plan-form label,
.add-student-form label {
    display: grid;
    gap: 6px;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 750;
}

.student-plan-form select,
.add-student-form input,
.add-student-form select {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}

.student-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.student-row-actions .button {
    min-height: 40px;
}

.student-security-actions {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.student-security-actions form:first-child {
    margin-right: auto;
}

.student-credentials-button {
    min-height: 40px;
}

.icon-button-danger {
    color: var(--red);
}

.icon-button-danger:hover {
    border-color: color-mix(in srgb, var(--red) 35%, var(--line));
    background: var(--red-soft);
    color: var(--red);
}

.student-empty-state {
    min-height: 300px;
}

.add-student-panel {
    position: sticky;
    top: 22px;
}

.add-student-form {
    display: grid;
    gap: 14px;
    padding: 20px;
}

.add-student-form label small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 500;
}

.add-student-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.educator-metrics,
.educator-progress-metrics {
    margin-bottom: 22px;
}

.educator-progress-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.educator-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(290px, 0.7fr);
    align-items: start;
    gap: 18px;
}

.compact-empty {
    display: grid;
    min-height: 180px;
    place-items: center;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.educator-activity-list {
    max-height: clamp(150px, calc(100dvh - 570px), 480px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    margin: 8px -24px -24px;
}

.educator-activity-list:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--blue) 42%, transparent);
    outline-offset: -3px;
}

.educator-activity-row {
    display: grid;
    grid-template-columns: auto minmax(150px, 1fr) minmax(60px, auto) minmax(60px, auto);
    align-items: center;
    gap: 12px;
    min-height: 68px;
    padding: 11px 24px;
    border-top: 1px solid var(--line);
}

.educator-activity-row > span:not(.avatar) {
    display: grid;
    min-width: 0;
}

.educator-activity-row strong {
    color: var(--text);
    font-size: 13px;
}

.educator-activity-row small {
    color: var(--muted);
    font-size: 10px;
}

.educator-activity-name strong,
.educator-activity-name small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.matrix-student-details {
    display: flex;
    align-items: center;
    gap: 8px;
}

.student-accuracy {
    --accuracy: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: hsl(calc(var(--accuracy) * 1.2) 68% 34%);
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.student-accuracy > span {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: hsl(calc(var(--accuracy) * 1.2) 68% 42%);
}

.student-accuracy.is-empty {
    color: var(--muted);
}

.student-accuracy.is-empty > span {
    background: var(--line-strong);
}

.educator-actions {
    display: grid;
}

.educator-actions h2 {
    margin-bottom: 14px;
}

.educator-actions > a {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 11px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
    color: var(--text-soft);
    text-decoration: none;
}

.educator-actions > a > span {
    display: grid;
}

.educator-actions > a strong {
    color: var(--text);
    font-size: 13px;
}

.educator-actions > a small {
    color: var(--muted);
    font-size: 10px;
}

.educator-actions > a > svg:first-child {
    color: var(--primary);
}

.educator-actions > a > svg:last-child {
    width: 16px;
    color: var(--muted);
}

.segmented-control {
    display: inline-grid;
    grid-auto-flow: column;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-strong);
}

.segmented-control a {
    min-width: 70px;
    padding: 7px 10px;
    border-radius: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
    text-align: center;
    text-decoration: none;
}

.segmented-control a.is-active {
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    color: var(--text);
}

.student-activity-scroll {
    overflow: auto;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.student-activity-matrix {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
}

.student-activity-matrix th,
.student-activity-matrix td {
    height: 58px;
    padding: 8px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    text-align: center;
}

.student-activity-matrix thead th {
    height: 46px;
    background: var(--surface-subtle);
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
    white-space: nowrap;
}

.student-activity-matrix tr:last-child > * {
    border-bottom: 0;
}

.student-activity-matrix tr > *:last-child {
    border-right: 0;
}

.student-activity-matrix th:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 210px;
    min-width: 210px;
    max-width: 210px;
    background: var(--surface);
    text-align: left;
}

.student-activity-matrix thead th:first-child {
    z-index: 3;
    background: var(--surface-subtle);
}

.student-activity-matrix thead th:not(:first-child) {
    width: 62px;
    min-width: 62px;
}

.student-activity-matrix .is-today {
    box-shadow: inset 0 2px 0 var(--blue);
}

.session-cell span {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 6px;
    background: var(--surface-subtle);
    color: var(--muted);
    font-weight: 800;
}

.session-cell-1 span {
    background: var(--blue-soft);
    color: var(--blue);
}

.session-cell-2 span {
    background: var(--primary-soft);
    color: var(--primary-ink);
}

.session-cell-3 span {
    background: var(--amber-soft);
    color: var(--amber);
}

.session-cell-4 span {
    background: var(--coral-soft);
    color: var(--coral);
}

.session-total {
    min-width: 66px;
    background: var(--surface-subtle);
    color: var(--text);
}

.student-library-target {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;
    margin: -8px 0 22px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.student-library-target > div {
    display: grid;
}

.student-library-target small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 750;
    text-transform: uppercase;
}

.student-library-target strong {
    font-size: 15px;
}

.student-library-target > div > span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.student-library-target select {
    width: 100%;
}

.class-library-selector {
    min-width: 220px;
}

.report-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: -6px 0 22px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.report-filter-bar > div {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
}

.report-filter-bar > div > span:last-child {
    display: grid;
    min-width: 0;
}

.report-filter-bar small,
.ranking-control-group > span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 750;
    text-transform: uppercase;
}

.report-filter-bar strong {
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-filter-bar form {
    width: min(300px, 42vw);
}

.report-filter-bar select {
    width: 100%;
}

.ranking-controls {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.ranking-control-group {
    display: grid;
    gap: 7px;
}

.ranking-sort-control a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.ranking-sort-control svg {
    width: 15px;
    height: 15px;
}

.ranking-section {
    margin-top: 0;
}

.ranking-count {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.ranking-table-scroll {
    max-width: 100%;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.ranking-table {
    width: 100%;
    min-width: 680px;
    border-collapse: separate;
    border-spacing: 0;
}

.ranking-table th,
.ranking-table td {
    height: 68px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.ranking-table thead th {
    height: 46px;
    background: var(--surface-subtle);
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
    white-space: nowrap;
}

.ranking-table tr:last-child > * {
    border-bottom: 0;
}

.ranking-table th:first-child,
.ranking-table td:first-child {
    width: 66px;
    text-align: center;
}

.ranking-table th:nth-child(2) {
    width: 42%;
}

.ranking-table thead .is-sorted,
.ranking-table .ranking-value.is-sorted {
    background: var(--primary-soft);
    color: var(--primary-ink);
}

.ranking-table tr.is-current-user > * {
    box-shadow: inset 0 1px 0 var(--success), inset 0 -1px 0 var(--success);
}

.ranking-position {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    background: var(--surface-strong);
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 850;
}

.ranking-position-1 {
    background: var(--amber-soft);
    color: var(--amber);
}

.ranking-position-2 {
    background: var(--blue-soft);
    color: var(--blue);
}

.ranking-position-3 {
    background: var(--coral-soft);
    color: var(--coral);
}

.ranking-user {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
    color: inherit;
    text-decoration: none;
}

.ranking-user:hover strong {
    color: var(--primary);
}

.ranking-user > span:last-child {
    display: grid;
    min-width: 0;
}

.ranking-user strong {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-user small,
.ranking-value small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
}

.ranking-value {
    min-width: 118px;
}

.ranking-value strong,
.ranking-value small {
    display: block;
}

.ranking-value strong {
    font-size: 15px;
}

.friends-section {
    margin-top: 0;
}

.friend-list {
    border-top: 1px solid var(--line);
}

.friend-row,
.friend-search-result {
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--line);
}

.friend-identity {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.friend-identity > span:last-child {
    display: grid;
    min-width: 0;
}

.friend-identity strong {
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.friend-identity:hover strong {
    color: var(--primary);
}

.friend-identity small {
    color: var(--muted);
    font-size: 11px;
}

.friend-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.friend-row-actions form {
    display: flex;
}

.friend-remove-button {
    color: var(--red);
}

.friend-search-dialog {
    width: min(680px, calc(100vw - 30px));
    max-height: min(760px, calc(100vh - 30px));
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
    color: var(--text);
}

.friend-search-dialog::backdrop {
    background: rgba(27, 16, 35, 0.56);
}

.friend-search-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--line);
}

.friend-search-heading h2 {
    margin-top: 2px;
    font-size: 19px;
}

.friend-search-form {
    display: grid;
    gap: 7px;
    padding: 20px 22px 16px;
}

.friend-search-form > label {
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 750;
}

.friend-search-form > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
}

.friend-search-form input {
    width: 100%;
}

.friend-search-results {
    max-height: 430px;
    padding: 0 22px 20px;
    overflow: auto;
}

.friend-search-empty {
    display: flex;
    min-height: 120px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.friend-state {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--success);
    font-size: 11px;
    font-weight: 750;
}

.friend-state svg {
    width: 15px;
    height: 15px;
}

.friend-state-pending {
    color: var(--amber);
}

.public-profile-heading .back-link {
    margin-bottom: 14px;
}

.public-profile-hero {
    margin-bottom: 22px;
}

.public-profile-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 30px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.public-profile-stats > div {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
    padding: 18px;
}

.public-profile-stats > div + div {
    border-left: 1px solid var(--line);
}

.public-profile-stats svg {
    color: var(--primary);
}

.public-profile-stats span {
    display: grid;
}

.public-profile-stats strong {
    font-size: 18px;
}

.public-profile-stats small {
    color: var(--muted);
    font-size: 10px;
}

.public-course-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 24px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.public-course-band h2 {
    margin: 3px 0 5px;
    font-size: 20px;
}

.public-course-band p:last-child {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.managed-plan-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.managed-plan-summary > span {
    display: grid;
    gap: 3px;
    padding: 18px 20px;
}

.managed-plan-summary > span + span {
    border-left: 1px solid var(--line);
}

.managed-plan-summary small {
    color: var(--muted);
    font-size: 11px;
}

.managed-plan-summary strong {
    color: var(--text);
    font-size: 18px;
}

.managed-account-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 20px;
    padding: 20px;
}

.managed-account-details > div {
    display: grid;
    gap: 5px;
}

.managed-account-details > div > span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
}

.managed-account-details strong,
.managed-account-details code {
    color: var(--text);
    font-size: 14px;
}

.managed-account-details p {
    display: flex;
    grid-column: 1 / -1;
    align-items: flex-start;
    gap: 8px;
    margin: 4px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.managed-account-details p svg {
    width: 17px;
    color: var(--primary);
}

@media (max-width: 700px) {
    .auth-layout {
        min-height: auto;
        place-items: start stretch;
    }

    .profile-form {
        grid-template-columns: 1fr;
    }

    .profile-form-actions {
        grid-column: auto;
        align-items: stretch;
        flex-direction: column;
    }

    .delete-account-form {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 520px) {
    .auth-panel {
        padding: 22px;
    }

    .auth-heading {
        align-items: flex-start;
    }

    .account-type-options {
        grid-template-columns: 1fr;
    }

    .account-language-fields {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1120px) {
    .student-management-layout,
    .class-management-layout,
    .educator-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .add-student-panel {
        position: static;
    }

    .add-class-panel {
        position: static;
    }

    .generated-credentials {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .credential-values {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .primary-nav {
        grid-template-columns: repeat(var(--nav-count, 6), minmax(0, 1fr));
    }

    .educator-progress-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .profile-hero-side {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .profile-hero-side .profile-xp {
        width: 100%;
    }

    .profile-hero-side > .button {
        width: 100%;
    }

    .public-profile-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .public-profile-stats > div:nth-child(3) {
        border-left: 0;
    }

    .public-profile-stats > div:nth-child(n + 3) {
        border-top: 1px solid var(--line);
    }

    .report-filter-bar,
    .ranking-controls {
        align-items: stretch;
        flex-direction: column;
    }

    .report-filter-bar form {
        width: 100%;
    }

    .ranking-controls {
        gap: 16px;
    }

    .ranking-control-group .segmented-control {
        width: 100%;
    }

    .ranking-control-group .segmented-control a {
        min-width: 0;
    }

    .class-heading-actions {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .class-heading-actions .button,
    .class-heading-actions form,
    .class-heading-actions form .button {
        width: 100%;
    }

    .student-row {
        grid-template-columns: 1fr;
    }

    .student-plan-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .student-row-actions {
        grid-column: 1 / -1;
        justify-content: stretch;
    }

    .student-row-actions .button {
        flex: 1;
    }

    .student-library-target {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .student-library-target > label,
    .student-library-target > .button,
    .student-library-target > form {
        grid-column: 1 / -1;
    }

    .class-library-selector {
        min-width: 0;
    }

    .educator-progress-metrics {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .friend-row,
    .friend-search-result {
        align-items: stretch;
        flex-direction: column;
    }

    .friend-row-actions,
    .friend-search-result > form,
    .friend-search-result > form .button {
        width: 100%;
    }

    .friend-row-actions .icon-button {
        flex: 1;
    }

    .friend-search-form > div {
        grid-template-columns: 1fr;
    }

    .friend-search-form .button {
        width: 100%;
    }

    .public-profile-stats {
        grid-template-columns: 1fr;
    }

    .public-profile-stats > div + div,
    .public-profile-stats > div:nth-child(3) {
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .nav-link {
        font-size: 9px;
    }

    .nav-link > span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ranking-sort-control a {
        gap: 4px;
        padding-inline: 6px;
    }

    .ranking-table th,
    .ranking-table td {
        padding-inline: 12px;
    }

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

    .class-card-stats {
        grid-template-columns: 1fr;
    }

    .class-card > .button {
        width: 100%;
    }

    .student-row {
        padding: 16px 14px;
    }

    .student-mini-stats,
    .student-plan-form,
    .student-plan-summary,
    .add-student-fields,
    .managed-plan-summary,
    .managed-account-details {
        grid-template-columns: 1fr;
    }

    .generated-credentials {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .generated-credentials .icon-tile,
    .credential-values {
        grid-column: auto;
    }

    .credential-values > div {
        grid-template-columns: minmax(0, 1fr) 40px;
    }

    .credential-values > div > span {
        grid-column: 1 / -1;
    }

    .managed-account-details p {
        grid-column: auto;
    }

    .student-mini-stats {
        gap: 12px;
    }

    .student-row-actions {
        flex-wrap: wrap;
    }

    .student-security-actions {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .student-security-actions form:first-child {
        width: 100%;
        margin-right: 0;
    }

    .student-credentials-button {
        width: 100%;
    }

    .settings-form-actions {
        padding: 0 15px 15px;
    }

    .settings-form-actions .button {
        width: 100%;
    }

    .confirm-dialog-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .confirm-dialog-actions .button {
        width: 100%;
    }

    .managed-plan-summary > span + span {
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .segmented-control {
        width: 100%;
    }

    .segmented-control a {
        min-width: 0;
    }

    .student-activity-matrix th:first-child {
        width: 180px;
        min-width: 180px;
        max-width: 180px;
    }

    .educator-activity-list {
        max-height: 320px;
    }
}

.icon-tile-rose {
    background: var(--coral-soft);
    color: var(--coral);
}

.level-chip {
    display: inline-flex;
    min-width: 34px;
    min-height: 26px;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-subtle);
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 800;
}

.grammar-unavailable {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 20px;
    padding: 28px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.grammar-unavailable h2 {
    margin-bottom: 5px;
}

.grammar-unavailable p:last-child {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.grammar-overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(250px, 340px);
    align-items: center;
    gap: 36px;
    padding: 26px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.grammar-overview-main {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 18px;
}

.grammar-chapter-mark {
    display: inline-flex;
    width: 64px;
    height: 64px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--blue) 30%, var(--line));
    border-radius: 8px;
    background: var(--blue-soft);
    color: var(--blue);
}

.grammar-chapter-mark svg {
    width: 30px;
    height: 30px;
}

.grammar-overview-main h2 {
    font-size: 28px;
}

.grammar-overview-main p:last-child {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.grammar-overview-progress {
    display: grid;
    gap: 7px;
}

.grammar-overview-progress > span {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
}

.grammar-overview-progress > span strong {
    color: var(--text);
    font-size: 22px;
}

.grammar-overview-progress .progress-track {
    margin: 0;
}

.grammar-overview-progress small {
    color: var(--muted);
    font-size: 11px;
}

.grammar-curriculum .section-heading p:last-child,
.grammar-mode-section .section-heading p:last-child {
    max-width: 680px;
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.grammar-tense-list {
    border-top: 1px solid var(--line);
}

.grammar-tense-row {
    display: grid;
    min-height: 86px;
    grid-template-columns: 48px minmax(0, 1fr) auto 24px;
    align-items: center;
    gap: 15px;
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    transition: background-color 160ms ease;
}

.grammar-tense-row:hover {
    background: var(--surface-subtle);
}

.grammar-tense-index {
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
}

.grammar-tense-row.is-complete .grammar-tense-index {
    border-color: color-mix(in srgb, var(--success) 30%, var(--line));
    background: var(--success-soft);
    color: var(--success);
}

.grammar-tense-index svg {
    width: 18px;
}

.grammar-tense-copy {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.grammar-tense-title-line {
    display: flex;
    align-items: center;
    gap: 9px;
}

.grammar-tense-title-line strong {
    font-size: 16px;
}

.grammar-tense-copy > small {
    color: var(--muted);
    font-size: 12px;
}

.grammar-mode-dots {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.grammar-mode-dots > span {
    width: 10px;
    height: 10px;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: var(--surface);
}

.grammar-mode-dots > span.is-complete {
    border-color: var(--success);
    background: var(--success);
}

.grammar-tense-chevron {
    width: 18px;
    color: var(--muted);
}

.grammar-tense-heading {
    max-width: 840px;
}

.grammar-tense-heading .back-link {
    margin-bottom: 20px;
}

.grammar-tense-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.grammar-tense-title .level-chip {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    color: var(--primary-ink);
    font-size: 13px;
}

.grammar-reference-band {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 34px;
    padding: 24px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.grammar-token-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.grammar-token-list li,
.grammar-signal-list code {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    padding: 5px 10px;
    border-radius: 6px;
    background: var(--surface-strong);
    color: var(--text-soft);
    font-size: 11px;
}

.grammar-signal-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.grammar-signal-list code {
    border: 1px solid color-mix(in srgb, var(--blue) 22%, var(--line));
    background: var(--blue-soft);
    color: var(--blue);
}

.grammar-mode-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.grammar-mode-card {
    display: flex;
    min-width: 0;
    min-height: 380px;
    padding: 20px;
    border: 1px solid var(--line);
    border-top: 3px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    flex-direction: column;
}

.grammar-mode-card.is-complete {
    border-top-color: var(--success);
}

.grammar-mode-card-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.grammar-mode-card-heading > div {
    display: grid;
    gap: 3px;
}

.grammar-mode-card-heading h3 {
    font-size: 16px;
}

.grammar-mode-card-heading span:not(.icon-tile) {
    color: var(--muted);
    font-size: 11px;
}

.grammar-complete-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--success) !important;
    font-weight: 750;
}

.grammar-complete-label svg {
    width: 14px;
    height: 14px;
}

.grammar-formula,
.grammar-example {
    display: grid;
    gap: 7px;
}

.grammar-formula {
    min-height: 94px;
    padding: 13px;
    border-left: 3px solid var(--blue);
    border-radius: 0 6px 6px 0;
    background: var(--blue-soft);
}

.grammar-formula small,
.grammar-example small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.grammar-formula code {
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.grammar-example {
    min-height: 82px;
    padding: 17px 2px;
}

.grammar-example p {
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
}

.grammar-mode-card > .button {
    margin-top: auto;
}

.grammar-learning-screen {
    padding-top: 4px;
}

.grammar-question-stage > h1 {
    min-height: 76px;
    max-width: 780px;
    font-size: 30px;
}

.grammar-feedback {
    min-height: 24px;
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.grammar-management-overview {
    display: flex;
    align-items: center;
    gap: 12px 32px;
    margin: -6px 0 24px;
    padding: 15px 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.grammar-management-overview > div {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
}

.grammar-management-overview > div + div {
    padding-left: 32px;
    border-left: 1px solid var(--line);
}

.grammar-management-overview > div > span:last-child {
    display: grid;
}

.grammar-management-overview strong {
    font-size: 14px;
}

.grammar-management-overview small {
    color: var(--muted);
    font-size: 11px;
}

.grammar-management-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    align-items: start;
    gap: 22px;
}

.grammar-management-content {
    min-width: 0;
}

.grammar-assignment-heading {
    align-items: flex-end;
}

.grammar-assignment-heading p:last-child {
    max-width: 680px;
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.grammar-assignment-list {
    border-top: 1px solid var(--line);
}

.grammar-assignment-row {
    display: grid;
    min-height: 112px;
    grid-template-columns: 48px minmax(180px, 1fr) minmax(360px, 1.35fr);
    align-items: center;
    gap: 15px;
    padding: 14px 10px;
    border-bottom: 1px solid var(--line);
}

.grammar-assignment-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}

.grammar-assignment-option {
    min-width: 0;
    cursor: pointer;
}

.grammar-assignment-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.grammar-assignment-option span {
    display: flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-subtle);
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 750;
    text-align: center;
    transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.grammar-assignment-option span svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
}

.grammar-assignment-option input:focus-visible + span {
    outline: 3px solid color-mix(in srgb, var(--primary) 25%, transparent);
    outline-offset: 2px;
}

.grammar-assignment-option input:checked + span {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
    background: var(--primary-soft);
    color: var(--primary-ink);
}

.grammar-selection-description {
    margin: 16px 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.grammar-selection-panel .button {
    width: 100%;
}

.grammar-assignment-empty {
    margin-top: 10px;
}

.grammar-mode-card.is-unassigned {
    border-top-color: var(--line);
    background: var(--surface-subtle);
    box-shadow: none;
}

.grammar-mode-card.is-unassigned .grammar-formula,
.grammar-mode-card.is-unassigned .grammar-example {
    opacity: 0.56;
}

.grammar-unassigned-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--muted) !important;
    font-weight: 750;
}

.grammar-unassigned-label svg {
    width: 13px;
    height: 13px;
}

.grammar-mask-example {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    margin: 14px 18px 18px;
    padding: 14px;
    border: 1px dashed var(--line-strong);
    border-radius: 6px;
    background: var(--surface-subtle);
}

.grammar-mask-example > span {
    display: grid;
    gap: 4px;
}

.grammar-mask-example > span:first-child {
    color: var(--muted);
}

.grammar-mask-example > span:last-child strong {
    color: var(--primary-ink);
}

.grammar-mask-example span {
    font-size: 10px;
}

.grammar-mask-example strong {
    color: var(--text);
    font-size: 13px;
}

.grammar-mask-example > svg {
    width: 17px;
    color: var(--muted);
}

@media (max-width: 1120px) {
    .grammar-mode-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grammar-management-layout {
        grid-template-columns: 1fr;
    }

    .grammar-selection-panel {
        position: static;
    }
}

@media (max-width: 700px) {
    .grammar-unavailable,
    .grammar-overview,
    .grammar-reference-band {
        grid-template-columns: 1fr;
    }

    .grammar-unavailable {
        align-items: start;
    }

    .grammar-unavailable .button {
        width: 100%;
    }

    .grammar-mode-grid {
        grid-template-columns: 1fr;
    }

    .grammar-management-overview {
        align-items: stretch;
        flex-direction: column;
    }

    .grammar-management-overview > div + div {
        padding: 12px 0 0;
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .grammar-assignment-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .grammar-check-all {
        align-self: flex-start;
    }

    .grammar-assignment-row {
        grid-template-columns: 42px minmax(0, 1fr);
        gap: 11px;
        padding-inline: 4px;
    }

    .grammar-assignment-options {
        grid-column: 1 / -1;
    }

    .grammar-mode-card {
        min-height: 0;
    }

    .grammar-tense-row {
        grid-template-columns: 42px minmax(0, 1fr) 20px;
        gap: 11px;
        padding-inline: 4px;
    }

    .grammar-mode-dots {
        grid-column: 2;
    }

    .grammar-tense-chevron {
        grid-column: 3;
        grid-row: 1 / span 2;
    }

    .grammar-question-stage > h1 {
        font-size: 26px;
    }

    .grammar-mask-example {
        grid-template-columns: 1fr;
    }

    .grammar-mask-example > svg {
        transform: rotate(90deg);
    }
}

@media (max-width: 520px) {
    .grammar-overview-main {
        align-items: flex-start;
    }

    .grammar-chapter-mark {
        width: 50px;
        height: 50px;
    }

    .grammar-tense-copy > small {
        font-size: 11px;
    }

    .grammar-tense-title {
        align-items: flex-start;
    }

    .grammar-question-stage > h1 {
        min-height: 96px;
        font-size: 23px;
    }

    .primary-nav {
        gap: 0;
    }

    .nav-link {
        padding-inline: 0;
        font-size: 8px;
    }

    .nav-link > span {
        max-height: 17px;
        overflow: visible;
        line-height: 1.05;
        text-align: center;
        text-overflow: clip;
        white-space: normal;
    }
}
