:root {
  --paper: #f4f3ef;
  --paper-deep: #eae9e4;
  --ink: #171717;
  --muted: #85837d;
  --line: #d8d6cf;
  --soft-line: #e5e3dc;
  --coral: #ef6b56;
  --coral-deep: #d95b48;
  --mint: #9de1cf;
  --white: #fffefa;
  --rail-width: 376px;
  --sans: "Manrope", "Noto Sans TC", sans-serif;
  --mono: "DM Mono", monospace;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }

.app-shell { min-height: 100vh; overflow: hidden; }
.topbar { height: 76px; padding: 0 48px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; background: rgba(244,243,239,.88); position: relative; z-index: 3; }
.brand { color: var(--ink); display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { width: 27px; height: 27px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; align-items: end; }
.brand-mark span { display: block; background: var(--ink); border-radius: 99px 99px 2px 2px; transform: skewY(-15deg); }
.brand-mark span:nth-child(1) { height: 13px; background: var(--coral); }
.brand-mark span:nth-child(2) { height: 22px; }
.brand-mark span:nth-child(3) { height: 17px; background: var(--mint); }
.brand-copy { display: flex; flex-direction: column; gap: 2px; }
.brand-name { font-weight: 900; letter-spacing: .07em; font-size: 15px; }
.brand-subtitle { font-family: var(--mono); letter-spacing: .12em; font-size: 8px; color: var(--muted); }
.topbar-note { color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; }
.online-dot, .status-dot { width: 6px; height: 6px; border-radius: 50%; background: #65c596; box-shadow: 0 0 0 3px rgba(101,197,150,.14); }

.workspace-grid { display: grid; grid-template-columns: var(--rail-width) minmax(0, 1fr); min-height: calc(100vh - 76px); }
.control-rail { border-right: 1px solid var(--line); padding: 50px 42px 28px; display: flex; flex-direction: column; background: #f0efea; }
.eyebrow { color: var(--muted); font-family: var(--mono); font-size: 9px; font-weight: 500; letter-spacing: .16em; margin: 0 0 16px; }
.rail-intro h1 { font-family: "Noto Sans TC", var(--sans); font-size: 31px; line-height: 1.22; letter-spacing: -.08em; margin: 0; font-weight: 900; }
em { color: var(--coral); font-style: normal; }
.intro-copy { color: #77756e; font-size: 12px; line-height: 1.8; margin: 18px 0 30px; max-width: 245px; }
.steps { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 13px 0 12px; margin-bottom: 26px; }
.step { display: flex; align-items: center; gap: 13px; padding: 8px 0; opacity: .38; transition: opacity .2s ease; }
.step.active, .step.completed { opacity: 1; }
.step > span { color: var(--muted); font-family: var(--mono); font-size: 10px; width: 19px; }
.step > div { display: flex; align-items: baseline; gap: 8px; }
.step strong { font-size: 11px; font-weight: 800; white-space: nowrap; }
.step small { color: var(--muted); font-size: 9px; white-space: nowrap; }
.step.active > span { color: var(--coral); }

.panel { margin-bottom: 25px; }
.panel-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.panel-number { color: var(--coral); font-family: var(--mono); font-size: 10px; }
.panel-heading h2 { font-size: 12px; margin: 0; font-weight: 800; letter-spacing: .02em; }
.dropzone { border: 1px dashed #bcbab2; min-height: 124px; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 17px; cursor: pointer; position: relative; transition: border .2s, background .2s, transform .2s; }
.dropzone:hover, .dropzone.dragover { background: rgba(255,255,255,.48); border-color: var(--coral); transform: translateY(-1px); }
.dropzone input, #watermarkImageInput { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone-icon { color: var(--coral); font-size: 27px; font-weight: 300; line-height: 1; margin-bottom: 8px; }
.dropzone-title { font-size: 11px; font-weight: 800; }
.dropzone-hint { color: var(--muted); font-family: var(--mono); font-size: 8px; margin-top: 6px; }
.dropzone-hint u { color: var(--ink); text-underline-offset: 2px; }
.file-chip { min-height: 59px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.45); padding: 9px 10px; margin-top: 10px; }
.file-chip-icon { width: 30px; height: 30px; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 8px; display: grid; place-items: center; flex: 0 0 auto; }
.file-chip-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.file-chip-copy strong { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-chip-copy small { color: var(--muted); font-family: var(--mono); font-size: 8px; }
.icon-button { background: none; border: 0; cursor: pointer; font-size: 20px; color: var(--muted); line-height: 1; padding: 3px; }
.icon-button:hover { color: var(--coral); }

.watermark-panel { opacity: .46; pointer-events: none; transition: opacity .25s ease; }
.watermark-panel.enabled { opacity: 1; pointer-events: auto; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border: 1px solid var(--line); background: #e7e6e0; margin-bottom: 17px; }
.segment { border: 0; background: transparent; height: 31px; cursor: pointer; font-size: 10px; color: var(--muted); display: flex; justify-content: center; align-items: center; gap: 7px; transition: color .2s, background .2s; }
.segment.active { color: var(--ink); background: var(--white); box-shadow: 0 1px 3px rgba(23,23,23,.08); }
.segment-icon { width: 16px; height: 16px; border: 1px solid currentColor; display: inline-grid; place-items: center; font-family: Georgia, serif; font-size: 11px; }
.image-icon { font-family: var(--sans); font-size: 14px; line-height: 1; }
.field-label { display: block; color: var(--muted); font-family: var(--mono); font-size: 9px; letter-spacing: .02em; margin-bottom: 8px; }
textarea { border: 1px solid var(--line); background: rgba(255,255,255,.54); color: var(--ink); resize: vertical; width: 100%; min-height: 58px; padding: 10px 11px; outline: none; font-size: 11px; line-height: 1.5; transition: border .2s, background .2s; }
textarea:focus, .color-picker:focus-within { border-color: var(--coral); background: var(--white); }
textarea::placeholder { color: #aaa8a1; }
.mini-upload { min-height: 59px; padding: 10px 12px; border: 1px dashed #bcbab2; display: flex; align-items: center; gap: 11px; cursor: pointer; }
.mini-upload:hover { border-color: var(--coral); }
.mini-upload.dragover { background: rgba(255,255,255,.48); border-color: var(--coral); transform: translateY(-1px); }
.mini-upload-icon { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid var(--line); color: var(--coral); font-size: 16px; }
.mini-upload strong, .mini-upload small { display: block; }
.mini-upload strong { font-size: 10px; }
.mini-upload small { color: var(--muted); font-family: var(--mono); font-size: 8px; margin-top: 4px; }
.watermark-image-name { color: var(--muted); font-family: var(--mono); font-size: 8px; padding-top: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.control-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin-top: 17px; }
.color-picker { display: flex; align-items: center; border: 1px solid var(--line); background: rgba(255,255,255,.54); height: 32px; }
.color-picker input[type="color"] { width: 30px; height: 30px; padding: 3px; border: 0; background: transparent; cursor: pointer; }
.color-picker input[type="text"] { width: 67px; padding: 0 7px; border: 0; outline: none; background: transparent; color: var(--ink); font-family: var(--mono); font-size: 9px; text-transform: uppercase; }
.color-presets { display: flex; align-items: center; gap: 6px; height: 32px; }
.color-dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(23,23,23,.15); padding: 0; cursor: pointer; position: relative; }
.color-dot.selected::after { content: ""; position: absolute; inset: -4px; border: 1px solid var(--ink); border-radius: 50%; }
.color-dot.white { background: #fff; }.color-dot.ink { background: #171717; }.color-dot.coral { background: var(--coral); }.color-dot.mint { background: var(--mint); }
.range-field { margin-top: 16px; }
.range-meta { display: flex; align-items: center; justify-content: space-between; }
.range-meta .field-label { margin-bottom: 6px; }
.range-meta output { color: var(--ink); font-family: var(--mono); font-size: 9px; }
input[type="range"] { width: 100%; accent-color: var(--coral); height: 3px; cursor: pointer; }
.ghost-button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 10px; display: flex; align-items: center; gap: 8px; padding: 0; margin-top: 18px; }
.ghost-button:hover { color: var(--coral); }
.ghost-button:first-letter { font-size: 17px; }
.rail-footer { border-top: 1px solid var(--line); padding-top: 17px; margin-top: auto; display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-family: var(--mono); font-size: 8px; line-height: 1.6; }
.footer-lock { color: var(--coral); font-size: 18px; line-height: .9; }

.canvas-workspace { min-width: 0; display: flex; flex-direction: column; padding: 50px 56px 25px; position: relative; }
.canvas-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.canvas-header .eyebrow { margin-bottom: 11px; }
.canvas-header h2 { font-family: "Noto Sans TC", var(--sans); font-size: 24px; letter-spacing: -.06em; line-height: 1; margin: 0; font-weight: 900; }
.download-button { min-width: 148px; height: 43px; border: 0; background: var(--ink); color: var(--white); cursor: pointer; display: flex; gap: 10px; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; transition: background .2s, transform .2s, opacity .2s; }
.download-button:hover:not(:disabled) { background: var(--coral); transform: translateY(-2px); }
.download-button:disabled { cursor: not-allowed; opacity: .27; }
.download-icon { font-family: var(--mono); font-size: 17px; line-height: 1; }
.preview-toolbar { display: flex; justify-content: space-between; align-items: center; margin-top: 27px; margin-bottom: 12px; min-height: 26px; }
.toolbar-left { display: flex; align-items: center; gap: 12px; }
.status-pill { color: var(--muted); font-family: var(--mono); font-size: 9px; display: flex; align-items: center; gap: 7px; }
.status-pill.ready { color: #459a72; }.status-pill.processing { color: var(--coral); }.status-pill.processing .status-dot { background: var(--coral); box-shadow: 0 0 0 3px rgba(239,107,86,.14); }
.page-count { color: var(--muted); font-family: var(--mono); font-size: 9px; border-left: 1px solid var(--line); padding-left: 12px; }
.toolbar-button { color: var(--muted); border: 0; background: none; font-family: var(--mono); font-size: 9px; cursor: pointer; padding: 6px; }
.toolbar-button:disabled { opacity: .35; cursor: not-allowed; }.toolbar-button:not(:disabled):hover { color: var(--coral); }.toolbar-button span { margin-left: 7px; opacity: .6; }
.stage-wrap { flex: 1; position: relative; min-height: 460px; border: 1px solid var(--line); overflow: auto; background: #dfded8; display: flex; align-items: center; justify-content: center; padding: 44px; }
.stage-grid { position: absolute; inset: 0; opacity: .31; background-image: linear-gradient(rgba(255,255,255,.4) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.4) 1px, transparent 1px); background-size: 28px 28px; pointer-events: none; }
.empty-state { position: relative; z-index: 1; text-align: center; animation: floatIn .65s ease both; }
.empty-orbit { width: 160px; height: 95px; position: relative; margin: 0 auto 22px; }
.orbit-ring { position: absolute; border: 1px solid #b5b3ac; border-radius: 50%; transform: rotate(-18deg); }.ring-one { width: 178px; height: 58px; top: 18px; left: -9px; }.ring-two { width: 148px; height: 95px; top: -1px; left: 6px; transform: rotate(55deg); border-color: #c7c5be; }
.orbit-card { position: absolute; width: 48px; height: 61px; display: grid; place-items: center; border: 1px solid var(--ink); font-family: var(--mono); font-size: 9px; box-shadow: 5px 5px 0 rgba(23,23,23,.08); }.card-back { left: 32px; top: 13px; background: var(--mint); transform: rotate(11deg); }.card-front { left: 78px; top: 21px; background: var(--white); transform: rotate(-13deg); font-family: Georgia, serif; font-size: 30px; font-weight: 700; }
.empty-kicker { color: var(--coral); font-family: var(--mono); font-size: 9px; letter-spacing: .14em; margin: 0 0 12px; }.empty-state h3 { font-family: "Noto Sans TC", var(--sans); font-size: 25px; letter-spacing: -.07em; line-height: 1.3; margin: 0; }.empty-state > p:last-child { color: var(--muted); font-size: 10px; line-height: 1.8; margin-top: 14px; }
.preview-stack { position: relative; z-index: 1; display: flex; align-items: center; gap: 28px; flex-direction: column; min-width: min(100%, 880px); }
.preview-page { position: relative; background: white; box-shadow: 0 12px 28px rgba(54,53,49,.16); flex: 0 0 auto; overflow: visible; }
.preview-page canvas { display: block; max-width: none; }
.preview-page.docx-page { width: min(100%, 760px); min-height: 920px; padding: 60px 66px; color: #2c2b28; overflow: hidden; }
.docx-sheet { font-family: "Noto Sans TC", var(--sans); font-size: 14px; line-height: 1.8; }.docx-sheet h1, .docx-sheet h2, .docx-sheet h3 { line-height: 1.35; margin: .7em 0 .3em; }.docx-sheet p { margin: .7em 0; }.docx-sheet img { max-width: 100%; }.docx-sheet table { border-collapse: collapse; width: 100%; }.docx-sheet td, .docx-sheet th { border: 1px solid #ccc; padding: 5px; }
.watermark-layer { position: absolute; z-index: 2; transform: translate(-50%, -50%); transform-origin: center; cursor: move; user-select: none; touch-action: none; min-width: 40px; min-height: 24px; display: flex; align-items: center; justify-content: center; }
.watermark-layer::before { content: ""; position: absolute; inset: -7px; border: 1px dashed rgba(239,107,86,.65); opacity: 0; transition: opacity .2s; pointer-events: none; }.watermark-layer:hover::before, .watermark-layer.selected::before { opacity: 1; }
.watermark-text { white-space: nowrap; font-family: "Manrope", "Noto Sans TC", sans-serif; font-size: clamp(13px, 4vw, 48px); font-weight: 800; letter-spacing: .04em; line-height: 1; text-shadow: 0 1px 8px rgba(0,0,0,.18); }
.watermark-image { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.resize-handle { width: 12px; height: 12px; position: absolute; right: -8px; bottom: -8px; border: 2px solid var(--coral); background: var(--white); cursor: nwse-resize; opacity: 0; transition: opacity .2s; }.watermark-layer:hover .resize-handle, .watermark-layer.selected .resize-handle { opacity: 1; }
.stage-hint { position: absolute; z-index: 3; left: 50%; bottom: 14px; transform: translateX(-50%); padding: 8px 12px; background: rgba(23,23,23,.82); color: var(--white); font-family: var(--mono); font-size: 8px; white-space: nowrap; }.mouse-icon { color: var(--mint); margin-right: 4px; }
.workspace-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; color: var(--muted); font-family: var(--mono); font-size: 8px; }.workspace-footer > div { display: flex; align-items: center; gap: 7px; }.footer-swatch { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }.shortcut-hint { color: #aaa8a1; }
.site-footer { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 12px; display: flex; align-items: center; justify-content: center; }
.site-footer-year { color: #666666; font-size: 14px; line-height: 1.4; }
.site-footer a { color: #4a90e2; font-size: 14px; line-height: 1.4; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-underline-offset: 3px; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); z-index: 20; padding: 11px 15px; background: var(--ink); color: var(--white); font-family: var(--mono); font-size: 9px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }.toast.show { opacity: 1; transform: translate(-50%, 0); }
@keyframes floatIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 1040px) { :root { --rail-width: 320px; }.control-rail { padding-left: 27px; padding-right: 27px; }.canvas-workspace { padding-left: 32px; padding-right: 32px; }.step > div { display: block; }.step small { display: block; margin-top: 2px; } }
@media (max-width: 760px) { .topbar { height: 65px; padding: 0 20px; }.topbar-note { display: none; }.workspace-grid { display: block; }.control-rail { border-right: 0; border-bottom: 1px solid var(--line); padding: 32px 20px 24px; }.rail-intro h1 { font-size: 28px; }.intro-copy { margin-bottom: 22px; }.steps { margin-bottom: 22px; }.step > div { display: flex; }.rail-footer { display: none; }.canvas-workspace { padding: 31px 20px 20px; }.canvas-header h2 { font-size: 21px; }.download-button { min-width: 119px; height: 39px; font-size: 10px; }.stage-wrap { min-height: 400px; padding: 28px 16px; }.preview-page.docx-page { min-height: 720px; padding: 35px 30px; }.shortcut-hint { display: none; } }
@media (max-width: 760px) { .site-footer { align-items: flex-start; flex-direction: column; gap: 10px; } }

/* Single-page layout: keep the tool and brand footer in one viewport. */
body { overflow-x: hidden; }
.app-shell { overflow: visible; }
.workspace-grid { min-height: calc(100vh - 76px); height: calc(100vh - 76px); }
.control-rail { padding: 28px 30px 18px; overflow-y: auto; scrollbar-width: thin; }
.rail-intro h1 { font-size: 28px; }
.intro-copy { font-size: 13px; line-height: 1.65; margin: 12px 0 18px; }
.steps { padding: 8px 0 7px; margin-bottom: 16px; }
.step { gap: 11px; padding: 6px 0; }
.step > span { font-size: 11px; }
.step strong { font-size: 13px; }
.step small { font-size: 10px; }
.panel { margin-bottom: 16px; }
.panel-heading { margin-bottom: 11px; }
.panel-heading h2 { font-size: 14px; }
.dropzone { min-height: 96px; }
.dropzone-icon { font-size: 23px; margin-bottom: 5px; }
.dropzone-title { font-size: 13px; }
.dropzone-hint { font-size: 10px; margin-top: 5px; }
.file-chip { min-height: 50px; }
.file-chip-copy strong { font-size: 12px; }
.file-chip-copy small { font-size: 9px; }
.segmented { margin-bottom: 12px; }
.segment { height: 30px; font-size: 12px; }
.field-label { font-size: 10px; margin-bottom: 6px; }
textarea { min-height: 52px; font-size: 13px; padding: 8px 10px; }
.control-row { margin-top: 12px; }
.range-field { margin-top: 11px; }
.range-meta output { font-size: 10px; }
.ghost-button { font-size: 12px; margin-top: 12px; }
.canvas-workspace { height: calc(100vh - 76px); padding: 30px 42px 18px; overflow: hidden; }
.canvas-header h2 { font-size: 22px; }
.preview-toolbar { margin-top: 18px; margin-bottom: 9px; }
.stage-wrap { flex: 1 1 auto; min-height: 0; height: auto; max-height: none; padding: 30px; }
.workspace-footer { margin-top: 9px; font-size: 9px; }
.site-footer { margin-top: 10px; padding-top: 10px; }

@media (max-width: 1040px) {
  .control-rail { padding-left: 24px; padding-right: 24px; }
  .canvas-workspace { padding-left: 28px; padding-right: 28px; }
}

@media (max-width: 760px) {
  .workspace-grid { height: auto; min-height: 0; }
  .control-rail { height: auto; max-height: none; overflow: visible; padding: 28px 20px 22px; }
  .canvas-workspace { height: auto; min-height: 0; overflow: visible; padding: 26px 20px 18px; }
  .stage-wrap { min-height: 380px; height: min(62vh, 520px); padding: 24px 15px; }
  .site-footer { align-items: center; }
}
