/* Eshit: live captions for deaf and hard-of-hearing people, often elderly. The premium screen (2026-12-02, the owner:
   «shu joyiniyam premium qilish kerak»), in the site's look (public/bosh.css, sayt.css) and the Mac app's: one cobalt
   light behind a glass caption panel, the main button in the icon's cobalt, a red live mark while listening. Still
   high contrast, large type and the phone's own light or dark setting. Every value lives in :root; the dark block
   changes colours only. Every text colour is checked against the surface behind it, the glass over the light's
   brightest point included (WCAG 2.2 AA, docs/ui/1-finding-patterns.md; the lowest pair is 6.7:1). The phone's own
   fonts: the CSP in _headers loads none. */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --glow: rgba(10, 73, 196, .12);          /* the one light, top right */
  --glass: rgba(255, 255, 255, .72);       /* the caption panel, over the light */
  --glass-line: rgba(17, 20, 24, .1);
  --glass-shadow: 0 24px 60px rgba(10, 40, 90, .1), 0 2px 8px rgba(10, 40, 90, .05);
  --btn: rgba(255, 255, 255, .9);          /* a second button: a lighter glass */
  --btn-line: rgba(17, 20, 24, .14);
  --btn-hover: #eef2f8;
  --surface: #eef1f5;                      /* solid boxes: the sample line, a chosen script */
  --sheet: #ffffff;                        /* the windows */
  --text: #111418;
  --text-2: #4a5058;
  --line: #6b7280;                         /* a line that shows where to type */
  --accent: #0a49c4;
  --on-accent: #ffffff;
  --chosen: rgba(10, 73, 196, .08);
  --main-1: #2b63dd;                       /* the main button: the icon's cobalt, lit from above */
  --main-2: #0a49c4;
  --main-glow: rgba(10, 73, 196, .32);
  --on-main: #ffffff;
  --stop-1: #c72a30;                       /* «Töxtat»: red, lit from above */
  --stop-2: #a4161a;
  --stop-glow: rgba(164, 22, 26, .3);
  --stop-glow-2: rgba(164, 22, 26, .5);
  --on-stop: #ffffff;
  --live: #e5372d;
  --error: #8c1d18;
  --error-bg: #fdecea;
  --backdrop: rgba(17, 20, 24, .45);

  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: ui-serif, 'New York', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif; /* the site's headings */
  --fs-small: 16px;
  --fs: 20px;
  --fs-btn: 21px;
  --fs-big: 24px;
  --fs-title: 30px;
  --fs-main: 30px;
  --harf: 32px; /* caption size: 24–64, chosen in the settings (app.js) */

  --gutter: 16px;
  --tap: 56px;
  --tap-small: 48px;
  --tap-main: 88px;
  --pill: 999px;
  --r-panel: 28px;
  --r-main: 26px;
  --r-btn: 20px;
  --r-chip: 14px;
  --box: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --glow: rgba(10, 73, 196, .42);
    --glass: rgba(255, 255, 255, .055);
    --glass-line: rgba(255, 255, 255, .12);
    --glass-shadow: 0 30px 80px rgba(0, 0, 0, .55);
    --btn: rgba(255, 255, 255, .07);
    --btn-line: rgba(255, 255, 255, .18);
    --btn-hover: rgba(255, 255, 255, .12);
    --surface: #16191d;
    --sheet: #0d0f13;
    --text: #f5f7fa;
    --text-2: #b4bac2;
    --line: #7b8390;
    --accent: #9cc0ff;
    --on-accent: #06224d;
    --chosen: rgba(156, 192, 255, .14);
    --main-glow: rgba(43, 99, 221, .45);
    --stop-glow: rgba(199, 42, 48, .35);
    --stop-glow-2: rgba(199, 42, 48, .6);
    --live: #ff5a4f;
    --error: #ffb4ab;
    --error-bg: #2a0a08;
    --backdrop: rgba(0, 0, 0, .7);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; color: var(--text); font: 400 var(--fs)/1.4 var(--sans); }
/* The one light: fixed behind everything, so a wide screen is lit too, not only the app's column. */
body::before {
  content: '';
  position: fixed;
  z-index: -1;
  top: -45vmax;
  right: -35vmax;
  width: 110vmax;
  height: 110vmax;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--glow), transparent);
  pointer-events: none;
}
h1, h2, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.ic { width: 24px; height: 24px; flex: none; }
.noscript { margin: 24px var(--gutter); font-size: var(--fs-big); }

