/* MAZEBOUND — visual system */
.mb-page {
  --mb-bg: #04070a;
  --mb-panel: rgba(8, 14, 18, 0.9);
  --mb-panel-strong: rgba(7, 12, 15, 0.97);
  --mb-line: rgba(226, 240, 235, 0.12);
  --mb-line-strong: rgba(226, 240, 235, 0.24);
  --mb-text: #eef7f3;
  --mb-muted: #94a8a1;
  --mb-gold: #fbbf24;
  --mb-gold-soft: #fde68a;
  --mb-danger: #fb7185;
  --mb-success: #6ee7b7;
  --mb-accent: #5eead4;
  --mb-accent-rgb: 94, 234, 212;
  --mb-accent-2: #fbbf24;
  --mb-accent-2-rgb: 251, 191, 36;
  --mb-display: "Cinzel", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --mb-ui: "Outfit", "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1000px 600px at 50% -10%, rgba(18, 90, 72, 0.24), transparent 65%),
    radial-gradient(800px 500px at 100% 100%, rgba(251, 191, 36, 0.05), transparent 65%),
    linear-gradient(180deg, #060b0d 0%, #030608 65%, #020405 100%);
  color: var(--mb-text);
  font-family: var(--mb-ui);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.mb-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 74%);
  z-index: 0;
}

.mb-page,
.mb-page * {
  box-sizing: border-box;
}

.mb-app {
  position: relative;
  z-index: 1;
  width: min(1440px, 100%);
  height: calc(100vh - var(--app-header-h, 72px));
  height: calc(100dvh - var(--app-header-h, 72px));
  min-height: 430px;
  margin: 0 auto;
  padding: 8px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mb-app[data-world="emerald"] {
  --mb-accent: #5eead4;
  --mb-accent-rgb: 94, 234, 212;
  --mb-accent-2: #fbbf24;
  --mb-accent-2-rgb: 251, 191, 36;
}

.mb-app[data-world="ruins"] {
  --mb-accent: #fbbf24;
  --mb-accent-rgb: 251, 191, 36;
  --mb-accent-2: #fb923c;
  --mb-accent-2-rgb: 251, 146, 60;
}

.mb-app[data-world="frost"] {
  --mb-accent: #a5f3fc;
  --mb-accent-rgb: 165, 243, 252;
  --mb-accent-2: #67e8f9;
  --mb-accent-2-rgb: 103, 232, 249;
}

.mb-app[data-world="shadow"] {
  --mb-accent: #c084fc;
  --mb-accent-rgb: 192, 132, 252;
  --mb-accent-2: #67e8f9;
  --mb-accent-2-rgb: 103, 232, 249;
}

.mb-app[data-world="infernal"] {
  --mb-accent: #fb923c;
  --mb-accent-rgb: 251, 146, 60;
  --mb-accent-2: #fde047;
  --mb-accent-2-rgb: 253, 224, 71;
}

/* ───────────────────────────── TOP BAR ───────────────────────────── */

.mb-bar {
  position: relative;
  z-index: 8;
  flex: 0 0 auto;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 10px;
  border: 1px solid var(--mb-line);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(20, 34, 36, 0.9), rgba(6, 11, 14, 0.94)),
    radial-gradient(360px 80px at 6% 50%, rgba(var(--mb-accent-rgb), 0.08), transparent 70%);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px);
}

.mb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  padding: 2px;
  background: transparent;
  color: var(--mb-text);
  cursor: pointer;
  text-align: left;
}

.mb-brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex: 0 0 auto;
  box-shadow: 0 0 24px rgba(var(--mb-accent-rgb), 0.22);
}

.mb-brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.mb-brand-copy strong {
  font-family: var(--mb-display);
  font-size: 0.95rem;
  letter-spacing: 0.16em;
  color: #f8fffb;
}

.mb-brand-copy small {
  margin-top: 4px;
  font-size: 0.52rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(var(--mb-accent-rgb), 0.8);
}

.mb-run-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 170px;
  padding-left: 12px;
  border-left: 1px solid var(--mb-line);
  line-height: 1.15;
}

.mb-kicker {
  margin: 0;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(var(--mb-accent-rgb), 0.78);
}

.mb-run-meta strong {
  font-family: var(--mb-display);
  font-size: 1rem;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: #f4fbf7;
}

.mb-hud {
  display: flex;
  align-items: stretch;
  gap: 7px;
  margin-left: auto;
}

.mb-chip {
  min-width: 62px;
  padding: 5px 9px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(21, 35, 38, 0.65), rgba(7, 12, 15, 0.8));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.mb-chip-label {
  font-size: 0.48rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--mb-muted);
  white-space: nowrap;
}

.mb-chip b {
  font-size: 0.94rem;
  font-variant-numeric: tabular-nums;
  color: #f8fffc;
  white-space: nowrap;
}

.mb-chip-shards b {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--mb-accent);
}

.mb-gem {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--mb-accent);
  transform: rotate(45deg);
  border-radius: 1.5px;
  box-shadow: 0 0 8px rgba(var(--mb-accent-rgb), 0.7);
}

.mb-chip-hearts b {
  display: flex;
  gap: 2px;
  color: var(--mb-danger);
  letter-spacing: 1px;
}

.mb-heart {
  display: inline-block;
  font-size: 0.9rem;
  line-height: 1;
  color: var(--mb-danger);
  text-shadow: 0 0 8px rgba(251, 113, 133, 0.55);
}

.mb-heart.empty {
  color: rgba(148, 163, 184, 0.25);
  text-shadow: none;
}

.mb-tools {
  display: flex;
  align-items: stretch;
  gap: 5px;
}

.mb-tool {
  min-width: 46px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(19, 32, 35, 0.7), rgba(7, 12, 15, 0.9));
  color: #d4e6df;
  font-family: var(--mb-ui);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease, color 0.16s ease;
}

.mb-tool:hover:not(:disabled) {
  border-color: rgba(var(--mb-accent-rgb), 0.5);
  color: #fff;
  transform: translateY(-1px);
}

.mb-tool:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.mb-tool-icon {
  font-size: 1rem;
  line-height: 1;
  color: var(--mb-accent);
  font-weight: 800;
}

.mb-tool-label {
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  color: var(--mb-muted);
  text-transform: uppercase;
}

.mb-tool-hint {
  border-color: rgba(var(--mb-accent-2-rgb), 0.28);
  position: relative;
}

