/* Berry Beat — Mignuti Kids
 * Rhythm tapper: 4 colored lanes, fruits fall on a synthesised beat.
 * Mirrors the Banana Berry palette used across Flappy Berry, Berry Garden,
 * Banana Berry Jump and Sing-Along Puzzles.
 */

:root {
  --color-cream: #fff8e7;
  --color-cream-warm: #ffe9c7;
  --color-sky: #4ecdc4;
  --color-banana: #ffd93d;
  --color-banana-light: #ffe883;
  --color-berry: #de1c56;
  --color-berry-light: #ff6e8c;
  --color-leaf: #4aa84f;
  --color-leaf-light: #7ccd7f;
  --color-ink: #2c2c2c;
  --radius: 18px;
  --shadow-card: 0 8px 24px rgba(44, 44, 44, 0.18);
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--color-cream);
  color: var(--color-ink);
  font-family:
    ui-rounded,
    "SF Pro Rounded",
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  overscroll-behavior: contain;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

body {
  overflow: hidden;
}

.stage {
  position: fixed;
  inset: 0;
  display: block;
  background: linear-gradient(180deg, #fff8e7 0%, #ffe9c7 60%, #ffd9a8 100%);
}

canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  background: transparent;
}

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Score in the top-left during play. */
.score {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  padding: 8px 16px;
  background: #fff;
  border-radius: 999px;
  box-shadow: var(--shadow-card);
  font-weight: 900;
  font-size: clamp(20px, 4.5vw, 26px);
  color: var(--color-ink);
  pointer-events: none;
  min-width: 64px;
  text-align: center;
}

.controls {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.icon-btn {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 120ms ease;
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn:focus-visible {
  outline: 3px solid var(--color-berry);
  outline-offset: 3px;
}

.icon-btn.hidden {
  display: none;
}

.icon {
  width: 22px;
  height: 22px;
  display: inline-block;
  background: var(--color-ink);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.icon-sound-off {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M3 10v4h4l5 4V6L7 10H3zm13.59 2L14 9.41 15.41 8 18 10.59 20.59 8 22 9.41 19.41 12 22 14.59 20.59 16 18 13.41 15.41 16 14 14.59 16.59 12z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M3 10v4h4l5 4V6L7 10H3zm13.59 2L14 9.41 15.41 8 18 10.59 20.59 8 22 9.41 19.41 12 22 14.59 20.59 16 18 13.41 15.41 16 14 14.59 16.59 12z'/></svg>");
}

.icon-sound-on {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M3 10v4h4l5 4V6L7 10H3zm11 0.5A3.5 3.5 0 0 1 17.5 14a3.5 3.5 0 0 1-3.5 3.5v-7zm0-4.5a8 8 0 0 1 8 8 8 8 0 0 1-8 8v-2a6 6 0 0 0 6-6 6 6 0 0 0-6-6V6z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M3 10v4h4l5 4V6L7 10H3zm11 0.5A3.5 3.5 0 0 1 17.5 14a3.5 3.5 0 0 1-3.5 3.5v-7zm0-4.5a8 8 0 0 1 8 8 8 8 0 0 1-8 8v-2a6 6 0 0 0 6-6 6 6 0 0 0-6-6V6z'/></svg>");
}

.icon-pause {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M6 5h4v14H6zM14 5h4v14h-4z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M6 5h4v14H6zM14 5h4v14h-4z'/></svg>");
}

/* Overlays shared style. */
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(44, 44, 44, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 20px;
  pointer-events: auto;
  animation: fadeIn 180ms ease both;
  overflow-y: auto;
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  background: var(--color-cream);
  border: 4px solid var(--color-berry);
  border-radius: 28px;
  padding: clamp(20px, 5vw, 36px) clamp(22px, 6vw, 42px);
  text-align: center;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-card);
  max-height: 95vh;
  overflow-y: auto;
}

.overlay-title {
  margin: 0 0 10px;
  font-size: clamp(28px, 7vw, 44px);
  color: var(--color-berry);
  font-weight: 900;
  letter-spacing: 0.01em;
}

.overlay-title--small {
  font-size: clamp(22px, 5.5vw, 30px);
  margin-bottom: 14px;
}

.overlay-sub {
  margin: 0 0 18px;
  font-size: clamp(15px, 3.6vw, 18px);
  color: var(--color-ink);
  line-height: 1.4;
}

.overlay-hint {
  margin: 16px 0 0;
  font-size: 13px;
  opacity: 0.7;
  line-height: 1.4;
}

/* Song-picker list. */
.song-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 6px 0 10px;
}

.song-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 3px solid transparent;
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--color-ink);
  box-shadow: 0 4px 0 rgba(44, 44, 44, 0.12);
  transition:
    transform 100ms ease,
    border-color 120ms ease;
  min-height: 72px;
  width: 100%;
}

