:root {
    color-scheme: light;
    --bg: #f5f7f5;
    --bg-secondary: #ebf2ed;
    --surface: rgba(255, 255, 255, 0.82);
    --surface-strong: #ffffff;
    --text: #173126;
    --muted: #60756b;
    --line: rgba(23, 49, 38, 0.1);
    --accent: #2c8f5f;
    --accent-2: #17513b;
    --accent-soft: #daf0e1;
    --shadow: 0 22px 60px rgba(39, 79, 55, 0.13);
    --promo-red: linear-gradient(135deg, #f7797d, #fbd786);
    --promo-green: linear-gradient(135deg, #57c785, #184e68);
    --promo-yellow: linear-gradient(135deg, #f5c04a, #f0932b);
}

body[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f1512;
    --bg-secondary: #171f1b;
    --surface: rgba(24, 31, 27, 0.86);
    --surface-strong: #1c2621;
    --text: #eef7f1;
    --muted: #a6bbb0;
    --line: rgba(238, 247, 241, 0.08);
    --accent: #5de09a;
    --accent-2: #bdf6d1;
    --accent-soft: rgba(93, 224, 154, 0.12);
    --shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
    background: var(--bg-secondary);
    min-height: 100%;
}

body {
    position: relative;
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    color: var(--text);
    background:
            radial-gradient(circle at top left, rgba(44, 143, 95, 0.16), transparent 28%),
            radial-gradient(circle at 80% 18%, rgba(245, 192, 74, 0.1), transparent 22%),
            linear-gradient(180deg, var(--bg) 0%, var(--bg-secondary) 100%);
    transition: background-color 0.35s ease, color 0.35s ease;
    overflow-x: hidden;
    overscroll-behavior-y: none;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
            radial-gradient(circle at top left, rgba(44, 143, 95, 0.16), transparent 28%),
            radial-gradient(circle at 80% 18%, rgba(245, 192, 74, 0.1), transparent 22%),
            linear-gradient(180deg, var(--bg) 0%, var(--bg-secondary) 100%);
}

body.modal-open {
    overflow: hidden;
}

body.mobile-dropdown-open {
    overflow: hidden;
}

img {
    display: block;
    max-width: 100%;
}

a {
    text-decoration: none;
    color: inherit;
}

p {
    line-height: 1.65;
}

.site-shell,
.auth-shell {
    width: min(1240px, calc(100% - 28px));
    margin: 0 auto;
    padding: 24px 0 48px;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.site-header,
.course-card,
.promo-card,
.review-card,
.content-card,
.hero-card,
.auth-card,
.lesson-card,
.plan-card,
.mini-panel,
.teacher-panel,
.hero-stat {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.site-header {
    position: sticky;
    top: 16px;
    z-index: 220;
    isolation: isolate;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 18px;
    border-radius: 22px;
}

.site-header.compact {
    margin-bottom: 26px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.site-header .brand {
    margin-left: -40px;
}

.center-brand {
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
    text-align: center;
}

.brand-image {
    width: 250px;
    height: auto;
    max-height: 74px;
    object-fit: contain;
    filter: drop-shadow(0 10px 24px rgba(14, 44, 30, 0.18));
}

.center-brand .brand-image {
    width: clamp(180px, 24vw, 320px);
    max-height: 88px;
}

.nav-links,
.header-actions,
.hero-badges,
.hero-actions,
.course-tags,
.course-footer,
.lesson-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.nav-links {
    color: var(--muted);
    align-items: center;
    position: relative;
    z-index: 230;
}

.nav-dropdown {
    position: relative;
    z-index: 240;
}

.nav-dropdown summary {
    list-style: none;
    cursor: pointer;
    font: inherit;
    color: inherit;
    user-select: none;
}

.nav-dropdown summary::-webkit-details-marker {
    display: none;
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    min-width: 210px;
    display: grid;
    gap: 6px;
    padding: 10px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-strong) 65%, transparent);
    backdrop-filter: blur(24px);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.24s ease, transform 0.24s ease;
    z-index: 320;
    isolation: isolate;
    contain: paint;
    will-change: transform, opacity;
}

.nav-dropdown[open] .nav-dropdown-menu,
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.nav-dropdown-menu a {
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--text);
    white-space: nowrap;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.22s ease, transform 0.22s ease, background-color 0.2s ease, color 0.2s ease;
}

.nav-dropdown[open] .nav-dropdown-menu a,
.nav-dropdown:hover .nav-dropdown-menu a,
.nav-dropdown:focus-within .nav-dropdown-menu a {
    opacity: 1;
    transform: translateY(0);
}

.nav-dropdown-menu a:nth-child(1) {
    transition-delay: 0.02s;
}

.nav-dropdown-menu a:nth-child(2) {
    transition-delay: 0.08s;
}

.nav-dropdown-menu a:nth-child(3) {
    transition-delay: 0.14s;
}

.nav-dropdown-menu a:hover {
    background: var(--accent-soft);
    color: var(--accent-2);
}

.mobile-dropdown-sheet {
    display: none;
}

.theme-toggle,
.password-toggle,
.outline-button {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.theme-toggle,
.password-toggle {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    font-size: 1rem;
}

.solid-link,
.outline-link,
.outline-button,
.full-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    font-weight: 700;
    transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
    cursor: pointer;
}

.solid-link,
.full-button {
    background: linear-gradient(135deg, var(--accent), #57bb7f);
    color: white;
    border: none;
}

.full-button:disabled,
.solid-link:disabled,
.payment-disabled-button {
    opacity: 0.55;
    cursor: not-allowed;
    filter: grayscale(0.12);
    box-shadow: none;
}

.outline-link,
.outline-button {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

.solid-link:hover,
.outline-link:hover,
.outline-button:hover,
.theme-toggle:hover,
.password-toggle:hover {
    transform: translateY(-1px);
}

.hero-section,
.details-layout,
.cabinet-layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.18fr) minmax(300px, 0.82fr);
    gap: clamp(18px, 2vw, 28px);
    margin-top: 30px;
}

.hero-copy,
.hero-visual,
.details-main,
.details-side,
.cabinet-main,
.cabinet-side {
    display: grid;
    gap: 18px;
    align-content: start;
}

.eyebrow {
    margin: 0;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
}

h1,
h2 {
    margin: 0;
    line-height: 1;
}

h1 {
    font-size: clamp(2.4rem, 6vw, 5rem);
    max-width: 11ch;
}

h2 {
    font-size: clamp(1.8rem, 4vw, 3rem);
    max-width: 14ch;
}

.hero-text,
.course-subtitle,
.muted {
    color: var(--muted);
}

.hero-badges span,
.course-tags span,
.course-badge,
.plan-mark {
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-2);
    font-weight: 700;
    font-size: 0.92rem;
}

.hero-stat,
.hero-card,
.mini-panel,
.content-card,
.auth-card {
    border-radius: 28px;
    padding: clamp(20px, 2.5vw, 28px);
}

.hero-stat strong {
    font-size: 2.2rem;
}

.hero-stat.muted {
    background: rgba(255, 255, 255, 0.05);
}

.gradient-card {
    background:
            radial-gradient(circle at top right, rgba(44, 143, 95, 0.18), transparent 42%),
            linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 18px;
    margin: 64px 0 22px;
}

.compact-section-heading {
    margin-top: 34px;
}

.course-category-section {
    scroll-margin-top: 120px;
}

.courses-page {
    padding-top: 0;
}

.courses-top-heading {
    margin: 14px 0 18px;
}

.courses-page > .section-heading h1,
.page-section > .section-heading h1 {
    white-space: nowrap;
}

.promo-grid,
.course-grid,
.review-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

.promo-card,
.review-card,
.course-card {
    border-radius: 28px;
    overflow: hidden;
}

.promo-card {
    padding: 22px;
    color: white;
    min-height: 220px;
    display: grid;
    align-content: end;
}

.promo-card h3 {
    margin: 8px 0 12px;
    font-size: 1.6rem;
}

.promo-card a {
    width: fit-content;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
}

.accent-red {
    background: var(--promo-red);
}

.accent-green {
    background: var(--promo-green);
}

.accent-yellow {
    background: var(--promo-yellow);
}

.course-image-wrap {
    position: relative;
    aspect-ratio: 4 / 4.6;
    overflow: hidden;
}

.course-image,
.teacher-portrait,
.mini-course img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.course-badge {
    position: absolute;
    top: 14px;
    left: 14px;
}

.course-content {
    display: grid;
    gap: 14px;
    padding: 22px;
}

.teacher-line {
    display: grid;
    gap: 4px;
}

.price {
    font-weight: 800;
    font-size: 1.05rem;
}

.page-section {
    padding-top: 8px;
}

.details-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 24px;
}

.details-copy {
    min-width: 0;
    display: grid;
    gap: 16px;
    align-content: start;
}

.teacher-panel {
    border-radius: 28px;
    padding: 18px;
    display: grid;
    gap: 14px;
    align-content: start;
    min-width: 0;
}

.teacher-portrait {
    border-radius: 24px;
    aspect-ratio: 4 / 5;
}

.content-card {
    display: grid;
    gap: 18px;
    align-content: start;
}

.bullet-list {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
}

.lesson-stack,
.plan-stack,
.review-stack,
.mini-course-list {
    display: grid;
    gap: 14px;
    align-content: start;
}

.lesson-card,
.plan-card {
    border-radius: 22px;
    padding: 18px;
}

.plan-card.highlighted {
    outline: 1px solid rgba(93, 224, 154, 0.45);
    background: linear-gradient(180deg, rgba(93, 224, 154, 0.1), rgba(255, 255, 255, 0.03));
}

.auth-card {
    width: min(100%, 520px);
}

.auth-form {
    display: grid;
    gap: 16px;
    margin-top: 12px;
}

.auth-form label {
    display: grid;
    gap: 8px;
    font-weight: 700;
}

.auth-form input {
    width: 100%;
    min-height: 50px;
    padding: 0 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font: inherit;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 58px;
}

.password-toggle {
    position: absolute;
    top: 4px;
    right: 4px;
}

.field-error,
.form-error {
    color: #ff7272;
    font-size: 0.92rem;
}

.form-debug {
    margin: 8px 0 0;
    color: var(--accent);
    font-weight: 700;
}

.auth-switch {
    margin: 18px 0 0;
    color: var(--muted);
}

.auth-switch a {
    color: var(--accent);
    font-weight: 700;
}

.consent-check {
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 12px;
    align-items: center;
    font-weight: 500;
    line-height: 1.35;
}

.consent-check input {
    margin: 0;
    width: 15px;
    height: 15px;
    appearance: auto;
    -webkit-appearance: checkbox;
    accent-color: var(--accent);
    border: 0;
    box-shadow: none;
    background: transparent;
    flex-shrink: 0;
}

.consent-check a {
    color: var(--accent);
    font-weight: 700;
}

.consent-check span {
    display: inline-block;
}

.full-button {
    width: 100%;
}

.mini-course {
    display: grid;
    grid-template-columns: 78px 1fr;
    gap: 14px;
    align-items: center;
    padding: 12px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
}

.mini-course img {
    aspect-ratio: 1;
    border-radius: 18px;
}

.avatar-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.mini-avatar {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
}

.mini-avatar.big {
    width: 56px;
    height: 56px;
}

.review-card-rich,
.review-inline {
    display: grid;
    gap: 14px;
    min-width: 0;
    padding: 20px;
}

.review-layout {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    min-width: 0;
}

.review-person,
.profile-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.review-person-panel {
    display: grid;
    gap: 12px;
    align-content: start;
    text-align: center;
    min-width: 0;
}

.review-avatar {
    width: 96px;
    height: 96px;
    justify-self: center;
    flex-shrink: 0;
}

.review-person-meta {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.review-person-meta .muted {
    margin: 0;
}

.review-person-meta strong,
.review-person-meta p {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.review-copy {
    min-width: 0;
}

.review-text {
    margin: 0;
    line-height: 1.7;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--line);
}

.profile-avatar-xl {
    width: 180px;
    height: 180px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--line);
    transition: filter 0.25s ease;
}

.profile-avatar-link {
    position: relative;
    display: inline-block;
}

.profile-avatar-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.42);
    color: white;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.25s ease;
    text-align: center;
    padding: 18px;
}

