/* ==========================================================================
   BLOK-SXEMA
   Vertikal oqim: tugunlar markazda, orasida bog'lovchi chiziq va strelka.
   Tarmoq qatori gorizontal shox + har ustunga tushuvchi chiziq bilan chiziladi.
   ========================================================================== */

.sxema-page {
    --sx-line: rgba(139, 146, 248, 0.55);
}

.sxema-loading,
.sxema-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: 3rem 1rem;
    color: var(--text-tertiary);
    font-size: .95rem;
}
.sxema-loading svg { width: 18px; height: 18px; }

.sxema {
    margin: 0 auto;
    max-width: 880px;
    padding: clamp(1.5rem, 3vw, 2.5rem) clamp(1rem, 3vw, 2.5rem) clamp(2rem, 4vw, 3rem);
    border-radius: var(--radius-2xl);
    background: var(--qogoz-2);
    border: 1px solid var(--chiziq);
    box-shadow: var(--shadow-sm);
}

.sxema__head {
    text-align: center;
    margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}
.sxema__head h2 {
    font-family: var(--font-display);
    font-size: clamp(1.15rem, 2.2vw, 1.55rem);
    margin: 0 0 .5rem;
    color: var(--siyoh);
}
.sxema__head p {
    margin: 0 auto;
    max-width: 56ch;
    font-size: .92rem;
    line-height: 1.6;
    color: var(--text-tertiary);
}

.sxema__flow {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* --- bog'lovchi chiziq --- */
.sx-link {
    position: relative;
    width: 2px;
    height: 30px;
    flex-shrink: 0;
    background: var(--sx-line);
}
.sx-link::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 7px solid var(--sx-line);
}
/* Tarmoqqa kirishda strelka kerak emas — u yerda shox boshlanadi */
.sx-link--short { height: 22px; }
.sx-link--short::after { display: none; }

/* --- tugunlar --- */
.sx-node {
    max-width: 100%;
    text-align: center;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    background: var(--surface-glass);
    border: 1px solid var(--surface-glass-border);
    color: var(--text-primary);
}

.sx-node--root {
    font-family: var(--font-display);
    font-size: clamp(1rem, 2vw, 1.2rem);
    font-weight: 700;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 1.15rem 2rem;
    background: linear-gradient(135deg, rgba(29, 95, 214, 0.3), rgba(29, 95, 214, 0.1));
    border-color: rgba(29, 95, 214, 0.45);
    box-shadow: 0 0 34px rgba(29, 95, 214, 0.16);
}

.sx-node--text {
    font-size: 1rem;
    line-height: 1.5;
    max-width: 32rem;
    color: var(--text-secondary);
}

/* bosqich nomi — tugun emas, belgi */
.sx-stage {
    font-family: var(--font-display);
    font-size: .76rem;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    padding: .45rem 1.15rem;
    border-radius: var(--radius-pill);
    color: var(--color-accent);
    background: rgba(217, 152, 26, 0.1);
    border: 1px solid rgba(217, 152, 26, 0.34);
}

/* --- tarmoq qatori --- */
.sx-branch {
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--n, 3), 1fr);
    gap: 1rem;
    width: 100%;
    padding-top: 34px;
}
/* gorizontal shox — birinchi va oxirgi ustun markazlari orasida */
.sx-branch::before {
    content: '';
    position: absolute;
    top: 0;
    left: calc(50% / var(--n, 3));
    right: calc(50% / var(--n, 3));
    height: 2px;
    background: var(--sx-line);
}
.sx-branch__col {
    position: relative;
    display: flex;
}
/* shoxdan kartaga tushuvchi chiziq */
.sx-branch__col::before {
    content: '';
    position: absolute;
    top: -34px;
    left: 50%;
    margin-left: -1px;
    width: 2px;
    height: 34px;
    background: var(--sx-line);
}
.sx-branch__col::after {
    content: '';
    position: absolute;
    top: -9px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 7px solid var(--sx-line);
}

.sx-node--branch {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(160deg, rgba(111, 79, 216, 0.10), transparent 70%), var(--qogoz-2);
    border-color: rgba(111, 79, 216, 0.30);
}
.sx-node--branch b { font-size: .95rem; font-weight: 600; line-height: 1.35; }
.sx-node--branch span { font-size: .85rem; color: var(--text-tertiary); }
/* shartli tarmoq belgisi (Ha / Yo'q) */
.sx-node__tag {
    align-self: center;
    font-style: normal;
    font-family: var(--font-display);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    padding: .15rem .6rem;
    border-radius: var(--radius-pill);
    color: var(--color-accent);
    background: rgba(217, 152, 26, 0.12);
    border: 1px solid rgba(217, 152, 26, 0.35);
}

