/* ==========================================================================
   mobile.css — responsive layer for MinecraftPixelArt
   Loaded AFTER style.css. Desktop layout is untouched above 820px.
   ========================================================================== */

/* "Blocks & History" only makes sense on mobile — the panel is always
   visible on desktop. */
#editor-mobile-panel-btn { display: none; }

@media (max-width: 820px) {

  /* ---------- 1. Full-height editor that survives the URL bar ---------- */

  /* --site-header-h is measured by mobile-editor.js.
     Height is auto rather than fixed: the canvas has a 300px floor and the
     fixed chrome (tool rail + status + action bar + download bar) is ~292px,
     which together exceed a small phone's viewport. Clipping that would hide
     the bottom bars, so the stack is allowed to grow and the page scrolls. */
  .workarea.editor-screen {
    height: auto;
    min-height: calc(100vh - var(--site-header-h, 0px));   /* fallback */
    min-height: calc(100dvh - var(--site-header-h, 0px));
    overflow: visible;
  }

  .editor-screen .columns { flex: 0 0 auto; }

  /* ---------- 2. Action bar: moved to the bottom, one scrollable row ---------- */

  /* Reorder the editor's flex children so the buttons sit last:
     canvas + tools -> palette dock -> status -> action bar. */
  .editor-screen .columns { order: 1; }
  .workarea.editor-screen .footbar { order: 2; }
  .workarea.editor-screen .topbar { order: 3; }
  .editor-download-bar { order: 4; }

  .workarea.editor-screen .topbar {
    padding: 8px;
    gap: 6px;
    flex-wrap: wrap;               /* every button visible, no hidden scroll */
    overflow: visible;
    justify-content: center;
    border-bottom: none;
    border-top: 1px solid var(--border-light);
    box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.06);
  }

  .workarea.editor-screen .topbar .topbar-btn {
    flex: 0 0 auto;
    min-height: 38px;              /* finger-sized */
    padding: 7px 12px;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  #editor-mobile-panel-btn { display: inline-flex; }

  /* Dropdowns become bottom sheets instead of running off-screen */
  .workarea.editor-screen .topbar-menu {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    left: 10px;
    right: 10px;
    bottom: auto;
    min-width: 0;
    max-height: 70dvh;
    overflow-y: auto;
    padding: 10px;
    border-radius: 16px;
    box-shadow: 0 -8px 40px rgba(15, 23, 42, 0.28);
    z-index: 450;
  }
  .workarea.editor-screen .topbar-menu .file-cta,
  .workarea.editor-screen .topbar-menu-item {
    padding: 13px 14px;
    font-size: 0.95rem;
  }

  /* ---------- 3. Stack: canvas on top, tool rail underneath ---------- */

  .editor-screen .columns {
    flex-direction: column;
    padding: 6px;
    gap: 6px;
  }

  .editor-screen .column.editor {
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column-reverse;  /* canvas above, tools below */
  }

  .editor-tools {
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    padding: 6px 8px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  .editor-tools::-webkit-scrollbar { display: none; }

  .editor-tools > label {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
  }
  .editor-tools svg { width: 24px; height: 24px; }

  /* Brush size + active block sit inline in the same strip */
  .editor-tools .brush-size-container {
    flex: 0 0 auto;
    margin: 0 0 0 4px;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
  }
  .editor-tools .brush-size-container br { display: none; }
  .editor-tools .brush-size-buttons {
    display: flex;
    gap: 10px;
    font-size: 1.05rem;
  }
  .editor-tools .brush-size-buttons i {
    padding: 6px;                /* bigger tap target */
  }

  .editor-tools .editor-eyedrop {
    flex: 0 0 auto;
    margin: 0 4px 0 auto;
    width: 46px;
    height: 46px;
  }

  .editor-canvas {
    flex: 1 1 auto;
    min-height: 300px;           /* never let the chrome squeeze it flat */
    touch-action: none;          /* stop the page scrolling while you draw */
    overscroll-behavior: contain;
  }
  .editor-canvas canvas { touch-action: none; }

  /* ---------- 4. Blocks & History docked under the canvas ---------- */

  .editor-screen .info-panels {
    flex: 0 0 auto;
    max-width: none;
    height: auto;                /* sized by its contents, not a dvh slice */
    min-height: 0;
    max-height: none;
    padding: 8px;
    gap: 8px;
    border-radius: var(--radius-md);
    overflow: hidden;
  }

  /* "Blocks & History" button now collapses the dock to free up canvas */
  .editor-screen .info-panels.is-collapsed { display: none; }

  .editor-screen .info-panels #editor-input-filter {
    min-height: 38px;
    font-size: 16px;              /* stops iOS zooming in on focus */
  }

  .info-panels-blocks {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 300px;           /* never collapse to a single row */
  }
  .info-panels-blocks-img {
    flex: 1 1 auto;
    min-height: 260px;
    overflow-y: auto;
  }

  .info-panels-blocks-img {
    grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
    gap: 5px;
    padding: 5px;
    -webkit-overflow-scrolling: touch;
  }
  .palette-tile { width: 38px; height: 38px; border-radius: 8px; }
  .palette-tile img { width: 30px; height: 30px; }
  .palette-tile:hover { transform: none; }   /* no hover jump on touch */

  .info-panels-history {
    flex: 0 0 74px;
    min-height: 0;
    font-size: 0.75rem;
  }
  .history-item { padding: 7px 9px; font-size: 0.8rem; }

  /* ---------- 5. Footbar ---------- */

  .workarea.editor-screen .footbar {
    padding: 5px 10px;
    font-size: 0.68rem;
    gap: 8px;
  }
  #editor-footbar-right {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* ---------- 6. Settings / upload screens ---------- */

  .settings-screen.container {
    padding-left: 22px;
    padding-right: 22px;
  }
  .settings-screen .columns {
    flex-direction: column;
    gap: 26px;
    padding: 0 4px;              /* extra inset either side of the content */
  }
  .settings-screen .img-background {
    margin-left: auto;
    margin-right: auto;
  }
  .settings-screen .crop-toolbar { padding: 0 4px; }
  .settings-screen .table-blocks-wrapper tbody { max-height: 46dvh; }
  .settings-screen .table-blocks-wrapper th,
  .settings-screen .table-blocks-wrapper td { padding: 10px; font-size: 0.9rem; }
  .settings-screen .table-blocks-wrapper td img { width: 26px; height: 26px; }
  .settings-screen .table-blocks-wrapper input[type="checkbox"] { width: 20px; height: 20px; }
  .input { min-height: 42px; font-size: 16px; }  /* 16px stops iOS zoom-on-focus */
  select, input[type="text"], input[type="number"] { font-size: 16px; }
}


