@import url('./fonts/golos.css');

/* ============================================================ токены */

:root {
    /* Ахроматическая шкала. Чистые #000/#fff не используются как пара:
       на длинном тексте такой контраст режет глаз. */
    --c-bg: #f7f7f7;
    --c-surface: #ffffff;
    --c-surface-2: #f0f0f0;
    --c-text: #0f0f0f;
    --c-text-dim: #2b2b2b;
    --c-placeholder: #6b6b6b;
    --c-line: #dcdcdc;
    --c-line-strong: #bdbdbd;
    --c-inverse-bg: #0f0f0f;
    --c-inverse-text: #fafafa;
    --c-focus: #0f0f0f;

    --step-0: 0.8125rem;  /* 13 — подписи, метаданные */
    --step-1: 0.9375rem;  /* 15 — основной текст интерфейса */
    --step-2: 1.0625rem;  /* 17 — текст ответа модели */
    --step-3: 1.3125rem;  /* 21 */
    --step-4: 1.75rem;    /* 28 */

    --lh-text: 1.55;
    --lh-tight: 1.2;

    --s1: 4px;
    --s2: 8px;
    --s3: 12px;
    --s4: 16px;
    --s5: 24px;
    --s6: 32px;
    --s7: 48px;

    --r-sm: 2px;
    --r-md: 3px;

    --sidebar-w: 264px;
    --measure: 68ch;

    --t-fast: 120ms;
    --t-base: 160ms;
    --ease: cubic-bezier(0.2, 0, 0.2, 1);

    color-scheme: light;
}

:root[data-theme='dark'] {
    --c-bg: #0d0d0d;
    --c-surface: #151515;
    --c-surface-2: #1d1d1d;
    --c-text: #f2f2f2;
    --c-text-dim: #d2d2d2;
    --c-placeholder: #8a8a8a;
    --c-line: #2b2b2b;
    --c-line-strong: #3d3d3d;
    --c-inverse-bg: #f2f2f2;
    --c-inverse-text: #0d0d0d;
    --c-focus: #f2f2f2;

    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) {
        --c-bg: #0d0d0d;
        --c-surface: #151515;
        --c-surface-2: #1d1d1d;
        --c-text: #f2f2f2;
        --c-text-dim: #d2d2d2;
        --c-placeholder: #8a8a8a;
        --c-line: #2b2b2b;
        --c-line-strong: #3d3d3d;
        --c-inverse-bg: #f2f2f2;
        --c-inverse-text: #0d0d0d;
        --c-focus: #f2f2f2;

        color-scheme: dark;
    }
}

/* ============================================================== база */

*,
*::before,
*::after { box-sizing: border-box; }

/* display у компонентов перебивает браузерное [hidden] — возвращаем ему силу. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--c-bg);
    color: var(--c-text);
    font-family: 'Golos Text', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: var(--step-1);
    line-height: var(--lh-text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3 {
    margin: 0;
    font-weight: 600;
    line-height: var(--lh-tight);
    letter-spacing: -0.011em;
}

button, input, textarea, select {
    font: inherit;
    color: inherit;
}

:focus { outline: none; }

:focus-visible {
    outline: 2px solid var(--c-focus);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}

::selection {
    background: var(--c-inverse-bg);
    color: var(--c-inverse-text);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================================== кнопки */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s2);
    padding: 0 var(--s4);
    height: 38px;
    border: 1px solid var(--c-line-strong);
    border-radius: var(--r-sm);
    background: var(--c-surface);
    color: var(--c-text);
    font-size: var(--step-1);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}

