:root {
  --ink: #111827;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --paper: #fffdf7;
  --surface: #ffffff;
  --green: #16a34a;
  --green-dark: #0f7a38;
  --green-soft: #ecfdf5;
  --gold: #f59e0b;
  --gold-soft: #fffbeb;
  --red: #dc2626;
  --red-soft: #fff1f2;
  --shadow: 0 18px 45px rgba(17, 24, 39, .08);
  --radius: 8px;
  font-family: Inter, "Noto Sans CJK SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, rgba(236, 253, 245, .75), rgba(255, 253, 247, .18) 360px), var(--paper);
  color: var(--text);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }

.container { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }
.site-header { position: sticky; top: 0; z-index: 20; height: 72px; border-bottom: 1px solid var(--line); background: rgba(255,253,247,.9); backdrop-filter: blur(16px); }
.site-header .container { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 900; white-space: nowrap; }
.mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; background: var(--green); color: #fff; box-shadow: 0 10px 20px rgba(22, 163, 74, .22); }
.nav, .actions { display: flex; align-items: center; gap: 12px; }
.nav { gap: 22px; color: var(--muted); font-size: 14px; font-weight: 800; }
.nav a.active { color: var(--green-dark); }
.btn { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 15px; background: #fff; color: var(--ink); font-weight: 850; white-space: nowrap; }
.btn.primary { border-color: var(--green); background: var(--green); color: #fff; }
.btn.gold { border-color: #fde68a; background: var(--gold-soft); color: #92400e; }
.btn.danger { border-color: #fecaca; background: var(--red-soft); color: var(--red); }
.btn.full { width: 100%; }
.badge { min-height: 26px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 0 9px; background: #fff; color: var(--muted); font-size: 12px; font-weight: 900; }
.badge.green { border-color: #bbf7d0; background: var(--green-soft); color: #166534; }
.badge.gold { border-color: #fde68a; background: var(--gold-soft); color: #92400e; }
.badge.red { border-color: #fecaca; background: var(--red-soft); color: var(--red); }

.hero { min-height: calc(100vh - 72px); display: grid; grid-template-columns: minmax(0,.95fr) minmax(420px,1.05fr); gap: 42px; align-items: center; padding: 54px 0 42px; }
.hero h1 { margin-top: 18px; max-width: 780px; color: var(--ink); font-size: clamp(40px,5.2vw,72px); line-height: 1.04; }
.hero p { margin-top: 20px; max-width: 650px; color: #374151; font-size: 19px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.eyebrow { width: max-content; max-width: 100%; display: inline-flex; align-items: center; border: 1px solid #bbf7d0; border-radius: 999px; padding: 7px 11px; background: var(--green-soft); color: #166534; font-size: 13px; font-weight: 900; }
.demo { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.demo-top { min-height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--line); }
.paper { min-height: 480px; margin: 24px; padding: 28px; border: 1px solid #f3ead7; border-radius: var(--radius); background: var(--paper); }
.paper h2 { color: var(--ink); font-size: 28px; line-height: 1.22; margin-bottom: 18px; }
.line { height: 10px; border-radius: 999px; background: #e5e7eb; margin: 12px 0; }
.line.mid { width: 82%; } .line.short { width: 58%; } .line.gold { width: 70%; background: #fde68a; } .line.green { width: 48%; background: #bbf7d0; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 246px minmax(0,1fr); background: #fff; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; border-right: 1px solid var(--line); background: #fbfbfb; padding: 22px 16px; }
.side-nav { display: grid; gap: 7px; }
.side-nav a { min-height: 42px; display: flex; align-items: center; gap: 10px; border-radius: var(--radius); padding: 0 12px; color: #4b5563; font-size: 14px; font-weight: 850; }
.side-nav a.active { background: var(--green-soft); color: #166534; }
.quota { margin-top: auto; border: 1px solid #bbf7d0; border-radius: var(--radius); padding: 15px; background: var(--green-soft); }
.quota small { color: #166534; font-weight: 800; }
.quota strong { display: block; color: var(--ink); font-size: 32px; line-height: 1.08; margin-top: 4px; }
.app-main { min-width: 0; background: linear-gradient(180deg, rgba(236,253,245,.45), rgba(255,255,255,0) 260px), #fff; }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 30px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.88); }
.topbar h1 { color: var(--ink); font-size: 25px; line-height: 1.2; }
.topbar p, .subtle { color: var(--muted); font-size: 14px; }
.content { padding: 28px 30px 42px; }
.stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 15px; }
.stat, .panel { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.stat { min-height: 126px; padding: 18px; }
.stat small { color: var(--muted); font-weight: 800; }
.stat strong { display: block; color: var(--ink); font-size: 31px; margin-top: 8px; }
.grid-2 { display: grid; grid-template-columns: minmax(0,1.5fr) 350px; gap: 18px; margin-top: 18px; }
.form-layout, .result-layout, .settings-grid { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 18px; margin-top: 18px; }
.settings-grid { grid-template-columns: 1fr 1fr; }
.panel-head { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 17px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 17px; }
.table-wrap { max-width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 14px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { color: var(--muted); font-size: 12px; font-weight: 900; }
.stepper { display: grid; grid-template-columns: repeat(4,1fr); gap: 9px; margin-bottom: 18px; }
.step { min-height: 58px; display: block; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: #fff; color: var(--muted); font-size: 13px; font-weight: 900; }
.step.active { border-color: #bbf7d0; background: var(--green-soft); color: #166534; }
.step.done { border-color: #bbf7d0; color: #166534; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.field { display: grid; gap: 7px; }
.field.wide { grid-column: 1 / -1; }
.field > span, .field-head span { color: var(--ink); font-size: 14px; font-weight: 900; }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.control { width: 100%; min-height: 44px; border: 1px solid #d1d5db; border-radius: var(--radius); background: #fff; color: var(--ink); padding: 9px 12px; }
textarea.control { min-height: 118px; resize: vertical; }
.ai-write { min-height: 28px; border: 1px solid #bbf7d0; border-radius: 999px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; background: var(--green-soft); color: #166534; font-size: 12px; font-weight: 900; white-space: nowrap; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.progress-ring { width: 124px; height: 124px; display: grid; place-items: center; margin: 4px auto 18px; border-radius: 999px; background: radial-gradient(circle at center,#fff 0 56%,transparent 57%), conic-gradient(var(--green) 0 78%,#e5e7eb 78% 100%); color: #166534; font-size: 27px; font-weight: 950; }
.tip-list { display: grid; gap: 13px; }
.tip { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; }
.tip-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; background: var(--green-soft); color: var(--green-dark); }
.tip strong { display: block; color: var(--ink); }
.tip p { color: var(--muted); font-size: 14px; }
.notice { border: 1px solid #fde68a; border-radius: var(--radius); padding: 13px; background: var(--gold-soft); color: #78350f; font-size: 14px; }
.editor { min-height: 680px; border: 1px solid #f3ead7; border-radius: var(--radius); padding: 32px; background: var(--paper); color: #1f2937; line-height: 1.78; white-space: pre-wrap; }
.score-list { display: grid; gap: 14px; }
.score-row { display: grid; gap: 7px; }
.score-row header { display: flex; justify-content: space-between; color: var(--ink); font-size: 13px; font-weight: 900; }
.bar { height: 8px; overflow: hidden; border-radius: 999px; background: #e5e7eb; }
.bar span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.loader { width: 66px; height: 66px; margin: 0 auto 22px; border: 5px solid #dcfce7; border-top-color: var(--green); border-radius: 999px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.admin-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.codebox { width: 100%; min-height: 180px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.prompt-editor { min-height: 220px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.55; }
.test-output { min-height: 320px; max-height: 560px; overflow: auto; white-space: pre-wrap; border: 1px solid #f3ead7; border-radius: var(--radius); padding: 16px; background: var(--paper); color: var(--text); }
.version-list { display: grid; gap: 8px; }
.version-item { width: 100%; min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 12px; background: #fff; color: var(--ink); font-weight: 850; text-align: left; }
.version-item.active { border-color: #bbf7d0; background: var(--green-soft); color: #166534; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 50; border: 1px solid #bbf7d0; border-radius: var(--radius); padding: 12px 14px; background: var(--green-soft); color: #166534; font-weight: 900; box-shadow: var(--shadow); }
.preset-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.preset-card { min-height: 92px; border: 1px solid var(--line); border-radius: var(--radius); padding: 13px; background: #fff; text-align: left; }
.preset-card.active { border-color: #bbf7d0; background: var(--green-soft); }
.preset-card strong { display: block; color: var(--ink); margin-bottom: 4px; }
.preset-card span { color: var(--muted); font-size: 12px; }
.secret-note { border: 1px solid #fde68a; border-radius: var(--radius); padding: 10px 12px; background: var(--gold-soft); color: #78350f; font-size: 13px; }

@media (max-width: 1040px) {
  .hero, .grid-2, .form-layout, .result-layout, .settings-grid, .admin-layout { grid-template-columns: 1fr; }
  .preset-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2,1fr); }
  .nav { display: none; }
}

@media (max-width: 820px) {
  .container { width: min(100% - 28px, 1180px); }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-nav { grid-template-columns: 1fr 1fr; }
  .quota { display: none; }
  .topbar { min-height: auto; align-items: flex-start; flex-direction: column; padding: 18px; }
  .actions { width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .content { padding: 18px; }
  .stats, .stepper, .form-grid { grid-template-columns: 1fr; }
  .form-footer { align-items: stretch; flex-direction: column; }
  .form-footer .btn { width: 100%; }
  .hero { min-height: auto; grid-template-columns: 1fr; padding: 34px 0; }
  .hero h1 { font-size: 40px; }
  .demo { display: none; }
}
