/* So‘z izlari — «kechki xarita» uslubi: sokin to‘q yashil-ko‘k tun (yorug‘da — iliq qog‘oz), harflar ip-munchoqdek iz bilan bog‘lanadi.
   Mavzu so‘zlari — dengiz-yashil, ko‘prik — kahrabo. Telefon birinchi: portretda bir ustun, landshaft va kompyuterda ikki ustun (chapda mavzu, o‘ngda taxta). */
@font-face { font-family: "IZ Serif"; src: url("assets/fonts/serif-600.woff2?v=1c22052c60fb") format("woff2"); font-weight: 600; font-display: swap; }
:root, :root[data-theme="dark"] {
  --bg: #0e1416; --sur: #151d20; --sur2: #1c262a; --sur3: #26333a; --line: rgba(220,240,235,.08); --line2: rgba(220,240,235,.16);
  --fg: #ecf1ee; --mut: #8d9f9b; --head: rgba(14,20,22,.86); --shadow: rgba(0,0,0,.5);
  --acc: #4cc4b1; --acc-ink: #032019; --acc-text: #63d2c0; --glow: rgba(76,196,177,.14);
  --tw: #3bb6a3; --tw-ink: #031b17; --br: #f0b549; --br-ink: #291900; --sel: #e8e2d1; --sel-ink: #111a1c;
  --board: #121a1d; --board-line: rgba(220,240,235,.06); --letter: #e6ece8; --topo: rgba(150,200,188,.055); --bad: #ff7a7a;
  --serif: "IZ Serif", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
:root[data-theme="light"] {
  --bg: #f3eee4; --sur: #fffcf6; --sur2: #ebe4d6; --sur3: #ded5c3; --line: rgba(45,38,20,.09); --line2: rgba(45,38,20,.18);
  --fg: #1a2325; --mut: #646e6b; --head: rgba(243,238,228,.9); --shadow: rgba(40,30,10,.16);
  --acc: #1f9a88; --acc-ink: #ffffff; --acc-text: #137a6b; --glow: rgba(31,154,136,.14);
  --tw: #7fd1c3; --tw-ink: #08302a; --br: #f4c056; --br-ink: #352300; --sel: #1e2a2d; --sel-ink: #f7f2e8;
  --board: #fbf8f1; --board-line: rgba(45,38,20,.07); --letter: #1a2325; --topo: rgba(60,85,75,.075); --bad: #d64545;
}
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { position: fixed; inset: 0; background: var(--bg); }
#topo { position: fixed; inset: 0; width: 100%; height: 100%; color: var(--topo); pointer-events: none; z-index: 0; }

/* ---- joylashuv: portret — bir ustun */
#app { position: fixed; inset: 0; z-index: 1; display: grid; margin: 0 auto; max-width: 560px;
  grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto auto auto auto minmax(0, 1.4fr);
  grid-template-areas: "top" "." "theme" "prog" "word" "board" "ctl" "."; /* ortiqcha balandlik tepa va pastga bo‘linadi: taxta mavzu kartasiga yopishib turadi */
  padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
#top { grid-area: top; display: flex; align-items: center; gap: 2px; height: 54px; margin: 0 -6px; }
#theme { grid-area: theme; } #prog { grid-area: prog; } #word { grid-area: word; } #boardWrap { grid-area: board; } #ctl { grid-area: ctl; }
#found { display: none; } /* topilgan so‘zlar ro‘yxati — faqat keng ekranda (chap ustun), portretda joy taxtaga */

/* ---- yuqori panel */
.ib { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--mut); cursor: pointer; text-decoration: none; flex: none; transition: color .15s, background .15s; }
.ib:hover { color: var(--fg); background: var(--sur2); }
.ib svg { width: 21px; height: 21px; }
#ttl { min-width: 0; padding-left: 2px; line-height: 1.1; }
#name { margin: 0; font: 600 21px/1.1 var(--serif); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sub { display: block; margin-top: 3px; color: var(--mut); font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
#top .sp { flex: 1; }

