/* Memoria — game styles. Mobile first (390×844, 360×640), the Juntos promo palette: coral→orange hero, cream, navy, white pills, ink. */
:root {
  --mm-hero: linear-gradient(145deg, #FF6B4A 0%, #FF9A3C 100%);
  --mm-navy: radial-gradient(circle at 30% 0%, #3A3D5C 0%, #1F2137 72%);
  --mm-ink: #2B2D42;
  --mm-gold: #FFC93C;
  --mm-coral: #F0502F;
  --mm-coral-deep: #C8381A;
  --mm-accent-ink: #B8331A;   /* coral text on white / cream (5.7:1) */
  --mm-edge: rgba(43, 45, 66, .08);
  --mm-lift: 0 14px 26px -20px rgba(43, 45, 66, .55), 0 3px 8px -4px rgba(43, 45, 66, .16);
  --mm-hi: inset 0 1px 0 rgba(255, 255, 255, .85);
  --mm-glow: 0 16px 26px -14px rgba(240, 80, 47, .75), inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -3px 0 rgba(150, 40, 10, .18);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --mm-edge: rgba(255, 255, 255, .1); --mm-lift: 0 14px 26px -18px rgba(0, 0, 0, .75); --mm-hi: inset 0 1px 0 rgba(255, 255, 255, .07); --mm-accent-ink: #FF9A80; }
}
:root[data-theme="dark"] { --mm-edge: rgba(255, 255, 255, .1); --mm-lift: 0 14px 26px -18px rgba(0, 0, 0, .75); --mm-hi: inset 0 1px 0 rgba(255, 255, 255, .07); --mm-accent-ink: #FF9A80; }

.ndj-app.mm-wide { max-width: 1180px; }
.ndj-app.mm-tight { padding-top: 10px; padding-bottom: 10px; }
body.mm-playing { overscroll-behavior-y: none; }
/* dark mode: the promo's navy behind everything */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body { background: radial-gradient(circle at 30% 0%, #3A3D5C 0%, #1F2137 72%); background-attachment: fixed; }
}
:root[data-theme="dark"] body { background: radial-gradient(circle at 30% 0%, #3A3D5C 0%, #1F2137 72%); background-attachment: fixed; }
/* results: the hero gradient fills the page */
body.mm-hero { background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, .26) 0%, rgba(255, 255, 255, 0) 55%), var(--mm-hero); background-attachment: fixed; }

/* ------------------------------------------------------------ small parts */
.mm-tb { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.mm-helpbtn .ndj-ic { width: 22px; height: 22px; }
.mm-topinvite { gap: 6px; padding: 0 12px; }
.mm-topinvite .ndj-ic { width: 19px; height: 19px; }
@media (max-width: 520px) {
  .mm-topinvite { padding: 0; width: 42px; }
  .mm-topinvite__txt { display: none; }
}
.mm-iconbtn {
  box-shadow: var(--mm-hi), 0 4px 8px -5px rgba(43, 45, 66, .45);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--mm-edge); background: linear-gradient(180deg, color-mix(in srgb, var(--card) 70%, #fff), var(--card-2)); color: var(--fg);
  transition: transform .12s;
}
.mm-iconbtn:active { transform: scale(.94); }
.mm-iconbtn .ndj-ic { width: 18px; height: 18px; }

.mm-connecting { display: flex; flex-direction: column; align-items: center; gap: 28px; padding-top: 14vh; }

/* ------------------------------------------------------------ lobby / setup */
.mm-lobby { display: flex; flex-direction: column; gap: 16px; }
.mm-lobby__a { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.mm-note { margin-top: 16px; color: var(--fg-2); font-size: .9rem; }
.mm-hint { text-align: center; color: var(--fg-2); font-size: .95rem; font-weight: 700; }
.ndj-app.mm-flush { padding-bottom: 0; }
.mm-actionbar {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; flex-direction: column; gap: 8px;
  margin: 0 -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--mm-edge);
}
.mm-actionbar--row { flex-direction: row; align-items: stretch; }
.mm-actionbar--row > .btn { padding-inline: 16px; white-space: nowrap; }
.mm-actionbar--row > .btn-primary { flex: 1 1 auto; min-width: 0; }
.mm-actionbar--row > .btn-secondary { flex: 0 0 auto; }
.mm-actionbar--row > .ndj-wait { flex: 1 1 auto; }
.mm-btxt { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mm-start, .mm-again { font-weight: 700; font-size: 1.2rem; min-height: 56px; }
@media (min-width: 900px) {
  .mm-lobby {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "a b" "a c"; grid-template-rows: auto 1fr; gap: 20px 24px; align-items: start;
  }
  .mm-lobby__a { grid-area: a; }
  .mm-players-card { order: -1; }
  .mm-lobby__b { grid-area: b; }
  .mm-lobby__c { grid-area: c; position: static; margin: 0; padding: 0; background: none; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .ndj-app.mm-flush { padding-bottom: 40px; }
}

/* settings */
.mm-field + .mm-field { margin-top: 18px; }
.mm-field__label { font-family: var(--font-display); font-weight: 600; font-size: 1rem; color: var(--fg); margin-bottom: 8px; }
.mm-field__note { margin-top: 8px; font-size: .9rem; font-weight: 700; color: var(--fg-2); text-align: center; }
.mm-opts { display: grid; gap: 8px; }
.mm-opts--theme { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mm-opts--size { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.mm-opts--order { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mm-opt {
  -webkit-appearance: none; appearance: none; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-width: 0; min-height: 56px; padding: 10px 8px; border-radius: 18px;
  border: 1px solid var(--mm-edge); background: linear-gradient(180deg, color-mix(in srgb, var(--card) 70%, #fff), var(--card-2)); color: var(--fg);
  box-shadow: var(--mm-hi), 0 6px 10px -7px rgba(43, 45, 66, .5);
  font: 800 .95rem/1.2 var(--font-body); text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s, box-shadow .2s, transform .12s, opacity .2s;
}
.mm-opt:active { transform: scale(.97); }
.mm-opt[aria-pressed="true"] {
  border: 2px solid var(--mm-coral); color: var(--fg);
  background: linear-gradient(180deg, color-mix(in srgb, var(--coral) 12%, var(--card)), color-mix(in srgb, var(--coral) 24%, var(--card)));
  box-shadow: 0 10px 18px -12px rgba(240, 80, 47, .75), inset 0 1px 0 rgba(255, 255, 255, .6);
}
.mm-opt[aria-pressed="true"]::after {
  content: ""; position: absolute; top: -8px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 12.5l4 4 9-9'/%3E%3C/svg%3E") center / 14px no-repeat, var(--mm-hero);
  box-shadow: 0 0 0 2px var(--card), 0 3px 6px -2px rgba(160, 40, 10, .5);
}
.mm-opt.is-ro { cursor: default; }
.mm-opt.is-ro:active { transform: none; }
.mm-opt.is-ro:not([aria-pressed="true"]) { opacity: .5; }
.mm-opt__art { display: flex; align-items: center; justify-content: center; }
.mm-opt__art .mm-art { width: 36px; height: 36px; margin: 0 -2px; filter: drop-shadow(0 1px 1px rgba(43, 45, 66, .12)); }
.mm-opt__txt { max-width: 100%; }
.mm-opt__num { font: 700 1.4rem/1 var(--font-display); }
.mm-opt--size { min-height: 54px; padding: 8px 4px; }
.mm-opt--order { flex-direction: row; gap: 8px; }
.mm-opt--order .ndj-ic { width: 18px; height: 18px; color: var(--fg-2); }

/* local setup */
.mm-setup { display: flex; flex-direction: column; gap: 18px; }
.mm-setup__head { display: flex; align-items: center; gap: 14px; }
.mm-setup__title { font-size: 1.45rem; }
.mm-plist { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.mm-prow { display: flex; align-items: center; gap: 10px; animation: ndj-pop .25s ease both; }
.mm-pinput { min-height: 50px; font-size: 1.05rem; }
.mm-pdot { width: 38px; height: 38px; font-size: 1rem; }
.mm-add .ndj-ic { width: 18px; height: 18px; }

/* ------------------------------------------------------------ play */
.mm-play { display: flex; flex-direction: column; gap: 10px; }
.mm-hud { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

/* the one instruction */
.mm-turn {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 78px; padding: 9px 14px 9px 10px; border-radius: 22px; overflow: hidden; color: var(--fg);
  background: var(--card); border: 1px solid var(--mm-edge); box-shadow: var(--mm-lift), var(--mm-hi);
}
.mm-turn__lead {
  flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: #fff; color: #E04A2C; box-shadow: 0 8px 14px -8px rgba(120, 30, 5, .6), inset 0 -3px 0 rgba(200, 80, 30, .12);
}
.mm-turn__lead .ndj-ic { width: 30px; height: 30px; }
.mm-turn__lead--who { background: transparent; box-shadow: none; }
.mm-turn__lead--who .ndj-avatar { width: 50px; height: 50px; font-size: 1.35rem; }
.mm-turn__txt { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; flex: 1; }
.mm-turn__title { max-width: 100%; font: 700 1.4rem/1.1 var(--font-display); letter-spacing: -.01em; overflow-wrap: anywhere; }
.mm-turn__sub {
  max-width: 100%; padding: 2px 10px; border-radius: 999px; background: #fff; color: var(--mm-ink);
  font-weight: 800; font-size: .9rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 4px 8px -5px rgba(120, 30, 5, .5);
}
.mm-turn__pairs {
  flex: none; padding: 5px 11px; border-radius: 14px; background: #fff;
  box-shadow: 0 4px 8px -5px rgba(120, 30, 5, .5), inset 0 -2px 0 rgba(43, 45, 66, .06);
  font: 600 .95rem var(--font-display); font-variant-numeric: tabular-nums; color: #4A4D68;
}
.mm-turn__pairs b { font-size: 1.35rem; font-weight: 700; color: var(--mm-ink); }
/* my turn / a pair: the hero gradient, large white text */
.mm-turn.is-mine, .mm-turn.is-match {
  color: #fff; border-color: transparent; box-shadow: var(--mm-glow);
  background: radial-gradient(120% 90% at 20% -20%, rgba(255, 255, 255, .34), rgba(255, 255, 255, 0) 55%), var(--mm-hero);
}
.mm-turn.is-mine .mm-turn__title, .mm-turn.is-match .mm-turn__title { text-shadow: 0 2px 3px rgba(160, 40, 10, .38); }
.mm-turn.is-mine .mm-turn__lead--who .ndj-avatar { box-shadow: 0 0 0 3px #fff, 0 6px 10px -4px rgba(120, 30, 5, .6); }
.mm-turn.is-match { animation: mm-glow 1.4s ease-in-out 1; }
.mm-turn.is-match .mm-turn__lead { color: #D4920A; }
/* waiting for someone else: navy */
.mm-turn.is-other { color: #fff; border-color: rgba(255, 255, 255, .1); background: var(--mm-navy); box-shadow: 0 16px 26px -16px rgba(20, 22, 50, .85), inset 0 1px 0 rgba(255, 255, 255, .16); }
.mm-turn.is-other .mm-turn__sub { background: rgba(255, 255, 255, .14); color: #F3F1FF; box-shadow: none; }
.mm-turn.is-other .mm-turn__pairs { background: rgba(255, 255, 255, .14); color: #D7D9EE; box-shadow: none; }
.mm-turn.is-other .mm-turn__pairs b { color: #fff; }
.mm-turn.is-other .mm-turn__lead--who .ndj-avatar { box-shadow: 0 0 0 3px rgba(255, 255, 255, .85); }
/* wrong pair: white with a coral edge */
.mm-turn.is-miss { border: 2px solid var(--mm-coral); background: linear-gradient(180deg, color-mix(in srgb, var(--coral) 8%, var(--card)), color-mix(in srgb, var(--coral) 20%, var(--card))); }
.mm-turn.is-miss .mm-turn__lead { background: var(--mm-hero); color: #fff; }
.mm-turn.is-miss .mm-turn__sub, .mm-turn.is-miss .mm-turn__pairs { background: var(--card); box-shadow: var(--mm-hi); }
.mm-turn.is-miss .mm-turn__sub { color: var(--mm-accent-ink); }
/* finished: green */
.mm-turn.is-done { border-color: color-mix(in srgb, var(--green) 50%, transparent); background: linear-gradient(180deg, color-mix(in srgb, var(--green) 14%, var(--card)), color-mix(in srgb, var(--green) 26%, var(--card))); }
.mm-turn.is-done .mm-turn__lead { background: linear-gradient(180deg, #4BE3A0, #1FB56F); color: #fff; }
.mm-turn.is-done .mm-turn__sub, .mm-turn.is-done .mm-turn__pairs { background: var(--card); }
.mm-turn.is-new { animation: mm-banner .5s cubic-bezier(.3, 1.5, .5, 1); }
.mm-turn.is-nudge { animation: ndj-shake .4s ease; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mm-turn.is-other { border-color: rgba(255, 255, 255, .2); }
  :root:not([data-theme="light"]) .mm-turn.is-miss .mm-turn__sub { color: #FFB4A0; }
}
:root[data-theme="dark"] .mm-turn.is-other { border-color: rgba(255, 255, 255, .2); }
:root[data-theme="dark"] .mm-turn.is-miss .mm-turn__sub { color: #FFB4A0; }

@media (max-width: 380px) {
  .mm-turn { gap: 10px; padding-left: 8px; min-height: 72px; }
  .mm-turn__title { font-size: 1.22rem; }
  .mm-turn__lead { width: 46px; height: 46px; }
  .mm-turn__lead .ndj-ic { width: 27px; height: 27px; }
  .mm-turn__lead--who .ndj-avatar { width: 44px; height: 44px; font-size: 1.2rem; }
  .mm-turn__pairs { padding: 4px 9px; }
}

/* scoreboard strip */
.mm-chips {
  list-style: none; margin: 0; padding: 4px 4px 6px; display: flex; gap: 8px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.mm-chips::-webkit-scrollbar { display: none; }
.mm-chip {
  flex: 1 1 0; min-width: 0; min-height: 48px; display: flex; align-items: center; gap: 7px; max-width: 220px;
  padding: 4px 5px 4px 4px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--mm-edge); box-shadow: var(--mm-lift), var(--mm-hi);
  font-weight: 800; font-size: 1rem;
  transition: border-color .25s, box-shadow .25s, opacity .25s;
}
.mm-chips.is-many .mm-chip { flex: 0 0 auto; min-width: 104px; max-width: 200px; }
.mm-chip .ndj-avatar { width: 34px; height: 34px; font-size: .95rem; flex: none; }
.mm-chip__name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-chip.is-me { background: color-mix(in srgb, var(--coral) 9%, var(--card)); }
.mm-chip__score {
  flex: none; display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 9px;
  border-radius: 999px; background: var(--bg-2); font: 700 1.15rem var(--font-display); font-variant-numeric: tabular-nums;
}
.mm-chip.is-turn { border: 2px solid var(--mm-coral); padding: 3px 4px 3px 3px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--mm-coral) 20%, transparent), var(--mm-lift); }
.mm-chip.is-turn .mm-chip__score { background: var(--mm-hero); color: #fff; text-shadow: 0 1px 2px rgba(160, 40, 10, .4); }
.mm-chip.is-away { opacity: .5; }

/* board: a navy table, the coral cards pop on it */
.mm-boardwrap { position: relative; display: flex; justify-content: center; align-items: center; min-width: 0; }
.mm-board {
  display: grid; grid-template-columns: repeat(var(--cols, 4), var(--cw, 72px)); gap: var(--gap, 8px);
  padding: var(--pad, 8px); border-radius: 26px;
  background: radial-gradient(120% 80% at 30% 0%, #444868 0%, #262944 58%, #1F2137 100%);
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .12), 0 24px 36px -26px rgba(31, 33, 55, .85), 0 0 0 3px color-mix(in srgb, var(--mm-coral) 38%, transparent);
}

.mm-card {
  position: relative; display: block; width: var(--cw, 72px); height: var(--ch, 90px);
  margin: 0; padding: 0; border: 0; background: none; color: inherit;
  border-radius: var(--cr, 14px); cursor: pointer; perspective: 800px; contain: layout style;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform .18s ease;
}
.mm-card.is-locked { cursor: default; }
.mm-card:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.mm-card__inner {
  position: absolute; inset: 0; display: block; transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.3, 1.3, .5, 1);
}
.mm-card.is-up .mm-card__inner { transform: rotateY(180deg); }
.mm-card__face {
  position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden;
  border-radius: var(--cr, 14px); -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.mm-card__back {
  background:
    radial-gradient(130% 60% at 25% 0%, rgba(255, 255, 255, .42), rgba(255, 255, 255, 0) 58%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .2) 1.3px, transparent 1.8px) 0 0 / 11px 11px,
    var(--mm-hero);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), inset 0 -4px 0 rgba(150, 40, 10, .22), 0 10px 14px -8px rgba(0, 0, 0, .55);
}
.mm-card__back::before {
  content: ""; position: absolute; inset: 5px; border-radius: calc(var(--cr, 14px) - 4px);
  border: 1.5px solid rgba(255, 255, 255, .62);
}
.mm-back__emb { position: relative; width: 52%; height: auto; max-height: 52%; filter: drop-shadow(0 2px 2px rgba(150, 40, 0, .35)); }
/* card backs won in the collection (html[data-mm-back], set from NDJ.collection.equipped('cardback')); no attribute = the Juntos back above */
:root[data-mm-back] .mm-back__emb { width: 58%; max-height: 58%; }
:root[data-mm-back="stars"] .mm-card__back {
  background:
    radial-gradient(130% 60% at 25% 0%, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 58%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28'%3E%3Cpath d='M7 3l1 2.4 2.4 1-2.4 1L7 9.8 6 7.4 3.6 6.4 6 5.4z' fill='%23FFD23F' opacity='.55'/%3E%3Ccircle cx='21' cy='19' r='1.1' fill='%23fff' opacity='.6'/%3E%3Ccircle cx='17' cy='6' r='.7' fill='%23fff' opacity='.45'/%3E%3Cpath d='M22 23.2l.6 1.5 1.5.6-1.5.6-.6 1.5-.6-1.5-1.5-.6 1.5-.6z' fill='%23FFE66D' opacity='.4'/%3E%3C/svg%3E") 0 0 / 28px 28px,
    radial-gradient(120% 90% at 50% 30%, #4A4E86 0%, #3A3D5C 45%, #1F2137 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -4px 0 rgba(0, 0, 0, .28), 0 10px 14px -8px rgba(0, 0, 0, .6);
}
:root[data-mm-back="stars"] .mm-card__back::before { border-color: rgba(255, 210, 63, .7); }
:root[data-mm-back="stars"] .mm-back__emb { filter: drop-shadow(0 0 6px rgba(255, 210, 63, .55)) drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
:root[data-mm-back="waves"] .mm-card__back {
  background:
    radial-gradient(130% 60% at 25% 0%, rgba(255, 255, 255, .4), rgba(255, 255, 255, 0) 58%),
    radial-gradient(circle at 50% 100%, transparent 6px, rgba(255, 255, 255, .2) 6.5px 8px, transparent 8.5px) 0 0 / 16px 10px,
    linear-gradient(170deg, #5FE0E6 0%, #1FB5C9 40%, #1478A8 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), inset 0 -4px 0 rgba(8, 60, 100, .3), 0 10px 14px -8px rgba(0, 0, 0, .55);
}
:root[data-mm-back="waves"] .mm-back__emb { filter: drop-shadow(0 2px 2px rgba(8, 60, 100, .45)); }
:root[data-mm-back="hearts"] .mm-card__back {
  background:
    radial-gradient(130% 60% at 25% 0%, rgba(255, 255, 255, .42), rgba(255, 255, 255, 0) 58%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9.6C3.2 7.8 2.4 6.4 2.4 5.2a1.9 1.9 0 0 1 3.6-.9 1.9 1.9 0 0 1 3.6.9c0 1.2-.8 2.6-3.6 4.4zM18 21.6c-2.8-1.8-3.6-3.2-3.6-4.4a1.9 1.9 0 0 1 3.6-.9 1.9 1.9 0 0 1 3.6.9c0 1.2-.8 2.6-3.6 4.4z' fill='%23fff' opacity='.28'/%3E%3C/svg%3E") 0 0 / 24px 24px,
    linear-gradient(155deg, #FF9AC4 0%, #FF5C9A 45%, #D93A78 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), inset 0 -4px 0 rgba(140, 20, 70, .25), 0 10px 14px -8px rgba(0, 0, 0, .55);
}
:root[data-mm-back="hearts"] .mm-back__emb { filter: drop-shadow(0 2px 3px rgba(140, 20, 70, .45)); }
:root[data-mm-back="galaxy"] .mm-card__back {
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 120, 220, .55), transparent 42%),
    radial-gradient(circle at 80% 78%, rgba(80, 170, 255, .5), transparent 48%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Ccircle cx='4' cy='6' r='.8' fill='%23fff'/%3E%3Ccircle cx='19' cy='3' r='.5' fill='%23fff' opacity='.7'/%3E%3Ccircle cx='26' cy='14' r='.9' fill='%23fff' opacity='.85'/%3E%3Ccircle cx='11' cy='19' r='.6' fill='%23fff' opacity='.6'/%3E%3Ccircle cx='22' cy='26' r='.7' fill='%23FFE66D' opacity='.8'/%3E%3Ccircle cx='6' cy='27' r='.5' fill='%23fff' opacity='.5'/%3E%3C/svg%3E") 0 0 / 30px 30px,
    linear-gradient(160deg, #2A1658 0%, #1A0E3A 55%, #0D0820 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), inset 0 -4px 0 rgba(0, 0, 0, .35), 0 0 0 1px rgba(199, 123, 255, .35), 0 10px 16px -8px rgba(60, 20, 120, .8);
}
:root[data-mm-back="galaxy"] .mm-card__back::before { border-color: rgba(255, 210, 63, .55); }
:root[data-mm-back="galaxy"] .mm-card__back::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; mix-blend-mode: screen;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .28) 45%, rgba(160, 220, 255, .18) 52%, transparent 66%) 0 0 / 260% 100%;
  animation: mm-holo 5.5s ease-in-out infinite;
}
:root[data-mm-back="galaxy"] .mm-back__emb { filter: drop-shadow(0 0 8px rgba(199, 123, 255, .7)); }
@keyframes mm-holo { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { :root[data-mm-back="galaxy"] .mm-card__back::after { animation: none; background-position: 50% 0; } }
.mm-card__seen {
  display: none; position: absolute; top: 5px; left: 5px; place-items: center; z-index: 1;
  width: clamp(16px, calc(var(--cw, 72px) * .25), 25px); height: clamp(16px, calc(var(--cw, 72px) * .25), 25px); border-radius: 50%;
  background: #fff; color: var(--mm-coral-deep); box-shadow: 0 2px 4px rgba(120, 30, 5, .45);
}
.mm-card__seen .ndj-ic { width: 66%; height: 66%; }
.mm-board.is-easy .mm-card.is-seen:not(.is-up) .mm-card__seen { display: grid; }
.mm-card__front {
  transform: rotateY(180deg); background: var(--tint, #fff);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .9), inset 0 -4px 0 rgba(43, 45, 66, .07), 0 10px 14px -8px rgba(0, 0, 0, .55);
}
.mm-card__front .mm-art { width: 84%; height: auto; aspect-ratio: 1; transition: opacity .4s, transform .4s; }
@media (hover: hover) and (pointer: fine) {
  .mm-card:not(.is-locked):hover { transform: translateY(-3px); }
}
/* picked: a clear gold ring */
.mm-card.is-up:not(.is-matched) .mm-card__front { box-shadow: inset 0 0 0 4px var(--mm-gold), 0 0 0 3px rgba(255, 201, 60, .45), 0 8px 18px rgba(255, 201, 60, .4); }
.mm-card.is-up.is-wrong .mm-card__front { box-shadow: inset 0 0 0 4px #FF6B6B, 0 0 0 3px rgba(255, 107, 107, .4), 0 8px 18px rgba(255, 107, 107, .4); }
.mm-card.is-wrong { animation: mm-shake .42s ease .45s both; }
.mm-card.is-matched .mm-card__front { box-shadow: inset 0 0 0 4px var(--own, var(--green)), inset 0 0 0 7px rgba(255, 255, 255, .85), 0 2px 6px rgba(0, 0, 0, .25); }
.mm-card.is-matched:not(.is-pop) .mm-art { opacity: .82; transform: scale(.92); }
.mm-card.is-pop { z-index: 2; animation: mm-pop .6s cubic-bezier(.3, 1.6, .5, 1) .35s both; }
.mm-card.is-pop::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .85);
  animation: mm-ring .9s ease-out .35s both;
}
.mm-card__own {
  position: absolute; top: 5px; right: 5px; background: var(--own, var(--green));
  width: clamp(17px, calc(var(--cw, 72px) * .26), 26px); height: clamp(17px, calc(var(--cw, 72px) * .26), 26px);
  display: grid; place-items: center; border-radius: 50%; color: #fff;
  font: 700 clamp(.6rem, calc(var(--cw, 72px) * .14), .85rem)/1 var(--font-display);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .95), 0 1px 3px rgba(0, 0, 0, .3);
}
.mm-card__own .ndj-ic { width: 70%; height: 70%; }

/* a funny caption: one at a time, over the edge of the board, never in the way of a tap */
.mm-quip {
  position: absolute; left: 0; right: 0; margin-inline: auto; top: 0; z-index: 9; translate: 0 -50%; pointer-events: none;
  width: max-content; max-width: 96%; display: flex; align-items: center; gap: 8px; padding: 6px 18px 6px 10px; border-radius: 999px; color: var(--mm-ink);
  background: #fff; border: 2px solid var(--mm-coral);
  box-shadow: 0 16px 28px -12px rgba(20, 22, 50, .7), 0 0 0 4px rgba(255, 255, 255, .35), inset 0 -3px 0 rgba(240, 80, 47, .12);
}
.mm-quip.is-on { animation: mm-quip 2.1s ease both; }
.mm-quip__e { font-size: 1.7rem; line-height: 1; font-style: normal; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif; animation: mm-emoji .6s cubic-bezier(.2, 1.8, .4, 1) both; }
.mm-quip__t { font: 700 clamp(1.05rem, 4.6vw, 1.25rem)/1.15 var(--font-display); text-wrap: balance; text-shadow: none; }

/* time and moves: quiet */
.mm-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 42px; }
.mm-stats { display: flex; align-items: center; gap: 14px; color: var(--fg-2); font-weight: 700; font-size: .88rem; }
.mm-stat { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.mm-stat .ndj-ic { width: 16px; height: 16px; }
.mm-endbtn { min-height: 44px; }
.mm-endbtn .ndj-ic { width: 16px; height: 16px; }

@media (min-width: 900px) {
  .ndj-app.mm-tight { padding-top: 18px; }
  .mm-play {
    display: grid; grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-areas: "board hud" "board foot"; grid-template-rows: auto 1fr; gap: 16px 28px; align-items: start;
  }
  .mm-hud { grid-area: hud; gap: 12px; }
  .mm-boardwrap { grid-area: board; align-items: flex-start; }
  .mm-foot { grid-area: foot; flex-direction: column; align-items: stretch; gap: 12px; }
  .mm-stats { justify-content: space-between; padding: 12px 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--mm-edge); font-size: .95rem; }
  .mm-endbtn { align-self: flex-start; }
  .mm-turn { min-height: 90px; }
  .mm-chips { flex-direction: column; overflow: visible; gap: 8px; }
  .mm-chip, .mm-chips.is-many .mm-chip { flex: 0 0 auto; max-width: none; border-radius: 18px; padding: 7px 10px 7px 8px; gap: 10px; font-size: 1rem; }
  .mm-chip .ndj-avatar { width: 36px; height: 36px; font-size: 1rem; }
  .mm-chip__name { flex: 1; }
}
/* the reactions tab (rooms) rests at the bottom right, beside the footer, so it never sits on top of a card (reactions.js reads --ndj-fxtab-top) */
@media (max-width: 899px) {
  body.mm-playing.mm-online { --ndj-fxtab-top: calc(100% - 36px - env(safe-area-inset-bottom, 0px)); }
  body.mm-playing.mm-online .mm-foot { padding-right: 34px; }
}

/* local mode: pass-the-phone banner */
.mm-pass {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 24px;
  background: rgba(21, 21, 43, .7); /* no backdrop blur: blurring a 30-card 3D board on a slow phone janks the banner */
  animation: ndj-fade .2s ease both; cursor: pointer;
}
.mm-pass__card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 260px; max-width: 100%;
  padding: 28px 34px 24px; border-radius: 30px; text-align: center; color: #fff;
  background: radial-gradient(120% 80% at 50% -10%, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0) 60%), var(--mm-hero);
  box-shadow: 0 30px 50px -20px rgba(120, 30, 5, .75), 0 0 0 5px rgba(255, 255, 255, .3), inset 0 1px 0 rgba(255, 255, 255, .5);
  animation: mm-banner .45s cubic-bezier(.3, 1.5, .5, 1) both;
}
.mm-pass__card .ndj-avatar { box-shadow: 0 0 0 4px #fff, 0 10px 18px -8px rgba(120, 30, 5, .7); }
.mm-pass__kicker { margin-top: 12px; padding: 2px 12px; border-radius: 999px; background: #fff; color: var(--mm-ink); font-size: .85rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.mm-pass__name { font: 700 2.3rem/1.1 var(--font-display); max-width: 14ch; overflow-wrap: anywhere; text-shadow: 0 3px 4px rgba(160, 40, 10, .4); }
.mm-pass__hint { margin-top: 8px; padding: 3px 12px; border-radius: 999px; background: rgba(255, 255, 255, .92); color: var(--mm-ink); font-size: .9rem; font-weight: 700; }

/* ------------------------------------------------------------ results (hero gradient) */
.mm-end { display: flex; flex-direction: column; gap: 18px; max-width: 560px; margin: 0 auto; }
.mm-end__main, .mm-end__side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.mm-end__head { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 4px; text-align: center; }
.mm-end__trophy {
  display: grid; place-items: center; width: 72px; height: 72px; border-radius: 24px;
  background: linear-gradient(180deg, #FFE58A, #FFC93C 55%, #F2A81D); color: #8A5A00;
  box-shadow: 0 18px 26px -14px rgba(120, 50, 0, .7), 0 0 0 4px rgba(255, 255, 255, .45), inset 0 1px 0 rgba(255, 255, 255, .7), inset 0 -3px 0 rgba(160, 80, 0, .16);
  animation: ndj-float 4s ease-in-out 3;
}
.mm-end__trophy .ndj-ic { width: 42px; height: 42px; }
.mm-end__title { color: #fff; font-size: clamp(2.2rem, 9.5vw, 3rem); font-weight: 700; overflow-wrap: anywhere; text-shadow: 0 3px 5px rgba(160, 40, 10, .4); }
.mm-end__sub { padding: 4px 14px; border-radius: 999px; background: #fff; color: var(--mm-ink); font-weight: 800; font-size: 1rem; box-shadow: 0 8px 14px -8px rgba(120, 30, 5, .6); }
.mm-end__quip { display: inline-flex; align-items: center; gap: 8px; margin: 2px 0 0; padding: 0 4px; color: #fff; font: 700 1.2rem/1.2 var(--font-display); text-shadow: 0 2px 3px rgba(160, 40, 10, .4); text-wrap: balance; }
.mm-end__quip span:first-child { font-size: 1.6rem; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif; text-shadow: none; }
.mm-badge-new {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; padding: 6px 14px; border-radius: 999px;
  background: #fff; color: var(--mm-ink); font-weight: 800; box-shadow: 0 8px 14px -8px rgba(120, 30, 5, .6); animation: ndj-pop .4s ease .3s both;
}
.mm-badge-new .ndj-ic { width: 16px; height: 16px; color: #E0A100; }

.mm-podium { list-style: none; margin: 0; padding: 30px 4px 0; display: flex; align-items: flex-end; justify-content: center; gap: 10px; }
.mm-pod {
  flex: 1 1 0; min-width: 0; max-width: 150px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  animation: mm-rise .6s cubic-bezier(.3, 1.4, .5, 1) both;
}
.mm-pod--2 { animation-delay: .1s; }
.mm-pod--1 { animation-delay: .25s; }
.mm-pod--3 { animation-delay: .4s; }
.mm-pod__who { position: relative; margin-bottom: 4px; }
.mm-pod__crown { position: absolute; left: 50%; top: -27px; transform: translateX(-50%); color: #FFE66D; filter: drop-shadow(0 2px 2px rgba(120, 50, 0, .5)); }
.mm-pod__crown .ndj-ic { width: 32px; height: 32px; }
.mm-pod--1 .ndj-avatar { width: 66px; height: 66px; font-size: 1.7rem; box-shadow: 0 0 0 4px #fff, 0 12px 18px -8px rgba(120, 30, 5, .7), inset 0 -3px 0 rgba(0, 0, 0, .15); }
.mm-pod__name { max-width: 100%; padding: 1px 10px; border-radius: 999px; background: #fff; color: var(--mm-ink); font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 6px 10px -6px rgba(120, 30, 5, .6); }
.mm-pod__pairs { font-size: .85rem; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(160, 40, 10, .5); }
.mm-pod__block {
  display: flex; justify-content: center; width: 100%; margin-top: 4px; padding-top: 10px;
  border-radius: 16px 16px 8px 8px; color: rgba(43, 45, 66, .85);
  font: 700 1.9rem var(--font-display); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), inset 0 -5px 0 rgba(0, 0, 0, .08), 0 14px 18px -12px rgba(120, 30, 5, .7), 0 0 0 2px rgba(255, 255, 255, .5);
}
.mm-pod--1 .mm-pod__block { height: 118px; background: linear-gradient(180deg, #FFEFA8, #FFC93C); }
.mm-pod--2 .mm-pod__block { height: 86px; background: linear-gradient(180deg, #F2F5FC, #BAC6DD); }
.mm-pod--3 .mm-pod__block { height: 62px; background: linear-gradient(180deg, #FBDDBF, #E5A673); }

.mm-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .mm-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.mm-tile {
  display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; padding: 10px 8px;
  border-radius: 20px; background: var(--card); border: 1px solid var(--mm-edge); box-shadow: 0 16px 24px -16px rgba(120, 30, 5, .6), var(--mm-hi); text-align: center;
}
.mm-tile__num { font: 700 1.55rem/1.15 var(--font-display); }
.mm-tile__lbl { font-size: .75rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--fg-2); }
.mm-tile__sub { max-width: 100%; font-size: .85rem; font-weight: 700; color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mm-tile.is-hot { background: color-mix(in srgb, var(--mm-gold) 28%, var(--card)); border-color: color-mix(in srgb, var(--mm-gold) 80%, transparent); }
.mm-rank .ndj-section-title .ndj-count { font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; }
.mm-again .ndj-ic, .mm-end .btn-secondary .ndj-ic { width: 20px; height: 20px; }
@media (max-width: 420px) { .mm-end__bar .btn-secondary { padding-inline: 18px; } .mm-end__bar .btn-secondary .mm-btxt { display: none; } }
.mm-end .mm-actionbar { background: linear-gradient(0deg, #FF903F 62%, rgba(255, 144, 63, 0)); border-top: 0; -webkit-backdrop-filter: none; backdrop-filter: none; padding-top: 22px; }
.mm-end .mm-again { color: var(--mm-ink); background: #fff; box-shadow: 0 16px 26px -12px rgba(120, 30, 5, .75), inset 0 1px 0 #fff, inset 0 -3px 0 rgba(43, 45, 66, .08); text-shadow: none; }
.mm-end .mm-again .ndj-ic { color: var(--mm-coral); }
.mm-end .btn-secondary { background: rgba(255, 255, 255, .22); color: #fff; border: 2px solid rgba(255, 255, 255, .85); box-shadow: none; }
.mm-end .ndj-wait { color: #fff; font-weight: 800; text-shadow: 0 2px 3px rgba(160, 40, 10, .4); text-align: center; }
.mm-end .ndj-card { box-shadow: 0 20px 30px -20px rgba(120, 30, 5, .65), var(--mm-hi); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.mm-hero { background: radial-gradient(circle at 50% 0%, #3A3D5C 0%, #1F2137 72%); background-attachment: fixed; }
  :root:not([data-theme="light"]) .mm-end__title, :root:not([data-theme="light"]) .mm-end__quip { color: #FFE66D; text-shadow: 0 3px 5px rgba(0, 0, 0, .5); }
  :root:not([data-theme="light"]) .mm-pod__pairs { text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
  :root:not([data-theme="light"]) .mm-end .btn-secondary { background: transparent; }
  :root:not([data-theme="light"]) .mm-end .mm-actionbar { background: linear-gradient(0deg, #1F2137 62%, rgba(31, 33, 55, 0)); }
  :root:not([data-theme="light"]) .mm-end .mm-again { box-shadow: 0 16px 26px -14px rgba(0, 0, 0, .8), inset 0 1px 0 #fff, inset 0 -3px 0 rgba(43, 45, 66, .08); }
  :root:not([data-theme="light"]) .mm-end .ndj-wait { text-shadow: none; }
}
:root[data-theme="dark"] body.mm-hero { background: radial-gradient(circle at 50% 0%, #3A3D5C 0%, #1F2137 72%); background-attachment: fixed; }
:root[data-theme="dark"] .mm-end__title, :root[data-theme="dark"] .mm-end__quip { color: #FFE66D; text-shadow: 0 3px 5px rgba(0, 0, 0, .5); }
:root[data-theme="dark"] .mm-pod__pairs { text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
:root[data-theme="dark"] .mm-end .btn-secondary { background: transparent; }
:root[data-theme="dark"] .mm-end .mm-actionbar { background: linear-gradient(0deg, #1F2137 62%, rgba(31, 33, 55, 0)); }
:root[data-theme="dark"] .mm-end .ndj-wait { text-shadow: none; }

@media (min-width: 900px) {
  .mm-end { max-width: none; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 28px 32px; align-items: start; padding-top: 8px; }
  .mm-end__main { grid-column: 1; grid-row: 1 / span 2; }
  .mm-end__side { grid-column: 2; grid-row: 1; }
  .mm-end__bar { grid-column: 2; grid-row: 2; }
  .mm-end .mm-actionbar, :root:not([data-theme="light"]) .mm-end .mm-actionbar, :root[data-theme="dark"] .mm-end .mm-actionbar { position: static; padding: 0; margin: 0; background: none; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
.mm-fam { margin-top: 0; }

/* invite modal */
.mm-invite__box { position: relative; width: min(460px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 16px 18px 18px; }
.mm-invite__box .ndj-share { padding: 0; border: 0; box-shadow: none; background: none; }
.mm-invite__box .ndj-share__head { padding-right: 48px; }
.mm-invite__close { position: absolute; top: 12px; right: 12px; z-index: 1; }

/* help: the visual guide and the two helpers */
.mm-modal__box { width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 18px; }
.mm-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.mm-modal__head .ndj-modal__title { margin: 0; font-size: 1.5rem; }
.mm-modal__actions { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.mm-modal__sub { margin: 18px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); font: 600 .95rem var(--font-display); color: var(--fg-2); }
.mm-guide { display: flex; flex-direction: column; gap: 10px; }
.mm-guide__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.mm-guide__step { display: flex; align-items: center; gap: 14px; padding: 8px 12px 8px 10px; border-radius: 20px; background: var(--card-2); box-shadow: inset 0 0 0 1px var(--mm-edge); }
.mm-guide__ic {
  position: relative; flex: none; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 18px; color: #fff;
  background: var(--mm-hero); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 10px 14px -8px rgba(240, 80, 47, .7);
}
.mm-guide__ic .ndj-ic { width: 32px; height: 32px; }
.mm-guide__n {
  position: absolute; left: -6px; top: -6px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--mm-ink); color: #fff; font: 700 .95rem var(--font-display); box-shadow: 0 0 0 2px var(--card-2);
}
.mm-guide__txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mm-guide__txt strong { font: 700 1.15rem/1.15 var(--font-display); }
.mm-guide__txt span { font-size: .95rem; line-height: 1.3; color: var(--fg-2); }
.mm-guide__win { display: flex; align-items: center; gap: 10px; margin: 2px 0 0; padding: 12px 14px; border-radius: 18px; background: color-mix(in srgb, var(--mm-gold) 30%, var(--card)); font: 700 1.05rem/1.25 var(--font-display); }
.mm-guide__win .ndj-ic { width: 28px; height: 28px; flex: none; color: #B07A00; }
.mm-guide__ok { width: 100%; }
.mm-switch {
  -webkit-appearance: none; appearance: none; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 10px 14px;
  border-radius: 18px; border: 1px solid var(--mm-edge); background: var(--card-2); color: var(--fg); text-align: left; cursor: pointer; font: inherit;
}
.mm-switch + .mm-switch { margin-top: 8px; }
.mm-switch__txt { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.mm-switch__txt strong { font: 700 1.05rem/1.2 var(--font-display); }
.mm-switch__txt span { font-size: .88rem; line-height: 1.3; color: var(--fg-2); font-weight: 600; }
.mm-switch__knob { position: relative; flex: none; width: 54px; height: 32px; border-radius: 999px; background: #B9BCCF; box-shadow: inset 0 2px 4px rgba(43, 45, 66, .25); transition: background .2s; }
.mm-switch__knob::after { content: ""; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(43, 45, 66, .4); transition: transform .2s; }
.mm-switch.is-on .mm-switch__knob { background: var(--mm-hero); box-shadow: inset 0 2px 4px rgba(150, 40, 10, .3); }
.mm-switch.is-on .mm-switch__knob::after { transform: translateX(22px); }
.mm-switch:focus-visible, .mm-opt:focus-visible { outline: 3px solid var(--mm-coral); outline-offset: 2px; }

/* ------------------------------------------------------------ motion */
@keyframes mm-banner { 0% { transform: scale(.94); opacity: .55; } 100% { transform: none; opacity: 1; } }
@keyframes mm-glow {
  0%, 100% { box-shadow: var(--mm-glow); }
  50% { box-shadow: 0 16px 30px -10px rgba(240, 80, 47, .9), 0 0 0 5px rgba(255, 214, 102, .5), inset 0 1px 0 rgba(255, 255, 255, .45); }
}
@keyframes mm-pop { 0% { transform: scale(1); } 40% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes mm-ring { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.45); opacity: 0; } } /* transform + opacity only: no repaint per frame */
@keyframes mm-shake {
  0%, 100% { transform: translateX(0); }
  25%, 75% { transform: translateX(-3px) rotate(-1deg); }
  50% { transform: translateX(3px) rotate(1deg); }
}
@keyframes mm-rise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes mm-quip {
  0% { opacity: 0; transform: translateY(8px) scale(.85); }
  12% { opacity: 1; transform: scale(1.05); }
  20% { transform: scale(1); }
  82% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-6px); }
}
@keyframes mm-emoji { 0% { transform: scale(.2) rotate(-25deg); } 100% { transform: none; } }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mm-opt { border-color: rgba(255, 255, 255, .12); background: linear-gradient(180deg, var(--card-2), var(--card)); box-shadow: 0 6px 12px -10px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .06); }
  :root:not([data-theme="light"]) .mm-opt[aria-pressed="true"] { border-color: var(--mm-coral); background: linear-gradient(180deg, color-mix(in srgb, var(--coral) 18%, var(--card)), color-mix(in srgb, var(--coral) 30%, var(--card))); }
  :root:not([data-theme="light"]) .mm-actionbar { border-top-color: rgba(255, 255, 255, .08); }
  :root:not([data-theme="light"]) .mm-guide__n { background: #fff; color: var(--mm-ink); }
  :root:not([data-theme="light"]) .mm-guide__win { background: rgba(255, 230, 109, .12); box-shadow: inset 0 0 0 1px rgba(255, 230, 109, .4); }
  :root:not([data-theme="light"]) .mm-guide__win .ndj-ic { color: #FFE66D; }
}
:root[data-theme="dark"] .mm-opt { border-color: rgba(255, 255, 255, .12); background: linear-gradient(180deg, var(--card-2), var(--card)); box-shadow: 0 6px 12px -10px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .06); }
:root[data-theme="dark"] .mm-opt[aria-pressed="true"] { border-color: var(--mm-coral); background: linear-gradient(180deg, color-mix(in srgb, var(--coral) 18%, var(--card)), color-mix(in srgb, var(--coral) 30%, var(--card))); }
:root[data-theme="dark"] .mm-actionbar { border-top-color: rgba(255, 255, 255, .08); }
:root[data-theme="dark"] .mm-guide__n { background: #fff; color: var(--mm-ink); }
:root[data-theme="dark"] .mm-guide__win { background: rgba(255, 230, 109, .12); box-shadow: inset 0 0 0 1px rgba(255, 230, 109, .4); }
:root[data-theme="dark"] .mm-guide__win .ndj-ic { color: #FFE66D; }
@media (prefers-reduced-motion: reduce) {
  .mm-end__trophy, .mm-pod, .mm-turn, .mm-card.is-pop, .mm-card.is-wrong, .mm-quip.is-on, .mm-quip__e { animation: none !important; }
  .mm-card__inner { transition-duration: .01s; }
  .mm-card.is-pop::after { display: none; }
}
