/* ============================================
   Pixia - Compress PDF studio (compress.html)
   Complements css/ai-tool.css (.at-* primitives)
   Scope: body.at-compress
   ============================================ */


body.at-compress {
  --cz-accent: var(--accent-primary);
  --cz-accent-2: var(--accent-primary);
  --cz-ink: var(--text-primary);
  --cz-line: var(--glass-border);
}

/* The app toggles visibility via the hidden attribute on many controls
   that also set display explicitly (drop area, stage, fields, etc.). */
body.at-compress [hidden] { display: none !important; }

/* ---------- Layout ---------- */
.cz-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 22px;
  align-items: start;
}

.cz-main {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  position: sticky;
  inset-block-start: 84px;
  align-self: start;
}

.cz-side {
  min-width: 0;
  display: grid;
  gap: 16px;
}

@media (max-width: 1060px) {
  .cz-layout { grid-template-columns: 1fr; }
  .cz-main { position: static; }
}

body.at-compress .cz-side .at-panel + .at-panel { margin-block-start: 0; }
body.at-compress .at-panel { min-height: 0; min-width: 0; }

.cz-panel h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-block-end: 2px;
}

.cz-panel h2 .cz-count {
  margin-inline-start: auto;
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 3px 10px;
}

.cz-panel-hint {
  margin: 0 0 14px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-tertiary);
  min-height: 40px;
}

/* ---------- Source files ---------- */
.cz-source { display: grid; gap: 12px; }

.cz-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 34px 20px;
  border: 1.6px dashed var(--glass-border-hover);
  border-radius: var(--at-radius-lg);
  background: var(--glass-bg);
  cursor: pointer;
  transition: border-color .2s var(--at-ease), background .2s var(--at-ease), transform .2s var(--at-ease);
}
.cz-drop:hover { border-color: var(--cz-accent); }
.cz-drop.drag {
  border-color: var(--cz-accent);
  background: color-mix(in srgb, var(--cz-accent) 10%, var(--glass-bg));
  transform: scale(1.006);
}
.cz-drop input { display: none; }
.cz-drop-icon {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: color-mix(in srgb, var(--cz-accent) 16%, transparent);
  color: var(--cz-accent);
  margin-block-end: 2px;
}
.cz-drop-icon svg { width: 26px; height: 26px; }
.cz-drop-title { font-family: var(--font-display); font-size: 1.02rem; font-weight: 600; color: var(--text-primary); }
.cz-drop-sub { font-size: 13px; color: var(--text-tertiary); }
.cz-drop-meta { display: flex; gap: 8px; margin-block-start: 4px; }
.cz-drop-meta span {
  font-size: 11px; font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 3px 10px;
}

.cz-files { display: none; gap: 8px; }
.cz-files[data-has="1"] { display: grid; }

