:root {
  --canvas: #f6f8fa;
  --surface: #fff;
  --surface-raised: #fbfcfd;
  --line: #dde5ea;
  --line-soft: #edf1f4;
  --ink: #15202b;
  --text: #26313d;
  --subtle: #66717e;
  --muted: #8a95a3;
  --jade: #0a9f6a;
  --jade-hover: #07885b;
  --jade-soft: #eaf7f0;
  --jade-line: #b9e4cf;
  --cobalt: #2f6fde;
  --cobalt-soft: #edf4ff;
  --cobalt-line: #c8dbff;
  --amber: #d99018;
  --amber-soft: #fff7e8;
  --amber-line: #f0d39a;
  --coral: #d64f45;
  --coral-soft: #fff0ee;
  --shadow: 0 14px 34px rgba(17, 24, 39, 0.11);
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: #e1e7ec transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 999px; background: #e1e7ec; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #cfd8df; background-clip: padding-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background: var(--canvas);
  font-family: var(--font);
  letter-spacing: 0;
}

button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; }

.app {
  display: grid;
  --preview-width: 420px;
  grid-template-rows: 64px minmax(0, 1fr);
  grid-template-columns: 280px minmax(0, 1fr) 1px var(--preview-width);
  grid-template-areas: "topbar topbar topbar topbar" "side editor handle preview";
  height: 100vh;
  overflow: hidden;
  background: var(--surface);
}
.app.side-hidden { grid-template-columns: 0 minmax(0, 1fr) 1px var(--preview-width); }
.app.preview-hidden { grid-template-columns: 280px minmax(0, 1fr) 0 0; }
.app.side-hidden.preview-hidden { grid-template-columns: 0 minmax(0, 1fr) 0 0; }
.app.side-hidden .side, .app.preview-hidden .preview { display: none; }
.app.preview-hidden .resize-handle { visibility: hidden; }
.app.side-hidden .topbar { grid-template-columns: 64px minmax(0, 1fr) auto; }
.app.side-hidden .brand { display: flex; justify-content: center; gap: 0; padding: 0; }
.app.side-hidden .brand > div, .app.side-hidden .brand .icon-btn { display: none; }
.app.side-hidden .project-strip { display: none; }

/* 14-16寸笔记本适配 */
@media screen and (max-width: 1440px) {
  .app {
    grid-template-columns: 248px minmax(0, 1fr) 1px 360px;
  }
  .app.side-hidden { grid-template-columns: 0 minmax(0, 1fr) 1px 440px; }
  .app.preview-hidden { grid-template-columns: 248px minmax(0, 1fr) 0 0; }
  .app.side-hidden.preview-hidden { grid-template-columns: 0 minmax(0, 1fr) 0 0; }
  .topbar { grid-template-columns: 248px minmax(0, 1fr) auto; }
  .brand { padding: 0 12px 0 14px; }
  .brand-logo { width: 36px; height: 36px; }
  .brand strong { font-size: 14px; }
  .brand span { font-size: 11px; }
  .top-actions { padding: 0 12px; gap: 8px; }
  .btn { height: 32px; padding: 0 10px; font-size: 12px; }
  .project-strip { padding: 0 14px; }
  .project-name strong, .project-name span { font-size: 12px; }
  .generate-panel { padding: 10px; gap: 8px; }
  .generate-panel textarea { min-height: 110px; font-size: 13px; padding: 10px 12px; }
  .generate-settings select { height: 30px; font-size: 11px; }
  .generate-main { height: 36px; font-size: 13px; }
  .library { padding: 10px 12px; }
  .library-head h2 { font-size: 13px; }
  .project-list { gap: 5px; }
  .project-item { padding: 8px 10px; font-size: 12px; }
  .avatar { width: 26px; height: 26px; font-size: 12px; }
  .editor-toolbar { padding: 0 12px; min-height: 44px; }
  .toolbar-group { gap: 2px; }
  .icon-btn { width: 30px; height: 30px; }
  .editor-toolbar-meta { gap: 8px; }
  .stats { gap: 8px; font-size: 11px; }
  .document { padding: 24px 18px 60px; }
  .paper { max-width: 680px; padding: 36px 40px 48px; font-size: 14px; }
  .paper h1 { font-size: 25px; }
  .paper h2 { font-size: 16px; }
  .statusbar { padding: 0 16px; font-size: 11px; height: 34px; }
  .module-head { padding: 0 12px; min-height: 48px; }
  .module-head h2 { font-size: 13px; }
  .template-row { padding: 10px 12px; }
  .template-tab { height: 30px; font-size: 11px; }
  .preview-canvas { padding: 16px 20px 36px; }
  .preview-canvas.desktop .wechat > section { padding: 26px 30px 40px; }
}

