:root {
  --bg: #12051f;
  --bg-grid: #23103a;
  --panel: #1b1030;
  --panel-2: #2b1a46;
  --text: #e9f7ff;
  --muted: #9bc4de;
  --lime: #8dff5b;
  --cyan: #39e1ff;
  --orange: #ffb347;
  --magenta: #ff4fd8;
  --shadow-pixel: 0 0 0 2px #07020f, 0 0 0 4px #311752, 8px 8px 0 0 #07020f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "VT323", monospace;
  color: var(--text);
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 18% 12%, rgba(57, 225, 255, 0.14) 0%, transparent 35%),
    radial-gradient(circle at 88% 78%, rgba(255, 79, 216, 0.18) 0%, transparent 36%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-grid) 100%);
  background-size: auto, auto, auto, auto, auto;
  background-size: 12px 12px, 12px 12px, cover, cover, cover;
  display: grid;
  place-items: center;
  padding: 1.2rem;
}

.layout {
  width: min(1120px, 100%);
  display: grid;
  gap: 1rem;
  grid-template-columns: 1.1fr 0.9fr;
}

.panel {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 2px solid #07020f;
  border-radius: 0;
  box-shadow: var(--shadow-pixel);
  padding: 1.2rem;
}

.eyebrow {
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--orange);
  margin: 0;
}

h1,
h2,
h3 {
  font-family: "Press Start 2P", monospace;
  margin: 0.4rem 0;
  line-height: 1.35;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(1rem, 1.9vw, 1.4rem);
  color: var(--cyan);
  text-shadow: 2px 2px 0 #07020f;
}

.subtitle {
  margin: 0.3rem 0 1rem;
  color: var(--muted);
  font-size: 1.55rem;
}

.dropzone {
  border: 2px dashed var(--cyan);
  border-radius: 0;
  display: block;
  padding: 0.9rem;
  text-align: center;
  cursor: pointer;
  transition: 0.2s ease;
  background: rgba(10, 6, 20, 0.6);
  box-shadow: inset 0 0 0 2px #07020f;
}

.dropzone.drag-over {
  transform: translate(-2px, -2px);
  border-color: var(--lime);
  background: rgba(141, 255, 91, 0.12);
}

.dropzone input {
  display: none;
}

.drop-title {
  font-family: "Press Start 2P", monospace;
  font-size: 0.72rem;
  display: block;
}

.drop-hint {
  display: block;
  color: var(--muted);
  margin-top: 0.2rem;
  font-size: 1.2rem;
}

.video-wrap {
  margin-top: 1rem;
  border-radius: 0;
  overflow: hidden;
  background: #000;
  position: relative;
  border: 2px solid #07020f;
  box-shadow: inset 0 0 0 2px rgba(57, 225, 255, 0.5);
}

video {
  width: 100%;
  max-height: 340px;
  display: block;
}

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

.crop-box {
  position: absolute;
  border: 2px solid var(--lime);
  border-radius: 0;
  box-shadow: 0 0 0 9999px rgba(2, 8, 15, 0.58);
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
}

.crop-box.dragging {
  cursor: grabbing;
}

.crop-box::after {
  content: "4:1";
  position: absolute;
  top: -24px;
  right: 0;
  background: #07020f;
  border: 1px solid var(--lime);
  border-radius: 0;
  padding: 0.1rem 0.35rem;
  font-size: 0.95rem;
  color: var(--lime);
}

.crop-hint {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 1.2rem;
}

.status {
  margin-top: 0.7rem;
  color: var(--orange);
  font-size: 1.3rem;
}

.trim-panel {
  margin-top: 0.9rem;
  background: rgba(8, 4, 16, 0.8);
  border: 2px solid #07020f;
  border-radius: 0;
  padding: 0.75rem;
  box-shadow: inset 0 0 0 2px rgba(255, 179, 71, 0.25);
}

.trim-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
}

.trim-head h3 {
  margin: 0;
  font-size: 0.8rem;
  color: var(--orange);
}

.trim-head p {
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
}