/* ---------- 7. Short landscape phones: give the canvas the room ---------- */

@media (max-width: 920px) and (max-height: 520px) and (orientation: landscape) {
  .editor-screen .column.editor { flex-direction: row; }  /* rail back to the left */
  .editor-tools {
    width: 52px;
    height: 100%;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    border-top: none;
  }
  .editor-tools .editor-eyedrop { margin: auto 0 4px; }
  .editor-screen .columns { flex-direction: row; }
  .editor-screen .info-panels {
    flex: 0 0 210px;
    height: auto;
    max-height: none;
    min-height: 0;
  }
}

/* ---------- 8. Very small phones ---------- */

@media (max-width: 380px) {
  .workarea.editor-screen .topbar .topbar-btn {
    padding: 8px 10px;
    font-size: 0.75rem;
  }
  #editor-footbar-right { display: none; }
}

/* ==========================================================================
   PNG export quality picker (Save As menu) — applies at all widths
   ========================================================================== */

.png-scale-row {
  padding: 8px 12px 10px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 6px;
}
.png-scale-row label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.png-scale-row select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  background: #ffffff;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.85rem;
}
.png-scale-info {
  display: block;
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

@media (max-width: 820px) {
  .png-scale-row select { min-height: 42px; font-size: 16px; }
}

/* ==========================================================================
   Hamburger + right-side navigation drawer
   ========================================================================== */

.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0 10px;
  margin-left: auto;
  background: transparent;
  border: none;
  cursor: pointer;
}
.nav-burger span {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: var(--text-main);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.is-open span:nth-child(2) { opacity: 0; }
.nav-burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(82vw, 320px);
  background: #ffffff;
  border-left: 1px solid var(--border-light);
  box-shadow: -12px 0 40px rgba(15, 23, 42, 0.22);
  z-index: 601;
  transform: translateX(100%);
  transition: transform 0.24s ease;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  overscroll-behavior: contain;
}
.nav-drawer.is-open { transform: translateX(0); }

