* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #2a5f9e;
  touch-action: none;          /* no scrolling or zooming while playing */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Press Start 2P", monospace;
  color: #fff;
}

/* The game box keeps a phone shape (9 x 16). game.js sets its size. */
#wrap {
  position: relative;
  overflow: hidden;
}

canvas {
  image-rendering: pixelated;  /* keeps the pixels big and chunky */
  image-rendering: crisp-edges;
}

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

.hidden {
  display: none !important;
}

.shadow, #hud, #help, #banner, #tapHint, .screen {
  text-shadow: 0.15em 0.15em 0 #14141c;
}

/* ---------- Top bar ---------- */
#hud {
  position: absolute;
  top: 0.7em;
  left: 0.7em;
  right: 0.7em;
  display: flex;
  align-items: center;
  gap: 0.8em;
  font-size: 0.8em;
  pointer-events: none;
}

#hudEggs {
  margin-left: auto;
}

#hud span {
  white-space: nowrap;
}

/* Eggs in a row (your high score), under the level */
#hudStreak {
  position: absolute;
  top: 1.8em;
  left: 0;
  font-size: 0.7em;
  color: #ffd21f;
}

#hudStreak.hidden {
  display: none;
}

#hud .icon {
  pointer-events: auto;
  min-width: 0;
  flex: none;
  width: 2.2em;
  height: 2.2em;
  margin: 0;
  padding: 0;
  font-size: 0.8em;
}

#help {
  position: absolute;
  bottom: 0.5em;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.5em;
  line-height: 1.6;
  pointer-events: none;
}

#banner {
  position: absolute;
  top: 22%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.9em;
  line-height: 1.6;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

#banner.show {
  opacity: 1;
}

#banner small {
  display: block;
  font-size: 0.55em;
  color: #ffe9a8;
}

#tapHint {
  position: absolute;
  top: 58%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.8em;
  pointer-events: none;
  animation: blink 1s steps(2) infinite;
}

@keyframes blink {
  50% { opacity: 0.3; }
}

/* ---------- Menu screens ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  padding: 1.2em 1em;
  background: rgba(20, 20, 40, 0.55);
  overflow-y: auto;
  touch-action: pan-y;
}

.screen.show {
  display: flex;
}

.screen.dialog {
  background: rgba(20, 20, 40, 0.95);
  z-index: 60;   /* above the trophy button (50), below the leaderboard card (1000) */
}

#titleScreen {
  background: transparent;
}

/* Leave room up top to see the baby bird that just hatched */
#winScreen {
  justify-content: flex-end;
  padding-bottom: 3.5em;
  background: transparent;
}

h1 {
  margin: 0 0 0.5em;
  font-size: 2em;
  line-height: 1.3;
  color: #ffe14d;
  text-align: center;
}

h2 {
  margin: 0 0 0.3em;
  font-size: 1.4em;
  line-height: 1.3;
  color: #ffe14d;
  text-align: center;
}

.small {
  margin: 0;
  font-size: 0.6em;
  line-height: 1.8;
  text-align: center;
}

.tiny {
  margin: 0;
  font-size: 0.45em;
  line-height: 1.8;
  text-align: center;
  max-width: 90%;
  color: #dde6ff;
}

.label {
  font-size: 0.55em;
  color: #ffe9a8;
}

button {
  font-family: inherit;
  color: #fff;
  font-size: 0.75em;
  min-width: 60%;
  padding: 0.8em 1em;
  margin: 0;
  background: #3a78e0;
  border: 0;
  box-shadow:
    inset -0.25em -0.25em 0 #1d3f94,
    inset 0.25em 0.25em 0 #7fb2ff,
    0 0 0 0.2em #14141c;
  cursor: pointer;
  text-shadow: 0.12em 0.12em 0 #14141c;
}

button:active {
  transform: translateY(0.15em);
  box-shadow:
    inset 0.25em 0.25em 0 #1d3f94,
    0 0 0 0.2em #14141c;
}

button.danger {
  background: #c43a3a;
  box-shadow: inset -0.25em -0.25em 0 #882020, inset 0.25em 0.25em 0 #ff7a7a, 0 0 0 0.2em #14141c;
}

