/* Chempionlar kechasi: to'q ultramarin, kumush-oq tugmalar, oltin faqat unvon va kubok uchun */
:root {
  --bg: #0a1230; --surf: #121d4a; --surf2: #1a2866; --line: #2b3b82;
  --txt: #f3f6ff; --dim: #9fb0e0; --gold: #e8c15a; --win: #3ddc97; --lose: #ff6b7a; --sig: #7aa2ff;
  --sq-l: #dbe3f4; --sq-d: #5876b8; --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--txt); font: 15px/1.45 var(--font); -webkit-user-select: none; user-select: none; overscroll-behavior: none; }
body { overflow: hidden; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.15; letter-spacing: -.01em; }
h2 { font-size: 13px; font-weight: 700; color: var(--dim); margin: 24px 0 10px; letter-spacing: .02em; }
h3 { font-size: 17px; }
.dim { color: var(--dim); } .sm { font-size: 13px; } .break { word-break: break-all; }
.lead { color: var(--dim); margin: 8px 0 18px; max-width: 46ch; }
.hint { color: var(--dim); font-size: 13px; margin-top: 10px; text-align: center; }
.empty { color: var(--dim); text-align: center; padding: 36px 12px; }
.err { color: var(--lose); margin: 14px 4px 0; }
:focus-visible { outline: 2px solid var(--sig); outline-offset: 2px; }
@media print { body * { display: none !important; } }

#app { height: 100%; position: relative; }
main { height: 100%; }
main.scroll { overflow-y: auto; padding: 18px 16px calc(84px + var(--safe-b)); -webkit-overflow-scrolling: touch; }
main.center { display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px; text-align: center; }
.plain { max-width: 340px; display: grid; gap: 12px; justify-items: center; } .plain p { color: var(--dim); }
.pg { margin-bottom: 14px; }

.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--txt); animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* tugmalar */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; padding: 0 18px; border-radius: 14px; font-weight: 700; transition: transform .08s, opacity .15s; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:active { transform: scale(.98); } .btn[disabled] { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--txt); color: #0a1230; }
.btn.ghost { border: 1.5px solid var(--line); color: var(--txt); }
.btn.danger { background: #3a1830; color: #ff9aa6; border: 1.5px solid #6a2a48; }
.btn.sm { min-height: 38px; width: auto; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.btn.xl { min-height: 60px; font-size: 18px; border-radius: 18px; margin-top: 18px; }
.btn + .btn { margin-top: 10px; }

/* kirish bosqichlari */
.gate { overflow-y: auto; padding: 24px 18px 40px; max-width: 520px; margin: 0 auto; }
.steps { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 10px; }
.steps li { display: flex; align-items: center; gap: 12px; color: var(--dim); font-weight: 600; }
.steps .n { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: 13px; flex: none; }
.steps .n svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.steps .cur { color: var(--txt); } .steps .cur .n { background: var(--txt); color: var(--bg); border-color: var(--txt); }
.steps .done { color: var(--win); } .steps .done .n { border-color: var(--win); }
.panel { background: var(--surf); border-radius: 22px; padding: 22px 18px; }
.meter { position: relative; display: flex; align-items: baseline; gap: 6px; font-size: 34px; font-weight: 800; margin: 4px 0 18px; padding-bottom: 12px; }
.meter span { font-size: 18px; color: var(--dim); font-weight: 600; }
.meter i { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; border-radius: 3px; background: var(--line); }
.meter i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--p); border-radius: 3px; background: var(--win); }
.lvl { border: 0; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; }
.lvl legend { font-weight: 800; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; padding: 0; }
.opt { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); cursor: pointer; }
.opt input { position: absolute; opacity: 0; }
.opt span { flex: 1; display: grid; } .opt small { color: var(--dim); font-size: 13px; }
.opt em { font-style: normal; color: var(--dim); font-weight: 700; }
.opt:has(input:checked) { border-color: var(--txt); background: var(--surf2); }
.opt:has(input:focus-visible) { outline: 2px solid var(--sig); }

/* o'yin turi belgisi */
.gi { display: inline-grid; place-items: center; width: 20px; height: 20px; font-size: 18px; line-height: 1; }
.gi.checkers::before { content: ""; width: 15px; height: 15px; border-radius: 50%; background: #ece6d6; box-shadow: inset 0 0 0 3px #b9b09a, 0 1px 0 #000; }

/* segmentli tugmalar */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--surf); padding: 4px; border-radius: 14px; margin: 14px 0; }
.seg button { min-height: 40px; border-radius: 10px; font-weight: 700; color: var(--dim); display: flex; align-items: center; justify-content: center; gap: 8px; }
.seg button.on { background: var(--txt); color: var(--bg); }

