:root {
    --header-h: 56px;
    --footer-h: 44px
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
    background: #f3f4f6;
    color: #111827;
}

/* Шапка */

header {
    height: var(--header-h);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 10;
}

header .brand {
    font-weight: 600;
    letter-spacing: 0.03em;
}

header .brand small {
    font-weight: 400;
    letter-spacing: 0.03em;
    font-style: italic;
}

header .menu-icon {
    width: 24px;
    height: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: none;
    background: transparent;
    padding: 4px;
    cursor: pointer;
}

.menu-icon span {
    height: 2px;
    border-radius: 999px;
    background: #111827;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

header .menu-icon.menu-icon span:nth-child(1) {
    transform: translateY(4px) rotate(45deg);
}

header .menu-icon.menu-icon span:nth-child(2) {
    opacity: 0;
}

header .menu-icon.menu-icon span:nth-child(3) {
    transform: translateY(-4px) rotate(-45deg);
}

header .menu-icon.menu-icon--active span:nth-child(1) {
    transform: translateY(0px) rotate(0deg);
}

header .menu-icon.menu-icon--active span:nth-child(2) {
    opacity: 1;
}

header .menu-icon.menu-icon--active span:nth-child(3) {
    transform: translateY(0px) rotate(0deg);
}

/* Скрытие левой панели по классу на body */

body.left-collapsed .pane-left,
body.left-collapsed #divider-left {
    display: none;
}

/* Основной layout с тремя панелями */

.layout {
    display: flex;
    height: calc(100vh - var(--header-h) - var(--footer-h));
    overflow: hidden;
}

/* Общие настройки панелей */

.pane {
    min-width: 0;
    overflow: hidden;
}

/* Левая колонка (курсы + уроки) */

.pane-left {
    flex: 0 0 260px;
    border-right: 1px solid #e5e7eb;
    background: #f9fafb;
    padding: 16px 16px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 16px;

    min-height: 0;
    overflow: hidden;
}

/* Центральная колонка (контент урока) */

.pane-center {
    flex: 1 1 auto;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
}

/* Правая колонка (песочница) */

.pane-right {
    flex: 0 0 320px;
    background: #f9fafb;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
    /* важно для внутреннего скролла */

    min-height: 0;
}

/* Ручки-разделители */

.divider {
    flex: 0 0 6px;
    position: relative;
    cursor: col-resize;
}

.divider::before {
    content: "";
    position: absolute;
    inset: 47% 2px;
    border-radius: 999px;
    background: #d1d5db;
}

/* Во время ресайза блокируем выделение и показываем курсор */

body.is-resizing,
body.is-resizing * {
    cursor: col-resize !important;
    user-select: none;
}

/* Левый сайдбар – текущий курс и список уроков */

.current-course-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    margin-bottom: 8px;
}

#current-course-button {
    border: none;
    background: transparent;
    padding: 4px 0;
    font: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.lesson-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;

    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.lesson-item {
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lesson-item span.type {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.6;
    margin-left: 8px;
    white-space: nowrap;
}

.lesson-item.active {
    background: #e0f2fe;
    color: #0f172a;
}

.lesson-item:hover {
    background: #e5e7eb;
}

.lesson-item .type svg.done {
    vertical-align: middle;
    margin-left: 4px;
}

.other-courses {
    border-top: 1px solid #e5e7eb;
    padding-top: 12px;
    margin-top: auto;
}

.other-courses-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    margin-bottom: 8px;
}

.course-switch-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;

    max-height: 224px;
    /* ~7 items */
    overflow-y: auto;
}

.course-switch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
}

.course-switch-item:hover {
    background: #e5e7eb;
}

.course-switch-item.active {
    background: #111827;
    color: #f9fafb;
}

.course-switch-item .status {
    font-size: 12px;
    opacity: 0.7;
}

/* Центральная панель – контент урока */

.lesson-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.lesson-meta {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 16px;
}

.lesson-body {
    flex: 1;
    overflow: auto;
    padding-right: 4px;
}

.lesson-body p {
    margin: 0 0 12px;
    line-height: 1.5;
}

.lesson-media {
    border-radius: 10px;
    border: 1px dashed #cbd5e1;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #9ca3af;
    margin-bottom: 12px;
}

.lesson-media.hidden {
    display: none;
}

.lesson-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    gap: 12px;
}

