:root {
  --bg: #0a0c14;
  --bg-1: #0e111c;
  --bg-2: #141828;
  --bg-3: #1a1f33;
  --pane: rgba(20, 24, 40, 0.72);
  --pane-2: rgba(28, 33, 55, 0.78);
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #e6e9f5;
  --text-2: #a6abc4;
  --text-3: #6b7090;
  --accent: #D9F925;
  --accent-2: #84cc16;
  --accent-3: #f472b6;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 255, 255, .04) inset;
  --r: 10px;
  --r-sm: 6px;
}

#app * {
  box-sizing: border-box
}

#app {
  --bg: #0a0c14;
  --bg-1: #0e111c;
  --bg-2: #141828;
  --bg-3: #1a1f33;
  --pane: rgba(20, 24, 40, 0.72);
  --pane-2: rgba(28, 33, 55, 0.78);
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #e6e9f5;
  --text-2: #a6abc4;
  --text-3: #6b7090;
  --accent: #D9F925;
  --accent-2: #84cc16;
  --accent-3: #f472b6;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 255, 255, .04) inset;
  --r: 10px;
  --r-sm: 6px;

  /* Layout Base */
  display: grid;
  grid-template-rows: 48px 1fr 220px;
  grid-template-columns: 240px 1fr 280px;
  gap: 6px;
  padding: 6px;
  background: radial-gradient(1200px 600px at 20% -20%, rgba(217, 249, 37, .16), transparent 60%), radial-gradient(900px 600px at 110% 110%, rgba(132, 204, 22, .12), transparent 60%), var(--bg);
  color: var(--text);
  font: 13px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Inter, sans-serif;
  user-select: none;
}

#app.is-standalone {
  position: fixed;
  inset: 0;
  height: 100vh;
  width: 100vw;
  z-index: 999999;
}

#app.is-shortcode {
  position: relative;
  height: 100vh;
  min-height: 700px;
  border-radius: var(--r);
  z-index: 10;
}

#app button,
#app input,
#app select,
#app textarea {
  font: inherit;
  color: inherit
}

#app button {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line-2);
  color: var(--text);
  padding: 6px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 500
}

#app button:hover {
  background: var(--bg-3);
  border-color: rgba(255, 255, 255, .18)
}

#app button.primary {
  background: var(--accent);
  border: none;
  color: #0a0c14;
  font-weight: 700;
  box-shadow: 0 0 15px rgba(217, 249, 37, 0.3)
}

#app button.primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px)
}

#app #btnImport,
#app #btnPaste {
  background: var(--bg-3);
  border-color: var(--line-2);
}

#app #btnImport:hover,
#app #btnPaste:hover {
  background: #252b3e;
  border-color: rgba(255, 255, 255, 0.2);
}

button.icon {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center
}

#app button.active {
  background: rgba(217, 249, 37, .2);
  border-color: var(--accent);
  color: #fff;
  box-shadow: inset 0 0 8px rgba(217, 249, 37, 0.2)
}

#app .toolbar button:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Prevent theme scrollbars when in standalone mode */
body.page-template-svg-animator-template {
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

input[type=text],
input[type=number],
input[type=color],
select,
textarea {
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 5px 8px;
  outline: none;
  color: var(--text);
  width: 100%
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent)
}

input[type=range] {
  width: 100%;
  accent-color: var(--accent)
}

input[type=color] {
  padding: 2px;
  height: 28px;
  cursor: pointer
}

.muted {
  color: var(--text-2)
}

.tiny {
  font-size: 11px
}

.row {
  display: flex;
  gap: 6px;
  align-items: center
}

.col {
  display: flex;
  flex-direction: column;
  gap: 6px
}

#app .glass {
  background: var(--pane);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow)
}

#app hr.sep {
  border: none;
  border-top: 1px solid var(--line);
  margin: 8px 0
}

.topbar {
  grid-column: 1/4;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: .4px
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: conic-gradient(from 200deg, #D9F925, #84cc16, #f472b6, #D9F925);
  position: relative
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 3px;
  background: var(--bg-1);
  border-radius: 5px
}

.brand-name {
  background: linear-gradient(120deg, #fff, #a6abc4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent
}

.brand-tag {
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: .6px;
  text-transform: uppercase;
  margin-left: 2px
}

.topbar .spacer {
  flex: 1
}

.toolbar {
  display: flex;
  gap: 4px;
  padding: 0 8px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  height: 32px;
  align-items: center
}

.toolbar button {
  width: 32px;
  height: 28px;
  font-size: 12px
}

.left {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  min-height: 0
}

.center {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative
}

.right {
  grid-column: 3;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  min-height: 0
}

.bottom {
  grid-column: 1/4;
  grid-row: 3;
  display: flex;
  flex-direction: column;
  min-height: 0
}

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  letter-spacing: .3px;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-2)
}