/* The settings wheel: a little pixel gear */
button.gear {
  position: absolute;
  top: 0.6em;
  right: 0.6em;
  min-width: 0;
  width: 2.6em;
  height: 2.6em;
  padding: 0;
  background: #5a6070 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' shape-rendering='crispEdges'%3E%3Cg fill='%23fff'%3E%3Crect x='5' y='0' width='2' height='12'/%3E%3Crect x='0' y='5' width='12' height='2'/%3E%3Crect x='1' y='1' width='2' height='2'/%3E%3Crect x='9' y='1' width='2' height='2'/%3E%3Crect x='1' y='9' width='2' height='2'/%3E%3Crect x='9' y='9' width='2' height='2'/%3E%3Crect x='2' y='2' width='8' height='8'/%3E%3C/g%3E%3Crect x='4' y='4' width='4' height='4' fill='%235a6070'/%3E%3C/svg%3E") center / 60% no-repeat;
  image-rendering: pixelated;
  box-shadow: inset -0.2em -0.2em 0 #3a3f4a, inset 0.2em 0.2em 0 #8a90a0, 0 0 0 0.2em #14141c;
}

.row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  width: 100%;
}

.row .label {
  min-width: 4.5em;
  text-align: right;
}

button.arrow {
  min-width: 0;
  width: 2.4em;
  padding: 0.6em 0;
  font-size: 0.7em;
}

.pick {
  flex: 1;
  text-align: center;
  font-size: 0.5em;
  line-height: 1.7;
}

.pick b {
  display: block;
  font-size: 1.5em;
  color: #ffe14d;
}

.pick .lock {
  color: #ff9a9a;
}

#preview {
  width: 55%;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 0.2em #14141c;
}

.swatches {
  display: flex;
  gap: 0.5em;
}

.swatches button {
  min-width: 0;
  width: 2em;
  height: 2em;
  padding: 0;
}

.swatches button.on {
  outline: 0.2em solid #fff;
  outline-offset: 0.2em;
}

input {
  font-family: inherit;
  font-size: 0.7em;
  text-transform: uppercase;
  padding: 0.6em;
  width: 9em;
  border: 0;
  background: #fff;
  color: #14141c;
  box-shadow: 0 0 0 0.2em #14141c;
  user-select: text;
  -webkit-user-select: text;
}

#codeInput {
  width: 90%;
  text-align: center;
  font-size: 0.65em;
}

input[type=range] {
  width: 9em;
  padding: 0;
  background: transparent;
  box-shadow: none;
  accent-color: #ffd21f;
}

.segmented {
  display: flex;
  gap: 0.4em;
}

.segmented button {
  min-width: 0;
  padding: 0.7em 0.6em;
  font-size: 0.55em;
  background: #5a6070;
  box-shadow: inset -0.25em -0.25em 0 #3a3f4a, inset 0.25em 0.25em 0 #8a90a0, 0 0 0 0.2em #14141c;
}

.segmented button.on {
  background: #3ac24a;
  box-shadow: inset -0.25em -0.25em 0 #248a30, inset 0.25em 0.25em 0 #7fe08a, 0 0 0 0.2em #14141c;
}

button.toggle {
  min-width: 0;
  width: 5em;
  padding: 0.6em 0;
  font-size: 0.6em;
}

/* ---------- How to play ---------- */
#howToScreen {
  justify-content: flex-start;   /* long page: start at the top and scroll */
}

.howto {
  width: 100%;
  font-size: 0.5em;
  line-height: 1.8;
}

.howto .label {
  display: block;
  margin: 1.4em 0 0.4em;
  font-size: 1.1em;
  color: #ffe14d;
}

.howto .label:first-child {
  margin-top: 0;
}

.howto p {
  margin: 0 0 0.5em;
  color: #dde6ff;
}

.howto b {
  color: #fff;
  font-weight: normal;
}

.howto .pc {
  font-size: 0.85em;
  color: #9fb0d8;
}

.howto .dot {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 0.6em;
  vertical-align: -0.1em;
  box-shadow: 0 0 0 0.15em #14141c;
}

.code {
  font-size: 0.85em;
  line-height: 1.8;
  padding: 0.6em 0.8em;
  background: #fff;
  color: #14141c;
  text-shadow: none;
  box-shadow: 0 0 0 0.2em #14141c;
  text-align: center;
  word-break: break-all;
  user-select: text;
  -webkit-user-select: text;
}