/* The page holder: one screen, never scrolled. Only the captions scroll, so the main button stays in reach. */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 960px;
  margin-inline: auto;
  padding: env(safe-area-inset-top) max(var(--gutter), env(safe-area-inset-right)) env(safe-area-inset-bottom) max(var(--gutter), env(safe-area-inset-left));
}

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 12px 10px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 26px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; box-shadow: 0 6px 18px var(--main-glow); }

.main { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; padding-bottom: 12px; }

/* Captions: a glass panel. The accuracy note stays above; the lines scroll, the newest at the bottom. */
.captions {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--glass-line);
  border-radius: var(--r-panel);
  background: var(--glass);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.note { margin: 0 24px; padding: 16px 0 10px; border-bottom: 1px solid var(--glass-line); color: var(--text-2); font-size: var(--fs-small); }
.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 24px 16px;
  font-size: var(--harf);
  font-weight: 650;
  line-height: 1.28;
  letter-spacing: -.01em;
  overflow-wrap: anywhere;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-line) transparent;
}
.lines > p { margin: 0 0 .4em; }
.partial { color: var(--text-2); }

/* The empty panel: what to do, in the middle, under the mark. It leaves with the first word, and while listening. */
.bos {
  position: absolute;
  top: 50%;
  left: 32px;
  right: 32px;
  display: grid;
  justify-items: center;
  gap: 14px;
  max-width: 22em;
  margin-inline: auto;
  color: var(--text-2);
  font-size: var(--fs);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.4;
  text-align: center;
  transform: translateY(-60%);
  pointer-events: none;
}
.bos::before {
  content: '';
  width: 52px;
  height: 52px;
  background: var(--accent);
  -webkit-mask: url(/belgilar/pufak.svg) center / contain no-repeat;
  mask: url(/belgilar/pufak.svg) center / contain no-repeat;
  opacity: .9;
}
.lines:not(:empty) ~ .bos, .partial:not([hidden]) ~ .bos, .tinglayapti .bos { display: none; }

.tools { display: flex; justify-content: flex-end; gap: 10px; padding: 0 16px 16px; }

.status { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.status .error { flex-basis: 100%; }
.status-line { font-weight: 700; }
.muted { color: var(--text-2); font-size: var(--fs-small); }
.error { padding: 12px 16px; border-left: 6px solid var(--error); border-radius: 12px; background: var(--error-bg); color: var(--error); font-weight: 600; line-height: 1.35; }

/* The live mark, as the Mac app's pill: a red dot and a moving wave, then the status words. Only while listening. */
.jonli { display: none; align-items: center; gap: 12px; min-height: 44px; padding: 6px 18px 6px 16px; border: 1px solid var(--glass-line); border-radius: var(--pill); background: var(--glass); }
.tinglayapti .jonli { display: inline-flex; }
.jonli-nuqta { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 4px color-mix(in srgb, var(--live) 22%, transparent); animation: nuqta 1.6s ease-in-out infinite; }
@keyframes nuqta { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--live) 8%, transparent); } }
.tolqin { display: flex; align-items: center; gap: 3px; height: 18px; }
.tolqin i { width: 3px; height: 18px; border-radius: 2px; background: currentColor; transform: scaleY(.25); animation: tolqin .82s ease-in-out infinite; }
.tolqin i:nth-child(1) { animation-delay: -.5s; }
.tolqin i:nth-child(2) { animation-delay: -.2s; animation-duration: .7s; }
.tolqin i:nth-child(3) { animation-delay: -.65s; animation-duration: .6s; }
.tolqin i:nth-child(4) { animation-delay: -.1s; animation-duration: .76s; }
.tolqin i:nth-child(5) { animation-delay: -.4s; }
@keyframes tolqin { 50% { transform: scaleY(1); } }

