* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #ebf1ff;
  background:
    radial-gradient(circle at top left, rgba(67, 97, 238, 0.26), transparent 28%),
    radial-gradient(circle at top right, rgba(76, 201, 240, 0.18), transparent 24%),
    linear-gradient(180deg, #09111f 0%, #111827 100%);
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar,
.panel,
.summary-card {
  background: rgba(12, 19, 35, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.14);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-radius: 24px;
}

.brand {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.status {
  margin-top: 6px;
  color: #cbd5e1;
}

.status.ok {
  color: #7dd3fc;
}

.status.idle {
  color: #f8fafc;
  opacity: 0.78;
}

.summary-grid,
.workspace-grid {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-card {
  border-radius: 20px;
  padding: 18px;
}

.summary-card .label {
  display: block;
  font-size: 0.92rem;
  color: #94a3b8;
  margin-bottom: 8px;
}

.summary-card strong {
  display: block;
  font-size: 1rem;
  word-break: break-all;
}

.workspace-grid {
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
}

.panel {
  border-radius: 28px;
  padding: 24px;
}

.panel-head h1,
.panel-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

.panel-head p {
  margin: 8px 0 0;
  color: #9fb2cf;
  line-height: 1.55;
}

.image-form {
  margin-top: 20px;
}

.field,
.field-row {
  display: grid;
  gap: 14px;
}

.field {
  margin-bottom: 16px;
}

.field-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field span {
  color: #cfe0ff;
  font-size: 0.95rem;
}

select,
textarea,
input[type="file"] {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.88);
  color: #f8fafc;
  padding: 14px 16px;
}

textarea {
  resize: vertical;
  min-height: 160px;
}

.upload-field small {
  color: #7f8ea8;
}

.tip-box {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(30, 41, 59, 0.62);
  border: 1px dashed rgba(125, 211, 252, 0.2);
  color: #bfd3f2;
  line-height: 1.6;
  margin-bottom: 18px;
}

.tip-box p {
  margin: 0;
}

.actions {
  display: flex;
  gap: 12px;
}

button {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 12px 18px;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.primary {
  background: linear-gradient(135deg, #38bdf8, #4361ee);
  color: #fff;
  font-weight: 600;
}

.ghost {
  background: rgba(148, 163, 184, 0.1);
  color: #d9e6ff;
}

.error-box {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(248, 113, 113, 0.32);
  color: #fecaca;
  white-space: pre-wrap;
}

.hidden {
  display: none;
}

.result-grid,
.history-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.result-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.history-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: #8da2c0;
  border: 1px dashed rgba(148, 163, 184, 0.24);
  border-radius: 20px;
}

.result-card,
.history-card {
  overflow: hidden;
  border-radius: 22px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.result-card img,
.history-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.result-card-actions {
  padding: 12px;
}

.result-card-actions button {
  width: 100%;
  background: rgba(56, 189, 248, 0.12);
  color: #d8f4ff;
}

.history-card {
  cursor: pointer;
}

.history-card-body {
  padding: 12px;
}

.history-card-body p {
  margin: 0;
  color: #deebff;
  line-height: 1.5;
}

.history-card-meta {
  margin-top: 8px;
  font-size: 0.86rem;
  color: #8ca0bb;
}

@media (max-width: 980px) {
  .summary-grid,
  .workspace-grid,
  .field-row,
  .result-grid,
  .history-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .app-shell {
    width: min(100% - 20px, 1200px);
    padding-top: 18px;
  }
}
