/* Bell Run — styles. Daytime pixel-meadow page frame, Prodigies buttons. */

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body.bellrun-page {
  font-family: "Nunito", "Avenir Next Rounded", "Trebuchet MS", "Verdana", sans-serif;
  /* the game's banded daytime sky + grass floor, page-wide */
  background:
    linear-gradient(0deg, #8a5a34 0 34px, #6abb4a 34px 52px, transparent 52px),
    linear-gradient(180deg, #3ec6f0 0%, #63d5f5 55%, #8fe4fa 100%);
  color: #1b233e;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.app {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: stretch;
  justify-content: center;
}






/* ---- character select ---- */

.select-screen {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  padding: calc(58px + env(safe-area-inset-top)) 16px 18px;
  gap: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.select-head { text-align: center; }

.app-title {
  margin: 0;
  font-size: clamp(30px, 6vw, 40px);
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #1b233e;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.5);
}

.select-tagline {
  margin: 2px 0 0;
  font-size: clamp(15px, 3vw, 18px);
  font-weight: 800;
  color: #135d84;
}

.select-sub {
  margin: 10px 0 0;
  font-size: clamp(17px, 3.5vw, 21px);
  font-weight: 800;
  color: #1b233e;
}

.bell-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}

.bell-card {
  appearance: none;
  border: 3px solid transparent;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
  color: #1b233e;
  padding: 10px 6px 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.bell-card:hover { transform: translateY(-3px); }
.bell-card:active { transform: translateY(0) scale(0.97); }

.bell-card.is-selected {
  border-color: var(--bell-color);
  background: rgba(255, 255, 255, 0.85);
  animation: bellBounce 0.45s ease;
}

@keyframes bellBounce {
  0% { transform: scale(1); }
  35% { transform: scale(1.09); }
  65% { transform: scale(0.97); }
  100% { transform: scale(1); }
}

.bell-card-img {
  width: 58px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bell-card-img img {
  max-width: 100%;
  max-height: 100%;
  filter: drop-shadow(0 4px 6px rgba(27, 35, 62, 0.25));
}

.bell-card-note {
  font-size: 15px;
  font-weight: 900;
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--bell-color);
  color: #fff;
  min-width: 42px;
  text-align: center;
}

.bell-card[style*="#f1e606"] .bell-card-note,
.bell-card[style*="#ffd25b"] .bell-card-note {
  color: #512d1b;
}

.select-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-bottom: env(safe-area-inset-bottom);
}

.controls-hint {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #135d84;
}

.controls-hint kbd {
  font-family: inherit;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  padding: 1px 7px;
}

.action-btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 34px;
  font-family: inherit;
  font-size: 19px;
  font-weight: 900;
  cursor: pointer;
  color: #1b233e;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 0 rgba(27, 35, 62, 0.25);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  min-height: 52px;
}

.action-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(27, 35, 62, 0.25);
}

.action-btn.primary {
  background: #6ab845; /* Prodigies green — solid */
  color: #fff;
}

/* ---- game stage ---- */