/* Buttons: one base; a glass line, a chip, the accent and the main one. Never smaller than --tap-small. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 8px 22px;
  border: 1px solid transparent;
  border-radius: var(--r-btn);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-btn);
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .3s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn[aria-disabled="true"] { opacity: .45; cursor: default; transform: none; }
.btn-line { border-color: var(--btn-line); background: var(--btn); }
.btn-line:hover, .btn-line[aria-pressed="true"] { background: var(--btn-hover); }
.btn-line[aria-pressed="true"] { border-color: var(--accent); }
.btn-chip { min-height: var(--tap-small); padding: 6px 16px; border-color: var(--btn-line); border-radius: var(--r-chip); background: var(--btn); font-size: 17px; font-weight: 600; }
.btn-chip:hover { background: var(--btn-hover); }
.btn-accent { background: linear-gradient(180deg, var(--main-1), var(--main-2)); color: var(--on-main); box-shadow: 0 10px 26px var(--main-glow); }

/* An icon before a button's word, drawn from public/belgilar/ in the word's own colour (app.js sets the word). */
.ikon::before { content: ''; flex: none; width: 24px; height: 24px; background: currentColor; -webkit-mask: var(--ikon) center / contain no-repeat; mask: var(--ikon) center / contain no-repeat; }
.btn-chip.ikon::before { width: 20px; height: 20px; }
.ikon-sozlama { --ikon: url(/belgilar/sozlama.svg); }
.ikon-nusxa { --ikon: url(/belgilar/nusxa.svg); }
.ikon-tozala { --ikon: url(/belgilar/tozala.svg); }
.ikon-javob { --ikon: url(/belgilar/javob.svg); }
.ikon-iboralar { --ikon: url(/belgilar/iboralar.svg); }
.top .btn { min-height: 52px; padding-inline: 18px; border-radius: 16px; font-size: 19px; }

.btn-main {
  width: 100%;
  min-height: var(--tap-main);
  gap: 16px;
  border: 0;
  border-radius: var(--r-main);
  background: linear-gradient(180deg, var(--main-1), var(--main-2));
  color: var(--on-main);
  box-shadow: 0 18px 44px var(--main-glow), inset 0 1px 0 rgba(255, 255, 255, .22);
  font-size: var(--fs-main);
  font-weight: 750;
  letter-spacing: -.005em;
}
.btn-main:hover { filter: brightness(1.06); }
.btn-main .ic { width: 52px; height: 52px; padding: 9px; border-radius: 50%; background: rgba(255, 255, 255, .16); }
.btn-main .ic-stop, .btn-main.on .ic-mic { display: none; }
.btn-main.on .ic-stop { display: block; }
.btn-main.on {
  background: linear-gradient(180deg, var(--stop-1), var(--stop-2));
  color: var(--on-stop);
  box-shadow: 0 18px 44px var(--stop-glow), inset 0 1px 0 rgba(255, 255, 255, .2);
  animation: nafas 2.4s ease-in-out infinite;
}
@keyframes nafas { 50% { box-shadow: 0 18px 60px var(--stop-glow-2), inset 0 1px 0 rgba(255, 255, 255, .2); } }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions .btn { min-height: 64px; padding-inline: 12px; }

.foot { padding: 2px 8px 12px; color: var(--text-2); font-size: 15px; line-height: 1.4; text-align: center; }

/* Overlays: full screen on a phone; on a wide screen a glass-edged window in the middle (the full-screen text stays
   full). */
