/* Layout: title screen over a scrolling block landscape; game screens put the board and an
   inventory-style side panel on a dark dirt backdrop. One deliberate dark visual world. */
:root {
  --gui: #c6c6c6;
  --gui-hi: #ffffff;
  --gui-lo: #555555;
  --gui-ink: #3f3f3f;
  --slot: #8b8b8b;
  --slot-lo: #373737;
  --edge: #000000;
  --text: #ffffff;
  --text-dim: #a8a8a8;
  --text-shadow: #3f3f3f;
  --yellow: #ffff55;
  --gold: #ffaa00;
  --green: #55ff55;
  --xp: #80ff20;
  --xp-lo: #3c8a0d;
  --red: #ff5555;
  --aqua: #55ffff;
  --purple: #c35bff;
  --tooltip-bg: rgba(16, 0, 16, 0.95);
  --tooltip-edge: #2d0a6b;
  --btn: #6f6f6f;
  --btn-hover: #7b86c4;
  --btn-hi: #a9a9a9;
  --btn-lo: #3a3a3a;
  --bg: #20160f;
  --font-display: 'Press Start 2P', ui-monospace, 'Courier New', monospace;
  --font-body: 'Pixelify Sans', 'Press Start 2P', ui-monospace, 'Courier New', monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.35;
  -webkit-font-smoothing: none;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; }
img, canvas { image-rendering: pixelated; }

#world, #dirt { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
#world { display: block; }
#dirt { background-color: #2a1d14; background-size: 64px 64px; image-rendering: pixelated; }
#dirt::after { content: ''; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.62); }
body.on-menu #dirt { display: none; }
body:not(.on-menu) #world { display: none; }

#app {
  position: relative;
  z-index: 1;
  min-height: 100%;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 12px 24px;
}
.screen { max-width: 1180px; margin: 0 auto; }
.screen[hidden] { display: none !important; }

.shadow-text { text-shadow: 2px 2px 0 var(--text-shadow); }

/* ---------- Buttons ---------- */
.mc-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 18px;
  font-family: var(--font-display);
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  text-shadow: 2px 2px 0 var(--text-shadow);
  background-color: var(--btn);
  background-image: linear-gradient(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.08)), var(--btn-tex, none);
  background-size: 64px 64px;
  image-rendering: pixelated;
  border: 2px solid var(--edge);
  box-shadow: inset 2px 2px 0 var(--btn-hi), inset -2px -4px 0 var(--btn-lo);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.mc-btn:hover, .mc-btn:focus-visible {
  background-color: var(--btn-hover);
  background-image: linear-gradient(rgba(96, 116, 230, 0.5), rgba(96, 116, 230, 0.5)), var(--btn-tex, none);
  border-color: var(--text);
  color: #ffffa0;
  outline: none;
}
.mc-btn:active { box-shadow: inset 2px 4px 0 var(--btn-lo), inset -2px -2px 0 var(--btn-hi); }
.mc-btn:disabled, .mc-btn[aria-disabled='true'] {
  background-color: #2c2c2c;
  background-image: none;
  color: var(--text-dim);
  text-shadow: none;
  box-shadow: inset 2px 2px 0 #3d3d3d, inset -2px -4px 0 #1c1c1c;
  border-color: var(--edge);
  cursor: default;
}
.mc-btn.wide { width: 100%; }
.mc-btn.small { min-height: 36px; padding: 6px 12px; font-size: 11px; }
.mc-btn.selected { border-color: var(--yellow); box-shadow: inset 2px 2px 0 var(--btn-hi), inset -2px -4px 0 var(--btn-lo), 0 0 0 2px var(--yellow); }
.mc-btn img { width: 24px; height: 24px; }

/* ---------- GUI panels ---------- */
.mc-panel {
  background: var(--gui);
  color: var(--gui-ink);
  border: 2px solid var(--edge);
  box-shadow: inset 3px 3px 0 var(--gui-hi), inset -3px -3px 0 var(--gui-lo);
  clip-path: polygon(4px 0, calc(100% - 4px) 0, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 0 calc(100% - 4px), 0 4px);
  padding: 16px;
}
.mc-panel h3 { margin: 0; font-family: var(--font-display); font-size: 12px; font-weight: 400; letter-spacing: 0.04em; color: var(--gui-ink); }
.slot-box {
  background: var(--slot);
  box-shadow: inset 2px 2px 0 var(--slot-lo), inset -2px -2px 0 var(--gui-hi);
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  min-height: 40px;
}
.topbar h2 {
  flex: 1;
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(13px, 2.4vw, 18px);
  font-weight: 400;
  text-shadow: 2px 2px 0 var(--text-shadow);
  text-wrap: balance;
}
.topbar .spacer { width: 92px; }
.icon-btn { width: 44px; padding: 0; }

