@font-face {
  font-family: "Bodoni Moda";
  src: url("/assets/fonts/bodoni-moda-400-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --sky: #dde7eb;
  --paper: #f5f5f7;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --coral: #b95c55;
  --yellow: #d6b765;
  --blue: #285fd1;
  --line: rgba(29, 29, 31, 0.12);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  color: var(--ink);
  background: var(--sky);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Helvetica Neue", sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  font: inherit;
  letter-spacing: 0;
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.light-level,
.stage,
.game-root {
  position: fixed;
  inset: 0;
}

.light-level {
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

.stage {
  z-index: 0;
  background: var(--sky);
}

.game-root {
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 520ms ease;
}

.game-root[data-ready="true"] {
  opacity: 1;
}

.game-root canvas {
  display: block;
  max-width: none;
  max-height: none;
}

.level-bar {
  position: fixed;
  z-index: 50;
  top: max(12px, env(safe-area-inset-top));
  right: max(132px, calc(env(safe-area-inset-right) + 120px));
  left: max(12px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  pointer-events: none;
}

.home-hatch,
.sound-switch {
  width: max-content;
  min-height: 44px;
  color: var(--ink);
  background: rgba(248, 248, 250, 0.64);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(38, 50, 56, 0.1);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  pointer-events: auto;
}

.home-hatch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px 0 10px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
}

.home-hatch-icon {
  position: relative;
  width: 23px;
  height: 23px;
  border: 1px solid rgba(25, 54, 79, 0.24);
  border-radius: 4px;
}

.home-hatch-icon::before,
.home-hatch-icon::after,
.home-hatch-icon i {
  content: "";
  position: absolute;
  display: block;
}

.home-hatch-icon::before {
  top: 5px;
  left: 5px;
  width: 8px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-left: 0;
}

.home-hatch-icon::after {
  top: 10px;
  left: 2px;
  width: 10px;
  border-top: 1.5px solid currentColor;
}

.home-hatch-icon i {
  top: 7px;
  left: 1px;
  width: 6px;
  height: 6px;
  border-bottom: 1.5px solid currentColor;
  border-left: 1.5px solid currentColor;
  transform: rotate(45deg);
}

.level-id {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: rgba(25, 54, 79, 0.78);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-transform: uppercase;
}

.level-id span {
  padding-right: 10px;
  border-right: 1px solid var(--line);
}

.sound-switch {
  display: inline-flex;
  justify-self: end;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  cursor: pointer;
}

.sound-bars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 16px;
}

.sound-bars i {
  display: block;
  width: 2px;
  background: currentColor;
  border-radius: 1px;
  animation: meter 1s ease-in-out infinite alternate;
}

.sound-bars i:nth-child(1) {
  height: 6px;
}

.sound-bars i:nth-child(2) {
  height: 13px;
  animation-delay: -0.35s;
}

.sound-bars i:nth-child(3) {
  height: 9px;
  animation-delay: -0.65s;
}

.is-muted .sound-bars i {
  height: 2px;
  animation-play-state: paused;
}

.sound-label {
  font-size: 12px;
  font-weight: 650;
}

.start-screen {
  position: fixed;
  z-index: 30;
  top: 50%;
  left: clamp(24px, 8vw, 120px);
  width: min(590px, calc(100vw - 48px));
  transform: translateY(-48%);
  transition:
    opacity 300ms ease,
    transform 420ms var(--ease-out);
}

.start-screen.is-leaving {
  opacity: 0;
  transform: translate(-18px, -48%);
  pointer-events: none;
}

.start-index {
  margin: 0 0 18px;
  color: rgba(29, 29, 31, 0.58);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.start-screen h1 {
  max-width: 100%;
  margin: 0;
  color: var(--ink);
  font-family: "Bodoni Moda", "Times New Roman", serif;
  font-size: clamp(84px, 12vw, 176px);
  font-style: italic;
  font-weight: 400;
  line-height: 0.82;
}

.start-copy {
  max-width: 430px;
  margin: 25px 0 0;
  color: var(--muted);
  font-size: clamp(14px, 1.35vw, 17px);
  line-height: 1.5;
}

.start-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 30px;
}

.wake-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 38px;
  min-width: 152px;
  min-height: 50px;
  padding: 0 15px 0 18px;
  color: #fff;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition:
    background-color 160ms ease,
    transform 160ms var(--ease-out);
}

.wake-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.quiet-link {
  min-height: 44px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(25, 54, 79, 0.38);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.control-note {
  display: flex;
  gap: 12px;
  margin: 19px 0 0;
  color: rgba(25, 54, 79, 0.68);
  font-size: 11px;
  font-weight: 600;
}

.touch-copy {
  display: none;
}

.game-hud {
  position: fixed;
  z-index: 35;
  top: max(80px, calc(env(safe-area-inset-top) + 68px));
  left: max(18px, env(safe-area-inset-left));
  width: min(188px, calc(100vw - 36px));
  padding: 14px 15px 13px;
  background: rgba(248, 248, 250, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 6px;
  box-shadow: 0 12px 36px rgba(38, 50, 56, 0.1);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
}

.light-counter {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
}

.light-counter strong {
  color: var(--ink);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.light-track {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin-top: 9px;
}

.light-track i {
  height: 5px;
  background: rgba(25, 54, 79, 0.12);
  border-radius: 2px;
  transition:
    background-color 220ms ease,
    box-shadow 220ms ease;
}

.light-track i.is-lit {
  background: var(--yellow);
  box-shadow: 0 0 11px rgba(246, 202, 79, 0.75);
}

.game-hint {
  display: none;
}

.fragment-toast {
  position: fixed;
  z-index: 40;
  top: 19%;
  left: 50%;
  max-width: min(520px, calc(100vw - 36px));
  margin: 0;
  padding: 11px 16px;
  color: var(--ink);
  background: rgba(248, 248, 250, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 5px;
  box-shadow: 0 16px 42px rgba(38, 50, 56, 0.12);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  opacity: 0;
  transform: translate(-50%, 8px);
  font-family: "Bodoni Moda", "Times New Roman", serif;
  font-size: clamp(19px, 2.2vw, 26px);
  font-style: italic;
  white-space: nowrap;
  transition:
    opacity 220ms ease,
    transform 300ms var(--ease-out);
}

.fragment-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.touch-controls {
  position: fixed;
  z-index: 40;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  left: max(18px, env(safe-area-inset-left));
  display: none;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
}

.move-controls {
  display: flex;
  gap: 10px;
}

.touch-controls button {
  display: inline-grid;
  place-items: center;
  width: 62px;
  height: 62px;
  padding: 0;
  color: var(--ink);
  background: rgba(255, 253, 244, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  box-shadow: 0 10px 30px rgba(35, 88, 108, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: auto;
  touch-action: none;
  font-size: 25px;
  font-weight: 550;
  transition: transform 100ms ease;
}

.touch-controls button.is-pressed {
  transform: scale(0.91);
}

.touch-controls .jump-control {
  display: flex;
  flex-direction: column;
  gap: 0;
  color: #fff;
  background: var(--coral);
  border-color: rgba(255, 255, 255, 0.5);
  font-size: 19px;
}

.jump-control span:last-child {
  font-size: 10px;
  font-weight: 750;
}

.finale {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(76px, env(safe-area-inset-top)) 24px
    max(32px, env(safe-area-inset-bottom));
  overflow: auto;
  background: rgba(245, 245, 247, 0.9);
  backdrop-filter: blur(26px) saturate(110%);
  -webkit-backdrop-filter: blur(26px) saturate(110%);
  opacity: 0;
  transition: opacity 380ms ease;
}

.finale.is-visible {
  opacity: 1;
}

.finale-beam {
  position: absolute;
  top: -18vh;
  left: 50%;
  width: min(68vw, 760px);
  height: 118vh;
  background: rgba(214, 183, 101, 0.14);
  clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%);
  transform: translateX(-50%);
  pointer-events: none;
}

.finale-letter {
  position: relative;
  width: min(720px, 100%);
  text-align: center;
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 500ms 160ms ease,
    transform 700ms 120ms var(--ease-out);
}

.finale.is-visible .finale-letter {
  opacity: 1;
  transform: translateY(0);
}

.finale-for {
  margin: 0 0 22px;
  color: var(--coral);
  font-size: 12px;
  font-weight: 800;
}

.finale h2 {
  margin: 0;
  color: var(--ink);
  font-family: "Bodoni Moda", "Times New Roman", serif;
  font-size: clamp(62px, 9vw, 116px);
  font-style: italic;
  font-weight: 400;
  line-height: 0.95;
}

.finale-message {
  margin: 30px auto 0;
  color: var(--muted);
  font-size: clamp(13px, 1.4vw, 16px);
  line-height: 1.8;
}

.finale-love {
  margin: 22px 0 0;
  color: var(--coral);
  font-family: "Bodoni Moda", "Times New Roman", serif;
  font-size: clamp(42px, 6vw, 72px);
  font-style: italic;
}

.finale-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 34px;
}

.finale-actions button,
.finale-actions a,
.webgl-fallback button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 17px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.finale-actions button,
.webgl-fallback button {
  color: #fff;
  background: var(--ink);
  border: 1px solid var(--ink);
}

.finale-actions a {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(25, 54, 79, 0.18);
}

.webgl-fallback {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  background: var(--paper);
}

.webgl-fallback p {
  max-width: 360px;
  margin: 0;
  line-height: 1.65;
}

.webgl-fallback button {
  justify-self: center;
}

.home-hatch:hover,
.sound-switch:hover,
.wake-button:hover {
  transform: translateY(-1px);
}

.quiet-link:hover {
  border-bottom-color: currentColor;
}

.home-hatch:focus-visible,
.sound-switch:focus-visible,
.wake-button:focus-visible,
.quiet-link:focus-visible,
.touch-controls button:focus-visible,
.finale-actions button:focus-visible,
.finale-actions a:focus-visible {
  outline: 3px solid #006adc;
  outline-offset: 3px;
}

body[data-archive-date="2026-07-25"] .arc-trigger {
  width: 44px;
  min-width: 44px;
  padding: 0;
}

body[data-archive-date="2026-07-25"] .arc-trigger-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@keyframes meter {
  to {
    transform: scaleY(0.55);
  }
}

@media (pointer: coarse) {
  .touch-controls:not([hidden]) {
    display: flex;
  }

  .desktop-copy {
    display: none;
  }

  .touch-copy {
    display: inline;
  }
}

@media (max-width: 760px) {
  .touch-controls:not([hidden]) {
    display: flex;
  }

  .desktop-copy {
    display: none;
  }

  .touch-copy {
    display: inline;
  }

  .level-bar {
    right: max(68px, calc(env(safe-area-inset-right) + 56px));
    grid-template-columns: 1fr auto;
  }

  .level-id {
    display: none;
  }

  .home-hatch {
    width: 44px;
    padding: 0;
    justify-content: center;
  }

  .home-hatch > span:last-child,
  .sound-label {
    display: none;
  }

  .sound-switch {
    width: 44px;
    justify-content: center;
    padding: 0;
  }

  .start-screen {
    top: auto;
    right: 24px;
    bottom: max(74px, calc(env(safe-area-inset-bottom) + 52px));
    left: 24px;
    width: auto;
    transform: none;
  }

  .start-screen.is-leaving {
    transform: translateY(12px);
  }

  .start-index {
    margin-bottom: 11px;
  }

  .start-screen h1 {
    font-size: clamp(76px, 25vw, 112px);
  }

  .start-copy {
    max-width: 330px;
    margin-top: 14px;
    font-size: 15px;
    line-height: 1.55;
  }

  .start-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
    margin-top: 19px;
  }

  .wake-button {
    width: min(230px, 100%);
  }

  .quiet-link {
    min-height: 36px;
  }

  .control-note {
    margin-top: 10px;
  }

  .game-hud {
    top: max(70px, calc(env(safe-area-inset-top) + 60px));
    width: 158px;
    padding: 11px 12px;
  }

  .game-hint {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .fragment-toast {
    top: 18%;
    max-width: calc(100vw - 30px);
    font-size: 16px;
    white-space: normal;
    text-align: center;
  }

  .finale {
    align-items: center;
    padding-right: 19px;
    padding-left: 19px;
  }

  .finale-for {
    margin-bottom: 16px;
  }

  .finale h2 {
    font-size: clamp(64px, 18vw, 84px);
  }

  .finale-message {
    margin-top: 22px;
    font-size: 14px;
    line-height: 1.9;
  }

  .finale-love {
    margin-top: 13px;
  }

  .finale-actions {
    flex-direction: column;
    width: min(280px, 100%);
    margin-right: auto;
    margin-left: auto;
  }
}

@media (max-height: 640px) and (orientation: landscape) {
  .start-screen {
    top: 54%;
  }

  .start-screen h1 {
    font-size: 68px;
  }

  .start-copy {
    margin-top: 12px;
    font-size: 14px;
  }

  .start-actions {
    margin-top: 15px;
  }

  .control-note {
    display: none;
  }

  .game-hud {
    top: 68px;
  }

  .touch-controls button {
    width: 52px;
    height: 52px;
  }

  .finale-message {
    margin-top: 18px;
    line-height: 1.7;
  }

  .finale-actions {
    margin-top: 18px;
  }
}

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

@media (prefers-reduced-transparency: reduce) {
  .home-hatch,
  .sound-switch,
  .game-hud,
  .fragment-toast {
    background: rgba(248, 248, 250, 0.96);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  .home-hatch,
  .sound-switch,
  .game-hud,
  .fragment-toast {
    background: #f8f8fa;
    border-color: #1d1d1f;
  }
}
