:root {
  color-scheme: dark;
  --bg:#08111F; --stage:#050B15; --surface-1:#0E1B2E; --surface-2:#13243A; --surface-3:#1A2E48;
  --line:#22364F; --line-strong:#3A4D63; --text:#E8ECF2; --text-2:#8FA1B7; --cream:#F3E8D2;
  --accent:#FF5E5B; --on-accent:#0E1B2E; --accent-soft:rgba(255,94,91,.14); --danger:#FF8A80;
  --grid-line:rgba(143,161,183,.06); --scrim:rgba(5,11,21,.8); --readout:rgba(14,27,46,.85);
  --radius:8px; --shadow-pop:0 8px 24px rgba(0,0,0,.40);
  --font-ui:'Outfit','Noto Sans TC',system-ui,sans-serif; --font-mono:'JetBrains Mono','Noto Sans TC',ui-monospace,monospace; --font-brand:'Syne','Noto Sans TC',sans-serif;
  --dur:140ms; --ease:cubic-bezier(.25,.46,.45,.94);
}
* { box-sizing:border-box; }
html { overflow-x:clip; }
body { margin:0; background:var(--bg); color:var(--text); font:14px/1.6 var(--font-ui); letter-spacing:0; }
body:has(.app) { overflow:hidden; }
button,input,select,textarea { font:inherit; color:inherit; }
button,a,input[type=range],input[type=color],select,summary { cursor:pointer; }
button { min-height:44px; min-width:44px; display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:8px 12px; border:1px solid transparent; border-radius:var(--radius); background:transparent; transition:background var(--dur) var(--ease),transform var(--dur) var(--ease); white-space:nowrap; }
button:hover { background:var(--surface-2); }
button:active { background:var(--surface-3); transform:scale(.97); }
button:disabled,input:disabled,select:disabled,.is-disabled { opacity:.4; cursor:not-allowed; }
:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
button.primary { background:var(--accent); color:var(--on-accent); font-weight:600; }
button.primary:hover { background:var(--cream); }
button.icon-only { padding:8px; flex-shrink:0; }
button.selected,button[aria-pressed=true] { background:var(--surface-3); border-color:var(--accent); }
a { color:var(--cream); text-underline-offset:4px; }
input:not([type=range]):not([type=color]),select,textarea { background:var(--surface-2); border:1px solid var(--line-strong); border-radius:var(--radius); padding:8px; min-height:44px; min-width:0; width:100%; }
textarea { resize:vertical; font-size:16px; line-height:1.6; }
h1,h2,h3,p { margin:0; }
h2 { font-size:18px; font-weight:600; } h3 { font-size:13px; font-weight:600; }
[hidden] { display:none !important; }
small,.muted,.hint { color:var(--text-2); font-size:12px; }
.hint { margin:8px 0; } .error-text { color:var(--danger); overflow-wrap:anywhere; }
.app { height:100dvh; padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); display:grid; grid-template-columns:200px minmax(0,1fr) 340px; grid-template-rows:56px 48px minmax(0,1fr); }
.topbar { grid-column:1/-1; grid-row:1; display:flex; align-items:center; gap:8px; padding:0 16px; border-bottom:1px solid var(--line); background:var(--surface-1); min-width:0; }
.brand { padding:4px 0; gap:8px; color:var(--cream); font-family:'Noto Sans TC',sans-serif; font-size:17px; font-weight:700; }
.brand small { font:700 11px var(--font-brand); letter-spacing:.12em; color:var(--text-2); }
.topbar-space { flex:1; } .history-actions { display:flex; }
.photos { grid-column:1; grid-row:2/4; min-height:0; display:flex; flex-direction:column; border-right:1px solid var(--line); background:var(--surface-1); }
.photos-heading,.photos-footer { display:flex; align-items:center; justify-content:space-between; padding:8px; font-size:12px; color:var(--text-2); }
.photos-heading button,.photos-footer button { padding:4px; font-size:12px; }
.photo-list { flex:1; overflow:auto; padding:8px; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; align-content:start; }
.photo-tile { position:relative; min-width:0; aspect-ratio:1; border-radius:6px; background:var(--surface-2); }
.photo-select { width:100%; height:100%; padding:0; border-radius:6px; overflow:hidden; border:2px solid transparent; }
.photo-select[aria-pressed=true] { border-color:var(--accent); }
.photo-select canvas { width:100%; height:100%; object-fit:cover; }
.photo-delete { position:absolute; top:0; right:0; background:transparent; opacity:0; border-radius:50%; }
.photo-delete::before { content:''; position:absolute; inset:10px; background:var(--scrim); border-radius:50%; }
.photo-delete svg { position:relative; width:16px; height:16px; }
.photo-delete:hover { background:transparent; }
.photo-tile:hover .photo-delete,.photo-tile:focus-within .photo-delete { opacity:1; }
.photo-badge { position:absolute; bottom:4px; left:4px; background:var(--readout); padding:0 4px; font-size:12px; pointer-events:none; }
.photo-add { width:100%; height:100%; min-height:60px; border:1px dashed var(--line-strong); }
.stage { grid-column:2; grid-row:2/4; position:relative; background:var(--stage); min-width:0; min-height:0; overflow:hidden; isolation:isolate; }
.stage-grid { position:absolute; inset:0; width:100%; height:100%; color:var(--grid-line); pointer-events:none; }
#preview,#overlay { position:absolute; inset:0; width:100%; height:100%; } #preview { pointer-events:none; } #overlay { touch-action:none; }
.empty-state { position:absolute; inset:32px; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; border:1px dashed var(--line-strong); border-radius:var(--radius); gap:16px; padding:24px; }
.empty-state>img { opacity:.6; } .empty-state h1 { font-size:28px; color:var(--cream); font-weight:600; } .empty-state>p { color:var(--text-2); }
.empty-actions { display:flex; flex-wrap:wrap; gap:8px; justify-content:center; } .support { max-width:360px; font-size:12px; } .privacy { font-size:12px; display:flex; align-items:center; justify-content:center; gap:8px; }
.stage-readout { position:absolute; left:12px; bottom:64px; max-width:calc(100% - 24px); padding:4px 8px; border-radius:var(--radius); background:var(--readout); color:var(--text-2); font:12px/1.6 var(--font-mono); pointer-events:none; }
.stage-tools { position:absolute; right:12px; bottom:12px; display:flex; align-items:center; background:var(--readout); border:1px solid var(--line); border-radius:var(--radius); }
.zoom-label { font:12px var(--font-mono); min-width:44px; text-align:center; }
.stage-prev,.stage-next { position:absolute; top:calc(50% - 22px); background:var(--readout); } .stage-prev { left:8px; } .stage-next { right:8px; }
.tabs { grid-column:3; grid-row:2; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); background:var(--surface-1); border-left:1px solid var(--line); border-bottom:1px solid var(--line); }
.tabs button { padding:8px 4px; font-size:13px; border-radius:0; gap:4px; color:var(--text-2); } .tabs button svg { width:16px; }
.tabs button[aria-selected=true] { color:var(--cream); background:var(--surface-3); border-bottom:2px solid var(--accent); }
.panel { grid-column:3; grid-row:3; min-height:0; min-width:0; overflow:hidden; border-left:1px solid var(--line); background:var(--surface-1); }
.panel-content { height:100%; overflow:auto; overscroll-behavior:contain; padding:16px 12px 24px; scrollbar-width:thin; }
.panel-title { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.control-group { margin-top:16px; color:var(--text-2); font-size:12px; font-weight:500; }
.number-field { display:grid; grid-template-columns:48px minmax(16px,1fr) 44px 44px 16px 44px; align-items:center; gap:4px; min-height:44px; }
.number-label { font-size:12px; line-height:1.4; user-select:none; cursor:pointer; min-height:44px; display:flex; align-items:center; }
.number-slider { width:100%; height:44px; appearance:none; background:transparent; margin:0; touch-action:none; }
.number-slider::-webkit-slider-runnable-track { height:4px; background:transparent; border-radius:2px; }
.number-slider::-webkit-slider-thumb { appearance:none; width:18px; height:18px; border:2px solid var(--accent); border-radius:50%; background:var(--cream); margin-top:-7px; }
.number-slider::-moz-range-track { height:4px; background:var(--line-strong); } .number-slider::-moz-range-progress { background:var(--accent); height:4px; }
.number-slider::-moz-range-thumb { width:14px; height:14px; background:var(--cream); border:2px solid var(--accent); border-radius:50%; }
.dragging .number-slider::-webkit-slider-thumb { width:22px; height:22px; margin-top:-9px; }
.number-read,.number-editor,.number-unit { font:13px var(--font-mono); font-variant-numeric:tabular-nums; }
.number-read { padding:4px 0; min-width:44px; } .number-unit { color:var(--text-2); font-size:12px; } .number-field .number-editor { padding:4px; }
.number-field .stepper { padding:8px; } .range-wrap { position:relative; height:44px; min-width:0; }
.range-track { position:absolute; top:20px; left:0; right:0; height:4px; border-radius:2px; background:var(--line-strong); pointer-events:none; }
.range-fill { display:block; width:var(--fill); height:4px; background:var(--accent); border-radius:2px; } .number-slider { position:relative; z-index:1; }
.segmented { display:flex; flex-wrap:wrap; gap:4px; margin:8px 0; } .segmented button { flex:1; padding:8px; font-size:12px; border:1px solid var(--line-strong); }
.toggle { width:100%; padding:4px 0; display:flex; justify-content:space-between; text-align:left; white-space:normal; }
.toggle-track { flex-shrink:0; width:36px; height:20px; border-radius:10px; background:var(--line-strong); position:relative; }
.toggle-track::after { content:''; position:absolute; top:3px; left:3px; width:14px; height:14px; border-radius:50%; background:var(--cream); }
.toggle[aria-checked=true] .toggle-track { background:var(--accent); } .toggle[aria-checked=true] .toggle-track::after { transform:translateX(16px); background:var(--on-accent); }
.color-picker { margin:8px 0; } .color-picker>label { font-size:12px; color:var(--text-2); } .swatches { display:flex; flex-wrap:wrap; gap:0; }
.swatch::before { content:''; width:20px; height:20px; border-radius:50%; background:var(--swatch); border:1px solid var(--line-strong); }
.custom-color { position:relative; width:44px; height:44px; display:grid; place-content:center; border-radius:var(--radius); cursor:pointer; } .color-native { opacity:0; position:absolute; width:100%; height:100%; cursor:pointer; }
.custom-color:focus-within { outline:2px solid var(--accent); outline-offset:2px; }
.hex { font-family:var(--font-mono) !important; }
.anchor-grid { display:grid; grid-template-columns:repeat(3,minmax(0,44px)); width:132px; margin:8px auto; } .anchor { padding:8px; }
.placement-layout { display:grid; grid-template-columns:132px minmax(0,1fr); align-items:center; gap:8px; margin:8px 0; }
.placement-margins .number-field { grid-template-columns:48px minmax(44px,1fr) 16px 44px; gap:0; }
.placement-margins .number-label { grid-column:1; }
.placement-margins .range-wrap { grid-column:2/-1; }
.mobile-photo-actions { display:none; }
.anchor span { display:block; width:12px; height:12px; border:2px solid var(--line-strong); border-radius:50%; } .anchor[aria-pressed=true] span { background:var(--accent); border-color:var(--accent); }
.select-field { display:flex; flex-direction:column; gap:4px; margin:12px 0; font-size:12px; color:var(--text-2); } .select-field select,.select-field input { color:var(--text); font-size:14px; }
.layer-actions,.inline-actions { display:flex; flex-wrap:wrap; gap:4px; } .layer-actions>button { flex:1; border:1px solid var(--line-strong); padding:8px; }
.layer-list { margin:12px 0 16px; } .layer-row { display:flex; align-items:center; min-height:48px; border-left:2px solid transparent; }
.layer-row.selected { border-color:var(--accent); background:var(--surface-3); } .layer-name { flex:1; min-width:0; justify-content:flex-start; padding:4px; } .layer-name span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.layer-row>.type-icon { display:flex; color:var(--text-2); } .layer-row>.type-icon svg { width:16px; } .layer-list button.icon-only { padding:8px; }
.full-width { width:100%; } .logo-preview { display:block; max-width:100%; max-height:120px; margin:8px auto; object-fit:contain; }
.variable-buttons { display:flex; flex-wrap:wrap; } .variable-buttons button { font-size:12px; padding:4px 8px; }
.drop-overlay { position:fixed; inset:8px; border:3px dashed var(--accent); background:var(--scrim); display:grid; place-content:center; color:var(--cream); font-size:24px; z-index:100; pointer-events:none; }
.import-status { position:fixed; top:56px; left:0; right:0; z-index:40; height:24px; background:var(--surface-1); font-size:12px; pointer-events:none; text-align:center; } .import-status progress { width:100%; height:3px; display:block; }
progress { accent-color:var(--accent); width:100%; height:4px; }
.toasts { position:absolute; top:12px; left:50%; transform:translateX(-50%); width:min(460px,calc(100% - 24px)); display:flex; flex-direction:column; gap:8px; z-index:40; }
.toast { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px 12px; background:var(--surface-2); border:1px solid var(--line-strong); border-radius:var(--radius); box-shadow:var(--shadow-pop); overflow-wrap:anywhere; } .toast.error { border-color:var(--danger); }
.dialog { padding:0; width:min(520px,calc(100% - 32px)); max-height:calc(100dvh - 48px); border:1px solid var(--line-strong); border-radius:var(--radius); background:var(--surface-1); color:var(--text); box-shadow:var(--shadow-pop); }
.dialog[open] { display:flex; flex-direction:column; } .dialog::backdrop { background:var(--scrim); }
.dialog-header { display:flex; justify-content:space-between; align-items:center; padding:12px 16px; border-bottom:1px solid var(--line); flex-shrink:0; }
.dialog-body { overflow:auto; overscroll-behavior:contain; padding:16px; min-height:0; } .dialog-body p+p { margin-top:12px; }
.dialog-footer { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; padding:12px 16px; border-top:1px solid var(--line); flex-shrink:0; }
.preset-row { display:flex; gap:8px; align-items:center; margin:4px 0; } .preset-apply { flex:1; white-space:normal; text-align:left; justify-content:flex-start; padding:8px; } .preset-copy { display:flex; flex-direction:column; } .preset-copy small { font-weight:400; }
.preset-preview { width:44px; height:44px; flex-shrink:0; background:var(--stage); border:1px solid var(--line); border-radius:6px; display:grid; place-content:center; color:var(--cream); }
.completion { white-space:pre-line; margin:12px 0; overflow-wrap:anywhere; }
.about-links { display:flex; flex-wrap:wrap; gap:12px; margin:16px 0; } .license-list { display:flex; flex-direction:column; gap:8px; margin:12px 0; }
@media (hover:none) { .photo-delete { opacity:1; } }
@media (min-width:768px) and (max-width:1023px) {
  .app { grid-template-columns:minmax(0,1fr) 320px; grid-template-rows:52px 48px minmax(0,1fr) 76px; }
  .topbar { padding:0 12px; } .stage { grid-column:1; grid-row:2/4; } .photos { grid-column:1; grid-row:4; border-top:1px solid var(--line); border-right:0; }
  .tabs { grid-column:2; grid-row:2; } .panel { grid-column:2; grid-row:3/5; } .photo-list { display:flex; padding:8px; gap:8px; }
  .photo-tile { flex:0 0 60px; height:60px; } .photos-heading,.photos-footer { display:none; } .brand small { display:none; } .desktop-add { padding:8px; } .import-status { top:52px; }
  .empty-state { inset:16px; gap:8px; padding:12px; } .empty-state h1 { font-size:24px; } .empty-state>img { width:48px; height:48px; }
}
@media (max-width:767px) {
  .app { grid-template-columns:minmax(0,1fr); grid-template-rows:52px max(240px,46dvh) 72px minmax(0,1fr) 56px; }
  .topbar { padding:0 12px; gap:8px; } .brand small,.history-actions,.desktop-add,.export-count { display:none; }
  .stage { grid-column:1; grid-row:2; } .photos { grid-column:1; grid-row:3; border:0; border-top:1px solid var(--line); }
  .photo-list { display:flex; padding:4px 8px; gap:8px; } .photo-tile { flex:0 0 64px; height:64px; } .photos-heading,.photos-footer { display:none; }
  .panel { grid-column:1; grid-row:4; border:0; } .panel-content { padding:12px 16px 20px; } .tabs { grid-column:1; grid-row:5; border:0; border-top:1px solid var(--line); }
  .tabs button { flex-direction:column; gap:0; font-size:12px; } .tabs button svg { width:20px; height:20px; }
  .empty-state { inset:12px; padding:12px; gap:8px; } .empty-state>img { width:48px; height:48px; } .empty-state h1 { font-size:24px; } .empty-state>p:not(.support):not(.privacy) { display:none; }
  .stage-tools { right:8px; bottom:8px; } .stage-readout { left:8px; bottom:60px; max-width:calc(100% - 16px); font-size:11px; }
  .dialog { width:100%; max-width:100%; max-height:calc(100dvh - 32px); margin:auto 0 0; border-radius:var(--radius) var(--radius) 0 0; } .dialog-footer { padding-bottom:max(12px,env(safe-area-inset-bottom)); }
  input,textarea,select,.select-field input,.select-field select,.number-editor,.hex { font-size:16px !important; } .import-status { top:52px; }
}
@media (max-width:1023px) { .photo-list { overflow-y:hidden; scrollbar-width:none; } .photo-list::-webkit-scrollbar { display:none; } .mobile-photo-actions { display:flex; margin-top:16px; } }
@media (max-width:359px) { .placement-layout { grid-template-columns:132px minmax(0,1fr); gap:0; } }
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { transition:none !important; animation:none !important; scroll-behavior:auto !important; } }