.pane-body {
  flex: 1;
  overflow: auto;
  padding: 8px
}

#stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  border-radius: var(--r);
  background: #0d1020;
  border: 1px solid var(--line)
}

#stageSvg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: default
}

.stage-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  opacity: 0;
  transition: .2s
}

.stage-grid.on {
  opacity: 1
}

.stage-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none
}

.status {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: rgba(10, 12, 20, .7);
  border: 1px solid var(--line);
  padding: 4px 8px;
  border-radius: var(--r-sm);
  font-size: 11px;
  color: var(--text-2);
  display: flex;
  gap: 10px
}

.status .pill {
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--bg-3)
}

.fps {
  position: absolute;
  right: 8px;
  top: 8px;
  background: rgba(10, 12, 20, .7);
  border: 1px solid var(--line);
  padding: 4px 8px;
  border-radius: var(--r-sm);
  font-size: 11px;
  color: var(--text-2);
  display: none;
  font-variant-numeric: tabular-nums
}

.fps.on {
  display: block
}

.layer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 12px;
  border: 1px solid transparent
}

.layer:hover {
  background: var(--bg-2)
}

.layer.selected {
  background: rgba(217, 249, 37, .18);
  border-color: rgba(217, 249, 37, .5)
}

.layer .lbl {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.layer .icon {
  width: 14px;
  height: 14px;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px
}

.layer .vis,
.layer .lock,
.layer .del {
  cursor: pointer;
  color: var(--text-3);
  width: 18px;
  text-align: center;
  font-size: 12px;
  transition: color .15s, transform .1s;
}

.layer .vis:hover,
.layer .lock:hover {
  color: var(--accent);
  transform: scale(1.15);
}

.layer .del:hover {
  color: var(--err);
  transform: scale(1.15);
}

.layer.hidden .lbl {
  opacity: .45;
  text-decoration: line-through
}

.layer.locked .lbl {
  opacity: .7
}

.prop-section {
  margin-bottom: 10px
}

.prop-section h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-2);
  margin: 0 0 6px;
  font-weight: 600
}

.prop-grid {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 4px 8px;
  align-items: center
}

.prop-grid label {
  font-size: 11px;
  color: var(--text-2)
}

.num-drag {
  cursor: ew-resize;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 4px 6px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-size: 12px;
  width: 100%
}

.num-drag:hover {
  border-color: var(--accent)
}

.num-drag.editing {
  cursor: text
}

#timelineWrap {
  display: flex;
  height: 100%;
  border-radius: var(--r);
  overflow: hidden
}

.tl-left {
  width: 240px;
  background: var(--pane);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column
}

.tl-area {
  flex: 1;
  background: var(--pane-2);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden
}

.tl-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  height: 34px
}

#tlRuler {
  height: 24px;
  border-bottom: 1px solid var(--line);
  position: relative;
  background: linear-gradient(var(--bg-2), var(--bg-1));
  overflow: hidden;
  cursor: ew-resize
}

.ruler-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--line);
  font-size: 10px;
  color: var(--text-3);
  padding: 2px 0 0 3px
}

.tl-rows-wrap {
  flex: 1;
  overflow: auto;
  position: relative
}

#tlRows {
  position: relative;
  min-height: 100%
}

.tl-row {
  height: 24px;
  border-bottom: 1px solid var(--line);
  position: relative
}

.tl-row:nth-child(odd) {
  background: rgba(255, 255, 255, .012)
}

.tl-track-head {
  height: 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  color: var(--text-2);
  gap: 6px;
  cursor: pointer
}

.tl-track-head:hover {
  background: var(--bg-2)
}

.tl-track-head.selected {
  background: rgba(217, 249, 37, .15);
  color: var(--text)
}

.tl-track-head .swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent)
}

