/* =========================================================================
   OM Interpreter — жива кімната перекладу.
   Дизайн-шар: читання — головна дія, мікрофон — тиха присутність.

   ПАЛІТРА (переглянута): нейтральна тепла база (камінь/графіт) + ОДИН акцент —
   мідь-ember. Зелено-teal напрямок прибрано: на світлому тлі він читався
   блідим. Дія (головна кнопка) — чорнило самої бази, не колір: стримано,
   впевнено, «дорого». Кольору в інтерфейсі рівно стільки, щоб позначити
   живе: активний мікрофон, вибір, зʼєднання, мовець.

   ТИПОГРАФІКА: інтерфейс — системний sans (жодного серіфа у хромі й у
   стрічці). Серіф лишений в ОДНОМУ місці — вордмарк «OM Interpreter».

   Порядок: токени → базис → вхід → кімната (топбар/стрічка/док) → шити → утиліти.
   ========================================================================= */

/* ───────────────────────────── 1. Токени ───────────────────────────── */
:root {
  /* світла тема = БАЗА (пріоритет за брифом) */
  --bg:        #f3f1ed;   /* теплий камінь, без зеленого підтону */
  --bg-2:      #ffffff;   /* піднятий шар (картки, шити) — чистий білий */
  --bg-3:      #ebe8e2;   /* вкладене поле */
  --ink:       #171614;
  --ink-2:     #55524c;
  --ink-3:     #837e75;
  --line:      rgba(23, 22, 20, .13);
  --line-2:    rgba(23, 22, 20, .06);
  --acc:       #a8431f;   /* мідь-ember — єдиний акцент (6.0:1 з білим) */
  --acc-ink:   #ffffff;
  --acc-soft:  rgba(168, 67, 31, .09);
  --act:       #1b1a17;   /* головна дія = чорнило, не колір */
  --act-ink:   #f7f5f1;
  --err:       #a3261d;
  --veil:      rgba(28, 24, 20, .38);
  --glass:     rgba(248, 246, 242, .86);
  --qr-dark:   #17160f;   /* QR завжди на білому тлі — контраст для камери */

  /* кольори мовців — кілька людей мусять відрізнятись боковим зором */
  --sp-1: #a8431f;
  --sp-2: #305a87;
  --sp-3: #5b5d1c;
  --sp-4: #8c2f4a;
  --sp-5: #1f5e56;

  --shadow-1: 0 1px 2px rgba(40, 32, 24, .05), 0 10px 26px -14px rgba(40, 32, 24, .22);
  --shadow-2: 0 28px 70px -28px rgba(30, 24, 18, .44);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI",
          Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-display: ui-serif, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --r-s: 12px;
  --r-m: 18px;
  --r-l: 26px;
  --pad: clamp(18px, 5vw, 34px);
  --col: 46rem;           /* комфортна колонка читання на десктопі */

  --tscale: 1;            /* множник розміру стрічки (кнопка «A») */
  color-scheme: light;
}

body[data-size="s"] { --tscale: .84; }
body[data-size="l"] { --tscale: 1.2; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #131211;
    --bg-2:      #1b1a18;
    --bg-3:      #24221f;
    --ink:       #f2efe9;
    --ink-2:     #a8a49b;
    --ink-3:     #7c776e;
    --line:      rgba(255, 255, 255, .12);
    --line-2:    rgba(255, 255, 255, .06);
    --acc:       #ea8b45;   /* мідь світлішає, щоб триматись на темному */
    --acc-ink:   #1b0f05;
    --acc-soft:  rgba(234, 139, 69, .14);
    --act:       #f2efe9;   /* дія на темному — світле чорнило */
    --act-ink:   #16150f;
    --err:       #ef7b6c;
    --veil:      rgba(0, 0, 0, .6);
    --glass:     rgba(19, 18, 17, .86);
    --qr-dark:   #17160f;
    --sp-1: #e68b4e;
    --sp-2: #82a9dd;
    --sp-3: #b3a35c;
    --sp-4: #e08fa8;
    --sp-5: #5cc4b2;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px -16px rgba(0, 0, 0, .6);
    --shadow-2: 0 28px 70px -24px rgba(0, 0, 0, .75);
    color-scheme: dark;
  }
}

/* ───────────────────────────── 2. Базис ───────────────────────────── */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;                    /* 16px базово — iOS не зумить інпути */
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  overflow: hidden;                   /* скролить лише стрічка */
  overscroll-behavior: none;
}

