/* =========================================================
   Matematika Olami — bolalar uchun yorqin, yumaloq dizayn
   ========================================================= */
:root {
  --bg: #fff8ec;
  --ink: #2d2a4a;
  --soft: #6b6890;
  --card: #ffffff;
  --line: #ece6ff;
  --primary: #7b5cff;
  --primary-d: #5a3fe0;
  --ok: #2fb344;
  --ok-bg: #e6f9ea;
  --bad: #f03e3e;
  --bad-bg: #ffecec;
  --sun: #ffd43b;
  --accent: #7b5cff;
  --accent-d: #5a3fe0;
  --radius: 22px;
  --shadow: 0 8px 24px rgba(77, 52, 160, .10);
  --font-head: 'Baloo 2', 'Comic Sans MS', 'Trebuchet MS', system-ui, sans-serif;
  --font: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --u: 9px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--font); color: var(--ink); font-size: 17px; line-height: 1.5;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(255, 212, 59, .25) 0 120px, transparent 121px),
    radial-gradient(circle at 90% 10%, rgba(123, 92, 255, .14) 0 160px, transparent 161px),
    radial-gradient(circle at 85% 85%, rgba(81, 207, 102, .16) 0 140px, transparent 141px),
    radial-gradient(circle at 5% 90%, rgba(255, 107, 157, .14) 0 130px, transparent 131px);
  background-attachment: fixed;
}
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: clamp(28px, 5vw, 42px); }
h2 { font-size: clamp(24px, 4vw, 32px); }
h3 { font-size: 22px; }
a { color: var(--primary-d); }
button, input, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 18px 16px 40px; flex: 1; }
.loading { text-align: center; padding: 80px 0; font-size: 24px; font-family: var(--font-head); }
.noscript { position: fixed; inset: 0; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; padding: 30px; text-align: center; z-index: 999; }

/* Fon bezaklari */
.bg-deco { position: fixed; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }
.bg-deco span { position: absolute; font-size: 42px; opacity: .13; animation: floaty 9s ease-in-out infinite; }
.bg-deco span:nth-child(1) { top: 12%; left: 4%; }
.bg-deco span:nth-child(2) { top: 30%; right: 6%; animation-delay: 1s; }
.bg-deco span:nth-child(3) { bottom: 18%; left: 8%; animation-delay: 2s; }
.bg-deco span:nth-child(4) { top: 62%; right: 14%; animation-delay: 3s; }
.bg-deco span:nth-child(5) { top: 80%; left: 45%; animation-delay: 1.5s; }
.bg-deco span:nth-child(6) { top: 8%; left: 50%; animation-delay: 2.5s; }
.bg-deco span:nth-child(7) { top: 45%; left: 2%; animation-delay: .5s; }
.bg-deco span:nth-child(8) { bottom: 6%; right: 4%; animation-delay: 3.5s; }
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-18px) rotate(10deg); } }

