:root {
  --navy: #0c5786;
  --navy-d: #083d5f;
  --orange: #f6a01a;
  --orange-d: #d9840a;
  --bg: #f2f6fb;
  --card: #ffffff;
  --ink: #15243a;
  --muted: #687890;
  --line: #e1e8f1;
  --ok: #1f9d55;
  --bad: #e5484d;
  --fix: #d9840a;
  --star: #f5b301;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 40, 70, .06), 0 6px 20px rgba(16, 40, 70, .06);
  --mono: 'JetBrains Mono', Consolas, 'Courier New', monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 Nunito, 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--navy); }
h1, h2 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 19px; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }

/* ---------- sarlavha ---------- */
.top { position: sticky; top: 0; z-index: 20; background: #fff; box-shadow: 0 1px 0 var(--line); }
.top-in { max-width: 1060px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand img { height: 24px; display: block; }
.brand span { background: var(--orange); color: #fff; font-weight: 800; font-size: 14px; padding: 2px 9px; border-radius: 999px; }
.top nav { display: flex; gap: 4px; flex: 1; margin-left: 8px; }
.top nav a { text-decoration: none; color: var(--muted); font-weight: 700; padding: 6px 12px; border-radius: 10px; }
.top nav a:hover { background: var(--bg); color: var(--ink); }
.top nav a.on { color: var(--navy); background: #e8f1f8; }
.icon-btn { border: 0; background: transparent; font-size: 20px; cursor: pointer; padding: 4px 6px; border-radius: 10px; }
.icon-btn:hover { background: var(--bg); }
.who { display: flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); font-weight: 700; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--bg); }
.who .av { font-size: 22px; }
.who .nm { max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mobile-note { background: #fff4e0; color: #8a5300; text-align: center; padding: 8px 16px; font-weight: 700; }

/* ---------- umumiy ---------- */
.page { max-width: 1060px; margin: 0 auto; padding: 22px 16px 60px; }
.page.narrow { max-width: 760px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-weight: 800; padding: 9px 18px; border-radius: 12px; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: #c5d2e2; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; box-shadow: 0 3px 0 var(--orange-d); }
.btn.primary:hover { filter: brightness(1.04); }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--orange-d); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.big { font-size: 18px; padding: 13px 26px; }
.star { color: #d6dde8; }
.star.on { color: var(--star); }
.av.big { font-size: 46px; line-height: 1; }
.kchip { display: inline-block; min-width: 30px; text-align: center; font: 700 15px var(--mono); background: #fdecec; color: #b42328; border-radius: 8px; padding: 2px 8px; margin: 2px 3px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; font-weight: 700; z-index: 60; transition: opacity .4s; box-shadow: var(--shadow); }
.toast.out { opacity: 0; }

/* ---------- profillar ---------- */
.hello { margin: 18px 0 26px; }
.hello h1 { font-size: 30px; }
.hello p { color: var(--muted); font-size: 17px; margin: 0; }
h2.sub { margin: 10px 0 14px; }
.profiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.pcard {
  position: relative; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 12px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; border: 2px solid transparent; transition: transform .12s, border-color .12s;
}
.pcard:hover, .pcard:focus { border-color: var(--orange); transform: translateY(-2px); outline: none; }
.pcard .av { font-size: 42px; line-height: 1.1; }
.pcard b { overflow-wrap: anywhere; }
.pcard small { color: var(--muted); }
.pcard.add { border: 2px dashed #c9d5e4; box-shadow: none; background: transparent; }
.pcard.add .av { color: var(--orange); font-weight: 800; }
.pcard .del { position: absolute; top: 6px; right: 6px; border: 0; background: transparent; color: #b8c3d2; font-size: 18px; cursor: pointer; width: 26px; height: 26px; border-radius: 8px; opacity: 0; }
.pcard:hover .del { opacity: 1; }
.pcard .del:hover { background: #fdecec; color: var(--bad); }
.newp { text-align: left; max-width: 520px; margin: 0 auto 18px; }
.newp label { display: block; font-weight: 800; }
.newp input { display: block; width: 100%; margin-top: 6px; font: inherit; font-size: 19px; padding: 11px 14px; border: 2px solid var(--line); border-radius: 12px; }
.newp input:focus { border-color: var(--orange); outline: none; }
.avatars { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.avb { font-size: 26px; width: 46px; height: 46px; border-radius: 12px; border: 2px solid transparent; background: var(--bg); cursor: pointer; }
.avb.on { border-color: var(--orange); background: #fff4e0; }
.err { color: var(--bad); font-weight: 700; min-height: 22px; margin-bottom: 6px; }
.newp .btn { width: 100%; }
.link { color: var(--navy); text-decoration: underline; cursor: pointer; }

/* ---------- xarita ---------- */
.hero { display: grid; grid-template-columns: 1fr; gap: 18px; }
.hero-me { display: flex; align-items: center; gap: 14px; }
.hero-me h1 { margin: 0; }
.hero-me p { margin: 2px 0 0; }
.hero-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.st { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: var(--bg); border-radius: 14px; padding: 12px 6px; }
.st b { font-size: 22px; font-weight: 800; color: var(--navy-d); }
.st span { color: var(--muted); font-size: 13px; line-height: 1.25; }
.ring { width: 64px; height: 64px; }
.ring-bg { fill: none; stroke: #dfe7f1; stroke-width: 8; }
.ring-fg { fill: none; stroke: var(--orange); stroke-width: 8; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 38px 38px; }
.ring-fg.full { stroke: var(--ok); }
.ring text { font: 800 15px Nunito, 'Segoe UI', sans-serif; fill: var(--ink); }
.go { justify-self: start; }
.unit { margin: 26px 0 8px; }
.unit h2 { display: flex; align-items: center; gap: 8px; }
.unit h2 small { margin-left: auto; font-size: 14px; color: var(--muted); font-weight: 700; }
.uic { font-size: 22px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile {
  position: relative; display: flex; flex-direction: column; gap: 2px; background: #fff; border-radius: 14px; padding: 12px 12px 10px;
  box-shadow: var(--shadow); text-decoration: none; color: var(--ink); border: 2px solid transparent; transition: transform .12s, border-color .12s; min-height: 118px;
}
a.tile:hover { transform: translateY(-2px); border-color: #c9d6e6; }
.tile .num { width: 30px; height: 30px; border-radius: 50%; background: #e8f1f8; color: var(--navy); font-weight: 800; display: grid; place-items: center; font-size: 14px; margin-bottom: 4px; }
.tile.passed .num { background: var(--ok); color: #fff; }
.tile.k-test .num { background: var(--navy); color: #fff; }
.tile.k-test.passed .num { background: var(--ok); }
.tile .tt { font-weight: 800; line-height: 1.25; }
.tile .kind { font-size: 12px; color: var(--muted); }
.tile .stars { margin-top: auto; font-size: 18px; letter-spacing: 1px; color: var(--ok); font-weight: 800; }
.tile .best { position: absolute; top: 14px; right: 10px; font-size: 11px; color: var(--muted); }
.tile.current { border-color: var(--orange); animation: glow 1.8s ease-in-out infinite; }
.tile.locked { background: #eef2f7; box-shadow: none; color: #8d9ab0; cursor: not-allowed; }
.tile.locked .num { background: transparent; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(246, 160, 26, .18), var(--shadow); } }

/* ---------- dars ---------- */
.lbar { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.page.lesson { padding-top: 14px; }
.back { text-decoration: none; font-weight: 800; color: var(--muted); padding: 6px 10px; border-radius: 10px; }
.back:hover { background: #fff; color: var(--ink); }
.ltitle { font-size: 22px; font-weight: 800; line-height: 1.2; flex: 1; min-width: 180px; }
.ltitle small { display: block; font-size: 13px; color: var(--muted); font-weight: 700; }
.live { display: flex; gap: 8px; }
.live div { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 6px 14px; text-align: center; min-width: 82px; }
.live b { display: block; font-size: 22px; color: var(--navy-d); font-variant-numeric: tabular-nums; }
.live span { font-size: 12px; color: var(--muted); }
.intro { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 800; color: var(--muted); }
.newkey { display: inline-flex; align-items: center; gap: 8px; background: #fff; border-radius: 12px; padding: 4px 12px 4px 4px; box-shadow: var(--shadow); }
.newkey b { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; font: 800 21px var(--mono); color: var(--ink); background: var(--fc); }
.newkey small { font-size: 13px; color: var(--ink); line-height: 1.2; max-width: 110px; }
.typebox { padding: 0 0 12px; overflow: hidden; }
.progress { height: 6px; background: #edf2f8; }
.progress i { display: block; height: 100%; width: 0; background: var(--orange); transition: width .15s; }
.text-view { height: calc(3 * 1.65em); overflow: hidden; margin: 16px 26px 4px; font: 500 28px/1.65 var(--mono); }
.text-inner { transition: transform .18s ease-out; }
.text-inner .w { display: inline-block; white-space: nowrap; }
.c { color: #24344d; border-radius: 4px; padding: 1px 0; }
.c.sp { white-space: pre-wrap; }
.c.ok { color: #9db0c4; }
.c.fix { color: var(--fix); }
.c.cur { background: var(--orange); color: #fff; box-shadow: 0 3px 0 var(--orange-d); }
.c.cur.bad { background: var(--bad); box-shadow: 0 3px 0 #b32a2f; }
.hint { margin: 2px 28px 0; color: var(--muted); font-size: 15px; min-height: 24px; }
.hint b { color: var(--ink); }
.shake { animation: shake .22s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.warn { background: #fff4e0; color: #8a5300; border-radius: 12px; padding: 10px 16px; font-weight: 800; margin-bottom: 14px; }
.ltools { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; font-size: 14px; }
.ltools label { display: flex; gap: 6px; align-items: center; cursor: pointer; font-weight: 700; }

/* ---------- klaviatura ---------- */
.kb-wrap { max-width: 880px; margin: 0 auto; }
.kb { display: flex; flex-direction: column; gap: 5px; background: #e4ebf3; padding: 8px; border-radius: 16px; user-select: none; }
.kb-row { display: flex; gap: 5px; }
.key {
  flex: 1 1 0; height: 42px; border-radius: 8px; background: #fff; box-shadow: 0 2px 0 #c3cfdd;
  display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;
  font: 700 15px Nunito, 'Segoe UI', sans-serif; color: #3b4b63; transition: background .12s, transform .08s;
}
.key.fc { background: #fff; background: color-mix(in srgb, var(--fc) 38%, #fff); }
.kb.plain .key.fc:not(.home) { background: #fff; }
.key.sp { font-size: 12px; color: #7d8ba0; }
.key .ks { font-size: 11px; line-height: 1; color: #7d8ba0; }
.key .kl { line-height: 1.1; }
.key.bump .kl::after { content: ''; position: absolute; left: 50%; bottom: 7px; width: 12px; height: 2px; margin-left: -6px; background: currentColor; border-radius: 2px; opacity: .7; }
.kb .key.home { background: var(--navy); color: #fff; box-shadow: 0 2px 0 var(--navy-d); }
.key.target { background: var(--orange); color: #fff; box-shadow: 0 2px 0 var(--orange-d), 0 0 0 3px rgba(246, 160, 26, .35); transform: translateY(-2px); animation: pulse 1.1s ease-in-out infinite; }
.key.target .ks { color: #fff; }
.key.hit { animation: hit .18s; }
.key.hit-ok { animation: hitok .22s; }
.key.hit-bad { animation: hitbad .3s; }
@keyframes pulse { 50% { box-shadow: 0 2px 0 var(--orange-d), 0 0 0 7px rgba(246, 160, 26, .15); } }
@keyframes hit { 50% { transform: translateY(2px); filter: brightness(.9); } }
@keyframes hitok { 40% { background: var(--ok); color: #fff; transform: translateY(2px); } }
@keyframes hitbad { 30% { background: var(--bad); color: #fff; transform: translateY(2px); } }
.kb.heat .key { color: #1f2d42; }
.kb.heat .key.nodata { background: #f3f6f9; color: #a7b3c4; }

/* ---------- qo'llar ---------- */
.hands { max-width: 330px; margin: 4px auto 0; }
.hands svg { display: block; width: 100%; height: auto; }
.hands .palm, .hands .finger rect { fill: #fde5d2; stroke: #e5bb9c; stroke-width: 2; transition: fill .12s; }
.hands .finger circle { opacity: .9; }
.hands .finger.on rect { fill: #ffbf5a; stroke: var(--orange-d); stroke-width: 3; }
.hands .finger.on circle { opacity: 1; stroke: #fff; stroke-width: 2; }

/* ---------- slaydlar ---------- */
.slide h1 { font-size: 28px; }
.slide p, .slide li { font-size: 18px; }
.slide .lead { font-size: 24px; }
.tips { list-style: none; padding: 0; }
.tips li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.tips li:last-child { border: 0; }
.slide .kb-wrap { margin: 14px 0; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 14px; margin: 8px 0; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 16px; height: 16px; border-radius: 5px; display: inline-block; }
.slide-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; }
.dots { display: flex; gap: 6px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: #d4dde9; }
.dots i.on { background: var(--orange); }

/* ---------- natija ---------- */
.modal { position: fixed; inset: 0; background: rgba(13, 30, 52, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; animation: fade .2s; }
.modal-card { background: #fff; border-radius: 20px; max-width: 640px; width: 100%; padding: 24px; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); max-height: calc(100vh - 32px); overflow: auto; animation: pop .28s ease-out; }
.r-stars { font-size: 54px; line-height: 1; letter-spacing: 6px; margin-bottom: 6px; }
.r-stars .star.on { animation: starpop .45s both; }
.r-stars .star.on:nth-child(2) { animation-delay: .15s; }
.r-stars .star.on:nth-child(3) { animation-delay: .3s; }
.r-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 16px 0; }
.r-grid div { background: var(--bg); border-radius: 12px; padding: 10px 4px; }
.r-grid b { display: block; font-size: 22px; color: var(--navy-d); }
.r-grid span { font-size: 12px; color: var(--muted); }
.r-chart { margin: 4px 0 10px; }
.chart { width: 100%; max-width: 760px; height: auto; display: block; margin: 0 auto; }
.chart .grid { stroke: #e6ecf3; }
.chart .ax { font-size: 11px; fill: #8c9ab0; }
.chart .avg { fill: none; stroke: var(--navy); stroke-width: 3; stroke-linejoin: round; }
.chart .raw { fill: var(--orange); opacity: .65; }
.chart .bar { fill: #9cc3e0; }
.chart .bar.full { fill: var(--ok); }
.chart .goal { stroke: var(--orange); stroke-dasharray: 5 4; }
.chart-legend { display: flex; justify-content: center; gap: 18px; font-size: 13px; color: var(--muted); }
.chart-legend i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.l-avg { background: var(--navy); }
.l-raw { background: var(--orange); height: 8px !important; width: 8px !important; border-radius: 50% !important; }
.r-weak { margin: 6px 0 4px; }
.r-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
@keyframes starpop { 0% { transform: scale(0); } 70% { transform: scale(1.3); } 100% { transform: scale(1); } }
.r-stars .star { display: inline-block; }

/* ---------- natijalarim ---------- */
.me-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.me-head > div { flex: 1; }
.me-head h1, .me-head p { margin: 0; }
.tiles-stat { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 18px; }
.tiles-stat .card { margin: 0; background: #fff; }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl th { color: var(--muted); font-weight: 700; font-size: 13px; }
.tbl .stars { font-size: 15px; }

/* Past ekranlar (1366×768 va brauzer paneli): dars ekrani bitta oynaga sig'sin. */
@media (min-width: 641px) and (max-height: 780px) {
  .top-in { padding: 6px 16px; }
  .page.lesson { padding-top: 8px; }
  .lbar { margin-bottom: 8px; }
  .live div { padding: 3px 12px; }
  .live b { font-size: 19px; }
  .text-view { font-size: 24px; margin: 10px 24px 2px; }
  .hint { font-size: 14px; }
  .typebox { padding-bottom: 6px; margin-bottom: 10px; }
  .kb { gap: 4px; padding: 6px; }
  .kb-row { gap: 4px; }
  .key { height: 34px; font-size: 14px; }
  .hands { max-width: 250px; margin-top: 2px; }
  .ltools { margin-top: 6px; font-size: 13px; }
}

@media (max-width: 860px) {
  .hero-stats, .tiles-stat { grid-template-columns: repeat(3, 1fr); }
  .r-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .top-in { gap: 6px; padding: 8px 12px; }
  .top nav { margin-left: 0; gap: 0; }
  .top nav a { padding: 6px 7px; font-size: 14px; }
  .who { padding: 2px; }
  .who .nm { display: none; }
  .brand img { height: 17px; }
  .brand span { font-size: 12px; padding: 1px 7px; }
  .icon-btn { font-size: 17px; padding: 2px; }
  .hero-stats, .tiles-stat { grid-template-columns: repeat(2, 1fr); }
  .text-view { font-size: 21px; margin: 16px 14px 4px; }
  .hint { margin: 2px 14px 0; }
  .key { height: 32px; font-size: 11px; border-radius: 6px; }
  .key .ks { display: none; }
  .kb, .kb-row { gap: 3px; }
  .kb { padding: 5px; }
  .live div { min-width: 0; padding: 4px 10px; }
  .live b { font-size: 18px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .hello h1 { font-size: 24px; }
}
