:root {
  --void: #050706;
  --bone: #f0eadb;
  --cyan: #55e9f5;
  --amber: #eebd66;
  --coral: #ff694f;
  --line: rgba(85, 233, 245, .28);
}

* { box-sizing: border-box; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--void); }
body {
  color: var(--bone);
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Roboto Mono", monospace;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: .14;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(2, 8, 7, .95) 4px);
  mix-blend-mode: multiply;
}

.deck { position: relative; width: 100%; height: 100%; isolation: isolate; }
.art { position: absolute; inset: 0; overflow: hidden; background: #080b0a; }
.art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--x) var(--y);
  transform-origin: var(--x) var(--y);
  transform: scale(var(--z));
  filter: saturate(.88) contrast(1.08);
  transition: opacity .16s steps(2), transform 4.8s cubic-bezier(.12,.6,.16,1), filter .5s ease;
}
.art img.play { transform: scale(calc(var(--z) + .09)); filter: saturate(1.02) contrast(1.12); }
.art.full img, .art.full img.play {
  object-fit: contain;
  object-position: center;
  transform: scale(.96);
  filter: saturate(1.02) contrast(1.08);
}
.art.left-fifth img, .art.left-fifth img.play,
.art.left-thirty img, .art.left-thirty img.play,
.art.left-half img, .art.left-half img.play {
  inset: 0 auto 0 0;
  width: auto;
  max-width: none;
  height: 100%;
  object-fit: fill;
  object-position: left top;
  transform: none;
  clip-path: none;
  filter: saturate(1.02) contrast(1.1);
}
.art.left-fifth img { -webkit-mask-image: linear-gradient(90deg, #000 0 42%, transparent 49%); mask-image: linear-gradient(90deg, #000 0 42%, transparent 49%); }
.art.left-thirty img { -webkit-mask-image: linear-gradient(90deg, #000 0 28%, transparent 33%); mask-image: linear-gradient(90deg, #000 0 28%, transparent 33%); }
.art.left-half img { -webkit-mask-image: linear-gradient(90deg, #000 0 45%, transparent 52%); mask-image: linear-gradient(90deg, #000 0 45%, transparent 52%); }
.art.chad-whole img, .art.chad-whole img.play {
  object-fit: contain;
  object-position: 25% 78%;
  transform: scale(1.65);
  transform-origin: 30% 80%;
  filter: saturate(1.02) contrast(1.08);
  -webkit-mask-image: linear-gradient(0deg, #000 0 45%, rgba(0,0,0,.92) 52%, transparent 61%);
  mask-image: linear-gradient(0deg, #000 0 45%, rgba(0,0,0,.92) 52%, transparent 61%);
}
.art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, rgba(2,6,5,.98) 0, rgba(2,6,5,.8) 15%, rgba(2,6,5,.18) 52%, rgba(2,6,5,.3) 100%),
    radial-gradient(circle at var(--mask-x, var(--x)) var(--mask-y, var(--y)), transparent 0 var(--mask-radius, 16%), rgba(2,5,4,.55) calc(var(--mask-radius, 16%) + 12%), rgba(2,5,4,.96) calc(var(--mask-radius, 16%) + 34%));
  box-shadow: inset 0 0 12vw rgba(0,0,0,.7);
  transition: background .18s steps(2);
}
.art.final::after {
  background:
    linear-gradient(0deg, rgba(2,6,5,.98) 0, rgba(2,6,5,.76) 15%, rgba(2,6,5,.12) 52%, rgba(2,6,5,.24) 100%),
    radial-gradient(circle at var(--mask-x, var(--x)) var(--mask-y, var(--y)), transparent 0 var(--mask-radius, 32%), rgba(2,5,4,.45) calc(var(--mask-radius, 32%) + 56%));
}
.art.wide::after {
  background:
    linear-gradient(0deg, rgba(2,6,5,.96) 0, rgba(2,6,5,.7) 14%, rgba(2,6,5,.12) 50%, rgba(2,6,5,.22) 100%),
    radial-gradient(circle at var(--mask-x, var(--x)) var(--mask-y, var(--y)), transparent 0 var(--mask-radius, 34%), rgba(2,5,4,.42) calc(var(--mask-radius, 34%) + 48%));
}
.art.full::after {
  background: linear-gradient(0deg, rgba(2,6,5,.96) 0, rgba(2,6,5,.66) 13%, transparent 42%, rgba(2,6,5,.08) 100%);
  box-shadow: inset 0 0 8vw rgba(0,0,0,.38);
}
.art.left-fifth::after,
.art.left-thirty::after,
.art.left-half::after {
  background: linear-gradient(0deg, rgba(2,6,5,.7), transparent 24%);
  box-shadow: none;
}
.art.third-cut::after {
  background: linear-gradient(0deg, rgba(2,6,5,.7), transparent 24%);
  box-shadow: inset 0 0 5vw rgba(0,0,0,.24);
}
.art.chad-whole::after {
  background: linear-gradient(0deg, rgba(2,6,5,.58), transparent 23%);
  box-shadow: none;
}
.art.custom-geometry img,
.art.custom-geometry img.play {
  inset: 0 !important;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: var(--x) var(--y) !important;
  transform: scale(var(--z)) !important;
  transform-origin: var(--x) var(--y) !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
}
.art.custom-geometry::after {
  background:
    linear-gradient(0deg, rgba(2,6,5,.96) 0, rgba(2,6,5,.72) 14%, rgba(2,6,5,.12) 50%, rgba(2,6,5,.22) 100%),
    radial-gradient(circle at var(--mask-x) var(--mask-y), transparent 0 var(--mask-radius), rgba(2,5,4,.55) calc(var(--mask-radius) + 12%), rgba(2,5,4,.96) calc(var(--mask-radius) + 34%)) !important;
  box-shadow: inset 0 0 12vw rgba(0,0,0,.7) !important;
}
.art.full ~ .reticle { opacity: 0; }
.art.cover ~ .copy,
.art.cover ~ .reticle { opacity: 0; }
.art.cover img,
.art.cover img.play {
  object-fit: contain;
  object-position: center;
  transform: scale(1);
}
.art.cover::after {
  background: linear-gradient(0deg, rgba(2,6,5,.72) 0, transparent 19%, transparent 86%, rgba(2,6,5,.14) 100%);
  box-shadow: inset 0 0 5vw rgba(0,0,0,.28);
}

.hud {
  position: absolute;
  z-index: 6;
  inset: 0 0 auto;
  height: clamp(48px, 6vh, 68px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 clamp(18px, 3vw, 46px);
  color: var(--cyan);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(5,7,6,.88), rgba(5,7,6,.3));
  font-size: clamp(9px, .85vw, 12px);
  letter-spacing: .18em;
  text-transform: uppercase;
}
.hud__center { color: #7e938d; }
.hud__right { text-align: right; color: var(--amber); }
.hud__left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.2vw, 18px);
}
.act-jump {
  position: relative;
  flex: 0 1 250px;
  min-width: 142px;
  max-width: 250px;
  height: 30px;
  color: var(--cyan);
  border: 1px solid rgba(85,233,245,.48);
  background:
    linear-gradient(90deg, rgba(85,233,245,.1), transparent 38%),
    rgba(5,7,6,.7);
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 0 100%);
}
.act-jump::before {
  content: "";
  position: absolute;
  z-index: 2;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--cyan);
  pointer-events: none;
}
.act-jump::after {
  content: "";
  position: absolute;
  z-index: 2;
  right: 10px;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--cyan);
  transform: translateY(-30%);
  pointer-events: none;
}
.act-jump select {
  width: 100%;
  height: 100%;
  padding: 0 28px 0 12px;
  overflow: hidden;
  color: var(--cyan);
  border: 0;
  outline: 0;
  background: transparent;
  appearance: none;
  cursor: pointer;
  font: 700 9px/1 ui-monospace, "SFMono-Regular", "Cascadia Mono", monospace;
  letter-spacing: .12em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.act-jump:has(select:hover),
.act-jump:has(select:focus-visible) {
  color: var(--void);
  border-color: var(--cyan);
  background: var(--cyan);
  box-shadow: 0 0 22px rgba(85,233,245,.18);
}
.act-jump:has(select:hover)::before,
.act-jump:has(select:focus-visible)::before { background: var(--coral); }
.act-jump:has(select:hover)::after,
.act-jump:has(select:focus-visible)::after { border-top-color: var(--void); }
.act-jump select:hover,
.act-jump select:focus-visible { color: var(--void); }
.act-jump select:disabled { cursor: not-allowed; opacity: .42; }

.reticle { position: absolute; z-index: 5; top: 12%; right: 6%; width: 34px; height: 34px; opacity: .65; border: 1px solid var(--cyan); }
.reticle::before, .reticle::after { content: ""; position: absolute; background: var(--cyan); }
.reticle::before { width: 16px; height: 1px; top: 16px; left: 8px; }
.reticle::after { height: 16px; width: 1px; left: 16px; top: 8px; }

.copy {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 75%;
  width: max-content;
  max-width: calc(100vw - clamp(150px, 14vw, 260px));
  transform: translate(-50%, -50%);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: clamp(12px, 2vw, 28px);
  text-align: left;
}
.prompt { color: var(--cyan); font: 800 clamp(12px, 1.6vw, 28px)/1 Impact, Haettenschweiler, sans-serif; text-shadow: 0 0 16px rgba(85,233,245,.35); }
.line { width: max-content; max-width: none; margin: 0; white-space: nowrap; font-size: clamp(14px, 1.72vw, 30px); font-weight: 750; line-height: 1.15; letter-spacing: -.02em; text-align: left; text-shadow: 0 4px 18px #000, 0 0 2px #000; }
.line::after { content: "■"; display: inline-block; color: var(--coral); margin-left: .2em; font-size: .52em; transform: translateY(-.1em); animation: blink .65s steps(1) infinite; }
.line.done::after { opacity: 0; animation: none; }

.nav {
  position: absolute;
  z-index: 30;
  inset: 50% 0 auto;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 clamp(7px, 1.25vw, 20px);
  pointer-events: none;
}
.nav button {
  width: clamp(48px, 5vw, 74px);
  height: clamp(78px, 10vh, 118px);
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(85,233,245,.45);
  background: rgba(5,7,6,.58);
  color: var(--cyan);
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(8px);
  font: 400 clamp(30px, 4vw, 60px)/1 Arial, sans-serif;
  transition: background .18s, color .18s, border-color .18s, transform .18s;
}
.nav button:hover, .nav button:focus-visible { outline: none; color: var(--void); background: var(--cyan); border-color: var(--cyan); transform: scale(1.04); }
.nav button:disabled { opacity: .18; cursor: default; transform: none; }

.rail { position: absolute; z-index: 31; left: 0; right: 0; bottom: 0; height: 38px; display: grid; align-items: center; background: rgba(5,7,6,.9); border-top: 1px solid var(--line); cursor: pointer; }
.rail:focus-visible { outline: 1px solid var(--cyan); outline-offset: -2px; }
.rail__fill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, rgba(85,233,245,.16), rgba(255,105,79,.25)); transition: width .28s ease; }
.rail__ticks { position: relative; display: grid; height: 100%; }
.rail__ticks span { border-right: 1px solid rgba(85,233,245,.15); }
.rail__ticks span.active { background: rgba(85,233,245,.14); box-shadow: inset 0 2px var(--coral); }
.rail__seek {
  position: absolute;
  z-index: 3;
  left: var(--seek-x, 0%);
  bottom: 0;
  width: 1px;
  height: 100%;
  opacity: 0;
  background: var(--bone);
  box-shadow: 0 0 8px rgba(240,234,219,.75);
  pointer-events: none;
}
.rail__seek::before {
  content: attr(data-label);
  position: absolute;
  left: 0;
  bottom: calc(100% + 7px);
  transform: translateX(-50%);
  width: max-content;
  padding: 5px 7px;
  color: var(--bone);
  border: 1px solid var(--line);
  background: rgba(5,7,6,.95);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.rail.seeking .rail__seek { opacity: 1; }
.hint { position: absolute; z-index: 8; right: clamp(18px, 3vw, 46px); bottom: 50px; color: #80928d; font-size: 9px; letter-spacing: .16em; text-transform: uppercase; }

.flash { position: absolute; z-index: 15; inset: 0; pointer-events: none; background: var(--bone); opacity: 0; }
.flash.go { animation: cut .18s steps(2); }

.editor-mode { user-select: none; }
.editor-mode .deck { cursor: crosshair; }
.editor-mode .art img,
.editor-mode .art img.play {
  inset: 0 !important;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: var(--x) var(--y) !important;
  transform: scale(var(--z)) !important;
  transform-origin: var(--x) var(--y) !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
  transition: none !important;
}
.art.transition-prime img,
.art.transition-prime img.play,
.art.transition-prime::after { transition: none !important; }
.art.beat-transition img,
.art.beat-transition img.play,
.editor-mode .art.editor-replaying img,
.editor-mode .art.editor-replaying img.play {
  transition:
    object-position 1s cubic-bezier(.2,.72,.18,1),
    transform-origin 1s cubic-bezier(.2,.72,.18,1),
    transform 1s cubic-bezier(.2,.72,.18,1) !important;
}
.art.beat-transition::after,
.art.editor-replaying::after { transition: background 1s cubic-bezier(.2,.72,.18,1) !important; }
.art.editor-mask-override::after {
  background:
    linear-gradient(0deg, rgba(2,6,5,.96) 0, rgba(2,6,5,.72) 14%, rgba(2,6,5,.12) 50%, rgba(2,6,5,.22) 100%),
    radial-gradient(circle at var(--mask-x) var(--mask-y), transparent 0 var(--mask-radius), rgba(2,5,4,.55) calc(var(--mask-radius) + 12%), rgba(2,5,4,.96) calc(var(--mask-radius) + 34%)) !important;
  box-shadow: inset 0 0 12vw rgba(0,0,0,.7) !important;
}
.editor-hud {
  position: absolute;
  z-index: 42;
  left: 50%;
  top: clamp(62px, 8vh, 88px);
  width: min(760px, calc(100vw - 32px));
  transform: translateX(-50%);
  display: none;
  grid-template-columns: 1fr auto;
  gap: 5px 24px;
  padding: 12px 15px;
  color: var(--cyan);
  border: 1px solid rgba(85,233,245,.65);
  background: rgba(5,7,6,.9);
  box-shadow: 0 12px 50px rgba(0,0,0,.5), inset 0 0 24px rgba(85,233,245,.05);
  pointer-events: none;
  font-size: 10px;
  line-height: 1.35;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.editor-mode .editor-hud { display: grid; }
.editor-hud strong { color: var(--coral); }
.editor-hud span { text-align: right; }
.editor-hud small { grid-column: 1 / -1; color: var(--bone); font: inherit; opacity: .78; }
.editor-toggle {
  position: absolute;
  z-index: 43;
  left: 50%;
  top: clamp(158px, 19vh, 188px);
  display: none;
  transform: translateX(-50%);
  padding: 8px 12px;
  color: var(--void);
  border: 1px solid var(--cyan);
  background: var(--cyan);
  font: 800 10px/1 ui-monospace, "SFMono-Regular", "Cascadia Mono", monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
}
.editor-mode .editor-toggle { display: block; }
.editor-toggle[data-point="start"] { border-color: var(--coral); background: var(--coral); }
.editor-toggle:hover,
.editor-toggle:focus-visible { outline: 1px solid var(--bone); outline-offset: 3px; }
.editor-mask-guide {
  position: absolute;
  z-index: 41;
  display: none;
  min-width: 24px;
  min-height: 24px;
  transform: translate(-50%, -50%);
  border: 1px dashed rgba(255,105,79,.9);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(5,7,6,.7), 0 0 24px rgba(255,105,79,.2);
  pointer-events: none;
}
.editor-mask-guide::before,
.editor-mask-guide::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: var(--coral);
  transform: translate(-50%, -50%);
}
.editor-mask-guide::before { width: 22px; height: 1px; }
.editor-mask-guide::after { width: 1px; height: 22px; }
.editor-mode .editor-mask-guide { display: block; }
.editor-mode .nav,
.editor-mode .rail { opacity: .28; }
.editor-mode[data-editor-gesture="panel-move"] .deck { cursor: move; }
.editor-mode[data-editor-gesture="panel-resize"] .deck,
.editor-mode[data-editor-gesture="mask-resize"] .deck { cursor: nwse-resize; }
.editor-mode[data-editor-gesture="mask-move"] .deck { cursor: crosshair; }
.toast {
  position: absolute;
  z-index: 50;
  left: 50%;
  bottom: 64px;
  transform: translate(-50%, 12px);
  padding: 10px 14px;
  color: var(--void);
  background: var(--cyan);
  opacity: 0;
  pointer-events: none;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  transition: opacity .16s ease, transform .16s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes blink { 50% { opacity: 0; } }
@keyframes cut { 0% { opacity: .18; } 100% { opacity: 0; } }

@media (max-width: 680px) {
  .hud { grid-template-columns: 1fr 1fr; }
  .hud__center { display: none; }
  .hud__left { gap: 0; }
  .act-jump { flex-basis: min(58vw, 220px); min-width: 0; height: 28px; }
  .act-jump select { font-size: 8px; padding-left: 10px; }
  .copy { left: 50%; top: 75%; width: max-content; max-width: calc(100vw - 34px); grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
  .prompt { font-size: 14px; }
  .line { max-width: none; font-size: 16px; }
  .nav { inset: auto 0 48px; transform: none; padding: 0 12px; }
  .nav button { height: 48px; width: 64px; }
  .hint { display: none; }
  .reticle { top: 11%; right: 7%; }
  .editor-hud { grid-template-columns: 1fr; top: 54px; }
  .editor-hud span { text-align: left; }
  .editor-toggle { top: 184px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