.song-tile:hover {
  transform: translateY(-1px);
}

.song-tile:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(44, 44, 44, 0.12);
}

.song-tile:focus-visible {
  outline: 3px solid var(--color-berry);
  outline-offset: 3px;
}

.song-tile--pick {
  border-color: var(--color-banana);
  background: #fffbe4;
}

.song-tile__art {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--color-banana);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 22px;
  color: #fff;
  font-weight: 900;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}

.song-tile__art--1 {
  background: var(--color-banana);
  color: var(--color-ink);
}
.song-tile__art--2 {
  background: var(--color-berry);
}
.song-tile__art--3 {
  background: var(--color-sky);
}
.song-tile__art--concert {
  background: linear-gradient(
    135deg,
    var(--color-banana) 0%,
    var(--color-berry) 50%,
    var(--color-sky) 100%
  );
  color: #fff;
  font-size: 20px;
}

.song-tile--concert {
  border-color: var(--color-berry);
  background: #fff5ea;
}
.song-tile--concert[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.4);
  box-shadow: 0 2px 0 rgba(44, 44, 44, 0.12);
}
.song-tile--concert[disabled]:active {
  transform: none;
}

.song-tile__body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.song-tile__name {
  font-weight: 900;
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.song-tile__pick-chip {
  background: var(--color-banana);
  color: var(--color-ink);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.song-tile__meta {
  font-size: 13px;
  color: rgba(44, 44, 44, 0.65);
}

.song-tile__stars {
  font-size: 16px;
  letter-spacing: 2px;
  color: var(--color-banana);
  text-shadow: 0 0 1px rgba(0, 0, 0, 0.3);
  flex: 0 0 auto;
}

/* Buttons. */
.big-btn {
  display: inline-block;
  min-width: 200px;
  min-height: 56px;
  padding: 14px 28px;
  border: none;
  border-radius: 999px;
  background: var(--color-berry);
  color: #fff;
  font-weight: 800;
  font-size: clamp(18px, 4vw, 22px);
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 6px 0 #8b1236;
  transition:
    transform 100ms ease,
    box-shadow 100ms ease;
  margin: 8px 0 4px;
}

.big-btn:hover {
  transform: translateY(-1px);
}

.big-btn:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #8b1236;
}

.big-btn:focus-visible {
  outline: 3px solid var(--color-banana);
  outline-offset: 4px;
}

.text-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: var(--color-ink);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  border-radius: 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-btn:hover {
  color: var(--color-berry);
}

.text-btn:focus-visible {
  outline: 3px solid var(--color-berry);
  outline-offset: 2px;
}

/* Stars on the result screen. */
.stars {
  font-size: 48px;
  letter-spacing: 6px;
  margin: 10px 0 8px;
  color: var(--color-banana);
  text-shadow: 0 2px 0 rgba(222, 28, 86, 0.3);
  min-height: 56px;
}

.result-meta {
  margin: 2px 0 10px;
  font-size: 15px;
  color: rgba(44, 44, 44, 0.75);
  line-height: 1.4;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .overlay {
    animation: none;
  }
  .big-btn,
  .song-tile {
    transition: none;
  }
}