.mb-tool-hint[data-count]::after {
  content: attr(data-count);
  display: none;
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--mb-gold);
  color: #241a04;
  font-size: 0.55rem;
  font-weight: 800;
  line-height: 15px;
  text-align: center;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.45);
}

@media (max-width: 1180px) {
  .mb-tool-hint[data-count]::after {
    display: block;
  }
}

.mb-tool-hint .mb-tool-icon {
  color: var(--mb-gold);
}

.mb-icon-map::before {
  content: "▦";
}

.mb-icon-sound::before {
  content: "♪";
}

.mb-icon-pause::before {
  content: "Ⅱ";
}

.mb-tool.is-muted .mb-icon-sound {
  opacity: 0.4;
}

/* Show run UI only while a level is in progress or paused. */
.mb-app[data-screen="title"] .mb-run-meta,
.mb-app[data-screen="title"] .mb-hud,
.mb-app[data-screen="title"] .mb-tools,
.mb-app[data-screen="worlds"] .mb-run-meta,
.mb-app[data-screen="worlds"] .mb-hud,
.mb-app[data-screen="worlds"] .mb-tools,
.mb-app[data-screen="levels"] .mb-run-meta,
.mb-app[data-screen="levels"] .mb-hud,
.mb-app[data-screen="levels"] .mb-tools,
.mb-app[data-screen="intro"] .mb-run-meta,
.mb-app[data-screen="intro"] .mb-hud,
.mb-app[data-screen="intro"] .mb-tools,
.mb-app[data-screen="howto"] .mb-run-meta,
.mb-app[data-screen="howto"] .mb-hud,
.mb-app[data-screen="howto"] .mb-tools,
.mb-app[data-screen="settings"] .mb-run-meta,
.mb-app[data-screen="settings"] .mb-hud,
.mb-app[data-screen="settings"] .mb-tools,
.mb-app[data-screen="loading"] .mb-run-meta,
.mb-app[data-screen="loading"] .mb-hud,
.mb-app[data-screen="loading"] .mb-tools {
  display: none;
}

.mb-app[data-screen="pause"] .mb-tools,
.mb-app[data-screen="complete"] .mb-tools,
.mb-app[data-screen="fail"] .mb-tools {
  display: none;
}

/* ───────────────────────────── STAGE ───────────────────────────── */

.mb-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(var(--mb-accent-rgb), 0.25);
  background: #030608;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.65),
    0 26px 70px rgba(0, 0, 0, 0.5),
    0 0 70px rgba(var(--mb-accent-rgb), 0.08),
    inset 0 0 80px rgba(0, 0, 0, 0.6);
  isolation: isolate;
}

.mb-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(var(--mb-accent-rgb), 0.55), transparent 12%, transparent 88%, rgba(var(--mb-accent-rgb), 0.55)) top / 100% 1px no-repeat,
    radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.45) 100%);
  opacity: 0.6;
}

.mb-stage-frame {
  position: absolute;
  inset: 8px;
  z-index: 2;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 16px;
}

#gameCanvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  z-index: 1;
}

.mb-toast {
  position: absolute;
  left: 50%;
  top: 18px;
  z-index: 30;
  transform: translate(-50%, -8px);
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(var(--mb-accent-rgb), 0.35);
  background: rgba(4, 12, 12, 0.9);
  color: #e9fff7;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  max-width: min(520px, 84%);
  text-align: center;
}

.mb-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.mb-toast[data-tone="locked"] {
  border-color: rgba(251, 113, 133, 0.45);
  color: #fecdd3;
}

.mb-toast[data-tone="collect"] {
  border-color: rgba(var(--mb-accent-2-rgb), 0.5);
  color: #fef3c7;
}

.mb-toast[data-tone="win"] {
  border-color: rgba(110, 231, 183, 0.55);
  color: #d1fae5;
}

.mb-map-note {
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: 30;
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(3, 8, 10, 0.88);
  border: 1px solid var(--mb-line);
  color: var(--mb-muted);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.mb-map-note b {
  color: var(--mb-accent);
}

/* ───────────────────────────── TOUCH PAD ───────────────────────────── */

.mb-touch {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  width: 156px;
  height: 156px;
  display: none;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  touch-action: none;
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.4));
}

.mb-app[data-screen="play"] .mb-touch {
  display: grid;
}

.mb-app[data-controls="swipe"] .mb-touch,
.mb-app[data-controls="keyboard"] .mb-touch {
  display: none !important;
}

.mb-app.mb-map-open .mb-touch {
  display: none !important;
}

@media (hover: hover) and (pointer: fine) {
  .mb-app[data-controls="auto"] .mb-touch {
    display: none;
  }
}

.mb-dir {
  border: 1px solid rgba(var(--mb-accent-rgb), 0.28);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(20, 36, 38, 0.82), rgba(4, 9, 11, 0.9)),
    radial-gradient(60px 40px at 50% 20%, rgba(var(--mb-accent-rgb), 0.1), transparent);
  color: #d9f8ee;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: transform 0.08s ease, background 0.08s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 7px 0 rgba(0, 0, 0, 0.35);
}

.mb-dir:active,
.mb-dir.is-held {
  transform: translateY(3px);
  background: linear-gradient(180deg, rgba(var(--mb-accent-rgb), 0.25), rgba(4, 9, 11, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 0 rgba(0, 0, 0, 0.35);
}

.mb-dir-up { grid-column: 2; grid-row: 1; }
.mb-dir-left { grid-column: 1; grid-row: 2; }
.mb-dir-down { grid-column: 2; grid-row: 3; }
.mb-dir-right { grid-column: 3; grid-row: 2; }

.mb-dir-core {
  grid-column: 2;
  grid-row: 2;
  border-radius: 50%;
  border: 1px solid rgba(var(--mb-accent-rgb), 0.25);
  background: radial-gradient(circle, rgba(var(--mb-accent-rgb), 0.16), rgba(3, 8, 10, 0.7));
  box-shadow: inset 0 0 14px rgba(var(--mb-accent-rgb), 0.18);
  pointer-events: none;
}

/* ───────────────────────────── FOOTER ───────────────────────────── */

.mb-footer {
  flex: 0 0 auto;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 6px;
  color: var(--mb-muted);
  font-size: 0.72rem;
}

.mb-app:not([data-screen="play"]) .mb-footer {
  display: none;
}

.mb-objective {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mb-objective-icon {
  color: var(--mb-accent);
  font-size: 0.85rem;
  text-shadow: 0 0 10px rgba(var(--mb-accent-rgb), 0.5);
}

.mb-objective #objectiveText {
  color: #c9dad4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mb-control-hint {
  flex: 0 0 auto;
  letter-spacing: 0.03em;
  opacity: 0.7;
  white-space: nowrap;
}

/* ───────────────────────────── SCREENS ───────────────────────────── */

.mb-screens {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
}

.mb-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 2.4vw, 28px);
  overflow: auto;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
  overscroll-behavior: contain;
}

