* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  font-family: 'Comic Sans MS', 'Comic Sans', 'Chalkboard SE', 'Segoe Print', 'Segoe UI', cursive;
  color: #2b2d42;
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation; -webkit-touch-callout: none;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
#bg { position: fixed; inset: 0; z-index: 0; display: block; }
button { font-family: inherit; cursor: pointer; }
.emoji { font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif; }
.hidden { display: none !important; }

/* round icon buttons (music / sound / voice / fullscreen / home) */
.icon-btn {
  width: 56px; height: 56px; border-radius: 50%;
  border: 4px solid #fff; background: linear-gradient(#ffd166, #f8961e);
  box-shadow: 0 5px 0 #c4661f, 0 8px 16px rgba(0,0,0,.25);
  font-size: 26px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
  transition: transform .15s;
  position: relative;
}
.icon-btn:hover { transform: translateY(-3px) scale(1.06); }
.icon-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #c4661f; }
.icon-btn.off { filter: grayscale(1) opacity(.75); }
.icon-btn.off::after {
  content: ''; position: absolute; left: 8px; right: 8px; top: 50%; height: 5px; margin-top: -2px;
  background: #e63946; border-radius: 3px; transform: rotate(-40deg);
}

.big-btn {
  border: 5px solid #fff; border-radius: 999px;
  padding: 16px 38px; font-size: 30px; font-weight: bold; color: #fff;
  background: linear-gradient(#52b788, #2d6a4f);
  box-shadow: 0 7px 0 #1b4332, 0 12px 22px rgba(0,0,0,.3);
  text-shadow: 0 3px 0 rgba(0,0,0,.25);
  transition: transform .12s;
}
.big-btn:hover { transform: translateY(-3px) scale(1.04); }
.big-btn:active { transform: translateY(4px); box-shadow: 0 3px 0 #1b4332; }
.big-btn.orange { background: linear-gradient(#ffb703, #fb8500); box-shadow: 0 7px 0 #b35c00, 0 12px 22px rgba(0,0,0,.3); }
.big-btn.pink { background: linear-gradient(#ff8fab, #e5386d); box-shadow: 0 7px 0 #a4133c, 0 12px 22px rgba(0,0,0,.3); }
.big-btn.blue { background: linear-gradient(#4cc9f0, #4361ee); box-shadow: 0 7px 0 #2b3a99, 0 12px 22px rgba(0,0,0,.3); }

@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes popIn { 0% { transform: scale(.2); opacity: 0; } 70% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); } }

/* "Tap to start" screen shown only when the browser blocks sound */
#tapStart {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  background: rgba(30, 60, 90, .35); backdrop-filter: blur(3px);
}
#tapStart .big-btn { font-size: 44px; padding: 22px 56px; animation: pulse 1.2s infinite; }
#tapStart p { color: #fff; font-size: 22px; text-shadow: 0 2px 4px rgba(0,0,0,.5); margin: 0; }

/* little yes/no question box */
.modal-back {
  position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: #fff8e7; border: 6px solid #ffb703; border-radius: 30px; padding: 28px 36px; text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,.35); animation: popIn .35s;
}
.modal h2 { margin: 0 0 20px; font-size: 32px; }
.modal .row { display: flex; gap: 18px; justify-content: center; }

/* ---------- player profiles ---------- */
.pf-chip {
  position: fixed; left: 14px; top: 12px; z-index: 6; display: flex; align-items: center; gap: 8px;
  padding: 5px 16px 5px 6px; border-radius: 999px; border: 4px solid #fff; background: rgba(255,255,255,.92);
  box-shadow: 0 5px 12px rgba(0,0,0,.2); font-size: 20px; font-weight: bold; color: #3a0ca3; max-width: 46vw;
}
.pf-chip .emoji { width: 40px; height: 40px; border-radius: 50%; background: #ffd166; display: flex; align-items: center; justify-content: center; font-size: 26px; flex: none; }
.pf-chip .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-chip:hover { transform: scale(1.05); }
.pf-back {
  position: fixed; inset: 0; z-index: 110; display: flex; align-items: center; justify-content: center;
  background: rgba(20, 50, 80, .45); backdrop-filter: blur(3px);
}
.pf-sheet {
  background: #fffaf0; border: 7px solid #fff; border-radius: 36px; padding: 22px 26px; text-align: center;
  box-shadow: 0 24px 50px rgba(0,0,0,.35); animation: popIn .4s; max-width: 94vw; max-height: 94vh; overflow: auto;
}
.pf-sheet h2 { margin: 0 0 16px; font-size: clamp(28px, 4vw, 42px); color: #3a0ca3; }
.pf-sheet h3 { margin: 0 0 8px; font-size: 26px; color: #3a0ca3; }
.pf-list { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; max-width: 720px; }
.pf-card {
  width: 140px; padding: 12px 8px; border-radius: 26px; border: 5px solid #fff; background: linear-gradient(#caffbf, #8ac926);
  box-shadow: 0 7px 0 rgba(0,0,0,.15), 0 10px 18px rgba(0,0,0,.18); display: flex; flex-direction: column; align-items: center; gap: 4px;
  position: relative; transition: transform .15s;
}
.pf-card:nth-child(4n+2) { background: linear-gradient(#bde0fe, #4895ef); }
.pf-card:nth-child(4n+3) { background: linear-gradient(#ffc8dd, #ff70a6); }
.pf-card:nth-child(4n+4) { background: linear-gradient(#ffe5a3, #ffb703); }
.pf-card.add { background: #fff; border: 5px dashed #bbb; box-shadow: none; }
.pf-card.cur { outline: 5px solid #ff006e; }
.pf-card:hover { transform: translateY(-4px) scale(1.05); }
.pf-av { font-size: 64px; line-height: 1.1; }
.pf-nm { font-size: 22px; font-weight: bold; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-card.add .pf-nm { color: #666; text-shadow: none; }
.pf-x { position: absolute; top: -10px; right: -10px; width: 36px; height: 36px; border-radius: 50%; background: #e63946; color: #fff; font-size: 20px; line-height: 36px; border: 3px solid #fff; }
.pf-card.wobble { animation: wiggle .5s infinite; }
.pf-form .pf-big { font-size: 80px; animation: bob 2s infinite; display: inline-block; }
.pf-name { display: block; margin: 8px auto 10px; font-family: inherit; font-size: 28px; font-weight: bold; padding: 8px 16px; border-radius: 18px; border: 4px solid #ddd; width: min(340px, 80vw); text-align: center; outline: none; color: #2b2d42; }
.pf-name:focus { border-color: #8338ec; }
.pf-avs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 520px; margin: 0 auto; }
.pf-avs button { width: 54px; height: 54px; border-radius: 50%; border: 4px solid #eee; background: #fff; font-size: 30px; padding: 0; }
.pf-avs button.sel { border-color: #8338ec; background: #f1e4ff; transform: scale(1.12); }
.pf-row { display: flex; gap: 16px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pf-foot { margin-top: 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pf-small { border: 3px solid #ddd; background: #fff; border-radius: 999px; padding: 6px 14px; font-size: 16px; color: #555; }
.pf-sync { font-size: 15px; color: #777; }
@media (max-width: 700px) {
  .pf-chip { font-size: 16px; padding: 3px 12px 3px 4px; left: 8px; top: 8px; }
  .pf-chip .emoji { width: 32px; height: 32px; font-size: 20px; }
  .pf-card { width: 112px; }
  .pf-av { font-size: 48px; }
  .pf-nm { font-size: 18px; }
  .pf-sheet { padding: 16px 12px; }
  .pf-avs button { width: 44px; height: 44px; font-size: 24px; }
}
