/* GTXT Студия. Шрифты: PT Sans и Unbounded (SIL OFL 1.1, файлы в /fonts). */
@font-face { font-family: "GTXT Sans"; font-weight: 400; font-display: swap; src: url(/fonts/pt-sans-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: "GTXT Sans"; font-weight: 400; font-display: swap; src: url(/fonts/pt-sans-cyrillic-ext-400-normal.woff2) format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "GTXT Sans"; font-weight: 400; font-display: swap; src: url(/fonts/pt-sans-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: "GTXT Sans"; font-weight: 700; font-display: swap; src: url(/fonts/pt-sans-cyrillic-700-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "GTXT Sans"; font-weight: 700; font-display: swap; src: url(/fonts/pt-sans-cyrillic-ext-700-normal.woff2) format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "GTXT Sans"; font-weight: 700; font-display: swap; src: url(/fonts/pt-sans-latin-700-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: "GTXT Display"; font-weight: 700; font-display: swap; src: url(/fonts/unbounded-cyrillic-700-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "GTXT Display"; font-weight: 700; font-display: swap; src: url(/fonts/unbounded-cyrillic-ext-700-normal.woff2) format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "GTXT Display"; font-weight: 700; font-display: swap; src: url(/fonts/unbounded-latin-700-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 {
  --bg: #f5f2ea;
  --surface: #ffffff;
  --surface-2: #efebe1;
  --fg: #15201d;
  --muted: #5d6b66;
  --line: #e0dbcf;
  --brand: #0f6b5e;
  --brand-ink: #ffffff;
  --brand-soft: #dcefe9;
  --accent: #f07a1e;
  --accent-ink: #ffffff;
  --danger: #b4321f;
  --warn-bg: #fff1e3;
  --warn-fg: #8a4610;
  --shadow: 0 1px 2px rgba(20, 30, 25, 0.06), 0 8px 24px rgba(20, 30, 25, 0.07);
  --radius: 18px;
  --font: "GTXT Sans", "PT Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "GTXT Display", "GTXT Sans", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1412; --surface: #161e1b; --surface-2: #1d2724; --fg: #e8eeeb; --muted: #9aaca6; --line: #2a3632;
    --brand: #39b49c; --brand-ink: #06231d; --brand-soft: #173430; --accent: #ff9440; --accent-ink: #2a1400;
    --danger: #ff7a66; --warn-bg: #3a2614; --warn-fg: #ffc894; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1412; --surface: #161e1b; --surface-2: #1d2724; --fg: #e8eeeb; --muted: #9aaca6; --line: #2a3632;
  --brand: #39b49c; --brand-ink: #06231d; --brand-soft: #173430; --accent: #ff9440; --accent-ink: #2a1400;
  --danger: #ff7a66; --warn-bg: #3a2614; --warn-fg: #ffc894; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 17px; line-height: 1.5;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
img, video { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 12px; text-wrap: balance; }
h1 { font-size: clamp(1.45rem, 3.4vw, 2rem); }
h2 { font-size: 1.2rem; margin-top: 8px; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 10px; }
a { color: var(--brand); }
.boot { text-align: center; margin-top: 30vh; color: var(--muted); font-family: var(--display); }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.center { text-align: center; }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 60ch; }
.eyebrow { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Шапка */
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.logo { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 700; color: var(--fg); text-decoration: none; font-size: 1.1rem; }
.logo-mark { display: block; width: 30px; height: 30px; flex: none; }
.logo.big { font-size: 1.5rem; margin-bottom: 18px; }
.logo.big .logo-mark { width: 40px; height: 40px; }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 700; white-space: nowrap; }
.tabs a.on { background: var(--brand-soft); color: var(--fg); }

/* Каркас */
.page { max-width: 1100px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-right)) 64px max(16px, env(safe-area-inset-left)); display: grid; gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0; }
.row.end { justify-content: flex-end; }
.row.space { justify-content: space-between; align-items: flex-start; }

/* Кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 11px 18px;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; min-height: 44px; transition: transform .08s, filter .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.accent { background: var(--accent); color: var(--accent-ink); box-shadow: inset 0 -3px 0 rgba(0,0,0,.14); }
.btn.ghost { background: var(--surface-2); color: var(--fg); }
.btn.danger { color: var(--danger); }
.btn.big { font-size: 1.1rem; padding: 14px 22px; min-height: 54px; }
.btn.small { font-size: 0.9rem; padding: 7px 12px; min-height: 36px; }
.btn.wide { width: 100%; }
.btn:hover:not(:disabled) { filter: brightness(1.05); }
.link { background: none; border: 0; color: var(--brand); font: inherit; font-weight: 700; cursor: pointer; padding: 6px; }
.link.small { font-size: 0.9rem; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 2px; }

/* Поля */
label, .field { display: grid; gap: 6px; font-weight: 700; margin: 12px 0; }
input[type="text"], input[type="email"], input[type="password"], textarea {
  width: 100%; font: inherit; font-weight: 400; color: var(--fg); background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 11px 13px; min-height: 46px;
}
textarea { resize: vertical; }
input:focus, textarea:focus { border-color: var(--brand); outline: none; }
.with-mic { display: flex; gap: 8px; align-items: stretch; }
.with-mic textarea { flex: 1; }
.mic {
  flex: 0 0 auto; min-width: 52px; border: 0; border-radius: 12px; background: var(--brand-soft); color: var(--brand); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 700; padding: 0 12px;
}
.mic.rec { background: var(--danger); color: #fff; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; font: inherit; font-weight: 700; padding: 8px 12px; border-radius: 9px; color: var(--muted); cursor: pointer; min-height: 38px; }
.seg button.on { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.chip { border: 1.5px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 0.92rem; cursor: pointer; }
.chip.on, .chip:hover { border-color: var(--brand); background: var(--brand-soft); }

/* Вход */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; align-items: center; max-width: 1040px; margin: 0 auto; padding: 32px max(16px, env(safe-area-inset-right)) 32px max(16px, env(safe-area-inset-left)); }
.auth-hero h1 { font-size: clamp(1.8rem, 4.6vw, 2.8rem); }
.bullets { padding: 0; list-style: none; display: grid; gap: 8px; margin: 18px 0 0; }
.bullets li { padding-left: 30px; position: relative; font-weight: 700; }
.bullets li::before { content: ""; position: absolute; left: 0; top: 4px; width: 18px; height: 18px; border-radius: 5px; background: var(--accent); box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.auth-card { display: grid; gap: 4px; }
@media (max-width: 820px) { .auth { grid-template-columns: 1fr; min-height: auto; } }

/* Студия */
.studio { grid-template-columns: 300px 1fr; align-items: start; }
.studio .job-slot { grid-column: 1 / -1; }
@media (max-width: 860px) { .studio { grid-template-columns: 1fr; } }
.hero-card { padding: 0; overflow: hidden; }
.hero-img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-2); }
.hero-meta { padding: 16px 18px 18px; }
@media (max-width: 860px) {
  .hero-card { display: grid; grid-template-columns: 112px 1fr; align-items: center; }
  .hero-img { height: 100%; }
  .hero-meta { padding: 12px 14px; }
}
.empty-hero { text-align: center; padding: 40px 20px; display: grid; justify-items: center; gap: 6px; }
.create h1 { margin-bottom: 4px; }

/* Задача */
.steps { list-style: none; padding: 0; margin: 8px 0 16px; display: grid; gap: 8px; }
.step { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.step.ok, .step.run { color: var(--fg); }
.step-icon { width: 26px; height: 26px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--surface-2); font-weight: 700; flex: none; }
.step.ok .step-icon { background: var(--brand); color: var(--brand-ink); }
.step.err .step-icon { background: var(--danger); color: #fff; }
.thumbs { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
@media (max-width: 700px) { .thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.thumb { margin: 0; position: relative; aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb figcaption { position: absolute; left: 8px; top: 8px; background: rgba(0,0,0,.55); color: #fff; border-radius: 8px; padding: 0 7px; font-weight: 700; font-size: .85rem; }
.render .bar { height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.render .bar > div { height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width .2s; }
.render p { margin-top: 6px; }
.alert { background: var(--warn-bg); color: var(--warn-fg); border-radius: 12px; padding: 14px; display: grid; gap: 8px; justify-items: start; }
.warn { background: var(--warn-bg); color: var(--warn-fg); border-radius: 10px; padding: 8px 10px; }

.result { display: grid; grid-template-columns: minmax(0, 340px) 1fr; gap: 20px; align-items: start; margin-top: 8px; }
@media (max-width: 760px) { .result { grid-template-columns: 1fr; } }
.player { width: 100%; aspect-ratio: 9 / 16; background: #000; border-radius: 16px; }
.result-side { display: grid; gap: 12px; align-content: start; }
.post { background: var(--surface-2); border-radius: 14px; padding: 14px; display: grid; gap: 4px; justify-items: start; }
.post-title { font-weight: 700; }
.tags { color: var(--brand); }

/* Карточка ролика */
.scenes { display: grid; gap: 14px; margin-top: 14px; }
.scene { display: grid; grid-template-columns: 236px 1fr; gap: 14px; align-items: start; padding-top: 14px; border-top: 1px solid var(--line); }
.scene-shots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shot { display: grid; gap: 6px; justify-items: start; }
.shot img, .shot .thumb { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 12px; }
@media (max-width: 560px) { .scene { grid-template-columns: 1fr; } }
.scene-text { display: grid; gap: 8px; justify-items: start; }
.scene-text textarea { width: 100%; }

/* Мои ролики */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; text-decoration: none; color: var(--fg); box-shadow: var(--shadow); display: grid; }
.tile img, .tile .thumb { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 0; }
.tile-text { padding: 10px 12px; display: grid; gap: 2px; }

/* Тьютор */
.tutor { max-width: 820px; }
.chat { display: grid; gap: 10px; }
.chat-list { display: grid; gap: 10px; max-height: 58vh; overflow-y: auto; padding: 4px 2px; align-content: start; }
.bubble { max-width: 86%; padding: 10px 14px; border-radius: 16px; display: grid; gap: 8px; justify-items: start; }
.bubble.user { justify-self: end; background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 4px; }
.bubble.assistant { justify-self: start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.bubble-text { white-space: pre-wrap; }
.chat-form { border-top: 1px solid var(--line); padding-top: 10px; }

/* Редактор героя */
.hero-grid { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
@media (max-width: 760px) { .hero-grid { grid-template-columns: 1fr; } }
.hero-preview-box { aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; border: 1.5px dashed var(--line); }
.hero-preview-box:not(.empty) { border-style: solid; }
.hero-preview { width: 100%; height: 100%; object-fit: cover; }
.voices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.voice-group { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin: 0; display: grid; gap: 4px; }
.voice-group legend { font-weight: 700; padding: 0 4px; }
.voice-opt { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; font-weight: 400; margin: 0; padding: 6px 0; cursor: pointer; }
.voice-opt input { width: 20px; height: 20px; accent-color: var(--brand); }
.play { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--brand-soft); color: var(--brand); font-size: 1rem; cursor: pointer; display: grid; place-items: center; }

/* Мелочи */
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; display: inline-block; animation: spin .8s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0;
  background: var(--fg); color: var(--bg); padding: 12px 16px; border-radius: 12px; max-width: min(92vw, 520px); z-index: 50;
  transition: opacity .25s, transform .25s; font-weight: 700; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }
@media (max-width: 560px) {
  /* Телефон: разделы — второй строкой, чтобы все четыре помещались без прокрутки. */
  .top { gap: 8px; flex-wrap: wrap; row-gap: 6px; padding-bottom: 6px; }
  .top .tabs { order: 3; flex-basis: 100%; justify-content: space-between; }
  .top .quota { margin-left: auto; }
  .tabs a { padding: 7px 10px; }
  .card { padding: 16px; }
  .thumbs { gap: 6px; }
}

/* Тарифы, капча, подтверждение почты */
.quota { font-weight: 700; text-decoration: none; color: var(--fg); background: var(--surface-2); border-radius: 999px; padding: 6px 10px; white-space: nowrap; font-size: .9rem; }
.captcha { min-height: 70px; margin: 8px 0 4px; }
.alert.verify { justify-items: stretch; }
.span-all { grid-column: 1 / -1; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.plan { display: grid; gap: 6px; align-content: start; position: relative; }
.plan.featured { border: 2px solid var(--accent); }
.plan.current { border: 2px solid var(--brand); }
.plan .price { font-size: 1.1rem; margin: 0; }
.plan .price strong { font-family: var(--display); font-size: 2rem; }
.plan .badge { position: absolute; top: -12px; right: 16px; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 2px 10px; font-weight: 700; font-size: .8rem; }
.small-bullets li { font-weight: 400; font-size: .95rem; }
.legal a { color: var(--muted); }
.legal { margin-top: 12px; text-align: center; }
.legal-page { max-width: 820px; }
.legal-page h2 { font-size: 1.05rem; margin-top: 18px; }
@media (max-width: 560px) { .quota { padding: 4px 8px; } }

/* Язык интерфейса: РУ / ҚАЗ / EN */
.ui-lang { font: inherit; font-weight: 700; font-size: .85rem; color: var(--fg); background: var(--surface-2); border: 0; border-radius: 999px; padding: 6px 10px; min-height: 34px; cursor: pointer; }
.ui-lang:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.auth-lang { grid-column: 1 / -1; justify-self: end; margin-bottom: -12px; }
.top .spacer { flex: 1; }
@media (max-width: 860px) { .auth-lang { margin-bottom: 0; } }

/* Установка как приложение */
.install-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 50;
  width: min(520px, calc(100% - 24px)); box-sizing: border-box; display: grid; grid-template-columns: 40px 1fr auto auto; align-items: center; gap: 12px;
  padding: 10px 10px 10px 12px; background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.install-bar img { width: 40px; height: 40px; display: block; }
.install-bar strong { font-size: .95rem; line-height: 1.2; }
.install-bar .btn { min-height: 40px; padding: 8px 16px; }
.install-hint { grid-column: 2 / 4; grid-row: 2; font-size: .9rem; color: var(--muted); }
.install-close { grid-column: 4; grid-row: 1; font: inherit; font-size: 1.4rem; line-height: 1; width: 36px; height: 36px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--fg); cursor: pointer; }
body.has-install-bar { padding-bottom: 96px; }

