:root {
  color-scheme: light;
  font-family: 'Inter', 'SF Pro Display', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  line-height: 1.6;
  font-size: 16px;
  --bg-gradient: linear-gradient(145deg, #0f172a 0%, #1e3a8a 45%, #7c3aed 100%);
  --panel-bg: rgba(15, 23, 42, 0.75);
  --panel-border: rgba(148, 163, 184, 0.4);
  --panel-shadow: 0 30px 80px rgba(2, 6, 23, 0.35);
  --primary: #38bdf8;
  --primary-dark: #0ea5e9;
  --secondary: rgba(56, 189, 248, 0.12);
  --success: #4ade80;
  --warning: #facc15;
  --danger: #f87171;
  --text-strong: #e2e8f0;
  --text-muted: #94a3b8;
  --card-bg: rgba(15, 23, 42, 0.55);
  --card-border: rgba(148, 163, 184, 0.25);
  --transition: 0.25s ease;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-gradient);
  color: var(--text-strong);
  -webkit-font-smoothing: antialiased;
}

.aurora {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.24), transparent 40%),
    radial-gradient(circle at 80% 10%, rgba(129, 140, 248, 0.2), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(79, 70, 229, 0.2), transparent 45%);
  filter: blur(60px);
  opacity: 0.8;
  animation: auroraMove 18s ease-in-out infinite alternate;
}

@keyframes auroraMove {
  0% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(5%, -2%, 0);
  }
  100% {
    transform: translate3d(-4%, 3%, 0);
  }
}

.page {
  position: relative;
  z-index: 1;
  padding: 40px clamp(24px, 6vw, 96px) 120px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 700;
}

.page-header p {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

button {
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    border-color var(--transition),
    background-color var(--transition);
  color: #0f172a;
}

button.primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #0f172a;
  box-shadow: 0 14px 35px rgba(14, 165, 233, 0.35);
}

button.primary.pulse {
  position: relative;
  overflow: hidden;
}

button.primary.pulse::after {
  content: '';
  position: absolute;
  inset: -60%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.35) 0%, transparent 65%);
  transform: scale(0);
  opacity: 0;
  transition:
    transform 0.5s ease,
    opacity 0.4s ease;
}

button.primary.pulse:hover::after {
  transform: scale(1);
  opacity: 1;
}

button.primary:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

button.secondary {
  background: rgba(148, 163, 184, 0.15);
  border-color: rgba(148, 163, 184, 0.35);
  color: var(--text-strong);
}

button.ghost {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.35);
  color: var(--text-strong);
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(15, 118, 191, 0.25);
}

button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 4px 16px rgba(15, 118, 191, 0.4);
}

.layout {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.panel {
  position: relative;
  border-radius: 20px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(24px);
}

.panel__title {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  color: var(--text-strong);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 8px 12px;
  margin: -8px -12px;
  border: none;
  background: none;
  flex: 1 1 auto;
  min-width: 0;
  user-select: none;
  position: relative;
  z-index: 1;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.panel__title:hover {
  background-color: rgba(56, 189, 248, 0.08);
}

.panel__title:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35);
  border-radius: 12px;
}

.panel__title-text {
  pointer-events: none;
}

.panel__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
  align-self: flex-start;
  min-width: 0;
}

.panel__actions button {
  padding: 6px 14px;
  font-size: 0.85rem;
  border-radius: 12px;
  white-space: nowrap;
}

.panel__actions--config button.ghost {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  color: var(--primary);
}

.panel__actions--config button.ghost:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.42);
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 24px clamp(20px, 5vw, 32px) 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.panel__body {
  padding: 16px clamp(20px, 5vw, 32px) clamp(24px, 5vw, 36px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel--collapsed .panel__body {
  padding-top: 0;
  padding-bottom: 0;
}

.panel__icon {
  width: 12px;
  height: 12px;
  border-right: 2px solid rgba(226, 232, 240, 0.85);
  border-bottom: 2px solid rgba(226, 232, 240, 0.85);
  transform: rotate(45deg);
  transition:
    transform 0.28s ease,
    border-color 0.28s ease,
    background-color 0.28s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 12px;
  padding: 12px;
  border-radius: 50%;
  cursor: pointer;
  outline: none;
}

.panel--collapsed .panel__header {
  border-bottom: none;
  padding-bottom: clamp(24px, 5vw, 32px);
}

.panel--collapsed .panel__body {
  padding-top: 0;
  padding-bottom: 0;
}

.panel__icon:hover {
  border-color: rgba(56, 189, 248, 0.85);
  background: rgba(56, 189, 248, 0.12);
}

.panel__icon:focus-visible {
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35);
}

.panel__title:hover .panel__icon {
  border-color: rgba(56, 189, 248, 0.85);
}

.panel--collapsed .panel__icon {
  transform: rotate(-135deg);
  border-color: rgba(148, 163, 184, 0.7);
}

.config-group {
  margin-bottom: 20px;
}

.config-group:last-child {
  margin-bottom: 0;
}

.config-group h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
}

.hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.credentials .form-grid {
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 768px) {
  .credentials .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.88rem;
  min-width: 0;
}

.form-field span {
  color: var(--text-strong);
  font-weight: 500;
}

.form-field input,
.form-field textarea {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  padding: 12px 16px;
  color: var(--text-strong);
  font-size: 1rem;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
  resize: vertical;
  min-height: 48px;
}

.form-field textarea {
  min-height: 180px;
  font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  font-size: 0.85rem;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.form-field input:focus-visible,
.form-field textarea:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field.toggle {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.form-field.toggle span {
  flex: 1;
  min-width: 0;
}

.form-field.toggle .toggle-switch {
  margin-left: 16px;
}

.inline-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
  align-items: center;
}

.inline-inputs input {
  width: 100%;
}

.inline-inputs .divider {
  justify-self: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.drop-zone {
  border-radius: 24px;
  padding: 40px 24px;
  border: 1px dashed rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.45);
  text-align: center;
  transition:
    border-color var(--transition),
    transform var(--transition),
    background-color var(--transition);
  cursor: pointer;
}

.drop-zone__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}

.drop-zone__icon {
  font-size: 2.5rem;
}

.drop-zone.dragover {
  border-color: var(--primary);
  background: rgba(56, 189, 248, 0.12);
  transform: translateY(-4px);
}

.input-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toggle-list--compact {
  gap: 10px;
  flex-direction: column;
}

.toggle-list--compact .toggle-item {
  min-height: 72px;
  align-items: flex-start;
  padding-top: 14px;
  padding-bottom: 14px;
  width: 100%;
}

.toggle-list--wrap {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px;
}

.toggle-list--wrap .toggle-item {
  flex: 0 1 auto;
  min-width: 240px;
  width: calc(33.333% - 8px);
  align-items: flex-start;
  padding-top: 14px;
  padding-bottom: 14px;
}

@media (max-width: 1200px) {
  .toggle-list--wrap .toggle-item {
    width: calc(50% - 6px);
  }
}

@media (max-width: 768px) {
  .toggle-list--wrap .toggle-item {
    width: 100%;
  }
}

.toggle-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1 1 220px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  padding: 14px 16px;
  min-width: 200px;
  min-height: 72px;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition),
    background-color var(--transition);
}

.toggle-item:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(56, 189, 248, 0.18);
  background: rgba(56, 189, 248, 0.12);
}

.toggle-item__summary {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  flex: 1;
  min-width: 0;
  justify-content: flex-start;
  padding-top: 2px;
}

.toggle-item__title {
  color: var(--text-strong);
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.toggle-item__desc {
  color: rgba(226, 232, 240, 0.65);
  font-size: 0.8rem;
  line-height: 1.4;
  white-space: normal;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.toggle-switch {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.3);
  border: 1px solid rgba(148, 163, 184, 0.45);
  cursor: pointer;
  transition:
    background-color var(--transition),
    border-color var(--transition);
  appearance: none;
  flex-shrink: 0;
  margin-top: 2px;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e2e8f0;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.3);
  transition:
    transform var(--transition),
    background-color var(--transition),
    box-shadow var(--transition);
}

.toggle-switch:checked {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-color: rgba(14, 165, 233, 0.6);
}

.toggle-switch:checked::after {
  transform: translateX(20px);
  background: #0f172a;
  box-shadow: 0 6px 14px rgba(56, 189, 248, 0.35);
}

.toggle-switch:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35);
}

.toggle-item .toggle-switch {
  order: 2;
  margin-left: auto;
  flex-shrink: 0;
}

.toggle-list .toggle-switch,
.form-field.toggle .toggle-switch {
  margin-left: auto;
}

.docs-content {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.7;
}

.docs-content h3 {
  color: var(--text-strong);
  font-size: 0.92rem;
  margin: 12px 0 6px;
}

.docs-content ul {
  margin: 6px 0 12px 18px;
  padding: 0;
}

.docs-content code {
  background: rgba(148, 163, 184, 0.15);
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--primary);
  font-size: 0.78rem;
}

.docs-content p {
  margin: 6px 0;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 999;
}

.modal--open {
  opacity: 1;
  pointer-events: auto;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
}

