@font-face {
  font-family: "Reset Medium";
  src: url("./Reset/ResetMedium-Medium.otf") format("opentype");
  font-display: block;
}

@font-face {
  font-family: "Reset Stencil Medium";
  src: url("./Reset/ResetMedium-StencilMedium.otf") format("opentype");
  font-display: block;
}

@font-face {
  font-family: "Reset Pixel";
  src: url("./Reset/ResetPixel-Medium.otf") format("opentype");
  font-display: block;
}

@font-face {
  font-family: "Reset Stencil Variable";
  src: url("./Reset/ResetStencilVariableVF.ttf") format("truetype");
  font-display: block;
}

:root {
  --design-w: 1080px;
  --design-h: 1920px;
  --stage-scale: 0.42;
  --xopq: 520;
  --yopq: 460;
  --type-line-height: 0.94;
  --type-pad-x: 8%;
  --type-pad-y: 9%;
  --type-font-family: "Reset Stencil Medium";
  --type-feature-settings: normal;
  --text-y: 0px;
  --text-stroke-width: 0.8px;
  --text-edge-x: 0px;
  --text-edge-opacity: 0.62;
  --text-opacity: 0.96;
  --shader-blur: 0px;
  --shader-blur-scale: 1;
  --shader-saturate: 1.08;
  --shader-brightness: 1;
  --grain-opacity: 0.16;
  --grain-hit: 0.12;
  --bass-drive: 0;
  --hit-drive: 0;
  --overall-drive: 0;
  --font-size-main: 96px;
  --line-gap: 58px;
  --panel-bg: rgba(20, 7, 6, 0.78);
  --panel-border: rgba(255, 211, 207, 0.18);
  --panel-text: rgba(255, 244, 241, 0.94);
  --panel-muted: rgba(255, 226, 222, 0.58);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #070000;
}

body {
  min-height: 100vh;
  color: var(--panel-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input {
  color: inherit;
}

button {
  cursor: pointer;
}

.studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 21rem;
  gap: 1rem;
  align-items: start;
  min-height: 100vh;
  padding: 1rem;
  background: #070000;
}

.preview-zone {
  min-width: 0;
  min-height: calc(100vh - 2rem);
  display: grid;
  place-items: center;
  position: sticky;
  top: 1rem;
}

.artboard-shell {
  width: 100%;
  height: calc(100vh - 2rem);
  display: grid;
  place-items: center;
}

.reel-frame {
  position: relative;
  overflow: hidden;
  background: #140000;
  box-shadow: 0 1.4rem 5rem rgba(0, 0, 0, 0.56);
  contain: strict;
}

.reel-design {
  position: absolute;
  inset: 0 auto auto 0;
  width: var(--design-w);
  height: var(--design-h);
  overflow: hidden;
  transform: scale(var(--stage-scale));
  transform-origin: top left;
  background: #130000;
  isolation: isolate;
}

.shader-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: block;
  filter: blur(var(--shader-blur)) saturate(var(--shader-saturate)) brightness(var(--shader-brightness));
  transform: scale(var(--shader-blur-scale));
  transform-origin: center;
}

.ascii-canvas {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: none;
  mix-blend-mode: screen;
}

.grain-canvas {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: calc(var(--grain-opacity) + var(--hit-drive) * var(--grain-hit));
  mix-blend-mode: soft-light;
}

.dither-canvas {
  position: absolute;
  inset: 0;
  z-index: 8;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: block;
  opacity: 0.28;
  mix-blend-mode: normal;
  image-rendering: pixelated;
}

.segment-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: var(--type-pad-y) var(--type-pad-x);
  pointer-events: none;
}

.segment-layer.is-disabled {
  display: none;
}

.segment-layer.effects-disabled .segment-copy {
  -webkit-text-stroke: 0;
  paint-order: normal;
  filter: none;
  mix-blend-mode: normal;
  text-shadow: none;
}

.segment {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: inherit;
  opacity: 0;
  transform: none;
  filter: none;
  will-change: opacity, transform;
}

.segment.is-active {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  filter: none;
}