/* ---------- Title screen ---------- */
.menu-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(28px, 6vh, 56px);
  padding-top: clamp(24px, 9vh, 90px);
  min-height: calc(100vh - 80px);
}
.logo {
  position: relative;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-weight: 400;
}
.logo-text {
  font-family: var(--font-display);
  font-size: clamp(30px, 8.4vw, 76px);
  letter-spacing: 0.02em;
  color: #9a9a9a;
  background-size: 48px 48px;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 0 #1f1f1f) drop-shadow(0 3px 0 #000) drop-shadow(3px 0 0 #000) drop-shadow(-3px 0 0 #000) drop-shadow(0 -3px 0 #000);
  line-height: 1.1;
}
.edition {
  font-family: var(--font-display);
  font-size: clamp(10px, 1.9vw, 15px);
  color: #f0d080;
  text-shadow: 2px 2px 0 #3a2a00;
  letter-spacing: 0.18em;
}
.splash {
  position: absolute;
  left: 84%;
  top: 74%;
  width: max-content;
  max-width: 13em;
  font-family: var(--font-display);
  font-size: clamp(9px, 1.5vw, 15px);
  line-height: 1.5;
  text-align: center;
  color: var(--yellow);
  text-shadow: 2px 2px 0 #3f3f00;
  transform-origin: center;
  animation: splash 0.55s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes splash {
  from { transform: translate(-50%, -50%) rotate(-16deg) scale(0.92); }
  to { transform: translate(-50%, -50%) rotate(-16deg) scale(1.06); }
}
.menu-buttons {
  display: grid;
  gap: 10px;
  width: min(420px, 100%);
}
.menu-buttons .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.menu-buttons .mc-btn { min-height: 48px; }
.menu-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 15px;
  color: var(--text);
  text-shadow: 2px 2px 0 var(--text-shadow);
  padding-top: 18px;
}

