@font-face {
  font-family: 'Monoton';
  src: url('fonts/monoton.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --mx: 50vw;
  --my: 50vh;
  --r: 1px;
  --bg: #05070a;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
  color: #e8e4dc;
}

canvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100vh;
}

#bg { z-index: 0; }

#c {
  z-index: 3;
  cursor: none;
  touch-action: none;
}

/* Warm flashlight glow that follows the pointer. */
.light {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    circle var(--r) at var(--mx) var(--my),
    rgba(255, 238, 205, 0.17) 0%,
    rgba(255, 222, 180, 0.07) 45%,
    rgba(255, 210, 160, 0) 100%
  );
}

/* The hidden title: only visible inside the flashlight circle. */
.title {
  position: fixed;
  inset: 0;
  z-index: 2;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.08em;
  pointer-events: none;
  user-select: none;
  font-family: 'Monoton', ui-sans-serif, system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(40px, 11.5vw, 190px);
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: center;
  background: linear-gradient(100deg, #ff3dbb 0%, #ffb347 35%, #3df5ff 68%, #9b6bff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(255, 90, 200, 0.45)) drop-shadow(0 0 30px rgba(60, 230, 255, 0.25));
  -webkit-mask-image: radial-gradient(circle var(--r) at var(--mx) var(--my), #000 0%, #000 35%, transparent 100%);
  mask-image: radial-gradient(circle var(--r) at var(--mx) var(--my), #000 0%, #000 35%, transparent 100%);
}

.light,
.title {
  opacity: 0;
}

/* Instruction line and battery meter at the bottom. */
.hint {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 4;
  width: min(92vw, 520px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
  user-select: none;
  transition: opacity 1.2s ease;
}

.hint.dim { opacity: 0.45; }

.hint-text {
  margin: 0;
  font: 500 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-align: center;
  color: rgba(240, 232, 220, 0.72);
  text-shadow: 0 0 12px rgba(255, 160, 220, 0.35);
}

.meter {
  width: 140px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.meter-fill {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #ff3dbb, #ffb347 45%, #3df5ff);
  box-shadow: 0 0 10px rgba(255, 120, 210, 0.7);
  transform-origin: left center;
  transform: scaleX(0);
}

.meter.locked .meter-fill {
  filter: saturate(0.8) brightness(0.9);
}

/* Sound toggle in the corner. */
.sound {
  position: fixed;
  right: 20px;
  bottom: 22px;
  z-index: 5;
  padding: 9px 14px 9px 30px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(10, 12, 16, 0.55);
  color: rgba(240, 232, 220, 0.75);
  font: 500 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

/* Small indicator dot: dim when off, glowing when on. */
.sound::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.25);
}

.sound[aria-pressed='true'] {
  color: #fff;
  border-color: rgba(255, 120, 210, 0.55);
  box-shadow: 0 0 14px rgba(255, 90, 200, 0.25);
}

.sound[aria-pressed='true']::before {
  background: #ff3dbb;
  box-shadow: 0 0 8px #ff3dbb;
}

.sound:hover { border-color: rgba(255, 255, 255, 0.3); }

.sound:focus-visible {
  outline: 2px solid #3df5ff;
  outline-offset: 3px;
}

@media (max-width: 480px) {
  .hint-text { font-size: 10px; letter-spacing: 0.2em; }
  .hint { bottom: 70px; }
  .sound { right: 50%; transform: translateX(50%); bottom: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .hint { transition: none; }
}
