/* Tracer: phones only, held upright. Palette from the course: turf, chalk-white ball, broadcast tracer red. */
@font-face { font-family: "Barlow Condensed"; src: url("fonts/BarlowCondensed-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("fonts/BarlowCondensed-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }

:root {
  --turf: #0E3B2E;       /* page */
  --turf-2: #164A3A;     /* cards */
  --turf-3: #21604C;     /* lines, pressed */
  --chalk: #F5F7F2;      /* text, the ball */
  --divot: #A9B8AF;      /* secondary text */
  --tracer: #FF3028;     /* the line and the one main action */
  --flag: #FFD23F;       /* needs a look */
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 14px;
  --pad: 20px;
  --tap: 52px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--turf); color: var(--chalk);
  font: 17px/1.45 var(--body);
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }
.screen { min-height: 100dvh; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 0; }

/* type */
.wordmark { font: 700 64px/0.9 var(--display); letter-spacing: 0.01em; text-transform: uppercase; margin: 0; }
.wordmark.small { font-size: 26px; }
.lede { font-size: 19px; color: var(--chalk); max-width: 22em; margin: 14px 0 28px; }
.fine { color: var(--divot); font-size: 14px; margin-top: 16px; }

/* buttons: every target at least 52 px tall for a thumb */
.btn { appearance: none; border: 0; border-radius: 999px; min-height: var(--tap); padding: 0 24px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 20px/1 var(--display); letter-spacing: 0.04em; text-transform: uppercase; text-decoration: none;
  color: var(--chalk); background: transparent; cursor: pointer; user-select: none; }
.btn:focus-visible { outline: 3px solid var(--flag); outline-offset: 3px; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--tracer); color: #fff; }
.btn-quiet { min-height: 44px; padding: 0 12px; color: var(--divot); font-size: 18px; }
.btn-danger { color: var(--chalk); border: 2px solid var(--turf-3); }
.btn-big { width: 100%; min-height: 64px; font-size: 24px; }

/* signed out: the tracer arc is the page */
#signin { justify-content: flex-end; position: relative; overflow: hidden; }
.arc { position: absolute; inset: 0 0 auto 0; width: 100%; height: 50dvh; }
.arc-line, .arc-glow { fill: none; stroke: var(--tracer); stroke-linecap: round; }
.arc-line { stroke-width: 6; }
.arc-glow { stroke-width: 22; opacity: 0.28; filter: blur(6px); }
.arc-ball { fill: var(--chalk); }
.arc path { stroke-dasharray: 900; stroke-dashoffset: 900; animation: fly 1.8s cubic-bezier(.2,.7,.3,1) 0.2s forwards; }
.arc-ball { opacity: 0; animation: land 0.3s ease-out 1.9s forwards; }
@keyframes fly { to { stroke-dashoffset: 0; } }
@keyframes land { to { opacity: 1; } }
.signin-copy { position: relative; padding: var(--pad) var(--pad) calc(32px + env(safe-area-inset-bottom)); }
.signin-copy .btn { width: 100%; }

/* bar */
.bar { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px 10px var(--pad); min-height: 60px; }

main { flex: 1; padding: 0 var(--pad) 120px; }

/* clip list */
.clips { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 12px; }
.card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 12px;
  background: var(--turf-2); border-radius: var(--r); padding: 16px; min-height: 76px;
  color: inherit; text-decoration: none; position: relative; overflow: hidden; }
.card:active { background: var(--turf-3); }
.card-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-when { color: var(--divot); font-size: 14px; grid-column: 1; }
.chip { grid-row: 1 / span 2; grid-column: 2; font: 600 16px/1 var(--display); letter-spacing: 0.05em;
  text-transform: uppercase; padding: 8px 12px; border-radius: 6px; background: var(--turf); color: var(--divot);
  white-space: nowrap; }
.chip.ready { background: var(--chalk); color: var(--turf); }
.chip.needs_check { background: var(--flag); color: var(--turf); }
.chip.failed { background: transparent; color: var(--tracer); border: 2px solid var(--tracer); }
/* uploads and work in progress: the progress bar is a tracer climbing along the bottom of the card */
.card .flight { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--tracer);
  box-shadow: 0 0 10px var(--tracer); width: var(--p, 0%); transition: width 0.3s; }
.card .flight.busy { width: 35%; animation: busy 1.6s ease-in-out infinite; }
@keyframes busy { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

.card.round .card-name { font: 700 22px/1.1 var(--display); text-transform: uppercase; letter-spacing: 0.02em; }
.card .flight.part { width: var(--p, 0%); animation: none; }
#batch main { padding-top: 0; }

.empty { margin-top: 18vh; color: var(--divot); max-width: 20em; }
.empty-title { font: 700 34px/1 var(--display); text-transform: uppercase; color: var(--chalk); margin: 0 0 10px; }

/* bottom dock, in the thumb zone */
.dock { position: fixed; left: 0; right: 0; bottom: 0;
  padding: 14px var(--pad) calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--turf) 70%, transparent); }
