:root {
  --ink: #18231e;
  --muted: #66716b;
  --cream: #f5f2e9;
  --paper: #fffef9;
  --green: #1f5d47;
  --green2: #d9e8de;
  --line: #dfe3dc;
  --orange: #d36f3d;
  --danger: #b63e31;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--cream); font-family: "Microsoft YaHei", "PingFang SC", sans-serif; }
button, select, input, textarea { font: inherit; }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid #5c9b8270; outline-offset: 2px; }
.topbar { height: 78px; padding: 0 max(4vw, 24px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255, 254, 249, .92); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); }
.brand { display: flex; gap: 12px; align-items: center; color: var(--ink); text-decoration: none; }
.brand-mark { width: 42px; height: 42px; background: var(--green); color: white; border-radius: 50% 48% 45% 52%; display: grid; place-items: center; font-family: serif; font-size: 23px; }
.brand b { display: block; font-size: 18px; letter-spacing: 3px; }
.brand small { font-size: 9px; letter-spacing: 1.8px; color: var(--muted); }
nav { display: flex; gap: 28px; }
.text-btn, .report { border: 0; background: none; color: var(--muted); cursor: pointer; }
.text-btn:hover, .report:hover { color: var(--green); }
.pill, .primary { border: 0; border-radius: 999px; padding: 11px 22px; cursor: pointer; }
.pill { background: var(--green2); color: var(--green); }
.primary { background: var(--green); color: white; font-weight: bold; box-shadow: 0 8px 20px #1f5d4730; }
.primary:disabled { opacity: .55; cursor: wait; }
main { max-width: 1120px; margin: auto; padding: 70px 24px; }
.hero { text-align: center; max-width: 800px; margin: auto; }
.eyebrow { font-size: 12px; letter-spacing: 4px; color: var(--green); font-weight: bold; }
.eyebrow span { display: inline-block; width: 28px; border-top: 1px solid; margin-right: 12px; vertical-align: middle; }
.hero h1 { font-family: "Songti SC", serif; font-size: clamp(38px, 6vw, 70px); line-height: 1.15; margin: 22px 0 18px; font-weight: 500; }
.hero h1 em { display: block; color: var(--green); font-style: normal; }
.hero p { max-width: 650px; margin: auto; color: var(--muted); line-height: 1.9; }
.workspace { margin: 65px auto 0; max-width: 900px; }
.mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.mode { border: 1px solid var(--line); background: #ffffff90; padding: 18px; border-radius: 18px; text-align: left; color: var(--ink); cursor: pointer; transition: .2s; }
.mode span { float: left; font-size: 24px; margin-right: 14px; color: var(--green); }
.mode b, .mode small { display: block; }
.mode small { color: var(--muted); margin-top: 5px; }
.mode.active { background: var(--green); color: white; border-color: var(--green); transform: translateY(-2px); box-shadow: 0 12px 30px #1f5d4725; }
.mode.active span, .mode.active small { color: #dbeae0; }
.editor { background: var(--paper); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 24px 60px #26392f12; overflow: hidden; }
.editor-head, .editor-foot, .result-meta { padding: 14px 20px; display: flex; align-items: center; gap: 12px; }
.editor-head { border-bottom: 1px solid var(--line); font-size: 13px; }
.editor-head select { border: 1px solid var(--line); border-radius: 8px; padding: 7px; background: white; max-width: min(440px, 60vw); }
.secure { margin-left: auto; color: var(--green); font-size: 12px; }
.editor textarea { border: 0; outline: 0; width: 100%; height: 220px; padding: 25px; resize: vertical; font: 16px/1.8 inherit; background: transparent; }
.editor-foot { justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); }
.spinner { display: inline-block; width: 14px; height: 14px; margin-left: 9px; border: 2px solid #ffffff70; border-top-color: white; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.result { max-width: 900px; margin: 24px auto 0; background: white; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; }
.result.error-panel { border-color: #d9968c; }
.result-meta { border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.result-meta .text-btn { margin-left: auto; }
.ai-badge { background: var(--green2); color: var(--green); padding: 6px 10px; border-radius: 999px; font-weight: bold; }
.result pre { white-space: pre-wrap; overflow-wrap: anywhere; font: 15px/1.9 inherit; padding: 20px 25px; margin: 0; }
.notice { margin: 0 25px 15px; padding: 12px; background: #f7f3df; border-radius: 10px; font-size: 12px; color: #6d6139; }
.report { margin: 0 20px 20px; text-decoration: underline; }
.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; margin-top: 80px; }
.principles article { padding: 28px 0; border-top: 1px solid var(--line); }
.principles article span { color: var(--orange); font-family: serif; }
.principles h3 { font-family: serif; font-size: 21px; }
.principles p { color: var(--muted); font-size: 13px; line-height: 1.8; }
footer { text-align: center; background: #e8e5dc; padding: 35px 20px; font-size: 12px; color: var(--muted); line-height: 1.8; }
footer a { color: var(--green); }
.hidden { display: none !important; }
dialog { border: 0; border-radius: 20px; padding: 30px; width: min(520px, calc(100% - 30px)); box-shadow: 0 30px 80px #0003; color: var(--ink); line-height: 1.8; }
dialog::backdrop { background: #17221db8; backdrop-filter: blur(3px); }
dialog .close { position: absolute; right: 18px; top: 12px; border: 0; background: none; font-size: 26px; cursor: pointer; }
dialog form { display: grid; gap: 12px; }
dialog input, dialog textarea, dialog select { width: 100%; padding: 13px; border: 1px solid var(--line); border-radius: 10px; }
dialog textarea { min-height: 120px; }
.auth-tabs { display: flex; margin-bottom: 14px; }
.auth-tabs button { flex: 1; border: 0; border-bottom: 2px solid var(--line); background: none; padding: 10px; cursor: pointer; }
.auth-tabs button.active { border-color: var(--green); color: var(--green); }
.check { font-size: 12px; }
.check input { width: auto; }
.error { color: var(--danger); font-size: 12px; min-height: 20px; }
.error.success { color: var(--green); }
.user-chip { font-size: 13px; color: var(--green); }

@media (max-width: 720px) {
  nav { display: none; }
  .topbar { height: 66px; }
  .brand small { display: none; }
  main { padding: 45px 15px; }
  .hero h1 { font-size: 38px; }
  .mode-tabs, .principles { grid-template-columns: 1fr; }
  .editor textarea { height: 190px; }
  .secure { display: none; }
  .result-meta #modelInfo { flex-basis: 100%; order: 3; }
}