@media screen and (max-width: 1280px) {
  .app {
    grid-template-columns: 220px minmax(0, 1fr) 320px;
  }
  .app.side-hidden { grid-template-columns: 0 minmax(0, 1fr) 1px 380px; }
  .app.preview-hidden { grid-template-columns: 220px minmax(0, 1fr) 0 0; }
  .app.side-hidden.preview-hidden { grid-template-columns: 0 minmax(0, 1fr) 0 0; }
  .topbar { grid-template-columns: 220px minmax(0, 1fr) auto; }
  .brand { padding: 0 10px 0 12px; }
  .brand-logo { width: 32px; height: 32px; }
  .brand strong { font-size: 13px; }
  .brand span { display: none; }
  .top-actions { padding: 0 10px; gap: 6px; }
  .btn { height: 30px; padding: 0 8px; font-size: 12px; }
  .project-strip { padding: 0 10px; }
  .project-name strong, .project-name span { font-size: 11px; }
  .source-tabs { height: 40px; }
  .source-tab { font-size: 12px; }
  .generate-panel { padding: 10px; gap: 8px; }
  .generate-panel textarea { min-height: 90px; font-size: 12px; padding: 9px 10px; }
  .library-head h2, .module-head h2 { font-size: 12px; }
  .panel-title p { display: none; }
  textarea { min-height: 76px; font-size: 12px; }
  .setting-grid { grid-template-columns: 1fr; gap: 5px; margin-top: 6px; }
  .setting-grid select { height: 28px; font-size: 11px; }
  .generate-main { height: 34px; margin-top: 8px; font-size: 12px; }
  .library { padding: 8px 10px; }
  .library-head h2 { font-size: 12px; }
  .project-list { gap: 4px; }
  .project-item { padding: 7px 9px; font-size: 11px; }
  .avatar { width: 26px; height: 26px; font-size: 12px; }
  .account-name { max-width: 60px; font-size: 11px; }
  .account-token { font-size: 10px; }
  .editor-toolbar { padding: 0 10px; min-height: 40px; }
  .icon-btn { width: 28px; height: 28px; }
  .toolbar-icon { width: 14px; height: 14px; }
  .editor-toolbar-meta { gap: 6px; }
  .stats { gap: 6px; font-size: 10px; }
  .document { padding: 18px 14px 50px; }
  .paper { max-width: 600px; padding: 28px 28px 40px; font-size: 13px; line-height: 1.8; }
  .paper h1 { font-size: 22px; margin-bottom: 10px; }
  .paper h2 { font-size: 15px; margin: 22px 0 8px; }
  .paper p { margin: 8px 0; }
  .statusbar { padding: 0 12px; font-size: 10px; height: 30px; }
  .module-head { padding: 0 10px; min-height: 44px; }
  .module-head h2 { font-size: 12px; }
  .device-switch button { width: 26px; height: 26px; }
  .device-switch .device-icon { width: 13px; height: 13px; }
  .template-row { padding: 8px 10px; }
  .template-tab { height: 28px; font-size: 10px; }
  .preview-canvas { padding: 12px 14px 24px; }
  .preview-canvas.desktop .wechat > section { padding: 20px 22px 32px; }
  .phone { max-width: 300px; }
  .restore-left, .restore-rail { top: 110px; }
  .restore-left button, .restore-rail button { width: 84px; height: 36px; font-size: 12px; }
  .ai-bubble { height: 30px; padding: 0 10px; font-size: 12px; }
  .export-options { grid-template-columns: 1fr; }
  .export-option { min-height: 80px; padding: 10px; font-size: 12px; }
  .modal { width: min(90vw, 640px); }
  .modal header, .modal footer { padding: 0 14px; min-height: 50px; }
  .modal-body { padding: 14px; max-height: calc(100vh - 170px); }
  .auth-modal { width: min(90vw, 380px); }
  .ai-grid { grid-template-columns: 1fr; }
  .ai-grid .full { grid-column: 1; }
  .text-box { min-height: 88px; font-size: 12px; }
}

