:root {
  color-scheme: dark;
  --bg: #101014;
  --surface-0: #15151a;
  --surface-1: #19191f;
  --surface-2: #202027;
  --surface-3: #27272f;
  --surface-4: #303039;
  --line: #34343e;
  --line-strong: #454550;
  --text: #f6f6f8;
  --text-soft: #b5b5be;
  --text-muted: #777782;
  --accent: #4b37f2;
  --accent-strong: #5b47ff;
  --accent-soft: rgba(75, 55, 242, 0.2);
  --red: #e42537;
  --green: #21cc69;
  --amber: #f4b740;
  --radius: 8px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid #7b6cff;
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: 266px minmax(580px, 1fr) 306px;
  grid-template-rows: 58px minmax(0, 1fr) 34px;
  width: 100vw;
  height: 100vh;
  background: var(--surface-0);
}

.topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 266px auto minmax(180px, 1fr) auto;
  align-items: center;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  background: #17171c;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 100%;
  padding: 0 18px;
  border-right: 1px solid var(--line);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand-mark {
  display: inline-block;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-mark.small {
  width: 15px;
  height: 15px;
}

.file-actions,
.topbar-actions,
.tool-group,
.transport-controls,
.status-items,
.stage-meta {
  display: flex;
  align-items: center;
}

.file-actions {
  height: 100%;
  gap: 3px;
  padding: 0 12px;
}

.topbar-actions {
  gap: 8px;
  padding-right: 14px;
}

.project-identity {
  min-width: 0;
  justify-self: center;
  text-align: center;
}

.project-identity input {
  width: min(360px, 90%);
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  text-align: center;
}

.project-identity input:hover,
.project-identity input:focus {
  border-color: var(--line-strong);
  background: var(--surface-1);
}

.save-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 10px;
}

.toolbar-button,
.icon-button,
.secondary-button,
.primary-button,
.tool-button,
.add-layer-button {
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms ease;
}

.toolbar-button:hover,
.icon-button:hover,
.tool-button:hover,
.add-layer-button:hover {
  background: var(--surface-3);
}

.toolbar-button:active,
.icon-button:active,
.secondary-button:active,
.primary-button:active,
.tool-button:active,
.add-layer-button:active {
  transform: translateY(1px);
}

.toolbar-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 31px;
  padding: 0 9px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.toolbar-button.small {
  min-height: 28px;
  padding: 0 8px;
  border-color: var(--line);
  background: var(--surface-1);
  font-size: 11px;
}

.toolbar-button[aria-pressed="true"] {
  border-color: rgba(91, 71, 255, 0.7);
  background: var(--accent-soft);
  color: #d8d3ff;
}

.toolbar-divider {
  width: 1px;
  height: 22px;
  margin: 0 5px;
  background: var(--line);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 31px;
  height: 31px;
  color: var(--text-soft);
  font-size: 16px;
}

.icon-button.compact {
  width: 27px;
  height: 27px;
  font-size: 13px;
}

.icon-button:disabled,
.toolbar-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.secondary-button,
.primary-button {
  min-height: 34px;
  padding: 0 13px;
  font-size: 12px;
  font-weight: 750;
}

.secondary-button {
  border-color: var(--line-strong);
  background: #1b1b20;
}

.secondary-button:hover {
  background: var(--surface-3);
}

.primary-button {
  border-color: var(--accent-strong);
  background: var(--accent);
  box-shadow: 0 8px 22px rgba(75, 55, 242, 0.22);
}

.primary-button:hover {
  background: var(--accent-strong);
}

.left-panel,
.inspector-panel {
  min-width: 0;
  min-height: 0;
  background: var(--surface-1);
}

.left-panel {
  border-right: 1px solid var(--line);
}

.inspector-panel {
  border-left: 1px solid var(--line);
}

.panel-tabs {
  display: flex;
  height: 43px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: #18181d;
}

.panel-tab {
  position: relative;
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.panel-tab::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 0;
  left: 10px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: transparent;
}

.panel-tab.active {
  color: var(--text);
}

.panel-tab.active::after {
  background: var(--accent-strong);
}

.panel-view,
.inspector-view {
  display: none;
  height: calc(100% - 43px);
  min-height: 0;
  overflow: auto;
}

.panel-view.active,
.inspector-view.active {
  display: block;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 61px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-heading strong,
.panel-heading small {
  display: block;
}

.panel-heading strong {
  font-size: 12px;
}

.panel-heading small {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 10px;
}

.layer-list {
  padding: 6px 6px 8px;
}

.layer-row {
  display: grid;
  grid-template-columns: 24px 27px minmax(0, 1fr) 26px 26px;
  align-items: center;
  gap: 2px;
  min-height: 39px;
  padding: 0 4px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-soft);
  cursor: default;
  user-select: none;
}

