.tool-block {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid #e4e8ef;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(202, 224, 247, 0.35), transparent 32%),
    linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
}

.section-head,
.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.section-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #eef7ff 0%, #dfebff 100%);
  color: #1f4c78;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid #c8dcf6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.section-pill-soft {
  background: linear-gradient(180deg, #f7fbff 0%, #edf5ff 100%);
  border-color: #dbe8fa;
  color: #315d8a;
}

.pill-meta,
.result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: #eef6ff;
  color: #225282;
  border: 1px solid #c8def6;
  font-size: 13px;
  font-weight: 600;
}

.crop-layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(320px, 0.96fr) minmax(280px, 0.82fr);
  gap: 18px;
  align-items: stretch;
}

.crop-editor-card,
.crop-settings-card,
.crop-result-card {
  height: 100%;
  align-content: start;
}

.crop-result-card {
  grid-template-rows: auto minmax(240px, auto) auto minmax(0, 1fr);
}

.crop-guide-card {
  grid-column: 1 / span 2;
  margin-top: 32px;
  align-self: start;
}

.crop-dropzone {
  display: grid;
  gap: 8px;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px dashed #90abc8;
  background:
    radial-gradient(circle at top left, rgba(82, 132, 196, 0.12), transparent 45%),
    linear-gradient(180deg, #f8fbff 0%, #f3f7fd 100%);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.crop-dropzone:hover,
.crop-dropzone.is-dragover {
  transform: translateY(-1px);
  border-color: #3d71aa;
  box-shadow: 0 16px 28px -24px rgba(49, 90, 138, 0.92);
}

.crop-dropzone strong {
  font-size: 16px;
  line-height: 1.5;
  color: #173c66;
}

.crop-dropzone span,
.crop-dropzone em {
  color: #5a6f83;
  line-height: 1.8;
}

.crop-dropzone em {
  font-style: normal;
  font-size: 12px;
}

.crop-canvas-shell {
  position: relative;
  min-height: 440px;
  height: 100%;
  border-radius: 26px;
  overflow: hidden;
  border: 1px solid #dbe4ef;
  background:
    linear-gradient(45deg, #f5f8fc 25%, transparent 25%),
    linear-gradient(-45deg, #f5f8fc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f5f8fc 75%),
    linear-gradient(-45deg, transparent 75%, #f5f8fc 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

#preview-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 440px;
  touch-action: none;
  cursor: default;
}

.crop-empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: #68809a;
  line-height: 1.8;
  pointer-events: none;
}

.crop-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.crop-toolbar button,
.aspect-chip,
.crop-main-actions button {
  min-height: 42px;
}

.crop-toolbar button,
.crop-main-actions button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid #d5e2f1;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f2f7fd 100%);
  color: #24476b;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 20px -18px rgba(40, 77, 116, 0.72);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
  cursor: pointer;
}

.crop-toolbar button:hover,
.crop-main-actions button:hover {
  transform: translateY(-1px);
  border-color: #97b5d7;
  background: linear-gradient(180deg, #ffffff 0%, #eaf2fb 100%);
  box-shadow: 0 16px 28px -22px rgba(37, 77, 116, 0.78);
}

.crop-toolbar button:focus-visible,
.crop-main-actions button:focus-visible {
  outline: none;
  border-color: #4d7aa9;
  box-shadow:
    0 0 0 4px rgba(77, 122, 169, 0.14),
    0 14px 24px -20px rgba(37, 77, 116, 0.75);
}

.crop-toolbar button:active,
.crop-main-actions button:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px -18px rgba(37, 77, 116, 0.72);
}

.crop-main-actions .primary {
  border-color: #2f669d;
  background: linear-gradient(180deg, #4e86c0 0%, #2f669d 100%);
  color: #ffffff;
  box-shadow: 0 16px 28px -20px rgba(47, 102, 157, 0.9);
}

.crop-main-actions .primary:hover {
  border-color: #255786;
  background: linear-gradient(180deg, #5a92cc 0%, #2a5e92 100%);
  color: #ffffff;
}

.crop-toolbar button[disabled],
.crop-main-actions button[disabled] {
  cursor: not-allowed;
  transform: none;
  border-color: #e3e8f0;
  background: linear-gradient(180deg, #f7f8fa 0%, #eef1f5 100%);
  color: #94a3b8;
  box-shadow: none;
}

.control-group,
.control {
  display: grid;
  gap: 8px;
}

.field-label,
.control span {
  font-size: 13px;
  color: #445365;
}

.aspect-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.aspect-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid #d3dfea;
  background: #f7fafc;
  color: #385067;
  font-weight: 600;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.aspect-chip:hover {
  transform: translateY(-1px);
}

.aspect-chip.is-active {
  border-color: #3b75af;
  background: linear-gradient(180deg, #edf5ff 0%, #dceaff 100%);
  color: #15477b;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.control-grid-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

.control-wide {
  grid-column: span 3;
}

.control input,
.control select,
.result-box,
.zbtool-comments .com_box textarea,
.zbtool-comments .com_info li input {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid #d6deea;
  border-radius: 18px;
  background: #fff;
  color: #1f2937;
  padding: 13px 15px;
  font-size: 14px;
}

.control-grid-compact .control input,
.control-grid-compact .control select {
  min-height: 46px;
}

.control input:focus,
.control select:focus,
.result-box:focus,
.zbtool-comments .com_box textarea:focus,
.zbtool-comments .com_info li input:focus {
  outline: none;
  border-color: #4d7aa9;
  box-shadow: 0 0 0 4px rgba(77, 122, 169, 0.12);
}

.checkbox-control {
  align-content: start;
}

.toggle-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 18px;
  border: 1px solid #dbe4ef;
  background: #f8fbff;
}

.toggle-line input {
  width: auto;
  margin: 0;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.crop-inline-stats,
.crop-result-meta {
  display: grid;
  gap: 10px;
}

.crop-inline-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.crop-stat-chip,
.crop-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #435264;
  line-height: 1.6;
}

.crop-stat-chip strong,
.crop-meta-row strong {
  color: #102a43;
}

.crop-result-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 240px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid #dde6f0;
  background:
    linear-gradient(45deg, #eef3f8 25%, transparent 25%),
    linear-gradient(-45deg, #eef3f8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef3f8 75%),
    linear-gradient(-45deg, transparent 75%, #eef3f8 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}

#result-image {
  display: none;
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
}

#result-image.is-ready {
  display: block;
}

.result-box {
  min-height: 188px;
  line-height: 1.75;
  resize: vertical;
}

.crop-note-card {
  padding: 0 2px;
}

.helper-list {
  margin: 0;
  padding-left: 18px;
  color: #4d6278;
  line-height: 1.85;
}

.tool-tip {
  min-height: 22px;
  color: #334155;
  font-size: 13px;
  margin-left: 20px;
}

.tool-tip.error {
  color: #b42318;
}

.empty-state {
  color: #70849a;
  line-height: 1.8;
  text-align: center;
}

@media (max-width: 1180px) {
  .crop-layout-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .crop-guide-card {
    grid-column: auto;
    margin-top: 0;
  }
}

@media (max-width: 820px) {
  .control-grid,
  .control-grid-compact,
  .crop-inline-stats {
    grid-template-columns: 1fr;
  }

  .control-wide {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  .tool-block,
  .crop-canvas-shell,
  .crop-dropzone,
  .crop-result-preview {
    border-radius: 18px;
  }

  .crop-canvas-shell,
  #preview-canvas {
    min-height: 320px;
  }
}
