:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --green: #16a34a;
    --yellow: #f59e0b;
    --purple: #8b5cf6;
    --danger: #ef4444;
    --shadow: 0 16px 45px rgba(15, 23, 42, .08);
    --shadow-soft: 0 8px 24px rgba(15, 23, 42, .06);
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--background);
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text-main);
    background: var(--background);
    line-height: 1.45;
    letter-spacing: 0;
}

img,
video,
canvas {
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled,
.btn:disabled {
    cursor: not-allowed;
    opacity: .68;
}

.topbar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 50;
    height: 76px;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
}

.topbar__inner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 24px;
    max-width: 1760px;
    height: 100%;
    margin: 0 auto;
    padding: 0 32px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    min-width: max-content;
    color: var(--primary);
    font-size: 28px;
    font-weight: 800;
}

.brand__mark {
    display: inline-grid;
    place-items: center;
    width: 52px;
    height: 52px;
    color: var(--primary);
    border: 3px solid var(--primary);
    border-radius: 50%;
    background: #eff6ff;
}

.brand__mark svg {
    width: 30px;
    height: 30px;
}

.main-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    min-width: 0;
}

.main-nav__item {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 76px;
    padding: 0 10px;
    color: #24324f;
    font-weight: 700;
    white-space: nowrap;
    transition: color .18s ease;
}

.main-nav__item svg {
    width: 20px;
    height: 20px;
}

.main-nav__item:hover,
.main-nav__item.is-active {
    color: var(--primary);
}

.main-nav__item.is-active::after {
    position: absolute;
    right: 4px;
    bottom: 0;
    left: 4px;
    height: 3px;
    content: "";
    background: var(--primary);
    border-radius: 999px 999px 0 0;
}

.topbar__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    min-width: 0;
}