.mb-screen.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mb-screen[data-screen-name="title"],
.mb-screen[data-screen-name="worlds"],
.mb-screen[data-screen-name="levels"],
.mb-screen[data-screen-name="intro"],
.mb-screen[data-screen-name="howto"],
.mb-screen[data-screen-name="settings"] {
  background:
    linear-gradient(180deg, rgba(3, 8, 9, 0.7), rgba(2, 5, 6, 0.88)),
    radial-gradient(800px 400px at 50% 0%, rgba(var(--mb-accent-rgb), 0.08), transparent 70%);
  backdrop-filter: blur(3px);
}

.mb-screen[data-screen-name="pause"],
.mb-screen[data-screen-name="complete"],
.mb-screen[data-screen-name="fail"],
.mb-screen[data-screen-name="achievement"] {
  background: rgba(2, 5, 7, 0.68);
  backdrop-filter: blur(7px);
}

.mb-screen::-webkit-scrollbar {
  width: 8px;
}

.mb-screen::-webkit-scrollbar-thumb {
  background: rgba(var(--mb-accent-rgb), 0.3);
  border-radius: 8px;
}

.mb-screen::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Loading */
.mb-loading {
  flex-direction: column;
  gap: 14px;
  background: #030708;
  color: var(--mb-muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.7rem;
}

.mb-loading-mark {
  animation: mbBreath 2.4s ease-in-out infinite;
  filter: drop-shadow(0 0 24px rgba(94, 234, 212, 0.35));
}

@keyframes mbBreath {
  0%, 100% { transform: scale(0.97); opacity: 0.8; }
  50% { transform: scale(1.03); opacity: 1; }
}

/* Title */
.mb-screen-title {
  align-items: center;
}

.mb-title-layout {
  width: min(1060px, 100%);
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(320px, 1.15fr);
  align-items: center;
  gap: clamp(18px, 4vw, 58px);
  padding: clamp(10px, 3vw, 34px);
}

.mb-title-mark {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

.mb-title-icon {
  position: relative;
  z-index: 2;
  width: min(290px, 74%);
  height: auto;
  border-radius: 28px;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 32px rgba(var(--mb-accent-rgb), 0.18));
  animation: mbFloat 6s ease-in-out infinite;
}

@keyframes mbFloat {
  0%, 100% { transform: translateY(-5px) rotate(-0.4deg); }
  50% { transform: translateY(5px) rotate(0.4deg); }
}

.mb-title-orbit {
  position: absolute;
  inset: 10%;
  border: 1px solid rgba(var(--mb-accent-rgb), 0.18);
  border-radius: 50%;
  transform: rotate(-18deg);
}

.mb-title-orbit::before,
.mb-title-orbit::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(var(--mb-accent-2-rgb), 0.14);
  border-radius: 50%;
}

.mb-title-orbit::before { inset: -11%; }
.mb-title-orbit::after { inset: 9%; }

.mb-title-orbit i {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--mb-accent);
  box-shadow: 0 0 12px var(--mb-accent);
  animation: mbOrbit 11s linear infinite;
}

.mb-title-orbit i:nth-child(1) { top: 0; left: 42%; }
.mb-title-orbit i:nth-child(2) { bottom: 6%; right: 9%; animation-delay: -4s; background: var(--mb-gold); box-shadow: 0 0 12px var(--mb-gold); }
.mb-title-orbit i:nth-child(3) { top: 38%; left: -2%; animation-delay: -8s; width: 3px; height: 3px; }

@keyframes mbOrbit {
  from { transform: rotate(0deg) translateX(0); }
  to { transform: rotate(360deg); }
}

.mb-title-copy {
  padding: 8px 0;
}

.mb-eyebrow {
  margin: 0 0 10px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: rgba(var(--mb-accent-rgb), 0.85);
}

.mb-title-copy h1 {
  margin: 0;
  font-family: var(--mb-display);
  font-size: clamp(2.7rem, 6.4vw, 5rem);
  line-height: 0.92;
  letter-spacing: 0.04em;
  font-weight: 800;
  color: #f5fff9;
  text-shadow: 0 0 40px rgba(var(--mb-accent-rgb), 0.16), 0 4px 30px rgba(0, 0, 0, 0.5);
}

.mb-title-copy h1 small {
  display: block;
  margin-top: 10px;
  font-family: var(--mb-ui);
  font-size: clamp(0.68rem, 1.6vw, 0.88rem);
  font-weight: 500;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--mb-gold-soft);
}

.mb-lede {
  margin: 18px 0 20px;
  max-width: 560px;
  color: #aec1ba;
  font-size: 0.92rem;
  line-height: 1.65;
}

.mb-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  max-width: 560px;
}

.mb-actions-minor {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 9px;
}

.mb-btn {
  position: relative;
  min-height: 54px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(22, 38, 40, 0.86), rgba(7, 13, 16, 0.94));
  color: var(--mb-text);
  font-family: var(--mb-ui);
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 10px 24px rgba(0, 0, 0, 0.24);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
}

.mb-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 20%, rgba(255, 255, 255, 0.08) 42%, transparent 62%);
  transform: translateX(-130%);
  transition: transform 0.6s ease;
}

.mb-btn:hover::after {
  transform: translateX(130%);
}

.mb-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--mb-accent-rgb), 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 16px 30px rgba(0, 0, 0, 0.32);
}

.mb-btn span {
  display: block;
  font-family: var(--mb-display);
  font-weight: 700;
  letter-spacing: 0.05em;
  font-size: 1rem;
}

.mb-btn small {
  display: block;
  margin-top: 2px;
  color: var(--mb-muted);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
}