.primary-btn {
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.primary-btn span.arrow {
    font-size: 16px;
    line-height: 1;
}

.primary-btn:hover {
    background: #1d4ed8;
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.notes {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.notes-header label {
    font-size: 13px;
    font-weight: 500;
    color: #4b5563;
}

.notes textarea {
    min-height: 80px;
    resize: vertical;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
}

.notes textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25);
}

.notes-save-btn {
    padding-inline: 10px;
    font-size: 12px;
}

.notes-status {
    min-height: 16px;
    font-size: 11px;
    color: #6b7280;
}

.notes label {
    font-size: 13px;
    color: #6b7280;
    display: block;
    margin-bottom: 4px;
}

.notes textarea {
    width: 100%;
    min-height: 80px;
    resize: vertical;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    padding: 8px;
    font-size: 13px;
    font-family: inherit;
}

/* Правая панель – песочница */

.sandbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.sandbox-title {
    font-weight: 600;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sandbox-select {
    border-radius: 999px;
    border: 1px solid #d1d5db;
    padding: 4px 8px;
    font-size: 13px;
    background: #ffffff;
}

.sandbox-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sandbox-editor textarea {
    width: 100%;
    flex: 1;
    resize: none;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    padding: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    background: #ffffff;
}

.sandbox-controls {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
}

.secondary-btn {
    border-radius: 999px;
    border: 1px solid #d1d5db;
    padding: 6px 12px;
    font-size: 13px;
    background: #ffffff;
    cursor: pointer;
}

.secondary-btn:hover {
    background: #e5e7eb;
}

.sandbox-output {
    margin-top: 8px;
    border-top: 1px solid #e5e7eb;
    padding-top: 8px;
}

.sandbox-output-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    margin-bottom: 4px;
}

.sandbox-output pre {
    background: #111827;
    color: #e5e7eb;
    padding: 8px;
    border-radius: 8px;
    font-size: 13px;
    overflow-x: auto;
    max-height: 120px;
    white-space: pre-wrap;
}

/* Адаптив */

@media (max-width: 1024px) {
    .layout {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - var(--header-h) - var(--footer-h));
        overflow: visible;
    }

    .divider {
        display: none;
    }

    .pane-left,
    .pane-center,
    .pane-right {
        flex: 0 0 auto;
        width: auto;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }

    .pane-right {
        border-bottom: none;
    }
}

/* Правая панель: заголовок и секции */

.side-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.side-panel-title {
    font-weight: 600;
    font-size: 15px;
}

.side-panel-section {
    flex: 1;
    display: none;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    /* скролл внутри секции (песочница/квиз) */
}

.side-panel-empty {
    flex: 1;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #6b7280;
    text-align: center;
    border-radius: 10px;
    border: 1px dashed #d1d5db;
    padding: 12px;
}

/* Квиз в правой панели */

.quiz {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    padding: 12px;
    flex: 1;
    min-height: 0;
    overflow: auto;
    /* скролл внутри квиза */
}

.quiz-header h3 {
    margin: 0 0 4px;
    font-size: 16px;
}

.quiz-description p {
    margin: 0 0 4px;
    font-size: 13px;
    color: #4b5563;
}

.quiz-question {
    border-radius: 8px;
    padding: 10px;
    background: #f9fafb;
    margin-bottom: 8px;
    border: 1px solid transparent;
}

.quiz-question-header {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #6b7280;
    margin-bottom: 4px;
}

.quiz-question-text {
    font-size: 14px;
    margin-bottom: 6px;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.quiz-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 6px;
    cursor: pointer;
}

.quiz-option:hover {
    background: #e5e7eb;
}

.quiz-option input {
    margin-top: 3px;
}

.quiz-text-input {
    width: 100%;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    font-size: 13px;
}