.modal__content {
  position: relative;
  z-index: 1;
  width: min(720px, 92vw);
  max-height: 80vh;
  overflow: auto;
  padding: 32px;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 40px 120px rgba(2, 6, 23, 0.5);
}

.modal__header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.75);
  color: var(--text-strong);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition:
    transform var(--transition),
    background-color var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.modal__close:hover {
  transform: scale(1.08);
  background: rgba(56, 189, 248, 0.22);
}

.modal-open {
  overflow: hidden;
}

@media (max-width: 600px) {
  .modal__content {
    padding: 24px;
  }
}

.config-group.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.config-group.grid .form-field {
  margin: 0;
}

.config-group.advanced summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 600;
  list-style: none;
  padding: 8px 0;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.config-group.advanced summary:hover {
  color: var(--primary-dark);
}

.config-group.advanced[open] summary {
  margin-bottom: 12px;
}

.config-group.advanced summary::-webkit-details-marker {
  display: none;
}

.config-group.advanced {
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 18px;
  padding: 16px 20px;
  background: rgba(15, 23, 42, 0.5);
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease;
  margin-top: 8px;
}

.config-group.advanced[open] {
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 24px 48px rgba(15, 118, 191, 0.18);
}

.json-editor {
  position: relative;
}

.config-group.advanced textarea {
  background: rgba(10, 17, 32, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 0.85rem;
  color: var(--text-strong);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.1);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  width: 100%;
  margin-top: 4px;
}

.config-group.advanced textarea:focus-visible {
  border-color: var(--primary);
  box-shadow:
    0 0 0 1px var(--primary),
    inset 0 0 0 1px rgba(56, 189, 248, 0.3);
}

.config-group.advanced textarea.json-error {
  border-color: var(--danger);
  box-shadow:
    0 0 0 1px var(--danger),
    inset 0 0 0 1px rgba(248, 113, 113, 0.2);
}

.config-group.advanced textarea.json-valid {
  border-color: var(--success);
  box-shadow:
    0 0 0 1px var(--success),
    inset 0 0 0 1px rgba(74, 222, 128, 0.2);
}

.json-validation {
  min-height: 24px;
  margin-top: 8px;
  font-size: 0.82rem;
  line-height: 1.4;
  padding: 0 4px;
  transition: opacity 0.2s ease;
}

.json-validation.error {
  color: var(--danger);
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.json-validation.error::before {
  content: '⚠';
  flex-shrink: 0;
  font-size: 1rem;
}

.json-validation.success {
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 6px;
}

.json-validation.success::before {
  content: '✓';
  flex-shrink: 0;
  font-size: 1rem;
}

.json-validation.info {
  color: var(--text-muted);
  font-style: italic;
}

input[type='range'] {
  accent-color: var(--primary);
}

.actions__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

#statusMessage {
  min-height: 24px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.payload-preview pre {
  margin: 10px 0 0;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  padding: 14px;
  max-height: 320px;
  overflow: auto;
  font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  font-size: 0.82rem;
  color: var(--text-strong);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.image-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 18px;
  backdrop-filter: blur(18px);
  transition:
    transform var(--transition),
    box-shadow var(--transition);
}

.image-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 42px rgba(15, 118, 191, 0.25);
}

.image-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.image-card__title {
  margin: 0;
  font-size: 0.95rem;
}

.image-card__size {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.image-card__status {
  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-strong);
}

.image-card__status[data-status='完成'] {
  background: rgba(74, 222, 128, 0.2);
  color: var(--success);
}

.image-card__status[data-status='失败'] {
  background: rgba(248, 113, 113, 0.2);
  color: var(--danger);
}

.image-card__body {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  container-type: inline-size;
}

.image-card__left {
  flex: 0 0 600px;
  min-width: 600px;
  display: flex;
  flex-direction: column;
}

.image-card__right {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 400px;
  max-height: 800px;
  overflow: hidden;
  min-width: 0;
}