/* --- sanab o'tilgan tushunchalar --- */
.sx-chips {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .8rem;
    width: 100%;
    max-width: 40rem;
    padding: 1.15rem 1.25rem;
    border-radius: var(--radius-lg);
    background: rgba(15, 31, 56, 0.035);
    border: 1px dashed var(--surface-glass-border);
}
.sx-chips__label {
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}
.sx-chips__list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem;
    margin: 0;
    padding: 0;
}
.sx-chip {
    display: inline-block;
    font-size: .88rem;
    font-weight: 500;
    padding: .4rem .9rem;
    border-radius: var(--radius-pill);
    color: var(--color-primary-lighter);
    background: rgba(43, 148, 87, 0.1);
    border: 1px solid rgba(43, 148, 87, 0.28);
}

/* --- yakuniy natija --- */
.sx-node--result {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    font-family: var(--font-display);
    font-size: clamp(1rem, 2vw, 1.18rem);
    font-weight: 700;
    padding: 1rem 1.8rem;
    color: var(--surface-canvas);
    background: var(--gradient-primary);
    border: 0;
    box-shadow: var(--shadow-glow);
}
.sx-node--result svg { width: 20px; height: 20px; flex-shrink: 0; }


/* === RESPONSIVE === */
@media screen and (max-width: 680px) {
    .sx-branch {
        grid-template-columns: 1fr;
        gap: 0;
        padding-top: 0;
    }
    .sx-branch::before { display: none; }
    .sx-branch__col::before,
    .sx-branch__col::after { display: none; }
    /* ustma-ust turgan kartalar orasiga qisqa bog'lovchi */
    .sx-branch__col + .sx-branch__col { margin-top: 26px; }
    .sx-branch__col + .sx-branch__col::before {
        display: block;
        top: -26px;
        height: 26px;
    }
    .sx-branch__col + .sx-branch__col::after {
        display: block;
        top: -8px;
    }
    .sx-node { padding: .9rem 1.1rem; }
}


/* ==========================================================================
   ISH STOLI (.sxy) — bitta ekran: yuqorida sarlavha, pastda taxta + yon panel.
   Rejim: [data-mode="yigish"] — skelet + bloklar;  [data-mode="korish"] — tayyor sxema.
   Taxtadagi chizma 800px tabiiy kenglikda, JS (_fit) uni ekranga masshtablaydi.
   ========================================================================== */
.sxy {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--navbar-height));
    min-height: 560px;
    padding: .75rem 0 1rem;
}
.sxy__container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    max-width: 1440px;
}
.sxy__head { flex-shrink: 0; }
.sxy__head .breadcrumb--tight { margin-bottom: .5rem !important; }
.sxy__head .xarita-bar { margin-bottom: .75rem; align-items: center; }
.sxy__head .xarita-bar__title { gap: .35rem; }
.sxy__head .xarita-bar__title h1 { font-size: clamp(1rem, 1.5vw, 1.25rem); }

.sxy__body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 1rem;
}

