/* --- Шрифт: Montserrat Alternates со своего сервера (SIL OFL 1.1, fonts/OFL.txt) --- */
@font-face { font-family: "Montserrat Alternates"; font-weight: 400; font-display: swap; src: url("fonts/montserrat-alternates-cyrillic-400-normal.woff2") format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Montserrat Alternates"; font-weight: 400; font-display: swap; src: url("fonts/montserrat-alternates-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Montserrat Alternates"; font-weight: 400; font-display: swap; src: url("fonts/montserrat-alternates-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Montserrat Alternates"; font-weight: 500; font-display: swap; src: url("fonts/montserrat-alternates-cyrillic-500-normal.woff2") format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Montserrat Alternates"; font-weight: 500; font-display: swap; src: url("fonts/montserrat-alternates-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Montserrat Alternates"; font-weight: 500; font-display: swap; src: url("fonts/montserrat-alternates-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Montserrat Alternates"; font-weight: 600; font-display: swap; src: url("fonts/montserrat-alternates-cyrillic-600-normal.woff2") format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Montserrat Alternates"; font-weight: 600; font-display: swap; src: url("fonts/montserrat-alternates-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Montserrat Alternates"; font-weight: 600; font-display: swap; src: url("fonts/montserrat-alternates-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

:root {
    --text: #333;
    --muted: #8a8a8a;
    --accent: #cb4545;
    --accent-hover: #b53c3c;
    --accent-soft: rgba(203, 69, 69, 0.14);
    --surface: #f7f7f7;
    --line: #e4e4e4;
    --radius: 14px;
    --hanzi: "Kaiti SC", "STKaiti", "KaiTi", "BiauKai", serif;
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }

body {
    background: #fff;
    color: var(--text);
    font-family: "Montserrat Alternates", sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* --- Шапка и заголовок --- */
.header { text-align: center; padding: 32px 16px 8px; }
.header__logo { width: 150px; display: inline-block; }

.main { max-width: 640px; margin: 0 auto; padding: 24px 16px 64px; }
.title { font-size: 34px; font-weight: 600; text-align: center; line-height: 1.2; }
.lead { color: var(--muted); text-align: center; margin: 12px 0 36px; }

/* --- Карточка с настройками --- */
.card {
    background: var(--surface);
    border-radius: 24px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.field { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.field__label { font-weight: 500; }
.field__optional { color: var(--muted); font-weight: 400; }
.field__hint { font-size: 13px; color: var(--muted); }
.field__hint.is-error { color: var(--accent); }

input[type="text"], textarea, .stepper {
    width: 100%;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: border-color .15s, box-shadow .15s;
}

input[type="text"], textarea { padding: 14px 16px; }
textarea { resize: vertical; min-height: 96px; font-family: var(--hanzi), "Montserrat Alternates", sans-serif; font-size: 22px; line-height: 1.4; }
textarea::placeholder, input::placeholder { color: #b8b8b8; }

input[type="text"]:focus, textarea:focus, .stepper:focus-within {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* --- Переключатель «книжная / альбомная» --- */
.segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #ececec;
    border-radius: var(--radius);
    padding: 4px;
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
    display: block;
    text-align: center;
    padding: 10px 8px;
    border-radius: 10px;
    color: var(--muted);
    cursor: pointer;
    transition: background .15s, color .15s;
}
.segmented input:checked + span { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.segmented input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

/* --- Число строк --- */
.stepper { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; height: 50px; }
.stepper button {
    height: 100%;
    background: none;
    border: 0;
    font-size: 22px;
    color: var(--accent);
    cursor: pointer;
}
.stepper input {
    width: 100%;
    border: 0;
    background: none;
    text-align: center;
    font-weight: 500;
    font-size: 18px;
    -moz-appearance: textfield;
}
.stepper input:focus { outline: none; }
.stepper input::-webkit-inner-spin-button,
.stepper input::-webkit-outer-spin-button { -webkit-appearance: none; }

/* --- Тумблеры --- */
.switches { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track {
    flex: none;
    position: relative;
    width: 44px;
    height: 26px;
    margin-top: 1px;
    border-radius: 13px;
    background: #d6d6d6;
    transition: background .2s;
}
.switch__track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
    transition: transform .2s;
}
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 4px var(--accent-soft); }
.switch__text { display: flex; flex-direction: column; font-weight: 500; }
.switch__text small { font-size: 13px; font-weight: 400; color: var(--muted); }

/* --- Ручной пиньинь --- */
.manual { display: flex; flex-direction: column; gap: 16px; }
.manual[hidden] { display: none; }
.manual__words { display: flex; flex-wrap: wrap; gap: 12px; }
.manual__empty { font-size: 14px; color: var(--muted); }
.word { display: flex; gap: 6px; padding: 8px; background: #fff; border-radius: var(--radius); }
.word__char { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.word__char span { font-family: var(--hanzi); font-size: 30px; line-height: 1.2; }
.word__char input {
    width: 64px;
    padding: 6px 4px;
    text-align: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    font-size: 16px; /* меньше 16px — Safari на iPhone увеличивает страницу при фокусе */
}
.word__char input:focus { outline: none; border-color: var(--accent); background: #fff; }

/* --- Кнопка --- */
.button {
    border: 0;
    border-radius: var(--radius);
    padding: 18px 24px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 17px;
    cursor: pointer;
    transition: background .15s, transform .1s;
}
.button:hover { background: var(--accent-hover); }
.button:active { transform: scale(.99); }
.button:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--accent-soft); }

/* --- SEO-текст под формой и юридические страницы --- */
.info, .legal-page { max-width: 640px; margin: 0 auto; padding: 0 16px 72px; }
.legal-page { max-width: 760px; padding-top: 24px; }
.info h2, .legal-page h2 { font-size: 22px; font-weight: 600; line-height: 1.3; margin: 48px 0 14px; }
.info h2:first-child { margin-top: 24px; }
.info h3, .legal-page h3 { font-size: 17px; font-weight: 600; margin: 24px 0 6px; }
.info p, .info li, .legal-page p, .legal-page li { color: #555; line-height: 1.7; }
.info p + p, .legal-page p + p { margin-top: 12px; }
.info ol, .legal-page ul { padding-left: 1.3em; display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.legal-page h1 { font-size: 28px; font-weight: 600; line-height: 1.25; margin-bottom: 8px; }
.legal-page a { color: var(--accent); overflow-wrap: anywhere; } /* длинные URL распирали страницу на телефоне */
.legal-page strong { color: var(--text); }
.legal-page__dates { font-size: 14px; color: var(--muted) !important; margin-bottom: 8px; }
.legal-page__table-wrap { overflow-x: auto; margin: 12px 0 20px; }
.legal-page table { width: 100%; border-collapse: collapse; font-size: 14px; color: #555; }
.legal-page th { background: var(--surface); color: var(--text); font-weight: 500; text-align: left; }
.legal-page th, .legal-page td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }

/* --- Подвал --- */
.footer { border-top: 1px solid var(--line); padding: 24px 16px 40px; }
.footer__nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 24px; }
.footer__nav a { font-size: 14px; color: var(--muted); text-decoration: none; }
.footer__nav a:hover { color: var(--accent); }

/* --- Баннер о файлах cookie (static/cookie-banner.js) --- */
.cookie-banner {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    width: calc(100% - 40px);
    max-width: 380px;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .14);
}
.cookie-banner__text { font-size: 13px; line-height: 1.45; color: #555; margin-bottom: 16px; }
.cookie-banner__text a { color: var(--accent); }
.cookie-banner__button {
    width: 100%;
    padding: 10px 16px;
    background: var(--accent);
    border: 0;
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
}
.cookie-banner__button:hover { background: var(--accent-hover); }

/* --- Телефон --- */
@media (max-width: 560px) {
    .header { padding-top: 24px; }
    .header__logo { width: 130px; }
    .title { font-size: 28px; }
    .lead { margin-bottom: 28px; }
    .card { padding: 22px 18px; border-radius: 20px; gap: 24px; }
    .field-row, .switches { grid-template-columns: 1fr; }
    .info h2, .legal-page h2 { font-size: 20px; margin-top: 40px; }
    .legal-page h1 { font-size: 24px; }
    .cookie-banner { right: 12px; bottom: 12px; width: calc(100% - 24px); }
}