.profile-avatar-link:hover .profile-avatar-xl {
    filter: brightness(0.55);
}

.profile-avatar-link:hover .profile-avatar-overlay {
    opacity: 1;
}

.profile-hero-large {
    align-items: center;
}

.teacher-row {
    display: grid;
    gap: 14px;
}

.teacher-chip {
    display: flex;
    align-items: center;
    gap: 12px;
}

.compact-heading {
    margin: 0 0 8px;
}

.modal-banner {
    padding: 18px 22px;
    border-radius: 20px;
    border: 1px solid rgba(93, 224, 154, 0.28);
    background: linear-gradient(135deg, rgba(93, 224, 154, 0.12), rgba(255, 255, 255, 0.04));
    display: grid;
    gap: 4px;
}

.purchase-modal {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 22px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

.purchase-modal:target,
.purchase-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.purchase-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 14, 11, 0.58);
    backdrop-filter: blur(10px);
}

.purchase-dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 720px);
    border-radius: 30px;
    padding: 28px;
    background: var(--surface-strong);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    display: grid;
    gap: 22px;
}

.purchase-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 1.4rem;
}

.purchase-head {
    display: grid;
    gap: 10px;
    padding-right: 48px;
}

.purchase-head h2 {
    max-width: none;
}

.purchase-form,
.purchase-plan-list,
.payment-form {
    display: grid;
    gap: 16px;
}

