/* =========================================================================
   Mira & Maia's Game Arcade — shared design system
   Kid-friendly (age ~5): big, bright, rounded, bouncy. No external assets.
   ========================================================================= */

:root {
  /* Playful palette */
  --c-red:    #ff5a5f;
  --c-orange: #ff9f1c;
  --c-yellow: #ffd23f;
  --c-green:  #2ec4b6;
  --c-blue:   #3a86ff;
  --c-purple: #8338ec;
  --c-pink:   #ff70a6;
  --c-navy:   #22223b;
  --c-cream:  #fff8ec;

  --ink:      #2b2440;
  --ink-soft: #6b6480;
  --paper:    #ffffff;

  --p1: var(--c-blue);   /* player 1 default */
  --p2: var(--c-red);    /* player 2 / computer default */

  --shadow: 0 6px 0 rgba(0,0,0,.14);
  --shadow-lg: 0 12px 30px rgba(34,34,59,.22);
  --radius: 22px;
  --radius-sm: 14px;

  --font: 'Baloo 2', 'Fredoka', 'Comic Sans MS', 'Segoe UI Rounded', 'Trebuchet MS', system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }
/* Never allow sideways scroll — decorative blobs & wide boards get clipped, not scrolled. */
html { overflow-x: hidden; }
body { overflow-x: hidden; max-width: 100vw; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 15% -10%, #ffe6a733, transparent 60%),
    radial-gradient(1000px 700px at 110% 10%, #a0e7e533, transparent 55%),
    linear-gradient(160deg, #fff3d6 0%, #ffe8f0 40%, #e6f0ff 100%);
  background-attachment: fixed;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Floating decorative blobs (added via JS on some pages) */
.mm-blob { position: fixed; border-radius: 50%; filter: blur(2px); opacity: .35; z-index: 0; pointer-events: none; animation: floaty 9s ease-in-out infinite; }
@keyframes floaty { 0%,100%{ transform: translateY(0) } 50%{ transform: translateY(-22px) } }

/* ------------------------------------------------------------------ chrome */
.mm-topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(8px);
  border-bottom: 3px solid #ffffffaa;
}
.mm-topbar .mm-title {
  font-weight: 800; font-size: clamp(18px, 3.4vw, 26px);
  margin: 0; letter-spacing: .3px; flex: 1;
  display: flex; align-items: center; gap: 10px;
}
.mm-topbar .mm-title .emoji { font-size: 1.3em; }

.mm-btn {
  font-family: var(--font);
  font-weight: 800;
  font-size: 17px;
  border: none;
  border-radius: 999px;
  padding: 11px 20px;
  color: #fff;
  background: var(--c-blue);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .08s ease, filter .15s ease, box-shadow .08s ease;
  user-select: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.mm-btn:hover { filter: brightness(1.06); }
.mm-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.14); }
.mm-btn.ghost { background: #ffffff; color: var(--ink); box-shadow: 0 4px 0 #e7e0d0; }
.mm-btn.green { background: var(--c-green); }
.mm-btn.orange{ background: var(--c-orange); }
.mm-btn.purple{ background: var(--c-purple); }
.mm-btn.pink  { background: var(--c-pink); }
.mm-btn.red   { background: var(--c-red); }
.mm-btn:disabled { opacity: .45; cursor: default; transform: none; filter: grayscale(.3); }
.mm-btn.small { font-size: 14px; padding: 8px 14px; }
.mm-icon-btn {
  width: 46px; height: 46px; padding: 0; justify-content: center;
  font-size: 22px; background: #fff; color: var(--ink); box-shadow: 0 4px 0 #e7e0d0;
}

a.mm-btn { text-decoration: none; }

/* ------------------------------------------------------------------ layout */
.mm-stage {
  position: relative; z-index: 1;
  max-width: 940px; margin: 0 auto; padding: 18px 16px 60px;
}
.mm-panel {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 20px;
  border: 4px solid #fff;
}
.mm-center { text-align: center; }
.mm-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: center; }
.mm-hidden { display: none !important; }

/* status / turn banner */
.mm-status {
  font-size: clamp(18px, 3.6vw, 24px);
  font-weight: 800; text-align: center;
  padding: 10px 16px; margin: 4px auto 14px;
  border-radius: var(--radius-sm);
  background: #fff7; display: inline-block;
  min-height: 1.2em;
}
.mm-status .chip { padding: 2px 12px; border-radius: 999px; color:#fff; }

/* ------------------------------------------------------------ mode select */
.mm-mode-wrap { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-top: 8px; }
.mm-mode-card {
  cursor: pointer; text-align: center;
  background: var(--paper); border: 4px solid #fff;
  border-radius: var(--radius); padding: 22px 16px;
  box-shadow: var(--shadow-lg);
  transition: transform .12s ease;
}
.mm-mode-card:hover { transform: translateY(-5px) rotate(-1deg); }
.mm-mode-card .big { font-size: 52px; line-height: 1; margin-bottom: 8px; }
.mm-mode-card .name { font-weight: 800; font-size: 20px; }
.mm-mode-card .sub { color: var(--ink-soft); font-size: 14px; margin-top: 4px; }

/* selectable option pills (difficulty, player count…) */
.mm-pills { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.mm-pill {
  cursor: pointer; border: 3px solid #e7e0d0; background: #fff;
  border-radius: 999px; padding: 9px 18px; font-weight: 800; font-size: 16px; color: var(--ink);
  transition: transform .08s ease;
}
.mm-pill[aria-pressed="true"] { background: var(--c-yellow); border-color: var(--c-orange); }
.mm-pill:active { transform: translateY(2px); }

/* ------------------------------------------------------------------ modal */
.mm-modal-back {
  position: fixed; inset: 0; z-index: 60; display: none;
  background: rgba(34,34,59,.55); backdrop-filter: blur(3px);
  align-items: center; justify-content: center; padding: 18px;
}
.mm-modal-back.open { display: flex; }
.mm-modal {
  background: var(--paper); border-radius: var(--radius);
  max-width: 560px; width: 100%; max-height: 86vh; overflow: auto;
  padding: 24px; box-shadow: var(--shadow-lg); border: 5px solid #fff;
}
.mm-modal h2 { margin: 0 0 6px; font-size: 26px; }
.mm-modal h3 { margin: 16px 0 4px; }
.mm-modal p, .mm-modal li { line-height: 1.5; font-size: 16px; }
.mm-modal ol, .mm-modal ul { padding-left: 22px; }
.mm-modal .ba-link {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 14px; font-weight: 800; color: var(--c-purple); text-decoration: none;
  background: #f3ecff; padding: 10px 16px; border-radius: 999px;
}
.mm-modal .ba-link:hover { text-decoration: underline; }
.mm-modal .close-row { display: flex; justify-content: flex-end; margin-top: 16px; }

/* ---------------------------------------------------------------- winner */
.mm-win {
  position: fixed; inset: 0; z-index: 70; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(255,255,255,.28); backdrop-filter: blur(2px);
}
.mm-win.open { display: flex; }
.mm-win .card {
  background: var(--paper); border-radius: 30px; padding: 34px 40px; text-align: center;
  box-shadow: var(--shadow-lg); border: 6px solid var(--c-yellow);
  animation: pop .5s cubic-bezier(.2,1.4,.4,1);
}
.mm-win .card .trophy { font-size: 84px; animation: wob 1.2s ease-in-out infinite; }
.mm-win .card h2 { font-size: 32px; margin: 6px 0 2px; }
.mm-win .card p { color: var(--ink-soft); margin: 0 0 16px; font-size: 18px; }
@keyframes pop { from { transform: scale(.4); opacity: 0 } to { transform: scale(1); opacity: 1 } }
@keyframes wob { 0%,100%{ transform: rotate(-9deg) } 50%{ transform: rotate(9deg) } }

/* confetti canvas */
#mm-confetti { position: fixed; inset: 0; z-index: 65; pointer-events: none; }

/* dice */
.mm-die {
  width: 74px; height: 74px; border-radius: 16px; background: #fff;
  box-shadow: var(--shadow); display: inline-grid; grid-template-columns: repeat(3,1fr);
  grid-template-rows: repeat(3,1fr); padding: 10px; gap: 2px; vertical-align: middle;
}
.mm-die.rolling { animation: shake .5s ease; }
@keyframes shake { 10%,90%{transform:translateX(-2px) rotate(-6deg)} 30%,70%{transform:translateX(3px) rotate(6deg)} 50%{transform:translateX(-3px) rotate(-4deg)} }
.mm-die i { display: block; align-self: center; justify-self: center; width: 13px; height: 13px; border-radius: 50%; background: var(--ink); }

/* playing card */
.mm-card {
  width: 62px; height: 88px; border-radius: 12px; background: #fff;
  box-shadow: var(--shadow); display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 30px; color: var(--ink); position: relative; border: 3px solid #fff;
  transition: transform .12s ease;
}
.mm-card.back {
  background: repeating-linear-gradient(45deg, var(--c-purple), var(--c-purple) 8px, #7a2fe0 8px, #7a2fe0 16px);
  color: #fff;
}
.mm-card.sel { transform: translateY(-12px); outline: 4px solid var(--c-yellow); }

/* generic bouncy entrance */
.mm-bounce-in { animation: bin .35s cubic-bezier(.2,1.3,.4,1); }
@keyframes bin { from{ transform: scale(.7); opacity: 0 } to{ transform: scale(1); opacity: 1 } }

/* small helper text */
.mm-hint { color: var(--ink-soft); font-size: 15px; text-align: center; margin: 8px 0; }
.mm-scorebar { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 6px 0 14px; }
.mm-score {
  background: #fff; border-radius: 16px; padding: 8px 16px; box-shadow: 0 4px 0 #e7e0d0;
  font-weight: 800; display: flex; align-items: center; gap: 8px; font-size: 18px;
}
.mm-score .dot { width: 16px; height: 16px; border-radius: 50%; }
.mm-score.active { outline: 3px solid var(--c-yellow); }

@media (max-width: 520px) {
  .mm-stage { padding: 12px 10px 50px; }
  .mm-panel { padding: 14px; }
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}
