/* Simos Camp — music mini-games: karaoke & dance battle (owner: mgMusic, prefix mgm-).
 * The scenes are drawn on a canvas; the DOM holds the touch lanes / arrow buttons and the intro / result cards.
 */
.mgm-root {
  position: absolute; inset: 0; overflow: hidden; background: #1d1747; touch-action: none;
  -webkit-user-select: none; user-select: none; font-family: var(--font); color: var(--ink);
}
.mgm-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- karaoke lane touch zones (visuals are painted on the canvas) ---------- */
.mgm-zones { position: absolute; inset: 0; pointer-events: none; }
.mgm-zone {
  position: absolute; margin: 0; padding: 0; border: 0; border-radius: 18px; background: transparent;
  pointer-events: auto; cursor: pointer; touch-action: none; outline: none; -webkit-tap-highlight-color: transparent;
}
.mgm-zone:focus-visible { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .55); }

/* ---------- dance battle arrow buttons ---------- */
.mgm-arrows { position: absolute; inset: 0; pointer-events: none; }
.mgm-arrow {
  position: absolute; display: grid; place-items: center; margin: 0; padding: 0; pointer-events: auto; cursor: pointer;
  border-radius: 22px; border: 3px solid var(--c2, #6b4f3f); outline: none; touch-action: none; -webkit-tap-highlight-color: transparent;
  background: radial-gradient(ellipse at 50% 18%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 55%), linear-gradient(180deg, var(--c1, #fff), var(--c, #ccc));
  box-shadow: 0 5px 0 var(--c2, #6b4f3f), 0 10px 18px rgba(10, 6, 40, .4);
  transition: transform .07s ease-out, box-shadow .07s ease-out, filter .07s;
}
.mgm-arrow svg { width: 58%; height: 58%; max-width: 56px; max-height: 56px; overflow: visible; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .18)); }
.mgm-arrow svg path { fill: #fff; stroke: var(--c2, #6b4f3f); stroke-width: 7; stroke-linejoin: round; paint-order: stroke; }
.mgm-arrow.on, .mgm-arrow:active { transform: translateY(4px) scale(.97); box-shadow: 0 1px 0 var(--c2, #6b4f3f), 0 4px 10px rgba(10, 6, 40, .35); filter: brightness(1.12); }
.mgm-arrow:focus-visible { box-shadow: 0 5px 0 var(--c2), 0 0 0 4px rgba(255, 255, 255, .7); }

/* ---------- overlays & cards ---------- */
.mgm-overlay {
  position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; pointer-events: auto;
  padding: calc(var(--safe-top) + 66px) 14px calc(var(--safe-bottom) + 14px);
  background: radial-gradient(ellipse at 50% 40%, rgba(46, 26, 96, .3), rgba(12, 8, 36, .72));
  animation: mgm-fade .35s ease both;
}
.mgm-overlay.mgm-out { animation: mgm-fade-out .3s ease forwards; pointer-events: none; }
.mgm-card {
  width: min(100%, 420px); max-height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 18px 18px 16px; text-align: center; animation: mgm-pop .5s var(--ease-spring) both;
}
.mgm-card > * + * { margin-top: 12px; }
.mgm-head { display: flex; align-items: center; gap: 12px; text-align: left; }
.mgm-head-t { min-width: 0; }
.mgm-face {
  position: relative; display: inline-grid; place-items: center; flex: none; border-radius: 50%; overflow: hidden;
  background: var(--turq-light); border: 3px solid #fff; box-shadow: 0 3px 0 rgba(0, 0, 0, .14);
}
.mgm-face canvas { width: 100%; height: 100%; display: block; }
.mgm-face b { font-size: 24px; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .2); }

/* song picker */
.mgm-pick-card { display: flex; flex-direction: column; width: min(100%, 470px); overflow: hidden; }
.mgm-pick-card > .mgm-head, .mgm-pick-card > .mgm-pick-bar, .mgm-pick-card > .mgm-voice, .mgm-pick-card > .mgm-hint { flex: none; }
.mgm-pick-bar { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.mgm-filters { display: flex; gap: 4px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.mgm-filters::-webkit-scrollbar { display: none; }
.mgm-filter {
  cursor: pointer; font: 600 12.5px var(--font); padding: 3px 8px; min-height: 32px; display: inline-flex; align-items: center; gap: 4px;
  flex: none; white-space: nowrap;
}
.mgm-filter i { font-style: normal; font-size: 11px; min-width: 18px; line-height: 18px; border-radius: 99px; background: rgba(0, 0, 0, .08); text-align: center; }
.mgm-filter.on i { background: rgba(255, 255, 255, .6); }
.mgm-filter:disabled { opacity: .45; cursor: default; }
.mgm-surprise { flex: none; min-height: 34px; padding-left: 10px; padding-right: 10px; white-space: nowrap; }
@media (max-width: 440px) { .mgm-surprise span { display: none; } }
.mgm-songs {
  display: flex; flex-direction: column; gap: 9px; min-height: 0; flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; padding: 3px 4px 8px; margin-left: -4px; margin-right: -4px;
}
.mgm-song {
  --sc: var(--pink);
  position: relative; display: flex; align-items: center; gap: 11px; width: 100%; min-height: 64px; padding: 8px 12px 8px 10px; cursor: pointer;
  border-radius: 18px; border: 3px solid var(--sand-dark); background: var(--paper); color: var(--ink); font: 500 15px var(--font);
  text-align: left; box-shadow: 0 4px 0 var(--sand-dark); flex: none;
  transition: transform .12s var(--ease-spring), box-shadow .12s, border-color .15s;
}
.mgm-song[hidden] { display: none; }
.mgm-song:hover, .mgm-song:focus-visible { border-color: var(--sc); outline: none; }
.mgm-song:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--sand-dark); }
.mgm-song-ic {
  font-size: 26px; line-height: 1; flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: #fff7ea; background: color-mix(in srgb, var(--sc) 22%, #fff); border: 2px solid var(--sc);
}
.mgm-song-t { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.mgm-song-t b { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mgm-song-t small { font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mgm-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.mgm-res-tags { justify-content: center; margin-top: 6px !important; }
.mgm-tag {
  display: inline-block; max-width: 100%; font-size: 11.5px; font-weight: 700; line-height: 1.5; padding: 0 7px; border-radius: 99px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mgm-tag-style { color: #fff; background: var(--sc); text-shadow: 0 1px 0 rgba(0, 0, 0, .18); }
.mgm-tag-mood { color: var(--ink); background: var(--sand); border: 1px solid var(--sand-dark); }
.mgm-diff { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: none; min-width: 46px; }
.mgm-diff small { font-size: 11px; font-weight: 700; color: var(--ink-soft); }
.mgm-diff.lv1 small { color: #1d8f6b; } .mgm-diff.lv3 small { color: #c2365f; }
.mgm-num {
  position: absolute; top: -7px; left: -7px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 99px; display: grid; place-items: center;
  font: 700 11px var(--font); color: #fff; background: var(--ink-soft); border: 2px solid var(--paper);
}
.mgm-num:empty { display: none; }
.mgm-voice { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.mgm-voice-l { font-size: 13px; font-weight: 700; color: var(--ink-soft); margin-right: 2px; }
.mgm-voice-b { cursor: pointer; font: 600 13px var(--font); min-height: 32px; padding: 4px 12px; }
.mgm-lvl { display: flex; gap: 3px; flex: none; }
.mgm-lvl i { width: 9px; height: 18px; border-radius: 5px; background: var(--sand-dark); }
.mgm-lvl i.on { background: linear-gradient(180deg, #ffa3c2, var(--pink)); }
.mgm-lvl i:nth-child(2) { height: 22px; margin-top: -4px; } .mgm-lvl i:nth-child(3) { height: 26px; margin-top: -8px; }
.mgm-hint { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--ink-soft); }
.mgm-keys { font-size: 12px; font-weight: 600; letter-spacing: .3px; color: var(--ink-faint); }
.mgm-judges-note { font-size: 13px; }

/* versus rows (dance intro + result) */
.mgm-vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; }
.mgm-side { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.mgm-side > b { font-size: 16px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mgm-side > small { font-size: 12px; color: var(--ink-soft); margin-top: -3px; }
.mgm-side.me .mgm-face { background: #bff3ec; border-color: #2ec4c6; }
.mgm-side.opp .mgm-face { background: #ffd9d2; border-color: #ff7a6b; }
.mgm-vs-mid {
  font-weight: 700; font-size: 20px; color: #fff; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(180deg, #ffa3c2, var(--pink)); border: 3px solid #d9487a; box-shadow: 0 3px 0 #b3335f; text-shadow: 0 2px 0 rgba(179, 51, 95, .6);
}
.mgm-total { font-size: 28px; font-weight: 700; line-height: 1; }
.mgm-side.me .mgm-total { color: #1d8fa3; } .mgm-side.opp .mgm-total { color: #d9573f; }
.mgm-paddles { display: flex; gap: 4px; }
.mgm-paddle {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 3px 3px 4px; border-radius: 12px;
  background: var(--sand); border: 2px solid var(--sand-dark); animation: mgm-paddle .45s var(--ease-spring) both;
}
.mgm-paddle:nth-child(2) { animation-delay: .15s; } .mgm-paddle:nth-child(3) { animation-delay: .3s; }
.mgm-paddle canvas { width: 28px; height: 28px; display: block; }
.mgm-paddle i { font-style: normal; font-weight: 700; font-size: 15px; min-width: 22px; line-height: 20px; border-radius: 99px; background: #fff; color: #4a3b33; }
.mgm-paddle.win { border-color: #ffd75e; background: #fff3c4; }
.mgm-paddle.win i { background: #ffd75e; }
.mgm-judges-line { font-size: 13px; color: var(--ink-soft); }

/* results */
.mgm-stars { display: flex; justify-content: center; gap: 8px; margin-top: 2px; }
.mgm-star { width: 54px; height: 54px; display: block; animation: mgm-star .6s var(--ease-spring) both; }
.mgm-star:nth-child(2) { width: 64px; height: 64px; margin-top: -8px; }
.mgm-star svg { width: 100%; height: 100%; display: block; }
.mgm-star svg path { fill: var(--sand-dark); stroke: var(--sand-deep); stroke-width: 1.4; stroke-linejoin: round; }
.mgm-star.on svg path { fill: #ffd75e; stroke: #d99a1c; filter: drop-shadow(0 2px 0 rgba(217, 154, 28, .45)); }
.mgm-res-title { font-size: 24px; }
.mgm-res-song { font-size: 14px; color: var(--ink-soft); margin-top: 2px !important; }
.mgm-score { font-size: 40px; font-weight: 700; line-height: 1; color: var(--pink); text-shadow: 0 3px 0 rgba(179, 51, 95, .18); }
.mgm-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.mgm-chips .sc-chip { font-size: 13px; }
.mgm-c-perfect { background: #fff3c4; border-color: #ffd75e; color: #7a5a00; }
.mgm-c-good { background: #dcf8f4; border-color: #2ec4c6; color: #145f6b; }
.mgm-c-miss { background: #efe8ff; border-color: #c9a8ff; color: #5a3f99; }
.mgm-c-combo { background: #ffe3ee; border-color: var(--pink); color: #a42c58; }
.mgm-msg { margin: 10px 0 0; font-size: 15px; color: var(--ink); line-height: 1.35; }
.mgm-card .sc-btn { min-width: 150px; margin-top: 14px; }

@keyframes mgm-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mgm-fade-out { to { opacity: 0; } }
@keyframes mgm-pop { from { opacity: 0; transform: translateY(18px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes mgm-star { from { opacity: 0; transform: scale(.2) rotate(-30deg); } to { opacity: 1; transform: none; } }
@keyframes mgm-paddle { from { opacity: 0; transform: translateY(12px) rotate(-8deg); } to { opacity: 1; transform: none; } }

@media (max-height: 560px) {
  .mgm-card { padding: 12px 14px; }
  .mgm-card > * + * { margin-top: 8px; }
  .mgm-song { min-height: 48px; }
  .mgm-song-ic { width: 38px; height: 38px; font-size: 22px; }
  .mgm-pick-card .mgm-head .mgm-face { display: none; }
  .mgm-score { font-size: 32px; }
}
