/* Tuzoq — to'liq ekranli canvas ustidagi sokin interfeys: kit ranglari, bitta urg'u (dunyo rangi), katta sensor tugmalar, safe-area. */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { position: fixed; inset: 0; touch-action: none; -webkit-user-select: none; user-select: none; background: var(--bg); }
#cv { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
/* sensor tugmalar ikkala mavzuda bir xil: tugmalar ko'pincha qorong'i yer ustida, ba'zan yorug' osmonda — shaffof qora doira + oq belgi ikkalasida ham o'qiladi */
:root { --wacc: var(--acc); --ink: var(--acc-ink); --glass: rgba(11,13,18,.62); --glass2: rgba(11,13,18,.82); --pb: rgba(8,10,14,.3); --pbl: rgba(255,255,255,.3); --pbf: rgba(255,255,255,.9); }
:root[data-theme="light"] { --glass: rgba(250,248,244,.7); --glass2: rgba(250,248,244,.9); }
body[data-mode="play"] .gu-toast { bottom: calc(118px + env(safe-area-inset-bottom)); }
#splash { position: fixed; inset: 0; display: grid; place-content: center; gap: 14px; justify-items: center; background: var(--bg); color: var(--fg); z-index: 50; }
#splash b { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
#splash i { width: 120px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--acc), transparent); background-size: 200% 100%; animation: sp 1.1s linear infinite; }
@keyframes sp { from { background-position: 100% 0; } to { background-position: -100% 0; } }
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#ui > * { pointer-events: auto; }
.scr { position: absolute; inset: 0; }

/* yumaloq tugma (yuqori qatorlar) */
.rb { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 13px; background: var(--glass); color: var(--fg); cursor: pointer; text-decoration: none; font-weight: 700; font-size: 13px; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.rb svg { width: 21px; height: 21px; }
.rb:hover { background: var(--glass2); }
.m-top { display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); position: relative; }
.m-top .sp { flex: 1; }
.m-top h2 { margin: 0 0 0 4px; font-size: 19px; font-weight: 800; letter-spacing: -.015em; }

/* menyu: chapda sarlavha (landshaft), pastda (portret); orqada o'yin o'zi o'ynaydi */
#menu { display: flex; flex-direction: column; background: linear-gradient(90deg, color-mix(in srgb, var(--bg) 78%, transparent) 0%, color-mix(in srgb, var(--bg) 40%, transparent) 46%, transparent 72%); }
#menu .m-body { margin: auto 0; padding: 0 max(28px, env(safe-area-inset-left)) 24px; max-width: 520px; }
#menu h1 { margin: 0; font-size: clamp(44px, 7.4vw, 76px); line-height: .98; font-weight: 800; letter-spacing: -.035em; }
#menu .m-body > p { margin: 12px 0 26px; color: var(--mut); font-size: 17px; max-width: 30ch; line-height: 1.4; }
.m-btns { display: grid; gap: 10px; max-width: 360px; }
.m-row { display: flex; gap: 10px; }
.m-row .gu-btn:first-child { flex: 1; }
.gu-btn small { font-weight: 600; font-size: 13px; opacity: .62; margin-left: 2px; font-variant-numeric: tabular-nums; }
.gu-btn.primary { background: var(--wacc); color: var(--ink); }
.gu-btn.big { min-height: 56px; font-size: 17px; border-radius: 15px; }
.gu-btn.big svg { width: 20px; height: 20px; }
#menu .gu-btn:not(.primary) { background: var(--glass); border-color: var(--line2); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
#menuSponsors { max-width: 360px; }
body.portrait #menu { background: linear-gradient(0deg, color-mix(in srgb, var(--bg) 88%, transparent) 0%, color-mix(in srgb, var(--bg) 62%, transparent) 42%, transparent 66%); }
body.portrait #menu .m-body { margin: auto 0 0; padding: 0 max(20px, env(safe-area-inset-left)) calc(26px + env(safe-area-inset-bottom)); max-width: none; }
body.portrait #menu h1 { font-size: 52px; }
body.portrait .m-btns, body.portrait #menuSponsors { max-width: none; }