.nav-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-light);
}
.nav-drawer-title {
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.nav-drawer-close {
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  font-size: 1.7rem;
  line-height: 1;
  color: var(--text-main);
  cursor: pointer;
}

.nav-drawer-links {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  overflow-y: auto;
}
.nav-drawer .nav-drawer-link {
  display: block;
  padding: 15px 20px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  text-decoration: none;
  border-bottom: 1px solid var(--bg-subtle);
}
.nav-drawer .nav-drawer-link:active { background: var(--bg-subtle); }

/* The header CTA keeps its button look inside the drawer */
.nav-drawer .btn-header-cta {
  margin: 14px 18px;
  border-bottom: none;
  border-radius: var(--radius-pill);
  text-align: center;
}

.nav-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.nav-drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }

body.nav-drawer-open { overflow: hidden; }

/* Burger covers phones AND tablets (iPad portrait is 820px, landscape 1024px).
   The inline links must hide across exactly the same range — style.css only
   hid them below 600px, so 601-820px was showing both at once. */
@media (max-width: 1024px) {
  .nav-burger { display: flex; }
  .site-header .site-links { display: none; }
}

/* Tablets have room for a slightly wider drawer */
@media (min-width: 601px) and (max-width: 1024px) {
  .nav-drawer { width: min(58vw, 380px); }
  .nav-drawer .nav-drawer-link { padding: 17px 22px; font-size: 1.05rem; }
  .nav-drawer-head { padding: 18px 22px; }
}

/* ==========================================================================
   Editor guide section
   ========================================================================== */

.guide-steps {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 860px;
  counter-reset: guide;
}
.guide-step {
  display: flex;
  gap: 18px;
  padding: 22px 0;
  border-bottom: 1px solid var(--border-light);
}
.guide-step:last-child { border-bottom: none; }

.guide-step-num {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--text-main);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
}
.guide-step-body h3 {
  margin: 6px 0 8px;
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-main);
}
.guide-step-body p {
  margin: 0 0 10px;
  color: var(--text-body);
  line-height: 1.7;
}
.guide-step-body p:last-child { margin-bottom: 0; }

.guide-tips,
.guide-shortcuts {
  max-width: 860px;
  margin: 40px auto 0;
}
.guide-tips-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 18px;
}
.guide-tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.guide-tip {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.guide-tip h4 {
  margin: 0 0 6px;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
}
.guide-tip p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-body);
}

.guide-shortcut-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.guide-shortcut-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.92rem;
  color: var(--text-body);
}
.guide-shortcut-table tr:last-child td { border-bottom: none; }
.guide-shortcut-table td:first-child { width: 160px; }

kbd {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--border-light);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--bg-subtle);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

/* ==========================================================================
   AdSense slots
   ========================================================================== */

