/* One page, portrait, no scrolling ever. Everything is sized off the viewport
   so the same rules hold on a phone and in a desktop window. */

:root {
  --ink: #3b2b1a;
  --paper: #ffffff;
  --sky: #4ec0ca;
  --shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  background: var(--sky);
  color: var(--paper);
  font-family: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* The play surface. `fixed` keeps it pinned to the visual viewport on iOS,
   where 100vh lies about the height of the window. */
#stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
}

/* --- HUD ------------------------------------------------------------- */

#hud {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 3vh);
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
}

#score {
  font-size: clamp(2.5rem, 12vw, 4.5rem);
  font-weight: 700;
  line-height: 1;
  text-shadow: var(--shadow);
}

#best {
  margin-top: 0.4em;
  font-size: clamp(0.7rem, 3.2vw, 1rem);
  letter-spacing: 0.12em;
  opacity: 0.85;
  text-shadow: var(--shadow);
}

/* --- Cards ------------------------------------------------------------ */

/* Cards never eat a tap - the whole canvas has to stay a flap target.
   Only the buttons inside them opt back in. */
.card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  text-align: center;
  pointer-events: none;
}

.card[hidden] {
  display: none;
}

/* A scrim, so the result stays readable whatever the bird crashed into. */
#over-card {
  background: rgba(0, 0, 0, 0.4);
}

.card p {
  margin: 0;
  text-shadow: var(--shadow);
}

.title {
  font-size: clamp(1.6rem, 8vw, 3rem);
  font-weight: 700;
  letter-spacing: 0.16em;
}

.hint {
  font-size: clamp(0.9rem, 4.5vw, 1.4rem);
  letter-spacing: 0.1em;
  animation: pulse 1.4s ease-in-out infinite;
}

.stat {
  font-size: clamp(0.9rem, 4.2vw, 1.3rem);
  letter-spacing: 0.12em;
}

.stat b {
  font-size: 1.4em;
}

.flash {
  font-size: clamp(0.9rem, 4.2vw, 1.3rem);
  letter-spacing: 0.12em;
  color: #ffe66d;
  animation: pulse 0.8s ease-in-out infinite;
}

.flash[hidden] {
  display: none;
}

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

/* --- Controls --------------------------------------------------------- */

/* Anchored low so it lands under a thumb rather than in the middle of the
   screen, which is where a vertically centred card would put it. */
#restart {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16%);
  pointer-events: auto;
  min-width: 12rem;
  min-height: 3.75rem;
  padding: 0 1.5em;
  border: 0;
  border-radius: 999px;
  background: #ffd166;
  color: var(--ink);
  font: inherit;
  font-size: clamp(1rem, 5vw, 1.5rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  box-shadow: 0 4px 0 #d9a441;
  cursor: pointer;
}

#restart:active {
  transform: translate(-50%, 3px);
  box-shadow: 0 1px 0 #d9a441;
}

#mute {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 2vh);
  right: calc(env(safe-area-inset-right, 0px) + 3vw);
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.22);
  color: var(--paper);
  line-height: 0;
  cursor: pointer;
}

#mute svg {
  width: 1.5rem;
  height: 1.5rem;
  pointer-events: none; /* keep the button itself the event target */
}

#mute .horn {
  fill: currentColor;
}

#mute .wave,
#mute .cross {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

#mute[aria-pressed='false'] .cross,
#mute[aria-pressed='true'] .wave {
  display: none;
}

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