.mb-btn-primary {
  border-color: rgba(var(--mb-accent-rgb), 0.45);
  background:
    linear-gradient(135deg, rgba(var(--mb-accent-rgb), 0.24), rgba(7, 13, 16, 0.94) 60%),
    linear-gradient(180deg, rgba(22, 38, 40, 0.86), rgba(7, 13, 16, 0.94));
  box-shadow: 0 0 0 1px rgba(var(--mb-accent-rgb), 0.1), 0 12px 34px rgba(var(--mb-accent-rgb), 0.14);
}

.mb-btn-primary span {
  color: #f2fffa;
}

.mb-btn-primary small {
  color: rgba(var(--mb-accent-rgb), 0.9);
}

.mb-btn-quiet {
  min-height: 48px;
  background: rgba(9, 16, 18, 0.65);
}

.mb-btn-quiet span {
  font-family: var(--mb-ui);
  font-size: 0.84rem;
  letter-spacing: 0.02em;
}

.mb-btn-quiet small {
  font-size: 0.6rem;
}

.mb-title-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 18px;
  padding-top: 13px;
  border-top: 1px solid var(--mb-line);
  color: var(--mb-muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mb-title-meta b {
  color: var(--mb-gold-soft);
  font-size: 0.8rem;
  margin-right: 3px;
}

/* Panel screens */
.mb-panel-screen {
  align-items: flex-start;
  justify-content: center;
  padding-top: clamp(10px, 2vw, 22px);
}

.mb-panel {
  width: min(1120px, 100%);
  margin: auto;
  padding: clamp(16px, 2.4vw, 26px);
  border: 1px solid var(--mb-line);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(13, 24, 27, 0.94), rgba(5, 10, 12, 0.97));
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.mb-panel-reading {
  width: min(960px, 100%);
}

.mb-panel-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--mb-line);
}

.mb-panel-heading {
  flex: 1 1 auto;
  min-width: 0;
}

.mb-panel-heading h2 {
  margin: 1px 0 0;
  font-family: var(--mb-display);
  font-size: clamp(1.35rem, 2.8vw, 2rem);
  letter-spacing: 0.04em;
  color: #f4fffa;
}

.mb-back {
  border: 1px solid var(--mb-line);
  border-radius: 10px;
  background: rgba(9, 17, 19, 0.8);
  color: #bcd1c9;
  font-family: var(--mb-ui);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 9px 12px;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
  min-height: 38px;
}

.mb-back:hover {
  border-color: rgba(var(--mb-accent-rgb), 0.45);
  color: #fff;
  transform: translateY(-1px);
}

.mb-panel-stats {
  display: flex;
  gap: 14px;
  align-items: center;
  color: var(--mb-muted);
  font-size: 0.7rem;
  text-align: right;
  white-space: nowrap;
}

.mb-panel-stats b {
  display: block;
  font-size: 1rem;
  color: var(--mb-gold-soft);
  font-variant-numeric: tabular-nums;
}

.mb-panel-lede {
  max-width: 720px;
  margin: 16px 0 20px;
  color: #a5b8b1;
  font-size: 0.85rem;
  line-height: 1.6;
}

/* World cards */
.mb-world-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.mb-world-card {
  position: relative;
  min-height: 238px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 15px;
  background:
    radial-gradient(150px 120px at 20% 0%, rgba(var(--w-accent-rgb, 94, 234, 212), 0.16), transparent 70%),
    linear-gradient(180deg, rgba(17, 30, 32, 0.84), rgba(5, 10, 12, 0.96));
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  color: var(--mb-text);
  text-align: left;
}

.mb-world-card:hover:not(.is-locked) {
  transform: translateY(-3px);
  border-color: rgba(var(--w-accent-rgb, 94, 234, 212), 0.55);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.3), 0 0 26px rgba(var(--w-accent-rgb, 94, 234, 212), 0.1);
}

.mb-world-card.is-locked {
  cursor: not-allowed;
  opacity: 0.58;
  filter: saturate(0.5);
}

.mb-world-card.is-locked:hover {
  transform: none;
}

.mb-world-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 40%, rgba(255, 255, 255, 0.045) 50%, transparent 60%);
  transform: translateX(-120%);
  transition: transform 0.7s ease;
  pointer-events: none;
}

.mb-world-card:hover:not(.is-locked)::after {
  transform: translateX(120%);
}

.mb-world-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.mb-world-sigil {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(var(--w-accent-rgb), 0.32);
  background: rgba(var(--w-accent-rgb), 0.08);
  color: rgb(var(--w-accent-rgb));
  flex: 0 0 auto;
}

.mb-world-sigil svg {
  width: 27px;
  height: 27px;
}

.mb-world-state {
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  padding: 4px 7px;
  border: 1px solid var(--mb-line);
  border-radius: 999px;
  white-space: nowrap;
}

.mb-world-card.is-restored .mb-world-state {
  color: var(--mb-success);
  border-color: rgba(110, 231, 183, 0.3);
}

.mb-world-card.is-locked .mb-world-state {
  color: #8b9a95;
}

.mb-world-card h3 {
  margin: 2px 0 0;
  font-family: var(--mb-display);
  font-size: 1.04rem;
  letter-spacing: 0.02em;
  color: #f4fbf8;
}

.mb-world-card .mb-world-sub {
  margin: 0;
  font-size: 0.68rem;
  color: rgba(var(--w-accent-rgb), 0.85);
  letter-spacing: 0.04em;
}

.mb-world-card .mb-world-blurb {
  margin: 2px 0 4px;
  font-size: 0.68rem;
  line-height: 1.45;
  color: #9eb2ab;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mb-world-card-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mb-world-progress-line {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  color: var(--mb-muted);
  font-size: 0.58rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mb-world-bar {
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.mb-world-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(var(--w-accent-rgb), 0.65), rgba(var(--w-accent-rgb), 1));
  box-shadow: 0 0 10px rgba(var(--w-accent-rgb), 0.5);
}

.mb-world-lock {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #9aa9a3;
  font-size: 0.59rem;
  line-height: 1.4;
}

.mb-world-lock b {
  color: #d4e2dc;
  font-weight: 600;
}

/* Trail panel */
.mb-trail-panel {
  margin-top: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--mb-line);
  border-radius: 14px;
  background: rgba(9, 17, 19, 0.6);
}

.mb-trail-panel h3 {
  margin: 2px 0 3px;
  font-family: var(--mb-display);
  font-size: 0.96rem;
}

.mb-trail-panel p:not(.mb-kicker) {
  margin: 0;
  color: var(--mb-muted);
  font-size: 0.72rem;
}

