* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  position: fixed;
  inset: 0;
  width: 100%;
  background: #ffd36b;
  color: #1a1a1a;
  font-family: "Arial Rounded MT Bold", "Chalkboard SE", "Comic Sans MS", "Trebuchet MS", sans-serif;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  touch-action: manipulation;
}

[hidden] { display: none !important; }

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #ffd36b url("assets/sticker-background.jpg") center center / cover no-repeat;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.15);
}

.app {
  position: relative;
  z-index: 1;
  height: 100%;
  height: 100dvh;
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  column-gap: 12px;
  row-gap: 10px;
  padding:
    calc(10px + env(safe-area-inset-top))
    calc(14px + env(safe-area-inset-right))
    calc(12px + env(safe-area-inset-bottom))
    calc(14px + env(safe-area-inset-left));
}

.jukebox {
  grid-column: 1;
  grid-row: 1 / span 3;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.34);
}

.tune {
  flex: 1 1 0;
  min-height: 64px;
  max-height: 118px;
  border: 4px solid #fff;
  border-radius: 20px;
  padding: 4px 4px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.18);
  background-image: radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.45), transparent 48%);
  transition: transform 80ms ease, box-shadow 80ms ease, filter 80ms ease;
}

.tune svg { width: 34px; height: 34px; display: block; flex: 0 0 auto; }

.tune span {
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  max-width: 100%;
}

.tune:active { transform: scale(0.97); }

.tune.is-on {
  filter: brightness(1.12);
  box-shadow: 0 0 0 4px #fff, 0 0 16px 3px var(--glow);
}

header {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
}

h1, .level, .mute {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
}

h1 {
  margin: 0;
  justify-self: start;
  padding: 8px 18px;
  font-size: clamp(28px, 4.4vw, 46px);
  line-height: 1.1;
  letter-spacing: 0.01em;
}

.level {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 18px 4px 14px;
  font-size: clamp(48px, 8vw, 80px);
  line-height: 1;
  font-weight: 800;
}

.star {
  color: #e09400;
  text-shadow: 0 2px 0 #7a4d00;
}

.mute {
  width: 84px;
  height: 84px;
  border: 4px solid #1a1a1a;
  color: #1a1a1a;
  display: grid;
  place-items: center;
  padding: 0;
}

.mute svg { width: 48px; height: 48px; display: block; }
.mute .icon-off { display: none; }
.mute.is-muted .icon-on { display: none; }
.mute.is-muted .icon-off { display: block; }

.stage {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  min-height: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.board {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3.4%;
}

.pad {
  min-width: 120px;
  min-height: 120px;
  width: 100%;
  height: 100%;
  border: 6px solid #fff;
  border-radius: 22%;
  display: grid;
  place-items: center;
  padding: 0;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.18);
  background-image: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.42), transparent 46%);
  transition: transform 80ms ease, filter 80ms ease, box-shadow 80ms ease;
}

.pad svg { width: 46%; height: 46%; display: block; }

.pad:disabled { opacity: 1; }

.pad:active:not(:disabled) { transform: scale(0.97); }

.pad.red { background-color: #ff2d2d; color: #fff; --glow: #ffd0d0; }
.pad.blue { background-color: #1f6bff; color: #fff; --glow: #d5e4ff; }
.pad.yellow { background-color: #ffd000; color: #3a2500; --glow: #fff1a8; }
.pad.green { background-color: #18b84a; color: #fff; --glow: #c8ffd8; }

.pad.lit,
.board.celebrate .pad {
  filter: brightness(1.28);
  transform: scale(1.04);
  box-shadow: 0 0 0 6px #fff, 0 0 26px 8px var(--glow);
}

.play {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  min-width: min(68%, 280px);
  min-height: 120px;
  padding: 12px 28px;
  border: 6px solid #1a1a1a;
  border-radius: 48px;
  background: #fff;
  color: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1;
  box-shadow: 0 8px 0 #e0a82a;
}

.play svg { width: 0.8em; height: 0.8em; display: block; }
.play:active { transform: translate(-50%, -50%) scale(0.98); }

.footer {
  grid-column: 2;
  grid-row: 3;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.message, .watch {
  margin: 0;
  min-height: 84px;
  width: min(100%, 680px);
  border-radius: 999px;
  background: #fff;
  color: #1a1a1a;
  font-size: clamp(32px, 4.6vw, 46px);
  font-weight: 800;
  line-height: 1;
}

.message {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 24px;
  border: 5px solid #1a1a1a;
}

.watch {
  border: 5px solid #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 22px;
  box-shadow: 0 6px 0 #1a1a1a;
}

.watch svg { width: 44px; height: 44px; display: block; }
.watch:active { transform: scale(0.98); }

.watch.attention {
  animation: offer 1.4s ease-in-out infinite;
}

@keyframes offer {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.burst { position: fixed; inset: 0; z-index: 4; pointer-events: none; }

.bit {
  position: fixed;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  box-shadow: 0 0 0 2px #fff;
  animation: burst 1s ease-out forwards;
}

.bit.round { border-radius: 50%; }

.bit.star {
  border-radius: 0;
  box-shadow: none;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

@keyframes burst {
  0% { transform: translate(0, 0) rotate(0deg) scale(0.5); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--spin)) scale(1); opacity: 0; }
}

@media (orientation: landscape) {
  .app { grid-template-columns: 150px minmax(0, 1fr); }
  .tune span { font-size: 20px; }
}

@media (max-height: 760px) {
  .app { row-gap: 6px; }
  .tune svg { width: 28px; height: 28px; }
  .tune span { font-size: 16px; }
  .mute { width: 72px; height: 72px; }
  .mute svg { width: 40px; height: 40px; }
  h1 { font-size: 28px; padding: 6px 14px; }
  .level { font-size: 48px; }
  .footer { min-height: 76px; }
  .message, .watch { min-height: 72px; font-size: 30px; }
  .play { min-height: 100px; }
}

@media (prefers-reduced-motion: reduce) {
  .watch.attention { animation: none; }
  .bit { animation: none; opacity: 0; }
  .tune.is-on { filter: none; }
}