.image-card__right .tab-container {
  flex: 1;
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (max-width: 1200px) {
  .image-card__body {
    flex-direction: column;
  }

  .image-card__left {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
  }

  .image-card__right {
    flex: 1 1 auto;
    width: 100%;
    max-height: 500px !important;
    min-height: 300px;
  }
}

.image-preview {
  position: relative;
  width: 600px;
  height: 600px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.bounding-box {
  position: absolute;
  border: 2px solid #3b82f6;
  background: transparent;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  transform: translateZ(0);
  cursor: pointer;
  transition: all 0.2s ease;
  pointer-events: auto;
}

.bounding-box:hover {
  border-color: #60a5fa;
  background: rgba(59, 130, 246, 0.1);
}

.bounding-box.active {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3);
}

.bounding-box__label {
  position: absolute;
  bottom: 100%;
  left: 0;
  background: #3b82f6;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 4px 4px 0 0;
  font-size: 0.75rem;
  white-space: nowrap;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bounding-box.active .bounding-box__label {
  background: #f59e0b;
}

/* Tab 容器 */
.tab-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  overflow: hidden;
}

.tab-header {
  display: flex;
  flex-shrink: 0;
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.tab-button {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab-button:hover {
  color: var(--text-strong);
  background: rgba(148, 163, 184, 0.1);
}

.tab-button.active {
  color: var(--primary);
  background: rgba(59, 130, 246, 0.1);
}

.tab-button.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
}

.tab-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tab-panel {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 16px;
  flex: 1;
  min-height: 0;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
}

.tab-panel[data-panel='response'] {
  padding: 0;
}

.response-header {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.copy-response-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 6px;
  color: var(--primary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-response-btn:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.copy-response-btn .copy-icon {
  font-size: 1rem;
}

.copy-response-btn.copied {
  background: rgba(74, 222, 128, 0.2);
  border-color: var(--success);
  color: var(--success);
}

.tab-panel[data-panel='response'] .response-json {
  margin: 0;
  padding: 16px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.tab-panel[data-panel='annotations'] {
  padding: 16px;
  overflow-y: auto;
}

.tab-panel[data-panel='annotations'] .annotation-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, 400px);
  gap: 16px;
  align-items: start;
  justify-content: start;
}

.annotation-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--primary);
  color: var(--bg-primary);
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* 空状态 */
.annotation-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.annotation-empty__icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.6;
}

.annotation-empty__text {
  font-size: 1rem;
  color: var(--text-strong);
  margin-bottom: 8px;
  font-weight: 500;
}

.annotation-empty__hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.annotation-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  width: 400px;
  height: 100px;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.annotation-item:hover {
  background: rgba(30, 41, 59, 0.7);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.2);
}

.annotation-item.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.annotation-item__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.annotation-item__index {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--primary);
  color: var(--bg-primary);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.annotation-item.active .annotation-item__index {
  background: #f59e0b;
}

.annotation-item__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.annotation-item__type {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(59, 130, 246, 0.2);
  color: var(--primary);
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.annotation-item__text {
  color: var(--text-strong);
  font-size: 0.85rem;
  line-height: 1.3;
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.annotation-item__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.annotation-item__confidence {
  display: flex;
  align-items: center;
  gap: 4px;
}

.confidence-bar {
  width: 30px;
  height: 3px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.confidence-bar__fill {
  height: 100%;
  background: var(--success);
  transition: width 0.3s ease;
}

/* 标注详情按钮 */
.annotation-item__detail {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 6px;
  color: var(--primary);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.annotation-item__detail:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: var(--primary);
  transform: scale(1.05);
}

.annotation-item__detail:active {
  transform: scale(0.95);
}

/* 标注详情模态框内容 */
.modal__content--detail {
  max-width: 800px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.annotation-detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px 24px;
}

.detail-section {
  margin-bottom: 16px;
}

.detail-section:last-child {
  margin-bottom: 0;
}

.detail-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary);
  margin: 0 0 8px 0;
  padding-bottom: 6px;
  border-bottom: 2px solid rgba(59, 130, 246, 0.2);
}

.detail-info-compact {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 6px;
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-row--full {
  flex-wrap: wrap;
}

.detail-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
  min-width: 60px;
}

.detail-value {
  font-size: 0.9rem;
  color: var(--text-strong);
  font-weight: 500;
  flex: 1;
}

.detail-badge {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(59, 130, 246, 0.2);
  color: var(--primary);
  border-radius: 10px;
  font-size: 0.8rem;
}

.detail-text-box {
  padding: 12px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  color: var(--text-strong);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 50px;
}

.detail-json {
  margin: 0;
  padding: 12px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  font-size: 0.75rem;
  color: var(--text-strong);
  line-height: 1.4;
  max-height: 250px;
  overflow-y: auto;
}

.response-json {
  margin: 0;
  padding: 16px;
  background: rgba(15, 23, 42, 0.75);
  border: none;
  overflow-y: auto;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  font-size: 0.82rem;
  color: var(--text-strong);
  word-wrap: break-word;
  white-space: pre-wrap;
}

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

  .panel {
    padding: 22px;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

@media (max-width: 600px) {
  .page {
    padding: 24px 18px 80px;
  }

  button {
    width: 100%;
    justify-content: center;
  }

  .input-actions {
    flex-direction: column;
  }

  .toggle-item {
    min-width: unset;
    width: 100%;
  }
}
