/* ============================================================
   Tezyoz Poyga: sahifa uslublari (sayt o'zgaruvchilari, tekis ranglar)
   ============================================================ */
.tool-page.container { max-width: 1120px; }
.pg-intro { color: var(--muted); margin: 0 0 18px; max-width: 760px; }

.pg { position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow); color: var(--text); overflow: hidden; }
.pg [hidden] { display: none !important; }
.pg button { font-family: inherit; }
.pg-ic { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.pg-ic-s { width: 15px; height: 15px; vertical-align: -3px; }
.pg kbd { display: inline-block; font: 600 11px/1.5 var(--font-mono); padding: 0 6px; margin-left: 8px;
  border-radius: 5px; border: 1px solid currentColor; opacity: .7; }

/* --- yuqori panel --- */
.pg-top { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-bottom: 1px solid var(--border); }
.pg-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.pg-tab { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border: 0;
  border-radius: 10px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s, color .15s; }
.pg-tab:hover { color: var(--text); background: var(--bg); }
.pg-tab.on { background: var(--accent-soft); color: var(--accent); }
.pg-wallet { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.pg-coins { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px;
  background: var(--warn-bg); color: var(--warn); font-weight: 700; font-size: 14px; }
.pg-coins b { color: var(--text); font-family: var(--font-display); }
.pg-lv { display: inline-flex; flex-direction: column; gap: 4px; min-width: 92px; font-size: 12px; color: var(--muted); }
.pg-lv b { color: var(--text); font-family: var(--font-display); font-size: 14px; }
.pg-lv-bar { display: block; height: 5px; border-radius: 9px; background: var(--accent-soft); overflow: hidden; }
.pg-lv-bar b { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 9px; transition: width .6s; }

/* --- sahna --- */
.pg-arena { position: relative; }
.pg-stage { position: relative; height: clamp(220px, 34vw, 360px); background: #8fc7ea; overflow: hidden;
  user-select: none; -webkit-user-select: none; touch-action: manipulation; }
html[data-theme="dark"] .pg-stage { background: #1d2440; }
.pg-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pg-hud { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 2; pointer-events: none; }
.pg:not(.pg-racing) .pg-hud { display: none; }
.pg-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 10px; border-radius: 9px;
  background: rgba(16,18,28,.66); color: #fff; font-size: 11px; }
.pg-chip small { opacity: .75; text-transform: uppercase; letter-spacing: .06em; font-size: 10px; }
.pg-chip b { font-family: var(--font-display); font-size: 16px; font-variant-numeric: tabular-nums; }
.pg-sbtns { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; z-index: 2; }
.pg-rbtn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255,255,255,.2);
  background: rgba(16,18,28,.62); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.pg-rbtn:hover { background: rgba(16,18,28,.82); }
.pg-rbtn .pg-ic { width: 17px; height: 17px; }
.pg:not(.pg-racing) #pgPauseBtn, .pg.pg-done #pgPauseBtn { display: none; }
.pg-caps { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 3; display: none;
  padding: 6px 14px; border-radius: 999px; background: var(--warn); color: #fff; font-size: 12.5px; font-weight: 700;
  white-space: nowrap; max-width: 94%; overflow: hidden; text-overflow: ellipsis; }
.pg-caps.show { display: block; }
.pg-count { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; pointer-events: none;
  font-family: var(--font-display); font-weight: 800; font-size: clamp(44px, 8vw, 84px); line-height: 1; color: #fff;
  text-shadow: 0 3px 0 rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.35); opacity: 0; white-space: nowrap; }
.pg-count.show { opacity: 1; }
.pg-count.pop { animation: pgPop .5s cubic-bezier(.2,1.4,.4,1); }
.pg-count.go { color: #c9f7d9; }
.pg-count.win { color: #ffe08a; }
@keyframes pgPop { from { transform: translate(-50%, -50%) scale(.4); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }

/* --- menyu --- */
.pg-panel { padding: 16px 18px 18px; border-top: 1px solid var(--border); }
.pg-mrow { display: grid; grid-template-columns: auto 1fr; gap: 14px 26px; align-items: start; }
.pg-lbl { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin: 0 0 7px; }
.pg-seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); }
.pg-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 40px; padding: 8px 13px; border: 0;
  border-radius: 9px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; }
.pg-seg button:hover { color: var(--text); }
.pg-seg button.on { background: var(--accent); color: #fff; }
.pg-seg-sm button { padding: 6px 10px; font-size: 13px; }
.pg-lvdesc { margin-top: 7px; font-size: 13px; color: var(--muted); }
.pg-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.pg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 12px;
  font-size: 15.5px; font-weight: 700; cursor: pointer; border: 1px solid transparent; transition: transform .12s, background .15s, border-color .15s; }
.pg-btn:active { transform: translateY(1px); }
.pg-btn-main { background: var(--accent); color: #fff; }
.pg-btn-main:hover { background: var(--accent-hover); }
.pg-btn-sec { background: var(--surface); color: var(--text); border-color: var(--border); }
.pg-btn-sec:hover { border-color: var(--accent); color: var(--accent); }
.pg-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.pg-btn-main:disabled:hover { background: var(--accent); }
.pg-btn-sec:disabled:hover { border-color: var(--border); color: var(--text); }
.pg-hardinfo { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.pg-key { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 7px;
  border: 1px solid var(--border); border-bottom-width: 2px; background: var(--bg); color: var(--text);
  font: 700 14px/1 var(--font-mono); }
.pg-note { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* --- yozish maydoni --- */
.pg-tmeta, .pg-thint { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); }
.pg-tmeta { margin-bottom: 8px; font-weight: 600; }
.pg-thint { margin-top: 8px; }
.pg-text { position: relative; font-size: 22px; line-height: 1.75; max-height: calc(1.75em * 4 + 24px); overflow-y: auto;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--input-bg, var(--surface));
  color: var(--text); outline: none; word-break: normal; overscroll-behavior: contain; cursor: text; }
.pg-text .pg-w { display: inline-block; white-space: pre; border-radius: 5px; }
.pg-text .pg-w.cw { background: var(--accent-soft); }
.pg-text span span { border-radius: 3px; }
.pg-text .ok { color: var(--ok); }
.pg-text .bad { background: var(--err); color: #fff; }
.pg-text .cur { box-shadow: inset 2px 0 0 var(--accent); animation: pgCaret 1s steps(1) infinite; }
@keyframes pgCaret { 50% { box-shadow: inset 2px 0 0 transparent; } }
.pg-text.shake { animation: pgShake .18s linear; }
@keyframes pgShake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.pg-kbd { position: absolute; left: 50%; top: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; margin: 0;
  font-size: 16px; pointer-events: none; }
.pg-typing { position: relative; }

/* --- overlay (pauza, natija) --- */
.pg-overlay { position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center;
  padding: 18px; overflow-y: auto; background: var(--surface); background: color-mix(in srgb, var(--surface) 93%, transparent); }
.pg-ovbox { text-align: center; }
.pg-ovbox h3, .pg-res h3 { font-family: var(--font-display); font-size: 28px; margin: 0 0 14px; }
.pg-ovbtns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.pg-overlay.pg-result { position: static; display: block; padding: 18px 16px 20px; background: var(--surface); border-top: 1px solid var(--border); overflow: visible; }
.pg-result .pg-res { animation: pgToastIn .35s ease-out; }
.pg-res { width: 100%; max-width: 600px; margin: auto; text-align: center; }
.pg-res-h { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; }
.pg-res-h h3 { margin: 0; }
.pg-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  background: var(--warn-bg); color: var(--warn); font-weight: 700; font-size: 13px; }
.pg-badge .pg-ic { width: 15px; height: 15px; }
.pg-podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 16px auto 14px; max-width: 470px; }
.pg-pod { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.pg-podcv { width: 100%; max-width: 140px; height: 58px; display: block; }
.pg-pod-n { font-weight: 700; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-pod-w { font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.pg-pod-b { width: 100%; border-radius: 10px 10px 0 0; background: var(--accent-soft2); display: flex; justify-content: center;
  padding-top: 6px; font: 800 22px/1 var(--font-display); color: var(--accent); }
.pg-pod1 .pg-pod-b { height: 78px; }
.pg-pod2 .pg-pod-b { height: 56px; }
.pg-pod3 .pg-pod-b { height: 40px; }
.pg-pod.me .pg-pod-b { background: var(--accent); color: #fff; }
.pg-pod.me .pg-pod-n { color: var(--accent); }
.pg-res-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pg-res-stats div { padding: 10px 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.pg-res-stats b { display: block; font: 800 22px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.pg-res-stats small { color: var(--muted); font-size: 12px; }
.pg-res-rw { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pg-rw { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--accent-soft);
  color: var(--accent); font-weight: 600; font-size: 14px; }
.pg-rw b { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.pg-lvup { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 7px 14px; border-radius: 10px;
  background: var(--ok-bg); color: var(--ok); font-weight: 700; }
.pg-res-ach { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.pg-res-ach span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 9px;
  border: 1px solid var(--border); font-size: 13px; font-weight: 600; }
.pg-res-ach .pg-ic { color: var(--accent); width: 15px; height: 15px; }

/* --- garaj --- */
.pg-gar { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.pg-show { position: relative; min-height: 380px; border-right: 1px solid var(--border); overflow: hidden; touch-action: pan-y; }
.pg-show canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.pg-show canvas:active { cursor: grabbing; }
.pg-show-name { position: absolute; top: 14px; left: 16px; right: 16px; pointer-events: none; }
.pg-show-name b { display: block; font: 700 24px/1.15 var(--font-display); }
.pg-show-name span { color: var(--muted); font-size: 13.5px; }
.pg-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer; padding: 0; }
.pg-arrow:hover { border-color: var(--accent); color: var(--accent); }
.pg-arrow-l { left: 10px; }
.pg-arrow-r { right: 10px; }
.pg-show-hint { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font-size: 12px; color: var(--muted); pointer-events: none; padding: 0 12px; }
.pg-gside { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pg-vlist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 292px; overflow-y: auto; padding: 2px; }
.pg-vcard { display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 7px 8px 8px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-align: left; transition: border-color .15s; }
.pg-vcard:hover { border-color: var(--accent); }
.pg-vcard.on { border-color: var(--accent); background: var(--accent-soft); }
.pg-vcard.locked .pg-vthumb { opacity: .45; }
.pg-vthumb { width: 100%; height: 50px; display: block; }
.pg-vname { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-vst { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.pg-vst .pg-ic { width: 13px; height: 13px; }
.pg-vst.on { color: var(--accent); }
.pg-vst.price { color: var(--warn); }
.pg-gopt .pg-lbl { margin-top: 4px; }
.pg-swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.pg-sw { width: 28px; height: 28px; border-radius: 50%; background: var(--sw); border: 2px solid var(--border); cursor: pointer; padding: 0; }
.pg-sw.on { outline: 2px solid var(--accent); outline-offset: 2px; }
.pg-gact { width: 100%; }
.pg-fair { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* --- yutuqlar --- */
.pg-sech { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.pg-sech h3 { font-family: var(--font-display); font-size: 17px; margin: 0; }
.pg-sech > span { color: var(--muted); font-size: 13px; }
.pg-view[data-view="ach"] { padding: 16px; }
.pg-achs { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.pg-ach { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; }
.pg-achic { width: 40px; height: 40px; flex-shrink: 0; border-radius: 10px; background: var(--bg); color: var(--muted); display: grid; place-items: center; }
.pg-ach.on .pg-achic { background: var(--accent); color: #fff; }
.pg-ach b { display: block; font-size: 14.5px; }
.pg-ach p { margin: 2px 0 4px; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.pg-ach:not(.on) b { color: var(--muted); }
.pg-ach small { font-size: 11.5px; color: var(--muted); }
.pg-achbar { display: block; height: 4px; border-radius: 9px; background: var(--accent-soft); overflow: hidden; margin: 5px 0 3px; }
.pg-achbar b { display: block; height: 100%; background: var(--accent); }

/* --- statistika --- */
.pg-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 16px; }
.pg-card { padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; }
.pg-card b { display: block; font: 800 24px/1.15 var(--font-display); font-variant-numeric: tabular-nums; }
.pg-card small { color: var(--muted); font-size: 12.5px; }
.pg-box { padding: 4px 16px 18px; }
.pg-chart { position: relative; height: 230px; }
.pg-chart canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pg-legend { display: inline-flex; align-items: center; gap: 6px; }
.pg-legend i { display: inline-block; width: 12px; height: 4px; border-radius: 2px; }
.pg-legend .lg-w { background: var(--accent); }
.pg-legend .lg-a { background: var(--ok); opacity: .5; height: 9px; margin-left: 8px; }
.pg-hardl { display: flex; flex-wrap: wrap; gap: 8px; }
.pg-hl { min-width: 70px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; text-align: center; }
.pg-hl b { display: block; font: 700 24px/1.2 var(--font-mono); }
.pg-hl small { color: var(--err); font-size: 12px; font-weight: 600; }
.pg-empty { margin: 0; color: var(--muted); font-size: 14px; }
.pg-tbl { overflow-x: auto; }
.pg-tbl table { width: 100%; border-collapse: collapse; font-size: 14px; }
.pg-tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.pg-tbl td { padding: 7px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.pg-tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* --- toast --- */
.pg-toasts { position: fixed; right: 18px; bottom: 18px; z-index: 900; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.pg-toast { display: flex; align-items: center; gap: 10px; min-width: 220px; max-width: 320px; padding: 10px 14px 10px 10px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-hover);
  animation: pgToastIn .35s cubic-bezier(.2,1.2,.4,1); }
.pg-toast.out { opacity: 0; transform: translateY(8px); transition: opacity .4s, transform .4s; }
.pg-toast small { display: block; font-size: 11.5px; color: var(--muted); }
.pg-toast b { font-size: 14.5px; }
.pg-tic { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
@keyframes pgToastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* --- moslashuv --- */
@media (max-width: 900px) {
  .pg-gar { grid-template-columns: 1fr; }
  .pg-show { min-height: 260px; border-right: 0; border-bottom: 1px solid var(--border); }
  .pg-vlist { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .pg-top { flex-direction: column; align-items: stretch; padding: 8px; gap: 8px; }
  .pg-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; }
  .pg-tab { flex-direction: column; gap: 3px; padding: 7px 2px; font-size: 11px; }
  .pg-wallet { justify-content: space-between; }
  .pg-lv { flex-direction: row; align-items: center; gap: 8px; }
  .pg-lv-bar { width: 80px; }
  .pg-stage { height: 220px; }
  .pg.pg-racing .pg-stage { height: 164px; }
  .pg-arena { scroll-margin-top: 62px; }
  .pg-seg-lv button { padding: 8px 4px; min-width: 0; font-size: 13px; }
  .pg-seg-sm button { flex: 1 1 auto; }
  .pg-hud { gap: 4px; top: 6px; left: 6px; right: 84px; }
  .pg-chip { padding: 3px 7px; gap: 4px; }
  .pg-chip small { font-size: 8.5px; }
  .pg-chip b { font-size: 13px; }
  .pg-sbtns { top: 6px; right: 6px; }
  .pg-rbtn { width: 32px; height: 32px; }
  .pg-panel { padding: 12px; }
  .pg-mrow { grid-template-columns: 1fr; gap: 12px; }
  .pg-seg { display: flex; }
  .pg-seg button { flex: 1; padding: 8px 6px; }
  .pg-actions .pg-btn { flex: 1 1 100%; }
  .pg-text { font-size: 18px; max-height: calc(1.75em * 3 + 24px); padding: 8px 10px; }
  .pg-res-stats { grid-template-columns: repeat(2, 1fr); }
  .pg-res h3, .pg-ovbox h3 { font-size: 23px; }
  .pg-pod-b { font-size: 18px; }
  .pg-pod1 .pg-pod-b { height: 58px; }
  .pg-pod2 .pg-pod-b { height: 42px; }
  .pg-pod3 .pg-pod-b { height: 30px; }
  .pg-podcv { height: 44px; }
  .pg-vlist { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 250px; }
  .pg-show { min-height: 220px; }
  .pg-show-name b { font-size: 19px; }
  .pg-achs { grid-template-columns: 1fr; }
  .pg-view[data-view="ach"] { padding: 12px; }
  .pg-cards { grid-template-columns: repeat(2, 1fr); padding: 12px; gap: 8px; }
  .pg-card b { font-size: 20px; }
  .pg-box { padding: 4px 12px 14px; }
  .pg-chart { height: 190px; }
  .pg-toasts { left: 12px; right: 12px; bottom: 12px; align-items: center; }
}
@media (pointer: coarse) { .pg kbd { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .pg-count.pop, .pg-text.shake, .pg-toast { animation: none; }
}
