:root {
  --brand: #ac9e9c;
  --brand-deep: #8f7c79;
  --brand-ink: #302d2d;
  --brand-muted: #756d6b;
  --brand-soft: #f1ebe9;
  --brand-line: #e3dad8;
  color: var(--brand-ink);
  background: #e7e4e4;
  font-family: Arial, "Noto Sans TC", -apple-system, BlinkMacSystemFont, sans-serif;
}
html { scroll-behavior: smooth; }
body { background: #e7e4e4; color: var(--brand-ink); }
.app-frame { min-height: 100vh; }
.app-sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; flex-direction: column;
  width: 250px; height: 100dvh; border-right: 1px solid #e2d9d7;
  background: #faf7f6; box-shadow: 4px 0 18px #5243400e;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; min-height: 94px; padding: 20px 23px; }
.sidebar-brand img { width: 44px; height: 44px; object-fit: contain; }
.sidebar-brand strong, .sidebar-brand small { display: block; color: var(--brand-deep); line-height: 1.2; letter-spacing: .06em; }
.sidebar-brand strong { font-size: 12px; }
.sidebar-brand small { font-size: 11px; font-weight: 700; margin-top: 3px; }
.sidebar-nav { flex: 1; padding: 10px 14px; overflow-y: auto; }
.sidebar-caption { margin: 5px 0 9px; padding: 0 13px; color: #a29390; font-size: 10px; font-weight: 750; letter-spacing: .1em; }
.sidebar-caption-spaced { margin-top: 27px; }
.sidebar-link { display: flex; align-items: center; gap: 12px; min-height: 46px; margin: 2px 0; padding: 0 13px; border-radius: 13px; color: #49413f; text-decoration: none; font-size: 13px; font-weight: 600; }
.sidebar-link:hover, .sidebar-link.is-active { background: #e9dfdd; color: #786461; }
.sidebar-link.is-active { font-weight: 750; }
.sidebar-icon { display: grid; place-items: center; width: 22px; flex: none; color: #988783; font-size: 11px; font-weight: 750; }
.sidebar-link.is-active .sidebar-icon { color: #786461; font-size: 20px; }
.sidebar-footer { display: flex; align-items: center; gap: 10px; margin: 16px; padding: 16px; border: 1px solid var(--brand-line); border-radius: 14px; background: #f1ebe9; color: #746967; font-size: 11px; }
.app-main { min-width: 0; min-height: 100vh; margin-left: 250px; }
.topbar { height: 75px; padding: 0 clamp(20px, 3vw, 42px); background: #fff; border-bottom: 1px solid #e2d9d7; }
.brand { gap: 12px; }
.company-logo { display: none; width: 40px; height: 40px; object-fit: contain; flex: none; }
.brand strong { color: #383332; font-size: 16px; font-weight: 750; letter-spacing: -.01em; }
.brand small { color: #938987; font-size: 10px; margin-top: 3px; letter-spacing: .1em; }
.topbar-note { color: #817773; font-size: 11px; }
.privacy-dot { width: 8px; height: 8px; background: #8db197; box-shadow: 0 0 0 4px #e7f1e9; }
.shell { max-width: 1600px; padding: 30px clamp(20px, 3vw, 42px) 34px; }
.intro { align-items: center; margin-bottom: 24px; }
.eyebrow { margin-bottom: 8px; color: #9b8985; font-size: 10px; font-weight: 700; letter-spacing: .06em; }
.intro h1 { margin: 0; color: #302d2d; font-size: 25px; font-weight: 750; letter-spacing: -.02em; }
.intro-copy { margin: 7px 0 0; color: #766f6e; font-size: 12px; }
.steps { align-self: center; padding: 0; }
.steps div { color: #847a77; }
.steps b, .section-number { color: var(--brand-deep); }
.steps i { background: #cfc4c1; }
.workspace { grid-template-columns: minmax(300px, 335px) minmax(0, 1fr); gap: 18px; }
.controls, .preview-column { border-color: #ded6d4; border-radius: 16px; background: #fff; box-shadow: 0 4px 12px #0000000d; }
.panel-title, .control-section, .preview-head { border-bottom-color: #ece6e4; }
.panel-title { padding: 21px 22px; }
.panel-title-icon { background: #f1ebe9; color: #8f7c79; }
.panel-title h2, .preview-head h2, .section-heading h3 { color: #302d2d; }
.panel-title p, .section-help, .preview-head #previewInfo { color: #817875; }
.control-section { padding: 22px; scroll-margin-top: 20px; }
.section-heading h3 { font-size: 14px; }
.upload-box, .photo-upload { border-color: #cbbfbc; background: #faf8f7; }
.upload-box:hover, .upload-box.dragover, .photo-upload:hover { border-color: #9f8c89; background: #f4eeec; }
.upload-icon, .photo-symbol, .photo-chevron { color: var(--brand-deep); }
.upload-box small, .file-status, .photo-upload small, .page-picker { color: #877d79; }
.page-picker button { border-color: var(--brand-line); color: var(--brand-deep); }
.segmented { background: #eee8e6; }
.segmented button { color: #726966; }
.segmented button.active { color: #665653; box-shadow: 0 2px 7px #49382c12; }
.range-head, .field-label, .unit-field { color: #514946; }
.range-head output, .region-controls-title small, .unit-field em { color: #938986; }
input[type=range] { accent-color: #9b8885; }
.subtle-button { border-color: #d8cecb; color: #745f5b; }
.subtle-button:hover, .subtle-button.active { background: #f1ebe9; border-color: var(--brand); }
.region-item { border-color: var(--brand-line); background: #faf8f7; color: #6f5e5a; }
.region-item.selected { border-color: var(--brand); background: #f1ebe9; }
.region-controls { background: #faf8f7; border-color: var(--brand-line); }
.region-controls-title strong { color: #675552; }
.text-input, .unit-field input { border-color: #d8cecb; color: #302d2d; background: #fff; }
.text-input:focus, .unit-field input:focus { border-color: #a99895; box-shadow: 0 0 0 3px #f1ebe9; }
.text-input::placeholder { color: #a29894; }
.preview-head { padding: 20px 23px; }
.eyebrow.small { color: #a29390; }
.preview-head-actions { display: flex; align-items: center; gap: 12px; }
.expand-preview { display: none; border: 1px solid #d8cecb; border-radius: 8px; background: #fff; color: #745f5b; padding: 7px 10px; font-size: 11px; font-weight: 700; }
.expand-preview:hover { background: #f1ebe9; }
.preview-stage { background: #eeeaea; }
.preview-stage canvas { box-shadow: 0 12px 35px #49382c2b; }
.empty-page { box-shadow: 0 13px 28px #49382c20; }
.empty-page span { background: #e9e0dd; }
.empty-page span:nth-child(1) { background: #ac9e9c; }
.empty-page div { background: #f1ebe9; }
.empty-photo { background: linear-gradient(140deg, #eee6e4, #cbbab7); border-color: #eeeaea; color: var(--brand-deep); }
.empty-state h3 { color: #383332; }
.empty-state p, .footer-tip, .bottom-note { color: #817875; }
.footer-tip span { color: var(--brand-deep); }
.primary-button { border-color: #9c8986; background: #9c8986; color: #fff; box-shadow: 0 4px 10px #49382c22; }
.primary-button:not(:disabled):hover { background: #85716d; }
.outline-button { border-color: #d8cecb; color: #745f5b; }
.outline-button:not(:disabled):hover { background: #f1ebe9; }
#toast { background: #796966; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 2px solid #8f7c79; outline-offset: 2px; }

/* Keep controls readable at normal browser zoom on desktop and phone. */
body { font-size: 14px; line-height: 1.5; }
.sidebar-brand strong { font-size: 14px; }
.sidebar-brand small, .sidebar-caption { font-size: 12px; }
.sidebar-link { font-size: 14px; }
.sidebar-icon { font-size: 12px; }
.sidebar-footer, .topbar-note { font-size: 12px; }
.brand small, .eyebrow, .eyebrow.small { font-size: 11px; }
.intro h1 { font-size: 27px; line-height: 1.25; }
.intro-copy { font-size: 14px; line-height: 1.6; }
.steps div, .steps b { font-size: 12px; }
.panel-title h2, .preview-head h2 { font-size: 18px; }
.panel-title p, .section-help, .preview-head #previewInfo { font-size: 13px; line-height: 1.55; }
.section-heading h3 { font-size: 16px; }
.section-number { font-size: 12px; }
.upload-box strong, .photo-upload strong { font-size: 14px; }
.upload-box small, .file-status, .photo-upload small, .page-picker { font-size: 12px; line-height: 1.5; }
.photo-upload > span:nth-child(2) { min-width: 0; }
.photo-upload small { max-width: none; white-space: normal; overflow-wrap: anywhere; }
.segmented button, .subtle-button, .region-item, .region-item button { font-size: 13px; }
.range-head, .field-label, .unit-field, .region-controls-title strong { font-size: 13px; }
.range-head output, .region-controls-title small, .unit-field em { font-size: 12px; }
.text-input, .unit-field input { font-size: 15px; }
.region-item { min-height: 32px; }
.unit-field input { height: 40px; }
.unit-field em { top: 10px; }
.expand-preview, .primary-button, .outline-button { font-size: 13px; }
.empty-state h3 { font-size: 18px; }
.empty-state p { font-size: 14px; line-height: 1.5; }
.footer-tip p, .bottom-note { font-size: 12px; line-height: 1.5; }
#toast { font-size: 13px; }
@media (max-width: 1180px) {
  .app-sidebar { display: none; }
  .app-main { margin-left: 0; }
  .company-logo { display: block; }
}
@media (max-width: 760px) {
  .topbar { height: 64px; padding: 0 14px; }
  .brand strong { font-size: 16px; }
  .brand small { font-size: 11px; }
  .shell { padding: 20px 12px 26px; }
  .intro { margin-bottom: 18px; }
  .intro h1 { font-size: 23px; }
  .intro-copy { margin: 7px 0 0; line-height: 1.55; }
  .workspace { display: flex; flex-direction: column; gap: 14px; }
  .controls, .preview-column { width: 100%; }
  .preview-column { order: -1; position: sticky; top: 0; z-index: 5; min-height: 0; border-radius: 0 0 14px 14px; }
  .preview-head { padding: 10px 14px; min-height: 58px; }
  .preview-head h2 { font-size: 17px; }
  .preview-head #previewInfo { display: none; }
  .expand-preview { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; }
  .preview-stage { height: clamp(150px, 32dvh, 300px); min-height: 0; padding: 10px; overflow: hidden; }
  .preview-stage canvas { max-height: 100%; max-width: 100%; }
  .empty-art { display: none; }
  .empty-state h3 { font-size: 17px; margin: 0 0 6px; }
  .empty-state p { font-size: 13px; margin: 0 0 12px; }
  .empty-state .primary-button { min-height: 40px; }
  .preview-footer { padding: 9px 12px; }
  .footer-tip { display: none; }
  .export-actions { width: 100%; display: flex; flex-direction: row; gap: 8px; }
  .export-actions > * { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 8px 7px; font-size: 13px; }
  .primary-button span { margin-left: 5px; }
  .controls { border-radius: 14px; }
  .control-section { padding: 18px; }
  .panel-title { padding: 18px; }
  .text-input, .unit-field input { font-size: 16px; }
  body.preview-open { overflow: hidden; }
  .preview-column.is-expanded { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; width: 100%; height: 100dvh; border: 0; border-radius: 0; }
  .preview-column.is-expanded .preview-stage { flex: 1 1 auto; height: auto; min-height: 0; padding: 14px; }
  .preview-column.is-expanded .preview-head { flex: none; }
  .preview-column.is-expanded .preview-footer { flex: none; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}
@media (max-width: 400px) {
  .export-actions, .two-fields { grid-template-columns: 1fr; flex-direction: column; }
  .preview-column:not(.is-expanded) .export-actions { flex-direction: row; }
  .preview-column:not(.is-expanded) .export-actions > * { font-size: 12px; }
}