.purchase-plan-option {
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 14px;
    align-items: start;
    padding: 16px 18px;
    border-radius: 22px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
}

.purchase-plan-option input {
    margin-top: 4px;
}

.purchase-plan-copy {
    display: grid;
    gap: 4px;
}

.purchase-plan-price {
    font-weight: 800;
    font-size: 1.05rem;
}

.purchase-field {
    display: grid;
    gap: 8px;
    font-weight: 700;
}

.purchase-field input,
.payment-form input {
    width: 100%;
    min-height: 52px;
    padding: 0 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font: inherit;
}

.contacts-form textarea {
    width: 100%;
    min-height: 160px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font: inherit;
    resize: vertical;
}

.review-select,
.review-textarea {
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font: inherit;
}

.review-select {
    min-height: 52px;
    padding: 0 16px;
}

.review-textarea {
    min-height: 180px;
    padding: 14px 16px;
    resize: vertical;
}

.moderation-banner {
    padding: 18px 20px;
    border-radius: 20px;
    border: 1px solid rgba(92, 138, 235, 0.28);
    background: linear-gradient(135deg, rgba(94, 137, 227, 0.18), rgba(62, 98, 184, 0.12));
    color: #8eb7ff;
    display: grid;
    gap: 6px;
}

.moderation-banner strong,
.moderation-banner p {
    margin: 0;
}