.mb-profile-panel {
  margin-top: 10px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(160px, 0.6fr) 1.6fr;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--mb-line);
  border-radius: 14px;
  background:
    radial-gradient(260px 120px at 100% 0%, rgba(var(--mb-accent-rgb), 0.06), transparent 70%),
    rgba(6, 13, 15, 0.6);
}

.mb-profile-panel h3 {
  margin: 2px 0 0;
  font-family: var(--mb-display);
  font-size: 0.92rem;
  color: #eaf8f1;
}

.mb-profile-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

/* Level banner + grid */
.mb-world-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  margin: 16px 0 12px;
  border: 1px solid rgba(var(--mb-accent-rgb), 0.18);
  border-radius: 15px;
  background:
    radial-gradient(260px 130px at 0% 50%, rgba(var(--mb-accent-rgb), 0.12), transparent 72%),
    linear-gradient(90deg, rgba(12, 25, 26, 0.8), rgba(6, 12, 14, 0.8));
}

.mb-world-glyph {
  width: 62px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  border: 1px solid rgba(var(--mb-accent-rgb), 0.24);
  background: rgba(var(--mb-accent-rgb), 0.08);
  color: var(--mb-accent);
}

.mb-world-glyph svg {
  width: 34px;
  height: 34px;
}

.mb-world-tagline {
  margin: 0 0 4px;
  font-family: var(--mb-display);
  font-size: 0.9rem;
  color: #f2faf6;
}

.mb-world-story {
  margin: 0;
  max-width: 650px;
  color: #9eb1aa;
  font-size: 0.73rem;
  line-height: 1.55;
}

.mb-world-fragment {
  margin: 7px 0 0;
  color: var(--mb-gold-soft);
  font-size: 0.63rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mb-world-progress {
  min-width: 112px;
  text-align: right;
  color: var(--mb-muted);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.5;
}

.mb-world-progress b {
  display: block;
  font-size: 1.25rem;
  color: var(--mb-accent);
  font-family: var(--mb-display);
}

.mb-level-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 10px;
  color: var(--mb-muted);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mb-level-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.mb-level-legend i {
  width: 7px;
  height: 7px;
  display: inline-block;
}

.mb-legend-star {
  background: var(--mb-gold);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 94%, 50% 72%, 21% 94%, 32% 57%, 2% 35%, 39% 35%);
}

.mb-legend-shard {
  background: var(--mb-accent);
  transform: rotate(45deg);
}

.mb-legend-relic {
  background: #fde68a;
  border-radius: 50%;
}

.mb-legend-trial {
  border: 1px solid var(--mb-accent);
  border-radius: 2px;
}

.mb-level-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding-bottom: 4px;
}

.mb-level-card {
  position: relative;
  min-height: 94px;
  padding: 10px 11px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(18, 32, 33, 0.74), rgba(6, 11, 13, 0.92));
  color: var(--mb-text);
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}

.mb-level-card:hover:not(.is-locked) {
  transform: translateY(-2px);
  border-color: rgba(var(--mb-accent-rgb), 0.45);
  box-shadow: 0 9px 20px rgba(0, 0, 0, 0.26);
}

.mb-level-card.is-locked {
  opacity: 0.44;
  cursor: not-allowed;
}

.mb-level-card.is-complete {
  border-color: rgba(110, 231, 183, 0.18);
}

.mb-level-card.is-current {
  border-color: rgba(var(--mb-accent-2-rgb), 0.5);
  box-shadow: 0 0 0 1px rgba(var(--mb-accent-2-rgb), 0.16), 0 0 22px rgba(var(--mb-accent-2-rgb), 0.09);
}

.mb-level-card.is-final {
  background:
    radial-gradient(100px 80px at 90% 0%, rgba(251, 113, 133, 0.14), transparent 70%),
    linear-gradient(180deg, rgba(22, 30, 34, 0.85), rgba(7, 11, 13, 0.94));
}

.mb-level-num {
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.35);
}

.mb-level-card.is-current .mb-level-num {
  color: var(--mb-gold);
}

.mb-level-name {
  display: block;
  margin-top: 3px;
  font-family: var(--mb-display);
  font-size: 0.8rem;
  line-height: 1.18;
  letter-spacing: 0.01em;
  color: #e8f5ef;
  min-height: 30px;
}

.mb-level-stars {
  display: flex;
  gap: 2px;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.14);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
}

.mb-level-stars .on {
  color: var(--mb-gold);
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

.mb-level-tags {
  display: flex;
  gap: 5px;
  margin-top: 6px;
  min-height: 12px;
}

.mb-level-tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.48rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--mb-muted);
  text-transform: uppercase;
}

.mb-level-tag.relic {
  color: var(--mb-gold-soft);
}

.mb-level-tag.trial {
  color: var(--mb-accent);
}

.mb-level-lock {
  position: absolute;
  right: 9px;
  top: 9px;
  display: flex;
  color: #87948f;
}

.mb-level-lock svg {
  width: 12px;
  height: 12px;
}

/* World map / level panel responsive */
@media (max-width: 980px) {
  .mb-world-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .mb-title-layout {
    grid-template-columns: minmax(180px, 0.7fr) minmax(300px, 1fr);
    gap: 24px;
  }
}

@media (max-width: 760px) {
  .mb-world-grid,
  .mb-level-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mb-world-grid {
    gap: 8px;
  }
  .mb-world-card {
    min-height: 192px;
    padding: 12px;
  }
  .mb-world-card .mb-world-blurb {
    display: none;
  }
  .mb-world-banner {
    grid-template-columns: auto 1fr;
  }
  .mb-world-progress {
    display: none;
  }
  .mb-panel-stats {
    display: none;
  }
  .mb-panel-head {
    gap: 10px;
  }
}

/* ───────────────────────────── MODALS ───────────────────────────── */

.mb-modal-screen {
  align-items: center;
}

.mb-modal {
  width: min(620px, 100%);
  margin: auto;
  padding: clamp(20px, 4vw, 34px);
  border: 1px solid rgba(var(--mb-accent-rgb), 0.24);
  border-radius: 20px;
  background:
    radial-gradient(300px 160px at 15% 0%, rgba(var(--mb-accent-rgb), 0.12), transparent 70%),
    linear-gradient(180deg, rgba(14, 26, 28, 0.98), rgba(4, 9, 11, 0.99));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: mbModalIn 0.24s ease both;
}

