/* Yozish maydoni — Monkeytype uslubi, sayt palitrasida (assets/js/typebox.js).
   Monkeytype oʻlchovlari: Roboto Mono 400, qator qadami 1.6em (soʻz 1em + 0.25em chekka × 2 + chiziq),
   kursor 0.1em × 1.2em, miltillash 1s, harflarda fon/katakcha YOʻQ — faqat rang.
   Ustoz'dagi juftligi: frontend/app/globals.css (.tb-*) — BIR XIL saqlansin. */
@font-face {
  font-family: 'Roboto Mono Uz';
  src: url('../fonts/robotomono-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.tb {
  --tb-sub: #a5a3b8;          /* yozilmagan — xira */
  --tb-ok: var(--heading);    /* toʻgʻri — yorqin */
  --tb-err: #e5484d;          /* xato */
  --tb-extra: #9b2c35;        /* ortiqcha (boʻshliq oʻrniga yozilgan) */
  --tb-caret: var(--primary);
  position: relative; cursor: text; outline: none;
  padding: clamp(1rem, 3vw, 1.75rem) clamp(1rem, 3vw, 2rem);
  border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-sm);
  font: 400 clamp(1.2rem, .85rem + 1.25vw, 1.85rem)/1.6 'Roboto Mono Uz', 'Roboto Mono', ui-monospace, Consolas, monospace;
  font-variant-ligatures: none; color: var(--tb-sub); user-select: none; -webkit-user-select: none;
}
/* Poyga: yirik matn — sinf ekranini uzoqdan ham koʻrish mumkin */
.tb-lg { font-size: clamp(1.3rem, .95rem + 1.6vw, 2.25rem); }
.tb.is-busy { opacity: .6; }

.tb-probe { position: absolute; left: 0; top: 0; visibility: hidden; white-space: pre; pointer-events: none; }
/* Doim 3 qator balandligi: matn qisqa boʻlsa ham maydon "sakramaydi" */
/* width: 0 + min-width: 100% — qatorlar (white-space: pre) kartani oʻz eniga choʻzmasin: aks holda
   tor ekranda maydon kengayib, "qatorga nechta belgi sigʻadi" oʻlchovi oʻzini-oʻzi tasdiqlab qoladi */
.tb-words { position: relative; width: 0; min-width: 100%; height: 4.8em; overflow: hidden; transition: filter .2s, opacity .2s; }
.tb-line { height: 1.6em; white-space: pre; }
.tb-w { display: inline-block; }
.tb-l { display: inline-block; height: 1.6em; color: var(--tb-sub); transition: color .08s; }
.tb-l.is-ok { color: var(--tb-ok); }
.tb-l.is-bad { color: var(--tb-err); }
.tb-l.is-extra { color: var(--tb-extra); }
/* Xatosi qolgan (oʻtib ketilgan) soʻz ostida chiziq */
.tb-w.is-err { box-shadow: inset 0 -2px 0 var(--tb-err); }

.tb-caret {
  position: absolute; left: 0; top: 0; z-index: 1; width: .1em; height: 1.2em; border-radius: .05em;
  background: var(--tb-caret); pointer-events: none; transition: transform .1s cubic-bezier(.25, .8, .35, 1);
}
.tb-caret.is-idle { animation: tb-flash 1s ease infinite; }
.tb-caret[hidden] { display: none; }
@keyframes tb-flash { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }

/* Fokus yoʻq: matn xiralashadi, ustida "bosing" yozuvi (Monkeytype kabi) */
.tb-cover {
  position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; gap: .55rem;
  border: 0; border-radius: inherit; background: transparent; cursor: pointer;
  font: 600 .98rem/1.2 var(--font-body); color: var(--heading);
}
.tb:not(.is-focus):not(.is-done) .tb-words { filter: blur(4px); opacity: .35; }
.tb:not(.is-focus) .tb-caret { opacity: 0; animation: none; }
.tb.is-focus .tb-cover, .tb.is-done .tb-cover { display: none; }
/* Telefon: koʻrinmas kiritish maydoni butun yozish maydonini qoplaydi (bosilganda ekran klaviaturasi chiqadi) */
.tb-input { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; opacity: 0; border: 0; font-size: 16px; }

@media (prefers-reduced-motion: reduce) {
  .tb-caret { transition: none; }
  .tb-caret.is-idle { animation: none; }
  .tb-words { transition: none; }
}