.segment-copy {
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  color: rgba(255, 244, 240, var(--text-opacity));
  -webkit-text-fill-color: currentColor;
  text-align: center;
  font-family: var(--type-font-family), Impact, sans-serif;
  font-size: var(--font-size-main);
  line-height: var(--type-line-height);
  letter-spacing: 0;
  font-feature-settings: var(--type-feature-settings);
  font-variation-settings: "xopq" var(--xopq), "yopq" var(--yopq);
  -webkit-text-stroke: var(--text-stroke-width) rgba(255, 215, 198, 0.72);
  paint-order: stroke fill;
  filter: url("#textResonance");
  mix-blend-mode: screen;
  text-shadow:
    var(--text-edge-x) 0 rgba(255, 52, 18, var(--text-edge-opacity)),
    calc(var(--text-edge-x) * -0.55) 0 rgba(255, 226, 202, calc(var(--text-edge-opacity) * 0.45));
  transform: translate3d(0, var(--text-y), 0);
  transform-origin: center;
}

.segment-layer.type-black .segment-copy {
  color: rgba(0, 0, 0, var(--text-opacity));
  -webkit-text-fill-color: rgba(0, 0, 0, var(--text-opacity));
  -webkit-text-stroke-color: rgba(0, 0, 0, 0.72);
  mix-blend-mode: normal;
  text-shadow:
    var(--text-edge-x) 0 rgba(0, 0, 0, var(--text-edge-opacity)),
    calc(var(--text-edge-x) * -0.55) 0 rgba(72, 0, 0, calc(var(--text-edge-opacity) * 0.45));
}

.segment-layer.effects-disabled.type-black .segment-copy {
  color: rgba(0, 0, 0, var(--text-opacity));
  -webkit-text-fill-color: rgba(0, 0, 0, var(--text-opacity));
  -webkit-text-stroke: 0;
  filter: none;
  mix-blend-mode: normal;
  text-shadow: none;
}

.segment-copy span {
  display: block;
  max-width: 100%;
  white-space: nowrap;
}

.segment-copy .line-gap {
  white-space: normal;
}

.segment-copy .line-gap {
  height: var(--line-gap);
}

.start-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: transparent;
  font-family: var(--type-font-family), Impact, sans-serif;
  font-size: 72px;
  letter-spacing: 0;
  font-variation-settings: "xopq" 560, "yopq" 260;
  text-shadow: none;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.start-overlay span {
  display: none;
}

body.has-started .start-overlay,
body.is-recording-clean .start-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.control-panel {
  align-self: stretch;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0.9rem;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 1rem 4rem rgba(0, 0, 0, 0.28);
  overflow: visible;
  scrollbar-color: rgba(255, 224, 220, 0.24) transparent;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--panel-muted);
  font-size: 0.72rem;
}

.panel-header h1 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.12;
  font-weight: 650;
  letter-spacing: 0;
}

.status-pill {
  margin: 0;
  padding: 0.28rem 0.46rem;
  border: 1px solid rgba(255, 225, 221, 0.18);
  border-radius: 999px;
  color: rgba(255, 232, 228, 0.82);
  font-size: 0.72rem;
  white-space: nowrap;
}

.button-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.55rem 2.55rem 2.55rem;
  gap: 0.55rem;
}

.primary-button,
.secondary-button {
  min-height: 2.55rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 224, 219, 0.2);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.primary-button {
  background: rgba(255, 235, 230, 0.94);
  color: #240000;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.08);
}

.type-icon-button,
.record-icon-button,
.fullscreen-icon-button {
  min-height: 2.55rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 224, 219, 0.2);
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.type-icon-button span {
  color: #fff2ee;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.type-icon-button.is-disabled {
  border-color: rgba(255, 75, 42, 0.68);
  background: rgba(255, 41, 20, 0.14);
}

.type-icon-button.is-disabled span {
  color: rgba(255, 188, 174, 0.88);
  text-decoration: line-through;
}

.fullscreen-icon-button span {
  color: #fff2ee;
  font-size: 1.18rem;
  line-height: 1;
}

.record-symbol {
  width: 0.92rem;
  height: 0.92rem;
  border-radius: 999px;
  background: #fff2ee;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.primary-button:hover,
.secondary-button:hover,
.type-icon-button:hover,
.record-icon-button:hover,
.fullscreen-icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 231, 226, 0.36);
}

