/* Morbit Moon — page styles on top of arcade.css (Merpy tokens).
   The board itself is a canvas drawn by morbit.js; its colours are kept
   deliberately quiet: a dusk-blue sky and muted sticker tiles. */

:root { --mm-sky: #2f3a55; --mm-cell: #3a4766; --mm-cell2: #36425f; }
html[data-theme="dark"] { --mm-sky: #1f2638; --mm-cell: #2b3550; --mm-cell2: #28314a; }

/* ---------- map ---------- */
.mm-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; }
.mm-head .gicon { width: 58px; height: 58px; border-radius: 18px; }
.mm-head .gicon .ic { width: 44px; height: 44px; }
.mm-head-t h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.mm-head-t p { font-size: 14px; font-weight: 700; color: var(--muted); }

.mm-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.mm-stats .stat { font-size: 13.5px; }
.mm-stats .stat small { font-size: 12px; font-weight: 700; color: var(--muted); }
.mm-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 20px; }
.mm-tools .btn { position: relative; flex-direction: column; gap: 3px; padding: 9px 4px; white-space: normal; line-height: 1.2; text-align: center; font-size: 12.5px; }
.mm-tools .btn .ic { width: 26px; height: 26px; }
.mm-badge {
  position: absolute; top: -8px; right: -6px; min-width: 22px; height: 22px; padding: 0 6px; display: grid; place-items: center;
  background: var(--accent); color: #fff; border: 2px solid var(--edge); border-radius: 999px; font-size: 12px; font-weight: 800;
}
@media (max-width: 420px) { .mm-tools .btn { font-size: 11.5px; } }

.mm-levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.mm-lv {
  position: relative; aspect-ratio: 1; display: grid; place-items: center; align-content: center; gap: 2px;
  background: var(--surface); border: 2px solid var(--edge); border-radius: 16px; box-shadow: var(--hard-sm);
  font-weight: 800; font-size: 19px; color: var(--text); padding: 0;
  transition: transform 120ms var(--ease), box-shadow 120ms var(--ease);
}
.mm-lv:active { transform: translateY(3px); box-shadow: none; }
.mm-lv .st { font-size: 11px; letter-spacing: 1px; color: var(--line-strong); line-height: 1; }
.mm-lv .st b { color: var(--gold-dim); font-weight: 800; }
.mm-lv.done { background: var(--t5); }
.mm-lv.next { background: var(--accent); color: #fff; animation: mmPulse 1.6s ease-in-out infinite; }
.mm-lv.next .st { color: rgba(255,255,255,.6); }
.mm-lv.locked { background: var(--surface-soft); color: var(--muted); box-shadow: none; border-style: dashed; border-color: var(--line-strong); cursor: default; }
.mm-lv.locked .ic { width: 22px; height: 22px; opacity: .55; }
.mm-lv.soon { grid-column: span 2; aspect-ratio: auto; font-size: 13px; color: var(--muted); border-style: dashed; border-color: var(--line-strong); box-shadow: none; background: transparent; padding: 8px; cursor: default; }
@keyframes mmPulse { 50% { transform: translateY(-2px); box-shadow: 0 5px 0 var(--ink); } }
@media (prefers-reduced-motion: reduce) { .mm-lv.next { animation: none; } }

.mm-chal { display: flex; align-items: center; gap: 14px; }
.mm-chal .goalchips { flex: 1; }
.goalchips { display: flex; flex-wrap: wrap; gap: 6px; }
.gchip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 5px; font-size: 13.5px; font-weight: 800;
  background: var(--surface); border: 2px solid var(--edge); border-radius: 999px;
}
.gchip .ic { width: 24px; height: 24px; vertical-align: 0; }
.gchip.done { background: var(--good-soft); color: var(--good); }
.mm-best { font-size: 13px; font-weight: 800; color: var(--gold-dim); margin-top: 6px; }

