:root {
  color-scheme: dark;
  --bg: #0b0b0d; --panel: #141417; --panel2: #1a1a1e; --raise: #222227; --hover: #2a2a30;
  --fg: #f1f1f3; --muted: #a0a0aa; --dim: #6c6c76; --line: rgba(255, 255, 255, 0.07); --line2: rgba(255, 255, 255, 0.13);
  --accent: #8b7bff; --accent2: #ff6bb5; --good: #4ade80; --warn: #fbbf24; --bad: #f87171;
  --radius: 12px; --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); overflow: hidden;
  font: 13.5px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: rgba(139, 123, 255, 0.35); }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: #2c2c33; border-radius: 8px; } ::-webkit-scrollbar-track { background: transparent; }
.hidden { display: none !important; }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border-radius: 5px; background: var(--raise); border: 1px solid var(--line2); color: var(--muted); }

/* ---------- layout ---------- */
#app { height: 100%; display: grid; grid-template-rows: 52px 1fr auto; grid-template-columns: 52px 1fr 280px;
  grid-template-areas: "top top top" "tools stage side" "time time time"; }
.topbar { grid-area: top; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); min-width: 0; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; letter-spacing: -0.02em; cursor: pointer; padding: 6px 8px; border-radius: 10px; border: 0; background: none; }
.brand:hover { background: var(--raise); }
.logo { width: 24px; height: 24px; image-rendering: pixelated; }
.docname { background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 5px 8px; width: 180px; color: var(--fg); font-weight: 500; }
.docname:hover { border-color: var(--line2); } .docname:focus { outline: none; border-color: var(--accent); background: var(--panel2); }
.docmeta { color: var(--dim); font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line2);
  background: var(--panel2); color: var(--fg); font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--hover); } .btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--fg); color: #0b0b0d; border-color: var(--fg); } .btn.primary:hover { background: #fff; }