/* ---- mavzu kartasi */
#theme { margin: 4px 0 0; padding: 12px 16px 13px; border-radius: 18px; background: var(--sur); border: 1px solid var(--line); text-align: center; }
.lab { display: block; font-size: 11px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; color: var(--acc-text); }
#clue { margin: 4px 0 0; font: 600 clamp(19px, 5.4vw, 25px)/1.18 var(--serif); letter-spacing: -.005em; color: var(--fg); text-wrap: balance; }
#theme.wait #clue { color: var(--mut); }

/* ---- topilganlar */
#prog { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 30px; margin-top: 8px; color: var(--mut); font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
#progTxt b { color: var(--fg); }
#pips { display: inline-flex; gap: 5px; }
#pips i { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--line2); transition: background .3s, border-color .3s, transform .3s; }
#pips i.on { background: var(--tw); border-color: var(--tw); }
#pips i.b { background: var(--br); border-color: var(--br); }
#pips i.pop { transform: scale(1.45); }

/* ---- terilayotgan so‘z va javob */
#word { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 54px; text-align: center; }
#wordTxt { display: inline-block; min-height: 30px; font-size: 25px; font-weight: 800; letter-spacing: .08em; color: var(--fg); line-height: 30px; white-space: nowrap; transition: color .15s, opacity .25s; }
#wordTxt.hintTxt { font-size: 14px; font-weight: 600; letter-spacing: 0; color: var(--mut); }
#wordNote { min-height: 18px; font-size: 12.5px; font-weight: 700; color: var(--mut); letter-spacing: .02em; transition: opacity .25s; }
#word.ok #wordTxt { color: var(--acc-text); } #word.ok #wordNote { color: var(--acc-text); }
#word.br #wordTxt, #word.br #wordNote { color: var(--br); }
:root[data-theme="light"] #word.br #wordTxt, :root[data-theme="light"] #word.br #wordNote { color: #a8730b; }
#word.bonus #wordNote { color: var(--fg); }
#word.bad #wordTxt { color: var(--bad); animation: iz-shake .34s; }
#word.bad #wordNote { color: var(--bad); }
#word.fade #wordTxt, #word.fade #wordNote { opacity: 0; }