.quiz-order {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quiz-order-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.quiz-order-row select {
    border-radius: 999px;
    border: 1px solid #d1d5db;
    padding: 2px 10px;
    font-size: 13px;
    background: #ffffff;
}

.quiz-scale {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quiz-scale input[type=range] {
    flex: 1;
}

.quiz-scale-value {
    font-weight: 600;
}

.quiz-scale-bounds {
    font-size: 12px;
    color: #6b7280;
}

.quiz-explanation {
    margin-top: 6px;
    font-size: 12px;
    color: #4b5563;
}

.quiz-controls {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.quiz-result {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 500;
}

.quiz-question--correct {
    border-color: #22c55e;
    background: #ecfdf3;
}

.quiz-question--incorrect {
    border-color: #ef4444;
    background: #fef2f2;
}

.lesson-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    gap: 12px;
}

.lesson-actions-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.next-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Контент уроков с современным оформлением */

.lesson-content {
    font-size: 14px;
    line-height: 1.6;
    color: #111827;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.lesson-content p {
    margin: 0 0 8px;
}

.lesson-content a {
    color: #2563eb;
    text-decoration: none;
}

.lesson-content a:hover {
    text-decoration: underline;
}

.lesson-section {
    padding: 12px 14px;
    border-radius: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.lesson-section h2 {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
}

.lesson-tagline {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #6b7280;
    margin-bottom: 4px;
}

.lesson-list {
    margin: 8px 0 0;
    padding-left: 18px;
}

.lesson-list li {
    margin-bottom: 4px;
}

.lesson-list--numbered {
    list-style: decimal;
}

.lesson-list--bulleted {
    list-style: disc;
}

/* Колонки и карточки для сравнения промптов */

.lesson-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.lesson-card {
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 10px 12px;
    background: #ffffff;
    font-size: 13px;
}

.lesson-card h3 {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 600;
}

.lesson-card--bad {
    border-color: #fecaca;
    background: #fef2f2;
}

.lesson-card--good {
    border-color: #bbf7d0;
    background: #ecfdf3;
}

/* Подсказки и callout-блоки */

.lesson-tip,
.lesson-callout {
    border-radius: 10px;
    padding: 10px 12px;
    margin-top: 12px;
    font-size: 13px;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.lesson-tip {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.lesson-callout {
    background: #fef9c3;
    border: 1px solid #facc15;
}

.lesson-callout--danger {
    background: #fef2f2;
    border-color: #ef4444;
}

.lesson-tip-icon,
.lesson-callout-icon {
    font-size: 16px;
    line-height: 1;
    margin-top: 2px;
}

.lesson-tip-body,
.lesson-callout-body {
    flex: 1;
}

/* Код и inline-code */

/* Общий стиль для inline-кода */
.lesson-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    background: #f3f4f6;
    padding: 2px 4px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

/* Блоки кода в уроках */
.lesson-content pre {
    margin: 8px 0 0;
    padding: 8px 10px;
    border-radius: 10px;
    background: #0f172a;
    color: #e5e7eb;
    overflow-x: auto;
    font-size: 13px;
}

/* Внутри pre убираем фон и отступы у code,
   чтобы не было светлых "плашек" поверх тёмного блока */
.lesson-content pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    color: inherit;
    border: 0;
}

/* Чипы / small-метки */

.lesson-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.lesson-chip {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e5e7eb;
    color: #374151;
}

.app-footer {
    padding: 8px 16px;
    font-size: 12px;
    color: #6b7280;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    text-align: right;

    min-height: var(--footer-h);
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.app-footer a {
    color: #4b5563;
    text-decoration: none;
    font-weight: 500;
}

.app-footer a:hover {
    color: #111827;
    text-decoration: underline;
}

/* HEADER RIGHT: гамбургер + аватар */

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-avatar-btn {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    padding: 0;
    overflow: hidden;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.profile-avatar-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    /* по умолчанию скрыта, пока нет аватара */
}

#profile-avatar-initials {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    letter-spacing: 0.05em;
}

/* AUTH OVERLAY */

.auth-overlay {
    position: fixed;
    inset: 0;
    /* Чуть темнее, чтобы меньше просвечивало */
    background: rgba(15, 23, 42, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.auth-overlay {
    position: fixed;
    inset: 0;
    /* Чуть темнее, чтобы меньше просвечивало */
    background: rgba(15, 23, 42, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;

    /* Сильный blur фона */
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

body.auth-locked {
    overflow: hidden;
}

.auth-overlay--hidden {
    display: none;
}

.auth-modal {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 16px;
    padding: 24px 24px 20px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.3);
}

.auth-title {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 600;
}

.auth-subtitle {
    margin: 0 0 16px;
    font-size: 13px;
    color: #6b7280;
}

.auth-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    margin-bottom: 12px;
}

.auth-label input {
    padding: 7px 9px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    font-size: 13px;
}

.auth-label input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25);
}

.auth-primary-btn {
    width: 100%;
    justify-content: center;
    margin-top: 4px;
}

.auth-secondary-btn {
    width: 100%;
    justify-content: center;
    margin-top: 8px;
}

.auth-step.hidden {
    display: none;
}

.auth-otp-text {
    font-size: 13px;
    margin: 0 0 10px;
}

.auth-otp-inputs {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 10px;
}

.auth-otp-input {
    width: 40px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid #d1d5db;
    text-align: center;
    font-size: 18px;
    font-weight: 500;
}

.auth-otp-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25);
}

.auth-error {
    min-height: 16px;
    margin-top: 8px;
    font-size: 12px;
    color: #b91c1c;
}

/* PROFILE MODAL */

.profile-modal.hidden {
    display: none;
}

.profile-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
}

.profile-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
}