/* bosh sahifa */
.top { display: flex; align-items: center; gap: 12px; }
.top.prof { margin-bottom: 18px; } .top .who { display: grid; min-width: 0; } .top .who b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av { position: relative; flex: none; width: var(--s); height: var(--s); border-radius: 50%; display: grid; place-items: center; overflow: hidden; font-weight: 800; font-size: calc(var(--s) * .38); background: hsl(var(--h) 45% 32%); color: hsl(var(--h) 80% 90%); }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.plate { background: var(--surf); border-radius: 24px; padding: 20px 18px 16px; border: 1.5px solid var(--line); }
.plate-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ttl { color: var(--gold); font-weight: 800; font-size: 15px; }
.rank { color: var(--dim); font-size: 13px; } .rank b { color: var(--txt); }
.big { font-size: 84px; line-height: 1; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; margin: 6px 0 12px; }
.ladder { height: 6px; background: var(--line); border-radius: 3px; position: relative; margin-bottom: 8px; }
.ladder i { position: absolute; inset: 0 auto 0 0; width: var(--p); background: var(--gold); border-radius: 3px; }
.wdl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.wdl div { display: grid; } .wdl dt { color: var(--dim); font-size: 12px; } .wdl dd { margin: 0; font-size: 20px; font-weight: 800; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { text-align: left; background: var(--surf); border-radius: 18px; padding: 14px; display: grid; gap: 4px; }
.tile svg { width: 24px; height: 24px; fill: none; stroke: var(--sig); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile span { color: var(--dim); font-size: 13px; }

.mcard { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--surf); border-radius: 16px; padding: 14px; margin-bottom: 10px; }
.mcard > div { display: grid; min-width: 0; } .mcard small { color: var(--sig); font-weight: 700; }
.mcard b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* pastki menyu */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: #0d1740; border-top: 1px solid var(--line); padding-bottom: var(--safe-b); z-index: 5; }
.tabbar button { display: grid; justify-items: center; gap: 2px; padding: 9px 0 8px; color: var(--dim); font-size: 11px; font-weight: 700; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar .on { color: var(--txt); } .tabbar .on svg { stroke: var(--gold); }

/* reyting ro'yxati */
.board-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.board-list li { display: flex; align-items: center; gap: 10px; background: var(--surf); border-radius: 14px; padding: 10px 12px; }
.board-list li.me { background: var(--surf2); box-shadow: inset 0 0 0 1.5px var(--sig); }
.board-list .nm { flex: 1; display: grid; min-width: 0; } .board-list .nm b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.rk, .medal { width: 28px; text-align: center; font-weight: 800; color: var(--dim); flex: none; }
.medal { height: 28px; line-height: 28px; border-radius: 50%; color: #1a1300; }
.medal.m1 { background: var(--gold); } .medal.m2 { background: #c8d0e4; } .medal.m3 { background: #d19a6a; }
.mebar { position: fixed; left: 12px; right: 12px; bottom: calc(66px + var(--safe-b)); display: flex; align-items: baseline; gap: 8px; background: var(--txt); color: var(--bg); border-radius: 16px; padding: 12px 16px; z-index: 4; box-shadow: 0 8px 24px #0008; }
.mebar span { font-size: 13px; } .mebar .dim { color: #5a6aa5; } .mebar b { font-size: 22px; } .mebar strong { margin-left: auto; font-size: 22px; }
.hist .res { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; flex: none; }
.hist .win .res { background: #12382c; color: var(--win); } .hist .loss .res { background: #3b1a2a; color: var(--lose); } .hist .draw .res { background: var(--line); color: var(--txt); }
.hist .win strong { color: var(--win); } .hist .loss strong { color: var(--lose); }

/* chempionat */
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--surf2); color: var(--sig); font-size: 12px; font-weight: 700; }
.cup { background: var(--surf); border-radius: 20px; padding: 16px; margin-bottom: 12px; display: grid; gap: 6px; }
.cup-h { display: flex; justify-content: space-between; align-items: center; }
.cup .prize { color: var(--gold); font-weight: 700; } .cup .btn { margin-top: 8px; align-self: start; }
.cup.finished { opacity: .75; }
.cup-top { display: grid; gap: 6px; justify-items: start; margin-bottom: 4px; } .champ { color: var(--gold); }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--dim); font-weight: 700; margin-bottom: 12px; padding: 4px 0; }
.back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.grp { background: var(--surf); border-radius: 18px; padding: 14px 12px; margin-bottom: 12px; }
.grp h3 { margin-bottom: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th { color: var(--dim); font-weight: 600; font-size: 12px; text-align: center; padding: 4px 2px; } th:nth-child(2), td:nth-child(2) { text-align: left; }
td { text-align: center; padding: 7px 2px; border-top: 1px solid var(--line); } td:nth-child(2) { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr.q td:first-child { box-shadow: inset 3px 0 0 var(--win); } tr.me td { background: #1d2c74; }
.mlist { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; }
.mrow { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; font-size: 13px; padding: 6px 4px; border-radius: 8px; color: var(--dim); }
.mrow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .mrow .r { text-align: right; } .mrow em { font-style: normal; font-weight: 800; color: var(--txt); min-width: 52px; text-align: center; }
.mrow .w { color: var(--txt); font-weight: 800; } .mrow.mine { background: var(--surf2); }

/* profil */
.stat { background: var(--surf); border-radius: 18px; padding: 14px; display: grid; gap: 2px; }
.stat span { display: flex; align-items: center; gap: 6px; color: var(--dim); font-weight: 700; } .stat b { font-size: 38px; letter-spacing: -.03em; line-height: 1.1; } .stat small { color: var(--dim); font-size: 12px; }
.trophies { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.trophies span { background: var(--surf); border-radius: 16px; padding: 12px; font-size: 28px; font-weight: 800; display: grid; border-top: 4px solid; } .trophies i { font-style: normal; font-size: 12px; color: var(--dim); font-weight: 600; }
.t1 { border-color: var(--gold) !important; } .t2 { border-color: #c8d0e4 !important; } .t3 { border-color: #d19a6a !important; }
.plain-list { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; font-size: 14px; }
.invite { background: var(--surf); border-radius: 16px; padding: 14px; display: grid; gap: 12px; }
.legal { color: var(--dim); font-size: 12px; margin-top: 24px; }

/* o'yin ekrani */
.game { display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 10px 12px calc(10px + var(--safe-b)); max-width: 560px; margin: 0 auto; }
.gtop { display: flex; align-items: center; gap: 8px; font-size: 13px; min-height: 26px; }
.viol { margin-left: auto; color: var(--lose); font-weight: 700; opacity: 0; } .viol.on { opacity: 1; }
.pbar { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 8px; border-radius: 14px; background: var(--surf); border: 1.5px solid transparent; }
.pbar.run { border-color: var(--sig); }
.pbar .nm { flex: 1; display: grid; min-width: 0; line-height: 1.25; } .pbar .nm b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .pbar .nm span { font-size: 12px; }
.clock { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; padding: 4px 12px; border-radius: 10px; background: var(--bg); min-width: 82px; text-align: center; }
.pbar.run .clock { background: var(--txt); color: var(--bg); } .clock.low { color: var(--lose); } .pbar.run .clock.low { background: var(--lose); color: #fff; }
.away { background: #3b2a12; color: #ffd18a; border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 600; }
.boardwrap { display: grid; place-items: center; }
.board { position: relative; display: grid; grid-template: repeat(8, 1fr) / repeat(8, 1fr); width: min(100%, calc(100dvh - 330px)); min-width: 260px; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--sq-d); box-shadow: 0 0 0 3px var(--surf2); touch-action: manipulation; }
.sq { position: relative; display: grid; place-items: center; }
.sq.l { background: var(--sq-l); } .sq.d { background: var(--sq-d); }
.sq .cr, .sq .cf { position: absolute; font-size: 9px; font-weight: 700; opacity: .75; pointer-events: none; }
.sq .cr { top: 2px; left: 3px; } .sq .cf { bottom: 1px; right: 3px; }
.sq.l .cr, .sq.l .cf { color: var(--sq-d); } .sq.d .cr, .sq.d .cf { color: var(--sq-l); }
.sq.last::before { content: ""; position: absolute; inset: 0; background: #ffd84a; opacity: .38; }
.sq.sel::before { content: ""; position: absolute; inset: 0; background: #4fe0a0; opacity: .5; }
.sq.mid::before { content: ""; position: absolute; inset: 0; background: #4fe0a0; opacity: .35; }
.sq.chk::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle, #ff3b4f 20%, transparent 70%); }
.sq.tgt::after { content: ""; width: 28%; height: 28%; border-radius: 50%; background: #0a1230; opacity: .38; position: absolute; }
.sq.cap::after { content: ""; position: absolute; inset: 6%; border-radius: 50%; border: 4px solid #0a1230; opacity: .38; }
.sq.must::after { content: ""; position: absolute; inset: 8%; border-radius: 50%; border: 2px dashed #ffd84a; }
.board.mine .sq { cursor: pointer; }
.pc { position: relative; z-index: 1; font-style: normal; font-size: min(10.5vw, 52px); line-height: 1; font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "Apple Symbols", "DejaVu Sans", sans-serif; }
.pc.pw { color: #fff; text-shadow: 0 0 1px #000, 0 0 2px #000, 0 1px 3px #0009, 1px 0 0 #000, -1px 0 0 #000, 0 -1px 0 #000, 0 1px 0 #000; }
.pc.pb { color: #101830; text-shadow: 0 0 1px #fff8, 0 1px 2px #0006; }
.ck { position: relative; z-index: 1; width: 78%; height: 78%; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: min(6.4vw, 30px); box-shadow: 0 3px 0 rgba(0, 0, 0, .35), inset 0 0 0 4px rgba(0, 0, 0, .12); }
.ck.cw { background: radial-gradient(circle at 35% 30%, #fffdf4, #e6dfc9 70%); color: #8a6d12; }
.ck.cb { background: radial-gradient(circle at 35% 30%, #4a5170, #181d34 70%); color: var(--gold); }
.ck::after { content: ""; position: absolute; inset: 15%; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .14); }
.ck.king { box-shadow: 0 3px 0 rgba(0, 0, 0, .35), 0 0 0 2px var(--gold); }
.land { animation: land .18s ease-out; } @keyframes land { from { transform: scale(1.25); } to { transform: scale(1); } }
.promo { position: absolute; inset: 34% 8%; background: var(--txt); border-radius: 14px; display: grid; grid-template-columns: repeat(4, 1fr); align-items: center; z-index: 3; box-shadow: 0 10px 30px #000a; }
.promo button { font-size: 44px; line-height: 1; padding: 6px 0; font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "Apple Symbols", sans-serif; }
.promo .pw { color: #fff; text-shadow: 0 0 2px #000, 0 0 2px #000, 0 0 3px #000; } .promo .pb { color: #101830; }
.note { text-align: center; color: var(--dim); font-size: 14px; min-height: 20px; } .note.turn { color: var(--txt); font-weight: 700; }
.offer { display: flex; align-items: center; gap: 8px; background: var(--surf2); border-radius: 12px; padding: 8px 10px; } .offer span { flex: 1; font-size: 14px; }
.gactions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .gactions .btn { margin: 0; min-height: 44px; }
body.ingame .tabbar { display: none; }

/* ustki qatlamlar */
.modal { position: fixed; inset: 0; background: #040a1ecc; display: grid; align-items: end; z-index: 20; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.sheet { background: var(--surf); border-radius: 26px 26px 0 0; padding: 26px 20px calc(24px + var(--safe-b)); display: grid; gap: 10px; max-width: 560px; width: 100%; margin: 0 auto; animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet .btn { margin: 0; } .sheet h2 { font-size: 24px; color: var(--txt); margin: 0; } .center-t { text-align: center; justify-items: center; }
.sheet.result { text-align: center; } .sheet.result.win h2 { color: var(--win); } .sheet.result.loss h2 { color: var(--lose); }
.delta { display: flex; justify-content: center; align-items: baseline; gap: 10px; } .delta b { font-size: 56px; letter-spacing: -.03em; line-height: 1; } .delta span { font-size: 22px; font-weight: 800; }
.result.win .delta span { color: var(--win); } .result.loss .delta span { color: var(--lose); }
.radar { width: 54px; height: 54px; border-radius: 50%; border: 3px solid var(--sig); position: relative; margin: 4px 0; }
.radar::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 3px solid var(--sig); animation: ping 1.4s ease-out infinite; }
@keyframes ping { from { transform: scale(1); opacity: .9; } to { transform: scale(2.2); opacity: 0; } }
#toasts { position: fixed; top: 10px; left: 12px; right: 12px; display: grid; gap: 8px; z-index: 40; pointer-events: none; justify-items: center; }
.toast { background: var(--txt); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: 0 8px 24px #0007; max-width: 480px; animation: up .2s ease-out; }
.toast.err { background: #ffd9de; color: #5a0f1c; } .toast.ok { background: #c9f5df; color: #0b3a26; } .toast.out { opacity: 0; transition: opacity .4s; }
body.offline::before { content: "Ulanish uzildi. Qayta ulanmoqda…"; position: fixed; top: 0; left: 0; right: 0; background: #5a2a10; color: #ffd18a; text-align: center; font-size: 13px; font-weight: 700; padding: 6px; z-index: 50; }

/* himoya: suv belgisi va parda */
#wm { position: fixed; inset: -20%; z-index: 30; pointer-events: none; transform: rotate(-24deg); font-size: 15px; font-weight: 800; line-height: 3.2; color: #fff; opacity: .045; word-break: break-all; overflow: hidden; }
body:not(.ingame) #wm { display: none; }
#shield { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: none; place-items: center; text-align: center; padding: 24px; }
#shield.on { display: grid; } #shield div { display: grid; gap: 8px; } #shield span { color: var(--dim); }

@media (max-height: 700px) { .big { font-size: 64px; } .board { width: min(100%, calc(100dvh - 300px)); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