/* --- taxta --- */
.sxy__board {
    position: relative;
    min-height: 0;
    overflow: hidden;
    border-radius: var(--radius-2xl);
    background: var(--qogoz-2);
    border: 1px solid var(--chiziq);
    box-shadow: var(--shadow-sm);
}
.sxy__canvas {
    width: 800px;
    max-width: 100%;
    margin: 0 auto;
    transform-origin: top center;
    will-change: transform;
}
/* chizma endi panel emas — taxtaning o'zi panel */
.sxy .sxema {
    max-width: none;
    padding: 1.1rem 1.25rem 1.25rem;
    background: none;
    border: 0;
    border-radius: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.sxema__head--print { display: none; }
/* ekranda bo'shliqlar ixcham — sxema kattaroq masshtabda sig'adi (shriftlar o'zgarmaydi) */
.sxy .sx-link { height: 18px; }
.sxy .sx-link--short { height: 14px; }
.sxy .sx-branch { padding-top: 22px; gap: .75rem; }
.sxy .sx-branch__col::before { top: -22px; height: 22px; }
.sxy .sx-node { padding: .75rem 1.2rem; }
.sxy .sx-node--root { padding: .85rem 1.5rem; }
.sxy .sx-node--branch { padding: .75rem .9rem; }
.sxy .sx-node--result { padding: .8rem 1.5rem; }
.sxy .sx-stage { padding: .35rem 1rem; }
.sxy .sx-chips { padding: .8rem 1rem; gap: .55rem; }

/* --- yon panel (ikkala rejimda) --- */
.sxy__side { min-height: 0; display: flex; flex-direction: column; }
.sxy__panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: .85rem;
    padding: 1.1rem 1.15rem;
    border-radius: var(--radius-2xl);
    background: var(--surface-glass);
    border: 1px solid var(--surface-glass-border);
    backdrop-filter: blur(var(--blur-md));
    -webkit-backdrop-filter: blur(var(--blur-md));
}
.sxy__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--color-secondary-light);
}
.sxy__eyebrow svg { width: 14px; height: 14px; }
.sxy__panel-head h2 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    line-height: 1.3;
    margin: .55rem 0 .4rem;
}
.sxy__panel-head p {
    margin: 0;
    font-size: .9rem;
    line-height: 1.6;
    color: var(--text-secondary);
}
.sxy__facts {
    list-style: none;
    display: flex;
    gap: 1.75rem;
    margin: 0;
    padding: .9rem 0;
    border-top: 1px solid var(--surface-glass-border);
    border-bottom: 1px solid var(--surface-glass-border);
}
.sxy__facts b {
    display: block;
    font-family: var(--font-display);
    font-size: 1.6rem;
    line-height: 1.1;
    color: var(--siyoh);
}
.sxy__facts span { font-size: .78rem; color: var(--text-tertiary); }
.sxy__panel-foot { margin-top: auto; display: flex; flex-direction: column; gap: .6rem; }
.sxy__hint { margin: 0; font-size: .8rem; line-height: 1.5; color: var(--text-tertiary); }

