/* beat-clap.css: styles for beat-clap-engine.js. Everything is scoped under .bc so it cannot
 * leak into the games CSS cascade (lw-games, engine, engine2, family sheets). Brand tokens come
 * from /core/tokens.css (read only). Colours were picked for contrast: white on the deep coral
 * is 5.6:1, navy on sun yellow is above 9:1. */
.bc {
  --bc-ink: var(--lw-ink, #1E2A4A);
  --bc-bg: var(--lw-bg-warm, #FFF0E8);
  --bc-coral: #E0633F;
  --bc-coral-deep: var(--lw-primary-deep, #BE4327);
  --bc-sun: var(--lw-sun, #FFC94D);
  --bc-leaf: #3E8E63;
  --bc-leaf-soft: #D6EFE0;
  --bc-line: var(--lw-line, #EFE9DF);
  position: relative;
  box-sizing: border-box;
  max-width: 620px;
  margin: 0 auto;
  padding: 14px 14px 20px;
  background: var(--bc-bg);
  border-radius: 28px;
  box-shadow: 0 6px 24px rgba(30, 42, 74, .10);
  color: var(--bc-ink);
  font-family: var(--lw-font-body, 'DM Sans', system-ui, sans-serif);
  -webkit-tap-highlight-color: transparent;
  scroll-margin-top: 12px;
}
.bc *, .bc *::before, .bc *::after { box-sizing: border-box; }
.bc [hidden] { display: none !important; }
.bc button { font: inherit; cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.bc button:focus-visible { outline: 3px solid var(--bc-ink); outline-offset: 3px; }
.bc-icon { width: 36px; height: 36px; flex: none; }

/* top bar */
.bc-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.bc-dots { display: flex; gap: 8px; align-items: center; min-height: 20px; }
.bc-dots i { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--bc-ink); opacity: .55; }
.bc-dots i.now { opacity: 1; background: var(--bc-sun); }
.bc-dots i.done { opacity: 1; background: var(--bc-leaf); border-color: var(--bc-leaf); }
.bc-sound, .bc-hear, .bc-level, .bc-round-btn { color: var(--bc-ink); }
.bc-sound { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px 0 12px; border: 2px solid var(--bc-ink); border-radius: 999px; background: #fff; font-weight: 700; font-size: 15px; }
.bc-sound .bc-icon { width: 26px; height: 26px; }
.bc-sound[aria-checked="false"] { background: transparent; }

/* level choice */
.bc-levels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 6px; }
.bc-level { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 172px; padding: 14px 10px 12px; border: 3px solid #fff; border-radius: 24px; background: #fff; box-shadow: 0 2px 10px rgba(30, 42, 74, .08); transition: transform .14s var(--lw-ease-pop, ease), border-color .14s; }
.bc-level:active { transform: scale(.97); }
.bc-level[data-suggested="true"] { border-color: var(--bc-coral-deep); }
.bc-level-pics { display: flex; justify-content: center; align-items: center; gap: 2px; height: 84px; }
.bc-level-pics img { width: 84px; height: 84px; object-fit: contain; border-radius: 18px; }
.bc-level[data-level="mix"] .bc-level-pics img { width: 52px; height: 52px; }
.bc-pips { display: flex; gap: 6px; align-items: center; height: 14px; }
.bc-pips i { width: 12px; height: 12px; border-radius: 50%; background: var(--bc-coral); }
.bc-pips i.gap { background: var(--bc-sun); }
.bc-level-label { font-weight: 800; font-size: 18px; line-height: 1.1; font-family: var(--lw-font-display, 'Bricolage Grotesque', system-ui, sans-serif); }
.bc-hint { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); padding: 3px 12px; border-radius: 999px; background: var(--bc-coral-deep); color: #fff; font-size: 13px; font-weight: 700; white-space: nowrap; }

/* play */
.bc-play { display: grid; justify-items: center; gap: 10px; }
.bc-stage { position: relative; width: 100%; display: grid; justify-items: center; gap: 10px; }
.bc-picwrap { position: relative; width: min(74vw, 36svh, 320px); }
.bc-pic { width: 100%; aspect-ratio: 1; border-radius: 28px; background: #fff; overflow: hidden; box-shadow: 0 2px 10px rgba(30, 42, 74, .10); transform-origin: 50% 100%; will-change: transform; }
.bc-pic img { display: block; width: 100%; height: 100%; object-fit: contain; }
.bc-hear { position: absolute; top: 8px; right: 8px; z-index: 2; width: 56px; height: 56px; padding: 0; display: grid; place-items: center; border: 2px solid var(--bc-ink); border-radius: 50%; background: #fff; }
.bc-hear .bc-icon { width: 30px; height: 30px; }
.bc-word { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-height: 56px; align-items: center; }
.bc-whole, .bc-part { font-family: var(--lw-font-display, 'Bricolage Grotesque', system-ui, sans-serif); font-weight: 800; font-size: clamp(26px, 7.4vw, 36px); line-height: 1; padding: 8px 18px 10px; border-radius: 18px; background: #fff; border: 3px solid #fff; }
.bc-part { animation: bc-in .26s ease-out both; }
.bc-part.lit { background: var(--bc-leaf-soft); border-color: var(--bc-leaf); }
.bc-bubbles { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; min-height: 44px; align-items: center; }
.bc-bubble { width: 38px; height: 38px; border-radius: 50%; background: var(--bc-sun); border: 3px solid var(--bc-ink); }
.bc-bubble.pop { animation: bc-pop .22s var(--lw-ease-pop, ease-out) both; }
.bc-bubble.lit { background: var(--bc-leaf); border-color: var(--bc-leaf); animation: bc-pop .22s var(--lw-ease-pop, ease-out) both; }

.bc-controls { display: grid; grid-template-columns: minmax(0, 1fr) 108px; gap: 12px; width: 100%; align-items: stretch; }
.bc-pad { position: relative; min-height: 128px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px; border: 0; border-radius: 30px; color: #fff; background: linear-gradient(180deg, #C94D2C 0%, #A83B20 100%); box-shadow: 0 8px 0 #7A2813; transition: transform .08s ease-out, box-shadow .08s ease-out; }
.bc-pad .bc-icon { width: 52px; height: 52px; }
.bc-pad.hit { transform: translateY(5px) scale(.985); box-shadow: 0 3px 0 #7A2813; }
.bc-pad.rest { filter: saturate(.45); }
.bc-cap { font-weight: 700; font-size: 15px; line-height: 1.1; text-align: center; }
.bc-go { min-height: 128px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px; border: 0; border-radius: 30px; background: var(--bc-ink); color: #fff; box-shadow: 0 8px 0 #0E1630; transition: transform .08s ease-out, box-shadow .08s ease-out; }
.bc-go:active { transform: translateY(5px); box-shadow: 0 3px 0 #0E1630; }
.bc-go .bc-icon { width: 42px; height: 42px; }
.bc-go .bc-cap { font-size: 13px; }
.bc-go[data-mode="next"] { background: var(--bc-sun); color: var(--bc-ink); box-shadow: 0 8px 0 #B98A12; }
.bc-go[data-mode="next"]:active { box-shadow: 0 3px 0 #B98A12; }
.bc[data-taps="0"][data-first="false"] .bc-go[data-mode="show"] { opacity: .8; }
.bc-handhint { display: none; position: absolute; right: 14px; top: 10px; pointer-events: none; color: var(--bc-ink); filter: drop-shadow(0 2px 0 rgba(255,255,255,.7)); animation: bc-tap 1.2s ease-in-out infinite; }
.bc-handhint .bc-icon { width: 40px; height: 40px; color: #fff; stroke: var(--bc-ink); stroke-width: 2.5px; paint-order: stroke; }
.bc[data-phase="play"][data-first="true"][data-taps="0"] .bc-handhint { display: block; }
.bc-status { min-height: 22px; margin: 0; font-size: 15px; font-weight: 700; text-align: center; color: var(--bc-ink); }

/* finale */
.bc-finale { display: grid; justify-items: center; gap: 14px; padding-top: 6px; }
.bc-done { margin: 0; font-family: var(--lw-font-display, 'Bricolage Grotesque', system-ui, sans-serif); font-size: clamp(30px, 9vw, 44px); font-weight: 800; outline: none; }
.bc-parade { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; width: 100%; padding: 14px 6px 18px; border-radius: 24px; background: linear-gradient(180deg, #fff 0%, #fff 70%, var(--bc-leaf-soft) 70%); }
.bc-friend { width: 84px; height: 84px; padding: 0; border: 0; background: transparent; border-radius: 20px; transform-origin: 50% 100%; }
.bc-friend img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 20px; }
.bc-friend.lit { filter: brightness(1.06) saturate(1.2); }
.bc-finale-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.bc-round-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 112px; min-height: 96px; padding: 10px 16px; border: 3px solid var(--bc-ink); border-radius: 26px; background: #fff; font-weight: 800; font-size: 16px; }
.bc-round-btn .bc-icon { width: 36px; height: 36px; }
.bc-round-btn:active { transform: scale(.97); }

@keyframes bc-pop { 0% { transform: scale(.3); } 70% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes bc-in { from { opacity: 0; transform: translateY(6px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes bc-tap { 0%, 100% { transform: translateY(0) rotate(-6deg); } 45% { transform: translateY(8px) rotate(-6deg); } }

@media (min-width: 720px) {
  .bc { padding: 18px 22px 26px; }
  .bc-picwrap { width: min(340px, 40svh); }
  .bc-controls { grid-template-columns: minmax(0, 1fr) 128px; }
  .bc-level { min-height: 190px; }
}
@media (max-width: 360px) {
  .bc-whole, .bc-part { padding: 6px 12px 8px; }
  .bc-controls { grid-template-columns: minmax(0, 1fr) 92px; }
}
@media (prefers-reduced-motion: reduce) {
  .bc *, .bc *::before, .bc *::after { animation: none !important; transition: none !important; }
}
