* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; background: #05060d;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  touch-action: none; overscroll-behavior: none;
}

#wrap {
  position: relative; width: 100vw; height: 100vh; height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  background: #05060d; user-select: none;
}

canvas#sky {
  display: block; background: #070812; touch-action: none;
  width: 100%; height: 100%;
  max-width: 100vw; max-height: 100vh; max-height: 100dvh;
}
@media (min-aspect-ratio: 16/9) { canvas#sky { width: auto; height: 100%; } }
@media (max-aspect-ratio: 16/9) { canvas#sky { width: 100%; height: auto; } }

#hud {
  position: absolute; top: env(safe-area-inset-top, 0px); left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; pointer-events: none;
}
#h-left { font-size: clamp(12px, 2.4vw, 16px); letter-spacing: 1px; color: #cfd6ff; }
#h-num { color: #64708f; font-family: ui-monospace, Consolas, monospace; }
#h-name { font-weight: 600; }
#h-right { display: flex; gap: 7px; pointer-events: auto; }
#h-right button {
  font-family: inherit; font-size: clamp(10px, 2vw, 12px); font-weight: 600;
  letter-spacing: 1px; color: #93a0c8;
  background: rgba(110, 130, 210, 0.12);
  border: 1px solid rgba(150, 170, 240, 0.3);
  border-radius: 14px; padding: 4px 12px; cursor: pointer;
}
#h-right button:hover { background: rgba(110, 130, 210, 0.25); }
#b-phys.on { background: #ffd27a; border-color: #ffd27a; color: #2a2000; }

#hint {
  position: absolute; left: 0; right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  text-align: center; pointer-events: none;
  color: #8e9ac4; font-size: clamp(12px, 2.5vw, 15px); letter-spacing: 0.5px;
}

#ov {
  position: absolute; inset: 0; background: rgba(4, 5, 12, 0.94);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 20;
}
#ov.hidden { display: none; }
#ov .card { max-width: 540px; width: 100%; text-align: center; color: #e6ebff; }
#ov h1 {
  margin: 0; font-size: clamp(32px, 8.5vw, 58px); letter-spacing: 9px;
  font-weight: 800; color: #fff; text-shadow: 0 0 26px rgba(140, 180, 255, 0.45);
}
#ov .tag { margin: 8px 0 20px; color: #7fb0ff; font-size: clamp(13px, 3vw, 16px); letter-spacing: 1px; }
#ov-body { font-size: clamp(12.5px, 2.7vw, 15px); line-height: 1.7; color: #b9c2e4; }
#ov-body p { margin: 0 0 12px; }
#ov-body b { color: #ffd27a; }
#ov-body .sub { color: #7a85ad; font-size: clamp(11px, 2.3vw, 13px); }
#ov .go {
  font-family: inherit; font-weight: 800; letter-spacing: 2px;
  font-size: clamp(15px, 3.6vw, 18px);
  background: #7fb0ff; color: #041028; border: none; border-radius: 9px;
  padding: 13px 40px; cursor: pointer; margin-top: 6px;
  box-shadow: 0 5px 0 #3f6cb5;
}
#ov .go:active { transform: translateY(2px); box-shadow: 0 3px 0 #3f6cb5; }

/* the seven levels, and where you are in them */
#dots {
  position: absolute; left: 0; right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 42px);
  display: flex; justify-content: center; gap: 9px; z-index: 5;
}
#dots .dot {
  width: 9px; height: 9px; padding: 0; border-radius: 50%; cursor: pointer;
  background: transparent; border: 1px solid rgba(150, 170, 240, 0.38);
  transition: transform .12s ease, background .12s ease;
}
#dots .dot:hover { transform: scale(1.35); }
#dots .dot.done { background: rgba(127, 176, 255, 0.55); border-color: rgba(127, 176, 255, 0.7); }
#dots .dot.now { background: #ffd27a; border-color: #ffd27a; transform: scale(1.3); }
#dots .dot.locked { border-color: rgba(120, 132, 170, 0.22); cursor: default; }
#dots .dot.locked:hover { transform: none; }

/* a phone held sideways is only ~390px tall: the card must not run off it */
#ov { overflow-y: auto; }
@media (max-height: 460px) {
  #ov { align-items: flex-start; padding: 12px 20px 20px; }
  #ov h1 { font-size: clamp(24px, 6vw, 34px); letter-spacing: 6px; }
  #ov .tag { margin: 5px 0 10px; }
  #ov-body { line-height: 1.5; }
  #ov-body p { margin: 0 0 7px; }
  #ov .go { padding: 10px 34px; margin-top: 2px; }
}
