* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
#board {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  touch-action: manipulation;
}
#readout {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 0.5em);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.6em;
  padding: 0.5em;
  z-index: 5;
  pointer-events: none;
}
/* One pip per level. Solved levels light up, the current one is ringed, and
   any level already reached can be tapped to replay it. */
#score {
  position: fixed;
  top: env(safe-area-inset-top, 0);
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7em;
  padding: 0.5em;
  z-index: 11;  /* above the start overlay: returning players see their score first */
  pointer-events: none;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: #777;
}
#pips {
  display: flex;
  align-items: center;
  gap: 0.15em;
}
.pip {
  /* the dot is small but the tap target is not */
  width: 1.6em;
  height: 1.6em;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
}
.pip::after {
  content: '';
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  border: 1px solid #333;
  transition: background 0.4s, box-shadow 0.4s, border-color 0.4s;
}
.pip.locked {
  pointer-events: none;
}
.pip.on::after {
  background: #2bff5e;
  border-color: #2bff5e;
  box-shadow: 0 0 6px hsla(130, 100%, 55%, 0.7);
}
/* solved in the fewest flips */
.pip.par::after {
  background: #ffcc44;
  border-color: #ffcc44;
  box-shadow: 0 0 8px rgba(255, 204, 68, 0.8);
}
.pip.current::after {
  outline: 1px solid #aaa;
  outline-offset: 2px;
}
#hint {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 2.4em);
  left: 0;
  right: 0;
  padding: 0 2em;
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #777;
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.6s;
}
#hint.fade {
  opacity: 0;
}
#banner {
  position: fixed;
  top: 40%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 2rem;
  letter-spacing: 0.2em;
  color: #8f8;
  text-shadow: 0 0 20px hsla(130, 100%, 55%, 0.8);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 6;
  pointer-events: none;
}
#banner.show {
  opacity: 1;
}
.stat {
  text-align: center;
  opacity: 0.7;
}
.stat .label {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: 0.1em;
}
.stat span:not(.label) {
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
}
#start {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 10;
}
#start.hidden {
  display: none;
}
#startOverlay {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2em;
  padding: 2em;
  text-align: center;
}
#title {
  font-weight: 300;
  font-size: 2.2rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #8f8;
  text-shadow: 0 0 20px hsla(130, 100%, 55%, 0.6);
}
#startButton {
  font-size: 1.5rem;
  padding: 1em 2em;
  border-radius: 0.5em;
  border: 1px solid #fff;
  background: #111;
  color: #fff;
  cursor: pointer;
}
#instructions {
  font-size: 0.9rem;
  color: #999;
  max-width: 400px;
  line-height: 1.4;
}
/* Lives in the readout row: the pips need the whole top edge. */
#shareButton {
  pointer-events: auto;
  font: inherit;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.5em 0.9em;
  border-radius: 2em;
  border: 1px solid #2a2a2a;
  background: rgba(0, 0, 0, 0.55);
  color: #6a6;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s;
}
#shareButton:hover {
  opacity: 1;
}
/* pulsed after a solve — the moment worth telling someone about */
#shareButton.pulse {
  opacity: 1;
  color: #8f8;
  border-color: hsla(130, 100%, 55%, 0.6);
  box-shadow: 0 0 16px hsla(130, 100%, 55%, 0.45);
}
.share-link {
  font: inherit;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: none;
  border: none;
  border-bottom: 1px solid #444;
  padding: 0.2em 0;
  color: #888;
  cursor: pointer;
}
.share-link:hover {
  color: #8f8;
  border-bottom-color: hsla(130, 100%, 55%, 0.6);
}