.btn:hover:not(:disabled) { background: var(--c-surface-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn--primary {
    background: var(--c-inverse-bg);
    color: var(--c-inverse-text);
    border-color: var(--c-inverse-bg);
}

.btn--primary:hover:not(:disabled) {
    background: var(--c-text);
    border-color: var(--c-text);
}

.btn--ghost {
    background: transparent;
    border-color: transparent;
}

.btn--ghost:hover:not(:disabled) { background: var(--c-surface-2); }

.btn--block { width: 100%; }

.btn--sm { height: 30px; padding: 0 var(--s3); font-size: var(--step-0); }

.btn__spinner {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 600ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================ поля */

.field { display: grid; gap: var(--s1); }

.field__label {
    font-size: var(--step-0);
    font-weight: 500;
}

.input {
    width: 100%;
    height: 40px;
    padding: 0 var(--s3);
    background: var(--c-surface);
    border: 1px solid var(--c-line-strong);
    border-radius: var(--r-sm);
    transition: border-color var(--t-fast) var(--ease);
}

.input::placeholder,
.composer__input::placeholder { color: var(--c-placeholder); }

.input:hover { border-color: var(--c-text-dim); }

.input:focus-visible {
    border-color: var(--c-focus);
    outline-offset: 0;
}

.input[aria-invalid='true'] { border-color: var(--c-text); border-width: 2px; }

/* Сообщение об ошибке всегда рядом с тем, что её вызвало. */
.notice {
    padding: var(--s3);
    border: 1px solid var(--c-text);
    border-radius: var(--r-sm);
    background: var(--c-surface-2);
    font-size: var(--step-0);
}

.notice--quiet { border-color: var(--c-line); }

/* ============================================================ вход */

.auth {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.auth__aside {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: var(--s7);
    background: var(--c-inverse-bg);
    color: var(--c-inverse-text);
}

.auth__panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--s6) var(--s5);
}

.auth__form {
    width: 100%;
    max-width: 360px;
    display: grid;
    gap: var(--s4);
}

.wordmark {
    font-size: var(--step-4);
    font-weight: 600;
    letter-spacing: -0.03em;
}

.auth__facts {
    display: grid;
    gap: var(--s3);
    font-size: var(--step-1);
}

.auth__fact {
    display: flex;
    justify-content: space-between;
    gap: var(--s4);
    padding-bottom: var(--s3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

:root[data-theme='dark'] .auth__fact { border-bottom-color: rgba(0, 0, 0, 0.16); }

.tabs {
    display: flex;
    gap: var(--s5);
    border-bottom: 1px solid var(--c-line);
}

.tab {
    padding: 0 0 var(--s3);
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: none;
    color: var(--c-text-dim);
    font-weight: 500;
    cursor: pointer;
    transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}

.tab[aria-selected='true'] {
    color: var(--c-text);
    border-bottom-color: var(--c-text);
}

.divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: var(--s3);
    font-size: var(--step-0);
    color: var(--c-text-dim);
}

.divider::before,
.divider::after {
    content: '';
    height: 1px;
    background: var(--c-line);
}

.providers { display: grid; gap: var(--s2); }

/* ============================================================= app */

.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    height: 100dvh;
    overflow: hidden;
}

.sidebar {
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    min-height: 0;
    border-right: 1px solid var(--c-line);
    background: var(--c-surface);
}

.sidebar__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s2);
    padding: var(--s4);
}

.sidebar__brand {
    font-weight: 600;
    letter-spacing: -0.02em;
}

.sidebar__list {
    overflow-y: auto;
    padding: 0 var(--s2) var(--s2);
    min-height: 0;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: var(--s2);
    width: 100%;
    padding: var(--s2) var(--s3);
    border: none;
    border-radius: var(--r-sm);
    background: none;
    color: var(--c-text);
    text-align: left;
    cursor: pointer;
    transition: background var(--t-fast) var(--ease);
}

.chat-item:hover { background: var(--c-surface-2); }

.chat-item[aria-current='true'] {
    background: var(--c-inverse-bg);
    color: var(--c-inverse-text);
}

.chat-item__title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-item__del {
    flex: none;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: var(--r-sm);
    background: none;
    color: inherit;
    opacity: 0;
    cursor: pointer;
}

.chat-item:hover .chat-item__del,
.chat-item__del:focus-visible { opacity: 0.7; }

.chat-item__del:hover { opacity: 1; background: var(--c-surface-2); color: var(--c-text); }

.sidebar__foot {
    display: grid;
    gap: var(--s2);
    padding: var(--s3) var(--s4) var(--s4);
    border-top: 1px solid var(--c-line);
}

.balance {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s2);
}

