/* X-O: lobbi (Shashka kabi ikki ustun), o'yin ekrani — taxta markazda, chapda/o'ngda ma'lumot. Telefon birinchi: tugmalar ≥ 44 px. */
:root { --x: #ff6b5b; --o: #4aa8ff; --cell: #1a1e27; --grid: #2c3240; --winc: #ffd166; }
:root[data-theme="light"] { --x: #e24a3a; --o: #1f7ae0; --cell: #fbfaf7; --grid: #d9d4c8; --winc: #f0a500; }
body { background: var(--bg); color: var(--fg); }
body[data-view="play"] { overflow: hidden; }

/* ---------- lobbi */
.lobby { max-width: 1060px; margin: 0 auto; padding: 60px 16px 24px; }
.hero { display: flex; gap: 14px; justify-content: center; align-items: center; margin: 4px 0 18px; }
.hero-b { width: 128px; aspect-ratio: 1; }
.hero-b.big { width: 196px; }
.hero-b .board { width: 100%; pointer-events: none; }
.lb-cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
@media (max-width: 860px) { .lb-cols { grid-template-columns: minmax(0, 1fr); } .hero-b { width: 96px; } .hero-b.big { width: 150px; } }
.lb-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.lb-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lb-name { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--sur); color: var(--fg); font: 600 15px var(--font); cursor: pointer; max-width: 60vw; }
.lb-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-name svg { width: 16px; height: 16px; opacity: .7; flex: none; }
.lb-rate { color: var(--mut); font-size: 14px; } .lb-rate b { color: var(--fg); }
.lb-live { color: var(--mut); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.ln-on, .ln-off { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; } .ln-off { background: var(--amber); }
.lb-resume { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 14px; border-radius: var(--r); border: 1px solid var(--acc); background: var(--sur); color: var(--fg); text-align: left; cursor: pointer; font: inherit; min-height: 56px; }
.lb-resume .ic { width: 36px; height: 36px; border-radius: 50%; background: var(--acc); color: var(--acc-ink); display: grid; place-items: center; flex: none; } .lb-resume .ic svg { width: 18px; height: 18px; }
.lb-resume small { display: block; color: var(--mut); font-size: 13px; margin-top: 2px; }
.lb-sec { background: var(--sur); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 14px; }
.lb-sec h2 { margin: 0 0 10px; font-size: 17px; }
.lb-note { margin: -4px 0 10px; color: var(--mut); font-size: 14px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 12px 14px; min-height: 84px; border-radius: 12px; border: 1px solid var(--line); background: var(--sur2); color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.tile.has { border-color: var(--green); } .tile.on { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); }
.tile .t-name { font-weight: 800; font-size: 18px; } .tile .t-kind, .tile .t-q { color: var(--mut); font-size: 13px; } .tile.has .t-q { color: var(--green); }
.seekbox, .codebox { margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--sur2); border: 1px dashed var(--line2); }
.sk-top, .cd-top { display: flex; align-items: center; gap: 10px; } .sk-time { margin-left: auto; color: var(--mut); font-variant-numeric: tabular-nums; }
.seekbox p { margin: 8px 0; color: var(--mut); font-size: 14px; }
.sk-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sk-pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--acc); animation: pulse 1.2s ease-in-out infinite; flex: none; }
@keyframes pulse { 50% { opacity: .3; transform: scale(.7); } }
.cd-code { margin-left: auto; font-size: 28px; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.cd-wait { display: flex; align-items: center; gap: 8px; color: var(--mut); font-size: 14px; margin-top: 6px; }
.gu-seg { margin-bottom: 10px; flex-wrap: wrap; }
.levels { display: grid; gap: 8px; margin-bottom: 10px; }
.level { display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: var(--sur2); color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.level.on { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); }
.lv-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--sur3); font-weight: 800; flex: none; } .level.on .lv-n { background: var(--acc); color: var(--acc-ink); }
.lv-t small { display: block; color: var(--mut); font-size: 13px; margin-top: 1px; }
.ai-row, .fr-new { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; } .ai-row .gu-seg, .fr-new .gu-seg { margin-bottom: 0; }
.fr-new { margin-bottom: 10px; }
.fr-join { display: flex; gap: 8px; } .fr-join input { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--sur2); color: var(--fg); font: 600 18px var(--font); letter-spacing: .14em; text-transform: uppercase; }
.guides { display: grid; gap: 6px; margin-top: 10px; } .guides a { color: var(--acc-text); text-decoration: none; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 14px; } .guides a:last-child { border-bottom: 0; }
.gu-table tr.me td { color: var(--acc-text); font-weight: 700; }

