/* Bell Breaker — styles */

:root {
  --bb-navy: #1b2245;
  --bb-navy-deep: #131836;
  --bb-panel: #232b58;
  --bb-ivory: #fdf8ee;
  --bb-teal: #099695;
  --bb-green: #6abb4a;
  --bb-gold: #ffd25b;
  --bb-red: #e72829;
}

* { box-sizing: border-box; }

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

body.breaker-page {
  font-family: "Nunito", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(1100px 600px at 50% -80px, #2a3468 0%, var(--bb-navy) 55%, var(--bb-navy-deep) 100%);
  color: var(--bb-ivory);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  overflow-x: hidden;
}

[hidden] { display: none !important; }



.action-btn {
  appearance: none; border: none; border-radius: 14px;
  padding: 13px 26px; font-family: inherit; font-size: 17px;
  font-weight: 900; letter-spacing: 0.02em; color: #fff;
  background: var(--bb-teal);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.28); cursor: pointer;
}
.action-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.28); }
.action-btn.primary { background: var(--bb-green); }
.action-btn.small { padding: 9px 16px; font-size: 14px; border-radius: 11px; }

/* ------------------------------------------------------------------ */
/* Level select                                                        */
/* ------------------------------------------------------------------ */
.app { max-width: 900px; margin: 0 auto; padding: 16px clamp(10px, 3vw, 24px) 40px; }

.select-screen { text-align: center; }
.app-title {
  margin: 40px 0 2px; font-size: clamp(30px, 6vw, 46px); font-weight: 900;
}
.app-title .t-break { color: var(--bb-gold); }
.select-sub {
  margin: 0 0 22px; font-size: 16px; font-weight: 700;
  color: rgba(253, 248, 238, 0.75);
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px; max-width: 740px; margin: 0 auto;
}

.level-card {
  appearance: none; border: 2px solid rgba(253, 248, 238, 0.16);
  border-radius: 16px; background: var(--bb-panel); color: var(--bb-ivory);
  padding: 14px 10px 12px; font-family: inherit; cursor: pointer;
  text-align: center; transition: transform 0.12s ease, border-color 0.12s ease;
}
.level-card:not(.locked):hover { transform: translateY(-2px); border-color: rgba(253, 248, 238, 0.45); }
.level-card .lc-num {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: 999px; font-weight: 900; font-size: 15px; color: #fff; margin-bottom: 6px;
}
.level-card .lc-name { display: block; font-weight: 900; font-size: 14px; line-height: 1.25; }
.level-card .lc-stars {
  display: block; margin-top: 6px; font-size: 15px; letter-spacing: 2px;
  color: var(--bb-gold); min-height: 19px;
}
.level-card .lc-stars .off { color: rgba(253, 248, 238, 0.22); }
.level-card .lc-best { display: block; margin-top: 3px; font-size: 11px; font-weight: 800; color: rgba(253,248,238,0.55); }
.level-card.locked { opacity: 0.45; cursor: default; }