/* ---------- play ---------- */
body.playing { height: 100dvh; min-height: 0; overflow: hidden; }
body.playing #vMap, body.playing #footer { display: none; }
.mm-play { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.mm-moves b { font-size: 18px !important; }
.mm-moves.low b { color: var(--bad); }
.mm-goalbar { width: 100%; max-width: 560px; margin: 0 auto; padding: 2px 16px 0; display: grid; gap: 8px; }
.mm-goals { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.mm-starbar {
  position: relative; height: 14px; border: 2px solid var(--edge); border-radius: 999px; background: var(--surface-soft); overflow: visible;
}
.mm-starbar i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 999px; background: var(--gold); transition: width 300ms var(--ease); }
.mm-starbar span {
  position: absolute; top: 50%; transform: translate(-50%, -50%); font-size: 18px; line-height: 1; color: var(--line-strong);
  text-shadow: 0 0 0 transparent; transition: color 200ms, transform 200ms;
}
.mm-starbar span.on { color: var(--gold-dim); transform: translate(-50%, -50%) scale(1.15); }
.mm-board { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 10px 12px; }
#board { display: block; touch-action: none; border: 3px solid var(--edge); border-radius: 18px; box-shadow: 0 6px 0 var(--ink); background: var(--mm-sky); box-sizing: content-box; }
.mm-flash {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.8); opacity: 0; pointer-events: none;
  background: var(--surface); border: 2px solid var(--edge); border-radius: 14px; box-shadow: var(--hard);
  padding: 8px 16px; font-weight: 800; font-size: 18px; transition: opacity 200ms, transform 200ms var(--ease);
}
.mm-flash.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.mm-boosters {
  flex-shrink: 0; display: flex; justify-content: center; gap: 12px;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 2px solid var(--edge);
}
.boost {
  position: relative; display: grid; justify-items: center; gap: 2px; min-width: 76px; padding: 7px 10px;
  background: var(--surface); border: 2px solid var(--edge); border-radius: 14px; box-shadow: var(--hard-sm);
  font-size: 12px; font-weight: 800; color: var(--text);
  transition: transform 120ms var(--ease), box-shadow 120ms var(--ease), background 120ms;
}
.boost .ic { width: 32px; height: 32px; }
.boost:active { transform: translateY(3px); box-shadow: none; }
.boost.on { background: var(--accent); color: #fff; }
.boost .q {
  position: absolute; top: -9px; right: -9px; min-width: 24px; height: 24px; padding: 0 6px; display: grid; place-items: center;
  background: var(--gold); color: var(--ink); border: 2px solid var(--edge); border-radius: 999px; font-size: 12px;
}
.boost .q.buy { background: var(--surface); }

/* ---------- modals ---------- */
.mm-card { width: min(100%, 440px); max-height: calc(100dvh - 32px); overflow-y: auto; text-align: center; }
.mm-card .gicon { width: 76px; height: 76px; border-radius: 22px; }
.mm-card .gicon .ic { width: 56px; height: 56px; }
.mm-card .row { display: flex; gap: 8px; width: 100%; flex-wrap: wrap; }
.mm-card .row .btn { flex: 1; }
.mm-card .x {
  position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; padding: 0; display: grid; place-items: center;
  background: var(--surface); border: 2px solid var(--edge); border-radius: 10px; font-size: 18px; font-weight: 900;
}
.mm-card { position: relative; }
.mm-bigstars { display: flex; justify-content: center; gap: 10px; font-size: 52px; line-height: 1; color: var(--line-strong); }
.mm-bigstars span { display: inline-block; }
.mm-bigstars span.on { color: var(--gold); -webkit-text-stroke: 2px var(--ink); animation: mmStar 520ms var(--ease) both; }
.mm-bigstars span:nth-child(2).on { animation-delay: 260ms; font-size: 64px; }
.mm-bigstars span:nth-child(3).on { animation-delay: 520ms; }
@keyframes mmStar { from { transform: scale(0) rotate(-40deg); } 70% { transform: scale(1.25); } }
.mm-thresh { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.mm-thresh .chip b { color: var(--gold-dim); }
.mm-coins { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--gold-dim); font-size: 17px; }
.mm-coins .ic { width: 24px; height: 24px; }
.mm-note { font-size: 13px; font-weight: 700; color: var(--muted); }
.mm-list { list-style: none; margin: 0; padding: 0; width: 100%; text-align: left; }
.mm-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.mm-list li + li { border-top: 1.5px dashed var(--line-strong); }
.mm-list .av { width: 40px; height: 40px; flex: none; border: 2px solid var(--edge); border-radius: 12px; background: var(--t4); display: grid; place-items: center; overflow: hidden; }
.mm-list .av img { width: 36px; height: 36px; }
.mm-list .who { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.mm-list .who b { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-list .who small { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.mm-list li.me { background: var(--accent-soft); margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: 12px; }
.mm-list .val { font-weight: 800; color: var(--gold-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mm-list .rk { width: 30px; flex: none; font-weight: 800; color: var(--muted); text-align: center; }
.mm-seg { width: 100%; }
.mm-seg2 { display: flex; gap: 6px; justify-content: center; }
.mm-seg2 button { border: 2px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 800; color: var(--muted); }
.mm-seg2 button[aria-pressed="true"] { border-color: var(--edge); background: var(--gold); color: var(--ink); }
.mm-shop { display: grid; gap: 10px; width: 100%; }
.mm-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 2px solid var(--edge); border-radius: 16px; background: var(--surface); text-align: left; }
.mm-item > .ic { width: 40px; height: 40px; }
.mm-item .who { flex: 1; display: grid; line-height: 1.3; }
.mm-item .who b { font-weight: 800; }
.mm-item .who small { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.mm-item .own { font-size: 12px; font-weight: 800; color: var(--muted); }
.mm-help { text-align: left; display: grid; gap: 10px; width: 100%; }
.mm-help li { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; font-weight: 600; line-height: 1.45; }
.mm-help li .ic { width: 30px; height: 30px; flex: none; }
.mm-help ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mm-help h3 { font-size: 15px; font-weight: 800; margin-top: 4px; }
.mm-sp { width: 30px; height: 30px; flex: none; border-radius: 9px; border: 2px solid var(--edge); background: var(--mm-sky); display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 15px; }
@media (max-width: 640px) { .mm-moves .lbl { display: inline !important; } }