/* [hidden] мусить бити наші display:flex/grid — інакше сховані блоки видно */
[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--acc-soft); }

.scr { display: none; height: 100dvh; flex-direction: column; }
body[data-screen="entry"] #screen-entry { display: flex; }
body[data-screen="room"]  #screen-room  { display: flex; }

.vh {                                  /* лише для скрін-рідера */
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ───────────────────────────── 3. Екран входу ───────────────────────────── */
/* Вхід мусить уміщатись в ОДИН екран iPhone (390×664 у Safari з панелями),
   тому вертикальний бюджет тут жорсткий: 1 поле + 1 вибір + 1 кнопка.
   overflow-y лишений як страховка для дуже низьких вікон (лендскейп). */
.scr--entry {
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: max(16px, env(safe-area-inset-top)) var(--pad) max(16px, env(safe-area-inset-bottom));
  /* один спокійний теплий подмух, без кольорових «плям» */
  background:
    radial-gradient(120% 80% at 50% -20%, rgba(168, 67, 31, .055), transparent 60%);
}

.entry { width: 100%; max-width: 26.5rem; margin: auto; }

.wordmark { display: flex; align-items: center; gap: 12px; margin: 0 2px 20px; }
.wordmark__mark { flex: none; color: var(--acc); display: inline-flex; }
.wordmark__txt { display: flex; flex-direction: column; min-width: 0; }
/* ЄДИНЕ місце серіфа в усьому продукті — власна назва */
.wordmark__name {
  font-family: var(--font-display);
  font-size: clamp(1.375rem, 5.2vw, 1.625rem);
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.1;
}
.wordmark__sub {
  font-size: .8125rem; color: var(--ink-3);
  letter-spacing: .03em;
  margin-top: 3px;
}

.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-1);
  padding: clamp(18px, 5vw, 26px);
  display: flex; flex-direction: column; gap: 18px;
}

.f { display: flex; flex-direction: column; gap: 9px; border: 0; margin: 0; padding: 0; }
.f__label {
  display: flex; align-items: baseline; gap: 8px;
  font-size: .78125rem; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3);
  padding: 0;
}
.f__opt { font-weight: 400; letter-spacing: .02em; text-transform: none; font-size: .8125rem; }

.input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid transparent;
  border-radius: var(--r-s);
  padding: 14px 15px;
  font-size: 1rem;                     /* ≥16px — без авто-зуму на iOS */
  min-height: 50px;
  transition: border-color .15s ease, background .15s ease;
}
.input::placeholder { color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--acc); background: var(--bg-2); }

/* мова — чипи, кожна ЗАВЖДИ своєю назвою (ніде не перекладається).
   Вибір тут = і мова перекладу для мене, і мова інтерфейсу. */
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chip {
  min-height: 50px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: var(--r-s);
  font-size: .9375rem; font-weight: 550;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .07s ease;
}
.chip:active { transform: scale(.985); }
.chip[aria-checked="true"] {
  background: var(--acc); border-color: var(--acc); color: var(--acc-ink);
  font-weight: 650;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: var(--r-s);
  padding: 14px 18px;
  min-height: 50px;
  font-size: .9375rem; font-weight: 600;
  cursor: pointer;
  transition: transform .07s ease, background .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: default; }
/* головна дія — чорнило, не колір: впевнено й без «кольорової» дешевизни */
.btn--primary {
  background: var(--act); border-color: var(--act); color: var(--act-ink);
  font-size: 1.0625rem; font-weight: 650; min-height: 54px;
  box-shadow: 0 10px 24px -16px rgba(23, 22, 20, .8);
}
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { color: var(--ink); }
.btn--sm { min-height: 42px; padding: 10px 14px; font-size: .875rem; }

.linkish {
  align-self: center;
  background: none; border: none; cursor: pointer;
  color: var(--ink-2); font-size: .875rem;
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: var(--line);
  padding: 6px 4px;
}
.linkish:hover { color: var(--ink); }

