@font-face {
  font-family: Barlow;
  src: url("/fonts/barlow-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

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

@font-face {
  font-family: "Barlow Condensed";
  src: url("/fonts/barlow-condensed-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { color-scheme: light; }

body {
  margin: 0;
  min-height: 100vh;
  background: #d9dde3;
  color: #1c1c1c;
  font-family: Barlow, sans-serif;
  font-weight: 500;
  caret-color: #c23b22;
}

::selection { background: #f0b429; color: #1c1c1c; }

:focus-visible {
  outline: 2px solid #1c1c1c;
  outline-offset: 3px;
}

* { scrollbar-color: #1c1c1c #d9dde3; }

header {
  min-height: 76px;
  background: #f0b429;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 32px;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.03em;
  font-weight: 700;
}

h2 {
  margin: 0 0 14px;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.session { display: flex; align-items: center; gap: 16px; font-size: 18px; font-weight: 700; }

header button, .playhead button, #pixels {
  background: transparent;
  border: 0;
  color: #1c1c1c;
  font: 700 18px/1 Barlow, sans-serif;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 8px 0;
  cursor: pointer;
}

.gate {
  width: min(440px, calc(100% - 48px));
  margin: 64px auto;
  background: #eceae4;
  padding: 28px;
}

.lead { margin: 0 0 18px; font-size: 22px; font-weight: 700; }

.field { display: flex; flex-direction: column; gap: 8px; font-size: 16px; font-weight: 700; }

input, select {
  font: 700 18px/1.2 Barlow, sans-serif;
  color: #1c1c1c;
  background: #fff;
  border: 2px solid #1c1c1c;
  border-radius: 0;
  padding: 10px 12px;
  width: 100%;
}

.gate button, .actions button {
  border: 0;
  cursor: pointer;
  font: 700 20px/1 Barlow, sans-serif;
  padding: 14px 18px;
}

.gate button, #render {
  background: #c23b22;
  color: #fff;
}

.gate button { margin-top: 18px; }

#render:hover, .gate button:hover { background: #a8321c; }

#render:disabled, .gate button:disabled, .actions button:disabled, input:disabled, select:disabled {
  background: #c8c3b8;
  color: #1c1c1c;
  cursor: not-allowed;
}

.dark { background: #1c1c1c; color: #fff; }
.dark:hover { background: #3a3a3a; }

.error {
  min-height: 1.4em;
  margin: 14px 0 0;
  color: #9a2e18;
  font-size: 16px;
  font-weight: 700;
}

main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  padding: 28px 32px 0;
}

.panel { background: #eceae4; padding: 22px; min-width: 0; }

.screen, .window {
  background: #1c1c1c;
  min-height: 300px;
  position: relative;
}

.screen video, .window img {
  display: block;
  width: 100%;
  height: 300px;
  object-fit: contain;
  background: #1c1c1c;
}

.empty {
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  padding: 24px;
  cursor: pointer;
}

.empty span:last-child { font-size: 16px; font-weight: 500; }

.empty input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}

.empty:focus-within { outline: 2px solid #f0b429; outline-offset: 3px; }

.screen.over { outline: 3px solid #f0b429; outline-offset: -6px; }

.window { display: flex; align-items: center; justify-content: center; }

#window-empty {
  margin: 0;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  padding: 24px;
}

.track {
  position: relative;
  height: 28px;
  margin-top: 16px;
  background: #c8c3b8;
  touch-action: none;
}

.span { position: absolute; top: 0; bottom: 0; background: #1c1c1c; }

.handle {
  position: absolute;
  top: -6px;
  width: 16px;
  height: 40px;
  padding: 0;
  background: #f0b429;
  border: 2px solid #1c1c1c;
  cursor: ew-resize;
}

.handle.start { left: -8px; }
.handle.end { right: -8px; }

.times {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.playhead { display: flex; gap: 18px; }

.stamp {
  margin: 16px 0 0;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: #1c1c1c;
}

.stamp.hot { color: #c23b22; }

.stamp.hit { animation: stamp 280ms cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes stamp {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

.state { margin: 4px 0 0; font-size: 20px; font-weight: 700; }
.state.hot { color: #c23b22; }

.palette {
  display: block;
  height: 28px;
  width: auto;
  margin-top: 16px;
  image-rendering: pixelated;
  background: #fff;
}

#pixels { margin-top: 10px; }

.window.pixels { overflow: auto; align-items: flex-start; justify-content: flex-start; }
.window.pixels img {
  width: auto;
  height: auto;
  max-width: none;
  image-rendering: pixelated;
}

.fileline { margin: 12px 0 0; font-size: 18px; font-weight: 700; }
.fileline a { color: #1c1c1c; }
.struck { text-decoration: line-through; }

.controls { padding: 22px 32px 32px; }

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 18px;
  align-items: flex-end;
}

.row + .row { margin-top: 16px; }

.controls .field { flex: 1 1 11rem; min-width: 0; }
.controls .field input, .controls .field select { width: 100%; font-size: 16px; }
.crop { flex: 0 0 5.5rem; }
.crop input { width: 100%; }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  font-weight: 700;
}

.check input { width: 18px; height: 18px; accent-color: #9a2e18; }

.actions { margin-left: auto; display: flex; gap: 12px; flex-wrap: wrap; }

@media (max-width: 860px) {
  header, main, .controls { padding-left: 16px; padding-right: 16px; }
  header { min-height: 64px; }
  h1 { font-size: 28px; }
  main { grid-template-columns: 1fr; padding-top: 16px; }
  .stamp { font-size: 22px; }
  .actions { margin-left: 0; width: 100%; }
  .actions button { flex: 1; }
}

@media (max-width: 520px) {
  h1 { font-size: 26px; }
  .session { font-size: 16px; }
  .stamp { font-size: 18px; letter-spacing: 0.02em; }
}

@media (prefers-reduced-motion: reduce) {
  .stamp.hit { animation: none; }
}