.dock.row { display: flex; gap: 12px; }
.dock.row .btn { flex: 1; }

/* one clip */
.clip-main { padding-top: 0; }
#player { width: 100%; max-height: 68dvh; background: #000; border-radius: var(--r); display: block; }
.clip-wait { aspect-ratio: 9 / 16; max-height: 60dvh; transition: none; width: 100%; border-radius: var(--r);
  background: var(--turf-2); display: grid; place-items: center; color: var(--divot);
  font: 600 22px/1.2 var(--display); text-transform: uppercase; letter-spacing: 0.05em; text-align: center; padding: 20px; }
.clip-name { font: 700 30px/1.05 var(--display); text-transform: uppercase; margin: 16px 0 4px; word-break: break-word; }
.clip-status { color: var(--divot); margin: 0; }
.clip-wait.short { aspect-ratio: 16 / 9; }
.reasons { margin: 12px 0 0; padding-left: 20px; color: var(--chalk); }
.hint { color: var(--divot); margin: 12px 0 0; }

/* tap-the-ball rescue */
.fix-main { padding-top: 0; padding-bottom: 104px; }
.fix-hint { margin: 0 0 10px; color: var(--chalk); font-size: 16px; min-height: 2.9em; }
.fix-box { position: relative; margin: 0 auto; border-radius: var(--r); overflow: hidden; background: #000;
  touch-action: manipulation; }
.fix-box video, .fix-box #fix-marks { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.loupe { position: absolute; top: 10px; width: 132px; height: 132px; border-radius: 50%;
  border: 3px solid var(--chalk); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5); background: #000; }
.loupe.left { left: 10px; } .loupe.right { right: 10px; }
.scrub { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.scrub input { flex: 1; height: 44px; accent-color: var(--tracer); }
.step-btn { appearance: none; border: 0; width: 52px; height: 52px; border-radius: 50%; background: var(--turf-2);
  color: var(--chalk); font: 600 30px/1 var(--display); cursor: pointer; }
.step-btn:active { background: var(--turf-3); }
.btn[disabled] { opacity: 0.45; }

/* clip editor */
.fix-box #edit-video, .fix-box #edit-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#edit-canvas { touch-action: none; }

/* style picker */
.style-main { padding-top: 0; }
.up { color: var(--divot); font: 600 16px/1 var(--display); letter-spacing: 0.05em; text-transform: uppercase; }
.preview { position: relative; width: min(100%, calc(clamp(130px, 100dvh - 600px, 34dvh) * 9 / 16)); aspect-ratio: 9 / 16; margin: 0 auto;
  border-radius: var(--r); overflow: hidden; background: #000; }
.preview video, .preview canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.preview-tag { position: absolute; left: 10px; top: 10px; font: 600 13px/1 var(--display); letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--chalk); background: rgba(14, 59, 46, 0.7); padding: 5px 8px; border-radius: 5px; }
.opt { border: 0; padding: 0; margin: 10px 0 0; }
.opt legend { font: 600 15px/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--divot);
  padding: 0; margin-bottom: 8px; }
.swatches { display: grid; grid-template-columns: repeat(5, var(--tap)); justify-content: space-between; gap: 8px 0; }
.swatch { appearance: none; width: var(--tap); height: var(--tap); border-radius: 50%; border: 3px solid var(--turf);
  background: var(--c); box-shadow: 0 0 0 2px var(--turf-3); cursor: pointer; }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 3px var(--chalk); }
.seg { display: flex; background: var(--turf-2); border-radius: 999px; padding: 4px; }
.seg button { appearance: none; flex: 1; border: 0; min-height: 44px; border-radius: 999px; background: transparent;
  color: var(--divot); font: 600 18px/1 var(--display); letter-spacing: 0.04em; text-transform: uppercase; cursor: pointer; }
.seg button[aria-checked="true"] { background: var(--chalk); color: var(--turf); }
.swatch:focus-visible, .seg button:focus-visible { outline: 3px solid var(--flag); outline-offset: 2px; }
#style .style-main { padding-bottom: 104px; }
#style .bar { min-height: 48px; padding-top: 4px; padding-bottom: 4px; }

.toast { position: fixed; left: var(--pad); right: var(--pad); bottom: calc(100px + env(safe-area-inset-bottom));
  background: var(--chalk); color: var(--turf); border-radius: var(--r); padding: 14px 16px; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .arc path, .arc-ball { animation: none; stroke-dashoffset: 0; opacity: 1; }
  .card .flight.busy { animation: none; width: 100%; opacity: 0.5; }
}