@keyframes mbModalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.mb-modal h2 {
  margin: 4px 0 10px;
  font-family: var(--mb-display);
  font-size: clamp(1.65rem, 4vw, 2.3rem);
  letter-spacing: 0.03em;
  color: #f6fffb;
  line-height: 1.05;
}

.mb-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: flex-end;
  margin-top: 16px;
  align-items: center;
}

.mb-modal-actions .mb-btn {
  min-height: 46px;
}

.mb-modal-actions-stack {
  flex-direction: column;
  align-items: stretch;
}

.mb-modal-actions-stack .mb-back {
  margin-top: 4px;
}

/* Intro */
.mb-intro {
  width: min(680px, 100%);
  padding: clamp(18px, 3vw, 26px);
  max-height: calc(100% - 12px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.mb-intro::-webkit-scrollbar,
.mb-complete::-webkit-scrollbar {
  width: 7px;
}

.mb-intro::-webkit-scrollbar-thumb,
.mb-complete::-webkit-scrollbar-thumb {
  background: rgba(var(--mb-accent-rgb), 0.28);
  border-radius: 8px;
}

.mb-intro .mb-modal-actions,
.mb-complete .mb-modal-actions {
  position: sticky;
  bottom: -1px;
  margin-top: 12px;
  padding-top: 10px;
  background: linear-gradient(180deg, rgba(5, 10, 12, 0), rgba(5, 10, 12, 0.97) 34%);
}

.mb-intro-story {
  margin: 0 0 12px;
  color: #a9bbb4;
  font-size: 0.82rem;
  line-height: 1.55;
  font-style: italic;
}

.mb-lesson {
  display: flex;
  gap: 11px;
  padding: 10px 11px;
  margin: 0 0 12px;
  border: 1px solid rgba(var(--mb-accent-2-rgb), 0.24);
  border-radius: 13px;
  background:
    radial-gradient(150px 100px at 0% 0%, rgba(var(--mb-accent-2-rgb), 0.12), transparent 70%),
    rgba(12, 22, 24, 0.7);
}

.mb-lesson-icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  border: 1px solid rgba(var(--mb-accent-2-rgb), 0.28);
  background: rgba(var(--mb-accent-2-rgb), 0.08);
  color: var(--mb-gold);
}

.mb-lesson-icon svg {
  width: 25px;
  height: 25px;
}

.mb-lesson-label {
  margin: 0;
  color: var(--mb-gold);
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.mb-lesson h3 {
  margin: 2px 0 4px;
  font-family: var(--mb-display);
  font-size: 0.98rem;
  color: #f8fffb;
}

.mb-lesson p:last-child {
  margin: 0;
  color: #a5b7b0;
  font-size: 0.74rem;
  line-height: 1.5;
}

.mb-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 7px;
  padding: 4px;
  border: 1px solid var(--mb-line);
  border-radius: 11px;
  background: rgba(4, 9, 11, 0.6);
}

.mb-mode-tabs button {
  flex: 1 1 120px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--mb-muted);
  font-family: var(--mb-ui);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.mb-mode-tabs button.is-active {
  background: rgba(var(--mb-accent-rgb), 0.12);
  border-color: rgba(var(--mb-accent-rgb), 0.3);
  color: #eafff8;
}

.mb-mode-tabs button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.mb-mode-note {
  margin: 0 0 14px;
  min-height: 16px;
  color: var(--mb-muted);
  font-size: 0.68rem;
}

.mb-intro-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.mb-intro-stat {
  padding: 7px 9px;
  border: 1px solid var(--mb-line);
  border-radius: 9px;
  background: rgba(6, 13, 15, 0.65);
}

.mb-intro-stat span {
  display: block;
  color: var(--mb-muted);
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mb-intro-stat b {
  display: block;
  margin-top: 2px;
  font-size: 0.92rem;
  color: #eafcf4;
  font-variant-numeric: tabular-nums;
}

.mb-criteria-line {
  margin: 0 0 14px;
  color: var(--mb-muted);
  font-size: 0.67rem;
  letter-spacing: 0.01em;
  line-height: 1.5;
}

.mb-criteria-line::first-letter {
  color: var(--mb-gold);
}

/* Pause / fail / complete */
.mb-pause-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin: 14px 0 6px;
}

.mb-pause-summary .mb-intro-stat b {
  font-size: 0.9rem;
}

.mb-fail-copy {
  color: #a9bbb4;
  font-size: 0.86rem;
  line-height: 1.6;
  margin: 0;
}

.mb-complete {
  width: min(680px, 100%);
  max-height: calc(100% - 12px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.mb-complete-message {
  color: #a9bbb4;
  font-size: 0.82rem;
  line-height: 1.55;
  margin: 4px 0 16px;
}

.mb-stars {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 12px 0 8px;
  min-height: 52px;
}

.mb-star {
  width: 48px;
  height: 48px;
  color: rgba(255, 255, 255, 0.12);
  transform: scale(0.82);
  transition: transform 0.25s ease, color 0.25s ease;
}

.mb-star.is-on {
  color: var(--mb-gold);
  filter: drop-shadow(0 0 12px rgba(251, 191, 36, 0.5));
  transform: scale(1);
  animation: mbStarPop 0.38s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

@keyframes mbStarPop {
  from { transform: scale(0.4) rotate(-12deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

.mb-star.is-on:nth-child(2) { transition-delay: 0.12s; }
.mb-star.is-on:nth-child(3) { transition-delay: 0.24s; }

.mb-complete-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin: 12px 0;
}

.mb-score-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 16px;
  padding: 12px 14px;
  border: 1px solid var(--mb-line);
  border-radius: 11px;
  background: rgba(4, 9, 11, 0.55);
  color: var(--mb-muted);
  font-size: 0.68rem;
}

.mb-score-breakdown b {
  color: var(--mb-gold-soft);
  font-weight: 700;
}

.mb-new-best {
  margin: 12px 0 0;
  padding: 7px 10px;
  border: 1px solid rgba(var(--mb-accent-2-rgb), 0.35);
  border-radius: 8px;
  background: rgba(var(--mb-accent-2-rgb), 0.08);
  color: var(--mb-gold);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-align: center;
  text-transform: uppercase;
}

.mb-achievement-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.mb-achievement {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid rgba(110, 231, 183, 0.25);
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.08);
  color: #d1fae5;
  font-size: 0.62rem;
  font-weight: 600;
}

.mb-achievement::before {
  content: "★";
  color: var(--mb-gold);
}

/* Achievement pop-up */
.mb-ach-toast {
  width: min(560px, 100%);
  margin: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 16px;
  background:
    radial-gradient(240px 120px at 10% 0%, rgba(251, 191, 36, 0.16), transparent 70%),
    linear-gradient(180deg, rgba(21, 32, 30, 0.98), rgba(5, 10, 12, 0.99));
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
  animation: mbModalIn 0.24s ease both;
}

.mb-ach-icon {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.1);
  color: var(--mb-gold);
  font-size: 1.4rem;
}

.mb-ach-toast h3 {
  margin: 2px 0 3px;
  font-family: var(--mb-display);
  font-size: 1.1rem;
  color: #fdfcf1;
}

.mb-ach-toast p:last-child {
  margin: 0;
  color: #a9bbb4;
  font-size: 0.7rem;
}

.mb-ach-toast .mb-back {
  margin-left: auto;
  flex: 0 0 auto;
}

/* ───────────────────────────── GUIDE / SETTINGS ───────────────────────────── */

.mb-guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.mb-guide-card {
  padding: 15px;
  border: 1px solid var(--mb-line);
  border-radius: 13px;
  background: rgba(7, 14, 16, 0.62);
}

.mb-guide-card h3 {
  margin: 0 0 7px;
  font-family: var(--mb-display);
  font-size: 1rem;
  letter-spacing: 0.03em;
  color: #f2faf6;
}

.mb-guide-card p {
  margin: 0 0 8px;
  color: #a4b6af;
  font-size: 0.74rem;
  line-height: 1.58;
}

.mb-guide-card p:last-child {
  margin-bottom: 0;
}

.mb-guide-card kbd {
  display: inline-block;
  min-width: 19px;
  margin: 0 1px;
  padding: 1px 4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: rgba(18, 30, 32, 0.8);
  color: #dfeee7;
  font-family: var(--mb-ui);
  font-size: 0.65rem;
  text-align: center;
}

.mb-gem-inline {
  color: var(--mb-accent);
}

.mb-guide-card b {
  color: var(--mb-gold-soft);
}

.mb-mechanic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.mb-mechanic {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--mb-line);
  border-radius: 11px;
  background: rgba(5, 11, 13, 0.6);
}

.mb-mechanic-icon {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(var(--mb-accent-rgb), 0.2);
  background: rgba(var(--mb-accent-rgb), 0.07);
  color: var(--mb-accent);
}

.mb-mechanic-icon svg {
  width: 18px;
  height: 18px;
}

.mb-mechanic h4 {
  margin: 0 0 2px;
  font-family: var(--mb-ui);
  font-size: 0.7rem;
  color: #e7f5ee;
}

.mb-mechanic p {
  margin: 0;
  color: var(--mb-muted);
  font-size: 0.61rem;
  line-height: 1.45;
}

.mb-settings-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
}

.mb-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border: 1px solid var(--mb-line);
  border-radius: 13px;
  background: rgba(7, 14, 16, 0.62);
}