.profile-modal-content {
    position: absolute;
    right: 16px;
    top: 64px;
    width: 320px;
    max-width: calc(100% - 32px);
    background: #ffffff;
    border-radius: 16px;
    padding: 16px 16px 14px;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.35);
}

.profile-modal-content h2 {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 600;
}

.profile-modal-close {
    position: absolute;
    top: 6px;
    right: 8px;
    border: none;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
    color: #9ca3af;
}

.profile-modal-close:hover {
    color: #4b5563;
}

.profile-avatar-block {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.profile-avatar-preview {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-upload {
    font-size: 12px;
    color: #2563eb;
    cursor: pointer;
}

.profile-avatar-upload input {
    display: none;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
    font-size: 13px;
}

.profile-field input {
    padding: 7px 9px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    font-size: 13px;
}

.profile-field input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25);
}

.profile-actions {
    display: flex;
    justify-content: flex-end;
}

.access-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 45;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.access-overlay--hidden {
    display: none;
}

.access-modal {
    max-width: 420px;
    width: 100%;
    background: #ffffff;
    border-radius: 16px;
    padding: 24px 24px 20px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.35);
    text-align: left;
}

.access-title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
}

.access-text {
    margin: 0 0 6px;
    font-size: 13px;
    color: #4b5563;
}

.current-course {
    display: flex;
    flex-direction: column;
    min-height: 0
}

.hidden {
    display: none !important;
}

.modal {
    position: fixed;
    inset: 0;
    display: grid;
    align-items: center;
    justify-items: center;
    background: rgba(17, 24, 39, 0.45);
    backdrop-filter: blur(2px);
    z-index: 9999;
    /* выше хедера/сайдбара */
}

.modal-card {
    width: min(560px, calc(100vw - 32px));
    max-height: min(80vh, 700px);
    overflow: auto;
    /* скролл, если текст длинный */
    background: #fff;
    color: #111827;
    border-radius: 16px;
    padding: 20px 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .20);
}

.modal-card h3 {
    margin: 0 0 8px;
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-card .muted {
    color: #6b7280;
    margin: 0 0 12px;
    font-size: 13px;
}

.modal-card textarea {
    width: 100%;
    min-height: 140px;
    resize: vertical;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px 12px;
    outline: none;
    font: inherit;
}

.modal-card textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.modal-card .row {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.btn {
    appearance: none;
    border: 0;
    cursor: pointer;
    border-radius: 10px;
    padding: 10px 14px;
    font: inherit;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-primary:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.btn-ghost {
    background: transparent;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.btn-ghost:hover {
    background: #f3f4f6;
}

.course-switch-item.locked { opacity: .65; }
.course-switch-item.locked:hover { opacity: .8; }

/* Обёртка для код-блока с кнопкой копирования */
.code-with-copy { position: relative; }

/* Сам код — без лишних отступов к обёртке */
.code-with-copy > pre { margin: 0; }

/* Кнопка копирования: компактная, с иконкой "два скруглённых прямоугольника" */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(17,24,39,.92); /* близко к вашим тёмным тонам */
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  opacity: .85;
  transition: opacity .15s ease, transform .05s ease, border-color .15s ease;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}

/* при наведении и активном состоянии */
.copy-btn:hover { opacity: 1; }
.copy-btn:active { transform: translateY(1px); }

/* состояние «скопировано» — зелёная окантовка */
.copy-btn.copied { border-color: #16a34a; }

/* Иконки внутри кнопки */
.copy-btn svg { width: 18px; height: 18px; display: block; }

/* Текст для экранных читалок */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
