/* Deutsch-Trainer — приложение. Тот же мотив, что у сайта: талон электронной очереди и табло ведомства.
   Синий — таблички, жёлтый — табло вызова, бумага — холодная серо-зелёная. Шрифты свои (DSGVO). */

@font-face { font-family: "Golos"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url("fonts/golos-text-latin-wght-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: "Golos"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url("fonts/golos-text-latin-ext-wght-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: "Golos"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url("fonts/golos-text-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Golos"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url("fonts/golos-text-cyrillic-ext-wght-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: "Vazirmatn"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/vazirmatn-arabic-wght-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }

:root {
  --ink: #1F2A44;
  --ink-soft: #3A4766;
  --muted: #5B6577;
  --paper: #EEF2F0;
  --sheet: #FFFFFF;
  --line: #C9D2CE;
  --signal: #F2C230;
  --signal-soft: #FBEDB5;
  --role: #E3EAF6;
  --me: #1F2A44;
  --ok: #2F7D5B;
  --error: #A3312A;
  --font: "Golos", "Vazirmatn", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.0625rem/1.5 var(--font); overscroll-behavior-y: none; }
[dir="rtl"] body { line-height: 1.75; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-underline-offset: 0.18em; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
[hidden] { display: none !important; }

.boot { height: 100vh; display: grid; place-items: center; }
.brand-mark { background: var(--ink); color: var(--signal); padding: 3px 8px; border-radius: 4px; font-weight: 800; font-size: 0.9rem; letter-spacing: 0.04em; }
.boot .brand-mark { font-size: 1.4rem; padding: 8px 14px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }

/* ---------- каркас ---------- */
.shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 760px; margin: 0 auto; }
.bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 5;
}
.bar .brand-mark { background: var(--signal); color: var(--ink); }
.bar h1 { font-size: 1.02rem; font-weight: 700; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: transparent; border: 0; color: inherit; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; font-size: 1.2rem; flex: none; }
.icon-btn:hover { background: rgba(255,255,255,0.12); }
.view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pad { padding: 18px 16px 28px; }
.tabs { display: flex; background: var(--sheet); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabs button { flex: 1; background: none; border: 0; padding: 8px 4px 9px; font-size: 0.78rem; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.tabs button span { font-size: 1.25rem; line-height: 1; }
.tabs button[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tabs button[aria-current="page"] span { filter: none; }

/* ---------- кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--sheet); color: var(--ink); font-weight: 650;
  cursor: pointer; text-decoration: none; text-align: center; line-height: 1.25;
}
.btn:hover { border-color: var(--ink-soft); }
.btn.primary { background: var(--signal); border-color: var(--signal); color: var(--ink); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { background: var(--error); border-color: var(--error); color: #fff; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }
label.field { display: block; margin: 0 0 14px; font-weight: 650; }
label.field span { display: block; margin-bottom: 6px; }
input[type=email], input[type=text], input[inputmode=numeric], textarea, select {
  width: 100%; border: 1px solid var(--line); background: var(--sheet); border-radius: 12px; padding: 12px 14px; font-size: 1.05rem;
}
input:focus, textarea:focus, select:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px var(--signal-soft); }
.code-input { font-size: 1.8rem !important; letter-spacing: 0.4em; text-align: center; font-weight: 800; direction: ltr; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.95rem; margin: 6px 0 16px; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--ink); }
.err { color: var(--error); font-weight: 600; margin: 8px 0; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

/* ---------- вход ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px 18px calc(24px + var(--safe-b)); max-width: 480px; margin: 0 auto; }
.ticket { background: var(--sheet); border-radius: 18px; padding: 22px 20px; box-shadow: 0 1px 0 var(--line), 0 18px 40px -24px rgba(31,42,68,0.45); position: relative; }
.ticket::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; border-radius: 18px 18px 0 0; background: var(--signal); }
.login h1 { font-size: clamp(1.7rem, 7vw, 2.3rem); font-weight: 850; line-height: 1.1; margin: 18px 0 8px; letter-spacing: -0.02em; }
[dir="rtl"] .login h1 { letter-spacing: 0; line-height: 1.4; }
.login .lead { color: var(--ink-soft); margin: 0 0 22px; }
.langs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 18px; justify-content: center; }
.langs button { background: none; border: 0; padding: 5px 10px; border-radius: 999px; color: var(--muted); cursor: pointer; font-size: 0.92rem; }
.langs button[aria-current="true"] { background: var(--sheet); color: var(--ink); font-weight: 700; box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- главный экран ---------- */
.hello { font-size: 1.45rem; font-weight: 800; margin: 2px 0 12px; line-height: 1.2; }
.note { background: var(--signal-soft); border-radius: 12px; padding: 10px 14px; margin: 0 0 16px; font-size: 0.95rem; }
.levelbar { display: flex; gap: 6px; margin: 0 0 18px; flex-wrap: wrap; }
.levelbar button { border: 1px solid var(--line); background: var(--sheet); border-radius: 999px; padding: 6px 14px; font-weight: 700; cursor: pointer; }
.levelbar button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.section h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 22px 0 8px; font-weight: 750; }
[dir="rtl"] .section h2 { letter-spacing: 0; text-transform: none; font-size: 0.95rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.card {
  background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 12px; text-align: start;
  cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-height: 76px; position: relative;
}
.card:hover { border-color: var(--ink); }
.card b { font-weight: 700; line-height: 1.3; }
.card small { color: var(--muted); }
.card .free { position: absolute; top: 10px; inset-inline-end: 10px; background: var(--ok); color: #fff; border-radius: 999px; font-size: 0.72rem; padding: 2px 8px; font-weight: 700; }
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tools .card { min-height: 0; padding: 12px; font-weight: 650; }

/* ---------- переписка ---------- */
.thread { padding: 14px 12px 18px; display: flex; flex-direction: column; gap: 10px; }
.empty { text-align: center; color: var(--muted); margin: 18vh 20px 0; }
.msg { max-width: 92%; display: flex; flex-direction: column; gap: 8px; }
.bubble { border-radius: 16px; padding: 10px 13px; background: var(--sheet); box-shadow: 0 1px 0 var(--line); overflow-wrap: anywhere; }
.bubble .ln { min-height: 0.6em; }
.bubble .ln:empty { height: 0.6em; }
.msg.bot { align-self: flex-start; }
.msg.role { align-self: flex-start; }
.msg.role .bubble { background: var(--role); border-start-start-radius: 4px; }
.msg.coach .bubble { background: var(--signal-soft); }
.msg.coach { align-self: flex-start; }
.msg.me { align-self: flex-end; }
.msg.me .bubble { background: var(--me); color: #fff; border-start-end-radius: 4px; }
.msg.review { max-width: 100%; align-self: stretch; }
.msg.review .bubble { border-top: 5px solid var(--signal); }
.msg.notice .bubble { border-inline-start: 5px solid var(--signal); }
.msg .time { font-size: 0.75rem; color: var(--muted); }
.bubble code { background: rgba(31,42,68,0.08); padding: 1px 6px; border-radius: 6px; font-family: inherit; font-weight: 650; cursor: copy; }
.bubble s { opacity: 0.7; }
.bubble bdi[lang="de"] { unicode-bidi: isolate; }
.bubble img, .bubble video { max-width: 100%; border-radius: 10px; display: block; margin: 4px 0; }
.btns { display: flex; flex-direction: column; gap: 6px; }
.btns .row { display: flex; gap: 6px; flex-wrap: wrap; }
.btns .row > * { flex: 1 1 auto; }
.btns .btn { min-height: 40px; padding: 8px 12px; font-size: 0.95rem; border-radius: 10px; }
.play { display: inline-flex; align-items: center; gap: 8px; background: var(--ink); color: #fff; border: 0; border-radius: 999px; padding: 6px 14px 6px 10px; cursor: pointer; font-weight: 650; font-size: 0.92rem; margin-bottom: 6px; }
.play .ic { width: 26px; height: 26px; border-radius: 50%; background: var(--signal); color: var(--ink); display: grid; place-items: center; font-size: 0.8rem; }
.play.on .ic { animation: pulse 1s infinite; }
.typing { align-self: flex-start; background: var(--sheet); border-radius: 16px; padding: 12px 16px; display: flex; gap: 5px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: dot 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; } .typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.cmd { color: var(--ink); font-weight: 700; text-decoration: underline; cursor: pointer; }

/* ---------- поле ввода ---------- */
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 8px 10px calc(8px + var(--safe-b)); background: var(--sheet); border-top: 1px solid var(--line); }
.composer textarea { resize: none; max-height: 140px; min-height: 46px; border-radius: 22px; padding: 11px 16px; line-height: 1.35; }
.round { width: 46px; height: 46px; flex: none; border-radius: 50%; border: 0; display: grid; place-items: center; font-size: 1.25rem; cursor: pointer; background: var(--ink); color: #fff; }
.round.mic { background: var(--signal); color: var(--ink); }
.round.rec { background: var(--error); color: #fff; animation: pulse 1s infinite; }
.round:disabled { opacity: 0.4; cursor: default; }
.recbar { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 6px; font-weight: 650; }
.recbar .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--error); animation: pulse 1s infinite; }
.recbar button { margin-inline-start: auto; }

/* ---------- аккаунт ---------- */
.panel { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 14px; }
.panel h2 { font-size: 1.05rem; margin: 0 0 10px; }
.panel .btns { margin-top: 12px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--paper); }
.switch:first-of-type { border-top: 0; }
.switch input { width: 46px; height: 26px; accent-color: var(--ink); flex: none; }
.links { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.95rem; }

/* ---------- всплывающее ---------- */
.toast { position: fixed; left: 50%; bottom: calc(86px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 50; max-width: 90vw; box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5); font-weight: 600; text-align: center; }

@media (min-width: 760px) {
  .shell { border-inline: 1px solid var(--line); background: var(--paper); }
  .msg { max-width: 80%; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

.typing { flex-wrap: wrap; align-items: center; }
.typing .slow { flex-basis: 100%; margin-top: 6px; font-size: 13px; color: var(--muted, #5b6478); }

/* ---------- 6.0: экран подписки, тихие кнопки ---------- */
.btn.quiet { background: none; box-shadow: none; color: var(--muted); font-size: 0.86rem; padding: 6px 8px; min-height: 0; text-decoration: underline; text-underline-offset: 3px; }
.buy .buy-title { font-size: 1.05rem; margin: 4px 0 12px; }
.buy .plans { display: grid; gap: 10px; margin-bottom: 16px; }
.buy .plan { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: start; padding: 14px 16px;
  border-radius: 14px; border: 2px solid var(--line, #d8dce5); background: var(--sheet, #fff); color: inherit; font: inherit; cursor: pointer; min-height: 64px; }
.buy .plan.on { border-color: var(--ink, #1F2A44); box-shadow: 0 0 0 3px var(--signal, #F2C230); }
.buy .plan:focus-visible { outline: 3px solid var(--signal, #F2C230); outline-offset: 2px; }
.buy .plan-main { display: flex; flex-direction: column; gap: 2px; }
.buy .plan-main small, .buy .plan-price small { color: var(--muted); font-size: 0.84rem; }
.buy .plan-price { display: flex; flex-direction: column; align-items: flex-end; text-align: end; white-space: nowrap; }
.buy .plan-price b { font-size: 1.15rem; }
.buy .badge { align-self: flex-start; background: var(--signal, #F2C230); color: var(--ink, #1F2A44); border-radius: 999px; padding: 1px 8px; font-size: 0.78rem; font-weight: 700; }
.buy .buy-points { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; font-size: 0.94rem; }
.btn.big { min-height: 56px; font-size: 1.08rem; }