.trim-timeline {
  position: relative;
  height: 44px;
  margin-top: 0.55rem;
}

.trim-track {
  position: absolute;
  inset: 9px 0;
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(57, 225, 255, 0.2), rgba(57, 225, 255, 0.06)),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.03) 0px,
      rgba(255, 255, 255, 0.03) 9px,
      rgba(0, 0, 0, 0.13) 9px,
      rgba(0, 0, 0, 0.13) 13px
    );
  border: 1px solid rgba(57, 225, 255, 0.45);
}

.trim-selected {
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 0;
  width: 30%;
  border-radius: 0;
  background: linear-gradient(90deg, rgba(141, 255, 91, 0.35), rgba(255, 79, 216, 0.4));
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.trim-range {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  background: transparent;
  border: 0;
  padding: 0;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.trim-range::-webkit-slider-runnable-track {
  height: 44px;
  background: transparent;
}

.trim-range::-moz-range-track {
  height: 44px;
  background: transparent;
}

.trim-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 34px;
  margin-top: 5px;
  border-radius: 0;
  border: 1px solid #07020f;
  background: linear-gradient(180deg, #fff6d8, #ffb347);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  cursor: ew-resize;
}

.trim-range::-moz-range-thumb {
  width: 18px;
  height: 34px;
  border-radius: 0;
  border: 1px solid #07020f;
  background: linear-gradient(180deg, #fff6d8, #ffb347);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  cursor: ew-resize;
}

.controls h2 {
  margin-bottom: 0.8rem;
}

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

label {
  display: grid;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 1.25rem;
}

input {
  border-radius: 0;
  border: 2px solid #07020f;
  background: rgba(10, 7, 19, 0.9);
  color: var(--text);
  padding: 0.45rem 0.55rem;
  font: inherit;
  box-shadow: inset 0 0 0 1px rgba(57, 225, 255, 0.4);
}

button {
  margin-top: 1rem;
  width: 100%;
  border: 2px solid #07020f;
  border-radius: 0;
  padding: 0.85rem;
  font: 400 1.2rem "Press Start 2P", monospace;
  color: #09110f;
  background: linear-gradient(90deg, var(--lime), #d8ff7f);
  cursor: pointer;
  transition: transform 0.15s steps(2, end);
  box-shadow: 0 0 0 1px #a1ff80 inset, 4px 4px 0 0 #07020f;
}

button:hover:not(:disabled) {
  transform: translate(-1px, -1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: 0 0 0 1px #a1ff80 inset;
}

.progress-wrap {
  margin-top: 0.8rem;
  width: 100%;
  height: 10px;
  background: rgba(7, 2, 15, 0.8);
  border-radius: 0;
  overflow: hidden;
  border: 2px solid #07020f;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: repeating-linear-gradient(
    90deg,
    var(--magenta) 0 8px,
    var(--orange) 8px 16px
  );
  transition: width 0.2s ease;
}

.progress-text {
  margin: 0.4rem 0 0;
  font-size: 1.15rem;
  color: var(--muted);
}

.signature {
  margin: 1.25rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 1.1rem;
}

.signature a {
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px solid var(--cyan);
}

.signature a:hover {
  color: var(--lime);
  border-bottom-color: var(--lime);
}

.result {
  margin-top: 1rem;
  padding: 0.8rem;
  border-radius: 0;
  background: rgba(9, 4, 16, 0.9);
  border: 2px solid #07020f;
  box-shadow: inset 0 0 0 1px rgba(57, 225, 255, 0.45);
}

.result img {
  display: block;
  width: 100%;
  border-radius: 0;
  border: 2px solid #07020f;
  margin: 0.5rem 0;
  image-rendering: pixelated;
}

#downloadLink {
  display: inline-block;
  text-decoration: none;
  color: #07020f;
  border: 2px solid #07020f;
  background: linear-gradient(90deg, var(--cyan), #b4f5ff);
  padding: 0.45rem 0.7rem;
  border-radius: 0;
  font-family: "Press Start 2P", monospace;
  font-size: 0.72rem;
  box-shadow: 3px 3px 0 0 #07020f;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

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