:root {
  --zbtool-shell-padding: 24px;
}

.audiot-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.48fr) minmax(340px, 0.92fr);
  gap: 18px;
  align-items: start;
}

.audiot-main,
.audiot-side {
  display: grid;
  gap: 16px;
}

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

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  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%, #deebff 100%);
  border: 1px solid #cfe0f6;
  color: #204a74;
  font-size: 14px;
  font-weight: 700;
}

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

.pill-meta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: #f4f7fb;
  color: #53657b;
  font-size: 12px;
  line-height: 1.5;
}

.audiot-dropzone {
  display: grid;
  gap: 8px;
  padding: 22px;
  border-radius: 24px;
  border: 1px dashed #8fb0d5;
  background:
    radial-gradient(circle at top left, rgba(70, 131, 209, 0.12), transparent 44%),
    linear-gradient(180deg, #f8fbff 0%, #f4f8fd 100%);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.audiot-dropzone:hover,
.audiot-dropzone.is-dragover {
  transform: translateY(-1px);
  border-color: #467bc1;
  box-shadow: 0 18px 30px -26px rgba(49, 90, 138, 0.9);
}

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

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

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

.audiot-dropzone input[type='file'] {
  display: none;
}

.audiot-wave-shell {
  position: relative;
  min-height: 320px;
  border-radius: 24px;
  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;
}

#waveform-canvas {
  display: block;
  width: 100%;
  height: 320px;
  touch-action: none;
  cursor: crosshair;
}

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

#preview-audio {
  width: 100%;
}

.audiot-inline-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.audiot-stat-chip {
  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;
}

.audiot-stat-chip span {
  color: #66798f;
  font-size: 12px;
}

.audiot-stat-chip strong {
  color: #13293e;
  font-size: 13px;
  word-break: break-word;
}

.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));
}

.control {
  display: grid;
  gap: 8px;
}

.control span {
  color: #35516f;
  font-size: 13px;
  font-weight: 600;
}

.control input,
.control select,
.summary-output,
.zbtool-comments .com_box textarea,
.zbtool-comments .com_info li input {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #d6dde7;
  border-radius: 16px;
  background: #fff;
  color: #23384f;
  font-size: 14px;
}

.control input:focus,
.control select:focus,
.summary-output: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);
}

.control-template {
  grid-column: span 2;
}

.control-note {
  margin: 0;
  color: #62758d;
  font-size: 12px;
  line-height: 1.8;
}

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

.action-row button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid #d6dde7;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f8fd 100%);
  color: #2a4560;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.action-row button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #7ea5d5;
  box-shadow: 0 12px 20px -18px rgba(41, 87, 144, 0.85);
}

.action-row button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.action-row .primary {
  border-color: #204a74;
  background: linear-gradient(180deg, #2d5f93 0%, #1f4a72 100%);
  color: #fff;
}

.tool-tip {
  min-height: 22px;
  color: #4f6680;
  font-size: 13px;
  line-height: 1.7;
}

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

.queue-list,
.result-list {
  display: grid;
  gap: 12px;
}

.queue-empty {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed #c9d6e6;
  background: #f9fbfe;
  color: #60748b;
  line-height: 1.8;
}

.queue-item,
.result-item {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid #e0e7f0;
  background: #fff;
}

.queue-item.is-active {
  border-color: #7aa6d7;
  box-shadow: 0 16px 30px -28px rgba(53, 99, 153, 0.88);
}

.queue-item-head,
.result-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.queue-item-title,
.result-item-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.queue-item-title strong,
.result-item-title strong {
  color: #233a54;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-all;
}

.queue-item-title span,
.result-item-title span {
  color: #667a91;
  font-size: 12px;
}

.queue-item-actions,
.result-item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.queue-item-actions button,
.result-item-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #d3deeb;
  background: #fff;
  color: #27445f;
  font-size: 12px;
  text-decoration: none;
}

.queue-item-actions button.is-active-button {
  border-color: #34689e;
  background: linear-gradient(180deg, #eef5ff 0%, #dbe9fb 100%);
  color: #16446f;
}

.queue-badges,
.result-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.queue-badge,
.result-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #edf4fb;
  color: #355572;
  font-size: 12px;
}

.queue-badge.is-processing {
  background: #fff4de;
  color: #8a5a05;
}

.queue-badge.is-done {
  background: #e8f7ec;
  color: #1f6a37;
}

.queue-badge.is-failed {
  background: #ffe9e9;
  color: #a93434;
}

.progress-shell {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #eef3f8;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6ea2dc 0%, #2d5f93 100%);
  transition: width 0.2s ease;
}

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

.stat-card {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 18px;
  background: #f6f9fc;
  border: 1px solid #e0e8f1;
}

.stat-card strong {
  color: #18324b;
  font-size: 20px;
  line-height: 1.1;
}

.stat-card span {
  color: #697d93;
  font-size: 12px;
}

.summary-output {
  margin: 0;
  min-height: 240px;
  padding: 16px;
  border-radius: 18px;
  background: #0f1d2d;
  color: #deebfb;
  font-size: 12px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}

.guide-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
  color: #4f657d;
  line-height: 1.8;
}

.result-item audio {
  width: 100%;
}

.result-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.result-meta div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f7fafd;
  border: 1px solid #e3eaf2;
}

.result-meta span {
  color: #75879c;
  font-size: 11px;
}

.result-meta strong {
  color: #203a54;
  font-size: 13px;
  line-height: 1.5;
}

.audiot-results-card {
  margin-top: 18px;
}

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

@media (max-width: 860px) {
  .control-grid,
  .control-grid-compact,
  .result-meta,
  .audiot-inline-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .tool-block,
  .audiot-dropzone,
  .queue-item,
  .result-item,
  .audiot-wave-shell {
    border-radius: 18px;
  }

  .control-grid,
  .control-grid-compact,
  .result-meta,
  .audiot-inline-stats,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .control-template {
    grid-column: span 1;
  }

  .queue-item-head,
  .result-item-head {
    flex-direction: column;
  }

  .queue-item-actions,
  .result-item-actions {
    justify-content: flex-start;
  }

  #waveform-canvas {
    height: 260px;
  }
}