.btn.ghost { background: transparent; border-color: transparent; } .btn.ghost:hover { background: var(--raise); }
.btn svg, .icon-btn svg { width: 17px; height: 17px; flex: none; }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--muted); transition: background .12s, color .12s; }
.icon-btn:hover { background: var(--raise); color: var(--fg); } .icon-btn.on { background: var(--raise); color: var(--fg); border-color: var(--line2); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.claude-btn { position: relative; }
.claude-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.claude-btn.connected { border-color: rgba(217, 119, 87, 0.55); background: rgba(217, 119, 87, 0.12); }
.claude-btn.connected .dot { background: #e0855f; box-shadow: 0 0 10px #e0855f; animation: pulse 2s infinite; }
.claude-btn.busy .dot { background: var(--warn); box-shadow: 0 0 12px var(--warn); }
@keyframes pulse { 50% { opacity: .45; } }
.sep { width: 1px; height: 22px; background: var(--line2); margin: 0 4px; }

/* ---------- tools ---------- */
.tools { grid-area: tools; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 0; overflow-y: auto; }
.tool { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); position: relative; }
.tool svg { width: 19px; height: 19px; }
.tool:hover { background: var(--raise); color: var(--fg); }
.tool.on { background: linear-gradient(145deg, rgba(139, 123, 255, .28), rgba(255, 107, 181, .18)); color: #fff; border-color: rgba(139, 123, 255, .45); }
.tools .sep { width: 24px; height: 1px; margin: 6px 0; }
.swatches { position: relative; width: 40px; height: 40px; margin-top: 6px; }
.swatch { position: absolute; width: 26px; height: 26px; border-radius: 7px; border: 2px solid #0b0b0d; box-shadow: 0 0 0 1px var(--line2); cursor: pointer; }
.swatch.primary { left: 0; top: 0; z-index: 2; } .swatch.secondary { right: 0; bottom: 0; }
.checker { background-color: #2b2b31; background-image: linear-gradient(45deg, #3a3a42 25%, transparent 25%, transparent 75%, #3a3a42 75%), linear-gradient(45deg, #3a3a42 25%, transparent 25%, transparent 75%, #3a3a42 75%); background-size: 8px 8px; background-position: 0 0, 4px 4px; }
.swatch i { position: absolute; inset: 0; border-radius: 5px; }

/* ---------- stage ---------- */
.stage { grid-area: stage; position: relative; overflow: hidden; background: radial-gradient(900px 500px at 50% 40%, #131317, #0b0b0d); }
.stage canvas.view { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.optionsbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; padding: 4px;
  border-radius: 12px; background: rgba(20, 20, 23, .86); border: 1px solid var(--line2); backdrop-filter: blur(12px); z-index: 5; white-space: nowrap; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.optionsbar label { display: flex; align-items: center; gap: 6px; color: var(--muted); padding: 0 8px; font-size: 12px; }
.optionsbar .chip { height: 28px; padding: 0 10px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.optionsbar .chip:hover { background: var(--raise); color: var(--fg); } .optionsbar .chip.on { background: var(--raise); color: var(--fg); border-color: var(--line2); }
.optionsbar .chip svg { width: 15px; height: 15px; }
.optionsbar input[type=range] { width: 80px; accent-color: var(--accent); }
.optionsbar .val { font-family: var(--mono); font-size: 12px; color: var(--fg); min-width: 18px; }
.statusbar { position: absolute; bottom: 10px; left: 12px; right: 12px; display: flex; gap: 10px; align-items: center; pointer-events: none; z-index: 4; }
.statusbar > * { pointer-events: auto; }
.pill { font-family: var(--mono); font-size: 11.5px; color: var(--muted); background: rgba(20, 20, 23, .86); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; backdrop-filter: blur(10px); }
.zoomctl { display: flex; align-items: center; gap: 2px; background: rgba(20, 20, 23, .86); border: 1px solid var(--line); border-radius: 10px; padding: 2px; margin-left: auto; }
.zoomctl button { width: 26px; height: 26px; border-radius: 7px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; }
.zoomctl button:hover { background: var(--raise); color: var(--fg); }
.zoomctl span { font-family: var(--mono); font-size: 11.5px; min-width: 48px; text-align: center; color: var(--muted); }

/* ---------- side panels ---------- */
.side { grid-area: side; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; }
.panel { border-bottom: 1px solid var(--line); padding: 12px; }
.panel h3 { margin: 0 0 10px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); display: flex; align-items: center; gap: 6px; }
.panel h3 .grow { flex: 1; }
.panel h3 .icon-btn { width: 24px; height: 24px; border-radius: 7px; } .panel h3 .icon-btn svg { width: 15px; height: 15px; }
.preview-wrap { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); display: grid; place-items: center; height: 168px; }
.preview-wrap canvas { image-rendering: pixelated; max-width: 100%; max-height: 100%; }
.preview-tools { display: flex; gap: 4px; margin-top: 8px; align-items: center; }
.preview-tools .pill { margin-left: auto; }

.picker { display: grid; grid-template-columns: 1fr 22px; gap: 8px; }
.sv { position: relative; height: 128px; border-radius: 9px; cursor: crosshair; touch-action: none; }
.sv::before { content: ""; position: absolute; inset: 0; border-radius: 9px; background: linear-gradient(90deg, #fff, transparent); }
.sv::after { content: ""; position: absolute; inset: 0; border-radius: 9px; background: linear-gradient(0deg, #000, transparent); }
.sv .knob, .hue .knob, .alpha .knob { position: absolute; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.5); transform: translate(-50%, -50%); pointer-events: none; z-index: 2; }
.hue { position: relative; border-radius: 9px; cursor: ns-resize; touch-action: none; background: linear-gradient(180deg, red, #ff0, lime, cyan, blue, #f0f, red); }
.hue .knob { left: 50%; }
.alpha { position: relative; height: 14px; border-radius: 7px; margin-top: 8px; cursor: ew-resize; touch-action: none; overflow: visible; }
.alpha i { position: absolute; inset: 0; border-radius: 7px; }
.alpha .knob { top: 50%; }
.hexrow { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.hexrow input { flex: 1; min-width: 0; height: 30px; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel2); padding: 0 9px; font-family: var(--mono); font-size: 12px; }
.hexrow input:focus { outline: none; border-color: var(--accent); }
.recent { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; min-height: 18px; }
.recent b { width: 18px; height: 18px; border-radius: 5px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }

select.sel { height: 28px; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel2); padding: 0 8px; color: var(--fg); font-size: 12px; max-width: 150px; }
.palette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; }
.palette b { aspect-ratio: 1; border-radius: 5px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); position: relative; transition: transform .08s; }
.palette b:hover { transform: scale(1.12); z-index: 1; }
.palette b.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(0,0,0,.6); z-index: 1; }
.palette b.add { display: grid; place-items: center; color: var(--muted); background: var(--panel2); font-size: 15px; }

.layers { display: flex; flex-direction: column; gap: 3px; }
.layer { display: grid; grid-template-columns: 26px 34px 1fr auto; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 9px; border: 1px solid transparent; cursor: pointer; }
.layer:hover { background: var(--panel2); }
.layer.on { background: var(--raise); border-color: var(--line2); }
.layer canvas { width: 34px; height: 34px; border-radius: 6px; image-rendering: pixelated; border: 1px solid var(--line); }
.layer .lname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer .lname input { width: 100%; background: var(--panel2); border: 1px solid var(--accent); border-radius: 6px; padding: 2px 5px; }
.layer .op { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.layer .eye { width: 26px; height: 26px; }
.layer.hidden-layer .lname, .layer.hidden-layer canvas { opacity: .4; }
.row-actions { display: flex; gap: 2px; margin-top: 8px; }
.slider-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.slider-row input { flex: 1; accent-color: var(--accent); }

/* ---------- timeline ---------- */
.timeline { grid-area: time; background: var(--panel); border-top: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.tl-bar { display: flex; align-items: center; gap: 4px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.tl-bar .num { width: 52px; height: 28px; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel2); text-align: center; font-family: var(--mono); font-size: 12px; }
.tl-bar label { color: var(--dim); font-size: 12px; display: flex; align-items: center; gap: 6px; margin: 0 6px; }
.frames { display: flex; gap: 8px; padding: 10px 12px 12px; overflow-x: auto; min-height: 104px; align-items: flex-start; }
.frame { flex: none; width: 74px; display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; border-radius: 11px; padding: 5px; border: 1px solid transparent; position: relative; }
.frame:hover { background: var(--panel2); }
.frame.on { background: var(--raise); border-color: rgba(139, 123, 255, .5); }
.frame.playing { border-color: rgba(255, 107, 181, .6); }
.frame canvas { width: 62px; height: 62px; border-radius: 7px; image-rendering: pixelated; border: 1px solid var(--line); }
.frame span { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.frame.drop-before::before { content: ""; position: absolute; left: -5px; top: 8px; bottom: 8px; width: 2px; background: var(--accent); border-radius: 2px; }
.frame-add { flex: none; width: 62px; height: 62px; margin-top: 5px; border-radius: 9px; border: 1px dashed var(--line2); background: transparent; color: var(--muted); display: grid; place-items: center; font-size: 22px; }
.frame-add:hover { border-color: var(--accent); color: var(--fg); }

/* ---------- dialogs ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(5, 5, 7, .62); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.dialog { width: min(520px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--panel); border: 1px solid var(--line2); border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .55); animation: pop .18s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.dialog header { display: flex; align-items: center; gap: 10px; padding: 16px 18px 6px; }
.dialog header h2 { margin: 0; font-size: 17px; letter-spacing: -0.01em; flex: 1; }
.dialog .body { padding: 8px 18px 18px; }
.dialog .foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.field { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.field > span { color: var(--muted); font-size: 12px; }
.field input[type=text], .field input[type=number], .field select { height: 36px; border-radius: 9px; border: 1px solid var(--line2); background: var(--panel2); padding: 0 10px; }
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; gap: 4px; padding: 3px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; flex-wrap: wrap; }
.seg button { flex: 1; height: 30px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); font-size: 12.5px; padding: 0 8px; }
.seg button.on { background: var(--raise); color: var(--fg); box-shadow: 0 0 0 1px var(--line2); }
.code { position: relative; font-family: var(--mono); font-size: 12px; background: #0a0a0c; border: 1px solid var(--line2); border-radius: 10px; padding: 12px 44px 12px 12px; white-space: pre-wrap; word-break: break-all; color: #d8d8e0; margin: 8px 0 14px; }
.code button { position: absolute; top: 8px; right: 8px; }
.steps { counter-reset: s; margin: 6px 0 0; padding: 0; list-style: none; }
.steps li { counter-increment: s; position: relative; padding-left: 34px; margin: 0 0 6px; color: var(--muted); }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--raise); color: var(--fg); display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.steps li b { color: var(--fg); font-weight: 600; }
.note { color: var(--dim); font-size: 12px; }
.status-line { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); margin-bottom: 12px; }
.status-line .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); }
.status-line.ok .dot { background: var(--good); box-shadow: 0 0 10px var(--good); }
.export-preview { display: grid; place-items: center; min-height: 120px; max-height: 220px; border-radius: 12px; border: 1px solid var(--line); overflow: auto; margin-bottom: 8px; }
.export-preview canvas, .export-preview img { image-rendering: pixelated; max-width: 100%; }
.menu { position: fixed; z-index: 60; min-width: 210px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 12px; padding: 5px; box-shadow: 0 20px 50px rgba(0,0,0,.5); animation: pop .12s; }
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; border: 0; background: transparent; text-align: left; color: var(--fg); }
.menu button:hover { background: var(--hover); }
.menu button kbd { margin-left: auto; }
.menu button svg { width: 16px; height: 16px; color: var(--muted); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }

/* ---------- home ---------- */
.home { position: fixed; inset: 0; z-index: 40; overflow: auto; background: var(--bg); }
.home::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 24px 24px; -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 20%, transparent 75%); mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 20%, transparent 75%); }
.home::after { content: ""; position: fixed; top: -260px; left: 50%; transform: translateX(-50%); width: 1000px; height: 560px; pointer-events: none; z-index: 0;
  background: radial-gradient(closest-side, rgba(139, 123, 255, .16), rgba(255, 107, 181, .06) 60%, transparent); }
.home-inner { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 22px 24px 60px; }
.home-top { display: flex; align-items: center; justify-content: space-between; }
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; padding: 56px 0 44px; }
.hero h1 { font-size: clamp(40px, 6vw, 64px); line-height: 1; letter-spacing: -0.045em; margin: 0 0 16px; font-weight: 700; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 17px; max-width: 470px; margin: 0 0 24px; line-height: 1.55; }
.hero .cta { display: flex; gap: 10px; flex-wrap: wrap; }
.hero .cta .btn { height: 42px; padding: 0 18px; border-radius: 12px; font-size: 14.5px; }
.badge { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 8px; border-radius: 999px; font-size: 12.5px; color: var(--muted); border: 1px solid var(--line2); background: rgba(20,20,23,.7); margin-bottom: 18px; }
.badge img { width: 16px; height: 16px; }
.showcase { position: relative; aspect-ratio: 1; max-width: 400px; justify-self: center; width: 100%; border-radius: 26px; border: 1px solid var(--line2); background: var(--panel); overflow: hidden; box-shadow: 0 40px 100px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.03) inset; }
.showcase canvas { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.showcase .cap { position: absolute; left: 12px; bottom: 12px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 12px; }
.section-title h2 { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.section-title span { color: var(--dim); font-size: 13px; }
.presets { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.preset { padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); text-align: left; display: flex; flex-direction: column; gap: 10px; transition: border-color .15s, transform .15s, background .15s; }
.preset:hover { border-color: rgba(139, 123, 255, .45); transform: translateY(-2px); background: var(--panel2); }
.preset .sq { display: grid; place-items: center; height: 56px; }
.preset .sq i { display: block; background: linear-gradient(145deg, rgba(139,123,255,.5), rgba(255,107,181,.35)); border-radius: 4px; box-shadow: 0 0 0 1px rgba(255,255,255,.12) inset; }
.preset .sq svg { width: 26px; height: 26px; color: var(--muted); }
.preset b { font-size: 14px; } .preset span { color: var(--dim); font-size: 12px; font-family: var(--mono); }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.proj { border-radius: 14px; border: 1px solid var(--line); background: var(--panel); overflow: hidden; cursor: pointer; transition: border-color .15s, transform .15s; position: relative; }
.proj:hover { border-color: var(--line2); transform: translateY(-2px); }
.proj .thumb { aspect-ratio: 1; display: grid; place-items: center; border-bottom: 1px solid var(--line); }
.proj .thumb img { width: 70%; height: 70%; object-fit: contain; image-rendering: pixelated; }
.proj .meta { padding: 10px 12px; }
.proj .meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.proj .meta span { color: var(--dim); font-size: 12px; }
.proj .del { position: absolute; top: 8px; right: 8px; opacity: 0; background: rgba(20,20,23,.9); }
.proj:hover .del { opacity: 1; }
.empty { padding: 26px; border-radius: 14px; border: 1px dashed var(--line2); color: var(--dim); text-align: center; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 8px; }
.feature { padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.025), transparent), var(--panel); }
.feature svg { width: 22px; height: 22px; color: var(--accent); }
.feature h4 { margin: 10px 0 4px; font-size: 14.5px; }
.feature p { margin: 0; color: var(--muted); font-size: 13px; }
.claude-card { margin-top: 12px; padding: 22px; border-radius: 18px; border: 1px solid rgba(217,119,87,.35); background: radial-gradient(600px 220px at 0% 0%, rgba(217,119,87,.14), transparent 70%), var(--panel); display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; }
.claude-card h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: -0.02em; }
.claude-card p { margin: 0; color: var(--muted); max-width: 620px; }
.claude-card .btn { justify-self: start; }
.home-foot { margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--dim); font-size: 13px; flex-wrap: wrap; gap: 10px; }
.home-foot a { color: var(--muted); text-decoration: none; } .home-foot a:hover { color: var(--fg); }

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 70; bottom: 150px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 9px; padding: 9px 14px; border-radius: 12px; background: rgba(28, 28, 32, .96); border: 1px solid var(--line2); box-shadow: 0 12px 40px rgba(0,0,0,.45); animation: toast .25s cubic-bezier(.2,.9,.3,1.2); font-weight: 500; }
.toast.claude { border-color: rgba(217,119,87,.5); }
.toast.claude::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #e0855f; box-shadow: 0 0 10px #e0855f; }
.toast.out { opacity: 0; transform: translateY(6px); transition: .3s; }
@keyframes toast { from { opacity: 0; transform: translateY(10px) scale(.96); } }
.dropzone { position: fixed; inset: 12px; z-index: 80; border: 2px dashed var(--accent); border-radius: 22px; background: rgba(139,123,255,.08); display: grid; place-items: center; font-size: 18px; font-weight: 600; pointer-events: none; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  #app { grid-template-columns: 48px 1fr; grid-template-areas: "top top" "tools stage" "time time"; }
  .side { position: fixed; right: 0; top: 52px; bottom: 0; width: 280px; z-index: 30; transform: translateX(100%); transition: transform .2s; box-shadow: -20px 0 50px rgba(0,0,0,.4); }
  .side.open { transform: none; }
  .docname { width: 120px; } .docmeta, .hide-md { display: none; }
  .hero { grid-template-columns: 1fr; padding-top: 30px; } .presets { grid-template-columns: repeat(3, 1fr); } .features { grid-template-columns: 1fr; }
  .claude-card { grid-template-columns: 1fr; }
}
@media (min-width: 981px) { .only-md { display: none !important; } }
@media (max-width: 560px) { .presets { grid-template-columns: repeat(2, 1fr); } .optionsbar { max-width: calc(100% - 20px); overflow-x: auto; } .hide-sm { display: none; } }

/* =========================================================================================
   v2 look: floating islands, softer depth, richer timeline
   ========================================================================================= */
:root { --bg: #08080a; --panel: #121215; --panel2: #18181c; --raise: #202026; --hover: #26262d; --line: rgba(255,255,255,0.06); --line2: rgba(255,255,255,0.11); }
body { background: radial-gradient(1200px 700px at 50% -10%, #15131f 0%, var(--bg) 55%) fixed; }
#app { gap: 8px; padding: 0 8px 8px; grid-template-rows: 56px minmax(0, 1fr) auto; grid-template-columns: 56px 1fr 292px; }
.topbar { background: transparent; border: 0; padding: 0 4px; gap: 6px; }
.tools, .stage, .side, .timeline { border-radius: 16px; border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.03); }
.tools { background: var(--panel); border-right: 1px solid var(--line); padding: 8px 0; }
.side { background: var(--panel); border-left: 1px solid var(--line); padding: 4px; gap: 4px; }
.timeline { background: var(--panel); border-top: 1px solid var(--line); overflow: hidden; }
.stage { background-color: #0d0d10; background-image: radial-gradient(rgba(255,255,255,0.07) 1px, transparent 1px); background-size: 22px 22px; }

/* top bar */
.brand { font-size: 16px; }
.brand .logo { width: 28px; height: 28px; filter: drop-shadow(0 4px 14px rgba(139,123,255,.35)); }
.docname { background: rgba(255,255,255,0.03); border-color: var(--line); height: 34px; border-radius: 10px; padding: 0 12px; }
.docmeta { padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); font-size: 11.5px; }
.btn { height: 34px; border-radius: 10px; }
.btn.primary { background: linear-gradient(180deg, #ffffff, #e4e4ea); box-shadow: 0 6px 20px rgba(255,255,255,.12); }
.btn.ghost { color: var(--muted); } .btn.ghost:hover { color: var(--fg); }
.icon-btn { border-radius: 10px; }

/* tool rail with tooltips */
.tool { width: 40px; height: 40px; border-radius: 12px; transition: background .15s, color .15s, transform .12s; }
.tool:active { transform: scale(.94); }
.tool.on { background: linear-gradient(145deg, #8b7bff, #c56bff 60%, #ff6bb5); color: #fff; border-color: transparent; box-shadow: 0 6px 20px rgba(139,123,255,.45), inset 0 1px 0 rgba(255,255,255,.25); }
[data-tip] { position: relative; }
[data-tip]:hover::after { content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); white-space: nowrap; z-index: 90;
  padding: 6px 10px; border-radius: 9px; background: #1d1d23; border: 1px solid var(--line2); color: var(--fg); font-size: 12px; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,.5); pointer-events: none; animation: fade .12s; }
.swatches { width: 42px; height: 42px; margin-top: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 9px; border: 2px solid var(--panel); }

/* floating options bar + status pills */
.optionsbar { top: 12px; border-radius: 14px; background: rgba(22,22,27,.82); backdrop-filter: blur(16px) saturate(150%); }
.statusbar { bottom: 12px; }
.pill, .zoomctl { background: rgba(22,22,27,.82); backdrop-filter: blur(12px); border-color: var(--line2); }
.zoomctl button.on { background: var(--raise); color: var(--fg); }

/* empty-canvas hint */
.hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; z-index: 3; transition: opacity .4s; }
.hint b { display: block; font-size: 15px; font-weight: 600; margin-bottom: 8px; color: var(--fg); }
.hint span { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12.5px; margin: 0 6px; }
.hint.gone { opacity: 0; }

/* side panels as cards */
.panel { border: 0; border-radius: 12px; padding: 12px; background: transparent; }
.panel + .panel { border-top: 1px solid var(--line); border-radius: 0; }
.panel h3 { color: var(--muted); font-size: 11px; margin-bottom: 12px; }
.preview-wrap { height: 176px; border-radius: 12px; border-color: var(--line2); }
.preview-tools { margin-top: 0; }
.pv-info { position: absolute; left: 8px; bottom: 8px; font: 11px var(--mono); color: var(--muted); padding: 3px 7px; border-radius: 7px; background: rgba(10,10,12,.75); }
.colorchips { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-bottom: 10px; }
.cchip { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); cursor: pointer; min-width: 0; }
.cchip.on { border-color: rgba(139,123,255,.55); box-shadow: 0 0 0 1px rgba(139,123,255,.3) inset; }
.cchip i { width: 22px; height: 22px; border-radius: 6px; flex: none; position: relative; overflow: hidden; }
.cchip i b { position: absolute; inset: 0; }
.cchip span { font: 11.5px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cchip small { display: block; font: 600 9.5px Inter, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.sv { height: 140px; border-radius: 12px; } .sv::before, .sv::after { border-radius: 12px; }
.hue { border-radius: 8px; width: 16px; justify-self: center; }
.picker { grid-template-columns: 1fr 16px; gap: 10px; }
.alpha { height: 12px; }
.palette { gap: 4px; } .palette b { border-radius: 6px; }
.layer { padding: 6px; border-radius: 10px; }
.layer.on { background: linear-gradient(90deg, rgba(139,123,255,.16), rgba(139,123,255,.04)); border-color: rgba(139,123,255,.35); }

/* timeline */
.tl-bar { padding: 8px 12px; gap: 6px; }
.tl-group { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); }
.tl-group .icon-btn { width: 30px; height: 30px; }
.playbtn { width: 38px !important; height: 38px !important; border-radius: 50% !important; background: linear-gradient(145deg, #8b7bff, #ff6bb5) !important; color: #fff !important; box-shadow: 0 6px 18px rgba(139,123,255,.45); }
.playbtn svg { width: 16px; height: 16px; }
.tl-bar label { color: var(--muted); }
.frames { padding: 12px 14px 14px; gap: 10px; min-height: 118px; }
.frame { width: 86px; padding: 6px; border-radius: 14px; background: var(--panel2); border: 1px solid var(--line); }
.frame:hover { background: var(--raise); }
.frame canvas { width: 72px; height: 72px; border-radius: 9px; }
.frame span { position: absolute; top: 10px; left: 10px; font-size: 10.5px; font-weight: 600; color: #fff; background: rgba(10,10,12,.75); padding: 1px 6px; border-radius: 6px; }
.frame em { font-style: normal; font: 10.5px var(--mono); color: var(--dim); }
.frame.on { background: linear-gradient(180deg, rgba(139,123,255,.22), rgba(255,107,181,.08)); border-color: rgba(139,123,255,.6); box-shadow: 0 6px 22px rgba(139,123,255,.2); }
.frame.on span { background: linear-gradient(90deg, #8b7bff, #ff6bb5); }
.frame.playing { border-color: #ff6bb5; }
.frame-add { width: 86px; height: 98px; margin-top: 0; border-radius: 14px; }
@media (max-width: 980px) {
  #app { grid-template-columns: 52px 1fr; padding: 0 6px 6px; gap: 6px; }
  .side { top: 60px; bottom: 8px; right: 8px; border-radius: 16px; }
}
.tools { overflow: visible; }

#toolTip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: min(520px, 45vw); }
@media (max-width: 1200px) { .topbar .hide-md { display: none; } .docmeta { display: none; } }
.side, .stage, .tools { min-height: 0; }
.hint { padding: 18px 22px; border-radius: 16px; background: rgba(14,14,18,.78); border: 1px solid var(--line2); backdrop-filter: blur(10px); box-shadow: 0 20px 50px rgba(0,0,0,.4); }
.hint span { margin: 2px 6px; }