.topbar .topbar__menu {
    display: none;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    color: #334155;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 12px;
    transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.icon-button:hover {
    color: var(--primary);
    background: #eff6ff;
    border-color: #bfdbfe;
}

.notification-button {
    position: relative;
}

.notification-button span {
    position: absolute;
    top: 5px;
    right: 5px;
    display: grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    background: var(--danger);
    border-radius: 999px;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: #172554;
    font-weight: 700;
    background: transparent;
    border: 0;
    border-radius: 12px;
    padding: 4px 6px 4px 4px;
    transition: background .18s ease, color .18s ease;
}

.user-chip:hover,
.account-menu.is-open .user-chip {
    color: var(--primary);
    background: #eff6ff;
}

.user-chip img {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #e0f2fe;
}

.user-chip span {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-menu {
    position: relative;
    flex: 0 0 auto;
}

.account-menu__dropdown {
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    z-index: 70;
    display: none;
    width: 320px;
    max-width: calc(100vw - 32px);
    padding: 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.account-menu.is-open .account-menu__dropdown {
    display: grid;
    gap: 12px;
    animation: toastIn .18s ease;
}

.account-card {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.account-card img {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border: 2px solid #dbeafe;
    border-radius: 50%;
}

.account-card strong,
.account-card span,
.account-card em {
    display: block;
    min-width: 0;
}

.account-card strong {
    overflow: hidden;
    color: var(--text-main);
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-card span {
    overflow: hidden;
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-card em {
    width: max-content;
    margin-top: 7px;
    padding: 3px 8px;
    color: var(--primary);
    font-size: 12px;
    font-style: normal;
    font-weight: 800;
    background: #dbeafe;
    border-radius: 999px;
}

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

.account-stats div {
    padding: 10px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.account-stats span {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.account-stats strong {
    display: block;
    margin-top: 3px;
    font-size: 18px;
}

.account-menu__links,
.account-logout {
    display: grid;
    gap: 8px;
}

.account-menu__links a,
.account-logout button {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 9px 10px;
    color: #334155;
    font-weight: 800;
    text-align: left;
    background: #fff;
    border: 1px solid transparent;
    border-radius: 10px;
    transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.account-menu__links a:hover {
    color: var(--primary);
    background: #eff6ff;
    border-color: #bfdbfe;
}

.account-logout {
    margin-top: 2px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.account-logout button {
    width: 100%;
    color: #b91c1c;
    border-color: #fecaca;
}

.account-logout button:hover {
    background: #fee2e2;
}

.app-shell {
    max-width: 1760px;
    margin: 0 auto;
    padding: 100px 32px 32px;
}

.panel,
.hero-card,
.login-card,
.login-preview {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.panel {
    padding: 22px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-weight: 800;
    text-align: center;
    transition: transform .16s ease, background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.btn svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 12px 24px rgba(37, 99, 235, .22);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    color: var(--primary);
    background: #fff;
    border-color: #93c5fd;
}

.btn-secondary:hover {
    background: #eff6ff;
    border-color: var(--primary);
}

.btn-danger {
    color: #fff;
    background: #dc2626;
    box-shadow: 0 12px 24px rgba(220, 38, 38, .18);
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-block {
    width: 100%;
}

.btn.is-loading {
    pointer-events: none;
}

.spinner {
    width: 17px;
    height: 17px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 390px;
    gap: 28px;
    align-items: start;
}

.dashboard-main,
.dashboard-sidebar {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.hero-card {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr) 150px;
    align-items: center;
    gap: 28px;
    min-height: 205px;
    padding: 26px 34px 22px;
    background: linear-gradient(100deg, #eff6ff 0%, #fff 48%, #f8fafc 100%);
    border-color: #b9d4ff;
    box-shadow: 0 18px 42px rgba(37, 99, 235, .09);
}

.hero-card__image img {
    width: 235px;
    height: 175px;
    object-fit: contain;
}

.hero-card h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.2;
}

.hero-card h1 span {
    color: var(--primary);
}

.hero-card p {
    margin: 10px 0 18px;
    color: var(--text-secondary);
    font-weight: 500;
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: hidden;
    background: rgba(255, 255, 255, .92);
    border: 1px solid #e5edf7;
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
}

.metric-item {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding: 18px 20px;
}

.metric-item + .metric-item {
    border-left: 1px solid var(--border);
}

.metric-item > svg {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    color: var(--primary);
    stroke-width: 2.2;
}

.metric-item .icon-hot {
    color: #f97316;
}

.metric-item span,
.progress-row span,
.video-status span,
.compact-stats span {
    display: block;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
}

.metric-item strong {
    display: block;
    margin-top: 3px;
    overflow-wrap: anywhere;
    font-size: 20px;
}

.hero-card__progress {
    display: grid;
    justify-items: center;
    gap: 10px;
    color: #172554;
    font-weight: 800;
}

.progress-ring {
    --progress: 0%;
    display: grid;
    place-items: center;
    width: 118px;
    height: 118px;
    background:
        radial-gradient(circle at center, #fff 59%, transparent 60%),
        conic-gradient(var(--primary) var(--progress), #e8eef7 0);
    border-radius: 50%;
}

.progress-ring span {
    color: #0f172a;
    font-size: 27px;
    font-weight: 800;
}

.progress-ring--small {
    width: 92px;
    height: 92px;
}

.progress-ring--small span {
    font-size: 21px;
}

.progress-ring--medium {
    width: 138px;
    height: 138px;
    margin: 14px auto;
}

.learning-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(360px, .88fr);
    gap: 18px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.section-title h2,
.panel h2,
.panel-header h2 {
    margin: 0;
    font-size: 20px;
    line-height: 1.25;
}

.step-badge {
    display: inline-grid;
    place-items: center;
    min-width: 32px;
    height: 32px;
    color: #fff;
    font-weight: 800;
    background: var(--primary);
    border-radius: 9px;
    box-shadow: 0 10px 20px rgba(37, 99, 235, .22);
}

.lesson-card {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 250px;
    gap: 24px;
    align-items: stretch;
    min-width: 0;
}

.lesson-thumb {
    position: relative;
    display: block;
    overflow: hidden;
    min-height: 235px;
    border-radius: 9px;
    background: #dbeafe;
}

.lesson-thumb img {
    width: 100%;
    height: 100%;
    min-height: 235px;
    object-fit: cover;
    transition: transform .22s ease;
}

.lesson-thumb:hover img {
    transform: scale(1.035);
}

.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    place-items: center;
    width: 74px;
    height: 74px;
    color: var(--primary);
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 12px 25px rgba(15, 23, 42, .22);
}

.duration-pill {
    position: absolute;
    right: 12px;
    bottom: 12px;
    padding: 6px 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    background: rgba(15, 23, 42, .78);
    border-radius: 8px;
}

.lesson-card__body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.lesson-card__body h3 {
    margin: 2px 0 0;
    font-size: 22px;
    line-height: 1.25;
}

.pill {
    display: inline-flex;
    align-items: center;
    width: max-content;
    max-width: 100%;
    min-height: 25px;
    padding: 3px 10px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
    background: #dbeafe;
    border-radius: 8px;
}

.meta-line,
.muted {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
}

.progress-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 20px 0 8px;
}

.linear-progress {
    overflow: hidden;
    width: 100%;
    height: 8px;
    background: #e8eef7;
    border-radius: 999px;
}

.linear-progress span {
    display: block;
    height: 100%;
    background: var(--primary);
    border-radius: inherit;
    transition: width .22s ease;
}

.linear-progress--green span {
    background: #22c55e;
}

.mini-flashcard {
    position: relative;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    min-height: 144px;
    padding: 18px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: inset 0 0 0 1px rgba(226, 232, 240, .4);
}

.mini-flashcard > div {
    position: relative;
    min-width: 0;
    text-align: center;
}

.mini-flashcard h3 {
    margin: 0;
    color: var(--primary);
    font-size: 28px;
}

.mini-flashcard p {
    width: max-content;
    max-width: 100%;
    margin: 6px auto 12px;
    padding-bottom: 8px;
    color: #334155;
    border-bottom: 1px solid #dbeafe;
}

.mini-flashcard strong {
    display: inline-block;
    margin-right: 10px;
}

.favorite-star {
    position: absolute;
    top: -4px;
    right: 0;
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    color: var(--yellow);
    background: transparent;
    border: 0;
}

.sound-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-weight: 800;
    background: transparent;
    border: 0;
}

.action-list {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.action-list a {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-weight: 700;
    transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.action-list a:hover {
    background: #f8fbff;
    border-color: #bfdbfe;
    transform: translateX(2px);
}

.action-list a svg:first-child {
    display: grid;
    width: 28px;
    height: 28px;
    padding: 5px;
    color: #fff;
    background: var(--primary);
    border-radius: 7px;
}

.action-list a:nth-child(2) svg:first-child {
    background: #10b981;
}

.action-list a:nth-child(3) svg:first-child {
    background: var(--purple);
}

.action-list--compact a {
    grid-template-columns: 28px minmax(0, 1fr) 18px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.panel-header a,
.panel-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-weight: 800;
}

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

.course-skill-card {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) 18px;
    gap: 14px;
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.course-skill-card:hover {
    transform: translateY(-2px);
    border-color: #bfdbfe;
    box-shadow: var(--shadow-soft);
}

.course-skill-card strong {
    display: block;
    margin-top: 2px;
    font-size: 16px;
}

.course-skill-card small {
    display: block;
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 13px;
}

.course-meta {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 4px;
    padding-top: 12px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    font-size: 13px;
    font-style: normal;
}

.course-meta em {
    padding: 4px 8px;
    color: var(--primary);
    font-style: normal;
    font-weight: 800;
    background: #dbeafe;
    border-radius: 7px;
}

.skill-icon {
    display: inline-grid;
    place-items: center;
    width: 60px;
    height: 60px;
    border-radius: 12px;
}

.skill-icon svg {
    width: 34px;
    height: 34px;
}

.blue-soft {
    color: var(--primary);
    background: #dbeafe;
}

.green-soft {
    color: #16a34a;
    background: #dcfce7;
}

.purple-soft {
    color: var(--purple);
    background: #ede9fe;
}

.yellow-soft {
    color: var(--yellow);
    background: #fef3c7;
}

.side-progress h2,
.streak-panel h2,
.recommendations-panel h2 {
    margin-bottom: 20px;
}

.side-progress__row {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border);
}

.side-progress__row strong {
    font-size: 20px;
}

.side-progress__row p {
    margin: 4px 0 12px;
    color: var(--text-secondary);
}

.side-progress .panel-link {
    margin-top: 16px;
}

.streak-head {
    display: flex;
    align-items: center;
    gap: 16px;
}

.streak-head > svg {
    width: 48px;
    height: 48px;
    color: #f97316;
}

.streak-head span {
    color: var(--text-secondary);
    font-weight: 700;
}

.streak-head strong {
    display: block;
    font-size: 24px;
}

.week-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    margin-top: 22px;
}

.week-row span {
    display: grid;
    justify-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-weight: 800;
}

.week-row em {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 1px dashed #94a3b8;
    border-radius: 50%;
    font-style: normal;
}

.week-row em.is-done {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.recommendations-panel h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.recommendations-panel h2 svg {
    color: var(--yellow);
}

.recommendation-list {
    display: grid;
    margin-bottom: 22px;
}

.recommendation-item {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.recommendation-item strong,
.recommendation-item small {
    display: block;
}

.recommendation-item small {
    margin-top: 3px;
    color: var(--text-secondary);
}

.rec-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
}

.rec-icon--blue {
    color: var(--primary);
    background: #dbeafe;
}

.rec-icon--green {
    color: #059669;
    background: #d1fae5;
}

.rec-icon--purple {
    color: var(--purple);
    background: #ede9fe;
}

.compact-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.compact-stats > div {
    min-width: 0;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.compact-stats strong {
    display: block;
    margin-top: 4px;
    font-size: 17px;
}

.compact-stats--stacked {
    grid-template-columns: 1fr;
}

.empty-state {
    display: grid;
    place-items: center;
    gap: 10px;
    min-height: 230px;
    text-align: center;
}

.empty-state svg {
    width: 42px;
    height: 42px;
    color: var(--primary);
}

.empty-state h3 {
    margin: 0;
}

.page-head {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-end;
    margin-bottom: 22px;
}

.page-head h1,
.lesson-heading h1,
.review-article h1 {
    margin: 8px 0;
    font-size: 34px;
    line-height: 1.15;
}

.page-head p,
.lesson-heading p {
    margin: 0;
    color: var(--text-secondary);
    font-weight: 600;
}

.page-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.course-roadmap {
    display: grid;
    gap: 20px;
}

.course-roadmap__hero {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 22px;
    margin-bottom: 22px;
}

.course-roadmap__hero img {
    width: 100%;
    height: 155px;
    object-fit: cover;
    border-radius: 10px;
}

.course-roadmap__hero h2 {
    margin: 0 0 8px;
    font-size: 28px;
}

.course-roadmap__hero p {
    margin: 0 0 12px;
    color: var(--text-secondary);
}

.course-roadmap__hero span {
    font-weight: 800;
    color: var(--primary);
}

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

.module-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.module-card__head {
    display: flex;
    gap: 13px;
    min-width: 0;
}

.module-card__head h3 {
    margin: 0;
}

.module-card__head p {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.lesson-list {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.lesson-list a {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.lesson-list small {
    flex: 0 0 auto;
    color: var(--text-secondary);
}

.lesson-layout,
.content-layout,
.vocabulary-layout,
.profile-layout,
.admin-layout,
.history-layout,
.result-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 22px;
    align-items: start;
}

.lesson-main,
.lesson-sidebar,
.review-sidebar {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--primary);
    font-weight: 800;
}

.resume-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px;
    color: #172554;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
}

.resume-banner p {
    margin: 4px 0 0;
    color: #475569;
}

.resume-banner__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.video-learning {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.lesson-video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #0f172a;
}

.video-status {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    padding: 16px;
}

.video-status > div:not(.linear-progress) {
    min-width: 0;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.video-status strong {
    display: block;
    margin-top: 4px;
}

.video-status .linear-progress {
    grid-column: 1 / -1;
}

.rich-content {
    color: #1e293b;
}

.rich-content h2,
.rich-content h3 {
    margin: 22px 0 10px;
}

.rich-content h2:first-child,
.rich-content h3:first-child {
    margin-top: 0;
}

.rich-content p {
    margin: 0 0 12px;
}

.rich-content blockquote {
    margin: 16px 0;
    padding: 14px 16px;
    background: #f8fafc;
    border-left: 4px solid var(--primary);
    border-radius: 8px;
}

.rich-content mark {
    padding: 2px 6px;
    background: #fef3c7;
    border-radius: 6px;
}

.word-list {
    display: grid;
    gap: 9px;
}

.word-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.word-row span {
    color: var(--text-secondary);
    text-align: right;
}

.next-lesson {
    display: grid;
    gap: 6px;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.next-lesson span {
    color: var(--primary);
    font-weight: 800;
}

.review-article {
    padding: 34px;
}

.vocab-focus-card {
    display: grid;
    grid-template-columns: minmax(260px, .7fr) minmax(0, 1fr);
    gap: 24px;
    align-items: center;
}

.vocab-focus-card img {
    width: 100%;
    height: 330px;
    object-fit: cover;
    border-radius: 10px;
}

.flashcard-face {
    position: relative;
    min-height: 260px;
    padding: 28px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.flashcard-face h2 {
    margin: 20px 0 6px;
    color: var(--primary);
    font-size: 42px;
}

.flashcard-face p {
    color: var(--text-secondary);
}

.flashcard-face strong {
    display: block;
    margin: 18px 0;
    font-size: 24px;
}

.review-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 22px;
}

.flashcard-review {
    min-height: 390px;
    perspective: 1000px;
}

.review-card {
    display: none;
    position: relative;
    min-height: 310px;
    transform-style: preserve-3d;
    transition: transform .24s ease;
}

.review-card.is-active {
    display: block;
}

.review-card.is-flipped {
    transform: rotateY(180deg);
}

.review-card__front,
.review-card__back {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 14px;
    padding: 28px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 12px;
    backface-visibility: hidden;
}

.review-card__front {
    background: #f8fbff;
}

.review-card__front h2 {
    margin: 0;
    color: var(--primary);
    font-size: 52px;
}

.review-card__back {
    background: #fff7ed;
    transform: rotateY(180deg);
}

.review-card__back strong {
    font-size: 30px;
}

.review-card__back small {
    color: var(--text-secondary);
    font-size: 16px;
}

.flashcard-help {
    margin-top: 14px;
    color: var(--text-secondary);
    font-weight: 700;
    text-align: center;
}

.rating-panel {
    display: grid;
    gap: 12px;
}

.rating-button {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    min-height: 54px;
    padding: 12px 14px;
    font-weight: 800;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.rating-button:hover {
    transform: translateY(-1px);
    border-color: #93c5fd;
}

.rating-button span {
    color: var(--text-secondary);
    font-weight: 700;
}

.rating-button--again {
    color: #dc2626;
}

.rating-button--hard {
    color: #d97706;
}

.rating-button--good {
    color: var(--primary);
}

.rating-button--easy {
    color: #16a34a;
}

.exercise-list,
.test-form {
    display: grid;
    gap: 16px;
}

.exercise-card__head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.exercise-card__head h2 {
    margin: 0;
    font-size: 19px;
}

.exercise-card__head p {
    margin: 4px 0 0;
    color: var(--text-secondary);
}

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

.answer-choice,
.answer-radio span {
    display: block;
    width: 100%;
    min-height: 52px;
    padding: 14px;
    color: var(--text-main);
    font-weight: 800;
    text-align: left;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.answer-choice:hover,
.answer-radio:hover span {
    background: #eff6ff;
    border-color: #93c5fd;
    transform: translateY(-1px);
}

.answer-choice.is-selected,
.answer-radio input:checked + span {
    color: var(--primary);
    background: #eff6ff;
    border-color: var(--primary);
}

.answer-radio input {
    position: absolute;
    opacity: 0;
}

.exercise-feedback {
    margin-top: 14px;
    padding: 13px 14px;
    border-radius: 10px;
}

.exercise-feedback p {
    margin: 5px 0 0;
}

.exercise-feedback.is-correct {
    color: #065f46;
    background: #d1fae5;
}

.exercise-feedback.is-wrong {
    color: #991b1b;
    background: #fee2e2;
}

.test-timer {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 18px;
    color: var(--primary);
    font-weight: 800;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
}

.test-timer.is-low {
    color: #b91c1c;
    background: #fee2e2;
    border-color: #fecaca;
}

.btn-submit-test {
    justify-self: end;
}

.result-card h1 {
    margin: 14px 0 20px;
    font-size: 38px;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 18px 0;
}

.result-stats div {
    padding: 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.result-stats span {
    display: block;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
}

.result-stats strong {
    display: block;
    margin-top: 5px;
    font-size: 22px;
}

.wrong-list {
    display: grid;
    gap: 14px;
}

.wrong-list div {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.wrong-list p {
    margin: 6px 0;
}

.wrong-list small {
    color: var(--text-secondary);
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 13px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 800;
    background: #f8fafc;
}

.data-table a {
    color: var(--primary);
    font-weight: 800;
}

.profile-card {
    text-align: center;
}

.profile-card img {
    width: 116px;
    height: 116px;
    object-fit: cover;
    border: 4px solid #dbeafe;
    border-radius: 50%;
}

.profile-card h1 {
    margin: 14px 0 4px;
}

.profile-card p {
    margin: 0;
    color: var(--text-secondary);
}

.form-stack,
.form-grid {
    display: grid;
    gap: 14px;
}

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

.form-grid .btn {
    align-self: end;
}

label span {
    display: block;
    margin-bottom: 7px;
    color: #334155;
    font-size: 14px;
    font-weight: 800;
}

input,
textarea,
select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    color: var(--text-main);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 9px;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease;
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

.success-label {
    color: #047857;
    font-weight: 800;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    display: grid;
    gap: 8px;
}

.stat-card svg {
    width: 34px;
    height: 34px;
    color: var(--primary);
}

.stat-card span {
    color: var(--text-secondary);
    font-weight: 800;
}

.stat-card strong {
    font-size: 30px;
}

.admin-menu {
    display: grid;
    gap: 9px;
}

.admin-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    color: #334155;
    border-radius: 9px;
}

.admin-menu a:hover,
.admin-menu a.is-active {
    color: var(--primary);
    background: #eff6ff;
}

.admin-forms {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-top: 22px;
}

.guest-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 30px;
    background:
        linear-gradient(135deg, rgba(37, 99, 235, .08), transparent 42%),
        var(--background);
}

.login-page {
    display: grid;
    grid-template-columns: 440px minmax(0, 520px);
    gap: 24px;
    width: min(100%, 990px);
}

.login-card,
.login-preview {
    padding: 30px;
}

.brand--login {
    margin-bottom: 26px;
}

.login-card__copy h1 {
    margin: 0 0 8px;
    font-size: 30px;
    line-height: 1.15;
}

.login-card__copy p {
    margin: 0 0 22px;
    color: var(--text-secondary);
}

.alert {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 10px;
}

.alert-danger {
    color: #991b1b;
    background: #fee2e2;
}

.demo-accounts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    margin-top: 18px;
    color: var(--text-secondary);
    font-size: 13px;
}

.demo-accounts p {
    width: 100%;
    margin: 0;
    font-weight: 800;
}

.quick-login {
    padding: 7px 9px;
    color: var(--primary);
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    font-weight: 800;
}

.login-preview {
    display: grid;
    align-content: center;
    gap: 18px;
    background: #fff;
}

.login-preview img {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
}

.login-preview h2 {
    margin: 0;
    font-size: 26px;
}

.login-preview__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.login-preview__stats span {
    padding: 12px;
    color: var(--text-secondary);
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.login-preview__stats strong {
    display: block;
    color: var(--text-main);
    font-size: 22px;
}

.toast-stack {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 80;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100vw - 44px));
}

.toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    color: #0f172a;
    background: #fff;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 10px;
    box-shadow: var(--shadow);
    animation: toastIn .2s ease;
}

.toast--success {
    border-left-color: #16a34a;
}

.toast--danger {
    border-left-color: #dc2626;
}

.toast--warning {
    border-left-color: #f59e0b;
}

.toast button {
    width: 28px;
    height: 28px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
}

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

@media (max-width: 1280px) {
    .dashboard-grid,
    .lesson-layout,
    .content-layout,
    .vocabulary-layout,
    .profile-layout,
    .admin-layout,
    .history-layout,
    .result-layout {
        grid-template-columns: 1fr;
    }

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

    .recommendations-panel {
        grid-column: 1 / -1;
    }

    .course-card-grid,
    .module-grid,
    .admin-forms {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1060px) {
    .topbar__inner {
        grid-template-columns: auto auto 1fr;
        padding: 0 20px;
    }

    .topbar .topbar__menu {
        display: inline-grid;
    }

    .main-nav {
        position: fixed;
        top: 76px;
        right: 16px;
        left: 16px;
        display: none;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-content: stretch;
        gap: 10px;
        padding: 14px;
        background: #fff;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
    }

    .main-nav.is-open {
        display: grid;
    }

    .main-nav__item {
        min-height: 46px;
        padding: 0 12px;
        border-radius: 9px;
    }

    .main-nav__item.is-active::after {
        display: none;
    }

    .main-nav__item.is-active {
        background: #eff6ff;
    }

    .topbar__actions {
        gap: 8px;
    }

    .btn-continue {
        min-width: 46px;
        padding: 0 13px;
    }

    .btn-continue span,
    .user-chip span,
    .user-chip > svg {
        display: none;
    }

    .hero-card {
        grid-template-columns: 190px minmax(0, 1fr);
    }

    .hero-card__progress {
        grid-column: 1 / -1;
        grid-template-columns: 118px auto;
        justify-content: center;
    }

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

    .metric-item + .metric-item {
        border-left: 0;
        border-top: 1px solid var(--border);
    }
}

@media (max-width: 760px) {
    .app-shell {
        padding: 92px 16px 24px;
    }

    .brand {
        font-size: 20px;
        gap: 9px;
    }

    .brand__mark {
        width: 42px;
        height: 42px;
    }

    .hero-card,
    .lesson-card,
    .course-roadmap__hero,
    .vocab-focus-card,
    .review-workspace,
    .video-status,
    .form-grid,
    .admin-stats,
    .admin-forms,
    .login-page,
    .login-preview__stats {
        grid-template-columns: 1fr;
    }

    .hero-card {
        padding: 20px;
        text-align: left;
    }

    .hero-card__image {
        display: none;
    }

    .hero-card h1,
    .page-head h1,
    .lesson-heading h1,
    .review-article h1 {
        font-size: 27px;
    }

    .dashboard-sidebar,
    .course-card-grid,
    .module-grid {
        grid-template-columns: 1fr;
    }

    .page-head {
        display: grid;
        align-items: start;
    }

    .page-actions {
        justify-content: stretch;
    }

    .page-actions .btn {
        flex: 1 1 100%;
    }

    .lesson-thumb,
    .lesson-thumb img {
        min-height: 210px;
    }

    .answer-grid,
    .result-stats,
    .compact-stats {
        grid-template-columns: 1fr;
    }

    .resume-banner {
        display: grid;
    }

    .resume-banner__actions {
        justify-content: stretch;
    }

    .resume-banner__actions .btn {
        width: 100%;
    }

    .review-article {
        padding: 22px;
    }

    .login-preview {
        display: none;
    }

    .guest-body {
        padding: 16px;
    }
}

@media (max-width: 460px) {
    .topbar__inner {
        gap: 8px;
        padding: 0 12px;
    }

    .brand span:last-child {
        display: none;
    }

    .notification-button {
        display: none;
    }

    .panel,
    .login-card {
        padding: 18px;
    }

    .mini-flashcard {
        grid-template-columns: 34px minmax(0, 1fr) 34px;
        padding: 12px 6px;
    }

    .mini-flashcard h3,
    .review-card__front h2 {
        font-size: 34px;
    }
}

.alert-success {
    color: #065f46;
    background: #d1fae5;
    border: 1px solid #a7f3d0;
}

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

.admin-sections {
    display: grid;
    gap: 22px;
    min-width: 0;
}

.admin-section {
    scroll-margin-top: 96px;
}

.admin-section h3 {
    margin: 0 0 10px;
    font-size: 18px;
}

.admin-workbench .admin-menu {
    position: sticky;
    top: 96px;
}

.admin-menu a {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    font-weight: 800;
}

.admin-two-column {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.admin-form-card {
    padding: 16px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.admin-form-actions,
.table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-table-panel {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.admin-table-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.admin-import-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-file-picker {
    display: inline-flex;
    align-items: center;
    min-height: 46px;
    padding: 0 14px;
    color: var(--text-secondary);
    font-weight: 800;
    background: #fff;
    border: 1px dashed #93c5fd;
    border-radius: 10px;
    cursor: pointer;
}

.admin-file-picker input {
    max-width: 160px;
}

.admin-import-summary {
    margin-top: 16px;
}

.admin-import-summary p {
    margin: 6px 0 0;
}

.admin-import-summary ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.table-select {
    width: 42px;
    text-align: center;
}

.table-select input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.admin-input-action {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.admin-input-action .btn {
    min-height: 44px;
    white-space: nowrap;
}

.admin-audio-preview {
    display: block;
    width: 100%;
    margin-top: 8px;
}

.admin-audio-preview[hidden] {
    display: none;
}

.admin-thumbnail-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 800;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.admin-thumbnail-preview img,
.admin-course-thumb {
    width: 58px;
    height: 42px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.admin-course-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.admin-course-title strong,
.admin-course-title small {
    display: block;
}

.admin-course-title small {
    max-width: 340px;
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-video-url {
    display: block;
    max-width: 420px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-content-preview {
    display: block;
    max-width: 520px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.45;
}

.admin-inline-note {
    display: block;
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.ck-editor__editable {
    min-height: 360px;
}

.ck.ck-editor {
    color: var(--text-main);
}

.ck.ck-editor__main > .ck-editor__editable {
    border-color: var(--border);
    border-radius: 0 0 10px 10px;
}

.is-editor-fallback {
    min-height: 360px;
}

.table-action-form {
    margin: 0;
}

.admin-action-button {
    width: 36px;
    height: 36px;
    color: #334155;
}

.admin-action-button--danger {
    color: #dc2626;
    border-color: #fecaca;
}

.admin-action-button--danger:hover {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fca5a5;
}

.admin-action-button:disabled {
    cursor: not-allowed;
    color: #94a3b8;
    background: #f8fafc;
    border-color: var(--border);
    opacity: .72;
}

.module-explainer {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
    padding: 16px;
    color: #172554;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
}

.module-explainer strong {
    font-size: 17px;
}

.module-explainer p {
    margin: 0;
    color: #334155;
}

.module-explainer code {
    width: max-content;
    max-width: 100%;
    padding: 6px 9px;
    color: var(--primary);
    background: #fff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    font-weight: 800;
}

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

.admin-report-grid div {
    padding: 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.admin-report-grid span {
    display: block;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 800;
}

.admin-report-grid strong {
    display: block;
    margin-top: 6px;
    font-size: 20px;
}

@media (max-width: 1280px) {
    .admin-workbench,
    .admin-two-column {
        grid-template-columns: 1fr;
    }

    .admin-workbench .admin-menu {
        position: static;
        order: -1;
    }

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

@media (max-width: 760px) {
    .admin-report-grid {
        grid-template-columns: 1fr;
    }
}