.tl-keyframe {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  background: linear-gradient(135deg, #fff, #c4cbe6);
  transform: translate(-50%, -50%) rotate(45deg);
  border-radius: 2px;
  cursor: grab;
  box-shadow: 0 0 0 1px var(--bg-1), 0 0 0 2px rgba(217, 249, 37, .5)
}

.tl-keyframe.selected {
  background: linear-gradient(135deg, #D9F925, #84cc16);
  box-shadow: 0 0 0 1px var(--bg-1), 0 0 0 2px var(--accent-3)
}

.tl-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #f472b6;
  pointer-events: none;
  z-index: 10
}

.tl-playhead::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -5px;
  width: 11px;
  height: 8px;
  background: #f472b6;
  clip-path: polygon(0 0, 100% 0, 50% 100%)
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100
}

.modal.open {
  display: flex
}

.modal-card {
  width: min(900px, 92vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden
}

.modal-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between
}

.modal-body {
  padding: 14px 16px;
  overflow: auto
}

.modal-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 8px
}

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
  flex-wrap: wrap
}

.tab {
  padding: 8px 12px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 12px
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent)
}

pre.code-out {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px;
  font: 12px/1.5 ui-monospace, Menlo, monospace;
  color: #cdd3ec;
  max-height: 50vh;
  overflow: auto;
  white-space: pre-wrap
}

.snap-guide {
  position: absolute;
  background: rgba(244, 114, 182, .9);
  pointer-events: none;
  z-index: 50
}

.snap-guide.h {
  height: 1px;
  left: 0;
  right: 0
}

.snap-guide.v {
  width: 1px;
  top: 0;
  bottom: 0
}

#selBox {
  position: absolute;
  border: 1px solid var(--accent);
  pointer-events: none;
  display: none;
  border-radius: 1px
}

.handle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #fff;
  border: 1px solid var(--accent);
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: nwse-resize
}

.handle.rot {
  background: var(--accent-3);
  border-radius: 50%;
  cursor: grab;
  border-color: #fff
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  z-index: 200;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: .2s;
  pointer-events: none
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -6px)
}

.toast.ok {
  border-color: var(--ok);
  color: var(--ok)
}

.toast.warn {
  border-color: var(--warn);
  color: var(--warn)
}

.toast.err {
  border-color: var(--err);
  color: var(--err)
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px
}

::-webkit-scrollbar-track {
  background: transparent
}

::-webkit-scrollbar-thumb {
  background: var(--bg-3);
  border-radius: 6px
}

::-webkit-scrollbar-thumb:hover {
  background: #252b46
}

/* perf overlay (upgraded) */
.fps {
  min-width: 170px;
  padding: 6px 10px
}

.fps-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4
}

.fps-row .k {
  color: var(--text-3)
}

.fps-row .v {
  color: var(--text)
}

.fps canvas {
  display: block;
  width: 150px;
  height: 28px;
  margin-top: 4px;
  border-top: 1px solid var(--line)
}

.fps .warn {
  color: var(--warn)
}

.fps .err {
  color: var(--err)
}

/* warnings panel */
#btnWarn {
  position: relative
}

#btnWarn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--warn);
  color: #000;
  font-size: 9px;
  font-weight: 700;
  border-radius: 8px;
  padding: 1px 4px;
  line-height: 1.2;
  min-width: 14px;
  text-align: center
}

#btnWarn .badge.zero {
  display: none
}

#btnWarn .badge.err {
  background: var(--err);
  color: #fff
}

.warn-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 55vh;
  overflow: auto
}

.warn-row {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  align-items: flex-start
}

.warn-row.severity-error {
  border-left: 3px solid var(--err)
}

.warn-row.severity-warn {
  border-left: 3px solid var(--warn)
}

.warn-row.severity-info {
  border-left: 3px solid var(--accent-2)
}

.warn-row .ico {
  width: 18px;
  flex-shrink: 0;
  font-size: 14px;
  line-height: 1.4
}

.warn-row .body {
  flex: 1;
  min-width: 0
}

.warn-row .msg {
  font-size: 12px;
  line-height: 1.4
}

.warn-row .target {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 2px;
  font-family: ui-monospace, monospace
}

.warn-row .actions {
  display: flex;
  gap: 4px
}

.warn-row button {
  padding: 3px 8px;
  font-size: 11px
}

.warn-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-2);
  font-size: 12px
}

/* timeline marquee */
.tl-marquee {
  position: absolute;
  border: 1px dashed var(--accent-2);
  background: rgba(132, 204, 22, .08);
  pointer-events: none;
  z-index: 60
}