:root {
  color-scheme: dark;
  --bg: #080b12;
  --panel: #0e131d;
  --line: #232d3e;
  --muted: #8490a6;
  --text: #edf3ff;
  --green: #53fc18;
  --purple: #a970ff;
  --cyan: #57e6ff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 1100px; overflow: hidden; background: var(--bg); color: var(--text); }
button, input { font: inherit; }
button { color: inherit; }

.topbar {
  height: 64px;
  display: grid;
  grid-template-columns: 300px 1fr auto;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 18, .96);
  padding: 0 18px;
}

.brand { display: flex; align-items: center; gap: 10px; color: white; text-decoration: none; font-size: 16px; letter-spacing: -.02em; }
.brand-mark { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; background: var(--green); color: #081006; font-weight: 900; box-shadow: 0 0 24px rgba(83,252,24,.18); }
.brand b { color: var(--green); }
.brand small { padding: 3px 6px; border: 1px solid #344055; border-radius: 5px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .12em; }
.topbar-center { justify-self: center; display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 12px; }
.save-state { display: flex; align-items: center; gap: 7px; }
.save-state i, .status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(83,252,24,.8); }
.viewer-count { padding-left: 18px; border-left: 1px solid var(--line); }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.button, .avatar { border: 1px solid var(--line); border-radius: 8px; background: #141b27; padding: 9px 13px; font-size: 12px; font-weight: 700; cursor: pointer; }
.button:hover { border-color: #3a465a; }
.button-primary { color: #071005; border-color: var(--green); background: var(--green); }
.avatar { width: 35px; height: 35px; padding: 0; border-radius: 50%; color: var(--cyan); background: #15313d; }

.app-shell { height: calc(100vh - 64px); display: grid; grid-template-columns: 268px minmax(560px, 1fr) 286px; }
.left-rail, .inspector { background: var(--panel); border-color: var(--line); }
.left-rail { border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; }
.main-nav { padding: 13px; border-bottom: 1px solid var(--line); }
.main-nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; color: var(--muted); text-decoration: none; border-radius: 7px; font-size: 13px; }
.main-nav a span { width: 18px; text-align: center; color: #b8c1d2; }
.main-nav a:hover, .main-nav a.active { color: white; background: #1a2231; }
.main-nav a.active { box-shadow: inset 3px 0 var(--green); }
.main-nav a.active span { color: var(--green); }
.channel-card { padding: 15px; border-bottom: 1px solid var(--line); }
.section-label { color: #657187; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .15em; margin-bottom: 9px; }
.channel-switcher { width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #121925; text-align: left; cursor: pointer; }
.channel-switcher span:nth-child(2) { display: flex; flex-direction: column; gap: 2px; }
.channel-switcher b { font-size: 12px; }
.channel-switcher small { color: var(--muted); font-size: 10px; }
.channel-avatar { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; background: linear-gradient(135deg, var(--green), var(--cyan)); color: #06100a; font-weight: 900; }
.chevron { color: var(--muted); }
.platform-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.platform { padding: 6px; border: 1px solid var(--line); border-radius: 6px; color: #a9b3c5; font-size: 9px; white-space: nowrap; }
.platform i { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; }
.platform.kick i { background: var(--green); }
.platform.twitch i { background: var(--purple); }
.layers-panel { min-height: 0; display: flex; flex-direction: column; flex: 1; }
.panel-heading, .inspector-heading { display: flex; align-items: center; justify-content: space-between; padding: 13px 15px; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.panel-heading button, .inspector-heading button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; }
.layer-list { overflow-y: auto; padding: 7px; }
.layer-row { width: 100%; display: grid; grid-template-columns: 25px 1fr auto; align-items: center; gap: 7px; padding: 8px; border: 1px solid transparent; border-radius: 7px; background: transparent; text-align: left; cursor: pointer; }
.layer-row:hover { background: #151d2a; }
.layer-row.active { border-color: #2f7542; background: #18271e; }
.layer-icon { color: #9faac0; font-weight: 800; text-align: center; }
.layer-row span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.layer-row small { color: #5f6a7f; }

.workspace { min-width: 0; display: flex; flex-direction: column; background: #090d15; }
.tool-row { height: 55px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border-bottom: 1px solid var(--line); background: #0d121b; }
.tool-group { display: flex; align-items: center; gap: 5px; }
.tool-group button { height: 32px; display: flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: #141b27; color: #c7d0df; font-size: 11px; cursor: pointer; }
.tool-group button:hover { border-color: var(--green); color: white; }
.tool-group button span { color: var(--green); font-weight: 900; }
.view-tools { padding-left: 10px; border-left: 1px solid var(--line); }
.view-tools button { width: 32px; justify-content: center; padding: 0; font-size: 15px; }
.zoom { color: var(--muted); font: 10px ui-monospace, monospace; padding: 0 5px; }
.stage-wrap { position: relative; min-height: 0; flex: 1; display: grid; place-items: center; padding: 38px 38px 52px; overflow: hidden; background-color: #070a10; background-image: radial-gradient(#202939 1px, transparent 1px); background-size: 18px 18px; }
.stage { position: relative; width: min(100%, calc((100vh - 200px) * 16 / 9)); aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid #3a4659; background: radial-gradient(circle at 50% 40%, #172235 0, #0a101a 52%, #070a10 100%); box-shadow: 0 24px 60px rgba(0,0,0,.46); }
.stage::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(87,230,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(87,230,255,.035) 1px, transparent 1px); background-size: 4.166% 7.407%; }
.safe-zone { position: absolute; inset: 6%; border: 1px dashed rgba(255,255,255,.12); pointer-events: none; }
.safe-zone::after { content: "SAFE AREA"; position: absolute; top: 7px; right: 9px; color: rgba(255,255,255,.2); font: 8px ui-monospace, monospace; letter-spacing: .12em; }
.stage-item { position: absolute; user-select: none; touch-action: none; cursor: move; transform-origin: center; }
.stage-item.selected { outline: 2px solid var(--cyan); outline-offset: 3px; }
.stage-item.selected::before, .stage-item.selected::after { content: ""; position: absolute; width: 8px; height: 8px; border: 2px solid var(--cyan); background: #09111d; }
.stage-item.selected::before { left: -7px; top: -7px; }
.stage-item.selected::after { right: -7px; bottom: -7px; }
.title-element { display: grid; place-items: center; color: white; font-size: clamp(16px, 3.1vw, 44px); font-weight: 900; letter-spacing: -.035em; text-shadow: 0 4px 24px rgba(0,0,0,.6); white-space: nowrap; }
.title-element b { color: var(--green); }
.platform-element { display: flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; background: rgba(8,12,20,.78); backdrop-filter: blur(10px); font-size: clamp(8px, 1.05vw, 14px); font-weight: 750; }
.platform-element i { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 10px currentColor; }
.platform-element .kick-dot { color: var(--green); background: var(--green); }
.platform-element .twitch-dot { color: var(--purple); background: var(--purple); }
.sound-element { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; padding: 10px 13px; border: 1px solid #31405a; border-radius: 10px; background: linear-gradient(135deg, rgba(24,34,51,.94), rgba(13,20,31,.94)); box-shadow: 0 12px 28px rgba(0,0,0,.3); }
.sound-element .sound-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: #25344d; color: var(--cyan); }
.sound-element span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; }
.sound-element b { font-size: 11px; }
.sound-element small { color: var(--muted); font-size: 8px; }
.sound-element button { width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--green); color: #071005; cursor: pointer; }
.timer-element { display: flex; align-items: baseline; gap: 7px; color: white; font: 800 clamp(15px, 2.2vw, 34px) ui-monospace, monospace; }
.timer-element small { color: var(--cyan); font-size: .35em; letter-spacing: .12em; }
.image-element, .video-element { display: grid; place-items: center; border: 1px dashed var(--cyan); border-radius: 8px; color: var(--cyan); background: rgba(20,35,47,.72); font-size: 11px; font-weight: 800; }
.image-element img, .video-element video { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.stage-footer { position: absolute; left: 39px; right: 39px; bottom: 16px; display: flex; justify-content: space-between; color: #657187; font-size: 10px; }
.stage-footer span:first-child { display: flex; align-items: center; gap: 7px; color: #96a2b6; }
.stage-ruler { position: absolute; opacity: .35; pointer-events: none; }
.stage-ruler-x { top: 18px; left: 40px; right: 40px; height: 8px; border-top: 1px solid #526078; background: repeating-linear-gradient(90deg, transparent 0 29px, #526078 30px 31px); }
.stage-ruler-y { left: 18px; top: 40px; bottom: 52px; width: 8px; border-left: 1px solid #526078; background: repeating-linear-gradient(0deg, transparent 0 29px, #526078 30px 31px); }

.inspector { border-left: 1px solid var(--line); overflow-y: auto; }
.inspector-heading { height: 55px; }
.inspector-heading > div { display: flex; flex-direction: column; gap: 2px; }
.inspector-heading small { color: var(--muted); font-size: 9px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.property-section { padding: 14px; border-bottom: 1px solid var(--line); }
.field-label, .section-title { color: #9ba7ba; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.text-input, .field-grid input { width: 100%; border: 1px solid #2b3649; border-radius: 6px; background: #101722; color: white; outline: none; }
.text-input { margin-top: 8px; padding: 9px 10px; font-size: 11px; }
.text-input:focus, .field-grid input:focus { border-color: var(--cyan); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.field-grid label { color: #69758a; font-size: 9px; }
.field-grid input { display: block; margin-top: 4px; padding: 7px 8px; font: 10px ui-monospace, monospace; }
.range-field { display: grid; grid-template-columns: 1fr auto; gap: 7px; margin-top: 13px; color: #9ba7ba; font-size: 10px; }
.range-field span { color: #d5dce8; font: 9px ui-monospace, monospace; }
.range-field input { grid-column: 1 / -1; width: 100%; accent-color: var(--green); }
.toggle-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; }
.toggle { padding: 8px; border: 1px solid #293549; border-radius: 6px; background: #111824; color: #7f8ba0; font-size: 9px; cursor: pointer; }
.toggle.active { border-color: #3a6c4b; color: #c8ffd0; background: #14241a; }
.output-card { display: flex; align-items: center; justify-content: space-between; background: linear-gradient(90deg, rgba(83,252,24,.06), transparent); }
.output-card > div { display: flex; flex-direction: column; gap: 4px; }
.output-card small { color: var(--muted); font-size: 9px; }
.output-card button { border: 1px solid #386c45; border-radius: 6px; background: #17271b; color: #bfffaa; padding: 7px 9px; font-size: 9px; cursor: pointer; }

@media (max-height: 680px) {
  .topbar { height: 56px; }
  .app-shell { height: calc(100vh - 56px); }
  .main-nav { display: grid; grid-template-columns: 1fr 1fr; }
  .main-nav a { padding: 7px 9px; }
  .channel-card { padding: 10px 15px; }
}