/* ---- taxta (SVG, 600×800 birlik; katak = 100) */
#boardWrap { position: relative; min-height: 0; display: grid; place-items: center; }
#board { display: block; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; cursor: pointer; overflow: visible; border-radius: 22px; background: var(--board); box-shadow: 0 0 0 1px var(--line), 0 18px 40px -22px var(--shadow); }
#board .lt { font-family: var(--font); font-size: 45px; font-weight: 700; fill: var(--letter); text-anchor: middle; dominant-baseline: central; transition: fill .2s; pointer-events: none; }
#board .lt.two { font-size: 35px; letter-spacing: -1px; }
#board .lt.on { fill: var(--sel-ink); }
#board .lt.ft { fill: var(--tw-ink); }
#board .lt.fb { fill: var(--br-ink); }
#board .tr { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 30; }
#board .bd { transform-box: fill-box; transform-origin: center; }
#board .sel .tr { stroke: var(--sel); }
#board .sel .bd { fill: var(--sel); animation: iz-pop .16s cubic-bezier(.2,.9,.3,1.25); }
#board .sel.bad { animation: iz-shake .32s; }
#board .sel.bad .tr { stroke: var(--bad); } #board .sel.bad .bd { fill: var(--bad); }
#board .sel.out { opacity: 0; transition: opacity .22s; }
#board .rb { stroke: var(--sel); stroke-width: 12; stroke-linecap: round; opacity: .45; }
#board .fw .tr { stroke: var(--tw); }
#board .fw .bd { fill: var(--tw); }
#board .fw.b .tr { stroke: var(--br); }
#board .fw.b .bd { fill: var(--br); }
#board .fw.fresh .bd { animation: iz-wave .55s cubic-bezier(.3,.7,.4,1) both; animation-delay: calc(var(--i) * 45ms); }
#board .fw.fin .bd { animation: iz-wave .6s ease both; animation-delay: calc(var(--d) * 1ms); }
#board .hn circle { fill: none; stroke: var(--br); stroke-width: 4.5; stroke-dasharray: 10 8; animation: iz-breathe 2.4s ease-in-out infinite; }
:root[data-theme="light"] #board .hn circle { stroke: #c98b14; }
#board .hn .ord { fill: none; stroke: var(--br); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 1 13; opacity: .95; }
:root[data-theme="light"] #board .hn .ord { stroke: #c98b14; }
#board .hn .num { font-family: var(--font); font-size: 17px; font-weight: 800; fill: var(--br); text-anchor: middle; dominant-baseline: central; }
:root[data-theme="light"] #board .hn .num { fill: #a8730b; }
#board .cur { fill: none; stroke: var(--acc-text); stroke-width: 4; opacity: .9; }
@keyframes iz-pop { from { transform: scale(.45); opacity: .5; } }
@keyframes iz-wave { 0% { transform: scale(1); } 38% { transform: scale(1.16); } 100% { transform: scale(1); } }
@keyframes iz-shake { 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
@keyframes iz-breathe { 50% { opacity: .55; } }

/* ---- pastki tugmalar */
#ctl { display: flex; justify-content: center; gap: 10px; padding: 10px 0 2px; }
.pill { display: inline-flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 20px 0 10px; border: 1px solid var(--line2); border-radius: 999px; background: var(--sur); color: var(--fg); cursor: pointer; font: inherit; transition: transform .08s, background .15s, border-color .2s, box-shadow .3s; }
.pill:hover { background: var(--sur2); }
.pill:active { transform: scale(.97); }
.pill.ghost { padding: 0 18px; background: transparent; color: var(--mut); font-weight: 650; }
.pill.solid { padding: 0 22px; background: var(--acc); border-color: transparent; color: var(--acc-ink); font-weight: 750; }
.pill.solid svg { width: 18px; height: 18px; }
#hintRing { position: relative; width: 34px; height: 34px; flex: none; }
#hintRing svg.rg { position: absolute; inset: 0; width: 34px; height: 34px; transform: rotate(-90deg); }
#hintRing svg.ic { position: absolute; inset: 8px; width: 18px; height: 18px; color: var(--mut); }
#hintRing .seg { fill: none; stroke: var(--line2); stroke-width: 3.2; stroke-linecap: round; }
#hintRing .seg.on { stroke: var(--br); }
#hintRing b { position: absolute; right: -5px; top: -5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--br); color: var(--br-ink); font-size: 11px; font-weight: 800; line-height: 17px; text-align: center; }
.hl { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; text-align: left; }
.hl b { font-weight: 750; font-size: 15px; }
.hl small { color: var(--mut); font-size: 12px; font-weight: 600; }
#bHint.ready { border-color: color-mix(in srgb, var(--br) 70%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--br) 16%, transparent); }
#bHint.ready #hintRing svg.ic { color: var(--br); }
#bHint.off { opacity: .55; }

/* ---- varaq (natija, arxiv) */
#sheet { position: fixed; inset: 0; z-index: 60; display: grid; align-items: end; justify-items: center; background: rgba(4,8,9,.55); animation: gu-fade .18s ease; }
:root[data-theme="light"] #sheet { background: rgba(30,26,16,.32); }
#sheet.closing { animation: iz-fadeout .2s ease forwards; pointer-events: none; } /* yopilayotgan varaq taxtaga teginishni to‘smasin */
#sheet > .sh { position: relative; width: min(560px, 100%); max-height: calc(100% - 24px - env(safe-area-inset-top)); overflow: auto; overscroll-behavior: contain; padding: 22px max(18px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); background: var(--sur); border: 1px solid var(--line2); border-bottom: 0; border-radius: 24px 24px 0 0; box-shadow: 0 -20px 60px var(--shadow); animation: iz-up .3s cubic-bezier(.2,.8,.25,1); }
#sheet.closing > .sh { animation: iz-down .2s ease forwards; }
@media (min-width: 700px) and (min-height: 620px) { /* kompyuterda varaq — markazdagi oyna */
  #sheet { align-items: center; padding: 20px; }
  #sheet > .sh { max-height: calc(100% - 40px); border-bottom: 1px solid var(--line2); border-radius: 24px; padding-bottom: 22px; }
}
@keyframes iz-up { from { transform: translateY(40px); opacity: 0; } }
@keyframes iz-down { to { transform: translateY(40px); opacity: 0; } }
@keyframes iz-fadeout { to { opacity: 0; } }
.sh-x { position: absolute; top: 10px; right: 10px; }
.sh h2 { margin: 2px 44px 4px 0; font: 600 28px/1.1 var(--serif); letter-spacing: -.01em; }
.sh .sh-sub { margin: 0 0 14px; color: var(--mut); font-size: 14px; }
.sh .sh-sub b { color: var(--fg); font-weight: 650; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.chips span { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--tw); color: var(--tw-ink); font-size: 13px; font-weight: 800; letter-spacing: .05em; animation: iz-up .3s ease both; animation-delay: calc(var(--i) * 40ms); }
.chips span.b { background: var(--br); color: var(--br-ink); }
.chips span.h { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--br) 85%, black); }
.st4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 14px; }
.st4 > div { padding: 10px 6px 9px; border-radius: 14px; background: var(--sur2); text-align: center; }
.st4 b { display: block; font-size: 21px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.st4 small { display: block; margin-top: 2px; color: var(--mut); font-size: 11.5px; font-weight: 650; line-height: 1.2; }
.st4 b svg { width: 16px; height: 16px; margin-right: 2px; color: var(--br); vertical-align: -1px; }
.acts { display: flex; gap: 8px; margin: 4px 0 12px; }
.acts .pill { flex: 1; justify-content: center; padding: 0 14px; font-weight: 700; }
.acts .pill svg { width: 18px; height: 18px; }
.nextp { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; border-radius: 14px; border: 1px dashed var(--line2); color: var(--mut); font-size: 13.5px; font-weight: 600; }
.nextp b { color: var(--fg); font-size: 17px; font-variant-numeric: tabular-nums; }
.sh-ad { margin-top: 12px; }
/* arxiv ro‘yxati */
.arch { display: grid; gap: 6px; margin-top: 4px; }
.arch button { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; min-height: 58px; padding: 8px 14px 8px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--sur2); color: var(--fg); text-align: left; cursor: pointer; font: inherit; }
.arch button:hover { border-color: var(--line2); }
.arch button.cur { border-color: color-mix(in srgb, var(--acc) 60%, transparent); }
.arch .n { font-weight: 800; font-size: 17px; color: var(--mut); text-align: center; font-variant-numeric: tabular-nums; }
.arch .c { min-width: 0; font: 600 16.5px/1.2 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arch .c small { display: block; margin-top: 2px; font: 600 12px/1.2 var(--font); color: var(--mut); }
.arch .s { color: var(--mut); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.arch .s.ok { color: var(--acc-text); }
.arch .s svg { width: 20px; height: 20px; vertical-align: middle; }
.note { margin: 8px 0 12px; color: var(--mut); font-size: 13px; }
/* sozlamalar */
.sg-l { display: block; margin: 14px 0 6px; color: var(--mut); font-size: 11.5px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.sg-l:first-child { margin-top: 0; }
.sg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 3px; border-radius: 13px; background: var(--sur2); border: 1px solid var(--line); }
.sg button { min-height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--mut); font-weight: 650; font-size: 14px; cursor: pointer; }
.sg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.opt b { display: block; font-size: 15px; }
.opt small { color: var(--mut); font-size: 12.5px; }
.sw { position: relative; width: 50px; height: 30px; flex: none; border: 0; border-radius: 99px; background: var(--sur3); cursor: pointer; transition: background .2s; }
.sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.sw[aria-checked="true"] { background: var(--acc); }
.sw[aria-checked="true"]::after { transform: translateX(20px); }
.lnk { margin-top: 16px; padding: 0; border: 0; background: none; color: var(--acc-text); font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.cr { color: var(--mut); font-size: 13.5px; line-height: 1.5; }
.cr a { color: var(--acc-text); }
/* qo‘llanma */
.hw svg { display: block; width: 100%; max-width: 300px; height: auto; margin: 2px auto 12px; }
.hw ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.hw li { position: relative; padding-left: 22px; color: var(--fg); font-size: 14.5px; line-height: 1.4; }
.hw li::before { content: ""; position: absolute; left: 4px; top: .5em; width: 9px; height: 9px; border-radius: 50%; background: var(--tw); }
.hw li.b::before { background: var(--br); }
.hw li.s::before { background: var(--sel); box-shadow: 0 0 0 1px var(--line2); }
.hw .hd { stroke-dasharray: 260; stroke-dashoffset: 260; animation: iz-draw 3.6s ease-in-out infinite; }
@keyframes iz-draw { 0% { stroke-dashoffset: 260; } 45%, 85% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.gu-modal > div { background: var(--sur); }
.gu-modal .gu-btn.primary { background: var(--acc); color: var(--acc-ink); }
.gu-toast { background: var(--fg); color: var(--bg); }
.load { display: grid; place-items: center; color: var(--mut); font-size: 14px; }

/* ---- landshaft va keng ekran: chapda mavzu va boshqaruv, o‘ngda taxta */
@media (min-aspect-ratio: 11/10) and (min-width: 600px) {
  #app { max-width: 1060px; column-gap: clamp(18px, 4vw, 56px); grid-template-columns: minmax(270px, 360px) minmax(0, 1fr);
    grid-template-rows: auto auto auto auto auto minmax(0, 1fr); align-content: stretch;
    grid-template-areas: "top board" "theme board" "prog board" "word board" "ctl board" "found board";
    padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); justify-content: center; }
  #top { margin: 0 -8px 2px; }
  #theme { margin-top: 6px; padding: 18px 18px 19px; text-align: left; }
  #clue { font-size: clamp(22px, 2.6vw, 30px); }
  #prog { justify-content: flex-start; margin-top: 12px; }
  #word { align-items: flex-start; height: 62px; margin-top: 4px; }
  #ctl { justify-content: flex-start; padding-top: 6px; flex-wrap: wrap; }
  #boardWrap { padding: 8px 0; }
  #found:not([hidden]) { display: block; grid-area: found; min-height: 0; overflow: auto; padding-top: 20px; }
  #found .lab { color: var(--mut); margin-bottom: 8px; }
  #found .chips span { height: 28px; font-size: 12.5px; animation: none; }
}
@media (min-aspect-ratio: 11/10) and (max-height: 500px) { #found:not([hidden]) { padding-top: 10px; } #found .lab { display: none; } }
/* past landshaft telefon: sarlavha ixcham */
@media (min-aspect-ratio: 11/10) and (max-height: 500px) {
  #top { height: 46px; }
  #theme { padding: 10px 14px; }
  #clue { font-size: 20px; }
  #prog { margin-top: 6px; }
  #word { height: 50px; }
  #wordTxt { font-size: 22px; }
  .pill { min-height: 46px; }
}
/* juda past portret (360×640): bo‘sh joy tejaladi */
@media (max-aspect-ratio: 11/10) and (max-height: 700px) {
  #top { height: 48px; }
  #theme { padding: 8px 14px 9px; border-radius: 15px; }
  #clue { font-size: clamp(18px, 5vw, 21px); }
  #prog { margin-top: 4px; min-height: 26px; }
  #word { height: 46px; }
  #wordTxt { font-size: 22px; }
  #ctl { padding-top: 6px; }
  .pill { min-height: 46px; }
}

/* ---- muqova rejimi (tools/seo/shot-izlar.mjs) */
body.shot.boardonly #top, body.shot.boardonly #theme, body.shot.boardonly #prog, body.shot.boardonly #word, body.shot.boardonly #ctl, body.shot.boardonly #found { display: none !important; }
body.shot.boardonly #app { grid-template-areas: "board"; grid-template-rows: 1fr; grid-template-columns: 1fr; max-width: none; padding: 0; }
body.shot.boardonly #boardWrap { overflow: hidden; padding: 0; }
@media (prefers-reduced-motion: reduce) { #board .hn circle { animation: none; } }