dialog { border: 0; padding: 0; background: var(--sheet); color: var(--text); }
dialog::backdrop { background: var(--backdrop); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.sheet, .full { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; }
.sheet {
  padding: max(16px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  overflow-y: auto;
  overscroll-behavior: contain;
}
@media (min-width: 760px) and (min-height: 600px) {
  .sheet { width: min(640px, 100% - 64px); height: fit-content; max-height: calc(100% - 64px); margin: auto; padding: 26px 32px 32px; border: 1px solid var(--glass-line); border-radius: var(--r-panel); box-shadow: 0 40px 100px rgba(0, 0, 0, .35); }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.sheet-head h2 { font: 600 var(--fs-title)/1.15 var(--serif); letter-spacing: -.012em; }
.x { display: grid; place-items: center; flex: none; width: var(--tap); height: var(--tap); padding: 0; border: 1px solid var(--btn-line); border-radius: var(--pill); background: var(--btn); color: var(--text); cursor: pointer; }
.x:hover { background: var(--btn-hover); }
.x .ic { width: 26px; height: 26px; }

.reply { display: block; width: 100%; min-height: 168px; padding: 14px 18px; border: 2px solid var(--line); border-radius: var(--r-btn); background: transparent; font-size: var(--fs-big); line-height: 1.35; resize: vertical; }
.reply:focus-visible { border-color: var(--accent); outline-offset: 2px; }
.sheet .error { margin-top: 12px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.sheet-actions .btn { min-height: 60px; }

.phrases { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.phrase { width: 100%; min-height: 72px; justify-content: flex-start; padding: 12px 22px; font-size: var(--fs-big); font-weight: 600; text-align: left; }

/* The full-screen text: app.js picks the largest size that fits; «Aylantir» turns the text, not the buttons. Nothing
   behind the words: they are read from across a counter. */
.full {
  padding: max(12px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  background: var(--bg);
  overflow: hidden;
}
.full[open] { display: flex; flex-direction: column; gap: 12px; }
.full-head { display: flex; justify-content: flex-end; }
.full-box { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.full-text { width: 100%; font-size: 64px; font-weight: 750; letter-spacing: -.015em; line-height: 1.15; text-align: center; overflow-wrap: break-word; transition: transform .3s; }
/* Measured with whole words (app.js keeps a pixel beside the widest one), so break-word only splits a word that is
   wider than the screen even at the smallest size. */
.full-text.olcham { overflow-wrap: normal; }
.full-text.turned { transform: rotate(180deg); }
.full .error { flex: none; }
.full-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.full-actions .btn { min-height: 64px; }

.group { min-width: 0; margin: 0 0 26px; padding: 0; border: 0; }
.group legend { margin-bottom: 12px; padding: 0; color: var(--text-2); font-size: var(--fs-small); font-weight: 650; }
.stepper { display: flex; align-items: center; gap: 16px; }
.stepper .btn { min-width: 96px; min-height: 64px; font-size: 26px; }
.stepper-value { min-width: 3ch; font: 600 40px/1 var(--serif); text-align: center; font-variant-numeric: tabular-nums; }
.choices { display: grid; gap: 10px; }
.choice { position: relative; display: block; }
.choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.choice span { display: flex; align-items: center; gap: 14px; min-height: var(--tap); padding: 8px 18px; border: 1px solid var(--btn-line); border-radius: var(--r-btn); background: var(--btn); font-weight: 600; }
.choice span::before { content: ''; flex: none; width: 24px; height: 24px; border: 2px solid var(--text-2); border-radius: 50%; }
.choice input:checked + span { border: 2px solid var(--accent); background: var(--chosen); }
.choice input:checked + span::before { border: 7px solid var(--accent); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }
.sample { padding: 14px 18px; border: 1px solid var(--glass-line); border-radius: var(--r-btn); background: var(--glass); font-size: var(--harf); font-weight: 650; letter-spacing: -.01em; line-height: 1.28; overflow-wrap: anywhere; }

/* Turnstile's check (public/tekshiruv.js). While it needs nothing from the user it is an invisible window that is not
   modal and lets every tap through, so the page and «Töxtat» stay usable; it is opened modal, as a small window with a
   close button and a backdrop, only when Turnstile asks for a click. */
.check { margin: auto; background: transparent; overflow: visible; }
.check:not(.seen) { position: fixed; inset: 0; pointer-events: none; }
.check > .x { display: none; }
.check.seen { padding: 16px; border: 1px solid var(--glass-line); border-radius: var(--r-btn); background: var(--sheet); }
.check.seen::backdrop { background: var(--backdrop); }
.check.seen > .x { display: grid; margin: 0 0 12px auto; }

/* A short screen (a small phone, or a browser's own bars): the captions keep the room, the controls get tighter. */
@media (max-height: 700px) {
  .top { padding-block: 6px 4px; }
  .main { gap: 10px; padding-bottom: 8px; }
  .note { padding-top: 10px; }
  .btn-main { min-height: 68px; }
  .btn-main .ic { width: 44px; height: 44px; padding: 7px; }
  .actions .btn { min-height: var(--tap); }
}

/* A narrow phone: the words stay on one line in the two-button rows (the icon goes above the word), and the live
   mark and the minutes left share one row (the wave gives way, the red dot stays). */
@media (max-width: 400px) {
  .actions .btn { flex-direction: column; gap: 3px; padding: 6px 8px; font-size: 19px; }
  .actions .ikon::before { width: 22px; height: 22px; }
  .tools { justify-content: stretch; }
  .tools .btn { flex: 1; }
  .jonli .tolqin { display: none; }
  .jonli { gap: 10px; padding-inline: 14px 16px; }
  .jonli .status-line { font-size: 18px; }
  #qoldi { font-size: 14px; }
}

/* A phone on its side: captions on the left, the controls on the right, so both fit without scrolling. */
@media (orientation: landscape) and (max-height: 560px) {
  .top { padding-block: 4px; }
  .main { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); grid-template-rows: 1fr auto auto; gap: 12px 16px; }
  .captions { grid-column: 1; grid-row: 1 / 4; }
  .status { grid-column: 2; grid-row: 1; align-self: end; }
  .btn-main { grid-column: 2; grid-row: 2; min-height: 72px; }
  .actions { grid-column: 2; grid-row: 3; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .tolqin i { transform: scaleY(.7); }
}
