:root {
  --bg: #f3f7f0;
  --bg-deep: #d9e6d8;
  --panel: rgba(255, 252, 247, 0.86);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --text: #193129;
  --muted: #667970;
  --line: rgba(25, 49, 41, 0.12);
  --line-strong: rgba(25, 49, 41, 0.2);
  --brand: #0c7d57;
  --brand-deep: #0a5b3f;
  --accent: #d7773c;
  --danger: #b24646;
  --shadow: 0 26px 68px rgba(22, 42, 31, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(12, 125, 87, 0.18), transparent 28%),
    radial-gradient(circle at 88% 0%, rgba(215, 119, 60, 0.16), transparent 24%),
    linear-gradient(180deg, #fbfdf9 0%, var(--bg) 56%, var(--bg-deep) 100%);
}

body.drawer-open {
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16)),
    repeating-linear-gradient(
      90deg,
      rgba(25, 49, 41, 0.025) 0,
      rgba(25, 49, 41, 0.025) 1px,
      transparent 1px,
      transparent 84px
    );
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 90%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  box-shadow: 0 10px 26px rgba(12, 125, 87, 0.16);
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(12, 125, 87, 0.22);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

button.secondary {
  color: var(--text);
  background: linear-gradient(135deg, #f7f3eb 0%, #eaf0e8 100%);
}

button.ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

input:focus {
  border-color: rgba(12, 125, 87, 0.42);
  box-shadow: 0 0 0 4px rgba(12, 125, 87, 0.08);
  background: #fff;
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  outline: none;
  resize: vertical;
  min-height: 96px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

textarea:focus {
  border-color: rgba(12, 125, 87, 0.42);
  box-shadow: 0 0 0 4px rgba(12, 125, 87, 0.08);
  background: #fff;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: calc(100vw - 24px);
  max-width: none;
  min-width: 320px;
  margin: 0 auto;
  padding: 24px 0 44px;
}

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 36%);
}

.topbar,
.workspace-panel,
.result-panel,
.account-drawer {
  position: relative;
}

.topbar {
  padding: 24px;
}

.brand-row,
.top-actions,
.section-head,
.section-head-wide,
.action-row,
.drawer-head {
  display: flex;
  gap: 12px;
}

.brand-row,
.section-head,
.drawer-head {
  justify-content: space-between;
  align-items: flex-start;
}

.brand-copy,
.workspace-panel,
.result-panel,
.account-drawer {
  z-index: 1;
}

.eyebrow,
.section-kicker,
.upload-kicker {
  margin: 0;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 10px;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

h2 {
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -0.03em;
}

h3 {
  font-size: 20px;
}

.hero-text,
.section-note,
.summary-text,
.meta-label,
.field span,
.help-text,
.drawer-note,
.result-detail,
.file-meta,
.detail-card summary {
  color: var(--muted);
}

.hero-text {
  max-width: 52ch;
  margin-top: 16px;
  line-height: 1.7;
}

.top-actions {
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-nav {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-top: 22px;
  margin-top: 18px;
  border-top: 1px solid rgba(25, 49, 41, 0.08);
  scrollbar-width: none;
}

.top-nav::-webkit-scrollbar {
  display: none;
}

.nav-pill,
.chip,
.summary-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}

.nav-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-weight: 700;
  padding: 12px 16px;
  box-shadow: none;
}

.nav-pill.active {
  background: linear-gradient(135deg, rgba(12, 125, 87, 0.16), rgba(215, 119, 60, 0.18));
  border-color: rgba(12, 125, 87, 0.22);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.82fr);
  gap: 20px;
  margin-top: 20px;
}

.workspace-panel,
.result-panel {
  padding: 22px;
}

.section-head-wide {
  justify-content: space-between;
  align-items: flex-start;
}

.section-note {
  margin-top: 8px;
  line-height: 1.7;
}

.summary-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.summary-pill {
  padding: 10px 14px;
  color: var(--brand);
  background: rgba(12, 125, 87, 0.1);
  font-weight: 800;
}

.upload-zone {
  position: relative;
  display: grid;
  gap: 10px;
  justify-items: start;
  margin-top: 18px;
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1.5px dashed rgba(12, 125, 87, 0.34);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(243, 248, 242, 0.92));
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.upload-zone:hover,
.upload-zone.dragover {
  transform: translateY(-1px);
  border-color: rgba(215, 119, 60, 0.56);
  background: linear-gradient(180deg, rgba(255, 250, 245, 0.96), rgba(245, 249, 241, 0.96));
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-zone strong {
  font-size: clamp(18px, 3vw, 24px);
  line-height: 1.3;
}

.file-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 10px;
}