.balance__value {
    font-size: var(--step-3);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.user {
    display: flex;
    align-items: center;
    gap: var(--s2);
    min-width: 0;
}

.avatar {
    flex: none;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 2px;
    background: var(--c-inverse-bg);
    color: var(--c-inverse-text);
    font-size: var(--step-0);
    font-weight: 600;
    overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

.user__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================================== диалог */

.main {
    display: grid;
    grid-template-rows: 1fr auto;
    min-height: 0;
    min-width: 0;
}

.thread {
    overflow-y: auto;
    padding: var(--s6) var(--s5);
    min-height: 0;
}

.thread__inner {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    gap: var(--s6);
}

.turn { display: grid; gap: var(--s4); }

.ask {
    max-width: var(--measure);
    padding: var(--s3) var(--s4);
    border: 1px solid var(--c-line);
    border-radius: var(--r-md);
    background: var(--c-surface);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Ответы моделей стоят рядом — в этом весь смысл сервиса. */
.answers {
    display: grid;
    gap: var(--s4);
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    align-items: start;
}

.answer {
    display: grid;
    grid-template-rows: auto 1fr auto;
    border: 1px solid var(--c-line);
    border-radius: var(--r-md);
    background: var(--c-surface);
    overflow: hidden;
    transition: border-color var(--t-base) var(--ease);
}

.answer[data-best='true'] { border-color: var(--c-text); border-width: 2px; }

.answer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s2);
    padding: var(--s2) var(--s3);
    border-bottom: 1px solid var(--c-line);
    font-size: var(--step-0);
    font-weight: 500;
}

.answer__body {
    padding: var(--s4);
    font-size: var(--step-2);
    overflow-wrap: break-word;
    min-width: 0;
}

.answer__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s2);
    padding: var(--s2) var(--s3);
    border-top: 1px solid var(--c-line);
    font-size: var(--step-0);
    color: var(--c-text-dim);
    font-variant-numeric: tabular-nums;
}

/* ======================================================== markdown */

/* Ответ модели приходит размеченным — списки, таблицы, код должны читаться
   как текст документа, а не как дамп. Отступы заданы только между блоками,
   чтобы карточка не распухала. */
.markdown > *:first-child { margin-top: 0; }
.markdown > *:last-child { margin-bottom: 0; }

.markdown p,
.markdown ul,
.markdown ol,
.markdown blockquote,
.markdown pre,
.markdown table { margin: 0 0 var(--s3); }

.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4 {
    margin: var(--s5) 0 var(--s2);
    line-height: var(--lh-tight);
}

.markdown h1 { font-size: var(--step-3); }
.markdown h2 { font-size: var(--step-2); }
.markdown h3,
.markdown h4 { font-size: var(--step-1); }

.markdown ul,
.markdown ol { padding-left: 1.35em; }

.markdown li { margin-bottom: var(--s1); }

.markdown li::marker { color: var(--c-text); }

.markdown blockquote {
    padding-left: var(--s3);
    border-left: 2px solid var(--c-line-strong);
}

.markdown a { color: inherit; text-underline-offset: 2px; }

.markdown hr {
    height: 0;
    margin: var(--s4) 0;
    border: none;
    border-top: 1px solid var(--c-line);
}

/* Код — единственное место, где моноширинный оправдан:
   в нём значимы пробелы и выравнивание. */
.markdown code {
    padding: 0.1em 0.35em;
    border: 1px solid var(--c-line);
    border-radius: 4px;
    background: var(--c-surface-2);
    font-family: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', monospace;
    font-size: 0.9em;
}

.markdown pre {
    padding: var(--s3);
    border: 1px solid var(--c-line);
    border-radius: var(--r-sm);
    background: var(--c-surface-2);
    overflow-x: auto;
}

.markdown pre code {
    padding: 0;
    border: none;
    background: none;
}

/* Таблица шире карточки прокручивается внутри себя, а не ломает вёрстку. */
.markdown table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: var(--step-1);
}

.markdown th,
.markdown td {
    padding: var(--s2) var(--s3);
    border: 1px solid var(--c-line);
    text-align: left;
    vertical-align: top;
}

.markdown th {
    background: var(--c-surface-2);
    font-weight: 600;
    white-space: nowrap;
}