.record-icon-button.is-recording {
  background: #ff2b19;
  color: #fff;
  border-color: rgba(255, 218, 214, 0.58);
}

.record-icon-button.is-recording .record-symbol {
  width: 0.82rem;
  height: 0.82rem;
  border-radius: 2px;
  background: #fff;
}

.preset-section {
  gap: 0.65rem;
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.preset-grid .secondary-button {
  min-height: 2.15rem;
  padding: 0 0.5rem;
  font-size: 0.76rem;
}

.random-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.5rem;
}

.random-grid .secondary-button {
  min-height: 2.15rem;
  padding: 0 0.5rem;
  font-size: 0.76rem;
}

.still-export-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.5rem;
  align-items: end;
}

.still-export-grid .secondary-button {
  min-height: 2.3rem;
  padding: 0 0.58rem;
  font-size: 0.76rem;
}

.preset-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.control-field {
  display: grid;
  gap: 0.35rem;
  color: var(--panel-muted);
  font-size: 0.75rem;
}

.control-field select,
.control-field input,
.control-field textarea {
  width: 100%;
  border: 1px solid rgba(255, 224, 220, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.075);
  color: rgba(255, 245, 242, 0.96);
  outline: none;
}

.control-field select,
.control-field input {
  min-height: 2.3rem;
  padding: 0 0.58rem;
}

.control-field textarea {
  min-height: 4.4rem;
  resize: vertical;
  padding: 0.55rem 0.58rem;
  line-height: 1.32;
  font-size: 0.76rem;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
}

.color-field {
  gap: 0.28rem;
}

.color-field input[type="color"] {
  min-height: 2.1rem;
  padding: 0.18rem;
  cursor: pointer;
}

.audio-analysis-section {
  gap: 0.62rem;
}

.analysis-readouts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
}

.analysis-readouts span {
  min-width: 0;
  display: grid;
  gap: 0.15rem;
  padding: 0.42rem 0.36rem;
  border: 1px solid rgba(255, 224, 220, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 226, 222, 0.58);
  font-size: 0.64rem;
  line-height: 1.05;
}

.analysis-readouts output {
  color: rgba(255, 244, 241, 0.9);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.control-field select:focus,
.control-field input:focus,
.control-field textarea:focus {
  border-color: rgba(255, 232, 228, 0.48);
}

.split-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.toggle-field {
  min-height: 2.25rem;
  display: flex;
  align-items: center;
  gap: 0.48rem;
  padding: 0 0.58rem;
  border: 1px solid rgba(255, 224, 220, 0.16);
  border-radius: 8px;
  color: rgba(255, 238, 234, 0.86);
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.055);
}

.toggle-field input {
  width: 1rem;
  height: 1rem;
  accent-color: #ff351f;
}

.timeline-readout {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: rgba(255, 235, 231, 0.78);
  font-size: 0.76rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(255, 225, 221, 0.13);
}

.control-section {
  display: grid;
  gap: 0.56rem;
  padding-top: 0.72rem;
  border-top: 1px solid rgba(255, 225, 221, 0.13);
}

.control-section h2 {
  margin: 0;
  color: rgba(255, 241, 238, 0.88);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0;
}

.scene-text-section {
  gap: 0.7rem;
}

.slider-field {
  display: grid;
  gap: 0.22rem;
  color: var(--panel-muted);
  font-size: 0.72rem;
}

.slider-field > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.slider-field output {
  color: rgba(255, 244, 241, 0.82);
  font-variant-numeric: tabular-nums;
}

.slider-field input[type="range"] {
  width: 100%;
  accent-color: #ff2d1a;
}

.keyframe-toggle {
  position: relative;
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  margin-left: auto;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 225, 221, 0.22);
  border-radius: 50%;
  color: rgba(255, 238, 234, 0.58);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0;
  line-height: 1;
  cursor: pointer;
}

.keyframe-toggle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.38rem;
  height: 0.38rem;
  border: 1px solid currentColor;
  box-sizing: border-box;
  transform: translate(-50%, -50%) rotate(45deg);
}

.keyframe-toggle:hover,
.keyframe-toggle:focus-visible {
  color: rgba(255, 248, 245, 0.92);
  border-color: rgba(255, 90, 62, 0.7);
  outline: none;
}

