/* A quiet writing studio: paper, ink, and restrained cinnabar accents. */
:root {
  --text: #2e3732;
  --text-muted: #777a70;
  --border: #deded2;
  --surface: #e8e9df;
  --gf-jade: #435e50;
  --gf-jade-deep: #31493c;
  --gf-cinnabar-deep: #a04736;
  --font-zh: 'KaiTi-CJK', 'LXGW WenKai Lite', serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-zh);
  -webkit-font-smoothing: antialiased;
  background: radial-gradient(ellipse at 85% 15%, #e5e7dc66, transparent 50%), #f5f4ed;
}
a { color: inherit; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid #a04736; outline-offset: 4px; }
.site-header { position: sticky; top: 0; z-index: 100; border-bottom: 1px solid var(--border); background: #f9f8f2; }
.nav-inner {
  max-width: 1200px; height: 48px; margin: auto; padding: 0 32px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px;
}
.back-link { text-decoration: none; color: #666f63; display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; }
.back-link:hover { color: #a04736; }
.circle-arrow-icon { width: 17px; height: 17px; }
.nav-title { color: #435e50; font-size: 20px; font-weight: 400; letter-spacing: 2px; line-height: 1.3; white-space: nowrap; }
.container { max-width: 1280px; width: calc(100% - 48px); margin: 18px auto 28px; }
.sheet { position: relative; }
.watermark { position: absolute; right: .4in; bottom: .2in; display: flex; align-items: center; gap: 8px; }
.watermark img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.watermark span { font-size: 10pt; color: var(--gf-jade); }
.workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-pane, .preview-pane { min-width: 0; }
.control-card { background: #fcfbf7; border: 1px solid var(--border); border-top: 3px solid #435e50; padding: 18px; box-shadow: 0 8px 28px #39463805; }
.section-heading { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.section-number { color: #a04736; font-size: 12px; letter-spacing: 1px; }
.section-heading h2 { font-size: 20px; font-weight: 400; letter-spacing: 2px; }
.section-aside { margin-left: auto; color: var(--text-muted); font-size: 12px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > span, .field > legend { color: #626b5f; font-size: 13px; }
.input-field { margin-bottom: 16px; }
input[type=text], input[type=number] { color: var(--text); background: #f8f8f1; border: 1px solid #d9ddcf; border-radius: 3px; padding: 8px 10px; min-height: 40px; width: 100%; }
input[type=text] { font-size: 19px; letter-spacing: 2px; }
input::placeholder { color: #93998b; font-size: 16px; letter-spacing: 1px; }
input[type=text]:focus, input[type=number]:focus { outline: 2px solid #435e5033; border-color: #435e50; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; align-items: end; }
.settings-grid > .field:last-child { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 18px; }
fieldset.field { border: 0; grid-column: 1 / -1; }
fieldset.field legend { padding-bottom: 7px; }
.radio-group { display: flex; gap: 8px; min-height: 40px; }
.radio-group label { display: flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; flex: 1; border: 1px solid #d9ddcf; border-radius: 3px; padding: 10px; white-space: nowrap; font-size: 14px; }
.radio-group label:has(input:checked) { background: #edf0e7; color: #31493c; border-color: #7d907c; }
.radio-group input { accent-color: #435e50; }
.switch { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; position: relative; }
.switch input { position: absolute; width: 38px; height: 24px; opacity: 0; }
.switch .track { width: 36px; height: 20px; border-radius: 20px; background: #d0d5c9; position: relative; transition: background .2s; }
.switch .thumb { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: white; transition: transform .2s; }
.switch input:checked + .track { background: #435e50; }
.switch input:checked + .track .thumb { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid #a04736; outline-offset: 4px; }
.switch-text { font-size: 14px; }
.actions button { width: 100%; }
.actions { border-top: 1px solid #e6e7dd; margin-top: 16px; padding-top: 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
button { cursor: pointer; min-height: 44px; border-radius: 3px; padding: 9px 12px; transition: background .18s; }
button.primary { background: #435e50; color: #fffdf4; border: 1px solid #435e50; letter-spacing: 2px; }
button.primary:hover { background: #31493c; }
button.ghost { background: transparent; color: #435e50; border: 1px solid #ccd2c4; }
button.ghost:hover { background: #edf0e7; }
button i { margin-right: 5px; font-size: 13px; }
.status { width: 100%; font-size: 12px; line-height: 1.7; color: #777a70; }
.status.err { color: #a04736; }
.note { display: flex; flex-direction: column; gap: 5px; padding: 14px 3px; color: #777a70; font-size: 13px; line-height: 1.9; }
.note-label { flex-shrink: 0; color: #8b6750; letter-spacing: 2px; }
.preview-heading { margin: 0 0 10px; }
.preview-area { background: #e9ebe3; border: 1px solid #dedfd5; padding: 18px; overflow-x: auto; }
#out { display: flex; flex-direction: column; align-items: center; gap: 24px; width: 816px; zoom: var(--preview-scale, 1); margin: 0 auto; }
.empty-hint { color: #777a70; text-align: center; padding: 60px 0; }
.page-footer { text-align: center; color: #8b8d80; font-size: 12px; letter-spacing: 3px; margin-top: 27px; }
@media (max-width: 800px) {
  .nav-inner { padding: 0 16px; }
  .container { width: calc(100% - 24px); }
  .nav-inner { grid-template-columns: auto 1fr; gap: 12px; }
  .nav-title { font-size: 16px; letter-spacing: 0; text-align: right; }
  .workspace { grid-template-columns: 1fr; gap: 16px; }
  .control-card { padding: 14px; }
  .control-card .section-heading { display: none; }
  .settings-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
  fieldset.field { grid-column: span 2; }
  .settings-grid > .field:last-child { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 18px; }
  .actions { margin-top: 10px; padding-top: 10px; gap: 10px; }
  .actions button { width: auto; flex: 1; }
  .status:empty { display: none; }
  .note { padding: 10px 2px 0; font-size: 12px; }
  .note-label { display: none; }
  .preview-area { padding: 12px; }
}
@media (max-width: 430px) {
  .settings-grid { grid-template-columns: 1fr 1fr; }
  fieldset.field { grid-column: 1 / -1; }
  .back-link { font-size: 12px; gap: 5px; }
}
@media print {
  body { background: white; }
  .preview-heading, .page-footer { display: none !important; }
  .workspace, .preview-pane { display: block; }
  .container { width: auto; max-width: none; margin: 0; padding: 0; }
  .preview-area { padding: 0; border: 0; background: white; overflow: visible; }
  #out { width: auto; zoom: 1 !important; margin: 0; align-items: center; gap: 0; padding: 0; }
}