/* Курсор набора: показывает, что ответ ещё идёт. */
.caret::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 1.05em;
    margin-left: 2px;
    background: currentColor;
    vertical-align: -0.15em;
    animation: blink 1s steps(2, start) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* ======================================================== компоузер */

.composer {
    border-top: 1px solid var(--c-line);
    background: var(--c-surface);
    padding: var(--s3) var(--s5) var(--s4);
}

.composer__inner {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    gap: var(--s3);
}

.models {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s2);
}

.model-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--s2);
    padding: var(--s1) var(--s3);
    border: 1px solid var(--c-line-strong);
    border-radius: 2px;
    background: var(--c-surface);
    font-size: var(--step-0);
    cursor: pointer;
    transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}

.model-chip:hover { border-color: var(--c-text-dim); }

.model-chip[aria-pressed='true'] {
    background: var(--c-inverse-bg);
    color: var(--c-inverse-text);
    border-color: var(--c-inverse-bg);
}

.model-chip:disabled { opacity: 0.4; cursor: not-allowed; }

.model-chip__price {
    font-variant-numeric: tabular-nums;
    opacity: 0.7;
}

.composer__row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--s3);
    align-items: end;
}

.composer__input {
    width: 100%;
    min-height: 44px;
    max-height: 200px;
    padding: var(--s3);
    border: 1px solid var(--c-line-strong);
    border-radius: var(--r-sm);
    background: var(--c-bg);
    resize: none;
    overflow-y: auto;
}

.composer__input:focus-visible { border-color: var(--c-focus); outline-offset: 0; }

.composer__hint {
    font-size: var(--step-0);
    color: var(--c-text-dim);
    font-variant-numeric: tabular-nums;
}

/* ============================================== пустые состояния */

.empty {
    display: grid;
    gap: var(--s3);
    max-width: var(--measure);
    margin: var(--s7) auto;
}

.empty__title { font-size: var(--step-3); }

/* ========================================================== модалка */

.modal[hidden] { display: none; }

.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: var(--s4);
    background: rgba(0, 0, 0, 0.45);
    z-index: 50;
}

.modal__box {
    width: 100%;
    max-width: 420px;
    display: grid;
    gap: var(--s4);
    padding: var(--s5);
    border: 1px solid var(--c-line);
    border-radius: var(--r-md);
    background: var(--c-surface);
}

.modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s3);
}

.amounts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s2);
}

/* ========================================================= адаптив */

@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; }
    .auth__aside { display: none; }
}

@media (max-width: 780px) {
    .app { grid-template-columns: 1fr; }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--sidebar-w);
        z-index: 40;
        transform: translateX(-100%);
        transition: transform var(--t-base) var(--ease);
    }

    .sidebar[data-open='true'] { transform: none; }

    .thread { padding: var(--s4) var(--s3); }
    .composer { padding: var(--s3); }
    .answers { grid-template-columns: 1fr; }
}

.only-mobile { display: none; }

@media (max-width: 780px) {
    .only-mobile { display: inline-flex; }
}

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ================================================ сайдбар: детали */

.sidebar__sub { padding: 0 var(--s4) var(--s3); }

.sidebar__row { display: flex; gap: var(--s2); }
.sidebar__row > .btn { flex: 1; }

.sidebar__empty { padding: var(--s3); font-size: var(--step-0); margin: 0; }

.chat-item__title {
    flex: 1;
    min-width: 0;
    padding: 0;
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.chat-item__act {
    flex: none;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: var(--r-sm);
    background: none;
    color: inherit;
    font-size: var(--step-0);
    opacity: 0;
    cursor: pointer;
}

.chat-item:hover .chat-item__act,
.chat-item__act:focus-visible { opacity: 0.75; }

.chat-item__act:hover { opacity: 1; background: var(--c-surface-2); color: var(--c-text); }

.chat-item__input {
    flex: 1;
    min-width: 0;
    height: 24px;
    padding: 0 var(--s1);
    border: 1px solid var(--c-focus);
    border-radius: var(--r-sm);
    background: var(--c-surface);
    color: var(--c-text);
}

.sidebar-open { position: fixed; left: 12px; top: 12px; z-index: 30; }

/* ==================================================== ход диалога */

.ask {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s4);
    max-width: var(--measure);
    padding: var(--s3) var(--s4);
    border: 1px solid var(--c-line);
    border-radius: var(--r-md);
    background: var(--c-surface);
}

