/* PRISMFALL — IQ house style: dark ground, solid pink #FF00C6 accents · © 2026 Andreas Trejo · IQ Bonkers */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --pink: #FF00C6;
  --ink: #0a0a14;
  --panel: #14142a;
  --panel2: #1c1c38;
  --text: #f4f2ff;
  --muted: #a49fd0;
  --gold: #ffd34d;
}
html, body { height: 100%; }
body {
  background: var(--ink);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
#app { max-width: 560px; margin: 0 auto; padding: 14px 14px 30px; min-height: 100%; }
.hidden { display: none !important; }

/* ---------- menu ---------- */
.brand { text-align: center; padding: 18px 0 6px; }
.logoGem {
  width: 64px; height: 64px; margin: 0 auto 8px;
  background: var(--pink);
  clip-path: polygon(50% 0, 100% 38%, 50% 100%, 0 38%);
  box-shadow: 0 0 34px rgba(255,0,198,.55);
}
.brand h1 { font-size: 42px; letter-spacing: 3px; font-weight: 900; }
.brand h1 span { color: var(--pink); }
.tagline { color: var(--muted); font-size: 14px; margin-top: 2px; }
.howto {
  background: var(--panel); border: 1px solid #2b2b52; border-radius: 14px;
  padding: 12px 14px; font-size: 14px; line-height: 1.55; color: #d9d6f5; margin: 14px 0;
}
.howto b { color: var(--pink); }
.menuBar { display: flex; gap: 10px; justify-content: center; margin: 10px 0 18px; }
.btn {
  font: inherit; font-weight: 800; cursor: pointer; border-radius: 999px;
  padding: 12px 22px; border: 2px solid #34345e; background: var(--panel2); color: var(--text);
  min-height: 48px;
}
.btn.primary { background: var(--pink); border-color: var(--pink); color: #fff; box-shadow: 0 4px 22px rgba(255,0,198,.4); }
.btn.ghost { background: var(--panel); }
.btn.sm { padding: 8px 13px; min-height: 40px; font-size: 14px; }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .38; cursor: default; }
.levelsTitle { font-size: 17px; letter-spacing: 1px; margin: 6px 0 10px; color: var(--muted); text-transform: uppercase; }
.levelGrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 9px; }
.levelBtn {
  font: inherit; cursor: pointer; border-radius: 13px; border: 2px solid #34345e;
  background: var(--panel2); color: var(--text); padding: 9px 2px 7px; min-height: 62px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.levelBtn .num { font-size: 19px; font-weight: 900; }
.levelBtn .stars { font-size: 11px; color: var(--gold); letter-spacing: 1px; min-height: 14px; }
.levelBtn.locked { opacity: .35; cursor: default; }
.levelBtn:not(.locked):active { transform: scale(.94); border-color: var(--pink); }
.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 22px; }