/* ---------- sarlavha (app.js data-fit): to'liq nom bir qatorda yoki o'yin belgisi — ikki qatorga bo'linmaydi, kesilmaydi */
.gu-bar h1[data-fit] { position: relative; display: flex; align-items: center; white-space: nowrap; -webkit-line-clamp: unset; line-clamp: none; }
.gu-bar h1 .t-mk { display: inline-flex; align-items: center; gap: 3px; }
.gu-bar h1:not([data-fit="mk"]) .t-mk { position: absolute; right: 0; top: 0; visibility: hidden; pointer-events: none; } /* o'lchash uchun joyida turadi; o'ngga bog'langan — qisqa nomdan (uz «X-O») keng bo'lsa ham h1 ni o'ngga to'ldirmaydi (scrollWidth) */
.gu-bar h1 .t-mk svg { width: 19px; height: 19px; flex: none; overflow: visible; }
@media (max-width: 359px) { .gu-bar h1 .t-mk { gap: 2px; } .gu-bar h1 .t-mk svg { width: 17px; height: 17px; } }
.gu-bar h1 .t-mk svg * { fill: none; stroke-linecap: round; }
.gu-bar h1 .t-mk .mx { stroke: var(--x); stroke-width: 15; } .gu-bar h1 .t-mk .mo { stroke: var(--o); stroke-width: 14; }
.gu-bar h1[data-fit="mk"] .t-full, .gu-bar h1[data-fit="none"] .t-full { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ---------- taxta */
.board { --n: 3; position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); aspect-ratio: 1; width: 100%; background: var(--grid); gap: 2px; padding: 2px; border-radius: 14px; touch-action: manipulation; }
.board[data-n="15"] { gap: 1px; padding: 1px; border-radius: 8px; }
.board .c { position: relative; display: block; min-width: 0; padding: 0; margin: 0; border: 0; background: var(--cell); cursor: default; aspect-ratio: 1; outline: none; color: inherit; }
.board[data-n="3"] .c:first-child { border-top-left-radius: 12px; } .board[data-n="3"] .c:nth-child(3) { border-top-right-radius: 12px; } .board[data-n="3"] .c:nth-child(7) { border-bottom-left-radius: 12px; } .board[data-n="3"] .c:nth-child(9) { border-bottom-right-radius: 12px; }
.board[data-n="15"] .c:first-child { border-top-left-radius: 7px; } .board[data-n="15"] .c:nth-child(15) { border-top-right-radius: 7px; } .board[data-n="15"] .c:nth-child(211) { border-bottom-left-radius: 7px; } .board[data-n="15"] .c:nth-child(225) { border-bottom-right-radius: 7px; }
.board .c.dot::before { content: ""; position: absolute; inset: 44%; border-radius: 50%; background: var(--grid); }
.board.can .c.e { cursor: pointer; }
.board .c:focus-visible { box-shadow: inset 0 0 0 2px var(--acc); z-index: 1; }
.board .c svg { position: absolute; inset: 14%; width: 72%; height: 72%; overflow: visible; }
.board[data-n="15"] .c svg { inset: 12%; width: 76%; height: 76%; }
.board .c svg * { fill: none; stroke-linecap: round; }
.board .c .mx { stroke: var(--x); stroke-width: 15; } .board .c .mo { stroke: var(--o); stroke-width: 14; }
.board[data-n="15"] .c .mx { stroke-width: 16; } .board[data-n="15"] .c .mo { stroke-width: 15; }
.board .c.new svg { animation: pop .22s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
.board .c.last { background: color-mix(in srgb, var(--cell) 86%, var(--acc)); }
.board .c.win { background: color-mix(in srgb, var(--cell) 70%, var(--winc)); }
.board .c.ghost svg, .board.can.hov .c.e:hover svg.gh { opacity: .38; }
.board .c svg.gh { display: none; } .board.can.hov .c.e:hover svg.gh, .board .c.ghost svg.gh { display: block; }
.board .c.ghost { box-shadow: inset 0 0 0 2px var(--acc); z-index: 1; }
.board .wl { position: absolute; inset: 0; pointer-events: none; width: 100%; height: 100%; }
.board .wl line { stroke: var(--winc); stroke-linecap: round; opacity: .9; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .45s ease-out .1s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .board .c.new svg, .board .wl line { animation: none; stroke-dashoffset: 0; } }

/* ---------- o'yin ekrani */
/* kompyuterda chat paneli ochiq bo'lsa (social.js: html.gu-chat-push, --gu-vw) o'yin uning chap tomonida qoladi */
.play { position: fixed; inset: 0 calc(100vw - var(--gu-vw, 100vw)) 0 0; padding: 56px 12px 12px; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto; justify-items: center; gap: 8px; }
.boardbox { position: relative; width: min(100%, calc(100dvh - 56px - 2 * 52px - 170px)); max-width: 620px; align-self: center; }
.board-wrap { width: 100%; }
.pbar { width: 100%; max-width: 620px; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 10px; border-radius: 12px; background: var(--sur); border: 1px solid var(--line); }
.pbar.turn { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); }
.pbar .mk { width: 26px; height: 26px; flex: none; } .pbar .mk svg { width: 100%; height: 100%; } .pbar .mk svg * { fill: none; stroke-linecap: round; } .pbar .mk .mx { stroke: var(--x); stroke-width: 14; } .pbar .mk .mo { stroke: var(--o); stroke-width: 13; }
.pbar .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; } .pbar .rt { color: var(--mut); font-size: 13px; }
.pbar .off { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); flex: none; }
.pbar .clk { margin-left: auto; font: 700 18px var(--font); font-variant-numeric: tabular-nums; padding: 4px 10px; border-radius: 8px; background: var(--sur2); }
.pbar .clk.low { color: var(--red); } .pbar.turn .clk { background: var(--acc); color: var(--acc-ink); } .pbar.turn .clk.low { background: var(--red); color: #fff; }
.pbar .think { margin-left: auto; color: var(--mut); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.side { width: 100%; max-width: 620px; display: grid; gap: 8px; }
.status { text-align: center; font-weight: 700; min-height: 22px; }
.banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--sur2); border: 1px solid var(--line2); font-size: 14px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tools .gu-btn { min-height: 44px; }
.hint-touch { margin: 0; text-align: center; color: var(--mut); font-size: 13px; }
.result { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 55%, transparent); border-radius: 14px; backdrop-filter: blur(1.5px); }
.result .card { width: min(92%, 340px); padding: 18px 16px; border-radius: 16px; background: var(--sur); border: 1px solid var(--line); text-align: center; box-shadow: 0 12px 40px rgba(0, 0, 0, .35); }
.result h3 { margin: 0 0 4px; font-size: 22px; } .result p { margin: 0 0 12px; color: var(--mut); } .result .dl { font-weight: 800; } .result .dl.up { color: var(--green); } .result .dl.dn { color: var(--red); }
.result .acts { display: grid; gap: 8px; } .result .acts .gu-btn { min-height: 46px; }
.result .x-close { position: absolute; }
/* keng ekran: ma'lumot o'ngda */
@media (min-width: 900px) and (min-height: 520px) {
  .play { grid-template-columns: minmax(0, 620px) 300px; justify-content: center; grid-template-rows: auto minmax(0, 1fr) auto; column-gap: 28px; padding: 64px 24px 16px; align-content: center; }
  .pbar.top { grid-column: 1; grid-row: 1; } .boardbox { grid-column: 1; grid-row: 2; width: min(100%, calc(100dvh - 64px - 2 * 52px - 40px)); } .pbar.bot { grid-column: 1; grid-row: 3; }
  .pbar { max-width: min(620px, calc(100dvh - 64px - 2 * 52px - 40px)); }
  /* o'ng ustun yuqorida (raqib qatori bilan bir chiziqda): pastki o'ng burchak chat oynasi uchun bo'sh qoladi (chatAvoid) */
  .side { grid-column: 2; grid-row: 1 / 4; align-self: start; max-width: 300px; } .tools { justify-content: stretch; } .tools .gu-btn { flex: 1 1 auto; }
  .status { min-height: 44px; display: flex; align-items: center; justify-content: center; }
}

