:root {
  --acid: #f2ff42;
  --ink: #121212;
  --red: #ff274b;
  --blue: #3456ff;
  --paper: #f4f1e9;
  --sans: Arial, Helvetica, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 280px;
  background: var(--acid);
}

body {
  min-width: 280px;
  min-height: 100svh;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--acid);
  font-family: var(--sans);
  transition: background-color 160ms linear, color 160ms linear;
}

button,
a {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.topline,
footer {
  position: fixed;
  right: 34px;
  left: 34px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.topline {
  top: 0;
  height: 62px;
  border-bottom: 1px solid currentColor;
}

.home-link,
footer a {
  text-decoration: none;
}

.home-link:focus-visible,
footer a:focus-visible,
.phase-rail button:focus-visible,
.start-button:focus-visible,
.again-button:focus-visible,
.soundless:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 4px;
}

.phase-name {
  position: absolute;
  left: 50%;
  margin: 0;
  transform: translateX(-50%);
}

.phase-name span {
  margin-right: 18px;
}

.soundless {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0;
  background: transparent;
}

.soundless span {
  width: 2px;
  height: 13px;
  background: currentColor;
  animation: signal 900ms ease-in-out infinite alternate;
}

.soundless span:nth-child(2) {
  height: 21px;
  animation-delay: -300ms;
}

.soundless span:nth-child(3) {
  height: 8px;
  animation-delay: -600ms;
}

.soundless[aria-pressed="true"] span {
  height: 3px;
  animation-play-state: paused;
}

main,
.scene {
  width: 100%;
  min-height: 100svh;
}

.scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

body[data-phase="arrival"] .scene-arrival,
body[data-phase="focus"] .scene-focus,
body[data-phase="echo"] .scene-echo {
  z-index: 2;
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.scene-arrival {
  padding: max(100px, 12vh) clamp(32px, 7vw, 112px) 90px;
}

.eyebrow,
.arrival-note,
.echo-prompt {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.eyebrow {
  position: absolute;
  top: 27%;
  left: 8%;
  z-index: 4;
  max-width: 110px;
  line-height: 1.25;
}

h1 {
  position: relative;
  z-index: 3;
  width: min-content;
  margin: 0 auto;
  font-family: var(--serif);
  font-size: clamp(84px, 18vw, 270px);
  font-style: italic;
  font-weight: 400;
  line-height: 0.62;
  letter-spacing: 0;
}

h1 span {
  display: block;
}

h1 span:last-child {
  margin-left: clamp(25px, 12vw, 190px);
  color: transparent;
  -webkit-text-stroke: clamp(1px, 0.15vw, 3px) var(--ink);
}

.start-button {
  position: absolute;
  right: 11%;
  bottom: 18%;
  z-index: 5;
  width: clamp(104px, 11vw, 170px);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  transition: transform 180ms ease;
}

.start-button span:last-child {
  font-size: 22px;
}

.start-button:hover {
  transform: rotate(9deg) scale(1.04);
}

.arrival-target {
  position: absolute;
  top: 5%;
  right: -3%;
  width: min(43vw, 620px);
  aspect-ratio: 1;
  opacity: 0.8;
  transform: translate(var(--x, 0), var(--y, 0));
  transition: transform 500ms cubic-bezier(.2,.8,.2,1);
}

.arrival-target span,
.arrival-target i {
  position: absolute;
  border-radius: 50%;
}

.target-red {
  inset: 0 35% 35% 0;
  background: var(--red);
  mix-blend-mode: multiply;
}

.target-blue {
  inset: 35% 0 0 35%;
  background: var(--blue);
  mix-blend-mode: multiply;
}

.arrival-target i {
  inset: 42%;
  background: var(--acid);
  border: 2px solid var(--ink);
}

.arrival-note {
  position: absolute;
  bottom: 83px;
  left: 8%;
  transform: rotate(-90deg) translateX(-100%);
  transform-origin: left top;
}

.scene-focus {
  color: var(--paper);
  background: var(--blue);
}

.focus-count {
  position: absolute;
  top: 14%;
  left: 7%;
  z-index: 4;
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.focus-count span {
  display: block;
  font-family: var(--serif);
  font-size: clamp(56px, 8vw, 120px);
  font-style: italic;
  font-weight: 400;
  line-height: 0.8;
}

.scene-focus h2,
.scene-echo h2 {
  position: absolute;
  z-index: 4;
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
}

.scene-focus h2 {
  right: 7%;
  bottom: 12%;
  font-size: clamp(42px, 7vw, 106px);
  line-height: 0.82;
  text-align: right;
}

.focus-target,
.echo-target {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(64vw, 64vh, 760px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
}

.focus-field {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.field-one {
  background: var(--red);
}

.field-two {
  inset: 19%;
  background: var(--acid);
}

.focus-target i,
.echo-target i {
  position: absolute;
  inset: 48.8%;
  z-index: 2;
  border-radius: 50%;
  background: var(--ink);
}

.time-track {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 8px;
  background: rgba(255,255,255,0.25);
}

.time-track span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--acid);
  transform: scaleX(0);
  transform-origin: left;
}

body[data-phase="focus"] .time-track span {
  animation: count-up 10s linear forwards;
}

.scene-echo {
  color: var(--ink);
  background: var(--paper);
}

.echo-prompt {
  position: absolute;
  top: 18%;
  left: 50%;
  z-index: 4;
  transform: translateX(-50%);
  white-space: nowrap;
}

.scene-echo h2 {
  top: 12%;
  left: 6%;
  color: rgba(18,18,18,0.12);
  font-size: clamp(90px, 18vw, 260px);
  line-height: 0.65;
}

.echo-target {
  border: 1px solid rgba(18,18,18,0.22);
  border-radius: 50%;
}

.echo-target::after {
  position: absolute;
  inset: 19%;
  border: 1px solid rgba(18,18,18,0.16);
  border-radius: 50%;
  content: "";
}

.again-button {
  position: absolute;
  right: 7%;
  bottom: 12%;
  z-index: 5;
  display: flex;
  gap: 28px;
  align-items: center;
  padding: 12px 0;
  background: transparent;
  border-bottom: 2px solid currentColor;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.again-button span {
  font-size: 19px;
}

.phase-rail {
  position: fixed;
  top: 50%;
  right: 0;
  z-index: 30;
  display: grid;
  transform: translateY(-50%);
}

.phase-rail button {
  width: 52px;
  height: 58px;
  padding: 0;
  color: inherit;
  background: transparent;
  border-top: 1px solid currentColor;
  font-size: 9px;
  font-weight: 700;
}

.phase-rail button:last-child {
  border-bottom: 1px solid currentColor;
}

.phase-rail button[aria-current="step"] {
  color: var(--paper);
  background: var(--ink);
}

body[data-phase="focus"] .phase-rail button[aria-current="step"] {
  color: var(--ink);
  background: var(--acid);
}

footer {
  bottom: 0;
  height: 54px;
  border-top: 1px solid currentColor;
}

body[data-phase="focus"],
body[data-phase="echo"] {
  background: var(--paper);
}

body.is-paused *,
body.is-paused *::before,
body.is-paused *::after {
  animation-play-state: paused !important;
}

@media (max-width: 760px) {
  .topline,
  footer {
    right: 18px;
    left: 18px;
  }

  .phase-name {
    display: none;
  }

  .scene-arrival {
    padding: 112px 22px 76px;
  }

  .eyebrow {
    top: 17%;
    left: 22px;
  }

  h1 {
    margin-top: 16vh;
    font-size: clamp(74px, 26vw, 150px);
    line-height: 0.72;
  }

  h1 span:last-child {
    margin-left: 5vw;
  }

  .arrival-target {
    top: 11%;
    right: -20%;
    width: min(78vw, 500px);
  }

  .start-button {
    right: 9%;
    bottom: 16%;
    width: 106px;
  }

  .arrival-note {
    display: none;
  }

  .phase-rail {
    top: auto;
    right: 18px;
    bottom: 54px;
    grid-template-columns: repeat(3, 42px);
    transform: none;
  }

  .phase-rail button {
    width: 42px;
    height: 36px;
    border-right: 1px solid currentColor;
  }

  .phase-rail button:first-child {
    border-left: 1px solid currentColor;
  }

  .phase-rail button:last-child {
    border-bottom: 0;
  }

  .focus-count {
    top: 11%;
    left: 22px;
  }

  .focus-target,
  .echo-target {
    width: min(86vw, 56vh);
  }

  .scene-focus h2 {
    right: 22px;
    bottom: 16%;
  }

  .echo-prompt {
    top: 13%;
    white-space: normal;
    text-align: center;
  }

  .scene-echo h2 {
    top: 24%;
    left: 20px;
    font-size: clamp(82px, 27vw, 170px);
  }

  .again-button {
    right: auto;
    bottom: 15%;
    left: 22px;
  }

  footer span {
    max-width: 100px;
  }
}

@media (max-height: 580px) and (orientation: landscape) {
  .focus-count {
    top: 16%;
  }

  .focus-target,
  .echo-target {
    width: min(42vw, 62vh);
  }

  .scene-focus h2 {
    bottom: 16%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .soundless span {
    animation: none;
  }
}

@keyframes count-up {
  to { transform: scaleX(1); }
}

@keyframes signal {
  to { height: 4px; }
}