/* ---------- HUD ---------- */
.hud { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; }
.hudMid { flex: 1; min-width: 0; }
.hudRow { display: flex; justify-content: space-between; font-weight: 800; font-size: 16px; }
.hudRow .moves { color: var(--pink); }
.hudRow .moves.low { color: #ff5252; animation: pulse .7s infinite alternate; }
.hudRow .chain { color: var(--gold); font-size: 14px; }
.goalRow { display: flex; align-items: center; gap: 7px; margin-top: 5px; font-size: 13px; color: var(--muted); }
.goalRow #goalIcon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.goalBar { flex: 1; height: 9px; background: #23233f; border-radius: 99px; overflow: hidden; }
#goalFill { height: 100%; width: 0%; background: var(--pink); border-radius: 99px; transition: width .35s ease; }
.hudBtns { display: flex; flex-direction: column; gap: 6px; }
@keyframes pulse { from { opacity: 1; } to { opacity: .45; } }

/* ---------- board ---------- */
#boardWrap { position: relative; width: min(100%, 58vh, 520px); margin: 0 auto; }
#board {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  background: #101024; border: 2px solid #2b2b52; border-radius: 18px;
  overflow: hidden; touch-action: none;
  box-shadow: 0 12px 44px rgba(0,0,0,.55), inset 0 0 60px rgba(255,0,198,.05);
}
.cellBg { position: absolute; width: 12.5%; height: 12.5%; }
.cellBg.alt { background: rgba(255,255,255,.028); }
.veil {
  position: absolute; width: 12.5%; height: 12.5%; pointer-events: none;
  background: rgba(150,220,255,.34);
  border: 1.5px solid rgba(200,240,255,.75); border-radius: 10px;
  box-shadow: inset 0 0 12px rgba(190,235,255,.8);
  transition: opacity .25s;
}
.tile {
  position: absolute; width: 12.5%; height: 12.5%;
  transition: transform .19s ease-in-out, opacity .15s;
  will-change: transform; cursor: pointer; z-index: 2;
}
.tile .gem {
  position: absolute; inset: 5%;
  border-radius: 22%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 -6px 12px rgba(0,0,0,.35), inset 0 4px 8px rgba(255,255,255,.22), 0 3px 7px rgba(0,0,0,.45);
}
.tile svg { width: 74%; height: 74%; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
.tile.t0 .gem { background: #57101d; border: 2px solid #ff4d5e; }
.tile.t1 .gem { background: #0d2c4d; border: 2px solid #38b6ff; }
.tile.t2 .gem { background: #0d3a22; border: 2px solid #3ddc74; }
.tile.t3 .gem { background: #4a3208; border: 2px solid #ffb52e; }
.tile.t4 .gem { background: #2f1650; border: 2px solid #b06bff; }
.tile.t5 .gem { background: #0b3d3a; border: 2px solid #4de8e0; }
.tile.prism .gem { background: #2a2a3d; border: 2px solid #ffffff; box-shadow: 0 0 16px rgba(255,0,198,.75), inset 0 0 14px rgba(255,255,255,.5); }
.tile .badge {
  position: absolute; right: 2%; bottom: 2%; width: 42%; height: 42%;
  pointer-events: none; filter: drop-shadow(0 0 4px rgba(255,0,198,.9));
}
.tile.special .gem { box-shadow: inset 0 -6px 12px rgba(0,0,0,.35), inset 0 4px 8px rgba(255,255,255,.25), 0 0 14px rgba(255,0,198,.65); border-color: var(--pink); }
.tile.selected .gem { outline: 3px solid var(--pink); outline-offset: 1px; }
.tile.hinted .gem { animation: hintPulse .55s infinite alternate; }
@keyframes hintPulse { from { outline: 2px solid rgba(255,211,77,.4); } to { outline: 4px solid var(--gold); outline-offset: 1px; } }
.tile.pop { animation: pop .22s ease-in forwards; z-index: 5; }
@keyframes pop { 40% { scale: 1.22; } 100% { scale: .1; opacity: 0; } }
.tile.spawnFlash .gem { animation: spawnFlash .5s ease-out; }
@keyframes spawnFlash { 0% { box-shadow: 0 0 0 6px rgba(255,0,198,.85); } 100% { box-shadow: 0 0 14px rgba(255,0,198,.65); } }
.tile.shake { animation: shake .26s ease-in-out; }
@keyframes shake { 20% { translate: -4px 0; } 45% { translate: 4px 0; } 70% { translate: -3px 0; } 100% { translate: 0 0; } }
.boardShake { animation: shake .3s ease-in-out; }

.banner {
  position: absolute; inset: auto 0 46% 0; text-align: center; z-index: 8;
  font-size: clamp(22px, 6.4vw, 34px); font-weight: 900; letter-spacing: 1.5px;
  color: #fff; text-shadow: 0 0 18px rgba(255,0,198,.95), 0 2px 6px #000;
  pointer-events: none;
}
.banner.pop2 { animation: bannerIn .3s ease-out; }
@keyframes bannerIn { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.tip { text-align: center; color: var(--muted); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- overlay ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(5,5,14,.78); z-index: 20;
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.card {
  background: var(--panel); border: 2px solid var(--pink); border-radius: 20px;
  padding: 26px 24px; text-align: center; max-width: 380px; width: 100%;
  box-shadow: 0 0 44px rgba(255,0,198,.35);
}
.card h2 { font-size: 26px; margin-bottom: 8px; }
.stars { font-size: 38px; color: var(--gold); letter-spacing: 6px; min-height: 46px; }
.card p { color: var(--muted); line-height: 1.5; margin-bottom: 18px; }
.ovBtns { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; }

@media (max-width: 420px) {
  .brand h1 { font-size: 34px; }
  .levelGrid { grid-template-columns: repeat(4, 1fr); }
  .hudRow { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .tile { transition: none; }
  .tile.hinted .gem, .hudRow .moves.low { animation: none; }
}
