/* ===== Shrift (offline, Lotin + Kirill) ===== */
@font-face { font-family: "Nunito"; font-weight: 600; font-display: swap; src: url(../fonts/nunito-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: "Nunito"; font-weight: 600; font-display: swap; src: url(../fonts/nunito-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+20A0-20CF, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Nunito"; font-weight: 600; font-display: swap; src: url(../fonts/nunito-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Nunito"; font-weight: 800; font-display: swap; src: url(../fonts/nunito-latin-800-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: "Nunito"; font-weight: 800; font-display: swap; src: url(../fonts/nunito-latin-ext-800-normal.woff2) format("woff2"); unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+20A0-20CF, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Nunito"; font-weight: 800; font-display: swap; src: url(../fonts/nunito-cyrillic-800-normal.woff2) format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Nunito"; font-weight: 900; font-display: swap; src: url(../fonts/nunito-latin-900-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: "Nunito"; font-weight: 900; font-display: swap; src: url(../fonts/nunito-latin-ext-900-normal.woff2) format("woff2"); unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+20A0-20CF, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Nunito"; font-weight: 900; font-display: swap; src: url(../fonts/nunito-cyrillic-900-normal.woff2) format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }

:root {
  --bg1: #e9f4ff;
  --bg2: #f6ecff;
  --ink: #1f2a44;
  --ink-soft: #55607a;
  --card: #ffffff;
  --line: #e3e8f2;
  --primary: #ff8a3d;
  --primary-dark: #e86f1f;
  --blue: #3d8bff;
  --green: #22c07a;
  --red: #ff5a6b;
  --yellow: #ffc83d;
  --purple: #8b5cf6;
  --sq-light: #f6e7c8;
  --sq-dark: #c9a173;
  --t1: #3d8bff;
  --t2: #22c07a;
  --t3: #8b5cf6;
  --t4: #e8590c;
  --t5: #c2255c;
  --radius: 22px;
  --shadow: 0 10px 30px rgba(43, 64, 120, .12);
  --shadow-sm: 0 4px 12px rgba(43, 64, 120, .10);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
  font-weight: 600;
  color: var(--ink);
  background: radial-gradient(1200px 600px at 10% -10%, #fff7d6 0%, transparent 60%),
              radial-gradient(900px 600px at 110% 10%, #ffe1ec 0%, transparent 55%),
              linear-gradient(160deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
  overflow: hidden;
  user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ===== Yuqori panel ===== */
.topbar {
  height: 68px; display: flex; align-items: center; gap: 16px; padding: 0 22px;
  background: rgba(255, 255, 255, .78); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); position: relative; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; text-align: left; }
.brand-mascot { width: 48px; height: 48px; filter: drop-shadow(0 3px 4px rgba(0,0,0,.15)); }
.brand-text b { display: block; font-weight: 900; font-size: 20px; letter-spacing: .3px; }
.brand-text small { color: var(--ink-soft); font-size: 12.5px; }
.topbar-stats { display: flex; gap: 8px; margin-left: auto; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; font-weight: 900; background: #fff; box-shadow: var(--shadow-sm); }
.pill-star .ico { color: var(--yellow); font-size: 18px; }
.pill-done .ico { color: var(--green); }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.lang-toggle { display: flex; background: #eef2fa; border-radius: 999px; padding: 4px; }
.lang-toggle button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; font-weight: 800; color: var(--ink-soft); }
.lang-toggle button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: #fff; box-shadow: var(--shadow-sm); font-size: 19px; }
.icon-btn.off { opacity: .45; }

/* ===== Ekranlar ===== */
.screen { display: none; height: calc(100vh - 68px); overflow: auto; }
.screen.active { display: block; animation: screenIn .35s ease; }
@keyframes screenIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ===== Tugmalar ===== */
.btn { border: 0; border-radius: 16px; padding: 11px 18px; font-weight: 800; background: #fff; box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s, background .2s; display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-primary { background: linear-gradient(180deg, #ffa25f, var(--primary)); color: #fff; box-shadow: 0 5px 0 var(--primary-dark), var(--shadow-sm); }
.btn-primary:active { box-shadow: 0 2px 0 var(--primary-dark); }
.btn-play { background: linear-gradient(180deg, #6aa8ff, var(--blue)); color: #fff; box-shadow: 0 5px 0 #2a6fd6, var(--shadow-sm); }
.btn-soft { background: #f2f5fb; box-shadow: none; }
.btn-ghost { background: transparent; box-shadow: none; padding: 8px 10px; color: var(--ink-soft); }
.btn-danger { background: #ffe6e9; color: #c22a3a; box-shadow: none; }
.btn-big { font-size: 18px; padding: 15px 26px; border-radius: 20px; }
.btn-wide { width: 100%; }

/* ===== Bosh sahifa ===== */
.hero { display: flex; gap: 26px; align-items: center; max-width: 1180px; margin: 26px auto 8px; padding: 0 24px; }
.hero-mascot img { width: 170px; height: 170px; animation: bob 3s ease-in-out infinite; filter: drop-shadow(0 12px 14px rgba(40,60,120,.2)); }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-10px) rotate(2deg); } }
.hero-bubble { position: relative; background: #fff; border-radius: 28px; padding: 22px 28px; box-shadow: var(--shadow); flex: 1; }
.hero-bubble::before { content: ""; position: absolute; left: -16px; top: 50%; width: 32px; height: 32px; background: #fff; transform: translateY(-50%) rotate(45deg); border-radius: 6px; }
.hero-bubble h1 { margin: 0 0 6px; font-weight: 900; font-size: 30px; }
.hero-bubble p { margin: 0 0 16px; color: var(--ink-soft); font-size: 17px; line-height: 1.45; }
.hero-buttons { display: flex; gap: 14px; flex-wrap: wrap; }

.tier-tabs { display: flex; gap: 12px; justify-content: center; margin: 18px auto 6px; flex-wrap: wrap; padding: 0 16px; }
.tier-tab { border: 0; border-radius: 18px; padding: 12px 18px; background: #fff; box-shadow: var(--shadow-sm); font-weight: 900; display: flex; flex-direction: column; align-items: flex-start; min-width: 250px; text-align: left; position: relative; overflow: hidden; }
.tier-tab small { font-weight: 700; color: var(--ink-soft); }
.tier-tab .bar { height: 6px; width: 100%; background: #eef1f7; border-radius: 6px; margin-top: 8px; overflow: hidden; }
.tier-tab .bar i { display: block; height: 100%; background: currentColor; border-radius: 6px; }
.tier-tab[data-tier="1"] { color: var(--t1); }
.tier-tab[data-tier="2"] { color: var(--t2); }
.tier-tab[data-tier="3"] { color: var(--t3); }
.tier-tab[data-tier="4"] { color: var(--t4); }
.tier-tab[data-tier="5"] { color: var(--t5); }
.tier-tab b { color: var(--ink); font-size: 17px; }
.tier-tab.on { outline: 3px solid currentColor; }

.map { max-width: 1180px; margin: 10px auto 20px; padding: 10px 24px 30px; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.lesson-card { position: relative; background: #fff; border: 0; border-radius: var(--radius); padding: 16px 16px 14px; text-align: left; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 8px; min-height: 150px; transition: transform .15s, box-shadow .15s; animation: cardIn .4s backwards; }
.lesson-card:hover { transform: translateY(-4px) rotate(-.4deg); box-shadow: var(--shadow); }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.lesson-card .num { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-weight: 900; font-size: 19px; color: #fff; background: var(--tc, var(--t1)); box-shadow: 0 4px 0 rgba(0,0,0,.12); }
.lesson-card .ttl { font-weight: 900; font-size: 16px; line-height: 1.25; }
.lesson-card .meta { margin-top: auto; display: flex; justify-content: space-between; align-items: center; color: var(--ink-soft); font-size: 13px; }
.lesson-card .stars { color: #d9dee8; font-size: 18px; letter-spacing: 1px; }
.lesson-card .stars .on { color: var(--yellow); text-shadow: 0 1px 0 #d9a21b; }
.lesson-card .icon { position: absolute; right: 14px; top: 12px; font-size: 30px; opacity: .9; }
.lesson-card.locked { filter: grayscale(.9); opacity: .55; }
.lesson-card.locked::after { content: "🔒"; position: absolute; right: 14px; bottom: 12px; font-size: 18px; }
.lesson-card.current { outline: 3px dashed var(--primary); }
.lesson-card .mini { height: 6px; background: #eef1f7; border-radius: 6px; overflow: hidden; }
.lesson-card .mini i { display: block; height: 100%; background: var(--tc); }
.credits { text-align: center; color: var(--ink-soft); font-size: 12.5px; padding: 0 20px 26px; }

/* ===== Dars / mashq sahnasi ===== */
.stage { --side: clamp(290px, 32vw, 430px); display: grid; grid-template-columns: minmax(0, 1fr) var(--side); gap: 22px; height: 100%; padding: 18px 22px; }
.stage-board { display: flex; align-items: center; justify-content: center; position: relative; min-height: 0; }
.stage-side { display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow: auto; padding: 4px 2px 10px; }
.lesson-head { display: flex; gap: 8px; align-items: flex-start; }
.lesson-head h2 { margin: 2px 0 0; font-weight: 900; font-size: 22px; line-height: 1.2; }
.lesson-kicker { color: var(--ink-soft); font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; }

.coach { display: flex; gap: 10px; align-items: flex-start; }
.coach-mascot { width: 92px; height: 92px; flex: none; transform-origin: 50% 90%; filter: drop-shadow(0 6px 6px rgba(40,60,120,.18)); }
.coach-mascot.talk { animation: talk .45s ease-in-out infinite alternate; }
@keyframes talk { from { transform: rotate(-3deg) scale(1); } to { transform: rotate(3deg) scale(1.04); } }
.coach-mascot.jump { animation: jump .8s cubic-bezier(.3,1.6,.5,1) 2; }
@keyframes jump { 0%,100% { transform: translateY(0) scale(1); } 40% { transform: translateY(-26px) scale(1.08) rotate(-8deg); } 70% { transform: translateY(0) scale(.96,1.04); } }
.coach-mascot.sad { animation: sad .7s ease; }
@keyframes sad { 0%,100% { transform: none; } 30% { transform: rotate(-10deg) translateY(4px); } 60% { transform: rotate(8deg) translateY(4px); } }
.speech { position: relative; background: #fff; border-radius: 20px; padding: 14px 18px; box-shadow: var(--shadow-sm); flex: 1; min-height: 92px; }
.speech::before { content: ""; position: absolute; left: -9px; top: 28px; width: 18px; height: 18px; background: #fff; transform: rotate(45deg); border-radius: 4px; }
.speech p { margin: 0; font-size: 19px; line-height: 1.45; position: relative; }
.speech p .w { transition: color .2s; }
.speech p .w.said { color: var(--ink); }
.speech p .w.todo { color: #a3abbd; }
.task-num { font-weight: 900; color: var(--primary); font-size: 14px; text-transform: uppercase; letter-spacing: .6px; }
.task-side { margin-top: 8px; display: inline-flex; gap: 6px; align-items: center; font-weight: 800; font-size: 14px; padding: 4px 10px; border-radius: 999px; background: #f2f5fb; }
.task-side:empty { display: none; }
.task-side .dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #333; }
.task-side .dot.w { background: #fff; }
.task-side .dot.b { background: #222; }

.beat-progress { display: flex; gap: 4px; }
.beat-progress i { flex: 1; min-width: 4px; height: 8px; border-radius: 6px; background: #e3e8f2; cursor: pointer; transition: background .3s; }
.beat-progress i.done { background: #b7d4ff; }
.beat-progress i.now { background: var(--blue); }
.player-controls { display: flex; gap: 12px; justify-content: center; }
.ctrl { width: 54px; height: 54px; border-radius: 50%; border: 0; background: #fff; box-shadow: var(--shadow-sm); font-size: 20px; }
.ctrl-main { width: 66px; height: 66px; font-size: 26px; background: linear-gradient(180deg, #6aa8ff, var(--blue)); color: #fff; box-shadow: 0 5px 0 #2a6fd6; }

.ex-dots { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
.ex-dots button { height: 30px; border-radius: 10px; border: 0; background: #eef1f7; font-weight: 900; font-size: 13px; color: var(--ink-soft); }
.ex-dots button.now { outline: 3px solid var(--primary); background: #fff; color: var(--ink); }
.ex-dots button.ok { background: var(--green); color: #fff; }
.ex-dots button.ok2 { background: #8fdcb7; color: #fff; }
.ex-dots button.seen { background: #ffd6a8; color: #8a4b12; }
.task-feedback { min-height: 30px; font-weight: 900; font-size: 18px; text-align: center; }
.task-feedback.good { color: var(--green); animation: pop .4s; }
.task-feedback.bad { color: var(--red); animation: shakeX .4s; }
.task-feedback.info { color: var(--ink-soft); font-size: 16px; font-weight: 700; text-align: left; background: #fff; border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow-sm); }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes shakeX { 0%,100% { transform: none; } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.task-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.task-actions .btn-primary { margin-left: auto; }

/* ===== Variantli savollar ===== */
.choice-host { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.question-host { width: min(92%, 640px); }
.choice-btn { border: 0; background: #fff; padding: 14px 16px; border-radius: 18px; font-weight: 900; font-size: 19px; box-shadow: 0 5px 0 #d5dcea, var(--shadow-sm); transition: transform .1s; }
.choice-btn:hover { transform: translateY(-2px); }
/* ko'tarilganda sichqoncha pastki chetdan «tushib qolib» tugma titramasin — bosish maydoni 4px pastga cho'zilgan */
.choice-btn { position: relative; }
.choice-btn::after { content: ""; position: absolute; left: 0; right: 0; top: 0; bottom: -4px; }
.choice-btn.right { background: var(--green); color: #fff; box-shadow: 0 5px 0 #169a60; animation: pop .4s; }
.choice-btn.wrong { background: #ffe1e5; color: #c22a3a; animation: shakeX .4s; }
/* dona rasmi va «Oq/Qora» rangli tugmalar (o'qiy olmaydigan bolalar uchun) */
.choice-btn.pc { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 12px 12px; }
.choice-btn .pcs { display: flex; gap: 2px; pointer-events: none; }
.choice-btn .pcs img { width: 64px; height: 64px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.18)); }
.choice-btn.pc2 .pcs img { width: 50px; height: 50px; }
.choice-btn .ico { display: block; font-size: 30px; line-height: 1.15; margin-bottom: 2px; pointer-events: none; }
.choice-btn.sw-w:not(.right):not(.wrong) { background: #fff; color: #1e2340; box-shadow: inset 0 0 0 3px #c9cfdd, 0 5px 0 #c9cfdd, var(--shadow-sm); }
.choice-btn.sw-b:not(.right):not(.wrong) { background: #2a2d3a; color: #fff; box-shadow: 0 5px 0 #0f1117, var(--shadow-sm); }
.question-card { background: #fff; border-radius: 30px; box-shadow: var(--shadow); padding: 48px 30px; font-size: 44px; font-weight: 900; text-align: center; animation: cardPop .5s cubic-bezier(.3, 1.6, .5, 1); }

/* ===== Shaxmat doskasi ===== */
.board-host { --size: min(calc(100vh - 68px - 60px), calc(100vw - var(--side, 430px) - 110px)); width: var(--size); height: var(--size); position: relative; }
.board-frame { position: absolute; inset: 0; padding: 26px; border-radius: 26px; background: linear-gradient(145deg, #8a5a33, #6b4223); box-shadow: 0 18px 40px rgba(60, 35, 10, .35), inset 0 2px 0 rgba(255,255,255,.2); }
.board { position: relative; width: 100%; height: 100%; border-radius: 8px; overflow: hidden; box-shadow: 0 0 0 3px #4a2c14; }
.board .sq { position: absolute; width: 12.5%; height: 12.5%; }
.board .sq.l { background: var(--sq-light); }
.board .sq.d { background: var(--sq-dark); }
.board .sq .hl { position: absolute; inset: 0; opacity: 0; transition: opacity .25s; }
.board .sq.hl-y .hl { background: rgba(255, 214, 0, .55); opacity: 1; }
.board .sq.hl-g .hl { background: rgba(34, 192, 122, .55); opacity: 1; }
.board .sq.hl-r .hl { background: rgba(255, 70, 90, .55); opacity: 1; }
.board .sq.hl-b .hl { background: rgba(61, 139, 255, .5); opacity: 1; }
.board .sq.hl-p .hl { background: rgba(139, 92, 246, .45); opacity: 1; }
.board .sq.last .hl { background: rgba(255, 200, 61, .45); opacity: 1; }
.board .sq.sel .hl { background: rgba(61, 139, 255, .45); opacity: 1; }
.board .sq.check .hl { background: radial-gradient(circle, rgba(255,40,40,.95) 0%, rgba(255,40,40,.5) 40%, transparent 72%); opacity: 1; }
.board .sq .dot { position: absolute; left: 50%; top: 50%; width: 30%; height: 30%; transform: translate(-50%, -50%); border-radius: 50%; background: rgba(30, 60, 140, .35); pointer-events: none; animation: dotIn .2s; }
.board .sq .ring { position: absolute; inset: 4%; border-radius: 50%; border: 6px solid rgba(30, 60, 140, .35); pointer-events: none; }
@keyframes dotIn { from { transform: translate(-50%, -50%) scale(0); } }
.board .sq .mk { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; pointer-events: none; animation: pop .35s; }
.board .sq .mk.x { color: #e0283c; font-size: calc(var(--size) / 12); }
.board .sq .mk.o { }
.board .sq .mk.o::after { content: ""; width: 34%; height: 34%; border-radius: 50%; background: #1f2a44; opacity: .8; }
.board .sq .mk.star { font-size: calc(var(--size) / 13); color: #ffb800; text-shadow: 0 2px 0 #c98b00; animation: starSpin 2.4s ease-in-out infinite; }
@keyframes starSpin { 0%,100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.12) rotate(12deg); } }
.board .sq .mk.lbl { font-size: calc(var(--size) / 30); color: #fff; }
.board .sq .mk.lbl span { background: rgba(31, 42, 68, .82); padding: 2px 8px; border-radius: 10px; }
/* belgilar donalardan (z-index 2) yuqorida; dona turgan katakda — o'ng yuqori burchakdagi nishon */
.board .sq .mk.x, .board .sq .mk.star, .board .sq .mk.lbl { z-index: 4; }
.board .sq .mk.on-pc { place-items: start end; }
.board .sq .mk.lbl.lbl2 { place-items: end end; }
.board .sq .mk.lbl.lbl2 span { transform: translate(18%, 22%); }
.board .sq .mk.lbl.on-pc span { transform: translate(18%, -22%); font-size: 1.15em; padding: 1px 7px; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.board .sq .mk.star.on-pc { font-size: calc(var(--size) / 22); line-height: 1; padding: 1px 2px; }
.board .sq .pulse { position: absolute; inset: 6%; border-radius: 50%; border: 5px solid #ff8a3d; animation: pulse 1.1s ease-out infinite; pointer-events: none; }
@keyframes pulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.25); opacity: 0; } }
.board .coord { position: absolute; font-size: calc(var(--size) / 48); font-weight: 900; pointer-events: none; opacity: .75; }
.board .coord.f { right: 4%; bottom: 2%; }
.board .coord.r { left: 4%; top: 2%; }
.board .sq.l .coord { color: var(--sq-dark); }
.board .sq.d .coord { color: var(--sq-light); }
.board-frame .edge { position: absolute; color: #f6e2c2; font-weight: 900; font-size: 14px; display: flex; }
.board-frame .edge.bottom { left: 26px; right: 26px; bottom: 3px; }
.board-frame .edge.left { top: 26px; bottom: 26px; left: 0; width: 26px; flex-direction: column; }
.board-frame .edge span { flex: 1; display: grid; place-items: center; }
.board-frame.big-coords .edge { color: #ffd166; font-size: 18px; text-shadow: 0 0 8px rgba(255, 209, 102, .8); }
.piece { position: absolute; width: 12.5%; height: 12.5%; background-size: 100% 100%; z-index: 2; transition: transform calc(.45s * var(--tempo, 1)) cubic-bezier(.35, .9, .35, 1.05), opacity .3s; pointer-events: none; will-change: transform; filter: drop-shadow(0 3px 2px rgba(0,0,0,.25)); }
.piece.drag { transition: none; z-index: 10; filter: drop-shadow(0 10px 8px rgba(0,0,0,.35)); }
.piece.appear { animation: appear .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes appear { from { opacity: 0; scale: .2; } }
.piece.vanish { opacity: 0; scale: 1.4; transition: opacity .35s, scale .35s; }
.piece.hop { animation: hop .5s ease; }
@keyframes hop { 50% { translate: 0 -18%; } }
.piece.wiggle { animation: wiggle .5s ease 2; }
@keyframes wiggle { 25% { rotate: -12deg; } 75% { rotate: 12deg; } }
.board svg.arrows { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; }
.board svg.arrows path { animation: drawIn calc(.6s * var(--tempo, 1)) ease forwards; }
@keyframes drawIn { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
.board.shake { animation: shakeX .4s; }
.promo { position: absolute; z-index: 20; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; }
.promo div { background: #fff; border-radius: 20px; padding: 12px; display: flex; gap: 8px; box-shadow: var(--shadow); }
.promo button { width: 80px; height: 80px; border: 0; border-radius: 14px; background: #f2f5fb center/80% no-repeat; }

/* ===== O'yin rejimi ===== */
.play-options { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: center; background: #fff; padding: 14px; border-radius: 18px; box-shadow: var(--shadow-sm); }
.play-options label { font-weight: 800; color: var(--ink-soft); }
.play-options { grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr); }
.play-options .seg { min-width: 0; }
.play-options .seg button { min-width: 0; padding: 8px 3px; }
.seg { display: flex; background: #eef2fa; padding: 4px; border-radius: 14px; }
.seg button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 10px; font-weight: 800; color: var(--ink-soft); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.movelist { background: #fff; border-radius: 18px; box-shadow: var(--shadow-sm); margin: 0; padding: 12px 12px 12px 42px; columns: 2; font-weight: 800; min-height: 80px; max-height: 220px; overflow: auto; }

/* ===== Dialog ===== */
.dialog { border: 0; border-radius: 26px; padding: 26px; width: min(440px, 92vw); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(20, 30, 60, .35); backdrop-filter: blur(3px); }
.dialog h2 { margin-top: 0; font-weight: 900; }
.dialog .row { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-weight: 800; justify-content: flex-start; }
.dialog .row select { margin-left: auto; font: inherit; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); }
.dialog input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--primary); }
.dialog-actions { display: flex; justify-content: space-between; margin-top: 16px; }

/* ===== Tabrik ===== */
.celebrate { position: fixed; inset: 0; z-index: 50; background: rgba(20, 30, 60, .45); display: grid; place-items: center; backdrop-filter: blur(3px); }
.celebrate-card { background: #fff; border-radius: 32px; padding: 30px 40px; text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.3); animation: cardPop .6s cubic-bezier(.3, 1.6, .5, 1); max-width: 520px; }
@keyframes cardPop { from { transform: scale(.4) rotate(-6deg); opacity: 0; } }
.celebrate-stars { font-size: 64px; letter-spacing: 6px; color: #e3e8f2; }
.celebrate-stars span { display: inline-block; }
.celebrate-stars .on { color: var(--yellow); text-shadow: 0 3px 0 #d9a21b; animation: starIn .6s cubic-bezier(.3, 1.8, .5, 1) backwards; }
@keyframes starIn { from { transform: scale(0) rotate(-180deg); } }
.celebrate-card h2 { font-weight: 900; font-size: 32px; margin: 8px 0; }
.celebrate-card p { color: var(--ink-soft); font-size: 18px; }
.celebrate-actions { display: flex; gap: 12px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.toast-praise { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(0); z-index: 40; font-weight: 900; font-size: 64px; color: #fff; pointer-events: none; text-shadow: 0 4px 0 #e86f1f, 0 8px 24px rgba(0,0,0,.3); white-space: nowrap; }
.toast-praise.show { animation: praise 1.6s cubic-bezier(.3, 1.5, .5, 1) forwards; }
@keyframes praise { 0% { transform: translate(-50%, -50%) scale(0) rotate(-10deg); opacity: 0; } 18% { transform: translate(-50%, -50%) scale(1.15) rotate(3deg); opacity: 1; } 30% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; transform: translate(-50%, -60%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -80%) scale(.9); } }
#fx-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; }


/* ===== Yuqori panel navigatsiyasi ===== */
.topnav { display: flex; gap: 8px; margin-left: 18px; }
.nav-btn { display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 14px; padding: 9px 15px; background: #fff; box-shadow: var(--shadow-sm); font-weight: 900; color: var(--ink); transition: transform .12s, background .2s; }
.nav-btn .ico { font-size: 19px; line-height: 1; }
.nav-btn:hover { transform: translateY(-2px); }
.nav-btn.on { background: linear-gradient(180deg, #6aa8ff, var(--blue)); color: #fff; }

/* ===== Umumiy sahifa ===== */
.page-wrap { max-width: 1180px; margin: 0 auto; padding: 22px 24px 34px; }
.page-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.page-head h1 { margin: 2px 0 6px; font-weight: 900; font-size: 28px; }
.page-head p { margin: 0; color: var(--ink-soft); font-size: 16px; line-height: 1.45; max-width: 820px; }
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px 20px; margin-bottom: 14px; }
.card h3 { margin: 0 0 12px; font-weight: 900; font-size: 18px; }
.muted { color: var(--ink-soft); margin: 10px 0 0; font-weight: 700; }

/* ===== Figuralar ===== */
.piece-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.piece-card { display: flex; gap: 16px; align-items: center; text-align: left; background: #fff; border: 0; border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; animation: cardIn .4s backwards; }
.piece-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.piece-card img { width: 96px; height: 96px; flex: none; background: radial-gradient(circle at 50% 60%, #fff3dc, #f6e7c8 70%); border-radius: 22px; padding: 8px; filter: drop-shadow(0 6px 6px rgba(40, 60, 120, .18)); }
.piece-card:hover img { animation: hopImg .5s; }
@keyframes hopImg { 40% { transform: translateY(-10px) rotate(-6deg); } 70% { transform: translateY(0) rotate(3deg); } }
.pc-body { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.pc-body b { font-size: 21px; font-weight: 900; }
.pc-val { align-self: flex-start; background: #fff3dc; color: #a35a12; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 900; }
.pc-body p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.35; }
.pc-body .mini { height: 6px; background: #eef1f7; border-radius: 6px; overflow: hidden; margin-top: 4px; }
.pc-body .mini i { display: block; height: 100%; background: var(--primary); }
.pc-body .meta { display: flex; justify-content: space-between; color: var(--ink-soft); font-size: 13px; }
.pc-body .stars { color: #d9dee8; font-size: 17px; }
.pc-body .stars .on { color: var(--yellow); }

/* ===== Imtihon sozlamalari ===== */
.exam-setup { max-width: 920px; }
.seg-wide { display: flex; flex-wrap: wrap; gap: 8px; }
.seg-wide button { flex: 1 1 160px; border: 0; border-radius: 14px; padding: 12px 14px; font-weight: 900; background: #f2f5fb; color: var(--ink-soft); }
.seg-wide button.on { background: linear-gradient(180deg, #6aa8ff, var(--blue)); color: #fff; box-shadow: var(--shadow-sm); }
.topic-picker { margin-top: 14px; display: flex; flex-direction: column; gap: 14px; max-height: 340px; overflow: auto; padding-right: 4px; }
.tp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 11px; font-weight: 800; font-size: 13px; color: var(--ink-soft); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.on { border-color: var(--blue); background: #e8f1ff; color: #1d4fa8; }
.chip-all { font-size: 12px; padding: 3px 10px; }
.rules { margin: 0; padding-left: 20px; color: var(--ink-soft); line-height: 1.6; font-weight: 700; }
#exam-start { margin: 6px 0 16px; }
.history { display: flex; flex-direction: column; gap: 6px; }
.h-row { display: grid; grid-template-columns: 1.2fr .8fr 1fr .8fr 40px; gap: 8px; align-items: center; background: #f7f9fd; border-radius: 12px; padding: 8px 12px; font-weight: 800; color: var(--ink-soft); }
.h-row b { color: var(--ink); }
.h-grade { text-align: center; border-radius: 10px; color: #fff; font-weight: 900; padding: 2px 0; }
.g5 { --g: var(--green); } .g4 { --g: var(--blue); } .g3 { --g: var(--yellow); } .g2 { --g: var(--red); }
.h-grade { background: var(--g); }

/* ===== Imtihon jarayoni ===== */
.exam-bar { display: flex; justify-content: space-between; align-items: center; background: #fff; border-radius: 14px; padding: 8px 14px; box-shadow: var(--shadow-sm); font-weight: 900; }
.exam-bar .tries i { color: #e3e8f2; font-style: normal; margin-left: 3px; font-size: 18px; }
.exam-bar .tries i.on { color: var(--red); }
.exam-score { color: var(--blue); }
.ex-dots button.fail { background: #ffd0d6; color: #b3213a; }
.topic-badge { display: inline-block; margin-top: 8px; background: #eef2fa; color: var(--ink-soft); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 800; }

/* ===== Imtihon natijasi ===== */
.exam-result { max-width: 920px; }
.result-top { display: flex; gap: 24px; align-items: center; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 24px; margin-bottom: 14px; animation: pop .5s; }
.score-ring { --p: 0; width: 150px; height: 150px; flex: none; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, #fff 76%, transparent 77%), conic-gradient(var(--g) calc(var(--p) * 1%), #eef1f7 0); }
.score-ring b { font-size: 42px; font-weight: 900; line-height: 1; }
.score-ring small { color: var(--ink-soft); font-weight: 800; }
.grade { font-size: 22px; font-weight: 900; color: var(--g); margin-bottom: 6px; }
.res-line { margin: 0 0 10px; font-size: 17px; font-weight: 800; }
.res-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.st { border-radius: 12px; padding: 6px 12px; font-weight: 800; background: #f2f5fb; }
.st-ok b { color: var(--green); } .st-mid b { color: #d08a00; } .st-bad b { color: var(--red); }
.topic-table { display: flex; flex-direction: column; gap: 8px; }
.tt-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px 56px; gap: 10px; align-items: center; font-weight: 800; }
.tt-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-bar { height: 10px; background: #eef1f7; border-radius: 10px; overflow: hidden; }
.tt-bar i { display: block; height: 100%; background: var(--g); border-radius: 10px; }
.exam-result .celebrate-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

@media (max-width: 1100px) {
  .topnav { margin-left: 6px; }
  .nav-btn { padding: 8px 11px; }
}
@media (max-width: 960px) {
  .nav-btn .lbl { display: none; }
  .result-top { flex-direction: column; text-align: center; }
  .tt-row { grid-template-columns: minmax(0, 1fr) 90px 50px; }
}

.btn-daily { background: linear-gradient(180deg, #b48bff, var(--purple)); color: #fff; box-shadow: 0 5px 0 #6d3fd6, var(--shadow-sm); }
.btn-daily.done { background: linear-gradient(180deg, #5fe0a6, var(--green)); box-shadow: 0 5px 0 #179a60, var(--shadow-sm); }

.btn-two { background: linear-gradient(180deg, #ffb35c, #ff8a1f); color: #fff; box-shadow: 0 5px 0 #d4680a, var(--shadow-sm); }
.btn-gold { background: linear-gradient(180deg, #ffe08a, #f2b632); color: #5a3d00; box-shadow: 0 4px 0 #c78f12, var(--shadow-sm); font-weight: 900; }

/* imtihon: vaqt */
.exam-timer { font-weight: 900; padding: 2px 10px; border-radius: 999px; background: #eef4ff; color: var(--blue); font-variant-numeric: tabular-nums; }
.exam-timer.low { background: #ffe5e8; color: var(--red); animation: tpulse 1s infinite; }
@keyframes tpulse { 50% { transform: scale(1.08); } }

/* kunlik test */
#screen-exam.daily .n-src { display: none; }
.daily-card { background: linear-gradient(135deg, #f4eeff, #fff); }
.daily-top { display: flex; align-items: center; gap: 14px; }
.daily-top b { font-size: 22px; font-weight: 900; }
.daily-top p { margin: 4px 0 0; }
.daily-fire { font-size: 44px; filter: drop-shadow(0 4px 6px rgba(255, 120, 0, .3)); }
.daily-week { display: flex; gap: 8px; margin: 14px 0 6px; flex-wrap: wrap; }
.daily-week .day { flex: 1 1 60px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 12px; background: #f1f3f9; color: var(--ink-soft); }
.daily-week .day small { font-size: 12px; font-weight: 800; text-transform: capitalize; }
.daily-week .day b { font-size: 18px; }
.daily-week .day.on { background: #dcf8ea; color: #128a52; }

/* sertifikat */
.cert-dialog { width: min(980px, 96vw); }
.cert-dialog canvas { width: 100%; height: auto; border-radius: 12px; box-shadow: var(--shadow-sm); background: #fff; display: block; }
.cert-row input { flex: 1; font: inherit; font-weight: 800; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--line); min-width: 0; }
.cert-row input:focus { outline: none; border-color: var(--blue); }
.cert-dialog .dialog-actions { gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.print-only { display: none; }
@media print {
  body > *:not(#cert-print-img) { display: none !important; }
  body { background: #fff !important; overflow: visible !important; }
  #cert-print-img { display: block !important; width: 100%; height: auto; }
  @page { size: A4 landscape; margin: 8mm; }
}

/* ikki kishilik o'yin */
.two-only { display: none !important; }
#screen-play.two .two-only { display: flex !important; }
#screen-play.two label.two-only { display: block !important; }
#screen-play.two .pc-only { display: none !important; }
.players { display: flex; flex-direction: column; gap: 8px; }
#screen-play:not(.two):not(.timed) #players { display: none; }
.player input[readonly] { cursor: default; }
.player { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 14px; padding: 8px 12px; box-shadow: var(--shadow-sm); border: 3px solid transparent; transition: border-color .2s, transform .2s; }
.player.active { border-color: var(--blue); transform: scale(1.02); }
.player input { flex: 1; min-width: 0; border: 0; font: inherit; font-weight: 800; background: transparent; color: var(--ink); }
.player input:focus { outline: none; }
.player .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #9aa6bf; flex: none; }
.player .dot.w { background: #fff; }
.player .dot.b { background: #222; }
.player .clock { font-variant-numeric: tabular-nums; font-size: 20px; font-weight: 900; min-width: 64px; text-align: right; }
.player .clock.low { color: var(--red); }

/* ===== Har xil ekranlarga moslashish ===== */
@media (max-width: 1100px) {
  .brand-text small { display: none; }
  .brand-text b { font-size: 17px; }
  .topbar { gap: 10px; padding: 0 14px; }
  .stage { gap: 14px; padding: 12px 14px; }
}
@media (max-width: 820px) {
  .lang-toggle button { padding: 6px 9px; }
  .pill { padding: 5px 10px; }
  .brand-text { display: none; }
  .ex-dots button { min-width: 0; padding: 0; font-size: 12px; }
}
@media (max-height: 640px) {
  .stage-side { gap: 8px; }
  .ex-dots { gap: 3px; }
}
/* tik (portret) ekran: taxta tepada, panel pastda */
@media (max-aspect-ratio: 1/1) {
  .stage { grid-template-columns: 1fr; height: auto; }
  .board-host { --size: min(94vw, 62vh); }
}

/* ===================== 1.3: yangi bo'limlar ===================== */
.board { touch-action: none; }
.board.counter .piece { background-image: none !important; }
.board.counter .piece::before { content: ""; position: absolute; inset: 0; background: var(--pc) center / 100% 100% no-repeat; rotate: var(--counter, 0deg); }
.board.counter.flipb .piece[data-c="b"]::before { rotate: calc(var(--counter, 0deg) + 180deg); }
.board-frame.rot .edge span { rotate: var(--counter, 0deg); }
.board-frame { transition: rotate .5s ease; }
.btn-review { background: linear-gradient(180deg, #5fd3e0, #19a7b8); color: #fff; box-shadow: 0 5px 0 #0f7f8d, var(--shadow-sm); }

/* kompyuter bilan o'yin: darajalar, debyut nomi, endshpil bazasi */
.level-box { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.level-box small { font-weight: 800; color: var(--ink-soft); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.play-info { background: #fff; border-radius: 14px; padding: 8px 12px; font-weight: 800; font-size: 14px; box-shadow: var(--shadow-sm); color: #5a4630; }
.play-info.tb { color: #0f6d48; background: #e8fbf2; }

/* ---------- ARENA: katta ekranda ikki kishilik o'yin ---------- */
body.arena-on .topbar { display: none; }
body.arena-on .screen { height: 100vh; }
#screen-play { position: relative; }
.arena-layer { display: none; }
#screen-play.arena .arena-layer { display: block; }
#screen-play.arena .stage { display: block; padding: 0; height: 100%; }
#screen-play.arena .stage-side { display: none; }
#screen-play.arena .stage-board { position: absolute; inset: 0; }
#screen-play.arena { overflow: hidden; background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.55), transparent 70%); }
.ap { position: absolute; z-index: 6; display: flex; flex-direction: column; gap: 10px; padding: 14px 18px; background: rgba(255,255,255,.94); border-radius: 24px;
  box-shadow: var(--shadow); border: 4px solid transparent; overflow: hidden; transition: border-color .25s, box-shadow .25s; font-size: clamp(15px, 1.5vmin, 22px); }
.ap.active { border-color: var(--blue); box-shadow: 0 0 0 6px rgba(61,139,255,.18), var(--shadow); }
.ap.winner { border-color: var(--yellow); box-shadow: 0 0 0 8px rgba(255,200,61,.35), var(--shadow); }
.ap-top { display: flex; align-items: center; gap: 10px; }
.ap-dot { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #9aa6bf; flex: none; }
.ap-dot.w { background: #fff; } .ap-dot.b { background: #222; }
.ap-name { flex: 1; min-width: 0; border: 0; border-bottom: 2px dashed #d5dbe8; background: transparent; font: inherit; font-weight: 900; font-size: 1.3em; color: var(--ink); padding: 2px 0; }
.ap-name:focus { outline: none; border-bottom-color: var(--blue); }
.ap-clock { font-variant-numeric: tabular-nums; font-size: 1.9em; font-weight: 900; }
.ap-clock:empty { display: none; }
.ap-clock.low { color: var(--red); animation: tpulse 1s infinite; }
.ap-cap { display: flex; align-items: center; flex-wrap: wrap; gap: 0; min-height: 1.6em; }
.ap-cap img { width: 1.7em; height: 1.7em; margin-right: -.45em; }
.ap-cap b { margin-left: .7em; color: #138a52; font-weight: 900; }
.ap-msg { font-weight: 900; font-size: 1.25em; color: var(--ink); line-height: 1.25; }
.ap.active .ap-msg { color: var(--blue); }
.ap-open { font-size: .8em; color: var(--ink-soft); font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-open:empty { display: none; }
.ap-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ap-row .btn { flex: 1 1 0; min-height: 54px; padding: 8px 10px; font-size: .95em; white-space: nowrap; }
.ap-row .btn:disabled { opacity: .45; }
.ap-ask { background: #fff7e0; border-radius: 16px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; animation: pop .3s; }
.ap-ask p { margin: 0; font-weight: 900; }
.ap.compact { padding: 10px 12px; gap: 6px; }
.ap.compact .ap-btns .btn span { display: none; }
.ap.compact .ap-row .btn { min-height: 46px; font-size: 1.1em; }
.arena-tools { position: absolute; z-index: 7; top: 12px; left: 12px; display: flex; gap: 8px; }
.arena-tools.col { flex-direction: column; top: 50%; transform: translateY(-50%); }
.arena-tools.right { left: auto; right: 12px; }
.arena-tools > button { width: 56px; height: 56px; border-radius: 18px; border: 0; background: rgba(255,255,255,.92); box-shadow: var(--shadow-sm); font-size: 24px; font-weight: 900; }
.arena-tools > button:active { transform: scale(.94); }
.arena-menu { position: absolute; top: 64px; left: 0; width: 380px; background: #fff; border-radius: 20px; padding: 14px; box-shadow: var(--shadow); display: grid; gap: 8px; }
.arena-tools.col .arena-menu { top: 0; left: 66px; }
.arena-tools.right .arena-menu { left: auto; right: 0; }
.arena-menu label { font-weight: 900; color: var(--ink-soft); }
.arena-menu .seg button { padding: 10px 4px; }

/* ---------- O'YIN TAHLILI ---------- */
.analysis { position: fixed; inset: 0; z-index: 65; background: rgba(20, 28, 48, .55); display: grid; place-items: center; padding: 14px; animation: screenIn .25s; }
.an-card { width: min(1400px, 100%); height: min(900px, 100%); background: #f7f9fd; border-radius: 26px; box-shadow: var(--shadow); display: flex; flex-direction: column; padding: 14px 18px; gap: 10px; }
.an-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.an-head h2 { margin: 0; font-weight: 900; }
.an-head .muted { margin: 2px 0 0; }
.an-body { flex: 1; min-height: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; }
.an-left { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.analysis .board-host { --size: min(calc(100vh - 220px), 46vw); }
.an-right { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.an-acc { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.an-acc:empty { display: none; }
.an-side { background: #fff; border-radius: 16px; padding: 10px 14px; box-shadow: var(--shadow-sm); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2px 10px; }
.an-side .an-pct { grid-row: span 2; font-size: 34px; font-weight: 900; color: var(--blue); }
.an-side .an-pct small { font-size: 16px; }
.an-side > small { grid-column: 2; color: var(--ink-soft); font-weight: 800; }
.an-cnt { grid-column: 1 / -1; display: flex; gap: 12px; font-weight: 900; font-size: 14px; }
.an-progress { position: relative; height: 26px; border-radius: 13px; background: #e6ebf5; overflow: hidden; flex: none; }
.an-progress i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, #6aa8ff, var(--blue)); transition: width .25s; }
.an-progress span { position: relative; display: block; text-align: center; font-weight: 900; font-size: 13px; line-height: 26px; color: #1f2a44; }
#an-graph { width: 100%; height: 90px; border-radius: 12px; cursor: pointer; flex: none; }
.an-comment { background: #fff; border-radius: 16px; padding: 10px 14px; box-shadow: var(--shadow-sm); display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: center; flex: none; }
.an-comment p { margin: 0; grid-column: 2; line-height: 1.4; }
.an-comment p.muted { margin: 0; }
.an-eval { grid-row: span 3; display: flex; flex-direction: column; align-items: center; background: #1f2a44; color: #fff; border-radius: 12px; padding: 6px 12px; min-width: 86px; }
.an-eval b { font-size: 24px; font-variant-numeric: tabular-nums; }
.an-eval small { font-size: 10px; opacity: .8; text-align: center; }
.an-moves { flex: 1; min-height: 0; overflow: auto; background: #fff; border-radius: 16px; box-shadow: var(--shadow-sm); padding: 8px; display: grid; grid-template-columns: 1fr 1fr; align-content: start; gap: 2px 10px; }
.an-row { display: grid; grid-template-columns: 34px 1fr 1fr; gap: 4px; align-items: center; }
.an-no { color: var(--ink-soft); font-weight: 800; text-align: right; }
.an-mv { border: 0; background: #f2f5fb; border-radius: 8px; padding: 4px 8px; font-weight: 900; text-align: left; }
.an-mv.now { outline: 3px solid var(--blue); }
.an-best { color: #128a52; } .an-good { color: var(--ink); } .an-inacc { color: #c99400; } .an-mistake { color: #e2770e; } .an-blunder { color: #e0283c; }
.an-mv.an-blunder { background: #ffe5e8; } .an-mv.an-mistake { background: #fff0dc; } .an-mv.an-inacc { background: #fff8d6; }

/* ---------- DEBYUTLAR ---------- */
.op-group h3 { font-weight: 900; margin: 18px 0 10px; }
.op-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.op-card { position: relative; text-align: left; border: 0; border-radius: var(--radius); background: #fff; padding: 14px 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 6px; animation: cardIn .4s backwards; transition: transform .15s; }
.op-card:hover { transform: translateY(-4px); }
.op-card b { font-size: 17px; font-weight: 900; padding-right: 48px; }
.op-card.trap { background: linear-gradient(135deg, #fff, #fff1f1); }
.op-card.due::after { content: "🔁"; position: absolute; top: 36px; right: 14px; font-size: 18px; }
.op-due { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: #fff7e6; border: 2px solid #ffc861; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; font-weight: 800; }
.op-eco { position: absolute; top: 12px; right: 14px; font-size: 12px; font-weight: 900; color: #fff; background: #8a5a33; padding: 2px 8px; border-radius: 8px; }
.op-moves { font-size: 13px; color: var(--ink-soft); font-weight: 800; min-height: 2.6em; }
.op-card .meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-soft); font-weight: 800; }
.op-card .stars span { color: #d8dde8; } .op-card .stars span.on { color: var(--yellow); }
.op-ideas { margin: 0; padding: 10px 14px 10px 30px; background: #fff; border-radius: 16px; box-shadow: var(--shadow-sm); line-height: 1.5; font-weight: 700; }
.op-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.op-chip { border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: 4px 9px; font-weight: 900; font-size: 14px; }
.op-chip.now { border-color: var(--blue); background: #eaf2ff; }
.op-chip.ok { border-color: var(--green); background: #e5f9ef; }
.op-chip.noted { position: relative; }
.op-chip.noted::after { content: ""; position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--orange, #ff9f1c); }
.op-step { min-width: 60px; text-align: center; font-weight: 900; align-self: center; color: var(--ink-soft); }

/* ---------- YUTUQLAR ---------- */
.ach-sum { display: flex; align-items: center; gap: 12px; font-weight: 800; margin-bottom: 16px; flex-wrap: wrap; }
.ach-sum b { font-size: 34px; font-weight: 900; color: var(--primary); }
.ach-sum .bar, .ach .bar { flex: 1 1 200px; height: 10px; background: #eef1f7; border-radius: 10px; overflow: hidden; display: block; }
.ach-sum .bar i, .ach .bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffc83d, var(--primary)); border-radius: 10px; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.ach { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; animation: cardIn .4s backwards; filter: grayscale(1); opacity: .7; }
.ach.on { filter: none; opacity: 1; background: linear-gradient(160deg, #fffbea, #fff); box-shadow: 0 0 0 3px #ffe08a, var(--shadow-sm); }
.ach .medal { font-size: 46px; width: 78px; height: 78px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #ffe9a8 60%, #f2b632); box-shadow: 0 6px 12px rgba(200, 140, 20, .25); }
.ach b { font-weight: 900; }
.ach p { margin: 0; font-size: 13px; color: var(--ink-soft); font-weight: 700; }
.ach small { font-weight: 800; color: var(--ink-soft); }
.ach .bar { width: 100%; flex: none; }
.ach-date { color: #128a52 !important; }
.ach-toast { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: flex; gap: 12px; align-items: center; background: #fff; border-radius: 20px; padding: 12px 18px 12px 12px;
  box-shadow: 0 0 0 3px #ffe08a, var(--shadow); max-width: 380px; transform: translateY(160%); transition: transform .45s cubic-bezier(.3, 1.4, .5, 1); }
.ach-toast.show { transform: none; }
.ach-toast .medal { font-size: 40px; width: 64px; height: 64px; flex: none; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #ffe9a8 60%, #f2b632); }
.ach-toast small { color: var(--primary); font-weight: 900; text-transform: uppercase; font-size: 12px; }
.ach-toast b { display: block; font-size: 18px; font-weight: 900; }
.ach-toast p { margin: 2px 0 0; font-size: 13px; color: var(--ink-soft); }

/* ---------- HISOBOT ---------- */
.page-head #report-print { margin-left: auto; flex: none; }
.rp-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.rp-head img { width: 64px; height: 64px; }
.rp-head h2 { margin: 0; font-weight: 900; }
.rp-head p { margin: 4px 0 0; color: var(--ink-soft); font-weight: 700; }
.rp-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin-bottom: 14px; }
.rp-kpi { background: #fff; border-radius: 18px; padding: 12px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; align-items: center; text-align: center; }
.rp-kpi span { font-size: 24px; }
.rp-kpi b { font-size: 22px; font-weight: 900; }
.rp-kpi small { color: var(--ink-soft); font-weight: 800; font-size: 12.5px; }
.rp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.rp-grid .card { margin: 0; }
.rp-grid h3 { margin: 0 0 10px; font-weight: 900; }
.rp-grid h4 { margin: 10px 0 6px; }
.rp-bar { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(60px, 1fr) 46px; gap: 10px; align-items: center; margin: 6px 0; font-weight: 800; font-size: 14px; }
.rp-bar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-bar i { height: 10px; background: #eef1f7; border-radius: 10px; overflow: hidden; display: block; }
.rp-bar i b { display: block; height: 100%; background: linear-gradient(90deg, #6aa8ff, var(--blue)); }
.rp-bar em { font-style: normal; text-align: right; }
.rp-chart { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 16px; }
.rp-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; min-width: 0; }
.rp-col i { width: 70%; background: linear-gradient(180deg, #ffb35c, var(--primary)); border-radius: 6px 6px 2px 2px; }
.rp-col em { font-style: normal; font-size: 10.5px; font-weight: 800; color: var(--ink-soft); white-space: nowrap; }
.rp-col small { font-size: 10.5px; font-weight: 800; color: var(--ink-soft); white-space: nowrap; }
.rp-games { display: flex; flex-wrap: wrap; gap: 8px 16px; font-weight: 800; margin: 6px 0; }
.rp-games .ok { color: #128a52; } .rp-games .bad { color: var(--red); }
.rp-rec ul { margin: 0; padding-left: 20px; line-height: 1.55; font-weight: 700; }
.rp-rec li { margin-bottom: 6px; }
.rp-foot { text-align: center; color: var(--ink-soft); font-size: 12px; margin-top: 16px; }
@media print {
  body.print-report > *:not(#screen-report) { display: none !important; }
  body.print-report #screen-report { display: block !important; height: auto !important; overflow: visible !important; animation: none; }
  body.print-report #cert-print-img { display: none !important; }
  body.print-report .no-print { display: none !important; }
  body.print-report .card, body.print-report .rp-kpi { box-shadow: none !important; border: 1px solid #dde3ee; break-inside: avoid; }
  body.print-report .page-wrap { max-width: none; padding: 0; }
  body.print-report { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* yangilanish xabari */
.update-bar { position: fixed; left: 50%; top: 78px; transform: translateX(-50%); z-index: 50; display: flex; gap: 12px; align-items: center; background: #fff; border-radius: 18px; padding: 10px 12px 10px 18px; box-shadow: 0 0 0 3px #b9d6ff, var(--shadow); font-weight: 900; }

@media (max-width: 1360px) {
  .topnav .nav-btn { padding: 8px 10px; }
}
@media (max-width: 1280px) {
  .nav-btn .lbl { display: none; }
}
@media (max-aspect-ratio: 1/1) {
  .an-body { grid-template-columns: 1fr; overflow: auto; }
  .analysis .board-host { --size: min(80vw, 50vh); }
}

/* vaqt nazorati (shaxmat soati) */
.tc-ctl { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tc-sel { width: 100%; font: inherit; font-weight: 800; padding: 8px 10px; border-radius: 12px; border: 2px solid var(--line); background: #fff; color: var(--ink); }
.tc-sel:focus { outline: none; border-color: var(--blue); }
.tc-custom { display: flex; gap: 8px; }
.tc-custom label { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.tc-custom input { width: 100%; font: inherit; font-weight: 900; padding: 6px 8px; border-radius: 10px; border: 2px solid var(--line); }
.arena-menu .tc-sel { padding: 12px; font-size: 17px; }
.ap-tc { font-size: .8em; font-weight: 800; color: var(--ink-soft); }
.ap-tc:empty { display: none; }
.ap-clock { padding: 2px 12px; border-radius: 12px; background: #eef2fa; }
.ap.active .ap-clock { background: var(--blue); color: #fff; }
.ap.active .ap-clock.low { background: var(--red); color: #fff; }
.player .clock { padding: 2px 8px; border-radius: 10px; }
.player.active .clock:not(:empty) { background: var(--blue); color: #fff; }
.player.active .clock.low { background: var(--red); color: #fff; }
#screen-play.paused .board { filter: blur(6px) grayscale(.4); transition: filter .3s; }
#screen-play.paused .stage-board::after { content: "⏸"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 120px; color: rgba(31, 42, 68, .75); pointer-events: none; }
.arena-tools.bottom { top: auto; bottom: 12px; }
.arena-tools.bottom .arena-menu { top: auto; bottom: 64px; }
.ap-cap:empty { display: none; }
.dialog { width: min(520px, 94vw); max-height: 94vh; overflow: auto; }
.dialog .scale-row { flex-direction: column; align-items: stretch; gap: 6px; }
.dialog .scale-row .seg button { padding: 8px 2px; font-size: 14px; }
.dialog .scale-info { margin: 0 0 6px; font-size: 13px; }
.brand-text b, .brand-text small { white-space: nowrap; }
.brand { flex: none; }
@media (max-width: 1500px) { .brand-text small { display: none; } }
@media (max-width: 1440px) { .nav-btn .lbl { display: none; } .topnav .nav-btn { padding: 9px 12px; } }
@media (max-width: 900px) { .brand-text { display: none; } }

/* ===== Yuqori panel o'z-o'zidan sig'adi (main.js fitTopbar): sig'masa bosqichma-bosqich ixchamlashadi ===== */
.topbar { overflow: hidden; }
.topbar > * { flex-shrink: 0; }
.topbar.tb-1 .nav-btn .lbl, .topbar.tb-1 .brand-text small { display: none; }
.topbar.tb-1 .topnav .nav-btn { padding: 8px 10px; }
.topbar.tb-2 .brand-text { display: none; }
.topbar.tb-2 { gap: 8px; padding: 0 10px; }
.topbar.tb-2 .topnav { gap: 5px; margin-left: 6px; }
.topbar.tb-2 .lang-toggle button { padding: 6px 9px; }
.topbar.tb-3 .topbar-stats { display: none; }
.topbar.tb-3 .lang-toggle button:not(.on) { display: none; }
.topbar.tb-3 .lang-toggle { cursor: pointer; }
.topbar.tb-3 .icon-btn { width: 36px; height: 36px; font-size: 16px; }
.topbar.tb-3 .topnav .nav-btn { padding: 7px 8px; }
.topbar.tb-3 .topbar-actions { margin-left: auto; gap: 6px; }

/* ===== Dastur haqida ===== */
.about-btn { width: 100%; margin-top: 10px; }
.about-dialog { width: min(720px, 94vw); max-height: 92vh; flex-direction: column; }
.about-dialog[open] { display: flex; }
.about-body { overflow: auto; line-height: 1.55; padding-right: 6px; }
.about-body h3 { margin: 16px 0 6px; font-weight: 900; color: var(--blue); }
.about-body ul, .about-body ol { margin: 0; padding-left: 22px; }
.about-body li { margin: 4px 0; }
.about-head { display: flex; align-items: center; gap: 14px; }
.about-head img { width: 64px; height: 64px; border-radius: 16px; }
.about-head b { display: block; font-size: 20px; font-weight: 900; }
.about-head small { color: var(--ink-soft); font-weight: 800; }
.about-lead { font-weight: 800; font-size: 17px; }
.about-copy { margin-top: 14px; }