.empty-state-panel {
    padding: 18px 20px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    display: grid;
    gap: 6px;
}

.empty-state-panel strong,
.empty-state-panel p {
    margin: 0;
}

.reviews-layout {
    align-items: start;
}

.reviews-page-heading {
    margin-top: 14px;
    margin-bottom: 18px;
}

.reviews-inline-heading {
    margin: 0 0 6px;
}

.review-card-moderation {
    position: relative;
    border: 1px solid rgba(92, 138, 235, 0.28);
    background: linear-gradient(180deg, rgba(94, 137, 227, 0.08), rgba(255, 255, 255, 0.03));
}

.review-status-tag {
    width: fit-content;
    margin: 0;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(92, 138, 235, 0.16);
    color: #8eb7ff;
    font-size: 0.88rem;
    font-weight: 800;
}

.promo-help,
.promo-status {
    margin: 0;
}

.promo-status-success {
    color: var(--accent);
    font-weight: 700;
}

.promo-status-error {
    color: #ff7272;
    font-weight: 700;
}

.purchase-total {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 18px;
    padding: 18px 20px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
}

.purchase-total-current {
    display: block;
    margin-top: 6px;
    font-size: 1.9rem;
}

.purchase-total-old-wrap {
    text-align: right;
}

.purchase-total-old {
    color: #ff6464;
    font-weight: 800;
    text-decoration: line-through;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.purchase-total-old.is-visible {
    opacity: 1;
}

.payment-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 24px;
}