.cz-file-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--glass-border);
  border-radius: var(--at-radius-md);
  background: var(--glass-bg);
  margin-top: 5px;
}
.cz-file-thumb {
  width: 40px; height: 52px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: var(--bg-secondary);
  display: grid; place-items: center;
  color: var(--text-tertiary);
}
.cz-file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cz-file-thumb svg { width: 18px; height: 18px; }
.cz-file-info { min-width: 0; display: grid; gap: 3px; }
.cz-file-name {
  font-size: 13.5px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cz-file-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-tertiary);
}
.cz-file-status { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.cz-file-status.is-error { color: #dc2626; background: color-mix(in srgb, #ef4444 14%, transparent); }
.cz-file-status.is-ready { color: #16a34a; background: color-mix(in srgb, #22c55e 16%, transparent); }
.cz-file-status.is-reading { color: var(--text-tertiary); background: var(--bg-secondary); }
.cz-icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background: var(--glass-bg);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color .2s var(--at-ease), border-color .2s var(--at-ease), background .2s var(--at-ease);
}
.cz-icon-btn:hover { color: #dc2626; border-color: color-mix(in srgb, #ef4444 45%, var(--glass-border)); background: color-mix(in srgb, #ef4444 8%, transparent); }
.cz-icon-btn svg { width: 16px; height: 16px; }

.cz-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  height: auto;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background: var(--glass-bg);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: color .2s var(--at-ease), border-color .2s var(--at-ease), background .2s var(--at-ease);
  margin-top: 20px;
}
.cz-add-btn:hover { color: var(--text-primary); border-color: var(--cz-accent); }
.cz-add-btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.cz-add-btn span { white-space: nowrap; }

/* ---------- Preview ---------- */
.cz-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-block-end: 10px;
}
.cz-preview-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cz-preview-nav button {
  min-width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background: var(--glass-bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .2s var(--at-ease);
}
.cz-preview-nav button:hover:not(:disabled) { border-color: var(--cz-accent); color: var(--cz-accent); }
.cz-preview-nav button:disabled { opacity: .4; cursor: not-allowed; }
.cz-preview-nav button svg { width: 16px; height: 16px; }
.cz-preview-label { font-size: 12.5px; font-weight: 600; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }

.cz-stage {
  position: relative;
  border: 1px solid var(--glass-border);
  border-radius: var(--at-radius-lg);
  background: var(--bg-secondary);
  display: grid;
  place-items: center;
  padding: 14px;
  min-height: 260px;
  overflow: hidden;
  user-select: none;
}
.cz-stage canvas {
  max-width: 100%;
  max-height: 560px;
  width: auto;
  height: auto;
  box-shadow: 0 14px 40px -18px rgba(0, 0, 0, .5);
  border-radius: 4px;
  background: #fff;
  cursor: crosshair;
}
.cz-stage-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--text-tertiary);
  font-size: 13.5px;
  text-align: center;
  padding: 40px 20px;
}
.cz-stage-empty svg { width: 34px; height: 34px; opacity: .7; }
.cz-stage-spinner {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg-secondary) 55%, transparent);
  backdrop-filter: blur(2px);
  z-index: 3;
}
.cz-stage-spinner[hidden] { display: none; }
.cz-spinner {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 3px solid var(--glass-border);
  border-block-start-color: var(--cz-accent);
  animation: cz-spin .8s linear infinite;
}
@keyframes cz-spin { to { transform: rotate(360deg); } }

/* apply-mode guard overlay */
.cz-stage.is-disabled { position: relative; }
.cz-stage.is-disabled::after {
  content: "";
  position: absolute; inset: 0;
  cursor: not-allowed;
}

/* ---------- Apply pages strip ---------- */
.cz-apply-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-block-end: 12px;
}
.cz-apply-right { display: flex; align-items: center; gap: 10px; }
.cz-seg {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--at-radius-md);
  padding: 3px;
}
.cz-seg button {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  padding: 6px 13px;
  border-radius: 9px;
  cursor: pointer;
  transition: all .2s var(--at-ease);
}
.cz-seg button:hover { color: var(--text-primary); }
.cz-seg button.active { background: var(--cz-accent); color: #1b1408; }

.cz-seg-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  margin-block-start: 10px;
}
.cz-seg-block button { text-align: center; }

.cz-apply-all-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-block-end: 12px;
}
.cz-mini-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 9px;
  padding: 5px 11px;
  cursor: pointer;
  transition: all .2s var(--at-ease);
}
.cz-mini-btn:hover:not(:disabled) { color: var(--text-primary); border-color: var(--cz-accent); }
.cz-mini-btn:disabled { opacity: .5; cursor: not-allowed; }

.cz-apply-all {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.cz-apply-all input { accent-color: var(--cz-accent); width: 15px; height: 15px; cursor: pointer; }

.cz-strip {
  position: relative;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 6px 2px 14px;
  scroll-snap-type: x proximity;
}
.cz-strip.is-disabled { opacity: .55; pointer-events: none; }

.cz-page {
  position: relative;
  flex: 0 0 auto;
  width: 82px;
  scroll-snap-align: start;
  border: 2px solid var(--glass-border);
  border-radius: 10px;
  background: var(--bg-secondary);
  overflow: hidden;
  cursor: pointer;
  outline: none;
  transition: border-color .2s var(--at-ease), transform .2s var(--at-ease), box-shadow .2s var(--at-ease);
}
.cz-page img { display: block; width: 100%; height: auto; }
.cz-page.is-sel {
  border-color: var(--cz-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cz-accent) 32%, transparent);
}
.cz-page:hover { transform: translateY(-2px); }
.cz-page:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--cz-accent) 55%, transparent); }