/* ---------- Puzzle select ---------- */
.tiers { display: grid; gap: 16px; }
.tier {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.tier-icon { width: 72px; height: 72px; }
.tier-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.tier-head h3 { font-size: 13px; }
.tier-progress { font-size: 16px; color: #555; font-variant-numeric: tabular-nums; }
.tier-desc { margin: 0 0 10px; font-size: 16px; color: #4a4a4a; }
.slots { display: flex; flex-wrap: wrap; gap: 4px; }
.pslot {
  position: relative;
  width: 52px;
  height: 52px;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: var(--slot);
  box-shadow: inset 2px 2px 0 var(--slot-lo), inset -2px -2px 0 var(--gui-hi);
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--text);
  text-shadow: 2px 2px 0 var(--text-shadow);
}
.pslot:hover, .pslot:focus-visible { background: #c5c5c5; outline: none; }
.pslot .num { position: absolute; right: 5px; bottom: 5px; }
.pslot img { position: absolute; left: 6px; top: 6px; width: 40px; height: 40px; }
.pslot.solved img.mark { left: auto; top: 3px; right: 3px; width: 20px; height: 20px; }

/* ---------- XP bar ---------- */
.xp { display: grid; justify-items: center; gap: 2px; margin: 18px auto 0; width: min(560px, 100%); }
.xp-level {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--xp);
  text-shadow: 2px 0 0 #000, -2px 0 0 #000, 0 2px 0 #000, 0 -2px 0 #000;
}
.xp-bar {
  position: relative;
  width: 100%;
  height: 12px;
  background: #1d1d1d;
  border: 2px solid var(--edge);
  overflow: hidden;
}
.xp-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(5.555% - 2px), rgba(0, 0, 0, 0.55) calc(5.555% - 2px) 5.555%);
}
.xp-fill { height: 100%; background: linear-gradient(var(--xp) 0 50%, var(--xp-lo) 50% 100%); transition: width 0.6s ease; }
.xp-caption { font-size: 15px; color: var(--text-dim); text-shadow: 2px 2px 0 #000; }

/* ---------- Bot setup ---------- */
.setup { display: grid; gap: 16px; max-width: 900px; margin: 0 auto; }
.setup .mc-panel { display: grid; gap: 14px; }
.mob-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 760px) { .mob-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.mob-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 12px 8px 10px;
  border: 2px solid transparent;
  background: var(--slot);
  box-shadow: inset 2px 2px 0 var(--slot-lo), inset -2px -2px 0 var(--gui-hi);
  color: var(--text);
  cursor: pointer;
  text-align: center;
}
.mob-card:hover, .mob-card:focus-visible { background: #9d9d9d; outline: none; }
.mob-card[aria-pressed='true'] { border-color: var(--text); background: #a7a7a7; }
.mob-card img { width: 64px; height: 64px; border: 2px solid #000; }
.mob-name { font-family: var(--font-display); font-size: 11px; text-shadow: 2px 2px 0 var(--text-shadow); }
.mob-rank { font-size: 15px; color: var(--yellow); text-shadow: 2px 2px 0 #3f3f00; }
.mob-desc { font-size: 14px; color: #f2f2f2; text-shadow: 1px 1px 0 #333; line-height: 1.25; }
.mob-beaten { font-size: 13px; color: var(--green); text-shadow: 1px 1px 0 #0a3a0a; min-height: 1.2em; }
.color-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* ---------- Play screen ---------- */
.play {
  --board: min(calc(100vh - 110px), calc(100vw - 440px), 720px);
  display: grid;
  grid-template-columns: var(--board) minmax(280px, 340px);
  gap: 20px;
  justify-content: center;
  align-items: start;
}
.board-col { display: grid; gap: 10px; min-width: 0; }
.board-frame {
  position: relative;
  width: var(--board);
  padding: clamp(14px, 2.6vw, 22px);
  background-size: 48px 48px;
  border: 3px solid var(--edge);
  box-shadow: inset 3px 3px 0 rgba(255, 255, 255, 0.18), inset -3px -3px 0 rgba(0, 0, 0, 0.45), 0 10px 0 rgba(0, 0, 0, 0.35);
  image-rendering: pixelated;
}
.board {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-width: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 0 0 3px #000;
}
.squares { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); }
.sq { background-size: 100% 100%; image-rendering: pixelated; }
.sq.dark { filter: brightness(0.96); }
.layer { position: absolute; inset: 0; pointer-events: none; }
.mark, .piece { position: absolute; width: 12.5%; height: 12.5%; }
.mark.last { background: rgba(255, 255, 85, 0.36); }
.mark.sel { background: rgba(85, 255, 255, 0.32); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.85); }
.mark.check { background: radial-gradient(rgba(255, 40, 40, 0.85), rgba(255, 40, 40, 0.15) 70%); animation: pulse 0.9s ease-in-out infinite alternate; }
.mark.hint { box-shadow: inset 0 0 0 4px var(--green); background: rgba(85, 255, 85, 0.22); animation: pulse 0.7s ease-in-out infinite alternate; }
.mark.wrong { background: rgba(255, 60, 60, 0.45); }
.mark.dot::after {
  content: '';
  position: absolute;
  left: 36%; top: 36%; width: 28%; height: 28%;
  background: rgba(20, 12, 4, 0.45);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.25);
}
.mark.cap {
  background:
    linear-gradient(135deg, rgba(0, 0, 0, 0.38) 18%, transparent 18%) top left,
    linear-gradient(225deg, rgba(0, 0, 0, 0.38) 18%, transparent 18%) top right,
    linear-gradient(45deg, rgba(0, 0, 0, 0.38) 18%, transparent 18%) bottom left,
    linear-gradient(315deg, rgba(0, 0, 0, 0.38) 18%, transparent 18%) bottom right;
  background-size: 50% 50%;
  background-repeat: no-repeat;
}
.mark.hover { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.7); }
@keyframes pulse { from { opacity: 0.55; } to { opacity: 1; } }
.piece {
  background-size: 86% 86%;
  background-position: 50% 62%;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.35));
  will-change: transform;
}
.piece.anim { transition: transform 0.2s cubic-bezier(0.3, 0.7, 0.4, 1); }
.piece.dragging { z-index: 10; transition: none; filter: drop-shadow(0 10px 0 rgba(0, 0, 0, 0.35)); background-size: 100% 100%; }
.piece.ghost { transform-origin: 50% 88%; }
.piece .hurt {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: #ff1f1f;
  -webkit-mask-position: 50% 62%; mask-position: 50% 62%;
  -webkit-mask-size: 86% 86%; mask-size: 86% 86%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.fx-particle { position: absolute; pointer-events: none; opacity: 0; }
.fx-particle.crit { background: #ffffff; box-shadow: 0 0 0 2px #4a4a4a; }
.fx-particle.smoke { box-shadow: 0 0 0 1px rgba(40, 40, 40, 0.35); }
.fx-particle.xp { background: #7dff2a; box-shadow: 0 0 0 1px #2a6b06, 0 0 6px rgba(160, 255, 60, 0.8); }
.coord {
  position: absolute;
  font-family: var(--font-display);
  font-size: clamp(7px, 1.2vw, 10px);
  color: #f5f5f5;
  text-shadow: 1px 1px 0 #000;
  pointer-events: none;
}
.board-frame.no-coords .coord { display: none; }

/* ---------- Side panel ---------- */
.side { display: grid; gap: 14px; align-content: start; min-width: 0; }
.side-title { display: grid; gap: 4px; }
.side-title h3 { font-size: 12px; line-height: 1.5; }
.side-sub { font-size: 16px; color: #4f4f4f; }
.goal-chip {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--text);
  text-shadow: 1px 1px 0 #000;
  background: #373737;
  border: 2px solid #000;
}
.goal-chip img { width: 22px; height: 22px; }
.status {
  min-height: 3.2em;
  display: grid;
  align-content: center;
  padding: 10px 12px;
  font-size: 18px;
  color: var(--text);
  text-shadow: 2px 2px 0 #000;
  background: #2b2b2b;
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 #1a1a1a, inset -2px -2px 0 #4a4a4a;
}
.status.good { color: var(--green); }
.status.bad { color: var(--red); }
.status.info { color: var(--yellow); }
.status .tip { display: block; font-size: 15px; color: #dcdcdc; margin-top: 4px; }
.hearts { display: flex; gap: 4px; }
.hearts img { width: 27px; height: 24px; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-grid .mc-btn { font-size: 10px; padding: 6px 8px; min-height: 40px; }
.btn-grid .span2 { grid-column: span 2; }
.player-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #8b8b8b;
  box-shadow: inset 2px 2px 0 var(--slot-lo), inset -2px -2px 0 var(--gui-hi);
  color: var(--text);
  text-shadow: 2px 2px 0 #333;
}
.player-card.active { background: #9aa4dc; }
.player-card img { width: 44px; height: 44px; border: 2px solid #000; background: #555; }
.player-card .pname { font-family: var(--font-display); font-size: 10px; line-height: 1.5; }
.player-card .pinfo { font-size: 15px; color: #f0f0f0; }
.player-card .adv { font-family: var(--font-display); font-size: 10px; color: var(--yellow); }
.captured { display: flex; flex-wrap: wrap; gap: 0; min-height: 20px; }
.captured img { width: 22px; height: 22px; margin-right: -4px; }
.thinking::after { content: ''; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
.moves {
  max-height: 210px;
  overflow-y: auto;
  padding: 6px 8px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  background: #2b2b2b;
  color: #e6e6e6;
  border: 2px solid #000;
  scrollbar-color: #8b8b8b #2b2b2b;
}
.moves ol { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: 2.6em 1fr 1fr; row-gap: 2px; }
.moves li { display: contents; }
.moves .n { color: #8a8a8a; }
.moves .m.cur { color: var(--yellow); }
.moves .empty { grid-column: 1 / -1; color: #8a8a8a; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 16px; }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: rgba(0, 0, 0, 0.6);
  animation: fadein 0.2s ease-out;
}
@keyframes fadein { from { opacity: 0; } }
.overlay > * { margin: auto; flex-shrink: 0; }
.dialog { width: min(440px, 100%); display: grid; gap: 14px; text-align: center; }
.dialog h3 { font-size: 13px; line-height: 1.6; }
.dialog p { margin: 0; font-size: 17px; }
.dialog .btns { display: grid; gap: 8px; }
.promo-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.promo-row button { min-width: 0; aspect-ratio: 1; border: 0; padding: 4px; cursor: pointer; background: var(--slot); box-shadow: inset 2px 2px 0 var(--slot-lo), inset -2px -2px 0 var(--gui-hi); }
.promo-row button:hover, .promo-row button:focus-visible { background: #c5c5c5; outline: none; }
.promo-row img { display: block; width: 100%; height: auto; }
.big-screen {
  width: min(560px, 100%);
  display: grid;
  gap: 18px;
  justify-items: center;
  text-align: center;
}
.big-screen h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(22px, 6vw, 44px);
  line-height: 1.3;
  color: var(--text);
  text-shadow: 4px 4px 0 var(--text-shadow);
  text-wrap: balance;
}
.big-screen p { margin: 0; font-size: 20px; text-shadow: 2px 2px 0 #000; }
.big-screen .score { color: var(--yellow); }
.big-screen .btns { display: grid; gap: 10px; width: min(400px, 100%); }
.overlay.death { background: linear-gradient(rgba(120, 0, 0, 0.55), rgba(60, 0, 0, 0.8)); }
.overlay.victory { background: linear-gradient(rgba(10, 60, 10, 0.6), rgba(0, 0, 0, 0.8)); }
.overlay.victory h2 { color: var(--green); text-shadow: 4px 4px 0 #0a3a0a; }
.overlay.draw h2 { color: var(--aqua); text-shadow: 4px 4px 0 #0a3a3a; }

.settings-list { display: grid; gap: 8px; }
.piece-legend { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.pl-cell {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 5px 2px 4px;
  background: var(--slot);
  box-shadow: inset 2px 2px 0 var(--slot-lo), inset -2px -2px 0 var(--gui-hi);
}
.pl-imgs { display: flex; }
.pl-imgs img { width: 28px; height: 28px; }
.pl-cell span { font-size: 12px; color: var(--text); text-shadow: 1px 1px 0 #333; }
.dialog .pl-caption { font-size: 14px; line-height: 1.3; text-align: left; color: #4a4a4a; }
.about p { text-align: left; font-size: 16px; }

/* ---------- Toasts & tooltips ---------- */
#toasts {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  z-index: 60;
  display: grid;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: min(320px, calc(100vw - 24px));
  padding: 10px 12px;
  background: #212121;
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 #555, inset -2px -2px 0 #0e0e0e;
  animation: toast-in 0.35s ease-out, toast-out 0.4s ease-in 3.6s forwards;
}
.toast img { width: 40px; height: 40px; }
.toast b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 10px; color: var(--yellow); line-height: 1.5; }
.toast span { font-size: 16px; color: var(--text); }
@keyframes toast-in { from { transform: translateX(110%); } }
@keyframes toast-out { to { transform: translateX(110%); opacity: 0; } }
.mc-tooltip {
  position: fixed;
  z-index: 70;
  max-width: 260px;
  padding: 6px 9px;
  pointer-events: none;
  background: var(--tooltip-bg);
  border: 2px solid var(--tooltip-edge);
  outline: 2px solid var(--tooltip-bg);
  color: var(--text);
  font-size: 16px;
  text-shadow: 2px 2px 0 #3f3f3f;
}
.mc-tooltip .t-title { color: var(--text); }
.mc-tooltip .t-goal { color: var(--aqua); }
.mc-tooltip .t-state { color: var(--text-dim); }
.mc-tooltip .t-state.ok { color: var(--green); }

/* ---------- Responsive ---------- */
.play.with-xp { --board: min(calc(100vh - 170px), calc(100vw - 440px), 720px); }
@media (max-width: 900px) {
  .play, .play.with-xp {
    --board: max(280px, min(calc(100vw - 32px), 640px, calc(100vh - 200px)));
    grid-template-columns: minmax(0, var(--board));
  }
  .side { width: 100%; }
  .topbar .spacer { display: none; }
}
@media (max-width: 520px) {
  body { font-size: 17px; }
  .tier { grid-template-columns: 48px minmax(0, 1fr); gap: 10px; }
  .tier-icon { width: 48px; height: 48px; }
  .pslot { width: 46px; height: 46px; }
  .pslot img { left: 5px; top: 5px; width: 36px; height: 36px; }
  .mc-btn { font-size: 11px; }
  .menu-buttons .mc-btn { font-size: 12px; }
  .splash { left: 70%; top: 122%; }
  .mob-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .color-pick .mc-btn { padding: 6px; font-size: 10px; }
  .pl-imgs img { width: 22px; height: 22px; }
  .pl-cell span { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