.payment-summary,
.payment-methods {
    display: grid;
    gap: 14px;
}

.payment-summary-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.payment-summary-old strong {
    color: #ff6464;
    text-decoration: line-through;
}

.payment-methods {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.payment-method.active {
    border-color: rgba(93, 224, 154, 0.45);
    background: rgba(93, 224, 154, 0.1);
}

.payment-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.sbp-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 20px;
    align-items: center;
    padding: 20px;
    border-radius: 24px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
}

.sbp-qr {
    width: min(100%, 220px);
    aspect-ratio: 1;
    object-fit: contain;
    background: white;
    padding: 10px;
    border-radius: 22px;
    justify-self: end;
}

.maintenance-card {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 16px;
    align-items: center;
    padding: 18px 20px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(255, 120, 120, 0.08), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(255, 100, 100, 0.22);
}

.maintenance-icon {
    width: 70px;
    height: 70px;
    display: grid;
    place-items: center;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 2rem;
}

.maintenance-icon-centered {
    margin: 2px auto 6px;
}

.contacts-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.contact-card {
    display: grid;
    gap: 16px;
    align-content: start;
    padding: 22px;
    border-radius: 28px;
}

.contact-card h3,
.contacts-form-head h2 {
    margin: 0;
}

.contact-card .muted,
.contacts-form-head .muted {
    margin: 0;
}

.contact-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
}

.contacts-form-card {
    display: grid;
    gap: 18px;
}

.contacts-form {
    gap: 18px;
}

.success-banner {
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(93, 224, 154, 0.24);
    background: rgba(93, 224, 154, 0.12);
    color: var(--accent-2);
    font-weight: 600;
}

.enroll-button {
    min-height: 64px;
    padding: 0 32px;
    font-size: 1.08rem;
    font-weight: 800;
    box-shadow: 0 18px 32px rgba(44, 143, 95, 0.2);
}

.year-courses-section,
.page-subsection {
    margin-top: 56px;
}

.year-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.year-card {
    padding: 22px;
    border-radius: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    display: grid;
    gap: 16px;
    align-content: start;
}

.year-card-image {
    width: 100%;
    aspect-ratio: 4 / 3.9;
    object-fit: cover;
    border-radius: 22px;
    border: 1px solid var(--line);
}

.price-line {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 16px;
}

.old-price {
    color: var(--muted);
    text-decoration: line-through;
}

.new-price {
    font-size: 1.2rem;
}

.improved-layout {
    grid-template-columns: minmax(0, 1.32fr) minmax(240px, 300px);
    align-items: start;
}

.teacher-panel-fixed {
    position: static;
    top: auto;
}

.teacher-panel-fixed .teacher-portrait {
    aspect-ratio: 1 / 1.18;
}

.hero-actions {
    margin-top: 8px;
    align-items: flex-start;
}