.mb-setting h3 {
  margin: 0 0 3px;
  font-family: var(--mb-display);
  font-size: 0.92rem;
  color: #eefaf4;
}

.mb-setting p {
  margin: 0;
  max-width: 480px;
  color: var(--mb-muted);
  font-size: 0.68rem;
  line-height: 1.45;
}

.mb-toggle {
  min-width: 68px;
  padding: 8px 13px;
  border: 1px solid rgba(var(--mb-accent-rgb), 0.28);
  border-radius: 999px;
  background: rgba(var(--mb-accent-rgb), 0.08);
  color: #d7f8ec;
  font-family: var(--mb-ui);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  flex: 0 0 auto;
}

.mb-toggle[aria-pressed="false"] {
  border-color: var(--mb-line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--mb-muted);
}

.mb-segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--mb-line);
  border-radius: 9px;
  background: rgba(3, 8, 10, 0.6);
  flex: 0 0 auto;
}

.mb-segmented button {
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--mb-muted);
  font-family: var(--mb-ui);
  font-size: 0.64rem;
  font-weight: 700;
  cursor: pointer;
}

.mb-segmented button.is-active {
  border-color: rgba(var(--mb-accent-rgb), 0.32);
  background: rgba(var(--mb-accent-rgb), 0.1);
  color: #eafff8;
}

.mb-trail-list {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  max-width: 320px;
  justify-content: flex-end;
}

.mb-trail-choice {
  min-width: 64px;
  padding: 6px 8px;
  border: 1px solid var(--mb-line);
  border-radius: 8px;
  background: rgba(4, 9, 11, 0.7);
  color: var(--mb-muted);
  font-family: var(--mb-ui);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.mb-trail-choice.is-active {
  border-color: rgba(var(--mb-accent-rgb), 0.45);
  background: rgba(var(--mb-accent-rgb), 0.1);
  color: #eafff8;
}

.mb-trail-choice.is-locked {
  opacity: 0.35;
  cursor: not-allowed;
}

.mb-settings-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--mb-line);
}

.mb-settings-footer p {
  margin: 0;
  color: var(--mb-muted);
  font-size: 0.67rem;
}

/* ───────────────────────────── RESPONSIVE ───────────────────────────── */

@media (max-width: 1180px) {
  .mb-run-meta {
    display: none;
  }
  .mb-tool-label {
    display: none;
  }
  .mb-tool {
    min-width: 38px;
    padding: 6px;
  }
  .mb-tool-icon {
    font-size: 1.05rem;
  }
}