/* --- bloklar panelidagi boshqaruv --- */
.sxy__tray-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.sxy__progress {
    font-family: var(--font-display);
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.sxy__pieces {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: .5rem;
    padding: .3rem;
    margin: 0 -.3rem;
    scrollbar-width: thin;
}
.sxy__pieces.is-empty::before {
    content: "Barcha bloklar taxtada — endi tekshiring.";
    font-size: .85rem;
    color: var(--text-tertiary);
    padding: .5rem .25rem;
}
.sxy__tray-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.sxy__tray-actions .btn { padding: .7rem 1.2rem; font-size: .9rem; }
.sxy__tray-actions .btn svg { width: 16px; height: 16px; }
[data-action="check"].is-ready { animation: sxy-pulse 1.6s ease-in-out infinite; }

/* --- bloklar --- */
.sxy-piece {
    appearance: none;
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    text-align: inherit;
    display: block;
    max-width: 100%;
    border-radius: var(--radius-lg);
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    transition: transform .2s var(--ease-out), opacity .2s ease, filter .2s ease;
}
.sxy-piece > * { pointer-events: none; }
.sxy-piece:active { cursor: grabbing; }
.sxy-piece:hover { transform: translateY(-2px); filter: brightness(1.08); }
.sxy-piece:focus-visible { outline: 2px solid var(--color-primary-light); outline-offset: 3px; }
.sxy-piece.is-selected > * {
    box-shadow: 0 0 0 2px var(--color-primary-light), 0 0 24px rgba(29, 95, 214, 0.45);
}
.sxy-piece.is-dragging { opacity: .3; }
.sxy-piece.is-locked { cursor: default; }
.sxy-piece.is-locked:hover { transform: none; filter: none; }
/* trayda bloklar ixchamroq — ustun tor */
.sxy__pieces .sx-node { padding: .7rem 1rem; }
.sxy__pieces .sx-node--root { font-size: .92rem; padding: .75rem 1.05rem; }
.sxy__pieces .sx-node--text { max-width: 100%; font-size: .92rem; }
.sxy__pieces .sx-node--branch { width: auto; }
.sxy__pieces .sx-node--result { font-size: 1rem; padding: .7rem 1.2rem; }

/* sudralayotgan nusxa */
.sxy-ghost {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    pointer-events: none;
    transform-origin: top left;
    filter: drop-shadow(0 18px 28px rgba(15, 31, 56, 0.55));
    opacity: .96;
}

/* --- uyalar --- */
.sxy-slot {
    position: relative;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    max-width: 100%;
    min-width: min(12rem, 100%);
    min-height: 2.9rem;
    border: 1.5px dashed rgba(15, 31, 56, 0.22);
    border-radius: var(--radius-lg);
    background: rgba(15, 31, 56, 0.025);
    outline: none;
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s var(--ease-out);
}
.sxy-slot--root   { min-width: min(24rem, 100%); min-height: 3.3rem; border-color: rgba(29, 95, 214, 0.35); }
.sxy-slot--stage  { min-width: 9rem;  min-height: 1.95rem; border-radius: var(--radius-pill); border-color: rgba(217, 152, 26, 0.38); }
.sxy-slot--text   { min-width: min(26rem, 100%); min-height: 2.9rem; }
.sxy-slot--branch { width: 100%; min-width: 0; min-height: 3.2rem; border-color: rgba(167, 139, 250, 0.38); }
.sxy-slot--chip   { min-width: 5.5rem; min-height: 2rem; border-radius: var(--radius-pill); border-color: rgba(43, 148, 87, 0.32); }
.sxy-slot--result { min-width: min(15rem, 100%); min-height: 3.1rem; border-color: rgba(29, 95, 214, 0.45); }

.sxy-slot.is-filled { border-color: transparent; background: none; min-width: 0; min-height: 0; }
.sxy-slot--branch .sxy-piece,
.sxy-slot--branch .sx-node--branch { width: 100%; }

.sxy-slot.is-target {
    border-color: var(--color-primary-light);
    background: rgba(29, 95, 214, 0.06);
    animation: sxy-breathe 1.4s ease-in-out infinite;
}
.sxy-slot.is-over {
    border-style: solid;
    border-color: var(--color-primary-light);
    background: rgba(29, 95, 214, 0.14);
    box-shadow: 0 0 28px rgba(29, 95, 214, 0.35);
    transform: scale(1.03);
    animation: none;
}
.sxy-slot.is-over-bad {
    border-color: #cf4a37;
    background: rgba(207, 74, 55, 0.08);
}
.sxy-slot:focus-visible {
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(29, 95, 214, 0.25);
}
.sxy-slot.is-shake { animation: sxy-shake .4s ease; }

/* tekshirish natijalari */
.sxy-slot.is-ok > .sxy-piece > * {
    box-shadow: 0 0 0 2px #2b9457, 0 0 22px rgba(43, 148, 87, 0.35);
}
.sxy-slot.is-ok::after {
    content: '';
    position: absolute;
    top: -7px;
    right: -7px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #2b9457 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23052e1f' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>") center / 10px no-repeat;
    box-shadow: 0 2px 8px rgba(15, 31, 56, 0.16);
    animation: sxy-pop .35s var(--ease-spring) both;
}
.sxy-slot.is-xato > .sxy-piece > * {
    box-shadow: 0 0 0 2px #cf4a37, 0 0 22px rgba(207, 74, 55, 0.35);
}
.sxy-slot.is-xato { animation: sxy-shake .5s ease; }
.sxy-slot.is-bosh {
    border-color: var(--color-accent);
    background: rgba(217, 152, 26, 0.08);
    animation: sxy-breathe-accent 1.2s ease-in-out 3;
}

/* xulosa */
.sxy__verdict {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    padding: .8rem .9rem;
    border-radius: var(--radius-lg);
    font-size: .85rem;
    background: rgba(207, 74, 55, 0.08);
    border: 1px solid rgba(207, 74, 55, 0.3);
    animation: dm-rise .4s var(--ease-out) both;
}
.sxy__verdict svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px; color: #cf4a37; }
.sxy__verdict b { display: block; font-size: .95rem; margin-bottom: 2px; }
.sxy__verdict span { color: var(--text-secondary); line-height: 1.45; }
.sxy__verdict.is-win { background: rgba(43, 148, 87, 0.1); border-color: rgba(43, 148, 87, 0.4); }
.sxy__verdict.is-win svg { color: #2b9457; }

/* yakun: chiziqlar yuqoridan pastga ketma-ket yonadi, natija porlaydi */
.sxy.is-complete .sx-link {
    animation: sxy-light .5s var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 110ms);
}
.sxy.is-complete .sx-link::after {
    border-top-color: var(--color-primary-light);
    transition: border-top-color .4s ease calc(var(--i, 0) * 110ms);
}
.sxy.is-complete .sx-branch::before,
.sxy.is-complete .sx-branch__col::before { background: var(--color-primary-light); transition: background .5s ease .6s; }
.sxy.is-complete .sx-branch__col::after { border-top-color: var(--color-primary-light); transition: border-top-color .5s ease .6s; }
.sxy.is-complete .sxy-slot--result .sx-node--result { animation: sxy-pulse 1.4s ease-in-out 3 1.2s; }

/* --- rejim tugmalari --- */
.sxy-modes {
    display: inline-flex;
    gap: .2rem;
    padding: .25rem;
    border-radius: var(--radius-pill);
    background: rgba(15, 31, 56, 0.16);
    border: 1px solid var(--surface-glass-border);
}
.sxy-modes__btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem .95rem;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: .85rem;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}
.sxy-modes__btn svg { width: 15px; height: 15px; }
.sxy-modes__btn:hover { color: var(--text-primary); }
.sxy-modes__btn.is-active {
    background: var(--gradient-primary);
    color: var(--surface-canvas);
    box-shadow: 0 6px 18px rgba(29, 95, 214, 0.3);
}
/* javob hali yopiq — tekshiruvdan keyin ochiladi */
.sxy-modes__btn.is-locked,
.xarita-act.is-locked {
    opacity: .4;
    cursor: not-allowed;
    filter: grayscale(.4);
}
.sxy-modes__btn.is-locked:hover { color: var(--text-secondary); }
.xarita-act.is-locked:hover { transform: none; box-shadow: none; }