.ad-slot {
  min-height: 100px;
  margin: 32px auto;
  max-width: 860px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.ad-slot-label {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  color: #b6bdc8;
}
/* Once a real ad unit is inserted, the placeholder chrome gets out of the way */
.ad-slot:has(ins) {
  background: transparent;
  border: none;
  min-height: 0;
}
.ad-slot:has(ins) .ad-slot-label { display: none; }

@media (max-width: 820px) {
  .content-section { padding: 44px 0; }
  .guide-step { gap: 12px; padding: 18px 0; }
  .guide-step-num { flex-basis: 34px; width: 34px; height: 34px; font-size: 0.9rem; }
  .guide-step-body h3 { font-size: 1.02rem; }
  .guide-shortcut-table td:first-child { width: 120px; }
  .ad-slot { margin: 24px auto; }
}

/* ==========================================================================
   Download bar — shown at every width
   ========================================================================== */

.editor-download-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
  order: 5;                    /* last child of the editor screen */
  background: #ffffff;
  border-top: 1px solid var(--border-light);
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

.editor-download-actions {
  display: flex;
  gap: 10px;
  align-items: stretch;
  justify-content: center;     /* desktop: natural width, centred */
}

.editor-download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 26px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--text-main);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.editor-download-btn:hover { opacity: 0.92; }
.editor-download-btn:active { opacity: 0.85; }
.editor-download-btn::before {
  content: "\2193";
  font-size: 1.05rem;
  font-weight: 800;
}

.editor-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 22px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  background: #ffffff;
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.editor-upload-btn:hover { background: var(--bg-subtle); }
.editor-upload-btn:active { background: var(--bg-subtle); }
.editor-upload-btn::before {
  content: "\2191";
  font-size: 1rem;
  font-weight: 800;
}

/* The progress bar tracks the button row's width on wide screens */
.editor-download-bar .dl-progress {
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 820px) {
  /* Phones: buttons stretch to fill the bar */
  .editor-download-bar { padding: 8px 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  .editor-download-actions { justify-content: stretch; gap: 8px; }
  .editor-download-btn {
    flex: 1.35 1 0;            /* the primary action gets the larger share */
    min-width: 0;
    min-height: 48px;
    padding: 0 10px;
    font-size: 0.95rem;
  }
  .editor-upload-btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 48px;
    padding: 0 10px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .editor-download-bar .dl-progress { max-width: none; }
}

/* Narrow phones: stack them so neither label truncates */
@media (max-width: 400px) {
  .editor-download-actions { flex-direction: column; }
  .editor-download-btn,
  .editor-upload-btn { flex: 0 0 auto; width: 100%; }
}

/* ==========================================================================
   Download / export progress bar
   ========================================================================== */

.dl-progress {
  display: none;
  flex-direction: column;
  gap: 5px;
}
.dl-progress.is-active { display: flex; }

.dl-progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.dl-progress-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}
.dl-progress-pct {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.dl-progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  overflow: hidden;
}
.dl-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--text-main);
  transition: width 0.12s linear;
}

/* Indeterminate sweep while the browser encodes the PNG (no progress events) */
.dl-progress.is-encoding .dl-progress-fill {
  width: 40%;
  animation: dl-sweep 0.9s ease-in-out infinite;
}
@keyframes dl-sweep {
  0%   { margin-left: -40%; }
  100% { margin-left: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .dl-progress-fill { transition: none; }
  .dl-progress.is-encoding .dl-progress-fill { animation: none; width: 100%; }
}

/* ==========================================================================
   Page hero / H1
   ========================================================================== */

.hero-head {
  padding-top: 44px;
  padding-bottom: 4px;
  text-align: center;
}

.hero-title {
  font-size: clamp(1.9rem, 4.6vw, 3.1rem);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  margin: 0 0 12px;
}

.hero-lead {
  max-width: 660px;
  margin: 0 auto;
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--text-muted);
}
.hero-lead code {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.86em;
  color: var(--text-main);
}

/* The editor takes the full viewport — the hero would push it off screen */
body.editor-active .hero-head { display: none; }

@media (max-width: 820px) {
  .hero-head { padding-top: 26px; padding-bottom: 0; }
  .hero-lead { font-size: 0.94rem; }
}

/* ==========================================================================
   Undo / Redo bar across the top of the canvas
   Styled to match the tool rail (.editor-tools): dark slab, white icons,
   rounded hover squares.
   ========================================================================== */

/* Stage stacks the bar above the canvas at every width. The column is `row`
   on desktop and `column-reverse` on mobile, so the bar cannot simply be a
   sibling of the canvas — it needs its own vertical container. */