/* telefon yotiq holatda (balandlik kichik): taxta chapda balandlik bo'yicha, o'yinchilar va tugmalar o'ngda */
@media (orientation: landscape) and (max-height: 519px) {
  .play { grid-template-columns: auto minmax(0, 320px); grid-template-rows: auto auto auto minmax(0, 1fr); column-gap: 16px; row-gap: 8px; padding: 52px 12px 8px; align-content: start; justify-content: center; justify-items: stretch; }
  .boardbox { grid-column: 1; grid-row: 1 / 5; width: calc(100dvh - 52px - 12px); max-width: none; align-self: start; }
  .pbar.top { grid-column: 2; grid-row: 1; } .pbar.bot { grid-column: 2; grid-row: 2; } .side { grid-column: 2; grid-row: 3; max-width: none; }
}

/* skrinshot rejimi (?shot=): faqat taxta */
.shot .gu-bar, .shot #lobby, .shot .pbar, .shot .side, .shot .gu-toast { display: none !important; }
.shot body { overflow: hidden; }
.shot .play { padding: 0; place-content: center; grid-template-rows: auto; grid-template-columns: auto; }
.shot .boardbox { width: var(--shot-w, 90vmin); max-width: none; }
/* portal muqovasi: karta 4:3 ga markazdan kesiladi va pastki qismida matn — ikkala taxta markazdagi 4:3 ichida va biroz yuqorida */
.shot .boardbox.multi { width: auto; display: flex; align-items: center; gap: 5vh; transform: translateY(-5vh); }
.shot .boardbox.multi .board[data-n="3"] { width: 46vh; } .shot .boardbox.multi .board[data-n="15"] { width: 80vh; }
.board .c.hl { background: color-mix(in srgb, var(--cell) 78%, var(--acc)); }