@media (max-width: 900px) {
  .mb-chip {
    min-width: 54px;
    padding: 4px 7px;
  }
  .mb-chip-label {
    font-size: 0.43rem;
  }
  .mb-chip b {
    font-size: 0.82rem;
  }
  .mb-hud {
    gap: 4px;
  }
  .mb-tools {
    gap: 3px;
  }
  .mb-title-copy h1 {
    font-size: clamp(2.4rem, 8vw, 3.6rem);
  }
  .mb-mechanic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .mb-app[data-screen="play"][data-controls="auto"] .mb-touch {
    display: grid;
  }
  .mb-app {
    padding: 6px 7px 7px;
    gap: 5px;
  }
  .mb-bar {
    min-height: 48px;
    padding: 5px 7px;
    gap: 7px;
    border-radius: 13px;
  }
  .mb-brand-icon {
    width: 32px;
    height: 32px;
  }
  .mb-brand-copy strong {
    font-size: 0.78rem;
  }
  .mb-brand-copy small {
    display: none;
  }
  .mb-app[data-screen="play"] .mb-brand-copy {
    display: none;
  }
  .mb-hud {
    gap: 3px;
  }
  .mb-chip {
    min-width: 42px;
    padding: 3px 5px;
  }
  .mb-chip-label {
    font-size: 0.4rem;
    letter-spacing: 0.08em;
  }
  .mb-chip b {
    font-size: 0.72rem;
  }
  .mb-chip:nth-child(2) {
    display: none;
  }
  .mb-gem {
    width: 6px;
    height: 6px;
  }
  .mb-tool {
    min-width: 34px;
    min-height: 36px;
    padding: 4px;
    border-radius: 8px;
  }
  .mb-tool-icon {
    font-size: 0.9rem;
  }
  .mb-stage {
    border-radius: 16px;
  }
  .mb-app[data-screen="play"] .mb-footer {
    display: flex !important;
    min-height: 22px;
    padding: 0 4px;
    font-size: 0.6rem;
  }
  .mb-control-hint {
    display: none;
  }
  .mb-title-layout {
    grid-template-columns: 1fr;
    gap: 10px;
    text-align: center;
    padding: 6px 4px;
  }
  .mb-title-mark {
    min-height: 132px;
  }
  .mb-title-icon {
    width: min(180px, 48vw);
    border-radius: 20px;
  }
  .mb-title-orbit {
    inset: 22% 17%;
  }
  .mb-title-copy h1 {
    font-size: clamp(2.2rem, 11vw, 3.4rem);
  }
  .mb-title-copy h1 small {
    letter-spacing: 0.26em;
  }
  .mb-lede {
    margin: 10px auto 14px;
    font-size: 0.8rem;
  }
  .mb-actions,
  .mb-actions-minor {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-left: auto;
    margin-right: auto;
    gap: 6px;
  }
  .mb-btn {
    min-height: 48px;
    padding: 8px 10px;
  }
  .mb-btn span {
    font-size: 0.82rem;
  }
  .mb-btn small {
    font-size: 0.56rem;
  }
  .mb-title-meta {
    justify-content: center;
    margin-top: 12px;
  }
  .mb-screen {
    padding: 8px;
  }
  .mb-panel {
    padding: 13px;
    border-radius: 15px;
  }
  .mb-panel-head {
    flex-wrap: wrap;
  }
  .mb-panel-heading h2 {
    font-size: 1.3rem;
  }
  .mb-world-banner {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 8px;
  }
  .mb-world-glyph {
    display: none;
  }
  .mb-level-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .mb-level-card {
    min-height: 88px;
    padding: 9px;
  }
  .mb-level-name {
    font-size: 0.74rem;
    min-height: 28px;
  }
  .mb-world-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mb-world-card {
    min-height: 178px;
    padding: 10px;
  }
  .mb-world-card h3 {
    font-size: 0.9rem;
  }
  .mb-world-state {
    font-size: 0.43rem;
    padding: 3px 5px;
  }
  .mb-trail-panel {
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
  }
  .mb-profile-panel {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .mb-profile-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mb-modal {
    padding: 18px;
    border-radius: 16px;
  }
  .mb-modal h2 {
    font-size: 1.6rem;
  }
  .mb-intro-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mb-pause-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mb-complete-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mb-guide-grid {
    grid-template-columns: 1fr;
  }
  .mb-mechanic-grid {
    grid-template-columns: 1fr;
  }
  .mb-setting {
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
  }
  .mb-trail-list {
    justify-content: flex-start;
    max-width: none;
  }
  .mb-settings-footer {
    flex-direction: column;
    align-items: flex-start;
  }
  .mb-ach-toast {
    flex-wrap: wrap;
  }
  .mb-ach-toast .mb-back {
    width: 100%;
    margin-left: 0;
  }
  .mb-app[data-screen="play"] .mb-touch {
    right: 10px;
    bottom: 10px;
    width: 132px;
    height: 132px;
  }
}

@media (max-width: 430px) {
  .mb-title-copy h1 {
    font-size: 2.1rem;
  }
  .mb-eyebrow {
    font-size: 0.52rem;
    letter-spacing: 0.16em;
  }
  .mb-world-card {
    min-height: 164px;
  }
  .mb-world-card .mb-world-sub {
    font-size: 0.6rem;
  }
  .mb-level-card {
    min-height: 84px;
  }
}

@media (max-width: 360px) {
  .mb-app[data-screen="play"] .mb-brand {
    display: none;
  }
  .mb-chip {
    min-width: 38px;
  }
}

/* Short viewports (landscape phones) */
@media (max-height: 560px) and (orientation: landscape) {
  .mb-title-layout {
    grid-template-columns: 180px 1fr;
    gap: 14px;
    align-items: center;
  }
  .mb-title-mark {
    min-height: 120px;
  }
  .mb-title-icon {
    width: 130px;
  }
  .mb-title-copy h1 {
    font-size: 2.2rem;
  }
  .mb-lede {
    margin: 8px 0 10px;
    font-size: 0.72rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .mb-actions {
    gap: 6px;
  }
  .mb-btn {
    min-height: 42px;
    padding: 6px 10px;
  }
  .mb-btn span {
    font-size: 0.78rem;
  }
  .mb-btn small {
    display: none;
  }
  .mb-actions-minor .mb-btn:nth-child(n+3) {
    display: none;
  }
  .mb-title-meta {
    margin-top: 8px;
    padding-top: 8px;
  }
  .mb-app[data-screen="play"] .mb-touch {
    width: 118px;
    height: 118px;
    right: 8px;
    bottom: 8px;
  }
  .mb-dir {
    border-radius: 10px;
    font-size: 0.85rem;
  }
  .mb-control-hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mb-title-icon,
  .mb-title-orbit i,
  .mb-loading-mark {
    animation: none !important;
  }
  .mb-screen,
  .mb-btn,
  .mb-world-card,
  .mb-level-card,
  .mb-toast {
    transition-duration: 0.01ms !important;
  }
}

/* Focus visibility */
.mb-page button:focus-visible {
  outline: 2px solid var(--mb-accent);
  outline-offset: 2px;
}

/* Tool/utility */
.mb-hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}
