/* "Klaviaturada tez yozish" kursi: kurs sahifasi, dars sahifasi va yozish pleeri.
   Faqat shu sahifalarda yuklanadi (controllers/typing.php). */

.btn-block { width: 100%; }
.btn-sm { padding: .5rem .9rem; font-size: .92rem; border-radius: 10px; }
.btn-sm small { font-weight: 500; opacity: .7; }

.crumbs { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin-bottom: 1rem; font-size: .92rem; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--primary); text-decoration: underline; }

.typing-facts { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.3rem 0 0; padding: 0; }
.typing-facts li { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .8rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: .92rem; color: var(--muted); }
.typing-facts b { color: var(--heading); font-variant-numeric: tabular-nums; }

/* ---------- Kurs sahifasi ---------- */
.typing-course { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2rem; align-items: start; }
.typing-progress-card {
  order: 2; position: sticky; top: 90px; padding: 1.4rem; border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-md);
}
.typing-progress-card .help { margin: .9rem 0 0; font-size: .86rem; color: var(--muted); line-height: 1.5; }
.tp-count { margin: .3rem 0 .6rem; color: var(--muted); }
.tp-count b { font: 700 2rem/1 var(--font-display); color: var(--heading); font-variant-numeric: tabular-nums; }
.tp-bar { height: 8px; border-radius: 99px; background: var(--primary-soft); overflow: hidden; margin-bottom: 1.1rem; }
.tp-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform .6s var(--ease); }

