.sub2api-image-nav > svg {
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 auto;
}

.ig-page {
  width: min(100%, 1440px);
  margin: 0 auto;
  color: #111827;
}

.ig-layout {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.ig-panel {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ig-controls {
  padding: 22px;
}

.ig-field + .ig-field,
.ig-field + .ig-two-fields,
.ig-two-fields + .ig-field {
  margin-top: 18px;
}

.ig-two-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(96px, 0.55fr);
  gap: 12px;
}

.ig-field label,
.ig-label-row label {
  display: block;
  margin-bottom: 7px;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
}

.ig-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ig-label-row > span {
  color: #9ca3af;
  font-size: 12px;
}

.ig-input {
  display: block;
  width: 100%;
  min-height: 42px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #111827;
  font: inherit;
  font-size: 14px;
  letter-spacing: 0;
  padding: 9px 11px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.ig-input:focus {
  border-color: #14b8a6;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.13);
}

.ig-prompt {
  min-height: 170px;
  resize: vertical;
  line-height: 1.55;
}

.ig-secret-wrap {
  position: relative;
}

.ig-secret-wrap .ig-input {
  padding-right: 44px;
}

.ig-icon-button {
  position: absolute;
  top: 4px;
  right: 4px;
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
}

.ig-icon-button:hover {
  background: #f3f4f6;
  color: #111827;
}

.ig-icon-button svg {
  width: 18px;
  height: 18px;
}

.ig-segments {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ig-segment {
  min-width: 0;
  min-height: 58px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  padding: 7px 5px;
  text-align: center;
}

.ig-segment strong,
.ig-segment span {
  display: block;
  letter-spacing: 0;
}

.ig-segment strong {
  font-size: 14px;
}

.ig-segment span {
  margin-top: 2px;
  color: #9ca3af;
  font-size: 10px;
}

.ig-segment:hover {
  border-color: #5eead4;
}

.ig-segment.is-active {
  border-color: #0d9488;
  background: #f0fdfa;
  color: #0f766e;
  box-shadow: inset 0 0 0 1px #0d9488;
}

.ig-message {
  margin-top: 16px;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
}

.ig-error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.ig-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.ig-primary,
.ig-secondary,
.ig-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  cursor: pointer;
}

.ig-primary {
  flex: 1;
  border: 1px solid #0d9488;
  background: #0d9488;
  color: #fff;
  padding: 9px 16px;
}

.ig-primary:hover {
  background: #0f766e;
}

.ig-primary:disabled {
  cursor: wait;
  opacity: 0.62;
}

.ig-primary svg {
  width: 18px;
  height: 18px;
}

.ig-secondary {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  padding: 9px 16px;
}

.ig-output {
  min-height: 620px;
  padding: 22px;
}

.ig-output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e5e7eb;
}

.ig-output-head h2 {
  margin: 0;
  color: #111827;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0;
}

.ig-output-head p {
  margin: 5px 0 0;
  color: #6b7280;
  font-size: 13px;
}

.ig-badge {
  flex: 0 0 auto;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #f9fafb;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 9px;
}

.ig-badge[data-tone="busy"] {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.ig-badge[data-tone="success"] {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.ig-badge[data-tone="error"] {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.ig-empty,
.ig-loading {
  display: flex;
  min-height: 500px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  text-align: center;
}

.ig-empty[hidden],
.ig-loading[hidden] {
  display: none;
}

.ig-empty strong,
.ig-loading strong {
  margin-top: 14px;
  color: #374151;
  font-size: 15px;
}

.ig-empty span,
.ig-loading span {
  margin-top: 5px;
  font-size: 13px;
}

.ig-empty-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #eff6ff;
  color: #2563eb;
}

.ig-empty-icon svg {
  width: 26px;
  height: 26px;
}

.ig-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #ccfbf1;
  border-top-color: #0d9488;
  border-radius: 50%;
  animation: ig-spin 800ms linear infinite;
}

@keyframes ig-spin {
  to { transform: rotate(360deg); }
}

.ig-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding-top: 18px;
}

.ig-result-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.ig-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: #f3f4f6;
}

.ig-image-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ig-result-meta {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  color: #6b7280;
  font-size: 12px;
}

.ig-download {
  min-height: 34px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  padding: 6px 9px;
}

.ig-download:hover {
  border-color: #5eead4;
  color: #0f766e;
}

.ig-download svg {
  width: 16px;
  height: 16px;
}

.ig-revised {
  margin: 0;
  border-top: 1px solid #e5e7eb;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.5;
  padding: 10px 12px;
}

.dark .ig-page { color: #f3f4f6; }
.dark .ig-panel,
.dark .ig-input,
.dark .ig-segment,
.dark .ig-secondary,
.dark .ig-result-card,
.dark .ig-download {
  border-color: #374151;
  background: #111827;
  color: #e5e7eb;
}
.dark .ig-field label,
.dark .ig-label-row label,
.dark .ig-output-head h2,
.dark .ig-empty strong,
.dark .ig-loading strong { color: #f3f4f6; }
.dark .ig-output-head,
.dark .ig-revised { border-color: #374151; }
.dark .ig-output-head p,
.dark .ig-revised,
.dark .ig-result-meta { color: #9ca3af; }
.dark .ig-icon-button:hover { background: #1f2937; color: #fff; }
.dark .ig-segment.is-active { border-color: #2dd4bf; background: rgba(13, 148, 136, 0.15); color: #5eead4; }
.dark .ig-image-wrap { background: #0b1220; }
.dark .ig-empty-icon { border-color: #1e3a5f; background: #111f35; color: #60a5fa; }

@media (max-width: 1040px) {
  .ig-layout { grid-template-columns: 1fr; }
  .ig-output { min-height: 520px; }
  .ig-empty, .ig-loading { min-height: 390px; }
}

@media (max-width: 640px) {
  .ig-controls, .ig-output { padding: 16px; }
  .ig-two-fields { grid-template-columns: 1fr; }
  .ig-results { grid-template-columns: 1fr; }
  .ig-segment span { font-size: 9px; }
  .ig-output-head { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .ig-spinner { animation-duration: 1.6s; }
}