.ask__text { white-space: pre-wrap; overflow-wrap: anywhere; }

.ask .btn { flex: none; opacity: 0; }
.ask:hover .btn,
.ask .btn:focus-visible { opacity: 1; }

.answer__meta { font-variant-numeric: tabular-nums; }

.answer__actions { display: flex; gap: var(--s2); }

/* ====================================================== таблицы UI */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--step-0);
}

.table th,
.table td {
    padding: var(--s2) var(--s3);
    border-bottom: 1px solid var(--c-line);
    text-align: left;
}

.table th { font-weight: 600; white-space: nowrap; }

.table td.num,
.table th.num { text-align: right; font-variant-numeric: tabular-nums; }

.table tbody tr:last-child td { border-bottom: none; }

.table__note { margin: var(--s3) 0 0; font-size: var(--step-0); }

/* ===================================================== статистика */

.stats__summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--s3);
}

.stat {
    display: grid;
    gap: 2px;
    padding: var(--s3);
    border: 1px solid var(--c-line);
    border-radius: var(--r-sm);
}

.stat__value {
    font-size: var(--step-3);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.stat__label { font-size: var(--step-0); }

/* ================================================== панели аккаунта */

.pane { display: grid; gap: var(--s4); }

.stack { display: grid; gap: var(--s3); }

.stack h3 { font-size: var(--step-1); }

.modal__box--wide { max-width: 640px; }

.modal__box { max-height: 88dvh; overflow-y: auto; }

.modal__head h2 { font-size: var(--step-3); }

/* ================================================== документы */

.doc {
    max-width: var(--measure);
    margin: 0 auto;
    padding: var(--s7) var(--s5);
}

.doc h1 { font-size: var(--step-4); margin-bottom: var(--s2); }

.doc h2 {
    font-size: var(--step-2);
    margin: var(--s6) 0 var(--s3);
}

.doc p, .doc li { margin: 0 0 var(--s3); }

.doc ul { padding-left: 1.35em; }

.doc__meta { font-size: var(--step-0); }

.doc__back { margin-bottom: var(--s5); }

.doc a { color: inherit; }

/* Незаполненные реквизиты видно сразу — документ без них силы не имеет. */
.doc__todo {
    padding: var(--s3);
    border: 2px solid var(--c-text);
    border-radius: var(--r-sm);
    background: var(--c-surface-2);
    font-size: var(--step-0);
}

.legal { font-size: var(--step-0); margin: 0; }
.legal a { color: inherit; }

/* ============================================ шапка чата и поиск */

.chatbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s3);
    padding: var(--s2) var(--s5);
    border-bottom: 1px solid var(--c-line);
    background: var(--c-surface);
}

.chatbar__title {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chatbar__actions { display: flex; gap: var(--s2); flex: none; }

.sidebar__sub { display: grid; gap: var(--s2); }

.input--sm { height: 32px; font-size: var(--step-0); }

/* ================================================ оценка стоимости */

.estimate {
    font-size: var(--step-0);
    font-variant-numeric: tabular-nums;
}

/* Предупреждение о нехватке денег обязано быть заметным. */
.estimate[data-warn='true'] {
    padding: var(--s2) var(--s3);
    border: 1px solid var(--c-text);
    border-radius: var(--r-sm);
    background: var(--c-surface-2);
}

/* ==================================================== мелочи форм */

.hint { font-size: var(--step-0); margin: 0; }

.modal__foot { display: flex; gap: var(--s2); justify-content: flex-end; }

.linklike {
    padding: 0;
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

/* ============================================= копирование кода */

.markdown pre { position: relative; }

.code-copy {
    position: absolute;
    top: var(--s2);
    right: var(--s2);
    padding: 2px var(--s2);
    border: 1px solid var(--c-line-strong);
    border-radius: var(--r-sm);
    background: var(--c-surface);
    color: var(--c-text);
    font-size: var(--step-0);
    opacity: 0;
    cursor: pointer;
    transition: opacity var(--t-fast) var(--ease);
}

.markdown pre:hover .code-copy,
.code-copy:focus-visible { opacity: 1; }
