@font-face {
  font-family: "Cooper";
  src: url("/fonts/cooper-black.ttf") format("truetype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Suisse";
  src: url("/fonts/SuisseIntl-Book.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Suisse";
  src: url("/fonts/SuisseIntl-SemiBold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0a0a0a;
  --panel: #181818;
  --panel-2: #202020;
  --panel-3: #2c2c2c;
  --ink: #f6f6f0;
  --muted: #9b9b96;
  --line: rgba(255, 255, 255, 0.12);
  --hot: #d72f21;
  --green: #2e7953;
  --blue: #5a8dff;
  --frame-ratio: 16 / 9;
  --split: 43%;
  --playhead-x: 0%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Suisse", Arial, sans-serif;
  font-size: 12px;
  letter-spacing: 0;
}

body {
  overflow: hidden;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel-2);
  color: var(--ink);
  cursor: pointer;
}

button:hover,
button:focus-visible,
input:focus,
select:focus,
textarea:focus {
  border-color: rgba(255, 255, 255, 0.34);
  outline: none;
}

img,
video {
  display: block;
  max-width: 100%;
}

.editor-shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  grid-template-rows: 48px minmax(0, 1fr) 260px;
  background: var(--bg);
}

.editor-topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto 150px;
  align-items: center;
  gap: 12px;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  background: #111;
  padding: 8px 12px;
}

.project-title {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.project-title strong {
  font-size: 13px;
  text-transform: uppercase;
  white-space: nowrap;
}

.project-title span,
.compact-field span {
  color: var(--muted);
  white-space: nowrap;
}

.transport {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.transport button {
  min-height: 28px;
  padding: 0 10px;
}

.transport button[data-action="play"] {
  background: var(--green);
  border-color: color-mix(in srgb, var(--green) 74%, white);
}

.transport button[data-action="delete"] {
  color: #ffd7d3;
  background: color-mix(in srgb, var(--hot) 62%, #111);
}

.compact-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.compact-field input {
  width: 100%;
}

.stage-zone {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background:
    linear-gradient(45deg, rgba(255,255,255,0.035) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.035) 75%),
    linear-gradient(45deg, rgba(255,255,255,0.035) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.035) 75%),
    #080808;
  background-position: 0 0, 12px 12px, 0 0;
  background-size: 24px 24px, 24px 24px, auto;
}

.composition-frame {
  position: relative;
  width: min(100%, calc((100dvh - 330px) * 16 / 9));
  aspect-ratio: var(--frame-ratio);
  max-height: calc(100dvh - 330px);
  background: #000;
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.42);
}

.media-layer,
.text-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.media-layer {
  object-fit: cover;
  object-position: center;
  opacity: 0;
}

.media-layer.is-visible {
  opacity: 1;
}

.split-rule {
  position: absolute;
  z-index: 4;
  top: 0;
  bottom: 0;
  left: var(--split);
  width: 1px;
  background: rgba(255, 255, 255, 0.28);
  transform: translateX(-0.5px);
  pointer-events: none;
}

.text-stage {
  z-index: 5;
  pointer-events: none;
}

.text-layer {
  position: absolute;
  z-index: 6;
  display: none;
  min-width: 28px;
  color: #fff;
  text-transform: uppercase;
  white-space: pre-wrap;
  cursor: text;
  pointer-events: auto;
  user-select: text;
}

.text-layer.is-visible {
  display: block;
}

.text-layer.is-selected {
  z-index: 12 !important;
  outline: 1px solid var(--blue);
  outline-offset: 4px;
}

.text-layer[data-side="left"] {
  left: 3%;
  width: calc(var(--split) - 6%);
}

.text-layer[data-side="right"] {
  left: calc(var(--split) + 3%);
  width: calc(97% - var(--split));
}

.text-layer[data-role="heading"] {
  z-index: 8;
  font-family: "Cooper", Georgia, serif;
  font-size: calc(clamp(26px, 7.6vw, 124px) * var(--layer-size, 1));
  font-weight: 900;
  line-height: 0.82;
}

