/* Aurora: shared light surfaces and gentle, compositor-driven ambient motion. */
:root {
  color-scheme: light;
  --bg: #f3f7fd; --bg-2: #f8faff; --card: rgba(255,255,255,.8);
  --card-2: #eef3fc; --border: #dce4f1; --text: #263451; --text-2: #62718a;
  --accent: #526bca; --accent-2: #3864b3; --danger: #c33f65; --ok: #21816a; --warn: #936110;
  --grad: linear-gradient(115deg, #536bca, #667dcc 42%, #b96594 78%, #b88348);
  --radius: 22px; --tabbar-h: 76px;
}
body { background: var(--bg); overflow-x: hidden; }
.ambient { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; background: linear-gradient(145deg,#fff5eb,#f8f1f8 35%,#eaf3ff 72%,#fff); }
.ambient::before, .ambient::after { content: ''; position: absolute; inset: -22%; will-change: transform; }
.ambient::before { background: radial-gradient(ellipse at 25% 30%,#ffe4a9 0,transparent 42%),radial-gradient(ellipse at 68% 65%,#f7bed8 0,transparent 43%); animation: warm-drift 19s ease-in-out infinite alternate; }
.ambient::after { background: radial-gradient(ellipse at 78% 24%,#badbff 0,transparent 43%),radial-gradient(ellipse at 30% 80%,#fff 0,transparent 38%); animation: cool-drift 24s ease-in-out infinite alternate; }
@keyframes warm-drift { to { transform: translate(8%,7%) rotate(12deg) scale(1.06); } }
@keyframes cool-drift { to { transform: translate(-8%,5%) rotate(-10deg) scale(1.12); } }
/* More visible movement on the workbench; the reading surfaces stay still. */
body[data-view="create"] .ambient::before { animation: workspace-warm 10s ease-in-out infinite alternate; }
body[data-view="create"] .ambient::after { animation: workspace-cool 13s ease-in-out infinite alternate; }
.ambient-flow { display: none; position: absolute; inset: -25%; pointer-events: none; background: radial-gradient(ellipse at 30% 45%,#ffdb9c99,transparent 38%),radial-gradient(ellipse at 65% 65%,#ffc2df99,transparent 40%),radial-gradient(ellipse at 65% 25%,#b5dcff99,transparent 36%); }
body[data-view="create"] .ambient-flow { display: block; animation: workspace-flow 9s ease-in-out infinite alternate; }
body[data-view="create"] .view-heading { animation-duration: 8s; }
@keyframes workspace-warm { from { transform: translate(-6%,-4%) rotate(-8deg); } to { transform: translate(16%,12%) rotate(18deg) scale(1.1); } }
@keyframes workspace-cool { from { transform: translate(7%,-5%) rotate(6deg); } to { transform: translate(-15%,14%) rotate(-15deg) scale(1.12); } }
@keyframes workspace-flow { from { opacity: .35; transform: translate(-9%,6%) rotate(-12deg); } to { opacity: .8; transform: translate(12%,-8%) rotate(14deg); } }
@keyframes color-flow { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes view-appear { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#app { max-width: 680px; isolation: isolate; padding-bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom,0px)); }
body[data-view="login"] #app { padding-bottom: 0; }
#topbar { padding: 14px 22px; padding-top: calc(14px + env(safe-area-inset-top,0px)); background: rgba(250,252,255,.78); border-bottom-color: #ffffffb3; backdrop-filter: blur(20px); }
.brand-logo { border-radius: 14px; box-shadow: 0 5px 16px #6178b92b; }
.brand-name { font-size: 15px; letter-spacing: .4px; }
.brand-sub { margin-top: 2px; font-size: 11px; }
.mode-chip { background: #ffffffb3; white-space: nowrap; padding: 6px 9px; }
.mode-chip.online { border-color: #b4dccf; }
.mode-chip.offline { border-color: #e8cf9c; }
#tabbar { max-width: 652px; width: calc(100% - 24px); bottom: 10px; border: 1px solid #ffffffdf; border-radius: 25px; background: rgba(250,252,255,.9); box-shadow: 0 8px 32px #46638c20; backdrop-filter: blur(20px); padding: 7px 6px calc(7px + env(safe-area-inset-bottom,0px)); }
.tab { border-radius: 18px; gap: 3px; transition: background .2s,color .2s; }
.tab.active { color: #435fba; background: linear-gradient(125deg,#e4edff,#f8e9f4); }
.tab-icon { display: flex; filter: none; }
.tab-icon svg { width: 22px; height: 22px; stroke-width: 1.7; }
.tab-label { font-size: 11px; font-weight: 600; }
.view { padding: 22px; gap: 16px; animation: view-appear .35s ease-out; }
.view > *, .param-grid > *, .seed-row input { min-width: 0; }
.section-card, .profile-card { background: var(--card); border: 1px solid #ffffffde; box-shadow: 0 5px 22px #526b9510; padding: 20px; }
.section-title { font-size: 13px; color: #4f607c; letter-spacing: .3px; }
.view-heading { position: relative; overflow: hidden; border: 1px solid #ffffffd9; border-radius: 25px; padding: 23px; background: linear-gradient(115deg,#ffedc8b8,#ffe4efba,#e1efffc9,#ffffffd9); background-size: 250% 250%; animation: color-flow 16s ease infinite; }
.eyebrow { font-size: 10px; font-weight: 800; letter-spacing: 2.2px; color: #6d7195; margin-bottom: 7px; }
.view-heading h1 { font-size: 26px; letter-spacing: -.8px; font-weight: 750; }
.view-heading p { font-size: 12px; color: #63718b; margin-top: 6px; }
.view-heading .spark { position: absolute; right: 22px; top: 15px; font-size: 52px; color: #fff; text-shadow: 0 3px 20px #929ee880; transform: rotate(10deg); }
.mode-tabs, .login-tabs { background: #ffffff8c; border-color: #ffffffde; padding: 5px; border-radius: 17px; }
.mode-tabs button, .login-tabs button { padding: 12px 0; }
.mode-tabs button.active, .login-tabs button.active { background: linear-gradient(120deg,#e5edff,#f9e9f1); color: #435fa5; box-shadow: 0 2px 7px #5974ad15; }
.login-wrap { min-height: 100svh; gap: 21px; padding: 48px 28px; max-width: 460px; margin: auto; }
.login-art { position: relative; width: 142px; height: 116px; display: grid; place-items: center; }
.login-art::before { content: ''; position: absolute; inset: 8px -12px; border: 1px solid #ffffffd9; border-radius: 50%; transform: rotate(-24deg); }
.login-art::after { content: '✦'; position: absolute; right: 7px; top: 3px; font-size: 25px; color: #fff; text-shadow: 0 2px 12px #aa85b3; }
.login-hero { width: 88px; height: 88px; border: 2px solid #ffffffd9; border-radius: 29px; transform: rotate(-8deg); background: linear-gradient(135deg,#fff1b8,#efb5cf,#a6cafa,#ecf6ff); background-size: 240% 240%; animation: color-flow 12s ease infinite; box-shadow: 0 15px 45px #8a94c02e,inset 0 2px 10px #fff9; color: #435c91; }
.login-heading { text-align: center; }
.login-title { font-size: 29px; letter-spacing: -1px; margin-bottom: 8px; }
.login-sub { line-height: 1.8; }
.login-panel { width: 100%; padding: 24px; background: #ffffffb3; border: 1px solid #ffffffe6; border-radius: 28px; box-shadow: 0 18px 50px #66799c16; }
.login-panel .form { margin-top: 23px; gap: 18px; }
.login-footer { font-size: 11px; color: #6c7891; letter-spacing: 1px; }
.form input, .form textarea, .form select, .section-card > select, .section-card > textarea, .param input:not([type=range]), .param select {
  width: 100%; min-width: 0; color: var(--text); background: #f7f9fdd9; border: 1px solid var(--border); border-radius: 13px; padding: 12px 14px; font: inherit; font-size: 14px; outline: none; transition: border-color .2s,box-shadow .2s;
}
input::placeholder, textarea::placeholder { color: #8590a5; opacity: 1; }
input:focus, textarea:focus, select:focus { border-color: #8aa3e4 !important; box-shadow: 0 0 0 3px #6f93e515; }
button, input, select, textarea { font-family: inherit; }
button { touch-action: manipulation; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #7397dc; outline-offset: 3px; }
.btn { background-size: 250% 250%; animation: color-flow 12s ease infinite; box-shadow: 0 7px 18px #556bb82b; border-radius: 15px; transition: transform .18s,box-shadow .18s; }
.btn:active { transform: translateY(1px); }
.btn-ghost-btn { color: #4a608c; background: #edf2fb; box-shadow: none; animation: none; border: 1px solid #dce5f5; }
.btn-danger { color: #fff; background: linear-gradient(120deg,#b94769,#cf617a); animation: none; }
.btn-ghost { color: #596b8a; background: #ffffff50; }
.section-title button.link { border: 0; background: transparent; font-family: inherit; padding: 6px 8px; border-radius: 8px; }
.prompt-card { padding: 0; gap: 0; border: 1px solid transparent; background: linear-gradient(#fffffff5,#fffffff5) padding-box,linear-gradient(120deg,#f1cd88,#e6afd2,#97bff6,#d4e8ff) border-box; box-shadow: 0 8px 28px #637cad15; transition: box-shadow .2s; }
.prompt-card:focus-within { box-shadow: 0 0 0 4px #95b4f017,0 10px 30px #6882b521; }
.prompt-card .section-title { padding: 15px 18px 0; }
.prompt-card .section-title label { display: flex; gap: 8px; align-items: center; color: #40557e; }
.prompt-card .section-title label::before { content: '✦'; color: #899bcd; font-size: 17px; }
.prompt-card #wb-prompt, .prompt-card #wb-neg { display: block; min-height: 162px; max-height: 360px; padding: 15px 18px; border: 0 !important; box-shadow: none; background: transparent; border-radius: 0; line-height: 1.85; font-size: 15px; resize: vertical; }
.prompt-card #wb-neg { min-height: 115px; }
.prompt-card.is-expanded #wb-prompt { min-height: 320px; max-height: 65vh; }
.prompt-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 10px 18px 13px; border-top: 1px solid #eef1f7; font-size: 11px; color: #6e7d97; }
.prompt-actions { display: flex; gap: 6px; align-items: center; }
.prompt-tools { padding: 0 14px 13px; display: flex; flex-wrap: wrap; gap: 7px; }
.prompt-tools button { border: 1px solid #dfe7f5; color: #566d9d; background: #f3f6fd; border-radius: 10px; padding: 7px 10px; font-size: 11px; cursor: pointer; }
.prompt-count { font-variant-numeric: tabular-nums; white-space: nowrap; }
.prompt-card .tag-chips:not(:empty) { padding: 0 16px 14px; }
.negative-card { background: linear-gradient(#fffffff0,#fffffff0) padding-box,linear-gradient(120deg,#f0c2d1,#e4dcfa,#c2d8f8) border-box; padding-bottom: 12px; }
.negative-card .section-title { padding-top: 10px; }
.negative-hint { margin: 3px 18px 0; font-size: 11px; color: #7e879b; }
.tag-chip { background: #eff4ff; border-color: #dbe5fa; color: #506998; }
.size-btn { background: #f6f8fd; padding: 12px 4px; line-height: 1.8; }
.size-btn.active { background: linear-gradient(125deg,#e8eeff,#f7eafa); border-color: #a2b5df; color: #435f9e; }
.cost-line { background: #ffffff80; border: 1px solid #ffffffb3; border-radius: 14px; padding: 13px 16px; }
.profile-card { background: linear-gradient(120deg,#fff2dbb8,#fbe8f0c9,#e7f1ffdb); }
.kv-row { gap: 16px; }
.kv-row .k { flex-shrink: 0; }
.kv-row .v { text-align: right; overflow-wrap: anywhere; }
.gallery-grid .empty { grid-column: 1/-1; background: #ffffff70; border: 1px solid #fff; border-radius: 22px; padding: 58px 16px; }
.chat-topbar { flex: 0 0 auto; margin: 10px 14px 0; padding: 12px 16px; border: 1px solid #fff; background: rgba(248,251,255,.96); border-radius: 16px; box-shadow: 0 5px 18px #526b9517; }
.chat-input-bar { max-width: 680px; background: #f7faffec; bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom,0px)); border-radius: 20px 20px 0 0; border: 1px solid #fff; }
.chat-input-bar input { min-width: 0; background: #fff; }
.msg-bubble { background: #ffffffdc; }
.msg.own .msg-bubble { background: linear-gradient(120deg,#e6eeff,#f9e5f0); border-color: #cddcf3; }
.msg.bot .msg-bubble { background: #e9f5ff; border-color: #c2dff3; }
.modal-sheet { background: linear-gradient(145deg,#fff5ec,#f5f5fe 50%,#eaf3ff); border: 1px solid #fff; }
.modal-backdrop { background: #273b586e; backdrop-filter: blur(7px); }
.toast { background: #fff; color: #334a71; box-shadow: 0 8px 30px #4b608c26; }
.upload-zone { background: linear-gradient(120deg,#f5f6ff,#edf6ff); border-color: #bed0ed; }
#wb-upload-card:empty { display: none; }
#admin-overview { display: flex; flex-direction: column; gap: 16px; }
.tool-btn { border: 1px solid #d7e2f4; background: #edf3fc; border-radius: 9px; padding: 7px 10px; color: #476193; cursor: pointer; font-size: 12px; }
.noise-controls { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--border); }
.parameter-badge { color: #687ba2; background: #edf3fc; border: 1px solid #dce6f6; border-radius: 8px; padding: 3px 8px; font-size: 10px; font-weight: 500; }
.range-labels { display: flex; justify-content: space-between; gap: 8px; color: var(--text-2); font-size: 11px; margin-top: -5px; }
.generation-hint { padding: 0 4px; line-height: 1.8; }
#wb-strength-card input[type="range"] { min-width: 0; min-height: 28px; cursor: pointer; }
#wb-strength-card output { background: #edf3fc; color: #48629a; padding: 4px 8px; border-radius: 8px; }
.prompt-card #wb-prompt { width: 100%; outline: none; white-space: pre-wrap; overflow-wrap: anywhere; overflow-y: auto; cursor: text; caret-color: #435fba; }
#wb-prompt[data-empty="true"]::before { content: attr(data-placeholder); color: #8590a5; pointer-events: none; position: absolute; max-width: calc(100% - 36px); }
#wb-prompt { position: relative; }
.prompt-token { display: inline-flex; align-items: baseline; max-width: 100%; border: 1px solid #bdcdec; border-radius: 9px; background: linear-gradient(115deg,#e8efff,#f8e8f5); padding: 1px 8px; margin: 2px 1px; color: #435e9d; font-size: 13px; line-height: 1.9; vertical-align: baseline; cursor: pointer; user-select: all; -webkit-user-select: all; white-space: normal; }
.prompt-token-name { overflow-wrap: anywhere; }
.prompt-token-name::before { content: '✦ '; font-size: 11px; color: #8297c9; }
.prompt-token:not(.is-open)::after { content: '⌄'; margin-left: 5px; color: #8193b8; }
.prompt-token.is-open { display: inline; padding: 3px 7px; box-decoration-break: clone; -webkit-box-decoration-break: clone; background: #eef3ff; }
.prompt-token.is-open .prompt-token-name { font-size: 10px; color: #7285ac; margin-right: 7px; }
.prompt-token-content { white-space: pre-wrap; }
.prompt-token:focus-visible { outline: 2px solid #7397dc; outline-offset: 2px; }
.prompt-token.is-invalid, .prompt-count.invalid { color: #ac3757; border-color: #d991a6; }
.prompt-preview-link { border: 0; background: transparent; color: #526daf; font-size: 11px; cursor: pointer; }
.preset-sheet { display: flex; flex-direction: column; gap: 14px; padding: 24px; }
.preset-sheet h2 { font-size: 20px; color: #344d7b; overflow-wrap: anywhere; }
.preset-sheet .eyebrow { margin: 0; }
.preset-preview { padding: 15px; border: 1px solid #d8e2f1; border-radius: 14px; background: #ffffffc9; font: inherit; font-size: 13px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 28vh; overflow-y: auto; }
.preset-display-actions { display: flex; gap: 8px; }
.preset-display-actions .btn { font-size: 12px; padding: 11px 8px; }
.preset-display-actions [aria-pressed="true"] { border-color: #90a8d8; background: #e1eafd; color: #3d5da2; }
.preset-weight-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.preset-weight-row input { width: 88px; min-width: 0; padding: 9px; border: 1px solid #cfdbed; border-radius: 10px; font: inherit; color: var(--text); background: #fff; }
.preset-weight-row .btn { margin-left: auto; width: auto; padding: 9px 18px; font-size: 13px; }
.replay-notice { padding: 12px 16px; background: #eaf4ffdf; border: 1px solid #c4d8f0; border-radius: 14px; }
/* Messages own their full row; percent widths must not compound through flex ancestors. */
.msg-body { width: 100%; }
.msg-content { flex: 1 1 0; width: 0; max-width: none; align-items: flex-start; }
.msg-bubble { width: fit-content; max-width: 100%; white-space: pre-wrap; word-break: normal; overflow-wrap: anywhere; }
.msg-img, .msg.bot .msg-img { max-width: 100%; max-height: 440px; width: auto; object-fit: contain; }
body[data-view="chat"] { overflow: hidden; }
body[data-view="chat"] #app { height: var(--chat-height,100dvh); min-height: 0; margin-top: 0; display: flex; flex-direction: column; padding-bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom,0px)); }
body[data-view="chat"] #topbar { flex: 0 0 auto; }
body[data-view="chat"] #main { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
body[data-view="chat"] .chat-view { flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 20px; animation: none; }
body[data-view="chat"] .chat-view > * { flex-shrink: 0; }
body[data-view="chat"] .chat-input-bar { position: relative; flex: 0 0 auto; bottom: auto; left: auto; transform: none; width: 100%; border-radius: 18px; }
body[data-view="chat"] #tabbar { position: absolute; }
body[data-view="chat"].chat-keyboard #tabbar { display: none; }
body[data-view="chat"].chat-keyboard #app { padding-bottom: env(safe-area-inset-bottom,0px); }
.guide-entry { margin-top: 15px; border: 1px solid #bacce8; border-radius: 10px; padding: 7px 12px; background: #ffffffb8; color: #465f95; font-size: 12px; cursor: pointer; }
.chat-guide-entry { flex: 0 0 auto; border: 1px solid #cfdbf0; border-radius: 12px; padding: 0 9px; background: #edf3ff; color: #526b9e; font-size: 12px; cursor: pointer; }
.user-guide-sheet { display: flex; flex-direction: column; overflow: hidden; padding: 22px; max-height: 88dvh; }
.user-guide-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-shrink: 0; padding-bottom: 16px; }
.user-guide-header h2 { font-size: 22px; }
.user-guide-header .btn-ghost { width: auto; padding: 8px 14px; }
#user-guide-content { overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.user-guide-section { padding: 14px 16px; background: #ffffffbd; border: 1px solid #dfe7f4; border-radius: 15px; margin-bottom: 10px; }
.user-guide-section summary { cursor: pointer; color: #405b8d; font-size: 14px; font-weight: 700; }
.user-guide-section ul { padding-left: 18px; margin-top: 12px; }
.user-guide-section li { font-size: 13px; line-height: 1.85; color: #596b87; margin-bottom: 10px; overflow-wrap: anywhere; white-space: pre-wrap; }
@media (hover:hover) { .btn:hover { box-shadow: 0 9px 24px #536db33b; } .prompt-tools button:hover,.tag-chip:hover { background: #e4edff; } }
@media (min-width: 900px) { #app { margin-top: 20px; } #topbar { border-radius: 22px; } .login-wrap { min-height: calc(100svh - 20px); } }
@media (max-width: 380px) { .view { padding: 14px; } .section-card { padding: 15px; } .prompt-card { padding: 0; } .negative-card { padding-bottom: 10px; } .login-wrap { padding: 28px 18px; } .login-panel { padding: 20px; } #topbar { padding-left: 14px; padding-right: 14px; } .brand-name { font-size: 14px; } .mode-chip { font-size: 10px; } .result-actions { flex-wrap: wrap; } }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } .ambient::before,.ambient::after { will-change: auto; } }
/* Individual characters and large-image choices */
.character-section .section-title{gap:12px;align-items:center}
.character-section .section-title small{font-size:12px;font-weight:500;color:#7c8196;margin-left:6px}
.character-section .hint{line-height:1.7;margin:10px 0}
.character-empty{padding:22px;text-align:center;border:1px dashed #d4dcf0;border-radius:16px;color:#7c8196;background:linear-gradient(110deg,#fff8eb88,#eff5ff99)}
.character-position-mode{display:flex;align-items:center;gap:16px;font-size:13px;margin-top:16px}
.character-position-mode select{flex:1;min-width:0}
.character-list{display:grid;gap:14px;margin-top:16px}
.character-card{min-width:0;padding:16px;border:1px solid #dce5f1;border-radius:18px;background:linear-gradient(135deg,#fffaf5dc,#f3f8ffdc);box-shadow:0 5px 18px #719ac408}
.character-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:14px}
.character-heading b{font-size:14px;display:flex;align-items:center;gap:8px}
.character-number{display:inline-grid;place-items:center;width:26px;height:26px;border-radius:9px;background:linear-gradient(120deg,#ffe4c0,#f9dbe9,#dceaff);color:#5a639a}
.character-heading button{min-width:32px;min-height:32px;border:1px solid #dbe3f3;border-radius:9px;background:#ffffffb0;color:#657193;padding:4px 8px;margin-left:4px}
.character-heading button:disabled{opacity:.35}
.character-card>label{font-size:12px;color:#747e96;display:block;margin-bottom:8px}
.character-card textarea{width:100%;min-height:76px;resize:vertical;box-sizing:border-box;line-height:1.7;font-size:14px;background:#ffffffba}
.character-card details{margin-top:10px;font-size:12px;color:#747e96}
.character-card summary{cursor:pointer;padding:4px 0 9px}
.character-placement{display:grid;grid-template-columns:128px minmax(0,1fr);gap:18px;margin-top:16px;align-items:center}
.character-map{position:relative;width:100%;aspect-ratio:1;border:1px solid #cedaf0;border-radius:12px;background:linear-gradient(150deg,#fff0db,#ffe4ec 45%,#dfeeff);overflow:hidden;touch-action:none;cursor:crosshair}
.character-map.grid-five{background-image:linear-gradient(#ffffff80 1px,transparent 1px),linear-gradient(90deg,#ffffff80 1px,transparent 1px),linear-gradient(150deg,#fff0db,#ffe4ec 45%,#dfeeff);background-size:20% 20%,20% 20%,100% 100%}
.map-label{position:absolute;left:8px;top:6px;font-size:10px;color:#9092a5;pointer-events:none}
.character-pin{position:absolute;display:grid;place-items:center;transform:translate(-50%,-50%);width:26px;height:26px;border-radius:50%;background:#7b88d7;color:white;font-weight:700;box-shadow:0 2px 10px #697ac844;pointer-events:none}
.character-axes label{display:block;font-size:11px;color:#737d98;margin:10px 0}
.character-axes input{width:100%;display:block;margin-top:10px;accent-color:#8491df}
.character-axes output{display:block;float:right;color:#5565a8}
.large-size-heading{font-size:13px;margin:18px 0 10px;font-weight:600}
.large-size-heading .hint{font-size:11px;font-weight:400;margin-left:8px}
.large-sizes{grid-template-columns:repeat(3,minmax(0,1fr))!important}
.large-sizes .size-btn{font-size:12px;padding:12px 4px}
@media(max-width:360px){.character-card{padding:12px}.character-placement{grid-template-columns:100px minmax(0,1fr);gap:12px}.character-heading button{margin-left:2px;padding:4px 6px}.character-heading b{font-size:12px}.character-position-mode{gap:8px}}
.character-card textarea{border:1px solid #dbe3f1;border-radius:12px;padding:12px 13px;color:#36476b;font-family:inherit;outline:none;transition:border-color .2s,box-shadow .2s}
.character-card textarea:focus{border-color:#a4b0e8;box-shadow:0 0 0 3px #b7c5f52a}
.character-position-mode select{min-height:42px;border:1px solid #dbe3f1;border-radius:12px;padding:8px 12px;background:#ffffffbf;color:#526181;font:inherit;outline:none}
.character-axes input[type=range]{height:6px;border-radius:6px}
.character-prompt-editor{min-height:96px;padding:12px;border:1px solid #dbe3f1;border-radius:12px;background:#ffffffba;color:#36476b;line-height:1.8;white-space:pre-wrap;overflow-wrap:anywhere;outline:none}
.character-card [data-char-preset]{width:100%;margin-top:10px;border:1px solid #dbe3f1;border-radius:10px;padding:9px;color:#526181;background:#fff;font:inherit}
.prompt-token{touch-action:none;user-select:none;-webkit-user-select:none}
.prompt-token.is-moving{opacity:.65;outline:2px solid #8799e4;cursor:grabbing}
/* Flowing creek background and reversible distraction-free view. */
.stream-canvas{position:absolute;inset:0;width:100%;height:100%;z-index:1;pointer-events:none}
.background-hide{display:block;margin-top:14px;padding:8px 12px;border:1px solid #ffffffc9;border-radius:12px;background:#ffffff80;color:#627397;font-size:12px;cursor:pointer}
body.background-only{overflow:hidden}
body.background-only #app{visibility:hidden;pointer-events:none}
.background-restore{position:fixed;z-index:200;right:20px;bottom:calc(22px + env(safe-area-inset-bottom,0px));border:1px solid #ffffffd9;border-radius:22px;padding:12px 20px;background:#ffffff80;backdrop-filter:blur(12px);color:#526584;box-shadow:0 5px 24px #647b9b15;font-size:13px;cursor:pointer}
.background-restore[hidden]{display:none}
body.background-only .ambient{transform:scale(1.025)}
.preset-picker-tools{position:sticky;top:0;z-index:2;background:#f9fbff;padding:10px 0 14px}
.preset-picker-tabs,.character-preset-types{display:flex;gap:8px;margin:10px 0}
.character-preset-types button,.preset-picker-tabs button{flex:1;padding:10px 6px;border:1px solid #dce5f4;border-radius:12px;background:linear-gradient(125deg,#fff5e9,#f8edf5,#edf5ff);color:#596d99;font-size:12px;cursor:pointer}
.character-preset-types small{margin-left:6px;opacity:.6;font-size:10px}
.preset-picker-tabs button.active{background:#e5ecff;border-color:#a8b9e7;color:#425c9d}
#preset-picker-search{width:100%;border:1px solid #d8e2f3;border-radius:14px;background:#fff;padding:13px;font:inherit;color:#425477}
#preset-picker-list{display:grid;gap:10px;max-height:48dvh;overflow-y:auto;overscroll-behavior:contain;padding:2px 3px}
.preset-picker-item{position:relative;display:block;text-align:left;width:100%;border:1px solid #e0e7f5;border-radius:16px;padding:14px 68px 14px 14px;background:linear-gradient(120deg,#fffaf5,#f2f7ff);color:#506487;cursor:pointer}
.preset-picker-item b{display:block;font-size:14px;overflow-wrap:anywhere}.preset-picker-item span{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;font-size:11px;line-height:1.65;margin-top:6px;color:#8590a7;overflow-wrap:anywhere}.preset-picker-item em{position:absolute;right:12px;top:16px;font-size:11px;font-style:normal;color:#7a8ec3}.picker-empty{padding:30px 10px;text-align:center;color:#8190aa}
#legacy-main-presets{display:none!important}
.main-preset-types{margin:2px 16px 14px}.main-preset-types button{padding:12px 6px;font-size:13px}

/* ===== 桌面端：左栏顶到最上占满整列，标题/模式压到右侧画布上方（≥1100px） ===== */
@media (min-width: 1100px) {
  #app { max-width: 1440px; margin-top: 0; }
  .view { padding: 10px 24px 16px; }
  body[data-view="create"] { overflow: hidden; }
  .create-view {
    display: grid;
    grid-template-columns: 410px minmax(0, 1fr);
    grid-template-rows: auto auto auto minmax(0, 1fr);
    gap: 10px 20px;
    height: calc(100dvh - var(--tabbar-h) - env(safe-area-inset-bottom, 0px) - 78px);
    align-items: stretch;
    overflow: hidden;
  }
  /* 左栏：从标题行开始一直到底，内部独立滚动 */
  .wb-controls { grid-column: 1; grid-row: 1 / span 4; display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: 6px; }
  /* 右侧上方：压缩标题 + 模式切换 + 复用提示 */
  .create-view .view-heading { grid-column: 2; grid-row: 1; display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 16px; animation: none; }
  .create-view .view-heading h1 { font-size: 17px; margin: 0; letter-spacing: 0; }
  .create-view .view-heading p, .create-view .view-heading .spark, .create-view .view-heading .eyebrow:not(.compact-title) { display: none; }
  .create-view .view-heading .guide-entry { margin-left: auto; }
  .create-view .view-heading .background-hide { width: auto; height: auto; padding: 6px 10px; font-size: 12px; line-height: 1.4; }
  .create-view .mode-tabs { grid-column: 2; grid-row: 2; padding: 3px; }
  .create-view .mode-tabs button { padding: 6px 0; font-size: 12.5px; border-radius: 10px; }
  .create-view .replay-notice { grid-column: 2; grid-row: 3; margin: 0; }
  /* 右侧画布：占满剩余空间，图片始终居中 */
  .wb-visual { grid-column: 2; grid-row: 4; display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .wb-visual > :first-child { margin-top: auto; }
  .wb-visual > :last-child { margin-bottom: auto; }
  .wb-visual > #wb-result { width: 100%; }
  .wb-visual-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 300px; width: 100%; border: 1px dashed var(--border); border-radius: 22px; color: var(--text-2); font-size: 14px; background: rgba(255, 255, 255, 0.35); }
  .wb-visual-placeholder span { font-size: 12px; opacity: 0.75; }
  .wb-visual .result-img { width: auto; max-width: 100%; max-height: calc(100dvh - 330px); margin: 0 auto; }
  #wb-generate { position: sticky; bottom: 6px; }
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
  .chat-view { max-width: 980px; margin: 0 auto; width: 100%; }
  .chat-input-bar, #tabbar { max-width: 1440px; }
  .modal-sheet { max-width: 720px; }
  .login-wrap { max-width: 480px; margin: 48px auto; }
}

/* 窄屏保持原有单栏：包裹层不生成盒子，DOM 顺序与旧版一致 */
@media (max-width: 1099.98px) {
  .wb-visual, .wb-controls { display: contents; }
  .wb-visual-placeholder { display: none; }
}