.layer-row:hover {
  background: #202026;
}

.layer-row.selected {
  border-color: rgba(91, 71, 255, 0.6);
  background: var(--accent-soft);
  color: var(--text);
}

.layer-row[draggable="true"] {
  cursor: grab;
}

.layer-row.dragging {
  opacity: 0.45;
}

.layer-handle {
  color: #5c5c67;
  font-size: 11px;
  text-align: center;
}

.layer-icon,
.layer-visibility,
.layer-lock {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #90909a;
  cursor: pointer;
  font-size: 11px;
}

.layer-icon {
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: #cbcbd2;
  font-weight: 750;
}

.layer-name {
  overflow: hidden;
  padding-left: 5px;
  font-size: 12px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-visibility.off,
.layer-lock.off {
  color: #4d4d57;
}

.add-menu {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.add-layer-button {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-height: 58px;
  padding: 7px 4px;
  border-color: var(--line);
  background: #1c1c22;
  color: var(--text-soft);
  font-size: 10px;
}

.layer-type-icon {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--text);
  font-weight: 800;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

.asset-card {
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-0);
  cursor: pointer;
}

.asset-card:hover {
  border-color: var(--accent-strong);
}

.asset-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 4px;
  background-image: linear-gradient(45deg, #23232a 25%, transparent 25%), linear-gradient(-45deg, #23232a 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #23232a 75%), linear-gradient(-45deg, transparent 75%, #23232a 75%);
  background-position: 0 0, 0 5px, 5px -5px, -5px 0;
  background-size: 10px 10px;
}

.asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.asset-card span {
  display: block;
  overflow: hidden;
  margin-top: 6px;
  color: var(--text-soft);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 48px 22px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 5px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: #8c8c98;
  font-size: 24px;
}

.empty-state strong {
  color: var(--text-soft);
  font-size: 12px;
}

.empty-state small {
  max-width: 190px;
  line-height: 1.5;
}

.editor-main {
  display: grid;
  grid-template-rows: minmax(280px, 1fr) 284px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #111116;
}

.stage-section {
  display: grid;
  grid-template-rows: 43px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.stage-toolbar,
.timeline-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  background: #1a1a20;
}

.stage-toolbar {
  justify-content: space-between;
  padding: 0 10px;
}

.tool-group {
  gap: 3px;
}

.tool-button {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  color: var(--text-soft);
  font-weight: 800;
}

.tool-button.active {
  background: var(--accent-soft);
  color: #dcd8ff;
}

.stage-meta {
  gap: 10px;
  color: var(--text-muted);
  font-size: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 23px;
  padding: 0 8px;
  border: 1px solid rgba(33, 204, 105, 0.25);
  border-radius: 999px;
  background: rgba(33, 204, 105, 0.06);
  color: #88dfa9;
  font-weight: 700;
}

.zoom-control {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 10px;
}

.zoom-control input {
  width: 72px;
  accent-color: var(--accent-strong);
}

.zoom-control output {
  width: 33px;
  color: var(--text-soft);
  text-align: right;
}

.canvas-viewport {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background-color: #0d0d11;
  background-image: radial-gradient(circle, #292932 1px, transparent 1px);
  background-size: 18px 18px;
}

.canvas-viewport.hand-mode {
  cursor: grab;
  touch-action: none;
}

.canvas-viewport.hand-mode.dragging {
  cursor: grabbing;
}

.canvas-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center center;
  will-change: transform;
  box-shadow: 0 26px 72px rgba(0, 0, 0, 0.6), 0 0 0 1px #3e3e48;
}

.graphics-canvas {
  position: relative;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  background: transparent;
  transform-origin: top left;
  user-select: none;
}

.transparent-grid {
  position: absolute;
  inset: 0;
  background-color: #cfd2d8;
  background-image: linear-gradient(45deg, #b8bcc5 25%, transparent 25%), linear-gradient(-45deg, #b8bcc5 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #b8bcc5 75%), linear-gradient(-45deg, transparent 75%, #b8bcc5 75%);
  background-position: 0 0, 0 20px, 20px -20px, -20px 0;
  background-size: 40px 40px;
}

.safe-area {
  position: absolute;
  z-index: 9990;
  inset: 5%;
  border: 2px dashed rgba(255, 255, 255, 0.48);
  pointer-events: none;
}

.safe-area::after {
  content: "";
  position: absolute;
  inset: 5.55%;
  border: 1px dashed rgba(255, 255, 255, 0.3);
}

.safe-area span {
  position: absolute;
  top: 8px;
  left: 10px;
  padding: 4px 7px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.48);
  color: rgba(255, 255, 255, 0.78);
  font-size: 18px;
}

.stage-elements {
  position: absolute;
  inset: 0;
}

.stage-element {
  position: absolute;
  transform-origin: center center;
  cursor: move;
}

.stage-element.text-layer {
  display: flex;
  white-space: pre-wrap;
}

.stage-element.image-layer img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.stage-element.selected::after {
  content: "";
  position: absolute;
  z-index: 10000;
  inset: -3px;
  border: 2px solid #6a57ff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65) inset;
  pointer-events: none;
}

.stage-element.selected::before {
  content: "";
  position: absolute;
  z-index: 10001;
  right: -8px;
  bottom: -8px;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 2px;
  background: #6a57ff;
  pointer-events: none;
}

.timeline-section {
  display: grid;
  grid-template-rows: 43px 34px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  border-top: 1px solid var(--line);
  background: #17171c;
}

.timeline-toolbar {
  padding: 0 10px;
}

.transport-controls {
  gap: 2px;
}

.icon-button.transport {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.primary-transport {
  background: var(--accent);
  color: white;
}

.time-display {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 132px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.time-display small {
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 600;
}

.diamond {
  color: #d7d1ff;
  font-size: 9px;
}

.timeline-spacer {
  flex: 1;
}

.timeline-hint {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-lanes {
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  min-width: 0;
  border-bottom: 1px solid var(--line);
  background: #1b1b21;
}

.timeline-label-spacer {
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-right: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.action-lane-track {
  position: relative;
  overflow: hidden;
}

.action-range {
  position: absolute;
  top: 5px;
  bottom: 5px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  overflow: hidden;
  border-radius: 4px;
  color: white;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-range.in {
  background: #4932e8;
}

.action-range.hold {
  background: #285e8b;
}

.action-range.update {
  background: #9c681b;
}

.action-range.out {
  background: #a62942;
}

.timeline-scroll {
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.timeline-labels {
  position: sticky;
  left: 0;
  z-index: 5;
  padding-top: 24px;
  border-right: 1px solid var(--line);
  background: #18181e;
}

.timeline-label-row,
.timeline-row {
  height: 31px;
  border-bottom: 1px solid #2b2b33;
}

.timeline-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 9px;
  color: var(--text-soft);
  font-size: 10px;
}

.timeline-label-row.selected {
  background: var(--accent-soft);
  color: white;
}

.timeline-label-row span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-track {
  position: relative;
  min-width: 760px;
  min-height: 100%;
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: calc(100% / 15) 100%;
}

.frame-ruler {
  position: relative;
  height: 24px;
  border-bottom: 1px solid var(--line);
  background: #1c1c22;
  cursor: crosshair;
}

.ruler-tick {
  position: absolute;
  bottom: 0;
  width: 1px;
  height: 7px;
  background: #5a5a66;
}

.ruler-tick.major {
  height: 11px;
}

.ruler-tick span {
  position: absolute;
  top: -9px;
  left: 4px;
  color: #8e8e98;
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.timeline-row {
  position: relative;
  background: rgba(255, 255, 255, 0.01);
}

.timeline-row:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.timeline-row.selected {
  background: rgba(75, 55, 242, 0.1);
}

.keyframe {
  position: absolute;
  top: 11px;
  width: 9px;
  height: 9px;
  border: 1px solid #e8e5ff;
  background: var(--accent-strong);
  transform: translateX(-50%) rotate(45deg);
  cursor: ew-resize;
}

.keyframe:hover,
.keyframe.active {
  width: 11px;
  height: 11px;
  top: 10px;
  background: #fff;
}

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

.playhead span {
  position: absolute;
  top: 0;
  left: -5px;
  width: 11px;
  height: 13px;
  border-radius: 2px 2px 6px 6px;
  background: #ff4053;
}

.inspector-tabs {
  padding: 0 8px;
}

.inspector-view {
  padding-bottom: 30px;
}

.inspector-header {
  padding: 15px 14px 13px;
  border-bottom: 1px solid var(--line);
}

.inspector-header .eyebrow,
.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--accent-strong);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.inspector-header h3 {
  margin: 0;
  font-size: 14px;
}

.inspector-section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.inspector-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 11px;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.field-grid.single {
  grid-template-columns: 1fr;
}

.field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.field.wide {
  grid-column: 1 / -1;
}

.field label,
.field > span {
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.modal input,
.modal select,
.modal textarea {
  width: 100%;
  min-width: 0;
  min-height: 31px;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #15151a;
  color: var(--text);
  font-size: 11px;
}

.field textarea,
.modal textarea {
  min-height: 66px;
  resize: vertical;
}

.field input[type="color"] {
  height: 31px;
  padding: 3px;
}

.field input[type="range"] {
  padding: 0;
  accent-color: var(--accent-strong);
}

.field-inline {
  display: grid;
  grid-template-columns: 1fr 46px;
  gap: 6px;
  align-items: center;
}

.inspector-actions {
  display: flex;
  gap: 7px;
  padding: 13px 14px;
}

.inspector-actions button {
  flex: 1;
}

.danger-button {
  border: 1px solid rgba(228, 37, 55, 0.4);
  border-radius: 6px;
  background: rgba(228, 37, 55, 0.08);
  color: #ff8691;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.data-field-card {
  margin-bottom: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #1b1b20;
}

.data-field-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.data-field-card header strong {
  font-size: 11px;
}

.data-field-card header code {
  color: #8e84ff;
  font-size: 9px;
}

.data-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 10px;
}

.validation-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.validation-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #1b1b20;
}

.validation-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(33, 204, 105, 0.12);
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
}

.validation-item strong,
.validation-item small {
  display: block;
}

.validation-item strong {
  font-size: 10px;
}

.validation-item small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.35;
}

.statusbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 266px minmax(0, 1fr);
  align-items: center;
  border-top: 1px solid var(--line);
  background: #141419;
  color: var(--text-muted);
  font-size: 9px;
}

.status-brand {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 100%;
  padding: 0 17px;
  border-right: 1px solid var(--line);
  color: white;
  font-size: 11px;
}

.status-items {
  justify-content: center;
  gap: 18px;
  overflow: hidden;
  padding: 0 12px;
  white-space: nowrap;
}

.status-items > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(33, 204, 105, 0.6);
}

.status-dot.green {
  background: var(--green);
}

.status-dot.amber {
  background: var(--amber);
  box-shadow: 0 0 8px rgba(244, 183, 64, 0.5);
}

.modal-backdrop {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 30px;
  background: rgba(5, 5, 8, 0.72);
  backdrop-filter: blur(8px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(600px, 100%);
  max-height: min(760px, calc(100vh - 60px));
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #1c1c22;
  box-shadow: var(--shadow);
}

.modal.wide {
  width: min(920px, 100%);
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
}

.modal-header {
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.modal-body {
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding: 18px;
}

.modal-footer {
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line);
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.preview-shell {
  display: grid;
  gap: 14px;
}

.preview-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background-color: #cfd2d8;
  background-image: linear-gradient(45deg, #b8bcc5 25%, transparent 25%), linear-gradient(-45deg, #b8bcc5 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #b8bcc5 75%), linear-gradient(-45deg, transparent 75%, #b8bcc5 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.preview-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 1920px;
  height: 1080px;
  transform-origin: top left;
}

.preview-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.preview-data {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.export-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.export-card {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #18181d;
}

.export-card h3 {
  margin: 0 0 10px;
  font-size: 12px;
}

.export-copy {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.55;
}

.file-tree {
  margin: 0;
  padding: 10px;
  border-radius: 5px;
  background: #101014;
  color: #aaa4ef;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.toast-region {
  position: fixed;
  z-index: 12000;
  right: 18px;
  bottom: 50px;
  display: grid;
  gap: 8px;
  width: min(340px, calc(100vw - 36px));
}

.toast {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #232329;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
  animation: toast-in 180ms ease-out both;
}

.toast.success .toast-symbol {
  color: var(--green);
}

.toast.warning .toast-symbol {
  color: var(--amber);
}

.toast strong,
.toast small {
  display: block;
}

.toast strong {
  font-size: 11px;
}

.toast small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.4;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 224px minmax(500px, 1fr) 278px;
  }

  .topbar {
    grid-template-columns: 224px auto minmax(120px, 1fr) auto;
  }

  .brand span + div,
  .toolbar-button span:last-child,
  .timeline-hint,
  .stage-meta {
    display: none;
  }

  .statusbar {
    grid-template-columns: 224px minmax(0, 1fr);
  }

  .status-items {
    gap: 10px;
  }
}

@media (max-height: 720px) {
  .editor-main {
    grid-template-rows: minmax(250px, 1fr) 230px;
  }
}