/* ---------- Yuqori panel ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 3px solid var(--line);
}
.topbar-in { max-width: 1120px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 10px; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-family: var(--font-head); font-weight: 800; font-size: 22px; white-space: nowrap; }
.logo .owl { font-size: 32px; animation: wobble 4s ease-in-out infinite; display: inline-block; }
.logo b { color: var(--primary); }
@keyframes wobble { 0%, 90%, 100% { transform: rotate(0); } 93% { transform: rotate(-12deg); } 96% { transform: rotate(12deg); } }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a, .icon-btn {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--soft);
  font-weight: 800; padding: 8px 12px; border-radius: 14px; border: 0; background: transparent; font-size: 15px;
}
.nav a:hover, .icon-btn:hover { background: #f3efff; color: var(--primary-d); }
.nav a.active { background: var(--primary); color: #fff; }
.nav a .ni { font-size: 19px; }
.user-chip { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 30px; background: #f3efff; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 15px; }
.user-chip .av { width: 34px; height: 34px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 22px; }
@media (max-width: 860px) {
  .nav a .nt, .user-chip .nt { display: none; }
  .logo span.lt { display: none; }
}

/* ---------- Tugmalar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 18px; padding: 12px 22px; font-weight: 800; font-size: 18px;
  font-family: var(--font-head); text-decoration: none; transition: transform .1s, box-shadow .1s, filter .15s;
  background: #f1f0f7; color: var(--ink); box-shadow: 0 5px 0 #d8d5e8;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #d8d5e8; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 5px 0 var(--primary-d); }
.btn-primary:active { box-shadow: 0 1px 0 var(--primary-d); }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 5px 0 var(--accent-d); }
.btn-ok { background: var(--ok); color: #fff; box-shadow: 0 5px 0 #237a33; }
.btn-danger { background: var(--bad); color: #fff; box-shadow: 0 5px 0 #c92a2a; }
.btn-sm { padding: 7px 14px; font-size: 15px; border-radius: 13px; box-shadow: 0 3px 0 #d8d5e8; }
.btn-sm.btn-primary { box-shadow: 0 3px 0 var(--primary-d); }
.btn-sm.btn-danger { box-shadow: 0 3px 0 #c92a2a; }
.btn-lg { padding: 16px 30px; font-size: 22px; }
.btn-ghost { background: transparent; box-shadow: none; color: var(--soft); }
.btn-ghost:active { box-shadow: none; }

/* ---------- Kartalar ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; border: 2px solid var(--line); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid-topics { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.muted { color: var(--soft); }
.center { text-align: center; }
.mt { margin-top: 18px; }
.row-flex { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

/* ---------- Kirish / ro‘yxatdan o‘tish ---------- */
.auth-wrap { display: grid; grid-template-columns: 1.05fr 1fr; gap: 26px; align-items: center; min-height: calc(100vh - 140px); }
.auth-hero h1 span { color: var(--primary); }
.auth-hero .hero-owl { font-size: 110px; line-height: 1; display: inline-block; animation: bounce 2.4s ease-in-out infinite; }
.hero-feats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.hero-feats div { background: #fff; border-radius: 16px; padding: 10px 14px; font-weight: 700; border: 2px solid var(--line); font-size: 15px; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
.tabs { display: flex; background: #f3efff; padding: 5px; border-radius: 18px; margin-bottom: 18px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 11px; border-radius: 14px; font-weight: 800; color: var(--soft); font-family: var(--font-head); font-size: 18px; }
.tabs button.on { background: #fff; color: var(--primary-d); box-shadow: 0 3px 10px rgba(0, 0, 0, .07); }
.field { margin-bottom: 13px; }
.field label { display: block; font-weight: 800; margin-bottom: 5px; font-size: 15px; }
.field input, .field select, .inp {
  width: 100%; padding: 12px 15px; border-radius: 15px; border: 3px solid var(--line); background: #fbfaff;
  outline: none; transition: border-color .15s; color: var(--ink);
}
.field input:focus, .field select:focus, .inp:focus { border-color: var(--primary); background: #fff; }
.field.err input { border-color: var(--bad); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-msg { min-height: 24px; font-weight: 800; color: var(--bad); margin: 4px 0 10px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }
.grade-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grade-pick button { border: 3px solid var(--line); background: #fff; border-radius: 16px; padding: 8px 4px; font-weight: 800; font-family: var(--font-head); font-size: 17px; }
.grade-pick button .gi { display: block; font-size: 26px; }
.grade-pick button.on { border-color: var(--gc); background: var(--gc); color: #fff; transform: scale(1.04); }
.avatar-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-pick button { width: 46px; height: 46px; border-radius: 50%; border: 3px solid transparent; background: #f6f4ff; font-size: 25px; padding: 0; transition: transform .15s; }
.avatar-pick button.on { border-color: var(--primary); background: #fff; transform: scale(1.12); }

/* ---------- Bosh sahifa ---------- */
.hello { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.hello .big-av { width: 84px; height: 84px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 52px; box-shadow: var(--shadow); border: 4px solid var(--sun); }
.bubble { position: relative; background: #fff; border-radius: 22px; padding: 14px 20px; box-shadow: var(--shadow); font-weight: 700; flex: 1; min-width: 240px; border: 2px solid var(--line); }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat { background: #fff; border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center; border: 2px solid var(--line); }
.stat .si { font-size: 32px; }
.stat b { display: block; font-size: 26px; font-family: var(--font-head); line-height: 1; }
.stat small { color: var(--soft); font-weight: 700; }
.grade-card {
  position: relative; border-radius: 28px; padding: 22px; color: #fff; text-decoration: none; overflow: hidden;
  background: linear-gradient(145deg, var(--gc), var(--gd)); box-shadow: 0 8px 0 var(--gd), var(--shadow);
  transition: transform .15s; display: flex; flex-direction: column; min-height: 210px;
}
.grade-card:hover { transform: translateY(-5px) rotate(-.5deg); }
.grade-card .gi { font-size: 58px; line-height: 1; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .15)); }
.grade-card h3 { font-size: 30px; margin: 8px 0 4px; }
.grade-card p { margin: 0; opacity: .95; font-weight: 700; font-size: 15px; flex: 1; }
.grade-card .gprog { margin-top: 12px; background: rgba(255, 255, 255, .3); border-radius: 10px; height: 10px; overflow: hidden; }
.grade-card .gprog span { display: block; height: 100%; background: #fff; border-radius: 10px; }
.grade-card .badge-mine { position: absolute; top: 14px; right: 14px; background: #fff; color: var(--gd); font-weight: 800; padding: 3px 11px; border-radius: 20px; font-size: 13px; }
.grade-card::after { content: ''; position: absolute; right: -40px; bottom: -40px; width: 140px; height: 140px; border-radius: 50%; background: rgba(255, 255, 255, .15); }
.section-title { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; }

/* ---------- Mavzular ---------- */
.grade-head { border-radius: 28px; padding: 22px 26px; color: #fff; background: linear-gradient(135deg, var(--gc), var(--gd)); display: flex; align-items: center; gap: 18px; margin-bottom: 22px; box-shadow: var(--shadow); flex-wrap: wrap; }
.grade-head .gi { font-size: 64px; }
.grade-head h1 { margin: 0; }
.grade-head p { margin: 0; font-weight: 700; opacity: .95; }
.back { color: inherit; text-decoration: none; font-weight: 800; display: inline-flex; align-items: center; gap: 5px; margin-bottom: 10px; }
.topic-card {
  background: #fff; border-radius: 24px; padding: 18px; border: 3px solid var(--line); text-align: left; cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s; display: flex; flex-direction: column; gap: 6px; font-family: var(--font);
  color: var(--ink); box-shadow: 0 5px 0 var(--line);
}
.topic-card:hover { transform: translateY(-4px); border-color: var(--gc); box-shadow: 0 9px 0 var(--gc); }
.topic-card .ti { font-size: 40px; width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: color-mix(in srgb, var(--gc) 16%, #fff); }
.topic-card h3 { margin: 4px 0 0; font-size: 21px; }
.topic-card p { margin: 0; color: var(--soft); font-size: 15px; font-weight: 600; flex: 1; }
.topic-card .tfoot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-weight: 800; font-size: 14px; }
.stars { color: #fab005; letter-spacing: 2px; font-size: 19px; }
.stars .off { color: #e3e0ef; }
.topic-card.mix { background: linear-gradient(135deg, #fff9db, #fff); border-color: #ffd43b; box-shadow: 0 5px 0 #ffd43b; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-weight: 800; font-size: 13px; background: #f3efff; color: var(--primary-d); }
.pill.ok { background: var(--ok-bg); color: #237a33; }
.pill.warn { background: #fff4e6; color: #d9480f; }
.pill.bad { background: var(--bad-bg); color: #c92a2a; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(45, 42, 74, .45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .2s; }
.modal-box { background: #fff; border-radius: 28px; padding: 26px; max-width: 640px; width: 100%; max-height: 92vh; overflow: auto; position: relative; animation: pop .25s; }
.modal-close { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #f3efff; font-size: 18px; font-weight: 800; color: var(--soft); }
.lesson-box { background: #f8f6ff; border-radius: 18px; padding: 6px 18px; margin: 12px 0; border-left: 6px solid var(--gc, var(--primary)); }
.lesson-example { border: 3px dashed var(--line); border-radius: 18px; padding: 12px; margin: 12px 0; }
.lesson-example .ex-q { font-weight: 800; text-align: center; margin-bottom: 6px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }

/* ---------- Test oynasi ---------- */
.quiz { max-width: 860px; margin: 0 auto; }
.quiz-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.quiz-title { font-family: var(--font-head); font-weight: 800; font-size: 21px; flex: 1; text-align: center; }
.quiz-count { font-family: var(--font-head); font-weight: 800; background: var(--accent); color: #fff; padding: 4px 14px; border-radius: 20px; }
.progress { display: flex; gap: 5px; margin-bottom: 16px; }
.progress span { flex: 1; height: 12px; border-radius: 8px; background: #e9e5f7; transition: background .3s; }
.progress span.cur { background: var(--accent); animation: pulse 1.2s infinite; }
.progress span.ok { background: var(--ok); }
.progress span.bad { background: var(--bad); }
@keyframes pulse { 50% { opacity: .5; } }
.q-card { padding: 22px; }
.q-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.q-head .mascot { font-size: 46px; line-height: 1; animation: bounce 2.4s ease-in-out infinite; }
.q-text { flex: 1; font-family: var(--font-head); font-size: clamp(21px, 3.6vw, 28px); font-weight: 700; background: #f8f6ff; padding: 12px 18px; border-radius: 4px 20px 20px 20px; }
.q-sub { font-size: 14px; color: var(--soft); font-weight: 700; margin-bottom: 2px; font-family: var(--font); }
.speak { border: 0; background: #fff4e6; width: 50px; height: 50px; border-radius: 50%; font-size: 24px; flex-shrink: 0; }
.speak:hover { background: #ffe8cc; }
.q-visual { min-height: 120px; display: flex; align-items: center; justify-content: center; padding: 14px 0; overflow-x: auto; }
.answers { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-top: 8px; }
.answers.two { grid-template-columns: 1fr 1fr; }
.answers.three { grid-template-columns: repeat(3, 1fr); }
.ans {
  border: 0; border-radius: 20px; padding: 16px 10px; font-family: var(--font-head); font-weight: 800; font-size: clamp(22px, 4vw, 30px);
  color: #fff; transition: transform .12s, box-shadow .12s, opacity .2s; min-height: 72px; position: relative;
}
.ans:nth-child(4n+1) { background: #ff6b9d; box-shadow: 0 6px 0 #d6336c; }
.ans:nth-child(4n+2) { background: #339af0; box-shadow: 0 6px 0 #1971c2; }
.ans:nth-child(4n+3) { background: #ff9f43; box-shadow: 0 6px 0 #e8590c; }
.ans:nth-child(4n+4) { background: #40c057; box-shadow: 0 6px 0 #2b8a3e; }
.ans:hover:not(:disabled) { transform: translateY(-3px); }
.ans:active:not(:disabled) { transform: translateY(5px); box-shadow: none; }
.ans .kbd { position: absolute; top: 6px; left: 10px; font-size: 12px; opacity: .7; font-family: var(--font); }
.ans:disabled { cursor: default; }
.ans.dim { opacity: .35; }
.ans.right { background: var(--ok) !important; box-shadow: 0 6px 0 #237a33 !important; animation: tada .6s; opacity: 1; }
.ans.wrong { background: var(--bad) !important; box-shadow: 0 6px 0 #c92a2a !important; animation: shake .45s; opacity: 1; }
@keyframes tada { 30% { transform: scale(1.1) rotate(-3deg); } 60% { transform: scale(1.08) rotate(3deg); } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.num-display { margin: 6px auto 12px; max-width: 260px; min-height: 70px; border-radius: 20px; border: 4px dashed var(--accent); background: #fff; font-family: var(--font-head); font-size: 42px; font-weight: 800; display: flex; align-items: center; justify-content: center; letter-spacing: 2px; }
.num-display .ph { color: #d0cbe6; }
.num-display.right { border: 4px solid var(--ok); background: var(--ok-bg); color: #237a33; }
.num-display.wrong { border: 4px solid var(--bad); background: var(--bad-bg); color: #c92a2a; animation: shake .45s; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; max-width: 330px; margin: 0 auto; }
.keypad button { border: 0; border-radius: 16px; padding: 12px; font-family: var(--font-head); font-size: 26px; font-weight: 800; background: #f3efff; color: var(--ink); box-shadow: 0 4px 0 #ddd6fb; }
.keypad button:active { transform: translateY(3px); box-shadow: none; }
.keypad .k-ok { background: var(--ok); color: #fff; box-shadow: 0 4px 0 #237a33; }
.keypad .k-del { background: #ffe3e3; color: #c92a2a; box-shadow: 0 4px 0 #ffc9c9; }

.order-slots, .order-pool { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 8px 0 14px; }
.slot { width: 76px; height: 66px; border-radius: 16px; border: 3px dashed #cfc8ee; display: grid; place-items: center; font-family: var(--font-head); font-size: 28px; font-weight: 800; cursor: pointer; background: #fbfaff; }
.slot.filled { border-style: solid; border-color: var(--accent); background: #fff; animation: pop .2s; }
.slot.right { border-color: var(--ok); background: var(--ok-bg); }
.slot.wrong { border-color: var(--bad); background: var(--bad-bg); }
.ord-card { width: 76px; height: 66px; border: 0; border-radius: 16px; font-family: var(--font-head); font-size: 28px; font-weight: 800; color: #fff; background: var(--accent); box-shadow: 0 5px 0 var(--accent-d); }
.ord-card.used { visibility: hidden; }
.order-actions { text-align: center; }

.feedback { margin-top: 18px; border-radius: 20px; padding: 14px 18px; display: none; align-items: center; gap: 14px; flex-wrap: wrap; animation: pop .25s; }
.feedback.show { display: flex; }
.feedback.ok { background: var(--ok-bg); border: 3px solid #b2f2bb; }
.feedback.bad { background: var(--bad-bg); border: 3px solid #ffc9c9; }
.feedback .fb-emoji { font-size: 44px; }
.feedback .fb-text { flex: 1; min-width: 200px; }
.feedback .fb-title { font-family: var(--font-head); font-size: 25px; font-weight: 800; line-height: 1.1; }
.feedback.ok .fb-title { color: #237a33; }
.feedback.bad .fb-title { color: #c92a2a; }
.feedback .fb-hint { font-weight: 700; font-size: 16px; }
.star-fly { position: fixed; font-size: 42px; pointer-events: none; z-index: 120; animation: starfly 1s ease-in forwards; }
@keyframes starfly { 0% { transform: scale(.4); opacity: 0; } 30% { transform: scale(1.4); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(.5); opacity: 0; } }

/* ---------- Vizual elementlar ---------- */
.vis-row { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.vis-col { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.vbox { background: #fbfaff; border: 3px solid var(--line); border-radius: 20px; padding: 10px 14px; display: flex; flex-direction: column; align-items: center; min-width: 120px; }
.vbox-lbl { font-family: var(--font-head); font-size: 30px; font-weight: 800; color: var(--accent-d); }
.op-sign { font-family: var(--font-head); font-size: 44px; font-weight: 800; color: var(--accent); min-width: 34px; text-align: center; }
.qmark { display: inline-grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: var(--sun); font-family: var(--font-head); font-weight: 800; font-size: 36px; animation: pulse 1.4s infinite; }
.expr { font-family: var(--font-head); font-size: clamp(28px, 5vw, 40px); font-weight: 800; background: #fff9db; border: 3px solid #ffe066; border-radius: 18px; padding: 6px 22px; color: #5c4600; }
.big-emoji { font-size: 80px; line-height: 1; animation: bounce 2s ease-in-out infinite; }
.cap { font-weight: 800; color: var(--soft); }
.emo-group { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 520px; }
.emo { font-size: clamp(32px, 6vw, 46px); line-height: 1; display: inline-block; animation: popIn .4s backwards; position: relative; }
.emo-group.sm { max-width: 230px; }
.emo-group.sm .emo { font-size: clamp(24px, 4.4vw, 32px); }
.emo-group.count .emo { padding: 2px; }
.emo.crossed { opacity: .4; }
.emo.crossed::after { content: ''; position: absolute; left: -2px; right: -2px; top: 50%; height: 4px; background: var(--bad); border-radius: 2px; transform: rotate(-35deg); }
@keyframes popIn { from { transform: scale(0) rotate(-30deg); opacity: 0; } }
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1; margin: 0 4px; font-weight: 800; }
.frac span:first-child { border-bottom: 3px solid currentColor; padding: 0 4px 2px; }
.frac span:last-child { padding-top: 2px; }

.clock { width: min(250px, 70vw); }
.clock-rim { fill: #ff8787; }
.clock-face { fill: #fff; }
.tick { stroke: #adb5bd; stroke-width: 2; }
.tick-big { stroke: #495057; stroke-width: 4; stroke-linecap: round; }
.clock-num { font-family: var(--font-head); font-weight: 800; font-size: 20px; fill: var(--ink); }
.hand-h { stroke: #2d2a4a; stroke-width: 9; stroke-linecap: round; }
.hand-m { stroke: #339af0; stroke-width: 5; stroke-linecap: round; }
.clock-pin { fill: #f03e3e; }
.shape-svg { width: min(200px, 55vw); filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .12)); animation: popIn .5s; }
.shape-svg > * { stroke: rgba(0, 0, 0, .2); stroke-width: 3; }
.pie { width: min(220px, 60vw); }
.pie-slice { stroke: #495057; stroke-width: 2.5; animation: popIn .4s backwards; transform-origin: 80px 80px; }
.fbar-wrap { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 520px; }
.fbar { flex: 1; display: flex; height: 54px; border: 3px solid #5c3d2e; border-radius: 10px; overflow: hidden; background: #fff; }
.fbar span { flex: 1; border-right: 3px solid #5c3d2e; transition: background .3s; }
.fbar span:last-child { border-right: 0; }
.fbar-lbl { font-family: var(--font-head); font-weight: 800; font-size: 28px; min-width: 60px; }
.nline { width: 100%; max-width: 640px; }
.nl-axis { stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.nl-tick { stroke: var(--ink); stroke-width: 2; }
.nl-num { font-family: var(--font-head); font-weight: 700; font-size: 17px; fill: var(--soft); }
.nl-strong { fill: var(--primary-d); font-size: 20px; font-weight: 800; }
.nl-jump { fill: none; stroke: #e8590c; stroke-width: 4; stroke-dasharray: 600; animation: draw 1.4s ease-out; }
.nl-jlbl { font-family: var(--font-head); font-weight: 800; font-size: 22px; fill: #e8590c; }
.nl-dot { fill: var(--primary); }
.nl-q { fill: var(--sun); }
.nl-qt { font-family: var(--font-head); font-weight: 800; font-size: 18px; fill: var(--ink); }
@keyframes draw { from { stroke-dashoffset: 600; } to { stroke-dashoffset: 0; } }
.seq { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.seq-cell { min-width: 62px; height: 62px; padding: 0 8px; border-radius: 16px; background: #fff; border: 3px solid var(--line); display: grid; place-items: center; font-family: var(--font-head); font-size: 30px; font-weight: 800; animation: popIn .4s backwards; }
.seq-cell.miss { background: var(--sun); border-color: #fab005; animation: popIn .4s backwards, pulse 1.4s infinite; }
.emoji-seq .seq-cell { font-size: 34px; }
.dot-array { display: grid; gap: 7px; justify-content: center; }
.dot { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffa8c5, #e64980); animation: popIn .35s backwards; }
.bt { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; justify-content: center; max-width: 560px; }
.bt-grp { display: flex; gap: 5px; flex-wrap: wrap; align-items: flex-end; max-width: calc(var(--u) * 33); }
.bt-h { width: calc(var(--u) * 10); height: calc(var(--u) * 10); background-color: #ffd43b; background-image: linear-gradient(to right, rgba(92, 70, 0, .35) 1px, transparent 1px), linear-gradient(to bottom, rgba(92, 70, 0, .35) 1px, transparent 1px); background-size: var(--u) var(--u); box-shadow: 0 0 0 2px #e8a700; border-radius: 2px; animation: popIn .4s backwards; }
.bt-t { width: var(--u); height: calc(var(--u) * 10); background-color: #74c0fc; background-image: linear-gradient(to bottom, rgba(0, 50, 100, .4) 1px, transparent 1px); background-size: var(--u) var(--u); box-shadow: 0 0 0 2px #1c7ed6; border-radius: 2px; animation: popIn .4s backwards; }
.bt-ones { display: grid; grid-template-rows: repeat(5, var(--u)); grid-auto-flow: column; gap: 5px; }
.bt-o { width: var(--u); height: var(--u); background: #ff8787; box-shadow: 0 0 0 2px #e03131; border-radius: 2px; animation: popIn .4s backwards; }
.ruler { width: 100%; max-width: 560px; }
.ruler-body { fill: #ffe066; stroke: #e8a700; stroke-width: 2; }
.r-tick { stroke: #5c4600; stroke-width: 1.5; }
.r-num { font-family: var(--font-head); font-weight: 800; font-size: 15px; fill: #5c4600; }
.r-unit { font-family: var(--font-head); font-weight: 800; font-size: 13px; fill: #5c4600; }
.guide { stroke: #f03e3e; stroke-width: 2; stroke-dasharray: 4 3; }
.pencil { animation: slideIn .8s ease-out; }
@keyframes slideIn { from { transform: translateX(-60px); opacity: 0; } }
.rectfig { width: 100%; }
.rf-body { fill: #d3f9d8; }
.rf-grid { stroke: #8ce99a; stroke-width: 1.5; }
.rf-border { fill: none; stroke: #2b8a3e; stroke-width: 4; stroke-dasharray: 2000; animation: draw2 1.5s ease-out; }
@keyframes draw2 { from { stroke-dashoffset: 2000; } to { stroke-dashoffset: 0; } }
.rf-lbl { font-family: var(--font-head); font-weight: 800; font-size: 18px; fill: var(--ink); }
.rf-soft { fill: var(--soft); }
.balance { width: min(400px, 100%); }
.bl-stand { fill: #845ef7; }
.bl-beam { stroke: #5f3dc4; stroke-width: 8; stroke-linecap: round; }
.bl-pin { fill: #ffd43b; stroke: #5f3dc4; stroke-width: 3; }
.bl-str { stroke: #868e96; stroke-width: 2; }
.bl-pan { fill: #ced4da; stroke: #868e96; stroke-width: 2; }
.bl-box { fill: #fff3bf; stroke: #fab005; stroke-width: 3; }
.bl-box2 { fill: #d0ebff; stroke: #339af0; }
.bl-txt { font-family: var(--font-head); font-weight: 800; font-size: 22px; fill: var(--ink); }
.road-wrap { width: 100%; max-width: 600px; }
.road-info { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 12px; }
.chip { background: #f3efff; border-radius: 14px; padding: 6px 12px; font-weight: 700; }
.chip b { color: var(--primary-d); font-family: var(--font-head); font-size: 19px; }
.road { position: relative; height: 90px; background: #495057; border-radius: 16px; overflow: hidden; border-top: 8px solid #8ce99a; border-bottom: 8px solid #8ce99a; }
.road-line { position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; background: repeating-linear-gradient(90deg, #fff 0 26px, transparent 26px 50px); }
.car { position: absolute; top: 14px; left: 30px; font-size: 44px; z-index: 2; animation: drive 3.2s ease-in-out infinite; }
.road-start { position: absolute; left: 4px; top: 22px; font-size: 32px; z-index: 1; }
.flag { position: absolute; right: 8px; top: 18px; font-size: 38px; z-index: 1; }
@keyframes drive { 0% { left: 30px; transform: scaleX(-1); } 80%, 100% { left: calc(100% - 100px); transform: scaleX(-1); } }
.pt-num { font-family: var(--font-head); font-size: clamp(32px, 6vw, 46px); font-weight: 800; text-align: center; color: var(--primary-d); letter-spacing: 2px; }
.pt { overflow-x: auto; max-width: 100%; }
.pt table { border-collapse: separate; border-spacing: 4px; margin: 6px auto 0; }
.pt th { background: #e7f5ff; color: #1864ab; font-size: 13px; padding: 6px 8px; border-radius: 10px; min-width: 64px; }
.pt th.th-k { background: #fff4e6; color: #d9480f; }
.pt td { height: 52px; min-width: 64px; border: 3px solid var(--line); border-radius: 12px; text-align: center; font-family: var(--font-head); font-size: 28px; font-weight: 800; background: #fff; }
.pt .hl { background: var(--sun) !important; color: var(--ink) !important; border-color: #fab005; }
.pt-cap { text-align: center; color: var(--soft); font-size: 13px; font-weight: 700; margin-top: 4px; }
.am { display: flex; align-items: stretch; gap: 8px; width: 100%; max-width: 520px; }
.am-left { display: grid; place-items: center; font-family: var(--font-head); font-size: 28px; font-weight: 800; color: #c2255c; padding-top: 34px; min-width: 30px; }
.am-main { flex: 1; display: flex; flex-direction: column; }
.am-top { display: flex; gap: 6px; margin-bottom: 6px; }
.am-top span { text-align: center; font-family: var(--font-head); font-size: 26px; font-weight: 800; color: #1971c2; min-width: 70px; }
.am-row { display: flex; gap: 6px; }
.am-box { min-width: 70px; height: 120px; border-radius: 14px; display: grid; place-items: center; font-family: var(--font-head); font-size: 22px; font-weight: 800; animation: popIn .5s backwards; }
.am-box.a1 { background: #d0ebff; border: 3px solid #339af0; }
.am-box.a2 { background: #ffdeeb; border: 3px solid #e64980; animation-delay: .25s; }
.groups { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.plate { background: radial-gradient(circle, #fff 55%, #e9ecef 56%, #f8f9fa 70%); border: 3px solid #dee2e6; border-radius: 50%; width: 132px; height: 132px; display: grid; place-items: center; padding: 18px; animation: popIn .4s backwards; }
.plate .emo-group.sm { max-width: 96px; gap: 2px; }
.plate .emo { font-size: 24px !important; }
.share { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.share-arrow { font-size: 30px; animation: bounce 1.5s infinite; }
.share-kids { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.kid { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.kid-face { font-size: 44px; line-height: 1; }
.kid-plate { width: 54px; height: 32px; border-radius: 50%; background: #f1f3f5; border: 3px solid #ced4da; display: grid; place-items: center; font-weight: 800; color: var(--soft); }
.pile-big { font-family: var(--font-head); font-size: 28px; font-weight: 700; background: #fff0f6; border-radius: 18px; padding: 8px 18px; }
.pairs { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; max-width: 560px; }
.pair { display: flex; gap: 2px; padding: 6px 8px; border-radius: 16px; border: 3px solid #b197fc; background: #f3f0ff; font-size: 32px; animation: popIn .4s backwards; }
.pair.single { border-style: dashed; border-color: #ffa94d; background: #fff4e6; }

/* ---------- Natija ---------- */
.result-card { max-width: 720px; margin: 0 auto; text-align: center; }
.big-stars { font-size: 64px; letter-spacing: 6px; margin: 8px 0; }
.big-stars span { display: inline-block; animation: starIn .6s backwards; }
.big-stars span.off { filter: grayscale(1); opacity: .3; }
@keyframes starIn { from { transform: scale(0) rotate(-180deg); } }
.ring { width: 170px; height: 170px; border-radius: 50%; margin: 10px auto; display: grid; place-items: center; background: conic-gradient(var(--rc) calc(var(--p) * 1%), #ece9f7 0); }
.ring div { width: 132px; height: 132px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-family: var(--font-head); font-size: 42px; font-weight: 800; }
.res-meta { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
.review { text-align: left; margin-top: 18px; }
.review-item { padding: 10px 14px; border-radius: 14px; background: #fff5f5; margin-bottom: 8px; border-left: 5px solid var(--bad); font-weight: 600; }
.review-item b { color: #237a33; }

/* ---------- Jadvallar ---------- */
.table-wrap { overflow-x: auto; border-radius: 16px; border: 2px solid var(--line); background: #fff; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { background: #f6f4ff; text-align: left; padding: 10px 12px; font-weight: 800; white-space: nowrap; color: var(--soft); }
.tbl td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tr:hover td { background: #fcfbff; }
.tbl tr.me td { background: #fff9db; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 34px; color: var(--soft); font-weight: 700; }
.empty .ee { font-size: 54px; display: block; }

/* ---------- Statistika / nishonlar ---------- */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.badge { text-align: center; padding: 14px 8px; border-radius: 20px; background: #fff; border: 3px solid var(--line); }
.badge .be { font-size: 40px; display: block; }
.badge b { display: block; font-size: 15px; }
.badge small { color: var(--soft); font-weight: 600; font-size: 12px; }
.badge.lock { filter: grayscale(1); opacity: .45; }
.chart-box { width: 100%; }
.chart-box canvas { display: block; }
.leader-top { display: flex; justify-content: center; align-items: flex-end; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.podium { text-align: center; background: #fff; border-radius: 22px 22px 8px 8px; padding: 14px 10px; width: 150px; box-shadow: var(--shadow); border: 3px solid var(--line); }
.podium .pa { font-size: 46px; }
.podium .pm { font-size: 30px; }
.podium.p1 { min-height: 200px; border-color: #fcc419; background: #fff9db; }
.podium.p2 { min-height: 170px; border-color: #ced4da; }
.podium.p3 { min-height: 150px; border-color: #ffc078; }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filter-bar .field { margin: 0; min-width: 140px; }
.filter-bar .field input, .filter-bar .field select { padding: 9px 12px; }
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-tabs a { text-decoration: none; padding: 10px 16px; border-radius: 15px; background: #fff; font-weight: 800; color: var(--soft); border: 2px solid var(--line); }
.admin-tabs a.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.warn-box { background: #fff4e6; border: 3px solid #ffd8a8; border-radius: 18px; padding: 12px 16px; font-weight: 700; margin-bottom: 16px; }
.info-box { background: #e7f5ff; border: 3px solid #a5d8ff; border-radius: 18px; padding: 12px 16px; font-weight: 600; margin-bottom: 16px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kv div { background: #f8f6ff; border-radius: 14px; padding: 10px 12px; }
.kv small { display: block; color: var(--soft); font-weight: 700; }
.kv b { font-family: var(--font-head); font-size: 22px; }

/* ---------- Toast va pastki qism ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 160%); visibility: hidden; background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 18px; font-weight: 800; z-index: 200; transition: transform .3s; max-width: 92vw; text-align: center; }
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.toast.ok { background: var(--ok); }
.toast.bad { background: var(--bad); }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 150; width: 100%; height: 100%; }
.footer { text-align: center; color: var(--soft); font-size: 14px; padding: 18px 16px 24px; }
.footer p { margin: 0; }
.prose { max-width: 820px; }
.prose p, .prose li { font-size: 17px; }

/* ---------- Moslashuvchan ---------- */
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; min-height: 0; }
  .auth-hero { text-align: center; }
  .auth-hero .hero-owl { font-size: 80px; }
  .hero-feats { display: none; }
}
@media (max-width: 560px) {
  :root { --u: 7px; }
  body { font-size: 16px; }
  .card { padding: 16px; }
  .q-card { padding: 14px; }
  .q-head .mascot { display: none; }
  .field-row { grid-template-columns: 1fr; }
  .answers { grid-template-columns: 1fr 1fr; }
  .answers.three { grid-template-columns: repeat(3, 1fr); }
  .slot, .ord-card { width: 58px; height: 54px; font-size: 22px; }
  .plate { width: 108px; height: 108px; padding: 12px; }
  .plate .emo { font-size: 19px !important; }
  .podium { width: 30%; padding: 10px 4px; }
  .grade-card { min-height: 170px; }
  .topbar-in { gap: 4px; padding: 6px 10px; }
  .nav a, .icon-btn { padding: 7px 8px; }
  .logo { font-size: 19px; }
  .modal-box { padding: 20px 16px; }
  .dot { width: 20px; height: 20px; }
  .tbl { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
@media print {
  .topbar, .footer, .bg-deco, .btn, .filter-bar, .admin-tabs { display: none !important; }
  body { background: #fff; }
}