.join { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.input--code {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .22em;
  text-align: center;
  font-size: 1.125rem; font-weight: 600;
}
/* значення прийшло з посилання (room_id) — показуємо як є, без косметики */
.input--asis { text-transform: none; letter-spacing: .06em; font-size: 1rem; }

.err { margin: 0; color: var(--err); font-size: .875rem; }

/* ───────────────────────────── 4. Кімната: топбар ───────────────────────────── */
.topbar {
  flex: none;
  display: flex; align-items: center; gap: 6px;
  padding: 8px max(13px, calc(var(--pad) - 12px));
  padding-top: max(8px, env(safe-area-inset-top));
  background: var(--glass);
  backdrop-filter: saturate(150%) blur(16px);
  -webkit-backdrop-filter: saturate(150%) blur(16px);
  border-bottom: 1px solid var(--line-2);
  z-index: 3;
}
.topbar__inner {
  width: 100%; max-width: var(--col); margin-inline: auto;
  display: flex; align-items: center; gap: 6px;
}

.ibtn {
  flex: none;
  min-width: 44px; min-height: 44px;
  display: grid; place-items: center;
  background: none; border: none; border-radius: 12px;
  color: var(--ink-2); cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.ibtn:hover { background: var(--line-2); color: var(--ink); }
/* «A» — сам показує поточний крок розміру стрічки (S / M / L) */
.ibtn--txt { font-weight: 650; letter-spacing: -.02em; font-size: 1rem; }
body[data-size="s"] .ibtn--txt { font-size: .8125rem; }
body[data-size="l"] .ibtn--txt { font-size: 1.25rem; color: var(--acc); }

/* мова читання — головний контекст, натискається для зміни */
.langbtn {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  background: none; border: none; cursor: pointer;
  padding: 4px 8px; border-radius: 12px; min-height: 44px;
  justify-content: center;
  transition: background .15s ease;
}
.langbtn:hover { background: var(--line-2); }
.langbtn__k {
  font-size: .625rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3);
}
.langbtn__v {
  font-size: .9375rem; font-weight: 600;
  display: flex; align-items: center; gap: 5px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.langbtn__v svg { flex: none; opacity: .5; }

.codebtn {
  flex: none;
  display: flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-2); cursor: pointer;
  transition: border-color .15s ease, transform .07s ease;
}
.codebtn:active { transform: scale(.98); }
.codebtn:hover { border-color: var(--acc); }
.codebtn svg { color: var(--ink-3); flex: none; }
.codebtn__code {
  font-family: var(--font-mono); font-size: .9375rem; font-weight: 600;
  letter-spacing: .12em; font-variant-numeric: tabular-nums;
}
/* на вузькому екрані код у топбарі не тримаємо — він великим шрифтом у шиті
   «поділитись», а місце потрібне мові читання (головний контекст) */
@media (max-width: 559px) {
  .codebtn { padding: 0 12px; }
  .codebtn__code { display: none; }
}

.conn {
  flex: none; width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-3); margin-left: 2px;
  transition: background .3s ease;
}
.conn[data-state="ok"]   { background: var(--acc); }
.conn[data-state="down"] { background: var(--err); animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ───────────────────────────── 5. Кімната: стрічка ───────────────────────────── */
.feed {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scroll-padding-bottom: 24px;
}
.feed__inner {
  width: 100%; max-width: var(--col); margin-inline: auto;
  padding: clamp(14px, 4vw, 26px) var(--pad) 14px;
  display: flex; flex-direction: column;
  min-height: 100%;
}

.empty { margin: auto 0; padding: 8px 0 24px; }
.empty__t {
  font-size: clamp(1.25rem, 5vw, 1.5rem); font-weight: 650;
  letter-spacing: -.015em; margin: 0 0 10px;
}
.empty__p { margin: 0 0 8px; color: var(--ink-2); font-size: .9375rem; line-height: 1.55; max-width: 34ch; }
.empty__hint { margin: 12px 0 0; color: var(--ink-3); font-size: .8125rem; line-height: 1.5; }

/* Репліка = СЕГМЕНТ (BUILD-SPEC-2). Послідовні сегменти мовця злипаються
   у «репліку» через data-cont="1" (без повторного підпису). */
.row {
  position: relative;
  padding: 0 0 0 15px;
  margin-top: 26px;
  border-left: 2px solid var(--sp);
  cursor: pointer;
  --sp: var(--sp-1);
}
.row:first-child { margin-top: 0; }
.row[data-cont="1"] { margin-top: 7px; }
.row.is-new { animation: rise .26s cubic-bezier(.22, .9, .3, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(7px); } }

.row__head {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 5px; flex-wrap: wrap;
}
.row[data-cont="1"] .row__head { display: none; }
.row__who {
  font-size: .875rem; font-weight: 700; letter-spacing: .005em;
  color: var(--sp);
}
.row__time {
  font-size: .75rem; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
/* мова оригіналу читачеві в підписі не потрібна — вона зʼявляється лише
   разом з оригіналом (тап по репліці), як його «шапка» */
.row__lang {
  display: none;
  font-size: .6875rem; color: var(--ink-3);
  letter-spacing: .08em; text-transform: uppercase;
}
.row.is-open .row__lang { display: inline; }

.row__text {
  margin: 0;
  font-size: calc(clamp(1.5rem, 5.6vw, 2rem) * var(--tscale));
  line-height: 1.34;
  letter-spacing: -.011em;
  font-weight: 450;
  overflow-wrap: break-word;
  text-wrap: pretty;
}
.row__src {
  margin: 7px 0 0;
  font-size: calc(.875rem * var(--tscale));
  line-height: 1.45;
  color: var(--ink-3);
  font-style: italic;
  display: none;                        /* оригінал — на тап по репліці */
}
.row.is-open .row__src { display: block; }

/* власне мовлення — ПРИГЛУШЕНЕ: очі мусять ловити ЧУЖЕ.
   Але не настільки, щоб мовець не читав себе: він контролює, чи його
   правильно почули (opacity .78, не .62). */
.row--mine {
  border-left-color: var(--line);
  opacity: .78;
}
.row--mine .row__who { color: var(--ink-3); }
.row--mine .row__text {
  font-size: calc(clamp(1.0625rem, 3.9vw, 1.25rem) * var(--tscale));
  line-height: 1.4; color: var(--ink-2); font-weight: 400;
}

/* мовець ЗАВЖДИ бачить свій оригінал — навіть коли читає іншою мовою
   (без цього неможливо перевірити, чи його правильно почули) */
.row--mine .row__src { display: block; }

/* «як мене переклали» — для ВЛАСНИХ реплік показуємо одразу, без тапу:
   це єдиний спосіб для мовця побачити, що система з ним робить. */
.row__out {
  margin: 5px 0 0;
  font-size: calc(.875rem * var(--tscale));
  line-height: 1.45;
  color: var(--ink-3);
  display: none;
}
.row__out:not(:empty) { display: block; }
.row__out b {
  font-weight: 600; font-size: .6875rem;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--acc); margin-right: 7px;
}

/* переклад у дорозі (мій сегмент відправлено, відповіді ще немає) */
.row--pending .row__text { color: var(--ink-3); }
.dots { display: inline-flex; gap: 3px; margin-left: 7px; vertical-align: baseline; }
.dots i {
  width: 4px; height: 4px; border-radius: 50%; background: currentColor;
  animation: dots 1.15s ease-in-out infinite;
}
.dots i:nth-child(2) { animation-delay: .16s; }
.dots i:nth-child(3) { animation-delay: .32s; }
@keyframes dots { 0%, 60%, 100% { opacity: .25; } 30% { opacity: .9; } }

.sys {
  margin-top: 22px;
  font-size: .75rem; color: var(--ink-3);
  letter-spacing: .04em;
  display: flex; align-items: center; gap: 10px;
}
.sys::before, .sys::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }

/* «до останнього» */
.jump {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--dock-h, 96px) + 12px);
  z-index: 4;
  display: flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 15px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-2); color: var(--ink);
  font-size: .8125rem; font-weight: 600;
  box-shadow: var(--shadow-1); cursor: pointer;
  animation: rise .2s ease both;
}
.jump[hidden] { display: none; }

/* ───────────────────────────── 6. Кімната: док мікрофона ───────────────────────────── */
.scr--room { position: relative; }

.dock {
  flex: none; z-index: 3;
  background: var(--glass);
  backdrop-filter: saturate(150%) blur(16px);
  -webkit-backdrop-filter: saturate(150%) blur(16px);
  border-top: 1px solid var(--line-2);
  padding: 11px var(--pad) max(11px, env(safe-area-inset-bottom));
}
.dock__inner {
  width: 100%; max-width: var(--col); margin-inline: auto;
  display: flex; align-items: center; gap: 14px;
}

.mic {
  position: relative; flex: none;
  width: 58px; height: 58px; border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-2); color: var(--ink-2);
  display: grid; place-items: center; cursor: pointer;
  transition: background .2s ease, color .2s ease, transform .08s ease, border-color .2s ease;
}
.mic:active { transform: scale(.95); }
.mic__ico { position: relative; z-index: 2; }
/* халоу = живий рівень звуку з мікрофона (--level 0..1), не декоративна анімація */
.mic__halo {
  position: absolute; inset: -3px; border-radius: 50%;
  border: 2px solid var(--acc);
  opacity: calc(.15 + var(--level, 0) * .85);
  transform: scale(calc(1 + var(--level, 0) * .22));
  transition: transform .09s linear, opacity .09s linear;
  pointer-events: none;
}
body:not([data-mic="listening"]) .mic__halo { opacity: 0; transform: scale(1); }

