/* Simos Camp — beach sports mini-games (volleyball, football). Prefix: mgs-   owner: mgSports
 * The scene itself is drawn on the canvas; this file styles the DOM layer on top of it: the shell scoreboard,
 * the big action button / control row, hints and the intro & result cards. Mobile-first, 44px+ touch targets.
 */
.mgs-root { position: absolute; inset: 0; overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; background: #cdf1fb; }
.mgs-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: pointer; }
.mgs-ui { position: absolute; inset: 0; z-index: 2; pointer-events: none; font-family: var(--font); }
.mgs-ui button { pointer-events: auto; font-family: var(--font); }

/* ------------------------------------------------------------------ shell scoreboard */
.mgs-board {
  position: absolute; top: calc(var(--safe-top) + 64px); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 244px; max-width: calc(100vw - 20px);
  padding: 5px 14px 5px; border-radius: 20px; border: 3px solid var(--wood-dark);
  background: var(--wood-grain), linear-gradient(180deg, #e7bb86, var(--wood));
  box-shadow: 0 4px 0 var(--wood-deep), 0 10px 22px rgba(30, 50, 64, .25);
  color: #fff; text-shadow: 0 2px 0 rgba(122, 81, 50, .6); pointer-events: none;
}
.mgs-board::before, .mgs-board::after { /* rope loops holding the driftwood board */
  content: ''; position: absolute; top: -9px; width: 10px; height: 12px; border: 3px solid #d9bf8c; border-bottom: 0; border-radius: 8px 8px 0 0;
}
.mgs-board::before { left: 22px; } .mgs-board::after { right: 22px; }
.mgs-board-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.mgs-board-pips { gap: 16px; margin-top: -1px; }
.mgs-faces { display: flex; align-items: center; min-width: 30px; }
.mgs-faces.l { justify-content: flex-end; } .mgs-faces.r { justify-content: flex-start; }
.mgs-faces .mgs-face { display: block; border-radius: 50%; border: 2px solid #fff; background: var(--turq-light); box-shadow: 0 2px 0 rgba(0, 0, 0, .15); }
.mgs-faces .mgs-face + .mgs-face { margin-left: -9px; }
.mgs-num { display: inline-block; min-width: 30px; text-align: center; font-size: 30px; line-height: 1; font-weight: 700; }
.mgs-num.pop { animation: mgs-pop .55s var(--ease-spring); }
.mgs-board-icon { font-size: 19px; line-height: 1; filter: drop-shadow(0 2px 0 rgba(122, 81, 50, .45)); }
.mgs-pips { display: flex; gap: 1px; }
.mgs-pips.r { flex-direction: row-reverse; }
.mgs-pip { display: inline-block; font-size: 14px; line-height: 1.1; opacity: .38; filter: grayscale(1) brightness(1.5); text-shadow: none; transition: opacity .25s, filter .25s; }
.mgs-pip.on { opacity: 1; filter: drop-shadow(0 1px 0 rgba(122, 81, 50, .5)); animation: mgs-pip .5s var(--ease-spring); }
.mgs-board-cap { font-size: 11px; font-weight: 600; letter-spacing: .3px; opacity: .92; }

/* ------------------------------------------------------------------ action button & control row */
.mgs-act {
  position: absolute; left: 50%; bottom: calc(var(--safe-bottom) + 22px); transform: translateX(-50%);
  width: 96px; height: 96px; border-radius: 50%; border: 4px solid var(--turq-dark); padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: radial-gradient(circle at 35% 28%, #a6f5f1, var(--turq) 58%, #1d9fb0);
  color: #fff; font: 700 17px/1 var(--font); letter-spacing: .3px; text-shadow: 0 2px 0 rgba(21, 113, 134, .65);
  box-shadow: 0 6px 0 #157186, 0 12px 24px rgba(30, 50, 64, .3); cursor: pointer; touch-action: none;
  transition: transform .1s var(--ease-spring), box-shadow .1s, filter .2s;
}
.mgs-act:active { transform: translateX(-50%) translateY(4px); box-shadow: 0 2px 0 #157186, 0 8px 16px rgba(30, 50, 64, .3); }
.mgs-act .mgs-act-label { font-size: 17px; white-space: nowrap; }
.mgs-act.hot { filter: brightness(1.08) saturate(1.1); animation: mgs-hot .55s ease-in-out infinite alternate; }
.mgs-act.mgs-off { opacity: 0; transform: translate(-50%, 24px); pointer-events: none; animation: none; transition: opacity .25s, transform .25s var(--ease-soft); }
.mgs-act:focus-visible, .mgs-cbtn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }

.mgs-controls {
  position: absolute; left: 50%; bottom: calc(var(--safe-bottom) + 20px); transform: translateX(-50%);
  display: flex; gap: 12px; align-items: flex-end; pointer-events: none; transition: opacity .25s, transform .25s var(--ease-soft);
}
.mgs-controls.mgs-off { opacity: 0; transform: translate(-50%, 24px); }
.mgs-controls.mgs-off .mgs-cbtn { pointer-events: none; }
.mgs-cbtn {
  pointer-events: auto; width: 86px; height: 80px; border-radius: 26px; padding: 4px 2px 6px; cursor: pointer; touch-action: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 3px solid var(--wood-dark); color: #fff; font: 700 15px/1 var(--font); text-shadow: 0 2px 0 rgba(122, 81, 50, .6);
  background: var(--wood-grain), linear-gradient(180deg, var(--wood-light), var(--wood));
  box-shadow: 0 5px 0 var(--wood-deep), 0 10px 20px rgba(30, 50, 64, .25);
  transition: transform .1s var(--ease-spring), box-shadow .1s, filter .2s;
}
.mgs-cbtn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--wood-deep); }
.mgs-cbtn .mgs-cbtn-icon { font-size: 26px; line-height: 1; }
.mgs-cbtn.turq { border-color: var(--turq-dark); background: radial-gradient(circle at 35% 28%, #a6f5f1, var(--turq) 60%, #1d9fb0); box-shadow: 0 5px 0 #157186, 0 10px 20px rgba(30, 50, 64, .25); text-shadow: 0 2px 0 rgba(21, 113, 134, .65); }
.mgs-cbtn.big { width: 104px; height: 96px; border-radius: 32px; }
.mgs-cbtn.hot { filter: brightness(1.1) saturate(1.15); animation: mgs-hot2 .55s ease-in-out infinite alternate; }

/* ------------------------------------------------------------------ hint pill */
.mgs-hint {
  position: absolute; left: 50%; bottom: calc(var(--safe-bottom) + 134px); transform: translate(-50%, 10px); opacity: 0;
  max-width: calc(100vw - 24px); padding: 8px 16px; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: rgba(255, 250, 240, .95); color: #4a3b33; font-weight: 600; font-size: 15px;
  border: 2px solid rgba(205, 176, 122, .9); box-shadow: 0 4px 12px rgba(30, 50, 64, .2);
  transition: opacity .3s, transform .3s var(--ease-soft); pointer-events: none;
}
.mgs-hint.on { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------------ cards (intro / mode choice / result) */
.mgs-cardwrap {
  position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center;
  padding: calc(var(--safe-top) + 66px) 16px calc(var(--safe-bottom) + 16px);
  background: radial-gradient(ellipse at 50% 55%, rgba(28, 60, 84, .12), rgba(28, 60, 84, .38));
  pointer-events: auto; animation: mgs-fade .3s ease both;
}
.mgs-cardwrap.out { animation: mgs-fadeout .3s ease both; pointer-events: none; }
.mgs-card { width: min(360px, 100%); max-height: 100%; overflow-y: auto; padding: 16px 18px 16px; text-align: center; animation: mgs-cardin .5s var(--ease-spring) both; }
.mgs-card-icon { font-size: 46px; line-height: 1.05; margin-top: -2px; }
.mgs-card-title { margin: 4px 0 2px; }
.mgs-card-text { margin: 6px 2px 12px; color: var(--ink-soft); font-size: 15px; line-height: 1.38; }
.mgs-card-faces { display: flex; justify-content: center; gap: 4px; margin: 8px 0 2px; }
.mgs-card-faces .mgs-face { display: block; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 3px 0 rgba(0, 0, 0, .12); background: var(--turq-light); }
.mgs-card-score { font-size: 36px; font-weight: 700; line-height: 1.1; color: var(--ink); letter-spacing: 1px; }
.mgs-card-tip { margin: 0 4px 12px; font-size: 13px; font-weight: 600; color: var(--turq-dark); }
.mgs-card-pts {
  display: inline-block; margin: 0 0 10px; padding: 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 700;
  background: #dff6e6; color: #226b3a; border: 2px solid var(--green);
}
.mgs-card-pts.soft { background: var(--sand); color: var(--ink-soft); border-color: var(--sand-dark); font-weight: 600; font-size: 13px; }
.mgs-card-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.mgs-card-btn { flex: 1 1 130px; }
.mgs-card-btn .mgs-bi { font-size: 18px; }
.mgs-result.won .mgs-card-icon { animation: mgs-bob 1.3s ease-in-out infinite; }
.mgs-card-modes { display: flex; flex-direction: column; gap: 8px; margin: -4px 0 14px; }
.mgs-mode {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 10px; border-radius: 14px;
  background: var(--sand-light); border: 2px solid var(--sand-dark); color: var(--ink-soft); font-size: 13px; line-height: 1.3;
}
.mgs-mode b { color: var(--ink); font-size: 15px; }

/* ------------------------------------------------------------------ turn banner (football) */
.mgs-banner {
  position: absolute; left: 50%; top: 42%; z-index: 3; transform: translate(-50%, -50%) scale(.6); opacity: 0;
  padding: 10px 24px 11px; border-radius: 999px; white-space: nowrap; pointer-events: none;
  background: rgba(255, 250, 240, .96); border: 3px solid var(--turq); color: var(--ink);
  font: 700 26px/1.1 var(--font); box-shadow: 0 5px 0 var(--turq-dark), 0 14px 30px rgba(30, 50, 64, .28);
}
.mgs-banner.on { animation: mgs-banner 1.6s var(--ease-soft) both; }
.mgs-keep .mgs-cbtn-label { font-size: 14px; }

/* ------------------------------------------------------------------ keyframes */
@keyframes mgs-pop { 0% { transform: scale(1); } 40% { transform: scale(1.55); color: var(--yellow); } 100% { transform: scale(1); } }
@keyframes mgs-pip { 0% { transform: scale(.3) rotate(-40deg); } 70% { transform: scale(1.35) rotate(8deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes mgs-hot { from { box-shadow: 0 6px 0 #157186, 0 0 0 0 rgba(255, 215, 94, .85); } to { box-shadow: 0 6px 0 #157186, 0 0 0 14px rgba(255, 215, 94, 0); } }
@keyframes mgs-hot2 { from { box-shadow: 0 5px 0 rgba(0, 0, 0, .25), 0 0 0 0 rgba(255, 215, 94, .85); } to { box-shadow: 0 5px 0 rgba(0, 0, 0, .25), 0 0 0 12px rgba(255, 215, 94, 0); } }
@keyframes mgs-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mgs-fadeout { from { opacity: 1; } to { opacity: 0; } }
@keyframes mgs-cardin { from { opacity: 0; transform: translateY(26px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes mgs-bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-6px) rotate(4deg); } }
@keyframes mgs-banner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  24% { transform: translate(-50%, -50%) scale(1); }
  78% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -64%) scale(.96); }
}
@media (prefers-reduced-motion: reduce) {
  .mgs-banner.on { animation-duration: .01s; opacity: 1; transform: translate(-50%, -50%); }
  .mgs-act.hot, .mgs-cbtn.hot, .mgs-result.won .mgs-card-icon { animation: none; }
}

@media (min-width: 900px) {
  .mgs-board { top: calc(var(--safe-top) + 14px); min-width: 300px; padding: 6px 18px; }
  .mgs-num { font-size: 36px; min-width: 36px; }
  .mgs-pip { font-size: 17px; }
  .mgs-act { width: 108px; height: 108px; bottom: 26px; }
  .mgs-hint { bottom: 150px; }
}
@media (max-height: 560px) {
  .mgs-board { top: calc(var(--safe-top) + 8px); }
  .mgs-act { width: 78px; height: 78px; bottom: calc(var(--safe-bottom) + 12px); }
  .mgs-cbtn { width: 72px; height: 64px; }
  .mgs-hint { bottom: calc(var(--safe-bottom) + 100px); }
}
