:root {
  color-scheme: light;
  --ink: #20362d;
  --muted: #79837a;
  --soft-muted: #9a9f96;
  --paper: #fffefa;
  --canvas: #f7f6f2;
  --line: #e7e7de;
  --green: #365e4d;
  --green-dark: #274b3c;
  --green-pale: #eaf1e9;
  --orange: #f0a36e;
  --orange-pale: #fff0e4;
  --danger: #a53a37;
  --shadow: 0 18px 54px rgba(38, 60, 47, 0.07), 0 2px 8px rgba(38, 60, 47, 0.035);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--canvas);
  color: var(--ink);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); }
button, input, textarea { font: inherit; }
button { color: inherit; }
.page-shell { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(32, 54, 45, .08); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--green); color: white; }
.brand-mark svg { width: 23px; height: 23px; }
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: .02em; }
.key-status { border: 1px solid var(--line); background: rgba(255,255,255,.62); border-radius: 999px; padding: 9px 13px; display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: #526158; }
.status-stack { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.key-dot { width: 7px; height: 7px; border-radius: 50%; background: #c8a678; }
.key-dot.is-ready { background: #5b9b70; box-shadow: 0 0 0 3px rgba(91,155,112,.13); }
.key-dot.is-error { background: #c66b62; box-shadow: 0 0 0 3px rgba(198,107,98,.13); }
.usage-status { margin: 9px 0 0; color: var(--muted); font-size: 11px; }
.chevron { font-size: 18px; line-height: 10px; margin-left: 1px; color: #8b978b; }
.intro { text-align: center; padding: 44px 0 31px; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px; color: #687a69; background: #eaf0e6; font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.sparkle { color: #de9566; font-size: 14px; }
h1 { margin: 17px 0 8px; font-size: clamp(27px, 4vw, 41px); line-height: 1.25; letter-spacing: -.055em; font-weight: 800; }
h1 span { color: var(--green); }
.intro-copy { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.field-label { display: block; font-size: 12px; font-weight: 700; color: #49594e; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; outline: 0; color: var(--ink); background: white; transition: border-color .18s, box-shadow .18s; }
input:focus, textarea:focus { border-color: #8baa92; box-shadow: 0 0 0 3px rgba(84, 131, 96, .11); }
input { padding: 12px 13px; font-size: 13px; }
input::placeholder, textarea::placeholder { color: #a4aaa1; }
.text-button { border: 0; background: transparent; padding: 4px 0; color: var(--green); font-size: 11px; font-weight: 700; cursor: pointer; }
.text-button:hover { color: var(--green-dark); text-decoration: underline; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 19px; align-items: start; }
.card { border: 1px solid rgba(32, 54, 45, .08); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); }
.composer { padding: 24px 25px 20px; }
.form-page { width: min(760px, 100%); margin-right: auto; margin-left: auto; }
.section-topline { display: flex; align-items: center; gap: 9px; }
.step-number { color: #b9a287; font-family: "DM Sans", sans-serif; font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.section-caption { color: #526158; font-size: 12px; font-weight: 700; }
.optional-label { color: #a0a49c; font-size: 10px; font-weight: 500; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 13px 0 21px; }
.mode-option { display: flex; align-items: center; gap: 10px; min-width: 0; border: 1px solid #e8e9e0; border-radius: 13px; background: white; padding: 11px 11px; text-align: left; cursor: pointer; transition: border-color .18s, background .18s, transform .18s; }
.mode-option:hover { transform: translateY(-1px); border-color: #bfd0bd; }
.mode-option.is-active { border-color: #87a48a; background: #f1f6ef; box-shadow: inset 0 0 0 1px rgba(90, 130, 94, .08); }
.mode-icon { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 10px; color: #ba865e; background: #fff0e4; font-size: 19px; }
.note-icon { color: #617e69; background: #e5efe4; font-size: 17px; }
.mode-option strong, .mode-option small { display: block; }
.mode-option strong { color: #354b3d; font-size: 12px; font-weight: 700; }
.mode-option small { margin-top: 2px; color: #899287; font-size: 9px; white-space: nowrap; }
.mode-check { display: grid; place-items: center; flex: 0 0 17px; width: 17px; height: 17px; margin-left: auto; border: 1px solid #d7ddd4; border-radius: 50%; color: transparent; font-size: 10px; }
.mode-option.is-active .mode-check { border-color: var(--green); color: white; background: var(--green); }
.photo-topline { margin-bottom: 11px; }
.photo-topline .optional-label { margin-left: auto; }
.upload-zone { position: relative; min-height: 183px; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; border: 1.5px dashed #cfd8cb; border-radius: 15px; background: #fbfcf8; color: #6a7d6c; cursor: pointer; transition: background .18s, border-color .18s; }
.upload-zone:hover, .upload-zone.is-dragging { border-color: #74947b; background: #f4f8f1; }
.upload-zone.has-image { min-height: 112px; border-style: solid; background: #edf1eb; }
.upload-zone input { position: absolute; width: 1px; height: 1px; padding: 0; opacity: 0; pointer-events: none; }
.upload-visual { width: 43px; height: 43px; display: grid; place-items: center; margin-bottom: 9px; border-radius: 13px; color: #718b73; background: #eaf0e6; }
.upload-visual svg { width: 31px; height: 31px; }
.upload-title { color: #405c49; font-size: 12px; font-weight: 700; }
.upload-hint { margin-top: 5px; color: #9a9f96; font-size: 10px; }
.upload-zone.has-image .upload-visual { display: none; }
.photo-preview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 9px; }
.photo-preview-item { position: relative; min-width: 0; overflow: hidden; aspect-ratio: 1; border: 1px solid #e1e8dd; border-radius: 12px; background: #edf1eb; }
.photo-preview-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-preview-number { position: absolute; left: 6px; bottom: 6px; display: grid; width: 21px; height: 21px; place-items: center; border-radius: 50%; color: white; background: rgba(37, 57, 43, .72); font-size: 10px; font-weight: 700; }
.photo-remove-button { position: absolute; top: 5px; right: 5px; display: grid; width: 28px; height: 28px; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.9); border-radius: 50%; color: #304538; background: rgba(255,255,255,.92); box-shadow: 0 2px 7px rgba(30,45,35,.15); font-size: 20px; line-height: 1; cursor: pointer; }
.photo-remove-button:hover { color: white; background: var(--green); }
.field-block { margin-top: 18px; }
.field-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
textarea { min-height: 65px; padding: 11px 12px; resize: vertical; font-size: 12px; line-height: 1.65; }
.field-helper { margin-top: 5px; color: #9a9f96; font-size: 10px; }
.style-block { margin-top: 18px; }
.style-options { display: flex; flex-wrap: wrap; gap: 7px; }
.style-chip { padding: 7px 11px; border: 1px solid #e6e8df; border-radius: 999px; color: #69746a; background: white; font-size: 10px; cursor: pointer; transition: all .15s; }
.style-chip:hover { border-color: #a5b8a5; color: var(--green); }
.style-chip.is-selected { border-color: #c6d5c4; color: #365b44; background: #edf4eb; font-weight: 700; }
.form-error { margin-top: 13px; padding: 10px 12px; border: 1px solid #f0d1cd; border-radius: 10px; color: var(--danger); background: #fff7f5; font-size: 11px; line-height: 1.6; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; border: 0; border-radius: 11px; font-weight: 700; cursor: pointer; transition: transform .18s, box-shadow .18s, opacity .18s; }
.button:disabled { opacity: .58; cursor: wait; transform: none; }
.button-dark { padding: 0 17px; color: white; background: var(--green); font-size: 12px; }
.button-dark:hover:not(:disabled), .button-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 9px 20px rgba(46, 89, 64, .18); }
.button-small { min-height: 42px; }
.button-primary { min-height: 47px; color: white; background: var(--green); box-shadow: 0 5px 13px rgba(46, 89, 64, .13); }
.generate-button { width: 100%; margin-top: 18px; font-size: 13px; }
.button-arrow { display: inline-grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; color: var(--green-dark); background: #f2c69e; font-family: "DM Sans", sans-serif; font-size: 14px; }
.privacy-note { margin: 10px 0 0; color: #9b9f97; text-align: center; font-size: 9px; line-height: 1.6; }
.results { min-height: 600px; padding: 24px 22px 17px; background: #fdfcf8; }
.results-heading { display: flex; justify-content: space-between; align-items: flex-start; }
.result-topline { margin-bottom: 9px; }
.results h2 { margin: 0; color: #7e887e; font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.results-sparkle { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 10px; color: #d08f63; background: #fff0e5; font-size: 17px; }
.empty-state { min-height: 475px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
.empty-illustration { position: relative; width: 124px; height: 126px; margin-bottom: 18px; }
.paper { position: absolute; width: 74px; height: 94px; border: 1px solid #e2e6dc; border-radius: 10px; background: white; box-shadow: 0 8px 23px rgba(44,66,49,.08); }
.paper-back { top: 19px; left: 31px; transform: rotate(10deg); background: #f1f5ee; }
.paper-front { top: 13px; left: 18px; padding: 18px 10px 10px; transform: rotate(-8deg); color: #769078; }
.paper-front span { display: block; margin-bottom: 12px; font-size: 10px; font-weight: 700; }
.paper-front i { display: block; width: 100%; height: 4px; margin-top: 6px; border-radius: 4px; background: #e6ede4; }
.paper-front i:last-child { width: 72%; }
.empty-spark { position: absolute; color: #eca879; }
.spark-one { top: 7px; right: 7px; font-size: 20px; }
.spark-two { right: 5px; bottom: 13px; color: #92a891; font-size: 16px; }
.empty-state p { margin: 0; color: #929991; text-align: center; font-size: 11px; line-height: 1.9; }
.draft-list { display: grid; gap: 10px; margin-top: 17px; }
.draft-card { position: relative; padding: 14px 14px 11px; border: 1px solid #e8e9e1; border-radius: 13px; background: white; animation: rise-in .24s ease both; }
.draft-card:nth-child(2) { animation-delay: .05s; }
.draft-card:nth-child(3) { animation-delay: .1s; }
@keyframes rise-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.draft-label { margin-bottom: 9px; color: #a48d70; font-family: "DM Sans", sans-serif; font-size: 9px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.draft-title { display: block; width: 100%; min-height: 0; margin: 0 0 5px; padding: 0; border: 0; border-radius: 5px; outline: 0; resize: none; overflow: hidden; color: #344c3b; background: transparent; font-size: 12px; font-weight: 700; line-height: 1.6; }
.draft-title:focus, .draft-body:focus { box-shadow: 0 0 0 3px rgba(84,131,96,.11); background: #fbfdf9; }
.draft-body { display: block; width: 100%; min-height: 0; padding: 2px 0; border: 0; border-radius: 5px; outline: 0; resize: none; overflow: hidden; color: #59665c; background: transparent; font-size: 11px; line-height: 1.8; }
.draft-tags { margin-top: 6px; color: #779078; font-size: 10px; line-height: 1.6; }
.draft-actions { display: flex; justify-content: flex-end; margin-top: 7px; padding-top: 7px; border-top: 1px solid #f0f0eb; }
.copy-button { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border: 0; border-radius: 7px; color: #58745e; background: #edf3eb; font-size: 10px; font-weight: 700; cursor: pointer; }
.copy-button:hover { background: #e2ecdf; }
.results-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 13px; color: #9a9f96; font-size: 9px; }
.regenerate-button { white-space: nowrap; font-size: 10px; }
.footer { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 23px 0 29px; color: #a1a49c; font-size: 10px; }
.footer-dot { color: #d2ad8d; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); max-width: calc(100% - 40px); padding: 10px 15px; border-radius: 999px; color: white; background: #263d31; box-shadow: 0 7px 25px rgba(32,54,45,.2); font-size: 12px; opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: opacity .2s, transform .2s; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.back-link { color: #58745e; text-decoration: none; font-size: 12px; font-weight: 700; }
.back-link:hover { color: var(--green-dark); }
.result-main { width: min(760px, 100%); margin: 0 auto; }
.result-intro { padding: 40px 0 25px; text-align: center; }
.result-intro h1 { margin-top: 16px; }
.result-card { min-height: 390px; padding: 25px 27px 22px; }
.loading-state, .error-state { min-height: 340px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 25px 16px; text-align: center; }
.loading-orbit { position: relative; width: 72px; height: 72px; display: grid; place-items: center; margin-bottom: 21px; border: 1px solid #dce7d9; border-radius: 50%; color: #d08f63; background: #f5f8f1; }
.loading-orbit::before, .loading-orbit::after { position: absolute; inset: 7px; border: 1px dashed #b9cbb6; border-radius: 50%; content: ""; animation: orbit 8s linear infinite; }
.loading-orbit::after { inset: -5px; border-color: #f0d9c6; animation-direction: reverse; animation-duration: 11s; }
.loading-orbit span { width: 23px; height: 23px; border: 2px solid #c9d9c5; border-top-color: var(--green); border-radius: 50%; animation: spin .9s linear infinite; }
.loading-orbit i { position: absolute; right: -3px; top: 2px; color: #dd9b6d; font-size: 18px; font-style: normal; }
@keyframes orbit { to { transform: rotate(360deg); } }
.loading-state h2, .error-state h2 { margin: 0; color: #43584a; font-size: 17px; }
.loading-state p, .error-state p { max-width: 430px; margin: 9px 0 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.error-mark { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 16px; border-radius: 50%; color: var(--danger); background: #fff0ed; font-size: 23px; font-weight: 700; }
.error-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 21px; }
.button-primary, .button-light { min-height: 43px; padding: 0 16px; font-size: 12px; text-decoration: none; }
.button-light { border: 1px solid #dce5d9; color: #48624e; background: #f3f7f0; }
.button-light:hover { background: #eaf1e7; }
.ready-state .results-heading { margin-bottom: 6px; }
.ready-state .results-heading h2 { margin: 3px 0 0; color: #354b3d; font-size: 19px; }
.ready-state .results-sparkle { flex: 0 0 31px; }
.ready-state .draft-list { margin-top: 19px; }
.ready-state .draft-card { padding: 16px 16px 12px; }
.result-privacy { margin: 12px 0 0; color: #9b9f97; text-align: center; font-size: 10px; line-height: 1.7; }
.conversation-card { margin-top: 16px; padding: 22px 25px 20px; }
.conversation-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.conversation-heading h2 { margin: 2px 0 5px; color: #354b3d; font-size: 18px; }
.conversation-heading p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.conversation-mark { flex: 0 0 31px; width: 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; color: #63836a; background: #eaf1e8; font-size: 17px; }
.conversation-list { display: grid; gap: 11px; margin: 18px 0; }
.conversation-list:empty { display: none; }
.conversation-turn { width: fit-content; max-width: 90%; min-width: 0; box-sizing: border-box; padding: 11px 13px; border-radius: 13px; }
.conversation-turn-user { justify-self: end; color: white; background: var(--green); border-bottom-right-radius: 5px; }
.conversation-turn-assistant { justify-self: start; color: #46564b; background: #f1f4ee; border-bottom-left-radius: 5px; }
.conversation-speaker { margin-bottom: 5px; opacity: .72; font-size: 9px; font-weight: 700; }
.conversation-turn-user { min-width: min(132px, 100%); }
.conversation-message { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.8; }
.chat-compose { margin-top: 17px; padding-top: 16px; border-top: 1px solid #eef0e9; }
.chat-compose textarea { min-height: 84px; margin-top: 7px; }
.chat-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; }
.chat-controls > span { color: #929991; font-size: 10px; }
.chat-send { min-height: 40px; padding: 0 14px; font-size: 11px; }
.chat-send span { color: #f2c69e; }
.chat-error { margin-top: 10px; }
.copy-followup-dialog { width: min(390px, calc(100% - 32px)); margin: auto; padding: 0; border: 1px solid #e8e9e1; border-radius: 18px; color: var(--ink); background: #fffefa; box-shadow: 0 22px 70px rgba(35, 53, 42, .2); }
.copy-followup-dialog::backdrop { background: rgba(28, 40, 32, .42); backdrop-filter: blur(3px); }
.copy-followup-content { padding: 25px 22px 22px; text-align: center; }
.copy-followup-mark { display: grid; width: 42px; height: 42px; place-items: center; margin: 0 auto 12px; border-radius: 14px; color: #416a54; background: #eaf2e8; font-size: 21px; font-weight: 700; }
.copy-followup-content h2 { margin: 0; color: #354b3d; font-size: 19px; }
.copy-followup-content p { margin: 9px 0 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.copy-followup-actions { display: grid; gap: 8px; margin-top: 19px; }
.copy-followup-actions .button { min-height: 45px; font-size: 13px; }
[hidden] { display: none !important; }

@media (max-width: 780px) {
  .page-shell { width: min(100% - 28px, 540px); }
  .topbar { height: 68px; }
  .brand-name { font-size: 16px; }
  .status-stack { flex-direction: column; align-items: flex-end; gap: 4px; }
  .key-status { min-height: 28px; padding: 5px 9px; font-size: 10px; }
  .usage-status { font-size: 11px; }
  .intro { padding: 34px 0 23px; }
  h1 { font-size: clamp(26px, 7vw, 34px); }
  .intro-copy { max-width: 290px; margin: 0 auto; font-size: 12px; }
  .workspace { grid-template-columns: 1fr; gap: 14px; }
  .composer { padding: 20px 17px 17px; }
  .section-caption { font-size: 13px; }
  .optional-label { font-size: 11px; }
  .mode-option { min-height: 59px; }
  .mode-option strong { font-size: 13px; }
  .mode-option small { font-size: 10px; }
  .results { min-height: 385px; padding: 20px 17px 16px; }
  .empty-state { min-height: 278px; }
  .draft-list { gap: 8px; }
  .field-label { font-size: 13px; }
  #context-input { min-height: 78px; font-size: 16px; }
  .field-helper { font-size: 11px; }
  .style-chip { min-height: 38px; padding-right: 12px; padding-left: 12px; font-size: 11px; }
  .generate-button { min-height: 50px; font-size: 14px; }
  .privacy-note { font-size: 10px; }
  .draft-label { font-size: 10px; }
  .draft-title, .draft-body { font-size: 16px; }
  .draft-tags { font-size: 12px; }
  .copy-button { min-height: 38px; padding-right: 11px; padding-left: 11px; font-size: 11px; }
  .results-bottom { font-size: 10px; }
  .footer { padding-top: 18px; padding-bottom: max(23px, env(safe-area-inset-bottom)); }
  .result-intro { padding: 30px 0 20px; }
  .result-intro h1 { font-size: clamp(25px, 7vw, 33px); }
  .result-card { min-height: 340px; padding: 17px 14px 15px; border-radius: 17px; }
  .loading-state, .error-state { min-height: 300px; padding: 20px 9px; }
  .ready-state .results-heading h2 { font-size: 18px; }
  .ready-state .draft-card { padding: 14px 12px 10px; }
  .result-privacy { padding: 0 10px; font-size: 10px; }
  .error-actions { gap: 8px; }
  .conversation-card { margin-top: 12px; padding: 17px 14px 15px; border-radius: 17px; }
  .conversation-heading h2 { font-size: 17px; }
  .conversation-heading p { font-size: 11px; }
  .conversation-turn { max-width: 96%; padding: 10px 11px; }
  .conversation-message { font-size: 14px; }
  .chat-compose textarea { min-height: 88px; font-size: 16px; }
  .chat-controls > span { flex: 1 1 100%; font-size: 10px; }
  .chat-send { width: 100%; min-height: 48px; font-size: 13px; }
}

@media (max-width: 370px) {
  .page-shell { width: calc(100% - 22px); }
  .composer { padding-right: 14px; padding-left: 14px; }
  .mode-switch { gap: 6px; }
  .mode-option { gap: 7px; padding: 9px 8px; }
  .mode-icon { flex-basis: 28px; width: 28px; height: 28px; }
  .mode-option small { font-size: 9px; }
  .style-chip { padding-right: 9px; padding-left: 9px; }
  .key-status { max-width: 190px; min-height: 25px; padding: 4px 7px; font-size: 9px; }
}