.editor-stage {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.editor-stage .editor-canvas {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}

.canvas-quickbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: #0f172a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.canvas-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #ffffff;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
}
.canvas-quick-btn:hover:not(:disabled) { background: #334155; }
.canvas-quick-btn:active:not(:disabled) { background: #ffffff; color: #0f172a; }

.canvas-quick-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.canvas-quick-icon {
  font-size: 1.1rem;
  line-height: 1;
  font-weight: 800;
}

@media (max-width: 820px) {
  .canvas-quickbar { padding: 5px 6px; gap: 4px; }
  .canvas-quick-btn { height: 38px; padding: 0 12px; font-size: 0.8rem; }

  /* Undo/Redo now live above the canvas — drop the action-bar duplicates,
     which also shortens that bar on small screens. */
  #editor-mobile-undo,
  #editor-mobile-redo { display: none; }
}


/* ---------- Block-size (zoom) slider in the canvas bar ---------- */

.canvas-zoom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding-right: 4px;
  color: #cbd5e1;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}
.canvas-zoom label { color: #94a3b8; }

.canvas-zoom input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 130px;
  height: 4px;
  border-radius: 999px;
  background: #334155;
  outline: none;
  cursor: pointer;
}
.canvas-zoom input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: none;
  cursor: pointer;
}
.canvas-zoom input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: none;
  cursor: pointer;
}

.canvas-zoom-value {
  min-width: 38px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
}

@media (max-width: 820px) {
  .canvas-zoom { gap: 6px; font-size: 0.72rem; }
  .canvas-zoom label { display: none; }          /* the px readout says enough */
  .canvas-zoom input[type="range"] { width: 92px; height: 6px; }
  .canvas-zoom input[type="range"]::-webkit-slider-thumb { width: 20px; height: 20px; }
}
@media (max-width: 400px) {
  .canvas-zoom input[type="range"] { width: 68px; }
}

/* ---------- Detail level (block resolution) control ---------- */

.detail-level {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 16px;
}
.detail-level-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}
.detail-level-head label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}
.detail-level-info {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.detail-level select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  background: #ffffff;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.88rem;
}
.detail-level-hint {
  margin: 8px 0 0;
  font-size: 0.76rem;
  line-height: 1.55;
  color: var(--text-muted);
}
@media (max-width: 820px) {
  .detail-level select { min-height: 44px; font-size: 16px; }
  .detail-level-head { flex-direction: column; gap: 2px; }
  .detail-level-info { text-align: left; }
}

/* ---------- Live detail slider above the palette ---------- */

.editor-detail {
  flex: 0 0 auto;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  margin-bottom: 8px;
}
.editor-detail-head,
.editor-detail-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.editor-detail-head label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
}
.editor-detail-value,
#editor-detail-blocks {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.editor-detail input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  margin: 9px 0 7px;
  border-radius: 999px;
  background: #cbd5e1;
  outline: none;
  cursor: pointer;
}
.editor-detail input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text-main);
  cursor: pointer;
}
.editor-detail input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: none;
  background: var(--text-main);
  cursor: pointer;
}
.editor-detail-apply {
  border: none;
  border-radius: var(--radius-pill);
  background: var(--text-main);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.74rem;
  padding: 6px 14px;
  cursor: pointer;
}
.editor-detail-apply:disabled { opacity: 0.35; cursor: default; }

@media (max-width: 820px) {
  .editor-detail { padding: 8px 10px; }
  .editor-detail input[type="range"] { height: 6px; }
  .editor-detail input[type="range"]::-webkit-slider-thumb { width: 20px; height: 20px; }
  .editor-detail-apply { min-height: 36px; padding: 0 16px; }
}

/* ---------- Palette needs real room on tablets too ---------- */

@media (min-width: 821px) and (max-width: 1024px) {
  .editor-screen .info-panels { flex: 0 0 260px; }
  .info-panels-blocks { min-height: 300px; }
  .info-panels-blocks-img { min-height: 260px; overflow-y: auto; }
}
