:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #f4f5f3;
  color: #17191b;
  letter-spacing: 0;
  --ink: #17191b;
  --muted: #676d70;
  --line: #d7dad7;
  --surface: #ffffff;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --warning: #b45309;
  --danger: #b42318;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #f4f5f3;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.appbar {
  min-height: 96px;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 18px max(20px, env(safe-area-inset-left));
  color: #fff;
  background: #151719;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-bottom: 4px solid var(--accent);
}

.eyebrow { margin: 0 0 4px; color: #9ca3a5; font-size: 11px; font-weight: 700; }
h1 { margin: 0; font-size: 28px; line-height: 1; }
h2 { margin: 0; font-size: 18px; line-height: 1.3; }

.status { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #8b9295; }
.status[data-state="online"] .status-dot { background: #35c58b; box-shadow: 0 0 0 4px rgba(53,197,139,.14); }
.status[data-state="offline"] .status-dot { background: #f59e0b; }
.status[data-state="error"] .status-dot { background: #ef4444; }

main { width: min(760px, 100%); margin: 0 auto; padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
section { padding: 24px 20px; border-bottom: 1px solid var(--line); }

.auth-panel { margin-top: 24px; background: var(--surface); }
.section-heading { margin-bottom: 18px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.section-heading.horizontal { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }

label, .label { display: block; margin: 0 0 7px; color: #404548; font-size: 13px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid #bcc2bf;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
input, select { height: 44px; padding: 0 12px; }
textarea { padding: 12px; resize: vertical; min-height: 144px; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15,118,110,.13); }

.input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.button-row { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; margin-top: 22px; }
.button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 700;
}
.button:disabled { opacity: .48; cursor: not-allowed; }
.button.primary { color: #fff; background: var(--accent); }
.button.primary:hover { background: var(--accent-strong); }
.button.secondary { color: var(--ink); background: #fff; border-color: #aeb5b2; }
.button.danger { color: var(--danger); background: #fff; border-color: #e6aaa4; }
.button.compact { min-height: 36px; padding: 0 13px; }
.run-button { min-height: 50px; }

.system-strip {
  padding-block: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #e9ece9;
}
.system-strip .label { margin: 0; color: var(--muted); font-size: 11px; }
.system-strip strong { display: block; margin-top: 2px; font-size: 14px; }
.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid #b8bebb;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.control-section, .result-section { background: var(--surface); }
.control-section select { margin-bottom: 18px; }
.seed-row { display: flex; align-items: center; gap: 11px; margin-top: 14px; color: #34393b; }
.seed-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 6px; color: #fff; background: var(--warning); font-weight: 800; }
.seed-row strong, .seed-row span { display: block; }
.seed-row div span { color: var(--muted); font-size: 12px; }

.job-section { background: #eef0ed; }
.notice { min-height: 22px; margin: 12px 0 0; color: #394044; font-size: 14px; line-height: 1.55; }
.notice.error, .error { color: var(--danger); }
.error { min-height: 20px; margin: 8px 0 0; font-size: 13px; }
.progress-track { height: 4px; overflow: hidden; background: #ced3cf; }
.progress-bar { width: 36%; height: 100%; background: var(--accent); animation: loading 1.3s ease-in-out infinite alternate; }
@keyframes loading { from { transform: translateX(-60%); } to { transform: translateX(240%); } }

.result-section pre {
  margin: 0;
  padding: 16px;
  max-height: 480px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f8f6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.65;
}
.result-images { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-bottom: 12px; }
.result-images:empty { display: none; }
.result-images img { display: block; width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--line); background: #e8eae7; }

[hidden] { display: none !important; }

@media (max-width: 480px) {
  .appbar { min-height: 88px; }
  section { padding-inline: 16px; }
  .button-row { grid-template-columns: 1fr; }
  .result-images { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .progress-bar { animation: none; width: 100%; }
}