.topbar {
  grid-area: topbar;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) auto;
  align-items: center;
  height: 64px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.96);
}
.brand {
  grid-column: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 100%;
  padding: 0 16px 0 20px;
  border-right: 1px solid var(--line);
}
.brand-logo {
  display: block;
  width: 42px;
  height: 42px;
  border: 1px solid var(--jade-line);
  border-radius: 8px;
  background: var(--surface);
  object-fit: contain;
}
.brand strong, .brand span, .project-name strong, .project-name span { display: block; }
.brand strong, .project-name strong { color: var(--ink); font-size: 15px; }
.brand span, .project-name span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.brand .icon-btn { margin-left: auto; }
.project-strip { grid-column: 2; display: flex; align-items: center; min-width: 0; height: 100%; padding: 0 20px; }
.project-name { min-width: 0; }
.project-name strong, .project-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { grid-column: 3; display: flex; align-items: center; gap: 10px; height: 100%; padding: 0 18px; border-left: 1px solid var(--line); white-space: nowrap; }

.btn, .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  white-space: nowrap;
}
.btn { gap: 8px; height: 36px; padding: 0 14px; font-size: 13px; font-weight: 700; }
.btn.primary { color: #fff; background: var(--jade); }
.btn.primary:hover { background: var(--jade-hover); }
.btn.secondary { color: var(--subtle); border: 1px solid var(--line); background: var(--surface); }
.btn.secondary:hover { color: var(--cobalt); border-color: var(--cobalt-line); background: var(--cobalt-soft); }
.btn:disabled { cursor: wait; opacity: .72; }
.icon-btn { width: 34px; height: 34px; color: var(--subtle); background: transparent; }
.icon-btn:hover { color: var(--cobalt); background: var(--cobalt-soft); }

.side, .editor, .preview { min-height: 0; background: var(--surface); overflow: hidden; }
.side { grid-area: side; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.generate-panel { padding: 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.generate-panel textarea { flex: 1; min-height: 160px; padding: 12px 14px; resize: none; line-height: 1.7; font-size: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.generate-panel textarea:focus { border-color: var(--jade-line); box-shadow: 0 0 0 3px rgba(10,159,106,.1); }
.generate-settings { display: flex; gap: 8px; }
.generate-settings select { flex: 1; height: 34px; padding: 0 9px; color: var(--subtle); font-size: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.generate-settings select:focus { border-color: var(--jade-line); box-shadow: 0 0 0 3px rgba(10,159,106,.1); }
.generate-main { width: 100%; height: 40px; font-size: 14px; }

.library { display: flex; flex: 1; flex-direction: column; min-height: 0; padding: 12px 14px; overflow: hidden; }
.library-head { display: flex; align-items: center; margin-bottom: 8px; }
.library-head h2, .module-head h2 { margin: 0; color: var(--ink); font-size: 14px; }
.project-list { display: flex; flex-direction: column; gap: 4px; flex: 1; min-height: 0; overflow: auto; padding-right: 2px; }
.project-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-align: left; background: var(--surface); font-size: 12px; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.project-item:hover { border-color: var(--jade-line); background: var(--jade-soft); }
.project-item.active { border-color: var(--jade); background: var(--jade-soft); }
.project-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.project-item strong { overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.project-item span { color: var(--muted); font-size: 11px; }
.project-item .delete-btn { opacity: 0; flex-shrink: 0; width: 22px; height: 22px; border-radius: 4px; color: var(--muted); background: transparent; font-size: 14px; line-height: 1; transition: opacity 0.15s, color 0.15s; }
.project-item:hover .delete-btn { opacity: 1; }
.project-item .delete-btn:hover { color: var(--coral); background: var(--coral-soft); }
.account-dropdown { position: relative; }
.account-trigger { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: var(--radius); background: transparent; cursor: pointer; }
.account-trigger:hover { background: var(--line-soft); }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #fff; background: var(--jade); font-weight: 800; font-size: 13px; flex-shrink: 0; }
.account-info { display: flex; flex-direction: row; align-items: center; gap: 3px; }
.account-name { color: var(--subtle); font-size: 12px; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-arrow { color: var(--subtle); font-size: 13px; line-height: 1; }
.account-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 100; display: none; min-width: 120px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.account-menu.open { display: block; }
.account-menu button { display: block; width: 100%; height: 34px; padding: 0 9px; border-radius: 6px; color: var(--subtle); background: transparent; text-align: left; font-size: 13px; }
.account-menu button:hover { color: var(--ink); background: var(--surface-raised); }

.editor { grid-area: editor; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.editor-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 18px; border-bottom: 1px solid var(--line-soft); }
.toolbar-group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.toolbar-sep { width: 1px; height: 18px; margin: 0 2px; background: var(--line); }
.toolbar-icon { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.toolbar-underline { text-decoration: underline; }
.toolbar-strike { text-decoration: line-through; }
.toolbar-highlight { padding: 0 3px; border-radius: 4px; background: #fff0b8; font-weight: 800; }
.toolbar-quote { font-size: 17px; font-weight: 800; line-height: 1; }
.toolbar-icon-clear .toolbar-clear-eraser { fill: #f3c0cc; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.toolbar-icon-clear .toolbar-clear-stroke { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.editor-toolbar .icon-btn.active .toolbar-icon-clear .toolbar-clear-eraser { fill: #f7d2db; }
.editor-toolbar .icon-btn strong, .editor-toolbar .icon-btn em { font-style: normal; font-weight: 800; }
.editor-toolbar .icon-btn em { font-style: italic; font-weight: 700; }
.editor-toolbar .icon-btn.active { color: var(--jade); background: var(--jade-soft); box-shadow: inset 0 0 0 1px var(--jade-line); }
.editor-toolbar .icon-btn:disabled { opacity: .45; cursor: not-allowed; }
.editor-toolbar-meta { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.stats { display: flex; gap: 12px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.document { flex: 1; min-height: 0; overflow: auto; padding: 36px 28px 76px; background: linear-gradient(180deg, #fff 0%, #fbfcfd 100%); }
.paper { max-width: 760px; min-height: 920px; margin: 0 auto; padding: 44px 54px 60px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 8px 20px rgba(17,24,39,.07); line-height: 1.88; font-size: 15px; }
.paper:focus { outline: none; }
.paper h1 { margin: 0 0 14px; color: var(--ink); font-size: 29px; line-height: 1.32; }
.paper .summary { padding: 15px 16px; border: 1px solid var(--jade-line); border-radius: 8px; color: #245241; background: var(--jade-soft); }
.paper h2 { margin: 30px 0 12px; color: var(--ink); font-size: 18px; }
.paper p { margin: 11px 0; color: #2d3844; }
.paper blockquote { margin: 14px 0; padding: 12px 14px; border-left: 3px solid var(--cobalt); border-radius: 0 8px 8px 0; color: #31455f; background: var(--cobalt-soft); }
.paper ul, .paper ol { margin: 12px 0 12px 22px; padding: 0; color: #2d3844; }
.paper li { margin: 6px 0; }
.paper a { color: var(--cobalt); text-decoration: underline; }
.paper mark { padding: 2px 4px; border-radius: 5px; background: #fff0b8; }
.generation-progress { display: grid; gap: 18px; min-height: 650px; align-content: center; color: var(--ink); }
.generation-signal { display: flex; align-items: end; gap: 6px; height: 42px; }
.generation-signal span { width: 7px; height: 20px; border-radius: 4px; background: var(--jade); animation: signalPulse 1.05s ease-in-out infinite; }
.generation-signal span:nth-child(2) { height: 32px; background: var(--cobalt); animation-delay: .15s; }
.generation-signal span:nth-child(3) { height: 24px; background: var(--amber); animation-delay: .3s; }
.generation-kicker { margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.generation-progress h1 { margin: 0; color: var(--ink); font-size: 28px; line-height: 1.3; }
.typing-dots { display: inline-block; min-width: 24px; color: var(--jade); animation: dotsFade 1s steps(3, end) infinite; }
.generation-summary { max-width: 560px; margin: 0; color: var(--subtle); font-size: 15px; line-height: 1.8; }
.stage-list { display: grid; gap: 10px; max-width: 620px; }
.stage-row { display: grid; grid-template-columns: 18px 1fr; gap: 12px; align-items: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-raised); opacity: .72; }
.stage-row.active { border-color: var(--jade); background: var(--jade-soft); opacity: 1; }
.stage-row.done { opacity: .88; }
.stage-dot { width: 10px; height: 10px; margin-top: 7px; border-radius: 50%; background: var(--line-strong); }
.stage-row.active .stage-dot { background: var(--jade); box-shadow: 0 0 0 4px var(--jade-line); }
.stage-row.done .stage-dot { background: var(--cobalt); }
.stage-row strong { display: block; margin-bottom: 2px; font-size: 14px; }
.stage-row small { display: block; color: var(--subtle); font-size: 12px; line-height: 1.6; }
.statusbar { display: flex; align-items: center; justify-content: space-between; height: 38px; padding: 0 22px; border-top: 1px solid var(--line); color: var(--muted); background: var(--surface-raised); font-size: 12px; }
.save-state { color: var(--subtle); white-space: nowrap; }

.preview { grid-area: preview; display: flex; flex-direction: column; }
.resize-handle { grid-area: handle; width: 1px; background: var(--line); cursor: col-resize; flex-shrink: 0; transition: background 0.15s; align-self: stretch; }
.resize-handle:hover, .resize-handle.dragging { background: var(--jade); }
.module-head { display: flex; align-items: center; justify-content: space-between; min-height: 54px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.module-actions { display: flex; align-items: center; gap: 7px; }
.device-switch { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-raised); }
.device-switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 6px;
  color: var(--subtle);
  background: transparent;
}
.device-switch button:hover { color: var(--ink); background: var(--surface); }
.device-switch button.active { color: var(--jade); background: var(--jade-soft); box-shadow: inset 0 0 0 1px var(--jade-line); }
.device-switch .device-icon { width: 15px; height: 15px; flex: 0 0 15px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.template-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); }
.template-tab { height: 34px; border: 1px solid transparent; border-radius: var(--radius); color: var(--subtle); background: transparent; font-size: 12px; font-weight: 700; }
.template-tab.active { color: var(--jade); border-color: var(--jade-line); background: var(--jade-soft); }
.template-tab[data-template="professional"].active { color: var(--cobalt); border-color: var(--cobalt-line); background: var(--cobalt-soft); }
.template-tab[data-template="magazine"].active { color: var(--amber); border-color: var(--amber-line); background: var(--amber-soft); }
.preview-canvas { flex: 1; min-height: 0; overflow: auto; padding: 22px 24px 36px; background: linear-gradient(180deg, #fbfcfd 0%, #f2f5f7 100%); }
.phone { max-width: 360px; margin: 0 auto; padding: 10px; border: 1px solid var(--line); border-radius: 28px; background: #f9fafb; box-shadow: 0 8px 20px rgba(17,24,39,.07); }
.phone-bar { width: 72px; height: 4px; margin: 4px auto 10px; border-radius: 999px; background: #d7dde3; }
.preview-canvas.desktop .phone { max-width: 100%; padding: 0; border-radius: 12px; background: var(--surface); }
.preview-canvas.desktop .phone-bar { display: none; }
.wechat { overflow: hidden; border: 1px solid var(--line-soft); border-radius: 20px; background: var(--surface); }
.wechat > section { padding: 24px 20px 38px; }
.preview-canvas.desktop .wechat { border-radius: 12px; }
.preview-canvas.desktop .wechat > section { padding: 30px 34px 44px; }
.zf-image-placeholder { margin: 16px 0; }
.zf-image-placeholder__frame { display: grid; gap: 6px; min-height: 132px; padding: 18px 16px; border: 1px dashed var(--line-strong); border-radius: 10px; color: var(--subtle); text-align: center; background: linear-gradient(180deg, #fbfcfd 0%, #f4f7f9 100%); }
.zf-image-placeholder__badge { justify-self: center; display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border: 1px solid var(--cobalt-line); border-radius: 999px; color: var(--cobalt); background: var(--cobalt-soft); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.zf-image-placeholder__title { display: block; color: var(--ink); font-size: 14px; line-height: 1.5; }
.zf-image-placeholder__meta { display: block; color: var(--muted); font-size: 12px; line-height: 1.6; }

.restore-left { position: fixed; left: 14px; top: 126px; z-index: 20; }
.restore-rail { position: fixed; right: 14px; top: 126px; z-index: 20; display: flex; flex-direction: column; gap: 10px; }
.restore-left button, .restore-rail button { display: none; align-items: center; justify-content: center; gap: 7px; width: 96px; height: 42px; padding: 0 12px; border: 1px solid var(--jade-line); border-radius: 999px; color: var(--jade); background: rgba(255,255,255,.98); box-shadow: 0 8px 20px rgba(17,24,39,.07); font-size: 13px; font-weight: 700; }
.app.side-hidden ~ .restore-left #restoreSide, .app.preview-hidden ~ .restore-rail #restorePreview { display: inline-flex; }
.ai-bubble { position: fixed; z-index: 50; display: none; height: 34px; padding: 0 12px; border-radius: 999px; color: #fff; background: var(--jade); box-shadow: var(--shadow); font-weight: 700; transform: translateX(-50%); }
.ai-bubble.show { display: inline-flex; align-items: center; }

.modal { width: min(720px, calc(100vw - 48px)); max-height: calc(100vh - 64px); padding: 0; border: 0; border-radius: 12px; box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(17,24,39,.38); }
.modal header, .modal footer { display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.modal footer { justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); border-bottom: 0; background: var(--surface-raised); }
.modal h2 { margin: 0; font-size: 16px; }
.modal-body { max-height: calc(100vh - 190px); overflow: auto; padding: 18px; }
.progress-modal { width: min(560px, calc(100vw - 48px)); }
.progress-modal .modal-body { max-height: calc(100vh - 150px); }
.progress-modal .generation-progress { min-height: 0; gap: 14px; }
.progress-modal .generation-signal { height: 34px; }
.progress-modal .generation-progress h1 { font-size: 22px; }
.progress-modal .generation-summary { max-width: none; font-size: 14px; }
.progress-modal .stage-list { max-width: none; }
.ai-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ai-grid .full { grid-column: 1 / -1; }
.ai-prompt-row { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; }
.ai-prompt-row label { font-size: 12px; color: var(--subtle); font-weight: 650; }
.ai-prompt-row textarea { width: 100%; box-sizing: border-box; padding: 10px 12px; font-size: 13px; line-height: 1.6; resize: vertical; min-height: 72px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--canvas); color: var(--ink); outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.ai-prompt-row textarea:focus { border-color: var(--jade-line); box-shadow: 0 0 0 3px rgba(10,159,106,.1); }
.text-box { min-height: 118px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-raised); font-size: 13px; line-height: 1.75; }
.export-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.export-option { min-height: 112px; padding: 13px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-align: left; background: var(--surface); font-weight: 700; }
.export-option.active { border-color: var(--jade-line); background: var(--jade-soft); }
.export-option span { display: block; margin-top: 6px; color: var(--subtle); font-size: 12px; line-height: 1.55; font-weight: 400; }
.notice-box { padding: 12px 13px; border: 1px solid var(--amber-line); border-radius: var(--radius); color: #5b4217; background: var(--amber-soft); font-size: 13px; }
#exportContent { min-height: 180px; margin-top: 12px; }
.settings-grid { display: grid; gap: 12px; }
.settings-grid label { display: grid; gap: 6px; color: var(--subtle); font-weight: 650; }
.settings-grid input, .settings-grid select { height: 38px; padding: 0 11px; }
.auth-modal { width: min(420px, calc(100vw - 48px)); }
.auth-body { display: grid; gap: 12px; }
.auth-body label { display: grid; gap: 6px; color: var(--subtle); font-size: 13px; font-weight: 700; }
.auth-body input { height: 38px; padding: 0 11px; }
.auth-error { min-height: 18px; margin: 0; color: var(--coral); font-size: 12px; line-height: 1.5; }
.toast { position: fixed; left: 50%; bottom: 20px; z-index: 90; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--surface); box-shadow: var(--shadow); font-size: 13px; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.slide-panel { position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 90vw; z-index: 200; background: var(--surface); box-shadow: -8px 0 32px rgba(17,24,39,.15); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .3s ease; }
.slide-panel.open { transform: translateX(0); }
.slide-panel-overlay { position: fixed; inset: 0; z-index: 190; background: rgba(17,24,39,.3); opacity: 0; pointer-events: none; transition: opacity .3s; }
.slide-panel-overlay.open { opacity: 1; pointer-events: auto; }
.slide-panel-header { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.slide-panel-back { width: 32px; height: 32px; border-radius: 6px; color: var(--subtle); background: transparent; font-size: 16px; }
.slide-panel-back:hover { background: var(--line-soft); }
.slide-panel-header h2 { flex: 1; margin: 0; font-size: 15px; color: var(--ink); }
.slide-panel-close { width: 32px; height: 32px; border-radius: 6px; color: var(--subtle); background: transparent; font-size: 18px; }
.slide-panel-close:hover { background: var(--line-soft); }
.slide-panel-tabs { display: flex; border-bottom: 1px solid var(--line); }
.slide-panel-tab { flex: 1; height: 44px; border: 0; background: transparent; color: var(--subtle); font-size: 13px; font-weight: 650; border-bottom: 2px solid transparent; }
.slide-panel-tab.active { color: var(--jade); border-color: var(--jade); }
.slide-panel-body { flex: 1; overflow: auto; padding: 16px; }
.slide-panel-content .info-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.slide-panel-content .info-row label { color: var(--muted); }
.slide-panel-content .info-row span { color: var(--ink); font-weight: 500; }
.quota-card { background: var(--surface-raised); border: 1px solid var(--line-soft); border-radius: 12px; padding: 20px 18px; margin-bottom: 20px; }
.quota-status { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.quota-label { font-size: 13px; color: var(--subtle); }
.quota-number { font-size: 28px; font-weight: 700; color: var(--jade); }
.quota-bar-wrap { height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.quota-bar { height: 100%; background: var(--jade); border-radius: 3px; transition: width .3s ease; }
.quota-sub { font-size: 12px; color: var(--subtle); }
.quota-packages h3, .quota-redeem h3, .quota-history h3 { margin: 0 0 10px; font-size: 13px; color: var(--ink); font-weight: 650; }
.package-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 20px; }
.package-item { padding: 14px 8px; border: 1px solid var(--line-soft); border-radius: 10px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.package-item:hover { border-color: var(--jade-line); background: var(--jade-soft); }
.package-item .package-name { font-size: 12px; color: var(--subtle); margin-bottom: 4px; }
.package-item .package-price { font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
.package-item .package-desc { font-size: 11px; color: var(--subtle); }
.redeem-row { display: flex; gap: 8px; margin-bottom: 8px; }
.redeem-row input { flex: 1; height: 36px; padding: 0 10px; font-size: 13px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--canvas); color: var(--ink); outline: none; }
.redeem-row input:focus { border-color: var(--jade-line); box-shadow: 0 0 0 3px rgba(10,159,106,.1); }
.redeem-notice { font-size: 12px; color: var(--subtle); }
.redeem-link { cursor: pointer; color: var(--jade); }
.recharge-body { text-align: center; }
.recharge-tip { font-size: 14px; color: var(--ink); margin: 0 0 16px; }
.recharge-qr { width: 180px; margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; }
.recharge-note { font-size: 12px; color: var(--subtle); }
.history-list { display: flex; flex-direction: column; gap: 0; }
.history-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.history-item:last-child { border-bottom: none; }
.history-item .history-title { flex: 1; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 8px; }
.history-item .history-date { color: var(--subtle); flex-shrink: 0; }
.history-empty { text-align: center; color: var(--subtle); font-size: 13px; padding: 20px 0; }
.history-tabs { display: flex; gap: 0; margin-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.quota-history { margin-top: 20px; }
.history-tab { flex: 1; padding: 8px 0; border: none; background: transparent; color: var(--subtle); font-size: 13px; font-weight: 650; border-bottom: 2px solid transparent; cursor: pointer; }
.history-tab.active { color: var(--jade); border-color: var(--jade); }
.pref-group { margin-bottom: 20px; }
.pref-group h3 { margin: 0 0 12px; font-size: 13px; color: var(--ink); font-weight: 650; }
.pref-row { display: grid; grid-template-columns: 90px 1fr; gap: 10px; align-items: start; margin-bottom: 10px; }
.pref-row.full { display: flex; flex-direction: column; gap: 6px; }
.pref-row label { padding-top: 8px; font-size: 12px; color: var(--subtle); }
.pref-row input { height: 36px; padding: 0 10px; font-size: 13px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--canvas); color: var(--ink); outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.pref-row input:focus { border-color: var(--jade-line); box-shadow: 0 0 0 3px rgba(10,159,106,.1); }
.combobox-row { align-items: start; }
.combobox-wrap { position: relative; display: flex; align-items: center; }
.combobox-wrap input { flex: 1; width: 100%; box-sizing: border-box; padding-right: 32px; border-radius: 8px 8px 0 0; }
.combobox-arrow { position: absolute; right: 0; top: 0; height: 36px; width: 32px; border: none; background: transparent; cursor: pointer; color: var(--subtle); font-size: 12px; display: flex; align-items: center; justify-content: center; border-radius: 0 8px 0 0; }
.combobox-arrow:hover { color: var(--ink); }
.combobox-dropdown { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line-soft); border-top: none; border-radius: 0 0 8px 8px; box-shadow: 0 4px 12px rgba(0,0,0,.08); z-index: 100; max-height: 200px; overflow: auto; }
.combobox-dropdown.open { display: block; }
.combobox-option { padding: 8px 12px; font-size: 13px; cursor: pointer; color: var(--ink); }
.combobox-option:hover { background: var(--hover); }
.combobox-option.selected { background: rgba(10,159,106,.08); color: var(--jade); }
.pref-row textarea { width: 100%; box-sizing: border-box; padding: 10px 11px; font-size: 13px; line-height: 1.6; resize: vertical; min-height: 80px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--canvas); color: var(--ink); outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.pref-row textarea:focus { border-color: var(--jade-line); box-shadow: 0 0 0 3px rgba(10,159,106,.1); }
.pref-actions { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.pref-actions .btn { width: 100%; }

@keyframes signalPulse {
  0%, 100% { transform: scaleY(.72); opacity: .68; }
  50% { transform: scaleY(1.08); opacity: 1; }
}

@keyframes dotsFade {
  0% { opacity: .25; }
  50% { opacity: 1; }
  100% { opacity: .25; }
}