.game-screen {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

/* stage sized by JS: 540 logical height, 640-960 logical width */
.stage {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(27, 35, 62, 0.35);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

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

.hud {
  position: absolute;
  top: 10px;
  /* Clear the shared chrome's fixed Menu pill (top-left) — at left:12px the
     hearts rendered underneath it. */
  left: 116px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  pointer-events: none;
  z-index: 10;
  font-size: 19px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 0 rgba(27, 35, 62, 0.45);
}

.hud-notes { margin-left: auto; }

.hud-hearts { letter-spacing: 2px; }

/* ---- hints ---- */

.ready-hint {
  position: absolute;
  top: 18%;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 10;
  animation: hintFloat 1.6s ease-in-out infinite;
  transition: opacity 0.5s ease;
}

.ready-hint.fade-out { opacity: 0; }

.ready-title {
  font-size: 30px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 3px 0 rgba(27, 35, 62, 0.4);
}

.ready-sub {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 0 rgba(27, 35, 62, 0.4);
}

.ready-sub kbd {
  font-family: inherit;
  background: rgba(27, 35, 62, 0.5);
  border-radius: 6px;
  padding: 1px 7px;
}

@keyframes hintFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

/* ---- panels ---- */

.panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  width: min(360px, 90%);
  max-height: 94%;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(255, 255, 255, 0.96);
  border: 2px solid rgba(27, 35, 62, 0.12);
  border-radius: 24px;
  padding: 18px 18px 20px;
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: panelIn 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes panelIn {
  from { transform: translate(-50%, -44%) scale(0.85); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.panel h2 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 900;
  color: #1b233e;
}

.over-sub {
  margin: 0 0 14px;
  font-weight: 800;
  color: #4a5878;
}

.panel-bell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 6px;
}

.panel-bell img {
  width: 60px;
  height: auto;
  filter: drop-shadow(0 4px 8px rgba(27, 35, 62, 0.25));
}

.panel-bell-name {
  font-weight: 900;
  font-size: 16px;
}

.new-best {
  display: inline-block;
  margin: 4px 0 6px;
  padding: 5px 16px;
  border-radius: 999px;
  background: #f39422; /* solid Prodigies orange */
  color: #fff;
  font-weight: 900;
  font-size: 15px;
  animation: bellBounce 0.6s ease infinite alternate;
}

.panel-stats {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 10px 0 14px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(27, 35, 62, 0.06);
  border-radius: 12px;
  padding: 7px 14px;
}

.stat-row dt {
  font-size: 13px;
  font-weight: 800;
  color: #4a5878;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-row dd {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  color: #1b233e;
}

.panel-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-actions .action-btn { width: 100%; }

/* PK-5 class-score widget breathing room (matches Flappy Bell) */
#classScoreSlot .pk5s-block {
  margin: 0 0 16px;
  text-align: left;
}

/* ---- touch controls ---- */

.touch-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 14px calc(12px + env(safe-area-inset-bottom));
  pointer-events: none;
  z-index: 15;
}

.touch-cluster {
  display: flex;
  gap: 10px;
}

/* The whole stage steers now (see the steering block in bell-run-v1.js), so
   these are the visible HINT that rolling exists rather than the only way to
   do it. Still grown from 76px, because a child who has found them is going
   to keep using them. */
.touch-btn {
  pointer-events: auto;
  appearance: none;
  border: 0;
  width: 92px;
  height: 92px;
  border-radius: 999px;
  background: rgba(27, 35, 62, 0.35);
  color: #fff;
  font-family: inherit;
  font-size: 26px;
  font-weight: 900;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  touch-action: none;
}

.touch-btn.is-down { background: rgba(27, 35, 62, 0.6); }

.touch-down {
  background: rgba(255, 210, 91, 0.6);
  color: #1b233e;
}

.touch-down.is-down { background: rgba(255, 210, 91, 0.9); }

.touch-jump {
  width: 116px;
  height: 116px;
  font-size: 20px;
  background: rgba(106, 184, 69, 0.55);
}

.touch-jump.is-down { background: rgba(106, 184, 69, 0.85); }

/* ---- reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
  .bell-card,
  .bell-card.is-selected,
  .ready-hint,
  .new-best,
  .panel {
    animation: none;
    transition: none;
  }
}

/* Control hints: a pre-reader on an iPad should never be told about Space and
   arrow keys. The keyboard line shows on fine pointers, the touch line on
   coarse ones — same trick the games use to reveal #touchControls. */
.hint-touch { display: none; }
@media (pointer: coarse) {
  .hint-keys { display: none; }
  .hint-touch { display: inline; }
}

/* Level picker — two big cards under the bell grid. Selected card gets the
   same red outline the bell cards use; each card carries a swatch of its
   level's sky so a non-reader can tell them apart. */
.select-sub-level { margin-top: 18px; }
.level-row {
  display: flex; justify-content: center; gap: 12px;
  flex-wrap: wrap; margin: 4px 0 6px;
}
.level-pick {
  display: flex; align-items: center; gap: 12px;
  min-width: 240px; min-height: 72px;
  padding: 10px 18px 10px 12px;
  border-radius: 16px; border: 3px solid transparent;
  background: #eaf7fd; color: #1b2245;
  font-family: inherit; cursor: pointer; text-align: left;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.level-pick:hover { transform: translateY(-2px); }
.level-pick.is-selected { border-color: #e72829; background: #ffffff; }
.level-pick .lp-num {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 999px;
  font-weight: 900; font-size: 20px; color: #fff;
  background: linear-gradient(180deg, #3ec6f0, #8fe4fa);
}
.level-pick.theme-sunset .lp-num {
  background: linear-gradient(180deg, #7b5bbf, #ffc46b);
}
.level-pick .lp-name { display: block; font-weight: 900; font-size: 17px; }
.level-pick .lp-sub { display: block; font-weight: 700; font-size: 13px; opacity: 0.65; }