.keyframe-toggle.is-active {
  color: #ff351f;
  border-color: rgba(255, 75, 42, 0.8);
  background: rgba(255, 41, 20, 0.14);
}

.keyframe-toggle.is-active::before {
  background: currentColor;
}

.keyframe-lane {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1.15rem;
  align-items: center;
  gap: 0.35rem;
  padding: 0.16rem 0 0.1rem;
}

.keyframe-lane[hidden] {
  display: none;
}

.keyframe-track {
  position: relative;
  height: 1.05rem;
  border-radius: 999px;
  cursor: pointer;
}

.keyframe-track::before {
  content: "";
  position: absolute;
  left: 0.38rem;
  right: 0.38rem;
  top: 50%;
  height: 1px;
  transform: translateY(-50%);
  background: rgba(255, 226, 222, 0.32);
}

.keyframe-playhead {
  position: absolute;
  top: 0.05rem;
  bottom: 0.05rem;
  width: 1px;
  transform: translateX(-0.5px);
  background: rgba(255, 245, 242, 0.82);
  pointer-events: none;
}

.keyframe-dot {
  position: absolute;
  top: 50%;
  width: 0.54rem;
  height: 0.54rem;
  min-width: 0;
  min-height: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(255, 244, 241, 0.82);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #ff2d1a;
  cursor: pointer;
  touch-action: none;
  box-shadow: 0 0 0 2px rgba(20, 0, 0, 0.82);
}

.keyframe-dot:hover,
.keyframe-dot:focus-visible {
  border-color: #fff7f4;
  outline: none;
}

.keyframe-dot.is-selected {
  width: 0.68rem;
  height: 0.68rem;
  background: #fff4ef;
  border-color: #ff351f;
}

.keyframe-dot.is-dragging {
  cursor: pointer;
}

.keyframe-delete {
  position: relative;
  width: 1.15rem;
  height: 1.15rem;
  min-width: 0;
  min-height: 0;
  padding: 0;
  display: none;
  place-items: center;
  border: 1px solid rgba(255, 225, 221, 0.24);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 238, 234, 0.72);
  font-size: 0;
  line-height: 1;
  cursor: pointer;
}

.keyframe-delete::before,
.keyframe-delete::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.5rem;
  height: 1px;
  background: currentColor;
  transform-origin: center;
}

.keyframe-delete::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.keyframe-delete::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.keyframe-lane.has-selected-keyframe .keyframe-delete {
  display: grid;
}

.keyframe-delete:hover,
.keyframe-delete:focus-visible {
  color: #fff7f4;
  border-color: rgba(255, 75, 42, 0.8);
  background: rgba(255, 41, 20, 0.16);
  outline: none;
}

.key-map {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.key-map span {
  padding: 0.26rem 0.42rem;
  border: 1px solid rgba(255, 225, 221, 0.14);
  border-radius: 999px;
  color: rgba(255, 226, 222, 0.62);
  font-size: 0.68rem;
}

body.ui-hidden .studio {
  grid-template-columns: 1fr;
  gap: 0;
  min-height: 100vh;
  padding: 0;
  background: #050000;
}

body.ui-hidden .control-panel {
  display: none;
}

body.ui-hidden {
  overflow: hidden;
}

body.ui-hidden .preview-zone,
body.ui-hidden .artboard-shell {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  position: static;
}

body.ui-hidden .reel-frame {
  box-shadow: none;
}

body.is-recording-clean {
  cursor: none;
  overflow: hidden;
}

body.is-recording-clean .studio {
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0;
  background: #050000;
}

body.is-recording-clean .control-panel {
  display: none;
}

body.is-recording-clean .preview-zone,
body.is-recording-clean .artboard-shell {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
}

body.is-recording-clean .reel-frame {
  box-shadow: none;
}

@media (max-width: 900px) {
  .studio {
    min-height: 100svh;
    grid-template-columns: 1fr;
  }

  .preview-zone,
  .artboard-shell {
    min-height: auto;
    height: 68svh;
    position: static;
  }

  .control-panel {
    min-height: auto;
  }
}

.svg-filters {
  position: fixed;
  width: 0;
  height: 0;
  pointer-events: none;
  overflow: hidden;
}