/* bosqichlar */
#levels { display: flex; flex-direction: column; background: color-mix(in srgb, var(--bg) 84%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@media (pointer: coarse) { #levels { background: color-mix(in srgb, var(--bg) 92%, transparent); -webkit-backdrop-filter: none; backdrop-filter: none; } }
.lv-wrap { flex: 1; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; padding: 14px max(14px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); width: 100%; max-width: 900px; margin: 0 auto; }
#lTabs { display: flex; width: 100%; margin-bottom: 14px; }
#lTabs button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 48px; line-height: 1.15; }
#lTabs button small { font-size: 11.5px; opacity: .7; font-variant-numeric: tabular-nums; font-weight: 600; }
.lv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.lv { position: relative; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto auto; align-items: center; gap: 2px 8px; min-height: 92px; padding: 12px 13px; text-align: left; border: 1px solid var(--line); border-radius: 15px; background: var(--sur); color: var(--fg); cursor: pointer; transition: border-color .15s, transform .08s; }
.lv:hover { border-color: var(--line2); }
.lv:active { transform: scale(.985); }
.lv b { font-size: 13px; font-weight: 750; color: var(--mut); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.lv .nm { grid-column: 1 / -1; font-size: 15.5px; font-weight: 700; line-height: 1.25; }
.lv .bt { font-size: 13.5px; color: var(--mut); font-variant-numeric: tabular-nums; }
.lv .mks { justify-self: end; }
.lv.done { border-color: color-mix(in srgb, var(--wacc) 30%, var(--line)); }
.lv.locked { opacity: .5; cursor: default; }
.lv .lock { grid-column: 2; grid-row: 1; width: 18px; height: 18px; fill: none; stroke: var(--mut); stroke-width: 2; }
/* belgilar: uchta romb */
.mks { display: inline-flex; gap: 5px; align-items: center; }
.mk { display: inline-block; width: 9px; height: 9px; transform: rotate(45deg); border: 1.6px solid var(--mut); border-radius: 2px; opacity: .55; }
.mk.on { background: var(--wacc); border-color: var(--wacc); opacity: 1; }
.mk.sm { width: 6px; height: 6px; border-width: 1px; border-radius: 1px; margin: 0 6px 1px 0; vertical-align: middle; }
.mk.big { width: 20px; height: 20px; border-width: 2.4px; border-radius: 4px; margin: 0 9px; }
.r-marks .mk.on { animation: mk .42s cubic-bezier(.2,1.4,.4,1) backwards; animation-delay: var(--d); }
@keyframes mk { from { transform: rotate(45deg) scale(.2); opacity: 0; } }

/* HUD */
#hud { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)); pointer-events: none; }
#hud > * { pointer-events: auto; }
.hb { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 13px; background: var(--glass); color: var(--fg); cursor: pointer; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.hb svg { width: 20px; height: 20px; }
.hmid { flex: 1; display: flex; justify-content: center; pointer-events: none !important; min-width: 0; }
.hmid > div { display: flex; flex-direction: column; align-items: center; line-height: 1.12; padding: 4px 14px 5px; border-radius: 13px; background: var(--glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); min-width: 0; max-width: 100%; }
.hmid small { font-size: 11.5px; font-weight: 650; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hmid b { font-size: 20px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.hfalls { display: inline-flex; align-items: center; gap: 5px; height: 44px; padding: 0 11px; border-radius: 13px; background: var(--glass); color: var(--mut); font-weight: 750; font-size: 15px; font-variant-numeric: tabular-nums; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); pointer-events: none !important; }
.hfalls svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hfalls svg circle { fill: currentColor; stroke: none; }
.hfalls span { color: var(--fg); }

/* sensor tugmalar: katta, yarim shaffof; qahramonni yopmaydi (kamera uni yuqoriroqda ushlaydi) */
#pad { position: fixed; inset: 0; z-index: 5; touch-action: none; -webkit-touch-callout: none; }
.pb { position: absolute; bottom: calc(18px + env(safe-area-inset-bottom)); width: 76px; height: 76px; border-radius: 50%; background: var(--pb); border: 1.5px solid var(--pbl); color: var(--pbf); display: grid; place-items: center; pointer-events: none; transition: background .08s, transform .08s; }
.pb svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.pb.on { background: color-mix(in srgb, var(--wacc) 34%, transparent); border-color: color-mix(in srgb, var(--wacc) 70%, transparent); transform: scale(.94); }
#pL { left: calc(16px + env(safe-area-inset-left)); }
#pR { left: calc(108px + env(safe-area-inset-left)); }
#pJ { right: calc(18px + env(safe-area-inset-right)); width: 96px; height: 96px; }
#pJ svg { width: 36px; height: 36px; }
#pD { right: calc(34px + env(safe-area-inset-right)); bottom: calc(132px + env(safe-area-inset-bottom)); width: 64px; height: 64px; }
#pD svg { width: 26px; height: 26px; }
@media (max-height: 430px) { .pb { bottom: calc(12px + env(safe-area-inset-bottom)); width: 68px; height: 68px; } #pR { left: calc(96px + env(safe-area-inset-left)); } #pJ { width: 84px; height: 84px; } #pD { right: calc(28px + env(safe-area-inset-right)); bottom: calc(108px + env(safe-area-inset-bottom)); width: 56px; height: 56px; } }

/* natija */
#result { display: grid; place-items: center; padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 38%, transparent); }
.r-card { width: min(420px, 100%); max-height: 100%; overflow: auto; background: var(--glass2); border: 1px solid var(--line2); border-radius: 22px; padding: 20px 20px 18px; text-align: center; box-shadow: 0 24px 70px var(--shadow); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); animation: gu-rise .28s cubic-bezier(.2,.8,.3,1); }
@media (pointer: coarse) { .r-card { -webkit-backdrop-filter: none; backdrop-filter: none; background: color-mix(in srgb, var(--sur) 94%, transparent); } }
.r-head small { display: block; color: var(--mut); font-size: 13px; font-weight: 650; }
.r-head h2 { margin: 4px 0 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.r-time { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 10px 0 4px; }
.r-time b { font-size: 52px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.05; }
.tag { padding: 4px 9px; border-radius: 999px; background: color-mix(in srgb, var(--wacc) 22%, transparent); color: var(--fg); font-size: 12px; font-weight: 750; }
.r-marks { display: flex; justify-content: center; margin: 12px 0 8px; }
.r-line { color: var(--mut); font-size: 13px; margin-bottom: 14px; font-variant-numeric: tabular-nums; }
.r-stats { margin-bottom: 14px; text-align: left; }
.r-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.r-acts .r-main { flex: 1 1 100%; min-height: 52px; font-size: 16px; }
.r-acts .r-retry { flex: 1 1 auto; white-space: nowrap; }
.r-acts .gu-btn { white-space: nowrap; }
.r-acts .acts-ad { flex: 1 1 100%; margin-top: 4px; text-align: left; }
@media (max-height: 520px) and (orientation: landscape) {
  .r-card { width: min(640px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; align-items: center; padding: 14px 18px; text-align: left; }
  .r-card > * { grid-column: 1; } .r-card .r-stats, .r-card .r-acts { grid-column: 2; } .r-card .r-stats { grid-row: 1 / span 2; align-self: end; margin-bottom: 8px; } .r-card .r-acts { grid-row: 3 / span 3; align-self: start; }
  .r-time { justify-content: flex-start; margin: 6px 0 0; } .r-time b { font-size: 42px; } .r-marks { justify-content: flex-start; margin: 8px 0 6px -9px; } .r-line { margin-bottom: 0; }
}
/* sozlamalar va yakuniy natija (kit oynasi ichida) */
.set { display: grid; gap: 10px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.set-row > span { font-weight: 650; }
.set .ctl { color: var(--mut); font-size: 13.5px; border-top: 1px solid var(--line); padding-top: 10px; }
.set .ctl summary { cursor: pointer; color: var(--fg); font-weight: 650; }
.set .ctl p { margin: 8px 0 0; color: var(--mut); }
.set #sReset { justify-self: start; margin-top: 4px; }
.sum-sub { font-size: 13px; }
.sum-t { margin-top: 12px; }
.sum-t small { color: var(--mut); margin-left: 4px; }
.pz-line { display: grid; gap: 2px; }
.pz-line span { color: var(--mut); font-variant-numeric: tabular-nums; }
.gu-modal .gu-acts2 .gu-btn.primary { background: var(--wacc); }