/* xulosa ichidagi "Tayyor sxemani ko'rish" */
.sxy__verdict-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-top: .55rem;
    padding: .45rem .85rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--surface-glass-border-strong);
    background: rgba(15, 31, 56, 0.06);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: .82rem;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, transform .2s var(--ease-out);
}
.sxy__verdict-btn svg { width: 14px; height: 14px; color: var(--color-primary-light); }
.sxy__verdict-btn:hover {
    background: rgba(29, 95, 214, 0.14);
    border-color: rgba(29, 95, 214, 0.5);
    transform: translateY(-1px);
}

/* ekran ostidagi bloklar (oldingi/keyingi, boshqa materiallar) */
.sxema-after { padding: 1.5rem 0 clamp(3rem, 6vw, 5rem); }

@keyframes sxy-breathe {
    0%, 100% { box-shadow: 0 0 0 3px rgba(29, 95, 214, 0.1); }
    50%      { box-shadow: 0 0 0 7px rgba(29, 95, 214, 0.22); }
}
@keyframes sxy-breathe-accent {
    0%, 100% { box-shadow: 0 0 0 3px rgba(217, 152, 26, 0.1); }
    50%      { box-shadow: 0 0 0 7px rgba(217, 152, 26, 0.25); }
}
@keyframes sxy-shake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-6px); }
    40%      { transform: translateX(6px); }
    60%      { transform: translateX(-4px); }
    80%      { transform: translateX(4px); }
}
@keyframes sxy-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.04); }
}
@keyframes sxy-pop {
    from { transform: scale(0); }
    to   { transform: scale(1); }
}
@keyframes sxy-light {
    to { background: var(--color-primary-light); }
}