.text-layer[data-role="kicker"],
.text-layer[data-role="body"] {
  z-index: 7;
  font-family: "Suisse", Arial, sans-serif;
  font-size: calc(clamp(8px, 1vw, 15px) * var(--layer-size, 1));
  font-weight: 700;
  line-height: 1.12;
}

.inspector {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: var(--panel);
}

.inspector-empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  color: var(--muted);
}

.inspector-form {
  display: grid;
  gap: 0;
}

.inspector-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.inspector-header span {
  color: var(--hot);
  font-weight: 700;
  text-transform: uppercase;
}

.inspector-header strong {
  color: var(--muted);
  font-size: 11px;
}

.inspector label {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.inspector label span {
  color: var(--muted);
}

.inspector input,
.inspector select,
.inspector textarea {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #101010;
  color: var(--ink);
  padding: 7px 8px;
}

.inspector textarea {
  resize: vertical;
}

.inspector input[type="range"] {
  padding: 0;
}

.inspector output {
  color: var(--muted);
  text-align: right;
}

.timeline-zone {
  grid-column: 1 / -1;
  min-width: 0;
  min-height: 0;
  border-top: 1px solid var(--line);
  background: #121212;
  display: grid;
  grid-template-rows: 42px minmax(0, 1fr);
}

.timebar {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.timebar span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.timebar span:last-child {
  text-align: right;
}

.timebar input {
  width: 100%;
}

.timeline-shell {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
}

.timeline-label-column {
  min-width: 0;
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.ruler-label,
.timeline-ruler {
  height: 28px;
  border-bottom: 1px solid var(--line);
}

.ruler-label {
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: var(--muted);
  text-transform: uppercase;
}

.layer-label {
  width: 100%;
  height: 30px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: #d8d8d2;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}

.layer-label.is-selected {
  background: rgba(90, 141, 255, 0.18);
}

.layer-label-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  background: var(--layer-color, var(--blue));
}

.layer-label span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-main {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.timeline-ruler {
  position: relative;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.15) 0 1px, transparent 1px 80px),
    #171717;
}

.ruler-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.28);
}

.ruler-tick span {
  position: absolute;
  top: 7px;
  left: 4px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.timeline-tracks {
  position: relative;
  min-height: 170px;
  cursor: crosshair;
}

.timeline-row {
  position: relative;
  height: 30px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.layer-bar {
  position: absolute;
  top: 5px;
  height: 20px;
  min-width: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: color-mix(in srgb, var(--layer-color, var(--blue)) 64%, #111);
  cursor: grab;
}

.layer-bar.is-selected {
  border-color: #fff;
  box-shadow: 0 0 0 1px rgba(90, 141, 255, 0.8);
}

.layer-bar:active {
  cursor: grabbing;
}

.trim-handle {
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 8px;
  background: rgba(255, 255, 255, 0.42);
  cursor: ew-resize;
}

.trim-handle-start {
  left: -4px;
}

.trim-handle-end {
  right: -4px;
}

.bar-title {
  position: absolute;
  inset: 0 10px;
  display: flex;
  align-items: center;
  overflow: hidden;
  color: #fff;
  font-size: 10px;
  white-space: nowrap;
  pointer-events: none;
}

.timeline-playhead {
  position: absolute;
  z-index: 20;
  top: 0;
  bottom: 0;
  left: var(--playhead-x);
  width: 2px;
  background: #fff;
  transform: translateX(-1px);
  pointer-events: none;
}

.timeline-playhead::before {
  content: "";
  position: absolute;
  top: 0;
  left: -5px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid #fff;
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .editor-shell {
    min-height: 100dvh;
    height: auto;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(260px, auto) auto minmax(260px, auto);
  }

  .editor-topbar {
    grid-template-columns: 1fr;
  }

  .transport {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .stage-zone {
    min-height: 300px;
  }

  .composition-frame {
    width: min(100%, 760px);
    max-height: none;
  }

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

  .timeline-zone {
    grid-column: auto;
  }
}
