:root {
  --ink: #25150d;
  --muted: #7a6559;
  --orange: #ff672f;
  --line: rgba(139, 82, 48, .13);
  --card: rgba(255, 252, 248, .94);
}

* { box-sizing: border-box; }
html { background: #fde7d3; scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(145deg, #fff0e1 0%, #fde4cd 48%, #ffe8d5 100%);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.site-shell { position: relative; isolation: isolate; min-height: 100vh; overflow: hidden; padding: 0 24px 42px; }
.ambient { position: fixed; z-index: -1; width: 360px; height: 360px; border-radius: 999px; filter: blur(2px); opacity: .5; }
.ambient-one { top: 110px; left: -180px; background: #ffd0aa; }
.ambient-two { top: 120px; right: -130px; background: #ffdbbd; }
.topbar { width: min(100%, 960px); height: 76px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); font-size: 18px; font-weight: 800; text-decoration: none; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; color: white; border-radius: 12px; background: linear-gradient(145deg, #ff8d4b, #ff5426); box-shadow: 0 10px 26px rgba(233, 75, 25, .2); letter-spacing: -1px; }
.topbar-note { padding: 9px 15px; color: #ad542d; font-size: 13px; border: 1px solid rgba(236, 125, 70, .22); border-radius: 999px; background: rgba(255, 255, 255, .4); }
.hero { width: min(100%, 960px); margin: 0 auto 18px; padding: 52px 32px 36px; text-align: center; border: 1px solid rgba(255, 255, 255, .8); border-radius: 30px; background: rgba(255, 248, 241, .52); box-shadow: 0 24px 80px rgba(128, 68, 30, .07); backdrop-filter: blur(18px); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; color: #c65b27; font-size: 13px; font-weight: 700; border-radius: 999px; background: #fff5eb; }
.eyebrow span { color: #7f6ee9; }
.hero h1 { margin: 22px 0 10px; font-size: clamp(35px, 5.2vw, 58px); line-height: 1.08; letter-spacing: -.055em; }
.hero p { margin: 0; color: var(--muted); font-size: 16px; }
.generator-card, .result-card { width: min(100%, 860px); margin: 0 auto 16px; border: 1px solid rgba(255, 255, 255, .86); border-radius: 24px; background: var(--card); box-shadow: 0 20px 60px rgba(127, 71, 35, .08); backdrop-filter: blur(14px); }
.generator-card { padding: 27px; text-align: center; }
.ready-state { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 17px; color: #68564c; font-weight: 700; }
.ready-state span { display: grid; place-items: center; width: 22px; height: 22px; color: white; border-radius: 50%; background: #3fac5a; font-size: 13px; }
.ready-state.not-ready span { background: #d47a31; }
.generate-button { width: min(100%, 430px); min-height: 62px; padding: 0 24px; color: white; font-size: 18px; font-weight: 800; letter-spacing: .01em; border: 0; border-radius: 16px; background: linear-gradient(135deg, #ff873e, #ff4d20); box-shadow: 0 15px 32px rgba(232, 72, 25, .24); cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; }
.generate-button:hover { transform: translateY(-2px); box-shadow: 0 18px 38px rgba(232, 72, 25, .3); }
.generate-button:disabled { transform: none; cursor: not-allowed; opacity: .58; box-shadow: none; }
.generate-button:focus-visible, .copy-button:focus-visible, .admin-primary:focus-visible, .admin-secondary:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(108, 89, 233, .35); outline-offset: 3px; }
.quota { display: inline-flex; align-items: center; gap: 7px; margin-top: 15px; padding: 7px 12px; color: #c55728; font-size: 13px; font-weight: 700; border: 1px solid #ffe0cd; border-radius: 999px; background: #fff7f0; }
.generator-card > p { margin: 11px 0 0; color: #8a7467; font-size: 13px; }
.inline-message { width: fit-content; max-width: 620px; margin: 14px auto 0; padding: 9px 13px; color: #765a4c; font-size: 13px; border-radius: 10px; background: #fff3e9; }
.result-heading { min-height: 58px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.result-heading h2 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 9px; }
.result-icon { display: grid; place-items: center; width: 25px; height: 25px; color: #e95c26; font-size: 11px; border-radius: 8px; background: #fff0e4; }
.copy-button { padding: 7px 12px; color: #cf5c29; font-size: 12px; font-weight: 700; border: 1px solid #ffe2d0; border-radius: 999px; background: #fff7f0; cursor: pointer; }
.copy-button:disabled { cursor: not-allowed; opacity: .45; }
.image-download { text-decoration: none; }
.generated-title { margin: 0; padding: 20px; font-size: 19px; font-weight: 800; }
.article-copy { padding: 18px 20px 22px; color: #51433b; font-size: 14px; line-height: 1.9; }
.empty-result { color: #ac9b91; font-weight: 400; }
.article-copy p { margin: 0 0 10px; white-space: pre-wrap; }
.article-copy p:last-child { margin-bottom: 0; }
.wechat-preview { padding: 18px 16px 24px; overflow-x: auto; background: #fff; border-radius: 0 0 24px 24px; }
.wechat-preview > section { width: 100%; }
.setting-toggle { display: flex; align-items: center; gap: 12px; width: fit-content; cursor: pointer; }
.settings-form .setting-toggle input[type="checkbox"] { width: 20px; height: 20px; margin: 0; padding: 0; accent-color: #e96731; }
.setting-toggle span { font-size: 15px; }
.style-field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.style-field-grid > div { display: grid; gap: 8px; }
.settings-form input[type="color"] { padding: 6px; cursor: pointer; }
.wechat-style-preview-frame { width: 100%; height: 440px; border: 1px solid #e9d8cc; border-radius: 12px; background: #f4f1ec; }
.image-result { min-height: 260px; padding: 20px; display: grid; place-items: center; }
.image-result img { display: block; width: 100%; max-height: 680px; object-fit: contain; border-radius: 16px; background: #f7ede5; box-shadow: 0 14px 34px rgba(84, 51, 32, .1); }
.image-placeholder, .image-skeleton { width: 100%; min-height: 220px; display: grid; place-items: center; align-content: center; gap: 10px; color: #a08b7e; text-align: center; border: 1px dashed #ead4c5; border-radius: 16px; background: linear-gradient(145deg, #fffaf5, #fff4eb); }
.image-placeholder span, .image-skeleton span { color: #e77942; font-size: 26px; }
.image-placeholder p { max-width: 520px; margin: 0; font-size: 13px; line-height: 1.7; }
.image-text-display { width: 100%; min-height: 220px; display: grid; place-items: center; padding: 28px; border: 1px dashed #ead4c5; border-radius: 16px; background: linear-gradient(145deg, #fffaf5, #fff4eb); color: #68564c; font-size: 15px; line-height: 1.9; text-align: center; white-space: pre-wrap; overflow-wrap: anywhere; }
.image-skeleton strong { color: #6e594d; font-size: 15px; }
.image-result.is-loading { overflow: hidden; }
.image-skeleton { animation: image-pulse 1.6s ease-in-out infinite; }
@keyframes image-pulse { 50% { opacity: .58; } }
footer { padding-top: 10px; color: #987f70; font-size: 12px; text-align: center; }

.admin-loading, .admin-login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(145deg, #fff0e1, #fde3cb); }
.admin-loading { color: var(--muted); }
.admin-login-card { width: min(100%, 460px); padding: 38px; border: 1px solid rgba(255, 255, 255, .9); border-radius: 26px; background: rgba(255, 252, 248, .94); box-shadow: 0 28px 90px rgba(110, 55, 23, .13); }
.admin-brand { margin-bottom: 34px; }
.admin-kicker { color: #d65e2a; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.admin-login-card h1 { margin: 9px 0; font-size: 31px; letter-spacing: -.04em; }
.admin-login-card > p { margin: 0 0 25px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.admin-login-card form, .settings-form { display: grid; gap: 12px; }
.admin-login-card label, .settings-form label { color: #4d3b32; font-size: 13px; font-weight: 800; }
.admin-login-card input, .settings-form input, .settings-form textarea, .settings-form select { width: 100%; color: var(--ink); border: 1px solid #e9d8cc; border-radius: 12px; background: #fffdfa; outline: none; transition: border-color .16s ease, box-shadow .16s ease; }
.admin-login-card input, .settings-form input { height: 48px; padding: 0 14px; }
.settings-form select { height: 48px; padding: 0 40px 0 14px; }
.settings-form textarea { min-height: 110px; padding: 13px 14px; line-height: 1.7; resize: vertical; }
.admin-login-card input:focus, .settings-form input:focus, .settings-form textarea:focus, .settings-form select:focus { border-color: #ef8b5b; box-shadow: 0 0 0 3px rgba(238, 115, 61, .12); }
.admin-primary, .admin-secondary { min-height: 46px; padding: 0 18px; font-weight: 800; border-radius: 12px; cursor: pointer; }
.admin-primary { color: white; border: 0; background: linear-gradient(135deg, #ff843b, #ff4e21); box-shadow: 0 12px 26px rgba(231, 72, 24, .2); }
.admin-secondary { color: #c25022; border: 1px solid #f4c8b1; background: #fff5ed; }
.admin-primary:disabled, .admin-secondary:disabled, .danger-link:disabled, .admin-logout:disabled { cursor: not-allowed; opacity: .58; }
.admin-notice { margin: 14px 0 0; padding: 11px 13px; font-size: 13px; border-radius: 10px; }
.admin-notice.success { color: #286a39; background: #ecf8ef; }
.admin-notice.error { color: #a53628; background: #fff0ed; }
.back-link { display: inline-block; margin-top: 22px; color: #8b6c5b; font-size: 13px; text-decoration: none; }
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); background: #fff9f3; }
.admin-sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 24px; display: flex; flex-direction: column; border-right: 1px solid #f0dfd3; background: #fffdf9; }
.admin-sidebar nav { margin-top: 45px; display: grid; gap: 8px; }
.admin-sidebar nav a { padding: 12px 14px; color: #6f5a4f; font-size: 14px; font-weight: 700; border-radius: 10px; text-decoration: none; }
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { color: #cf5725; background: #fff0e5; }
.admin-logout { margin-top: auto; padding: 11px 14px; color: #8a6f60; text-align: left; border: 0; border-radius: 10px; background: transparent; cursor: pointer; }
.admin-content { width: min(100%, 980px); padding: 54px 54px 80px; }
.admin-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; margin-bottom: 28px; }
.admin-heading h1 { margin: 7px 0 8px; font-size: 38px; letter-spacing: -.045em; }
.admin-heading p { margin: 0; color: var(--muted); }
.preview-link { flex: 0 0 auto; padding: 10px 14px; color: #bf5326; font-size: 13px; font-weight: 700; border: 1px solid #f1d1bf; border-radius: 10px; background: #fff; text-decoration: none; }
.settings-form { gap: 18px; }
.settings-section { padding: 25px; display: grid; gap: 12px; border: 1px solid #f0ded2; border-radius: 18px; background: white; box-shadow: 0 15px 40px rgba(94, 54, 30, .05); scroll-margin-top: 20px; }
.section-title { margin-bottom: 8px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.section-title h2 { margin: 0 0 5px; font-size: 18px; }
.section-title p { margin: 0; color: #8e786b; font-size: 13px; line-height: 1.6; }
.status-pill { flex: 0 0 auto; padding: 6px 10px; color: #9b6a51; font-size: 12px; font-weight: 800; border-radius: 999px; background: #f6eee9; }
.status-pill.configured { color: #2f7843; background: #eaf7ee; }
.api-key-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.credential-grid, .storage-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.credential-grid > div, .storage-grid > div { display: grid; gap: 8px; }
.section-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.history-actions { justify-content: space-between; padding-top: 4px; }
.field-help { margin: -3px 0 0; color: #9a8578; font-size: 12px; }
.danger-link { width: fit-content; padding: 4px 0; color: #bf4737; border: 0; background: transparent; font-size: 12px; cursor: pointer; }
.number-input { max-width: 180px; }
.sticky-notice { margin: 0; }
.save-button { min-height: 54px; font-size: 15px; }

@media (max-width: 760px) {
  .site-shell { padding: 0 14px 28px; }
  .topbar { height: 64px; }
  .topbar-note { display: none; }
  .hero { padding: 36px 18px 28px; border-radius: 24px; }
  .hero h1 { margin-top: 18px; font-size: 36px; }
  .hero p { font-size: 14px; }
  .generator-card { padding: 23px 16px; }
  .generator-card, .result-card { border-radius: 18px; }
  .generate-button { min-height: 58px; font-size: 16px; }
  .image-result { min-height: 220px; padding: 14px; }
  .admin-shell { display: block; }
  .admin-sidebar { position: static; height: auto; padding: 18px; flex-direction: row; align-items: center; gap: 18px; overflow-x: auto; border-right: 0; border-bottom: 1px solid #f0dfd3; }
  .admin-sidebar nav { margin: 0; display: flex; gap: 4px; white-space: nowrap; }
  .admin-sidebar nav a { padding: 9px 10px; }
  .admin-logout { margin: 0 0 0 auto; white-space: nowrap; }
  .admin-content { padding: 32px 16px 60px; }
  .admin-heading { align-items: center; }
  .admin-heading h1 { font-size: 30px; }
  .credential-grid, .storage-grid, .api-key-row, .style-field-grid { grid-template-columns: 1fr; }
  .settings-section { padding: 20px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