body[data-mic="listening"] .mic {
  background: var(--acc); border-color: var(--acc); color: var(--acc-ink);
}
body[data-mic="starting"] .mic { color: var(--acc); border-color: var(--acc); }

.dock__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dock__status {
  display: flex; align-items: center; gap: 7px;
  font-size: .8125rem; font-weight: 600; color: var(--ink-2);
}
.dock__status b { font-weight: 600; }
.dock__hint { font-size: .75rem; color: var(--ink-3); }

/* живий інтерим власного мовлення — тихий, до двох рядків (мовець мусить
   бачити, ЩО саме розпізнається, інакше не зрозуміє, чи його чують) */
.live {
  display: none;
  font-size: .9375rem; line-height: 1.35; color: var(--ink-2);
}
body[data-mic="listening"] .live.has-text {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden;
}
body[data-mic="listening"] .live.has-text ~ .dock__status { display: none; }

.wave { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; flex: none; }
.wave i {
  width: 2px; border-radius: 1px; background: var(--acc);
  height: calc(3px + var(--level, 0) * 9px);
  transition: height .1s linear;
}
.wave i:nth-child(1) { height: calc(2px + var(--level, 0) * 5px); }
.wave i:nth-child(3) { height: calc(2px + var(--level, 0) * 7px); }
.wave i:nth-child(4) { height: calc(2px + var(--level, 0) * 4px); }
body:not([data-mic="listening"]) .wave { display: none; }

