#nativeSpirographApp {
  color-scheme: dark;
  --bg: #030712;
  --panel: rgba(8, 16, 34, 0.82);
  --panel-strong: rgba(7, 14, 30, 0.95);
  --panel-soft: rgba(16, 29, 55, 0.58);
  --line: rgba(135, 176, 255, 0.17);
  --line-bright: rgba(89, 180, 255, 0.4);
  --text: #edf5ff;
  --muted: #91a4bf;
  --cyan: #33ddff;
  --blue: #4d7cff;
  --violet: #a85cff;
  --pink: #ff63b8;
  --orange: #ffb54d;
  --danger: #ff637a;
  --radius: 18px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
  --panel-w: 310px;
  --right-w: 290px;
  --top: 24px;
  --gap: 20px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@scope (#nativeSpirographApp) {
* { box-sizing: border-box; }
:scope { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { color: inherit; }
svg { display: block; }

.svg-sprite { position: fixed; width: 0; height: 0; overflow: hidden; }
.app-shell { position: relative; width: 100%; height: 100%; min-height: 540px; background: #020613; isolation: isolate; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; z-index: 0; }
#stage:active { cursor: grabbing; }
.ambient-layer {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(circle at 50% 45%, rgba(61, 81, 255, .08), transparent 36%),
    linear-gradient(90deg, rgba(26, 72, 140, .04) 1px, transparent 1px),
    linear-gradient(rgba(26, 72, 140, .04) 1px, transparent 1px);
  background-size: auto, 72px 72px, 72px 72px;
  mix-blend-mode: screen;
}

.topbar {
  position: absolute; z-index: 20; top: var(--top); left: 28px; right: 28px;
  display: flex; justify-content: space-between; align-items: center; pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand {
  display: flex; align-items: center; gap: 14px; padding: 0; border: 0; background: transparent; cursor: pointer; text-align: left;
}
.brand-mark { position: relative; width: 48px; height: 48px; display: grid; place-items: center; filter: drop-shadow(0 0 13px rgba(56, 203, 255, .32)); }
.brand-mark::before, .brand-mark i {
  content: ""; position: absolute; border: 1.5px solid var(--cyan); border-radius: 50%; width: 31px; height: 31px;
}
.brand-mark::before { transform: rotate(0deg) scaleX(.75); }
.brand-mark i:nth-child(1) { transform: rotate(60deg) scaleX(.75); border-color: var(--blue); }
.brand-mark i:nth-child(2) { transform: rotate(120deg) scaleX(.75); border-color: var(--violet); }
.brand-mark i:nth-child(3) { width: 9px; height: 9px; background: var(--cyan); border: 0; box-shadow: 0 0 16px var(--cyan); }
.brand-copy { display: flex; flex-direction: column; line-height: 1; }
.brand-copy strong { font-size: 19px; letter-spacing: .32em; font-weight: 650; background: linear-gradient(90deg, #8df4ff, #9eb2ff 58%, #d590ff); -webkit-background-clip: text; color: transparent; }
.brand-copy small { margin-top: 8px; color: #b9c9dd; letter-spacing: .15em; font-size: 9px; font-weight: 650; }
.top-actions { display: flex; gap: 8px; }
.icon-button {
  width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(7, 14, 29, .72); backdrop-filter: blur(16px); display: grid; place-items: center; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035), 0 8px 22px rgba(0,0,0,.22); transition: .18s ease;
  position: relative;
}
.icon-button:hover { border-color: var(--line-bright); background: rgba(15, 28, 52, .88); transform: translateY(-1px); }
.icon-button:active { transform: translateY(0); }
.icon-button svg { width: 21px; height: 21px; fill: #d8e7fb; }
.icon-button.compact { width: 34px; height: 34px; border-radius: 9px; }
.icon-button.compact svg { width: 17px; height: 17px; }
.mobile-panel-button { display: none; }
.record-dot { display: none; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #ff4163; right: 7px; top: 7px; box-shadow: 0 0 10px #ff4163; }
#recordButton.is-recording { border-color: rgba(255, 65, 99, .65); }
#recordButton.is-recording .record-dot { display: block; animation: recordPulse .8s infinite alternate; }
@keyframes recordPulse { to { opacity: .25; transform: scale(.7); } }

.panel {
  position: absolute; z-index: 15; top: 105px; bottom: 30px; border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(10, 20, 41, .9), rgba(5, 12, 26, .83)); backdrop-filter: blur(22px) saturate(125%);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.035); overflow: hidden;
}
.panel-left { left: 28px; width: var(--panel-w); padding: 0 18px 18px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(96,151,224,.32) transparent; }
.panel-right { right: 28px; width: var(--right-w); padding: 18px 14px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(96,151,224,.32) transparent; }
.panel::-webkit-scrollbar { width: 5px; }
.panel::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(96,151,224,.28); }
.panel-mobile-head { display: none; }

.panel-edge-toggle {
  position: absolute; z-index: 18; top: 50%; width: 29px; height: 62px; padding: 0; border: 1px solid rgba(112, 177, 244, .3);
  background: linear-gradient(180deg, rgba(14, 32, 60, .94), rgba(6, 15, 31, .94)); color: #bcefff; cursor: pointer;
  display: grid; place-items: center; transform: translateY(-50%); box-shadow: 0 10px 30px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.04);
  backdrop-filter: blur(14px); transition: left .28s ease, right .28s ease, border-color .18s ease, background .18s ease, opacity .24s ease;
}
.panel-edge-toggle:hover { border-color: rgba(68, 221, 255, .75); background: linear-gradient(180deg, rgba(20, 47, 82, .97), rgba(9, 23, 45, .97)); }
.panel-edge-toggle svg { width: 18px; height: 18px; fill: currentColor; transition: transform .25s ease; }
.panel-edge-toggle-left { left: 0; border-left: 0; border-radius: 0 11px 11px 0; }
.panel-edge-toggle-right { right: 0; border-right: 0; border-radius: 11px 0 0 11px; }
.panel-edge-toggle-left svg { transform: rotate(-90deg); }
.panel-edge-toggle-right svg { transform: rotate(90deg); }
.panel-edge-toggle-left.is-open { left: calc(28px + var(--panel-w) - 1px); }
.panel-edge-toggle-right.is-open { right: calc(28px + var(--right-w) - 1px); }
.panel-edge-toggle-left.is-open svg { transform: rotate(90deg); }
.panel-edge-toggle-right.is-open svg { transform: rotate(-90deg); }

@media (min-width: 981px) {
  .panel-left.is-collapsed { transform: translateX(calc(-100% - 30px)); }
  .panel-right.is-collapsed { transform: translateX(calc(100% + 30px)); }
}

.control-section { border-bottom: 1px solid rgba(132, 174, 238, .1); }
.section-heading {
  width: 100%; height: 52px; padding: 0 2px; border: 0; background: transparent; display: flex; align-items: center; justify-content: space-between; cursor: pointer;
  color: #dbe8fa; text-transform: uppercase; font-size: 11px; letter-spacing: .11em; font-weight: 700;
}
.section-heading svg { width: 17px; height: 17px; fill: var(--muted); transition: transform .2s ease; }
.control-section.is-open .section-heading svg { transform: rotate(180deg); }
.section-body { display: none; padding: 1px 2px 15px; }
.control-section.is-open .section-body { display: block; }

.range-control { margin: 10px 0 16px; }
.range-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 12px; }
.range-title label { color: #b7c6da; }
.range-title output { color: #f2f7ff; font-variant-numeric: tabular-nums; font-size: 11px; min-width: 50px; text-align: right; }
input[type="range"] {
  --fill: 50%; appearance: none; width: 100%; height: 4px; margin: 0; border-radius: 999px; outline: none;
  background: linear-gradient(90deg, var(--range-color, var(--cyan)) var(--fill), rgba(131,161,209,.19) var(--fill));
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none; width: 12px; height: 12px; border-radius: 50%; border: 0; background: var(--range-color, var(--cyan));
  box-shadow: 0 0 0 3px rgba(255,255,255,.02), 0 0 12px color-mix(in srgb, var(--range-color, var(--cyan)) 70%, transparent); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%; border: 0; background: var(--range-color, var(--cyan)); cursor: pointer;
}
.range-control:nth-of-type(3n+1) input { --range-color: var(--cyan); }
.range-control:nth-of-type(3n+2) input { --range-color: var(--violet); }
.range-control:nth-of-type(3n+3) input { --range-color: var(--pink); }

.select-row, .switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 14px; font-size: 12px; color: #b7c6da; }
.select-row select {
  max-width: 145px; min-width: 118px; height: 34px; border: 1px solid rgba(139,178,232,.18); border-radius: 9px; color: #e7f1ff;
  background: rgba(8,16,33,.86); padding: 0 28px 0 10px; outline: none;
}
.select-row select:focus { border-color: rgba(51,221,255,.55); }
.switch-row { position: relative; cursor: pointer; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row i { width: 38px; height: 21px; border-radius: 999px; background: rgba(112,139,180,.18); border: 1px solid rgba(139,178,232,.15); position: relative; transition: .2s; }
.switch-row i::after { content: ""; position: absolute; width: 15px; height: 15px; border-radius: 50%; left: 2px; top: 2px; background: #72849d; transition: .2s; }
.switch-row input:checked + i { background: linear-gradient(90deg, rgba(51,221,255,.52), rgba(91,98,255,.55)); border-color: rgba(51,221,255,.45); }
.switch-row input:checked + i::after { left: 19px; background: #e9fbff; box-shadow: 0 0 10px rgba(51,221,255,.7); }

.audio-reactor { margin-top: 15px; padding: 12px; border: 1px solid rgba(85, 177, 239, .19); border-radius: 12px; background: linear-gradient(145deg, rgba(14, 31, 57, .7), rgba(8, 15, 32, .72)); }
.audio-reactor-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.audio-reactor-head > div { display: flex; flex-direction: column; gap: 3px; }
.audio-reactor-head span { color: #dcecff; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.audio-reactor-head small { color: #7189a8; font-size: 9px; }
.beat-meter { height: 19px; display: flex; align-items: flex-end; gap: 2px; }
.beat-meter i { width: 3px; height: 25%; border-radius: 2px; background: linear-gradient(#62f5ff, #6967ff); box-shadow: 0 0 6px rgba(73, 220, 255, .35); transform-origin: bottom; transition: height 70ms linear; }
.beat-meter i:nth-child(2) { height: 52%; }
.beat-meter i:nth-child(3) { height: 82%; }
.beat-meter i:nth-child(4) { height: 42%; }
.audio-upload-button { width: 100%; height: 37px; border: 1px dashed rgba(72, 196, 255, .4); border-radius: 9px; background: rgba(31, 100, 154, .1); color: #a9dff8; display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 10px; cursor: pointer; transition: .18s ease; }
.audio-upload-button:hover { border-color: #45dbff; color: #edfbff; background: rgba(41, 143, 205, .16); }
.audio-upload-button svg { width: 14px; height: 14px; fill: currentColor; }
.audio-track { margin-top: 9px; padding: 11px; border: 1px solid rgba(98, 188, 244, .18); border-radius: 11px; background: linear-gradient(145deg, rgba(10, 29, 53, .88), rgba(6, 14, 29, .92)); box-shadow: inset 0 1px 0 rgba(255,255,255,.025); }
.audio-track[hidden] { display: none; }
.audio-track-info { display: grid; grid-template-columns: 31px minmax(0, 1fr) 28px; align-items: center; gap: 8px; }
.audio-note { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; color: #b7f6ff; font-size: 16px; background: linear-gradient(145deg, rgba(48, 207, 255, .2), rgba(101, 91, 255, .2)); box-shadow: inset 0 0 12px rgba(67, 192, 255, .1); }
.audio-icon-button { width: 31px; height: 31px; border: 1px solid rgba(110, 174, 238, .26); border-radius: 8px; background: rgba(16, 35, 62, .8); display: grid; place-items: center; cursor: pointer; }
.audio-icon-button:hover { border-color: rgba(73, 221, 255, .7); }
.audio-icon-button svg { width: 13px; height: 13px; fill: #d8f4ff; }
.audio-remove-button svg { fill: #ff91a4; }
.audio-track-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.audio-track-copy strong { overflow: hidden; color: #d6e9fa; font-size: 9px; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.audio-track-copy small { color: #69819f; font-size: 8px; }
.audio-seek { --range-color: #55dfff; height: 5px !important; margin-top: 13px !important; }
.audio-seek::-webkit-slider-thumb { width: 11px !important; height: 11px !important; }
.audio-time-row { display: flex; justify-content: space-between; margin-top: 5px; color: #7087a2; font-size: 8px; font-variant-numeric: tabular-nums; }
.audio-transport { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 7px; }
.audio-play-button, .audio-skip-button { position: relative; border: 0; display: grid; place-items: center; cursor: pointer; transition: transform .16s ease, filter .16s ease; }
.audio-play-button { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(145deg, #35dff2, #6265ff); box-shadow: 0 7px 20px rgba(62, 124, 255, .3), inset 0 1px 0 rgba(255,255,255,.35); }
.audio-play-button svg { width: 16px; height: 16px; fill: #fff; }
.audio-play-button:hover, .audio-skip-button:hover { transform: translateY(-1px); filter: brightness(1.13); }
.audio-skip-button { width: 31px; height: 31px; border-radius: 50%; background: rgba(37, 67, 104, .42); }
.audio-skip-button svg { width: 15px; height: 15px; fill: #a9c4df; }
.audio-skip-button small { position: absolute; color: #e2f3ff; font-size: 6px; font-weight: 800; line-height: 1; }
.audio-sensitivity { margin: 13px 0 8px; }
.audio-reactor > p { margin: 7px 0 0; color: #607894; font-size: 8px; line-height: 1.45; }

.palette-list { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 8px 0 14px; }
.palette-chip { width: 100%; aspect-ratio: 1; border-radius: 50%; border: 2px solid transparent; background: var(--chip); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 0 14px rgba(0,0,0,.25); transition: .18s; }
.palette-chip:hover { transform: scale(1.08); }
.palette-chip.is-active { border-color: #e9f7ff; box-shadow: 0 0 0 2px rgba(51,221,255,.45), 0 0 15px rgba(51,221,255,.28); }
.color-editor { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.color-editor label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .07em; }
.color-editor input { width: 100%; height: 34px; border: 1px solid rgba(139,178,232,.18); border-radius: 9px; background: transparent; padding: 2px; cursor: pointer; }
.color-editor input::-webkit-color-swatch-wrapper { padding: 0; }
.color-editor input::-webkit-color-swatch { border: 0; border-radius: 6px; }

.panel-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding-top: 16px; }
.panel-actions .primary-button { grid-column: 1 / -1; }
.primary-button, .secondary-button, .mini-button, .data-actions button {
  border: 1px solid rgba(90, 157, 255, .34); border-radius: 10px; background: rgba(8, 16, 33, .66); color: #e9f3ff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: .18s ease;
}
.primary-button { height: 44px; background: linear-gradient(135deg, rgba(35, 102, 255, .24), rgba(123, 66, 255, .19)); border-color: rgba(83, 151, 255, .7); box-shadow: inset 0 0 22px rgba(64, 123, 255, .08); text-transform: uppercase; font-size: 11px; letter-spacing: .09em; font-weight: 750; }
.secondary-button { height: 39px; font-size: 11px; color: #b8c9df; }
.primary-button:hover, .secondary-button:hover, .data-actions button:hover { border-color: var(--cyan); background-color: rgba(15,31,57,.85); }
.primary-button svg, .secondary-button svg { width: 16px; height: 16px; fill: currentColor; }

.preset-head { display: flex; align-items: flex-end; justify-content: space-between; padding: 0 2px 14px; }
.eyebrow { display: block; color: #79c9ff; font-size: 9px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; margin-bottom: 5px; }
.preset-head h2 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.mini-button { width: 34px; height: 34px; }
.mini-button svg { width: 16px; height: 16px; fill: #d7e7fb; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.preset-card {
  position: relative; min-width: 0; padding: 0; border: 1px solid rgba(130,173,237,.17); border-radius: 12px; background: rgba(2, 7, 18, .62); overflow: hidden; cursor: pointer; transition: .18s ease; text-align: left;
}
.preset-card:hover { border-color: rgba(70,178,255,.65); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.26); }
.preset-card.is-active { border-color: #2f9cff; box-shadow: inset 0 0 0 1px rgba(47,156,255,.4), 0 0 18px rgba(39,127,255,.18); }
.preset-card canvas { display: block; width: 100%; aspect-ratio: 1.22; background: #020713; }
.preset-card .preset-meta { display: flex; align-items: center; justify-content: space-between; padding: 7px 8px 8px; gap: 6px; }
.preset-card strong { font-size: 9px; line-height: 1.15; font-weight: 620; color: #d8e7f8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preset-card small { color: #6f849f; font-size: 8px; }
.preset-card .delete-preset { position: absolute; right: 5px; top: 5px; width: 25px; height: 25px; border: 1px solid rgba(255,255,255,.1); border-radius: 7px; background: rgba(5,8,16,.72); display: grid; place-items: center; opacity: 0; cursor: pointer; transition: .18s; }
.preset-card:hover .delete-preset { opacity: 1; }
.delete-preset svg { width: 13px; height: 13px; fill: #ff8a9d; }
.custom-section { border-top: 1px solid rgba(131,170,229,.12); margin-top: 17px; padding-top: 15px; }
.custom-heading { display: flex; justify-content: space-between; margin-bottom: 11px; color: #dce9fa; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.custom-heading small { color: #70849f; text-transform: none; letter-spacing: 0; font-weight: 500; }
.custom-empty { grid-column: 1/-1; padding: 14px; border: 1px dashed rgba(136,176,235,.18); border-radius: 10px; color: #71839d; font-size: 10px; text-align: center; }
.data-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 15px; }
.data-actions button { height: 34px; font-size: 9px; color: #9eb0c7; }
.data-actions svg { width: 13px; height: 13px; fill: currentColor; }
.about-card { margin-top: 14px; border: 1px solid rgba(130,173,237,.13); border-radius: 12px; padding: 13px; background: rgba(13,23,43,.43); }
.about-card p { color: #8da0ba; font-size: 10px; line-height: 1.55; margin: 0; }
.about-card b { color: #c9d8ea; }

.bottom-dock {
  position: absolute; z-index: 14; left: 50%; bottom: 26px; transform: translateX(-50%); height: 47px; display: flex; align-items: center;
  border: 1px solid rgba(131,176,242,.16); border-radius: 14px; background: rgba(6, 13, 28, .76); backdrop-filter: blur(20px); box-shadow: 0 16px 40px rgba(0,0,0,.32); overflow: hidden;
}
.bottom-dock button { height: 100%; padding: 0 17px; border: 0; background: transparent; color: #a9bdd6; display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 10px; letter-spacing: .04em; }
.bottom-dock button:hover { background: rgba(49,103,176,.13); color: #edf7ff; }
.bottom-dock svg { width: 15px; height: 15px; fill: currentColor; }
.bottom-dock > span { width: 1px; height: 18px; background: rgba(128,168,223,.15); }
.interaction-hint { position: absolute; z-index: 12; bottom: 83px; left: 50%; transform: translateX(-50%); color: rgba(185,204,229,.76); font-size: 10px; letter-spacing: .015em; white-space: nowrap; pointer-events: none; }
.interaction-hint i { color: #50647e; font-style: normal; margin: 0 5px; }
.spark { color: #ffd378; text-shadow: 0 0 10px #ff9f4a; margin-right: 5px; }
.performance-badge { position: absolute; z-index: 12; left: calc(var(--panel-w) + 48px); bottom: 30px; display: flex; align-items: center; gap: 6px; color: #60748e; font-size: 8px; letter-spacing: .08em; pointer-events: none; }
.performance-badge > span { width: 6px; height: 6px; border-radius: 50%; background: #53e8a1; box-shadow: 0 0 9px #53e8a1; }
.performance-badge b { color: #8eabc5; font-size: 8px; }
.performance-badge small { letter-spacing: 0; }

.export-popover {
  position: fixed; z-index: 50; top: 78px; right: 148px; width: 210px; padding: 10px; border: 1px solid var(--line); border-radius: 13px;
  background: rgba(7,15,31,.96); backdrop-filter: blur(20px); box-shadow: var(--shadow);
}
.export-popover[hidden] { display: none; }
.export-popover strong { display: block; padding: 4px 6px 8px; font-size: 11px; color: #dce9f8; }
.export-popover button { width: 100%; border: 0; border-radius: 8px; background: transparent; color: #9db0c8; text-align: left; padding: 9px 8px; font-size: 10px; cursor: pointer; }
.export-popover button:hover { background: rgba(67,118,194,.14); color: #edf6ff; }

.modal-backdrop { position: fixed; z-index: 80; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(0,4,13,.7); backdrop-filter: blur(12px); }
.modal-backdrop[hidden] { display: none; }
.modal-card { width: min(440px, 100%); position: relative; padding: 24px; border: 1px solid rgba(119,169,240,.24); border-radius: 18px; background: linear-gradient(180deg, rgba(13,26,51,.98), rgba(6,13,28,.98)); box-shadow: 0 30px 100px rgba(0,0,0,.6); }
.modal-card h2 { margin: 0 0 18px; font-size: 22px; }
.modal-card > label { display: flex; flex-direction: column; gap: 8px; color: #9db0c8; font-size: 11px; }
.modal-card input[type="text"] { height: 42px; border: 1px solid rgba(127,169,231,.22); border-radius: 10px; background: rgba(4,10,22,.7); color: #eef6ff; padding: 0 12px; outline: none; }
.modal-card input[type="text"]:focus { border-color: #34cfff; box-shadow: 0 0 0 3px rgba(52,207,255,.09); }
.modal-close { position: absolute; right: 14px; top: 14px; }
.modal-preview { height: 165px; margin: 16px 0; border-radius: 12px; overflow: hidden; border: 1px solid rgba(126,170,234,.16); background: #020713; }
.modal-preview canvas { width: 100%; height: 100%; display: block; }
.modal-card .primary-button { width: 100%; }

.toast-stack { position: fixed; z-index: 100; right: 24px; bottom: 24px; display: grid; gap: 9px; pointer-events: none; }
.toast { min-width: 220px; max-width: 340px; padding: 12px 14px; border: 1px solid rgba(112,170,245,.23); border-radius: 11px; background: rgba(8,17,34,.94); box-shadow: 0 16px 50px rgba(0,0,0,.36); color: #dbe9f8; font-size: 11px; animation: toastIn .25s ease both; }
.toast strong { color: #79e9ff; }
.toast.is-leaving { animation: toastOut .25s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.98); } }

.app-shell.ui-hidden .panel, .app-shell.ui-hidden .bottom-dock, .app-shell.ui-hidden .interaction-hint, .app-shell.ui-hidden .performance-badge, .app-shell.ui-hidden .brand, .app-shell.ui-hidden .panel-edge-toggle { opacity: 0; pointer-events: none; transform: translateY(5px); }
.app-shell.ui-hidden .top-actions .mobile-panel-button, .app-shell.ui-hidden .top-actions #snapshotButton, .app-shell.ui-hidden .top-actions #recordButton { opacity: 0; pointer-events: none; }
.panel, .bottom-dock, .interaction-hint, .performance-badge, .brand { transition: opacity .24s ease, transform .24s ease; }
.app-shell.left-panel-collapsed .performance-badge { left: 28px; }

@media (max-width: 1240px) {
  :scope { --panel-w: 285px; --right-w: 260px; }
  .preset-grid { grid-template-columns: 1fr; }
  .preset-card canvas { aspect-ratio: 1.65; }
  .bottom-dock { bottom: 20px; }
  .interaction-hint { bottom: 76px; }
}

@media (max-width: 980px) {
  .panel-edge-toggle { display: none; }
  .mobile-panel-button { display: grid; }
  .panel { top: 0; bottom: 0; height: 100%; border-radius: 0; z-index: 60; width: min(360px, 88vw); transition: transform .28s ease; }
  .panel-left { left: 0; transform: translateX(-102%); padding-top: 0; }
  .panel-right { right: 0; transform: translateX(102%); width: min(350px, 88vw); padding-top: 0; }
  .panel.is-mobile-open { transform: translateX(0); }
  .panel-mobile-head { position: sticky; z-index: 3; top: 0; height: 58px; margin: 0 -18px 7px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; background: rgba(7,15,31,.96); border-bottom: 1px solid rgba(126,169,232,.14); backdrop-filter: blur(20px); }
  .panel-right .panel-mobile-head { margin: 0 -14px 14px; }
  .panel-mobile-head strong { font-size: 12px; text-transform: uppercase; letter-spacing: .09em; }
  .preset-grid { grid-template-columns: 1fr 1fr; }
  .preset-card canvas { aspect-ratio: 1.25; }
  .performance-badge { left: 24px; }
  .interaction-hint { display: none; }
  .bottom-dock { bottom: 18px; }
}

@media (max-width: 640px) {
  :scope { --top: 14px; }
  .app-shell { min-height: 480px; }
  .topbar { left: 14px; right: 14px; }
  .brand { gap: 9px; }
  .brand-mark { width: 38px; height: 38px; transform: scale(.84); }
  .brand-copy strong { font-size: 14px; letter-spacing: .22em; }
  .brand-copy small { display: none; }
  .top-actions { gap: 5px; }
  .icon-button { width: 39px; height: 39px; border-radius: 10px; }
  .icon-button svg { width: 18px; height: 18px; }
  #uiButton, #recordButton, #fullscreenButton { display: none; }
  .bottom-dock { left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); transform: none; justify-content: stretch; }
  .bottom-dock button { flex: 1; justify-content: center; padding: 0 8px; }
  .bottom-dock button span { display: none; }
  .performance-badge { bottom: 70px; left: 14px; }
  .export-popover { top: 64px; right: 12px; }
  .toast-stack { left: 14px; right: 14px; bottom: 72px; }
  .toast { min-width: 0; max-width: none; width: 100%; }
}

@media (max-height: 690px) and (min-width: 981px) {
  .panel { top: 84px; bottom: 18px; }
  .topbar { top: 15px; }
  .brand-mark { width: 42px; height: 42px; transform: scale(.88); }
  .bottom-dock { bottom: 14px; }
  .interaction-hint { display: none; }
  .performance-badge { bottom: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
}
