/* Dot Loop — connect-the-dots puzzle. Full-bleed canvas, dark board. */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  -webkit-tap-highlight-color: transparent;
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #14161b;
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: none;
  overscroll-behavior: none;
}

#canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: pointer; }

/* ---------- HUD ---------- */
.hud {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  left: 0; right: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
}
.hud__score {
  font-size: clamp(2.1rem, 8vw, 3.4rem);
  font-weight: 900;
  letter-spacing: -0.01em;
  color: #eef1f6;
  text-shadow: 0 2px 18px rgba(120, 150, 220, 0.28);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.hud__best {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(190, 200, 220, 0.5);
  font-variant-numeric: tabular-nums;
}

.sound-btn {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  z-index: 6;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(180, 195, 225, 0.28);
  background: rgba(26, 30, 40, 0.55);
  color: #c8d4e8;
  font-size: 1.05rem;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color 140ms ease, background 140ms ease;
}
.sound-btn:hover { border-color: rgba(180, 195, 225, 0.6); }
.sound-btn[aria-pressed="false"] { color: rgba(160, 175, 205, 0.4); }

/* ---------- control bar ---------- */
.controls {
  position: fixed;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  gap: 8px;
}
.ctrl {
  appearance: none;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #cdd8ea;
  background: rgba(26, 30, 40, 0.6);
  border: 1.5px solid rgba(180, 195, 225, 0.24);
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
  transition: border-color 140ms ease, background 140ms ease;
}
.ctrl:hover { border-color: rgba(180, 195, 225, 0.55); background: rgba(36, 42, 56, 0.8); }

/* ---------- overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(120% 90% at 50% 42%, rgba(24, 27, 36, 0.86), rgba(10, 11, 16, 0.95));
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  transition: opacity 260ms ease;
}
.overlay[hidden] { display: none; }
.overlay.is-hidden { opacity: 0; pointer-events: none; }

.panel {
  text-align: center;
  max-width: 460px;
  padding: 34px 30px 32px;
  border-radius: 26px;
  background: rgba(24, 27, 36, 0.9);
  border: 1px solid rgba(180, 195, 225, 0.12);
  box-shadow: 0 28px 70px -18px rgba(0, 0, 0, 0.7);
  animation: pop 320ms cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
@keyframes pop { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.panel__title {
  margin: 0 0 6px;
  font-size: clamp(2.4rem, 10vw, 3.9rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 0.95;
  padding-bottom: 0.16em;
  background: linear-gradient(120deg, #ff5a68 0%, #ffab33 28%, #25d6a4 55%, #4f9bff 78%, #a86bff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.panel__text { margin: 0 0 26px; font-size: clamp(0.96rem, 3.3vw, 1.06rem); line-height: 1.6; font-weight: 500; color: #c2ccdc; }
.panel__text b { color: #eef1f6; font-weight: 800; }
.play-btn {
  appearance: none;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  color: #2a0f13;
  background: linear-gradient(180deg, #ff8a94, #f0515f);
  border: 0;
  padding: 16px 44px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 10px 28px -6px rgba(240, 81, 95, 0.55);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.play-btn:hover { transform: translateY(-2px); box-shadow: 0 16px 38px -8px rgba(240, 81, 95, 0.68); }
.play-btn:active { transform: translateY(0); }

/* ---------- frame + hint ---------- */
.frame { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
.frame__corner {
  position: absolute;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(180, 195, 225, 0.5);
}
.frame__corner--tl { top: max(14px, env(safe-area-inset-top)); left: 16px; }
.frame__corner--tr { top: max(14px, env(safe-area-inset-top)); right: 62px; }
.frame__corner--bl { bottom: 14px; left: 16px; }
.frame__corner a { color: inherit; text-decoration: none; pointer-events: auto; }
.frame__corner a:hover { color: #ff8a94; }

.hint {
  position: fixed;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(180, 195, 225, 0.5);
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 300ms ease;
}
.hint.is-gone { opacity: 0; }

@media (max-width: 560px) {
  .frame__corner--bl { display: none; }
  .frame__corner--tr { display: none; }
}
