:root {
  --page: #f4f8f6;
  --surface: #ffffff;
  --surface-soft: #ecfdf5;
  --surface-warm: #fff7ed;
  --surface-cool: #eff6ff;
  --text: #17211d;
  --muted: #65736c;
  --line: #d7e2dd;
  --accent: #0f9f72;
  --accent-strong: #047857;
  --accent-soft: #d1fae5;
  --warn: #f59e0b;
  --danger: #dc2626;
  --info: #2563eb;
  --shadow: 0 24px 70px rgba(23, 33, 29, 0.13);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(15, 159, 114, 0.1), transparent 280px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(15, 159, 114, 0.06) 1px, transparent 1px),
    var(--page);
  background-size: auto, 46px 46px, 46px 46px, auto;
  color: var(--text);
  line-height: 1.55;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border-radius: 8px;
}

a {
  color: var(--accent-strong);
}

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

.topbar {
  display: grid;
  gap: 22px;
  margin-bottom: 22px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.brand {
  display: grid;
  gap: 8px;
  text-align: center;
}

.eyebrow {
  width: fit-content;
  margin: 0 auto;
  padding: 6px 10px;
  border: 1px solid rgba(15, 159, 114, 0.35);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.15;
  letter-spacing: 0;
}

.nav-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.tab,
.lang-btn,
.btn,
.mini-btn,
.copy-btn,
.channel-pill,
.choice-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.tab {
  min-width: 112px;
  padding: 11px 16px;
  font-weight: 700;
}

.tab:hover,
.lang-btn:hover,
.mini-btn:hover,
.copy-btn:hover,
.channel-pill:hover,
.choice-btn:hover {
  border-color: rgba(15, 159, 114, 0.55);
  transform: translateY(-1px);
}

.tab.active,
.lang-btn.active,
.channel-pill.active,
.choice-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.lang-switch {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.lang-btn {
  min-width: 42px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 800;
}

.panel {
  margin-bottom: 18px;
  padding: clamp(18px, 4vw, 30px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.step-wrap {
  display: grid;
  gap: 16px;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 8px;
  background: #dce7e2;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--info), var(--warn));
  transition: width 0.25s ease;
}

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

.step {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.step-num {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: #fff;
  font-weight: 900;
}

.step.active,
.step.done {
  color: var(--accent-strong);
  font-weight: 800;
}

.step.active .step-num,
.step.done .step-num {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.section-title-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.section-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.callout {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  background: var(--surface-warm);
  color: #713f12;
}

.field {
  display: grid;
  gap: 9px;
}

.input,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.input {
  min-height: 56px;
  padding: 0 16px;
}

.textarea {
  min-height: 190px;
  padding: 14px 16px;
  resize: vertical;
}

.input:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 159, 114, 0.14);
}

.error {
  color: var(--danger);
  font-size: 14px;
}

.success {
  color: var(--accent-strong);
  font-size: 14px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 18px;
  font-weight: 800;
}

.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.btn.secondary {
  background: #fff;
  color: var(--accent-strong);
}

.btn.block {
  width: 100%;
}

.btn:disabled,
.mini-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.mini-btn,
.copy-btn {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 800;
}

.session-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

.summary-box {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.summary-line {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.summary-line:last-child {
  border-bottom: 0;
}

.summary-k {
  color: var(--muted);
  font-weight: 800;
}

.summary-v {
  min-width: 0;
  overflow-wrap: anywhere;
}

.choice-box {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 8px;
  background: var(--surface-cool);
}

.choice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.choice-btn {
  min-width: 76px;
  padding: 8px 12px;
  font-weight: 800;
}

.submit-flow {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.submit-flow li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.flow-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #cbd5e1;
}

.submit-flow li.done {
  color: var(--accent-strong);
  font-weight: 800;
}

.submit-flow li.done .flow-dot {
  background: var(--accent);
}

.query-layout {
  display: grid;
  gap: 18px;
}

.badge {
  display: inline-flex;
  width: fit-content;
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.stat-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.stat-num {
  margin-top: 4px;
  font-size: 28px;
  font-weight: 900;
}

.copy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.table-scroll {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #f8fbfa;
  color: var(--muted);
}

.mono {
  font-family: "SFMono-Regular", Consolas, ui-monospace, monospace;
  overflow-wrap: anywhere;
}

.status {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 12px;
}

.status.unused {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status.used {
  background: #fee2e2;
  color: #991b1b;
}

.status.processing {
  background: #dbeafe;
  color: #1d4ed8;
}

.status.invalid {
  background: #ffedd5;
  color: #9a3412;
}

.empty {
  padding: 16px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  background: var(--surface-warm);
}

.raw {
  max-height: 360px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
  color: #e5e7eb;
  white-space: pre-wrap;
}

.guide-grid {
  display: grid;
  gap: 18px;
}

.guide-card {
  display: grid;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.guide-card:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.guide-card h2 {
  margin: 0;
  font-size: 21px;
}

.guide-card ol {
  margin: 0;
  padding-left: 22px;
}

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

figure {
  margin: 0;
}

.guide-img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: zoom-in;
}

figcaption {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(10, 15, 13, 0.58);
}

.modal {
  width: min(520px, 100%);
  max-height: min(88vh, 100%);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 19px;
}

.modal-body {
  padding: 18px;
}

.modal-foot {
  padding: 16px 18px;
  border-top: 1px solid var(--line);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.channel-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.channel-pill {
  display: grid;
  gap: 4px;
  padding: 12px;
  text-align: center;
}

.channel-sub {
  color: var(--muted);
  font-size: 12px;
}

.channel-pill.active .channel-sub {
  color: rgba(255, 255, 255, 0.86);
}

.toast-modal {
  width: min(380px, 100%);
  text-align: center;
}

.result-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 6px auto 12px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 28px;
  font-weight: 900;
}

.result-icon.fail {
  background: #fee2e2;
  color: #991b1b;
}

.lightbox-img {
  display: block;
  max-width: min(960px, 95vw);
  max-height: 86vh;
  border-radius: 8px;
  background: #fff;
}

@media (max-width: 780px) {
  .topbar {
    padding: 20px;
  }

  .steps,
  .stat-grid,
  .figure-grid,
  .channel-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .summary-line {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 460px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 16px;
  }

  .nav-row,
  .actions,
  .session-tools {
    align-items: stretch;
  }

  .tab,
  .btn,
  .mini-btn,
  .copy-btn {
    flex: 1 1 auto;
  }

  .steps,
  .stat-grid,
  .figure-grid,
  .channel-list {
    grid-template-columns: 1fr;
  }
}