.dock__end {
  flex: none; display: flex; align-items: center; gap: 5px;
  color: var(--ink-3); padding-right: 2px;
}
.people { font-size: .8125rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ───────────────────────────── 7. Шити (поділитись / транскрипт / мова) ─────────────── */
.sheet {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: flex-end; justify-content: center;
  background: var(--veil);
  animation: fade .16s ease both;
  padding: 0;
}
.sheet[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }

.sheet__panel {
  width: 100%; max-width: 30rem;
  max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-l) var(--r-l) 0 0;
  box-shadow: var(--shadow-2);
  padding: 10px clamp(18px, 5.5vw, 26px) max(22px, env(safe-area-inset-bottom));
  animation: up .24s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes up { from { transform: translateY(14px); opacity: .6; } }

.sheet__grip {
  width: 40px; height: 4px; border-radius: 2px; background: var(--line);
  margin: 2px auto 14px;
}
.sheet__head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.sheet__title {
  margin: 0; flex: 1;
  font-size: 1.1875rem; font-weight: 650; letter-spacing: -.015em;
}
.sheet__x {
  flex: none; min-width: 40px; min-height: 40px;
  display: grid; place-items: center;
  background: none; border: none; border-radius: 12px;
  color: var(--ink-3); font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.sheet__x:hover { background: var(--line-2); color: var(--ink); }
.sheet__hint { margin: 14px 0 0; font-size: .8125rem; color: var(--ink-3); line-height: 1.5; text-align: center; }

/* поділитись */
.qr {
  display: grid; place-items: center;
  background: #fff; border-radius: var(--r-m); padding: 14px;
  border: 1px solid var(--line);
}
.qr svg { display: block; width: 100%; height: auto; max-width: 262px; }
.bigcode {
  margin: 18px 0 4px; text-align: center;
}
.bigcode__k {
  font-size: .6875rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3);
}
.bigcode__v {
  display: block; margin-top: 4px;
  font-family: var(--font-mono);
  font-size: clamp(2rem, 11vw, 2.75rem); font-weight: 650;
  letter-spacing: .14em; font-variant-numeric: tabular-nums;
}
.copyrow { display: grid; grid-template-columns: 1fr auto; gap: 9px; margin-top: 14px; }
.copyrow .input { font-size: .875rem; font-family: var(--font-mono); min-height: 46px; }

/* транскрипт */
.tr { display: flex; flex-direction: column; gap: 16px; }
.tr__item { display: grid; grid-template-columns: 3.4rem 1fr; gap: 10px; }
.tr__t { font-size: .75rem; color: var(--ink-3); font-variant-numeric: tabular-nums; padding-top: 3px; }
.tr__who { font-size: .8125rem; font-weight: 700; color: var(--sp, var(--ink-2)); }
.tr__txt { font-size: 1rem; line-height: 1.45; margin: 2px 0 0; }
.tr__src { font-size: .8125rem; line-height: 1.45; color: var(--ink-3); font-style: italic; margin: 3px 0 0; }
.tr__empty { color: var(--ink-3); font-size: .9375rem; }
.sheet__actions { display: flex; gap: 9px; margin-top: 18px; }
.sheet__actions .btn { flex: 1; }

/* мова читання */
.langlist { display: grid; gap: 9px; }
.langopt {
  display: flex; align-items: center; gap: 11px;
  min-height: 54px; padding: 10px 15px;
  border: 1px solid var(--line); border-radius: var(--r-s);
  background: var(--bg-2); cursor: pointer; text-align: left;
  font-size: 1rem; font-weight: 550;
  transition: border-color .15s ease, background .15s ease;
}
.langopt[aria-checked="true"] { border-color: var(--acc); background: var(--acc-soft); }
.langopt__tick { margin-left: auto; color: var(--acc); opacity: 0; flex: none; }
.langopt[aria-checked="true"] .langopt__tick { opacity: 1; }

/* ───────────────────────────── 8. Десктоп ───────────────────────────── */
@media (min-width: 760px) {
  :root { --r-l: 30px; }

  /* спокійна композиція: колонка читання по центру, док — острівець */
  .feed__inner { padding-top: 34px; padding-bottom: 8px; }
  .row { padding-left: 20px; margin-top: 32px; }
  .row[data-cont="1"] { margin-top: 9px; }

  .dock {
    background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none;
    border-top: none; padding: 0 var(--pad) 22px;
  }
  .dock__inner {
    /* острівець вирівняний рівно по колонці читання — не «ширший за текст» */
    max-width: calc(var(--col) - 2 * var(--pad));
    background: var(--glass);
    backdrop-filter: saturate(150%) blur(18px);
    -webkit-backdrop-filter: saturate(150%) blur(18px);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: var(--shadow-1);
    padding: 9px 18px 9px 9px;
  }

  .langbtn { flex: none; }
  .mic { width: 52px; height: 52px; }

  /* градієнт-вуаль під доком, щоб текст не «вʼїжджав» у нього */
  .scr--room::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 118px;
    background: linear-gradient(to top, var(--bg) 26%, transparent);
    pointer-events: none; z-index: 2;
  }

  .sheet { align-items: center; padding: 24px; }
  .sheet__panel {
    border-radius: var(--r-l);
    padding: 22px clamp(22px, 3vw, 30px) 26px;
    max-height: 86dvh;
  }
  .sheet__grip { display: none; }

  .entry { max-width: 27.5rem; }
}

@media (min-width: 1100px) {
  :root { --col: 50rem; }
  .row__text { letter-spacing: -.014em; }
}

/* низьке вікно (Safari з видимими панелями, iPhone SE, half-split):
   вхід стискається, але лишається ОДНИМ екраном — без скролу */
@media (max-height: 700px) {
  .wordmark { margin-bottom: 16px; gap: 11px; }
  .card { gap: 15px; padding: 17px 18px 19px; }
  .chip { min-height: 47px; }
  .input { min-height: 47px; padding: 12px 14px; }
  .btn--primary { min-height: 51px; }
  .linkish { padding: 3px 4px; }
}
/* зовсім низько (лендскейп телефона) — тоді вже й тег-лайн зайвий */
@media (max-height: 560px) {
  .wordmark { margin-bottom: 12px; }
  .wordmark__sub { display: none; }
  .card { gap: 12px; }
}

/* висока щільність реплік на дуже низьких екранах (лендскейп телефона) */
@media (max-height: 480px) {
  .row { margin-top: 18px; }
  .dock { padding-top: 7px; }
  .mic { width: 48px; height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