.cz-page-num {
  position: absolute;
  inset-block-start: 4px;
  inset-inline-start: 4px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-primary);
  background: rgba(255, 255, 255, .92);
  border-radius: 6px;
}
.cz-page-check {
  position: absolute;
  inset-block-start: 4px;
  inset-inline-end: 4px;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1.5px solid var(--glass-border);
  color: #fff;
  transition: all .18s var(--at-ease);
}
.cz-page-check svg { width: 11px; height: 11px; display: none; }
.cz-page.is-sel .cz-page-check { background: var(--cz-accent); border-color: var(--cz-accent); }
.cz-page.is-sel .cz-page-check svg { display: block; }

/* ---------- Controls panel ---------- */
.cz-field { margin-block-end: 16px; }
.cz-field:last-child { margin-block-end: 2px; }
.cz-field > label {
  display: block;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .01em;
  color: var(--text-secondary);
  margin-block-end: 8px;
}
.cz-inline-label {
  display: block;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .01em;
  color: var(--text-secondary);
  margin-block-end: 8px;
}

.cz-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  margin-block-start: 6px;
}
.cz-switch input { position: absolute; opacity: 0; pointer-events: none; }
.cz-switch i {
  position: relative;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--glass-border);
  transition: background .18s;
}
.cz-switch i::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform .18s;
}
.cz-switch input:checked + i { background: var(--cz-accent,#4f46e5); }
.cz-switch input:checked + i::after { transform: translateX(16px); }
[dir="rtl"] .cz-switch input:checked + i::after { transform: translateX(-16px); }
.cz-switch input:focus-visible + i { outline: 2px solid var(--cz-accent,#4f46e5); outline-offset: 2px; }
.cz-switch input:disabled + i { opacity: .45; }
.cz-switch input:disabled ~ span { opacity: .6; }

.cz-input, .cz-select, .cz-number {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--at-radius-md);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: border-color .2s var(--at-ease), box-shadow .2s var(--at-ease);
}
.cz-input:focus, .cz-select:focus, .cz-number:focus {
  outline: none;
  border-color: var(--cz-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cz-accent) 20%, transparent);
}
.cz-input::placeholder { color: var(--text-tertiary); }

.cz-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cz-row-auto { display: flex; align-items: center; gap: 10px; }

.cz-range-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.cz-range { width: 100%; accent-color: var(--cz-accent); cursor: pointer; }
.cz-range-val {
  min-width: 46px;
  text-align: end;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* color swatches */
.cz-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.cz-swatch {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  cursor: pointer;
  padding: 0;
  transition: transform .18s var(--at-ease), border-color .18s var(--at-ease), box-shadow .18s var(--at-ease);
}
.cz-swatch:hover { transform: scale(1.12); }
.cz-swatch.active { border-color: var(--text-primary); box-shadow: 0 0 0 2px var(--cz-accent); }
.cz-swatch-custom {
  position: relative;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  overflow: hidden;
  cursor: pointer;
  background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red);
}
.cz-swatch-custom input {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
}

/* image upload tile */
.cz-img-tile {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1.6px dashed var(--glass-border-hover);
  border-radius: var(--at-radius-md);
  background: var(--glass-bg);
  cursor: pointer;
  transition: border-color .2s var(--at-ease), background .2s var(--at-ease);
}
.cz-img-tile:hover { border-color: var(--cz-accent); }
.cz-img-thumb {
  width: 64px; height: 64px;
  border-radius: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  display: grid; place-items: center;
  overflow: hidden;
  color: var(--text-tertiary);
}
.cz-img-thumb svg { width: 22px; height: 22px; }
.cz-img-thumb img { width: 100%; height: 100%; object-fit: contain; }
.cz-img-body { min-width: 0; display: grid; gap: 3px; }
.cz-img-name {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cz-img-hint { font-size: 12px; color: var(--text-tertiary); }
.cz-img-clear { width: 30px; height: 30px; display: grid; place-items: center; border: 0; background: transparent; color: var(--text-tertiary); cursor: pointer; border-radius: 8px; }
.cz-img-clear:hover { color: #dc2626; background: color-mix(in srgb, #ef4444 10%, transparent); }
.cz-img-clear svg { width: 15px; height: 15px; }

/* position 3x3 grid */
.cz-posgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.cz-posbtn {
  aspect-ratio: 2 / 1;
  border: 1px solid var(--glass-border);
  border-radius: 9px;
  background: var(--glass-bg);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: all .18s var(--at-ease);
}
.cz-posbtn:hover { border-color: var(--cz-accent); }
.cz-posbtn.active { background: color-mix(in srgb, var(--cz-accent) 14%, var(--glass-bg)); border-color: var(--cz-accent); }
.cz-posbtn span {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--text-tertiary);
  transition: background .18s var(--at-ease);
}
.cz-posbtn.active span { background: var(--cz-accent); }

/* arrangement seg + gap */
.cz-sub-hint { font-size: 11.5px; color: var(--text-tertiary); margin-block-start: 7px; line-height: 1.55; }

/* ---------- Run / progress ---------- */
.cz-run-panel .cz-run-btn { width: 100%; }
.cz-run-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; }
.cz-actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.cz-btn { justify-content: center; }

/* ---------- Result ---------- */
.cz-success {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: var(--at-radius-md);
  background: color-mix(in srgb, #22c55e 10%, transparent);
  border: 1px solid color-mix(in srgb, #22c55e 38%, transparent);
  margin-top: 15px;
}
.cz-success-icon {
  width: 36px; height: 36px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #22c55e;
  color: #fff;
}
.cz-success-icon svg { width: 17px; height: 17px; }
.cz-success-body { min-width: 0; display: grid; gap: 3px; }
.cz-success-title { font-size: 14.5px; font-weight: 700; color: var(--text-primary); }
.cz-success-desc { font-size: 12.5px; color: var(--text-tertiary); }
.cz-outfiles { margin-block-start: 12px; display: grid; gap: 8px; max-height: 210px; overflow: auto; }
.cz-outfile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--glass-border);
  border-radius: var(--at-radius-md);
  background: var(--glass-bg);
}
.cz-outfile-name {
  min-width: 0;
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cz-outfile-size { font-weight: 500; color: var(--text-tertiary); font-size: 12px; }
.cz-result-actions { margin-block-start: 12px; display: grid; gap: 9px; }

/* ---------- misc ---------- */
.cz-muted { color: var(--text-tertiary); }
.cz-inline-flex { display: inline-flex; align-items: center; gap: 6px; }
.cz-caption { font-size: 11.5px; color: var(--text-tertiary); line-height: 1.6; margin-block-start: 10px; }

/* ---------- progress / run ---------- */
.cz-progress {
  display: none;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--glass-border);
  border-radius: var(--at-radius-md);
  background: var(--glass-bg);
}
.cz-progress.show { display: flex; }

/* progress ring */
.cz-ring {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
}
.cz-ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.cz-ring-track,
.cz-ring-fill {
  fill: none;
  stroke-width: 3.4;
}
.cz-ring-track { stroke: var(--bg-secondary); }
.cz-ring-fill {
  stroke: var(--cz-accent);
  stroke-linecap: round;
  stroke-dasharray: 0 100;
  transition: stroke-dasharray .25s var(--at-ease);
}
.cz-ring-pct {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.cz-progress-msg {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cz-cancel {
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--at-radius-md);
  cursor: pointer;
  transition: all .2s var(--at-ease);
}
.cz-cancel:hover:not([disabled]) { color: var(--text-primary); border-color: var(--cz-accent); }

@media (max-width: 620px) {
  .cz-row2 { grid-template-columns: 1fr; }
  .cz-actions-row { grid-template-columns: 1fr; }
}
/* ---------- Compress specific ---------- */

/* compression level cards */
.cz-levels { display: grid; grid-template-columns: 1fr; gap: 8px; }
.cz-level {
  display: grid;
  gap: 2px;
  text-align: start;
  padding: 11px 13px;
  border: 1px solid var(--glass-border);
  border-radius: var(--at-radius-md);
  background: var(--glass-bg);
  color: var(--text-secondary);
  font-family: inherit;
  cursor: pointer;
  transition: border-color .18s var(--at-ease), background .18s var(--at-ease);
}
.cz-level:hover { border-color: var(--cz-accent); }
.cz-level.active {
  border-color: var(--cz-accent);
  background: color-mix(in srgb, var(--cz-accent) 12%, var(--glass-bg));
}
.cz-level-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}
.cz-level.active .cz-level-title { color: var(--cz-accent); }
.cz-level-title::after {
  content: "";
  width: 16px; height: 16px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  transition: border-color .18s var(--at-ease), box-shadow .18s var(--at-ease), background .18s var(--at-ease);
}
.cz-level.active .cz-level-title::after {
  border-color: var(--cz-accent);
  background: var(--cz-accent);
  box-shadow: inset 0 0 0 3px var(--bg-primary);
}
.cz-level-desc { font-size: 11.5px; line-height: 1.45; color: var(--text-tertiary); }

/* advanced section divider */
.cz-advanced {
  margin-block-start: 16px;
  padding-block-start: 15px;
  border-block-start: 1px solid var(--glass-border);
}
.cz-advanced-label {
  display: block;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .01em;
  color: var(--text-secondary);
  margin-block-end: 10px;
}

/* page grid preview */
.cz-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
  max-height: 430px;
  overflow: auto;
  padding-block-end: 4px;
}
.cz-page-grid .cz-page {
  width: auto;
  aspect-ratio: 3 / 4;
  cursor: default;
}
.cz-page-grid .cz-page canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

/* result summary */
.cz-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px;
  border-radius: var(--at-radius-lg);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  margin-block-end: 12px;
}
.cz-summary-main { display: flex; align-items: baseline; gap: 8px; }
.cz-summary-pct {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.cz-summary-label { font-size: 13px; font-weight: 600; color: var(--text-tertiary); }
.cz-summary-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.cz-tier-great {
  border-color: color-mix(in srgb, #22c55e 42%, var(--glass-border));
  background: color-mix(in srgb, #22c55e 9%, var(--glass-bg));
}
.cz-tier-good {
  border-color: color-mix(in srgb, #22c55e 28%, var(--glass-border));
  background: color-mix(in srgb, #22c55e 6%, var(--glass-bg));
}
.cz-tier-great .cz-summary-pct, .cz-tier-good .cz-summary-pct { color: #16a34a; }
.cz-tier-low .cz-summary-pct { color: var(--text-secondary); }
.cz-tier-none .cz-summary-pct { color: var(--text-tertiary); }

/* result list */
.cz-result-list { display: grid; gap: 8px; }
.cz-result-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--glass-border);
  border-radius: var(--at-radius-md);
  background: var(--glass-bg);
}
.cz-result-info { min-width: 0; display: grid; gap: 5px; }
.cz-result-name {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cz-result-sizes { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-tertiary); flex-wrap: wrap; }
.cz-size-old { color: var(--text-tertiary); }
.cz-size-new { color: var(--text-primary); font-weight: 650; }
.cz-arrow { color: var(--text-tertiary); }
.cz-badge { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.cz-badge-great { color: #16a34a; background: color-mix(in srgb, #22c55e 16%, transparent); }
.cz-badge-good { color: #16a34a; background: color-mix(in srgb, #22c55e 12%, transparent); }
.cz-badge-low, .cz-badge-none { color: var(--text-tertiary); background: var(--bg-secondary); }
.cz-bar { height: 5px; border-radius: 999px; background: var(--bg-secondary); overflow: hidden; }
.cz-bar span { display: block; height: 100%; border-radius: 999px; background: color-mix(in srgb, var(--cz-accent) 65%, #22c55e); transition: width .3s var(--at-ease); }
.cz-icon-btn-dl { text-decoration: none; color: var(--cz-accent); }
.cz-icon-btn-dl:hover { color: var(--cz-accent); border-color: var(--cz-accent); background: color-mix(in srgb, var(--cz-accent) 10%, transparent); }
.cz-result-actions { margin-block-start: 14px; display: grid; gap: 9px; }

.cz-reset-btn { width: 100%; }
.cz-run-panel .cz-run-btn { width: 100%; }