.theme-sky .lc-num { background: var(--bb-teal); }
.theme-meadow .lc-num { background: var(--bb-green); }
.theme-sunset .lc-num { background: #f39422; }
.theme-night .lc-num { background: #7b569e; }
.level-card.endless-card .lc-num { background: var(--bb-red); }

/* ------------------------------------------------------------------ */
/* Game screen                                                         */
/* ------------------------------------------------------------------ */
.game-screen {
  position: fixed; inset: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center;
  background:
    radial-gradient(1100px 600px at 50% -80px, #2a3468 0%, var(--bb-navy) 55%, var(--bb-navy-deep) 100%);
}

.hud {
  width: min(96vw, 640px);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 8px 2px 6px;
}
.hud-left, .hud-right { display: flex; align-items: center; gap: 12px; }
.hud-level-name { font-size: 14px; font-weight: 900; color: rgba(253, 248, 238, 0.8); }

.led {
  font-family: "Courier New", monospace;
  font-weight: 900; font-size: 20px; letter-spacing: 2px;
  color: #ffd25b; background: #0c1024;
  border: 2px solid rgba(253, 248, 238, 0.18);
  border-radius: 6px; padding: 2px 8px;
}
.led-label { font-size: 10px; font-weight: 900; letter-spacing: 0.1em; color: rgba(253,248,238,0.6); display: block; text-align: center; }

.balls-dots { font-size: 15px; letter-spacing: 3px; color: var(--bb-ivory); }
.balls-dots .spent { color: rgba(253, 248, 238, 0.18); }


.stage-wrap {
  position: relative;
  flex: 1;
  width: 100%;
  display: flex; align-items: flex-start; justify-content: center;
  min-height: 0;
}

#gameCanvas {
  display: block;
  touch-action: none;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

/* floating toasts over the canvas */
.toast-layer {
  position: absolute; inset: 0; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
}
.toast {
  font-weight: 900; text-align: center;
  color: #fff; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  animation: toastIn 1.5s ease forwards;
  font-size: 30px;
}
.toast.big { font-size: 42px; color: var(--bb-gold); }
.toast.small { font-size: 20px; }
.toast .toast-sub { display: block; font-size: 16px; color: rgba(253, 248, 238, 0.85); }
@keyframes toastIn {
  0% { transform: scale(0.6); opacity: 0; }
  12% { transform: scale(1.08); opacity: 1; }
  22% { transform: scale(1); }
  78% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-14px); }
}
@media (prefers-reduced-motion: reduce) {
  .toast { animation-duration: 0.01s; animation-fill-mode: forwards; opacity: 1; }
}

/* ------------------------------------------------------------------ */
/* Panels                                                              */
/* ------------------------------------------------------------------ */
.panel-veil {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(12, 16, 38, 0.66);
  display: grid; place-items: center; padding: 18px;
}
.panel {
  width: min(430px, 94vw);
  background: var(--bb-panel);
  border: 3px solid rgba(253, 248, 238, 0.22);
  border-radius: 22px; padding: 26px 22px 22px; text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  animation: panelIn 0.3s cubic-bezier(0.34, 1.45, 0.64, 1);
}
@keyframes panelIn { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.panel h2 { margin: 0 0 4px; font-size: 27px; font-weight: 900; color: var(--bb-gold); }
.panel .panel-sub { margin: 0 0 10px; font-weight: 800; font-size: 15px; color: rgba(253, 248, 238, 0.8); }

.star-row { font-size: 42px; letter-spacing: 6px; margin: 2px 0 6px; color: var(--bb-gold); }
.star-row .off { color: rgba(253, 248, 238, 0.18); }
.star-row .pop { display: inline-block; animation: starPop 0.45s cubic-bezier(0.34, 1.6, 0.64, 1) backwards; }
.star-row .pop:nth-child(2) { animation-delay: 0.18s; }
.star-row .pop:nth-child(3) { animation-delay: 0.36s; }
@keyframes starPop { from { transform: scale(0); } to { transform: scale(1); } }

.panel .led-row { margin: 6px 0; }
.panel .notes-played {
  font-size: 21px; font-weight: 900; color: var(--bb-ivory); margin: 8px 0 2px;
}
.panel .notes-played .music-note { color: var(--bb-gold); }
.panel .stat-row { font-size: 14px; font-weight: 800; margin: 2px 0; color: rgba(253, 248, 238, 0.8); }

.panel-actions {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px;
}

#classScoreSlot { margin-top: 12px; }

.pause-panel h2 { color: var(--bb-ivory); }

@media (max-width: 480px) {
  .hud { padding-top: 52px; } /* clear the fixed menu/mute buttons */
  .led { font-size: 16px; }
}

/* Speed picker — turtle / normal / rabbit. Scales the whole simulation. */
.speed-picker { display: inline-flex; gap: 3px; margin-right: 6px; }
/* 30px in a row of three: a child aiming for the rabbit hits the pause. */
.speed-btn {
  min-width: 44px;
  min-height: 44px;
  width: 30px; height: 30px; padding: 0;
  display: grid; place-items: center;
  font-size: 14px; line-height: 1;
  color: #fdf8ee; background: rgba(253, 248, 238, 0.10);
  border: 2px solid rgba(253, 248, 238, 0.18); border-radius: 9px;
  cursor: pointer; transition: background 0.14s, border-color 0.14s, transform 0.14s;
}
.speed-btn:hover { background: rgba(253, 248, 238, 0.18); transform: translateY(-1px); }
.speed-btn.is-on { background: #099695; border-color: #00706f; }
