html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
}

canvas {
  display: block;
  touch-action: none;
  cursor: grab;
}

canvas:active {
  cursor: grabbing;
}

/* 2.39:1 anamorphic letterbox, capped so portrait screens keep a usable frame */
.letterbox {
  position: fixed;
  left: 0;
  right: 0;
  height: clamp(28px, calc((100vh - 100vw / 2.39) / 2), 16vh);
  background: #000;
  z-index: 5;
  display: flex;
  align-items: center;
  padding: 0 28px;
  color: #efe4d4;
  pointer-events: none;
  user-select: none;
  overflow: hidden;
}

.letterbox.top {
  top: 0;
}

.letterbox.bottom {
  bottom: 0;
  justify-content: center;
}

.letterbox .title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.28em;
  opacity: 0.85;
}

.letterbox .title span {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-left: 10px;
}

.letterbox .hint {
  display: none;
  font-size: 11px;
  letter-spacing: 0.25em;
  opacity: 0.4;
}

.letterbox .clock {
  position: absolute;
  right: 28px;
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.3em;
  font-variant-numeric: tabular-nums;
}

/* Explore mode keeps the static letterbox and interactive controls. */
.explore .letterbox .hint {
  display: block;
}

.explore .letterbox .clock {
  display: none;
}

body:not(.explore) canvas {
  cursor: default;
}

/* Loading gate: covers everything (letterbox included) until all assets are in. */
#loader {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #07050a;
  color: #efe4d4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  transition: opacity 0.9s ease;
  user-select: none;
}

#loader.done {
  opacity: 0;
  pointer-events: none;
}

#loader.ready {
  cursor: pointer;
}

.loader-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.34em;
  opacity: 0.9;
}

.loader-title span {
  display: block;
  margin-top: 10px;
  text-align: center;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  opacity: 0.55;
}

.loader-bar {
  width: min(280px, 60vw);
  height: 2px;
  background: rgba(239, 228, 212, 0.14);
  border-radius: 2px;
  overflow: hidden;
}

.loader-bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #f3a6b8, #ffd9a8);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease-out;
}

.loader-status {
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  opacity: 0.6;
}

#loader.ready .loader-status {
  opacity: 0.85;
  animation: loader-pulse 2.2s ease-in-out infinite;
}

@keyframes loader-pulse {
  50% {
    opacity: 0.35;
  }
}