.hero-actions form {
    margin: 0;
}

.hero-actions .enroll-button {
    width: fit-content;
}

.wide-card {
    width: min(100%, 760px);
}

.profile-edit-preview {
    margin: 12px 0 8px;
}

.site-footer {
    width: min(1240px, calc(100% - 28px));
    margin: 22px auto 28px;
    padding: 22px;
    border-radius: 26px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-strong) 82%, transparent);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.site-footer-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) repeat(2, minmax(180px, 1fr));
    gap: 22px;
    align-items: start;
}

.footer-brand {
    justify-content: flex-start;
    margin-bottom: 10px;
}

.footer-heading {
    margin: 0 0 10px;
    font-weight: 800;
}

.footer-links-block {
    display: grid;
    gap: 10px;
    align-content: start;
}

.footer-link,
.footer-doc-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}

.footer-link-icon {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.06);
}

.footer-doc-link {
    color: var(--accent);
    font-weight: 700;
}

.footer-note {
    margin: 18px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.95rem;
}

.legal-page .content-card {
    width: min(100%, 920px);
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    transition-delay: var(--delay, 0ms);
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.delay-1 {
    --delay: 120ms;
}

.delay-2 {
    --delay: 240ms;
}

@media (max-width: 980px) {
    .site-header,
    .section-heading,
    .details-hero {
        grid-template-columns: 1fr;
    }

    .site-header,
    .nav-links,
    .header-actions {
        flex-wrap: wrap;
    }

    .hero-section,
    .details-layout,
    .cabinet-layout,
    .payment-layout {
        grid-template-columns: 1fr;
    }
    
    .site-header {
        align-items: flex-start;
        gap: 14px;
        padding: 16px;
    }

    .nav-links {
        order: 3;
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .nav-links a {
        white-space: nowrap;
        flex: 0 0 auto;
    }

    .nav-dropdown {
        flex: 0 0 auto;
    }

    .nav-dropdown-menu {
        min-width: 190px;
        left: 0;
    }

    .details-hero,
    .improved-layout {
        grid-template-columns: 1fr;
    }

    .details-side {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .profile-hero,
    .profile-hero-large {
        align-items: flex-start;
    }
}

@media (max-width: 720px) {
    .site-shell,
    .auth-shell {
        width: min(100%, calc(100% - 14px));
        padding-top: 10px;
        padding-bottom: 32px;
    }

    h1,
    h2 {
        max-width: none;
    }

    h1 {
        font-size: clamp(2.35rem, 12vw, 3.8rem);
        line-height: 0.94;
    }

    h2 {
        font-size: clamp(1.7rem, 8vw, 2.45rem);
        line-height: 0.97;
    }

    .site-header {
        position: static;
        gap: 12px;
        padding: 12px 12px 14px;
        border-radius: 20px;
        align-items: center;
        z-index: 220;
        isolation: isolate;
    }

    .site-header .brand {
        order: 1;
        width: 100%;
        margin-left: 0;
        justify-content: center;
    }

    .brand-image {
        width: min(250px, 58vw);
        max-height: 68px;
    }

    .nav-links {
        order: 2;
        width: 100%;
        gap: 8px;
        overflow: visible;
        flex-wrap: wrap;
        justify-content: center;
        padding-bottom: 0;
    }

    .nav-links a,
    .nav-dropdown {
        flex: 0 0 auto;
    }

    .header-actions {
        order: 3;
        width: 100%;
        justify-content: space-between;
        gap: 10px;
    }

    .header-actions .outline-link,
    .header-actions .solid-link,
    .header-actions .outline-button {
        flex: 1 1 0;
        min-width: 0;
    }

    .header-actions .theme-toggle {
        flex: 0 0 auto;
    }

    .nav-links a {
        padding: 9px 12px;
        border-radius: 999px;
        border: 1px solid var(--line);
        background: rgba(255, 255, 255, 0.04);
        font-size: 0.95rem;
    }

    .nav-dropdown summary {
        padding: 9px 12px;
        border-radius: 999px;
        border: 1px solid var(--line);
        background: rgba(255, 255, 255, 0.04);
        white-space: nowrap;
    }

    .nav-dropdown-menu {
        position: fixed;
        top: 122px;
        left: 12px;
        right: 12px;
        min-width: 0;
        box-shadow: var(--shadow);
        background: color-mix(in srgb, var(--surface-strong) 88%, transparent);
        transform: translateY(8px);
        opacity: 0;
        pointer-events: none;
        padding: 10px;
        z-index: 420;
        isolation: isolate;
        contain: paint;
        will-change: transform, opacity;
    }

    .nav-dropdown-menu {
        display: none !important;
    }

    .mobile-dropdown-sheet {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 600;
        pointer-events: none;
    }

    .mobile-dropdown-backdrop {
        position: absolute;
        inset: 0;
        border: 0;
        background: transparent;
        opacity: 0;
        pointer-events: none;
    }

    .mobile-dropdown-panel {
        position: fixed;
        top: 122px;
        left: 12px;
        right: 12px;
        display: grid;
        gap: 10px;
        padding: 10px;
        border-radius: 22px;
        border: 1px solid var(--line);
        background: color-mix(in srgb, var(--surface-strong) 90%, transparent);
        box-shadow: var(--shadow);
        opacity: 0;
        pointer-events: none;
        transform: translateY(8px);
        transition: opacity 0.24s ease, transform 0.24s ease;
        backdrop-filter: blur(26px);
    }

    body.mobile-dropdown-open .mobile-dropdown-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    body.mobile-dropdown-open .mobile-dropdown-panel {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    .mobile-dropdown-panel a {
        display: block;
        padding: 12px 14px;
        border-radius: 14px;
        border: 1px solid var(--line);
        background: rgba(255, 255, 255, 0.04);
        color: var(--text);
        font-weight: 600;
    }

    .mobile-dropdown-panel a:hover {
        background: var(--accent-soft);
        color: var(--accent-2);
    }

    .nav-dropdown[open] .nav-dropdown-menu,
    .nav-dropdown:hover .nav-dropdown-menu,
    .nav-dropdown:focus-within .nav-dropdown-menu {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    .hero-section,
    .details-layout,
    .cabinet-layout,
    .payment-layout {
        margin-top: 20px;
        gap: 14px;
    }

    .hero-copy,
    .hero-visual,
    .details-main,
    .details-side,
    .cabinet-main,
    .cabinet-side {
        gap: 14px;
    }

    .section-heading {
        margin: 42px 0 18px;
        align-items: flex-start;
    }

    .courses-top-heading {
        margin: 6px 0 14px;
    }

    .courses-page > .section-heading h1,
    .page-section > .section-heading h1 {
        white-space: normal;
    }

    .section-heading .outline-link {
        width: auto;
    }

    .hero-stat,
    .hero-card,
    .content-card,
    .auth-card,
    .teacher-panel,
    .year-card,
    .lesson-card,
    .plan-card {
        border-radius: 22px;
        padding: 18px;
    }

    .promo-card,
    .review-card,
    .course-card {
        border-radius: 22px;
    }

    .course-content {
        padding: 18px;
    }

    .promo-grid,
    .course-grid,
    .review-grid,
    .year-grid,
    .details-side {
        grid-template-columns: 1fr;
    }

    .details-hero {
        gap: 18px;
    }

    .teacher-panel-fixed .teacher-portrait {
        aspect-ratio: 4 / 4.7;
    }

    .course-tags,
    .hero-badges {
        gap: 8px;
    }

    .course-tags span,
    .hero-badges span,
    .plan-mark {
        padding: 8px 10px;
        font-size: 0.86rem;
    }

    .course-footer,
    .hero-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .hero-actions .solid-link,
    .hero-actions .outline-link,
    .course-footer .solid-link,
    .course-footer .outline-link {
        width: 100%;
    }

    .solid-link,
    .outline-link {
        width: 100%;
    }

    .hero-actions .enroll-button {
        width: 100%;
    }

    .enroll-button {
        min-height: 58px;
        padding: 0 24px;
        font-size: 1rem;
    }

    .review-person,
    .profile-hero,
    .profile-hero-large {
        align-items: flex-start;
        flex-direction: column;
    }

    .review-layout {
        grid-template-columns: 1fr;
        gap: 16px;
        align-items: stretch;
    }

    .review-person-panel {
        text-align: left;
        grid-template-columns: 72px minmax(0, 1fr);
        align-items: center;
        gap: 14px;
    }

    .review-avatar {
        width: 72px;
        height: 72px;
        justify-self: start;
        align-self: start;
    }

    .review-copy,
    .review-text {
        max-width: 100%;
    }

    .review-card,
    .review-card-rich,
    .review-card-moderation {
        overflow: hidden;
    }

    .review-card-rich,
    .review-inline {
        padding: 18px 16px;
    }

    .profile-avatar-xl {
        width: 136px;
        height: 136px;
    }

    .profile-avatar-large {
        width: 104px;
        height: 104px;
    }

    .teacher-chip {
        align-items: center;
    }

    .mini-course {
        grid-template-columns: 64px 1fr;
        gap: 12px;
    }

    .mini-avatar.big {
        width: 50px;
        height: 50px;
    }

    .purchase-dialog {
        width: min(100%, calc(100vw - 24px));
        max-height: min(92vh, 860px);
        overflow: auto;
        border-radius: 24px;
        padding: 20px 16px 18px;
        gap: 18px;
    }

    .purchase-head {
        padding-right: 36px;
    }

    .purchase-close {
        top: 12px;
        right: 12px;
    }

    .purchase-plan-option {
        grid-template-columns: 18px 1fr;
        gap: 10px;
        padding: 14px;
    }

    .purchase-total,
    .payment-summary-row,
    .maintenance-card {
        grid-template-columns: 1fr;
    }

    .purchase-total {
        flex-direction: column;
        align-items: flex-start;
    }

    .purchase-total-old-wrap {
        text-align: left;
    }

    .payment-summary-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .payment-methods,
    .payment-form-grid,
    .sbp-card,
    .contacts-grid {
        grid-template-columns: 1fr;
    }

    .payment-method {
        min-height: 48px;
    }

    .sbp-card {
        padding: 16px;
        gap: 16px;
    }

    .sbp-qr {
        justify-self: center;
        width: min(100%, 240px);
    }

    .maintenance-icon {
        width: 60px;
        height: 60px;
        border-radius: 18px;
    }

    .auth-form input,
    .purchase-field input,
    .payment-form input,
    .contacts-form textarea {
        font-size: 16px;
    }

    .site-footer {
        width: min(100%, calc(100% - 14px));
        margin-top: 16px;
        padding: 18px;
    }

    .site-footer-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .footer-brand {
        justify-content: center;
    }

    .footer-brand-block {
        text-align: center;
    }
}

@media (max-width: 520px) {
    .site-shell,
    .auth-shell {
        width: min(100%, calc(100% - 12px));
    }

    .site-header {
        padding: 10px 10px 12px;
    }

    .brand-image {
        width: min(238px, 60vw);
        max-height: 62px;
    }

    .nav-dropdown-menu {
        top: 112px;
        left: 10px;
        right: 10px;
    }

    .header-actions {
        gap: 8px;
    }

    .nav-links a {
        padding: 8px 11px;
        font-size: 0.92rem;
    }

    .hero-stat strong {
        font-size: 1.95rem;
    }

    .profile-avatar-xl {
        width: 120px;
        height: 120px;
    }

    .avatar-row {
        gap: 8px;
    }

    .mini-avatar {
        width: 38px;
        height: 38px;
    }
}