/* --- responsive --- */
@media screen and (max-width: 1100px) {
    .sxy__body { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media screen and (max-width: 860px) {
    .sxy { height: auto; min-height: calc(100vh - var(--navbar-height)); }
    .sxy__body { grid-template-columns: 1fr; }
    /* taxta kenglik bo'yicha sig'adi, bo'yiga oshsa ichida suriladi */
    .sxy__board { height: 56vh; overflow-y: auto; scrollbar-width: thin; }
    .sxy__panel { flex: none; }
    .sxy__pieces { max-height: 30vh; }
    .sxy-modes__btn span { display: none; }
    .sxy-modes__btn { padding: .5rem .7rem; }
}


.sxy__print-foot { display: none; }

/* === CHOP ETISH ===
   Ikki qatlam:
   1) .sxy.is-qogoz — qog'oz JOYLASHUVI (kompakt bo'shliqlar, 718px kanvas, sarlavha bloki).
      JS uni chop etishdan oldin qo'yadi va shu holatda balandlikni O'LCHAB, kerak bo'lsa
      --print-zoom beradi — natija doim bitta A4 varaq. Shriftlar o'zgarmaydi.
   2) @media print — faqat ko'rinish: ortiqcha elementlar yashiriladi, ranglar oq-qora. */
@page { size: A4; margin: 10mm 12mm 12mm; }

/* --- 1) qog'oz joylashuvi --- */
.sxy.is-qogoz { height: auto; min-height: 0; display: block; padding: 0; }
.sxy.is-qogoz .sxy__container { display: block; max-width: none; padding: 0; }
.sxy.is-qogoz .sxy__body { display: block; }
.sxy.is-qogoz .sxy__board {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    border: 0;
    border-radius: 0;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.sxy.is-qogoz .sxy__canvas {
    transform: none !important;
    width: 718px;            /* A4 (210mm) − 24mm hoshiya ≈ 718px */
    max-width: 100%;
    margin: 0 !important;
    zoom: var(--print-zoom, 1);
}
.sxy.is-qogoz .sxy__side,
.sxy.is-qogoz .sxy-modes,
.sxy.is-qogoz .breadcrumb,
.sxy.is-qogoz .xarita-bar__actions { display: none !important; }
.sxy.is-qogoz .sxy__print-foot { display: flex; }

/* sarlavha bloki: yorliq → sarlavha → izoh, ostida ingichka chiziq */
.sxy.is-qogoz .xarita-bar { margin: 0; align-items: flex-start; }
.sxy.is-qogoz .xarita-bar__title { gap: .45rem; }
.sxy.is-qogoz .xarita-bar__title h1 { font-size: 1.4rem; line-height: 1.25; }
.sxy.is-qogoz .sxema__head--print {
    display: block;
    text-align: left;
    margin: .5rem 0 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid #ddd;
}
.sxy.is-qogoz .sxema__head--print h2 { display: none; } /* sarlavha bilan takror */
.sxy.is-qogoz .sxema__head--print p {
    margin: 0;
    max-width: none;
    font-size: .95rem;
    line-height: 1.55;
}

/* bo'shliqlar ixcham — shrift o'lchamlari o'zgarmaydi */
.sxy.is-qogoz .sxema { max-width: none; padding: 0; break-inside: avoid; }
.sxy.is-qogoz .sx-link { height: 20px; }
.sxy.is-qogoz .sx-link--short { height: 16px; }
.sxy.is-qogoz .sx-branch { padding-top: 24px; gap: .75rem; break-inside: avoid; }
.sxy.is-qogoz .sx-branch__col::before { top: -24px; height: 24px; }
.sxy.is-qogoz .sx-node { padding: .6rem 1.1rem; }
.sxy.is-qogoz .sx-node--root { padding: .75rem 1.4rem; }
.sxy.is-qogoz .sx-node--branch { padding: .7rem .9rem; gap: .2rem; }
.sxy.is-qogoz .sx-node--result { padding: .7rem 1.4rem; }
.sxy.is-qogoz .sx-stage { padding: .35rem 1rem; }
.sxy.is-qogoz .sx-chips { padding: .7rem 1rem; gap: .5rem; }

/* varaq ostidagi imzo-qator */
.sxy.is-qogoz .sxy__print-foot {
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.25rem;
    padding-top: .6rem;
    border-top: 1px solid #ddd;
    font-size: .78rem;
}

/* --- 2) qog'oz ko'rinishi --- */
@media print {
    .navbar,
    .footer,
    .bg-mesh,
    .scroll-top,
    .xarita-pager,
    .xarita-related,
    .sxema-after { display: none !important; }

    body { background: #fff !important; color: #111 !important; }
    .app-main { padding-top: 0 !important; min-height: 0 !important; }
    .sxema-page { --sx-line: #999; }

    .xarita-bar__title h1 {
        color: #111 !important;
        -webkit-text-fill-color: #111 !important;
        background: none !important;
    }
    .xarita-bar__badge { color: #444 !important; border-color: #bbb !important; background: none !important; }
    .sxema__head--print p { color: #444 !important; }
    .sxy__print-foot { color: #666 !important; }
    .sxy__print-foot b { color: #111 !important; font-weight: 600; }

    .sxema { background: #fff !important; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
    .sx-node,
    .sx-chips {
        background: #fff !important;
        border-color: #999 !important;
        color: #111 !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
    }
    .sx-node--text { color: #333 !important; }
    .sx-stage,
    .sx-chip,
    .sx-node__tag {
        background: #f3f3f3 !important;
        color: #111 !important;
        border-color: #999 !important;
    }
    .sx-node--result {
        background: #e9e9e9 !important;
        color: #111 !important;
        border: 1px solid #999 !important;
    }
    .sx-chips__label { color: #555 !important; }
    .sx-node--branch span { color: #555 !important; }
}