.typing-sections { display: grid; gap: 1.8rem; }
.tsec h2 { font-size: 1.15rem; margin: 0 0 .7rem; display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.tsec h2 small { font: 500 .85rem var(--font-body); color: var(--muted); }
.tlessons { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.tlessons a {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: .9rem; align-items: center;
  padding: .7rem 1rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  text-decoration: none; color: var(--ink); transition: border-color .2s, box-shadow .2s, translate .2s var(--ease);
}
.tlessons a:hover { border-color: #c7d2fe; box-shadow: var(--shadow-sm); translate: 0 -1px; color: var(--ink); }
.tl-num { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-dark); font: 600 .9rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.tl-main { display: grid; gap: .1rem; min-width: 0; }
.tl-title { font-weight: 600; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-meta { font-size: .85rem; color: var(--muted); }
.tl-state { font-size: .82rem; font-weight: 600; white-space: nowrap; }

.tlessons li.is-done .tl-num { background: var(--accent); color: #fff; }
.tlessons li.is-done .tl-state { color: var(--accent); }
.tlessons li.is-next a { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.tlessons li.is-next .tl-num { background: var(--primary); color: #fff; }
.tlessons li.is-next .tl-state { color: var(--primary); }
.tlessons li.is-locked a { background: transparent; border-style: dashed; }
.tlessons li.is-locked .tl-title, .tlessons li.is-locked .tl-num { color: #9a98ad; }
.tlessons li.is-locked .tl-num { background: #efeef6; }

@media (max-width: 900px) {
  .typing-course { grid-template-columns: minmax(0, 1fr); }
  .typing-progress-card { order: 0; position: static; }
}

/* ---------- Dars sahifasi ---------- */
.typing-lesson-head { padding: clamp(1.6rem, 4vw, 2.6rem) 0 1.4rem; }
.tl-headline { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.tl-headline h1 { margin: 0; font-size: clamp(1.7rem, 3.4vw, 2.5rem); }
.tl-pos { font: 600 .95rem/1 var(--font-display); color: var(--muted); font-variant-numeric: tabular-nums; }
.typing-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.2rem; }

.tl-video { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-md); overflow: hidden; background: #0d0b26; box-shadow: var(--shadow-md); max-width: 860px; }
.tl-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tl-hint { display: flex; gap: .7rem; align-items: flex-start; margin: 0; padding: .9rem 1.1rem; border-radius: 14px; background: var(--primary-soft); color: #312e81; line-height: 1.6; }
.tl-hint .icon { flex: none; margin-top: .25rem; color: var(--primary); }
.tl-locked { padding: 1.6rem; border-radius: var(--r-lg); background: var(--surface); border: 1px dashed #c7d2fe; text-align: center; }
.tl-locked h2 { font-size: 1.3rem; }
.tl-locked p { color: var(--muted); margin: .3rem auto 1.2rem; max-width: 46ch; }
.tl-nav { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: .6rem; }

/* ---------- Pleer ---------- */
.typing-app { display: grid; grid-template-columns: minmax(0, 1fr); gap: .9rem; }
.tp-note { margin: 0; padding: .8rem 1rem; border-radius: 12px; background: var(--amber-bg); color: var(--amber-fg); font-size: .92rem; }
.tp-stats { display: flex; flex-wrap: wrap; gap: .4rem 2rem; align-items: baseline; }
.tp-stat { color: var(--muted); font-size: .95rem; }
.tp-stat b { font: 700 2rem/1 var(--font-display); color: var(--heading); font-variant-numeric: tabular-nums; }
.tp-stat b.is-low { color: #b45309; }
.tp-stat small { font-size: .8rem; }

.tp-box {
  position: relative; cursor: text; outline: none; border: 2px solid var(--line); border-radius: 18px;
  background: var(--surface); padding: clamp(1rem, 3vw, 1.8rem);
  font-family: ui-monospace, 'Cascadia Mono', Consolas, 'Liberation Mono', monospace;
  font-size: clamp(1.15rem, 2.2vw, 1.7rem); line-height: 2; min-height: calc(6em + 2rem);
  transition: border-color .2s;
}
.tp-box.is-focus { border-color: var(--primary); }
.tp-probe { position: absolute; left: 0; top: 0; visibility: hidden; white-space: pre; pointer-events: none; }
.tp-line { white-space: pre; }
.tp-ch { color: #a19fb5; border-radius: 3px; }
.tp-ch.is-ok { color: var(--heading); }
.tp-ch.is-bad { color: #dc2626; background: #fee2e2; }
.tp-ch.is-cur { color: var(--heading); background: rgba(79, 70, 229, .14); box-shadow: inset 0 -3px 0 var(--primary); animation: tp-blink 1.1s steps(1) infinite; }
@keyframes tp-blink { 50% { box-shadow: inset 0 -3px 0 transparent; } }

.tp-cover {
  position: absolute; inset: 0; display: grid; place-items: center; border: 0; border-radius: 16px; cursor: pointer;
  background: rgba(255, 255, 255, .72); backdrop-filter: blur(2px); font: inherit;
}
.tp-cover span { padding: .55rem 1rem; border-radius: 12px; background: var(--heading); color: #fff; font: 600 .95rem/1.2 var(--font-body); }
.tp-box.is-focus .tp-cover { display: none; }
/* Telefon: koʻrinmas kiritish maydoni butun yozish maydonini qoplaydi (bosilganda ekran klaviaturasi chiqadi) */
.tp-mobile-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; font-size: 16px; z-index: 2; }

.tp-progress { height: 6px; border-radius: 99px; background: #edecf5; overflow: hidden; }
.tp-progress span { display: block; height: 100%; background: var(--primary); transform-origin: left; transform: scaleX(0); transition: transform .15s linear; }
.tp-controls { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.tp-controls .tp-count { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Natija */
.tp-result { padding: clamp(1.1rem, 3vw, 1.6rem); border-radius: var(--r-lg); border: 1px solid; animation: tp-in .5s var(--ease) both; }
.tp-result.is-pass { background: #ecfdf5; border-color: #a7f3d0; }
.tp-result.is-fail { background: #fffbeb; border-color: #fde68a; }
@keyframes tp-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.tp-rhead { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: center; }
.tp-rhead h2 { font-size: 1.35rem; margin: 0 0 .2rem; }
.tp-rhead p { margin: 0; color: var(--muted); max-width: 52ch; }
.tp-grade { display: flex; align-items: center; gap: .8rem; padding: .55rem .9rem; border-radius: 14px; background: rgba(255, 255, 255, .7); }
.tp-grade b { display: block; font: 700 1.2rem/1.1 var(--font-display); color: var(--heading); }
.tp-grade small { font-size: .8rem; color: var(--muted); }
.tp-stars { display: inline-flex; gap: 2px; font-size: 1.35rem; line-height: 1; font-family: 'Segoe UI Symbol', system-ui, sans-serif; }
.tp-star { color: #e5e3ef; position: relative; }
.tp-star.is-full { color: #f59e0b; }
/* Yarim yulduz: kulrang yulduz ustida chap yarmi kesilgan sariq nusxa */
.tp-star.is-half::before { content: '★'; position: absolute; left: 0; top: 0; width: 50%; overflow: hidden; color: #f59e0b; }
.tp-rgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; margin: 1.2rem 0; }
.tp-rstat { padding: .9rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); text-align: center; }
.tp-rstat b { display: block; font: 700 1.7rem/1.1 var(--font-display); color: var(--heading); font-variant-numeric: tabular-nums; }
.tp-rstat.is-good b { color: var(--accent); }
.tp-rstat.is-low b { color: #b45309; }
.tp-rstat span { font-size: .82rem; color: var(--muted); }
.tp-ractions { display: flex; flex-wrap: wrap; gap: .7rem; }
@media (max-width: 560px) { .tp-rgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Ekrandagi klaviatura: tugma rangi = barmoq */
.tp-kb-wrap { overflow-x: auto; padding: .8rem 0 .4rem; }
.tp-kb { display: grid; justify-items: center; gap: 6px; min-width: max-content; margin: 0 auto; user-select: none; }
.tp-kb-row { display: flex; gap: 6px; }
.tp-key {
  display: grid; place-items: center; width: clamp(34px, 3.4vw, 46px); height: clamp(34px, 3.4vw, 46px);
  border-radius: 9px; border: 1px solid rgba(30, 27, 75, .08); font: 500 .85rem/1 var(--font-body);
  transition: background .12s, color .12s, transform .12s;
}
.tp-key.k-wide { width: clamp(56px, 5.6vw, 76px); }
.tp-key.k-shift { width: clamp(66px, 6.8vw, 92px); }
.tp-key.k-space { width: clamp(220px, 26vw, 340px); }
.f-pinky { background: #ffe4e6; color: #9f1239; }
.f-ring { background: #fef3c7; color: #92400e; }
.f-middle { background: #d1fae5; color: #065f46; }
.f-indexl { background: #e0f2fe; color: #075985; }
.f-indexr { background: #e0e7ff; color: #3730a3; }
.f-thumb { background: #f1f5f9; color: #475569; }
.tp-key.is-active { background: var(--primary); color: #fff; border-color: var(--primary); transform: translateY(1px); box-shadow: 0 4px 12px rgba(79, 70, 229, .35); }
.tp-kb-note { margin: .6rem 0 0; font-size: .8rem; color: var(--muted); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .tp-ch.is-cur { animation: none; }
}

.tp-controls .tp-sound { margin-right: auto; }
.tp-controls .tp-sound svg { flex: none; }
.tp-controls .tp-sound[aria-pressed="false"] { color: var(--muted); border-color: var(--line); }