.file-item,
.empty-inline,
.option-field,
.result-card,
.drawer-card,
.detail-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
}

.file-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
}

.file-title,
.result-card strong,
.drawer-status strong {
  word-break: break-word;
}

.file-title {
  font-weight: 800;
}

.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.file-actions button {
  padding: 9px 12px;
  font-size: 13px;
}

.empty-inline {
  padding: 18px;
  text-align: center;
  border-style: dashed;
  color: var(--muted);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.option-field {
  display: block;
  padding: 14px;
}

.option-field span,
.meta-label,
.field span {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}

.result-stack {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.result-card {
  padding: 16px;
}

.result-card strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(20px, 3vw, 26px);
  line-height: 1.35;
}

.result-detail {
  margin-top: 10px;
  line-height: 1.7;
}

.progress-box {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(25, 49, 41, 0.14);
  background: rgba(25, 49, 41, 0.09);
  overflow: hidden;
}

.progress-bar {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
  transition: width 360ms ease;
}

.result-action-card button {
  margin-top: 14px;
}

.feedback-card strong {
  font-size: 20px;
}

.feedback-card .field {
  margin-top: 12px;
}

.feedback-card button {
  margin-top: 14px;
}

.chip {
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 800;
}

.chip.neutral {
  background: rgba(102, 121, 112, 0.12);
  color: var(--muted);
}

.chip.success {
  background: rgba(12, 125, 87, 0.12);
  color: var(--brand);
}

.chip.error {
  background: rgba(178, 70, 70, 0.12);
  color: var(--danger);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 27, 20, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 20;
}

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

.account-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(460px, 100vw);
  height: 100vh;
  padding: 22px;
  background: rgba(252, 249, 244, 0.96);
  backdrop-filter: blur(18px);
  box-shadow: -22px 0 50px rgba(18, 35, 26, 0.16);
  transform: translateX(110%);
  transition: transform 220ms ease;
  z-index: 21;
  overflow-y: auto;
}

.account-drawer.open {
  transform: translateX(0);
}

.drawer-note {
  margin-top: 14px;
  line-height: 1.7;
}

.drawer-card {
  margin-top: 14px;
  padding: 16px;
}

.drawer-status {
  display: grid;
  gap: 10px;
}

.field {
  display: block;
  margin-top: 12px;
}

.action-row {
  margin-top: 14px;
}

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

.detail-card {
  overflow: hidden;
  padding: 0;
}

.detail-card summary {
  list-style: none;
  padding: 16px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.detail-card summary::-webkit-details-marker {
  display: none;
}

.detail-card summary::after {
  content: "+";
  float: right;
  color: var(--brand);
  font-size: 20px;
  line-height: 1;
}

.detail-card[open] summary::after {
  content: "-";
}

.detail-body {
  padding: 0 16px 16px;
}

.help-text {
  line-height: 1.7;
  margin-bottom: 12px;
}

.token-preview {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(12, 125, 87, 0.08), rgba(215, 119, 60, 0.08));
  border: 1px dashed rgba(12, 125, 87, 0.24);
  word-break: break-all;
  line-height: 1.7;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 18px);
  min-width: min(480px, calc(100vw - 32px));
  max-width: min(560px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(23, 49, 41, 0.9);
  color: #fff;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 30;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.success {
  background: rgba(12, 125, 87, 0.92);
}

.toast.error {
  background: rgba(178, 70, 70, 0.94);
}

.reveal {
  animation: rise-in 420ms ease both;
}

.workspace-panel.reveal {
  animation-delay: 80ms;
}

.result-panel.reveal {
  animation-delay: 120ms;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@media (max-width: 860px) {
  .page-shell {
    width: calc(100% - 10px);
    padding: 14px 0 28px;
  }

  .topbar,
  .workspace-panel,
  .result-panel,
  .account-drawer {
    padding: 18px;
  }

  .brand-row,
  .section-head,
  .section-head-wide,
  .drawer-head {
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .top-actions > button {
    width: 100%;
  }

  .options-grid,
  .file-item {
    grid-template-columns: 1fr;
  }

  .file-actions {
    justify-content: flex-start;
  }

  .section-head-wide > button,
  .action-row > button,
  .result-action-card > button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }

  h1 {
    font-size: 34px;
  }

  .nav-pill,
  button {
    min-height: 44px;
  }

  .upload-zone {
    padding: 18px;
  }
}
