/* Oson Studio, Doska (onlayn oq taxta): umumiy uslublar (uz/ru/en) */
/* DOSKA, fullscreen */
body[data-page="doska.html"] .app-footer,
body[data-page="doska.html"] main.tool-page .breadcrumb,
body[data-page="doska.html"] main.tool-page .tool-head { display: none !important; }
body[data-page="doska.html"] main.tool-page {
  padding: 0 !important; max-width: none !important; width: 100%; margin: 0;
}

/* ===== FOKUS REJIMI: chap sidebar yashirin, tepada hamburger (3 chiziq) ===== */
.topbar { display: flex; }
.sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.16); }
.sidebar.open { transform: translateX(0); }
body.has-sidebar { padding-left: 0; padding-top: 0; }

.dk-fs {
  position: fixed; top: 60px; left: 0;
  right: 0; bottom: 0; background: var(--surface); overflow: hidden; z-index: 1;
}

.dk-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  cursor: crosshair; touch-action: none; background: var(--surface);
  background-image: radial-gradient(circle, rgba(0,0,0,0.06) 1px, transparent 1px);
  background-size: 24px 24px;
}
[data-theme="dark"] .dk-canvas {
  background-image: radial-gradient(circle, rgba(255,255,255,0.05) 1px, transparent 1px);
}
.dk-canvas.tool-select { cursor: default; }
.dk-canvas.panning { cursor: grabbing; }
/* Qalam (pen), uchi pastki-chapda, hotspot o'sha yerda */
.dk-canvas.tool-pen { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M13.53 7.07 15.65 4.95 19.05 8.35 16.93 10.47Z' fill='%23F19CB6' stroke='%238a4a63' stroke-width='0.5' stroke-linejoin='round'/%3E%3Cpath d='M12.11 8.49 13.53 7.07 16.93 10.47 15.51 11.89Z' fill='%23C9CED6' stroke='%237f858f' stroke-width='0.5' stroke-linejoin='round'/%3E%3Cpath d='M5.54 18.46 13.81 10.19 15.51 11.89 7.24 20.16Z' fill='%23E0A81E' stroke='%238a6a12' stroke-width='0.5' stroke-linejoin='round'/%3E%3Cpath d='M3.84 16.76 12.11 8.49 13.81 10.19 5.54 18.46Z' fill='%23F6C445' stroke='%238a6a12' stroke-width='0.5' stroke-linejoin='round'/%3E%3Cpath d='M3.84 16.76 7.24 20.16 4.55 20.73 3.27 19.45Z' fill='%23E9C69B' stroke='%23a9814f' stroke-width='0.5' stroke-linejoin='round'/%3E%3Cpath d='M3.27 19.45 4.55 20.73 2.5 21.5Z' fill='%233B3B3B' stroke='%231f1f1f' stroke-width='0.4' stroke-linejoin='round'/%3E%3C/svg%3E") 3 21, crosshair; }
/* O'chirg'ich (eraser), ishchi burchagi pastki-chapda */
.dk-canvas.tool-eraser { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M7 20.5 2.9 16.4a1.5 1.5 0 0 1 0-2.1l8.8-8.8a1.5 1.5 0 0 1 2.1 0l5 5a1.5 1.5 0 0 1 0 2.1L12.5 20.5z' fill='%23a5b4fc' stroke='%23ffffff' stroke-width='1.3' stroke-linejoin='round'/%3E%3C/svg%3E") 5 19, cell; }
.dk-canvas.tool-text { cursor: text; }
.dk-canvas.tool-hand { cursor: grab; }
.dk-canvas.tool-hand.panning { cursor: grabbing; }
.dk-canvas.tool-laser { cursor: crosshair; }
.dk-canvas.no-grid { background-image: none; }

/* SPOTLIGHT */
.dk-spotlight {
  position: fixed; inset: 0; pointer-events: none; z-index: 50;
  opacity: 0; transition: opacity .25s ease;
  background: radial-gradient(circle 160px at 50% 50%, transparent 0%, transparent 55%, rgba(0,0,0,0.78) 100%);
}
.dk-spotlight.on { opacity: 1; }
[data-theme="dark"] .dk-spotlight {
  background: radial-gradient(circle 160px at 50% 50%, transparent 0%, transparent 55%, rgba(0,0,0,0.92) 100%);
}
#dkSpotlightBtn.spot-on { background: #fee2e2; border-color: #ef4444; color: #ef4444; }
[data-theme="dark"] #dkSpotlightBtn.spot-on { background: rgba(239,68,68,0.18); }

/* HELP DIALOG */
.dk-help {
  position: fixed; inset: 0; z-index: 200;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(3px);
}
.dk-help.show { display: flex; }
.dk-help-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 22px;
  max-width: 560px; width: 100%;
  max-height: 80vh; overflow-y: auto;
  box-shadow: 0 24px 60px -10px rgba(0,0,0,0.35);
}
.dk-help h3 { margin: 0 0 14px; font-size: 16px; }
.dk-help h4 { margin: 16px 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.dk-help-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.dk-help-row:last-child { border-bottom: none; }
.dk-help-row kbd {
  background: var(--bg); border: 1px solid var(--border); border-radius: 5px;
  padding: 2px 7px; font: 600 12px monospace; color: var(--text);
}
.dk-help-close { float: right; background: none; border: none; cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; }
.dk-help-close:hover { color: var(--text); }

/* CONTEXT MENU */
.dk-ctx {
  position: fixed; z-index: 150;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 4px;
  box-shadow: 0 12px 32px -6px rgba(0,0,0,0.2), 0 4px 12px rgba(0,0,0,0.08);
  min-width: 180px; display: none;
}
.dk-ctx.show { display: block; }
.dk-ctx-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 7px; cursor: pointer;
  font: 500 13.5px var(--font-display), system-ui;
  color: var(--text);
}
.dk-ctx-item:hover { background: var(--bg); }
.dk-ctx-item.danger { color: #ef4444; }
.dk-ctx-item .ctx-kbd { margin-left: auto; font: 600 11px monospace; color: var(--muted); }
.dk-ctx-sep { height: 1px; background: var(--border); margin: 4px 6px; }

/* LOCKED shape indicator */
.dk-locked-badge {
  position: absolute; pointer-events: none;
  background: var(--accent); color: #fff;
  padding: 2px 6px; border-radius: 4px;
  font: 700 10px var(--font-display), system-ui;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Stats badge */
.dk-stats {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border);
  padding: 6px 10px; border-radius: 9px;
  font: 600 11.5px var(--font-display), system-ui;
  color: var(--muted); pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  z-index: 8;
}

/* TOP TOOLBAR */
.dk-toolbar {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 6px 20px -4px rgba(0,0,0,0.15), 0 2px 6px rgba(0,0,0,0.06);
  z-index: 10; max-width: calc(100% - 28px); overflow-x: auto;
}
.dk-toolbar::-webkit-scrollbar { display: none; }
.dk-toolbar { scrollbar-width: none; }

.dk-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: transparent; border: 1.5px solid transparent; border-radius: 9px;
  cursor: pointer; color: var(--text); transition: .14s; flex-shrink: 0; position: relative;
}
.dk-btn:hover { background: var(--bg); }
.dk-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.dk-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dk-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.dk-btn .kbd-hint {
  position: absolute; bottom: 2px; right: 3px;
  font: 700 8.5px monospace; color: var(--muted); opacity: 0.6;
}
.dk-btn.active .kbd-hint { color: var(--accent); opacity: 0.8; }
.dk-sep { width: 1px; height: 26px; background: var(--border); margin: 0 4px; flex-shrink: 0; }

/* PROPERTIES PANEL, Chap yuqori (navbar bilan markazdagi toolbar orasida), scrollsiz, ixcham */
.dk-props {
  position: absolute; top: 78px; left: 14px; width: 244px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px; box-shadow: 0 6px 20px -4px rgba(0,0,0,0.15);
  z-index: 9; display: flex; flex-direction: column; gap: 9px;
  /* Scrollbar yashirin, lekin zarurat bo'lsa scroll ishlaydi */
  /* sarlavha (60) + tepa (78) + pastki zoom paneli (64) uchun joy: panel ekrandan chiqmaydi va zoom panelini yopmaydi */
  max-height: calc(100vh - 210px);
  overflow-y: auto;
  scrollbar-width: none;
}
.dk-props::-webkit-scrollbar { display: none; width: 0; }
/* Mobil "Uslub" tugmasi (joriy rang nuqtasi bilan) va panel sarlavhasi: faqat mobil */
.dk-style-btn { display: none; }
.dk-style-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1.5px var(--border); background: #1e1e1e; }
.dk-props-head { display: none; align-items: center; justify-content: space-between; }
.dk-props-head b { font: 700 14px var(--font-display), system-ui; color: var(--text); }
.dk-props-close { width: 34px; height: 34px; border: none; background: var(--bg); color: var(--text); border-radius: 9px; cursor: pointer; display: grid; place-items: center; }
.dk-props-close svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; }
/* Amallar (nusxa, guruh, qulf, o'chirish) */
.dk-acts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dk-acts .dk-grid-btn.danger { color: #ef4444; }
.dk-acts .dk-grid-btn.danger:hover { border-color: #ef4444; }
.dk-grid-btn:disabled { opacity: .4; cursor: not-allowed; }
/* Mobil ko'rinish: tor ekran yoki past bo'yli (gorizontal telefon) ekran */
@media (max-width: 720px), (max-height: 500px) {
  /* Xususiyatlar paneli: mobilda pastdan chiqadigan varaq ("Uslub" tugmasi bilan ochiladi) */
  .dk-props {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto;
    max-height: 60vh; border-radius: 18px 18px 0 0; border-bottom: none;
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 60; box-shadow: 0 -12px 34px -6px rgba(0,0,0,.22);
    overscroll-behavior: contain;
  }
  .dk-fs.props-open .dk-props { display: flex; }
  .dk-props-head { display: flex; }
  .dk-style-btn { display: grid; }
  .dk-swatches { gap: 8px; }
  .dk-swatch { width: 32px; height: 32px; border-radius: 9px; }
  .dk-grid-btn { height: 40px; }
  .dk-slider::-webkit-slider-thumb { width: 24px; height: 24px; }
  .dk-slider::-moz-range-thumb { width: 24px; height: 24px; }
  /* Pastki panellardagi ajratkich vertikal qolsin (toolbar'dagi kabi gorizontal emas) */
  .dk-bottom-right .dk-sep, .dk-bottom-left .dk-sep { width: 1px; height: 22px; margin: 0 4px; }
  /* Klaviatura belgilari (H, V, P...) sensorli ekranda kerak emas */
  .dk-btn .kbd-hint { display: none; }
  /* Yordam oynasini yopish tugmasi barmoq uchun yetarli kattalikda */
  .dk-help-close { width: 40px; height: 40px; margin: -8px -8px 0 0; display: grid; place-items: center; }
  /* Pastki panellardagi ajratkich vertikal qolsin (toolbar'dagi kabi gorizontal emas) */
  .dk-bottom-right .dk-sep, .dk-bottom-left .dk-sep { width: 1px; height: 22px; margin: 0 4px; }
  /* Klaviatura belgilari (H, V, P...) sensorli ekranda kerak emas */
  .dk-btn .kbd-hint { display: none; }
  /* Tanlov soni: pastda zoom/amallar bilan to'qnashmasin, tepaga */
  .dk-stats { bottom: auto; top: 12px; left: auto; right: 12px; transform: none; }
  /* Toolbar, chap tomonda vertikal ustun */
  /* pastki zoom/amallar panellari (16 + 40 + oraliq) ustiga tushmasin */
  .dk-toolbar { flex-direction: column; left: 8px; top: 14px; transform: none; max-width: none; max-height: calc(100% - 86px); overflow-y: auto; }
  .dk-sep { width: 22px; height: 1px; margin: 3px 0; }
  /* Tugmalar bitta ustunga sig'masa: yashirin scroll o'rniga bir nechta ustun (JS qatorlar sonini beradi) */
  .dk-toolbar.multi-col { display: grid; grid-auto-flow: column; grid-auto-columns: max-content; overflow: visible; }
  .dk-toolbar.multi-col .dk-sep { display: none; }
}
/* Planshet (tik): gorizontal toolbar barcha tugmalari scrollsiz sig'sin */
@media (min-width: 721px) and (max-width: 900px) and (min-height: 501px) {
  .dk-toolbar { padding: 4px; gap: 2px; }
  .dk-btn { width: 34px; height: 34px; }
  .dk-sep { margin: 0 2px; }
}
/* Planshet (tik): gorizontal toolbar barcha tugmalari scrollsiz sig'sin */
@media (min-width: 721px) and (max-width: 900px) and (min-height: 501px) {
  .dk-toolbar { padding: 4px; gap: 2px; }
  .dk-btn { width: 34px; height: 34px; }
  .dk-sep { margin: 0 2px; }
}
/* Juda tor ekran: pastki chap (zoom) va o'ng (amallar) panellari bir-biriga kirmasin */
@media (max-width: 360px) {
  .dk-bottom-right .dk-count, .dk-bottom-right .dk-count + .dk-sep { display: none; }
}
/* Keng ekranlarda: panel toolbar bilan bir sathda (top), toolbar esa panel o'ngidagi bo'shliqda markazlashadi (o'ngroqqa suriladi) */
@media (min-width: 1300px) and (min-height: 501px) {
  .dk-props { top: 14px; max-height: calc(100vh - 146px); }
  .dk-toolbar { left: calc(50% + 129px); }
}
.dk-section { display: flex; flex-direction: column; gap: 6px; }
.dk-section-lbl {
  font: 600 11.5px var(--font-display), system-ui; color: var(--text);
  letter-spacing: 0.1px;
}
.dk-section.hide { display: none; }

/* Swatches */
.dk-swatches { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.dk-swatch {
  display: inline-block; box-sizing: border-box; flex-shrink: 0;
  width: 22px; height: 22px; border-radius: 6px;
  cursor: pointer; border: 2px solid transparent; transition: .12s; padding: 0;
}
.dk-swatch:hover { transform: scale(1.1); }
.dk-swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.dk-swatch.none { background: var(--surface) !important; position: relative; }
.dk-swatch.none::after { content: ""; position: absolute; inset: 4px; background: linear-gradient(135deg, transparent calc(50% - 1px), #ef4444 calc(50% - 1px), #ef4444 calc(50% + 1px), transparent calc(50% + 1px)); border-radius: 3px; }
.dk-swatch-divider { width: 1px; height: 22px; background: var(--border); margin: 0 2px; }
.dk-swatch.custom {
  background: linear-gradient(135deg, #ef4444 0%, #f59e0b 25%, #22c55e 50%, #3b82f6 75%, #a855f7 100%);
  position: relative;
}
.dk-swatch.custom { overflow: hidden; margin: 0; }
.dk-swatch.custom input[type=color] {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; padding: 0; border: none;
}

/* Grid buttons (font, size, align, layer) */
.dk-grid { display: grid; gap: 6px; }
.dk-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.dk-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.dk-grid-btn {
  height: 32px; border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--bg); cursor: pointer; display: grid; place-items: center;
  transition: .12s; padding: 0; color: var(--text);
  font: 600 13px var(--font-display), system-ui;
}
.dk-grid-btn:hover { border-color: var(--accent); }
.dk-grid-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.dk-grid-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dk-grid-btn.size-s { font-size: 10px; }
.dk-grid-btn.size-m { font-size: 13px; }
.dk-grid-btn.size-l { font-size: 16px; }
.dk-grid-btn.size-xl { font-size: 19px; }
/* Font family preview fonts */
.dk-grid-btn[data-font="hand"] { font-family: "Caveat", "Comic Sans MS", cursive; font-weight: 700; font-size: 18px; }
.dk-grid-btn[data-font="normal"] { font-family: var(--font-display), system-ui, sans-serif; font-weight: 700; }
.dk-grid-btn[data-font="code"] { font-family: "JetBrains Mono", monospace; font-weight: 600; font-size: 12px; }
.dk-grid-btn[data-font="serif"] { font-family: Georgia, serif; font-weight: 700; }

/* Width buttons */
.dk-widths { display: flex; gap: 6px; }
.dk-widths .dk-grid-btn { flex: 1; }
.dk-widths .ln { background: var(--text); border-radius: 2px; width: 22px; }
.dk-widths .dk-grid-btn.active .ln { background: var(--accent); }
.dk-widths .ln.s { height: 2px; }
.dk-widths .ln.m { height: 4px; }
.dk-widths .ln.l { height: 7px; }

/* Slider */
.dk-slider-wrap { display: flex; flex-direction: column; gap: 4px; }
.dk-slider {
  width: 100%; height: 6px; background: var(--border); border-radius: 3px;
  appearance: none; -webkit-appearance: none; outline: none; cursor: pointer;
  accent-color: var(--accent);
}
.dk-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface);
  cursor: pointer; box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.dk-slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface); cursor: pointer;
}
.dk-slider-labels {
  display: flex; justify-content: space-between;
  font: 600 11px var(--font-display), system-ui; color: var(--muted);
}

/* BOTTOM controls */
.dk-bottom-left {
  position: absolute; bottom: 16px; left: 14px;
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 4px; box-shadow: 0 6px 20px -4px rgba(0,0,0,0.12); z-index: 9;
}
.dk-bottom-left .dk-btn { width: 32px; height: 32px; }
.dk-bottom-left .dk-btn svg { width: 14px; height: 14px; }
.dk-bottom-left .zoom-val {
  min-width: 50px; text-align: center;
  font: 700 12px var(--font-display), system-ui; color: var(--text);
  padding: 0 6px; cursor: pointer; user-select: none;
}
.dk-bottom-left .zoom-val:hover { color: var(--accent); }

.dk-bottom-right {
  position: absolute; bottom: 16px; right: 14px;
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 4px; box-shadow: 0 6px 20px -4px rgba(0,0,0,0.12); z-index: 9;
}
.dk-bottom-right .dk-btn { width: 32px; height: 32px; }
.dk-bottom-right .dk-btn svg { width: 14px; height: 14px; }
.dk-bottom-right .dk-count {
  padding: 0 8px; font: 700 11.5px var(--font-display), system-ui; color: var(--muted);
}

/* TOAST */
.dk-toast {
  position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--surface);
  padding: 10px 18px; border-radius: 10px;
  font: 600 13px var(--font-display), system-ui;
  opacity: 0; pointer-events: none; transition: opacity .18s;
  z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.dk-toast.show { opacity: 1; }

/* TOOLTIPS, JS-managed single element (clipping muammosini hal qiladi) */
.dk-tip {
  position: fixed; top: 0; left: 0;
  background: var(--text); color: var(--surface);
  padding: 4px 9px; border-radius: 6px;
  font: 600 11px var(--font-display), system-ui;
  white-space: nowrap; pointer-events: none;
  z-index: 10000;
  opacity: 0; transform: translate(-50%, -100%) translateY(-4px);
  transition: opacity .12s;
  will-change: opacity, transform;
}
.dk-tip.show { opacity: 1; }
.dk-tip.below { transform: translate(-50%, 0) translateY(4px); }

/* TEXT INPUT OVERLAY */
.dk-text-input {
  position: absolute; background: transparent;
  border: 1.5px dashed var(--accent); border-radius: 4px;
  padding: 4px 6px; outline: none; resize: none; overflow: hidden;
  min-width: 80px; min-height: 28px; color: var(--text);
  z-index: 50; white-space: nowrap; line-height: 1.4;
  /* Selection rangi, saytning accent ranglariga moslangan */
  caret-color: var(--accent);
}
.dk-text-input::selection {
  background: var(--accent-soft);
  color: var(--text);
}
.dk-text-input::-moz-selection {
  background: var(--accent-soft);
  color: var(--text);
}

@media (max-width: 480px) {
  .dk-toolbar { padding: 4px; gap: 2px; }
  .dk-btn { width: 34px; height: 34px; }
  .dk-btn svg { width: 16px; height: 16px; }
  .dk-sep { margin: 3px 0; width: 22px; height: 1px; }
}

/* a11y: klaviatura fokusi (2026-10-17) */
.dk-slider:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
