/* ================= Jewel Rush ================= */
:root {
  --gold-1: #fffbe0;
  --gold-2: #ffe48a;
  --gold-3: #f2b636;
  --gold-4: #c98415;
  --gold-dark: #6b3f06;
  --navy-1: #1d3d78;
  --navy-2: #0e2350;
  --navy-3: #081633;
  --ink: #050a18;
  --display: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --deco: 'Cinzel Decorative', 'Cinzel', Georgia, serif;
  --body: 'Nunito', system-ui, sans-serif;
  --gold-ring: 0 0 0 .4cqw #f6d77a, 0 0 0 .75cqw #7a4d0e, 0 0 0 1cqw #ffe7a0;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--ink);
  display: grid; place-items: center;
  height: 100dvh; overflow: hidden;
  font-family: var(--body); color: #fff;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { -webkit-user-drag: none; }

#backdrop {
  position: fixed; inset: -40px;
  background: url(assets/cave_background.jpg) center/cover;
  filter: blur(28px) brightness(.45) saturate(1.2);
}

#app {
  position: relative;
  width: min(100vw, 56.25dvh);
  height: min(100dvh, 177.78vw);
  container-type: size;
  overflow: hidden;
  box-shadow: 0 0 80px rgba(0,0,0,.8);
}
#app > .bg {
  position: absolute; inset: 0;
  background: url(assets/cave_background.jpg) center/cover;
  animation: bgDrift 40s ease-in-out infinite alternate;
}
@keyframes bgDrift { from { transform: scale(1.04); } to { transform: scale(1.1) translateY(-1%); } }

#fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }

/* ---------- Shared ---------- */
.gold-text {
  background: linear-gradient(180deg, var(--gold-1) 0%, var(--gold-2) 30%, var(--gold-3) 56%, var(--gold-4) 72%, var(--gold-2) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 .35cqw 0 #4a2a04) drop-shadow(0 .8cqw 1.2cqw rgba(0,0,0,.6));
}

.screen {
  position: absolute; inset: 0;
  opacity: 0; visibility: hidden;
  transform: scale(1.03);
  transition: opacity .45s ease, transform .55s cubic-bezier(.2,.8,.2,1), visibility 0s .45s;
}
.screen.active { opacity: 1; visibility: visible; transform: none; transition: opacity .45s ease, transform .55s cubic-bezier(.2,.8,.2,1); }

.btn {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 52cqw; height: 13.5cqw; padding: 0 7cqw;
  border-radius: 999px;
  font-family: var(--display); font-weight: 900; font-size: 5.6cqw; letter-spacing: .08em; text-transform: uppercase;
  transition: transform .12s ease, filter .2s;
}
.btn:active { transform: translateY(.7cqw) scale(.98); }
.btn:hover { filter: brightness(1.08); }
.btn::after {
  content: ''; position: absolute; top: -20%; bottom: -20%; width: 30%; left: -50%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  transform: skewX(-20deg);
  animation: shine 4.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shine { 0%, 70% { left: -50%; } 100% { left: 130%; } }
.btn-gold {
  color: #4a2700;
  background: linear-gradient(180deg, #fff2b3 0%, #ffd55a 38%, #e9a521 52%, #f6bf3d 80%, #ffe08a 100%);
  border: .45cqw solid #fff3c4;
  box-shadow: 0 1cqw 0 #8a5208, 0 0 0 .35cqw #8a5208, 0 2.2cqw 3.5cqw rgba(0,0,0,.55), inset 0 -.8cqw 1.2cqw rgba(160,90,0,.35);
  text-shadow: 0 .25cqw 0 rgba(255,250,220,.7);
}
.btn-navy {
  color: var(--gold-2);
  background: linear-gradient(180deg, #3363bd 0%, #1a3f86 45%, #0f2a62 55%, #173a7c 100%);
  border: .45cqw solid #f0c95e;
  box-shadow: 0 1cqw 0 #071636, 0 0 0 .35cqw #5a3a08, 0 2.2cqw 3.5cqw rgba(0,0,0,.55), inset 0 .6cqw .8cqw rgba(255,255,255,.18);
  text-shadow: 0 .3cqw 0 rgba(0,0,0,.6);
}
.btn-red {
  color: #fff;
  background: linear-gradient(180deg, #ff7a86 0%, #e2243c 50%, #a80f24 100%);
  border: .45cqw solid #ffd2a0;
  box-shadow: 0 1cqw 0 #5e0612, 0 2cqw 3cqw rgba(0,0,0,.5);
  text-shadow: 0 .3cqw 0 rgba(0,0,0,.4);
}
.btn-sm { min-width: 0; height: 9cqw; padding: 0 4.5cqw; font-size: 3.6cqw; }

.img-btn { position: absolute; transition: transform .15s; filter: drop-shadow(0 1cqw 1.4cqw rgba(0,0,0,.55)); }
.img-btn img { width: 100%; height: 100%; object-fit: contain; display: block; }
.img-btn:hover { transform: scale(1.06); }
.img-btn:active { transform: scale(.92); }

.round-btn {
  width: 11cqw; height: 11cqw; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--gold-2);
  background: radial-gradient(circle at 40% 30%, #2d5fb8, #0c2152 70%);
  box-shadow: var(--gold-ring), 0 1.2cqw 2cqw rgba(0,0,0,.5);
}
.round-btn svg { width: 55%; height: 55%; }
.round-btn:active { transform: scale(.92); }

.star-pill {
  display: flex; align-items: center; gap: 1.5cqw;
  height: 9cqw; padding: 0 4cqw 0 1.5cqw;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(20,44,96,.92), rgba(8,20,48,.92));
  box-shadow: 0 0 0 .35cqw #e9bf55, 0 1cqw 2cqw rgba(0,0,0,.45);
  font-family: var(--display); font-weight: 900; font-size: 4.6cqw; color: var(--gold-2);
}
.star-pill img { width: 8cqw; height: 8cqw; object-fit: contain; margin-top: -.8cqw; }

/* ================= MENU ================= */
#menu { display: flex; flex-direction: column; align-items: center; }
.menu-vignette {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 45% at 50% 28%, rgba(120,200,255,.18), transparent 70%),
    linear-gradient(180deg, rgba(4,8,22,.72) 0%, rgba(4,8,22,.15) 35%, rgba(4,8,22,.2) 60%, rgba(4,8,22,.85) 100%);
}
.rays {
  position: absolute; left: 50%; top: 27cqh; width: 230cqw; height: 230cqw;
  translate: -50% -50%;
  background: repeating-conic-gradient(from 0deg, rgba(255,240,200,.09) 0deg 6deg, transparent 6deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 0%, transparent 55%); mask: radial-gradient(circle, #000 0%, transparent 55%);
  animation: spin 80s linear infinite;
  mix-blend-mode: screen;
}
@keyframes spin { to { rotate: 360deg; } }

.logo { position: relative; margin-top: 8cqh; display: flex; flex-direction: column; align-items: center; }
.logo-gems { position: relative; width: 70cqw; height: 31cqw; }
.halo {
  position: absolute; left: 50%; top: 52%; width: 46cqw; height: 46cqw; translate: -50% -50%;
  background: radial-gradient(circle, rgba(255,255,255,.55), rgba(160,220,255,.25) 35%, transparent 68%);
  animation: halo 3s ease-in-out infinite;
}
@keyframes halo { 50% { scale: 1.15; opacity: .7; } }
.lg-center {
  position: absolute; left: 50%; top: 50%; width: 30cqw; translate: -50% -50%;
  filter: drop-shadow(0 0 3cqw rgba(255,255,255,.7)) drop-shadow(0 2cqw 2cqw rgba(0,0,0,.5));
  animation: floatC 4s ease-in-out infinite;
}
@keyframes floatC { 50% { transform: translateY(-1.8cqw) rotate(4deg); } }
.lg { position: absolute; width: 12cqw; filter: drop-shadow(0 1.4cqw 1.4cqw rgba(0,0,0,.5)); animation: floatG 5s ease-in-out infinite; }
.lg1 { left: 2cqw; top: 15cqw; animation-delay: -1s; rotate: -14deg; }
.lg2 { left: 13cqw; top: 1cqw; animation-delay: -2s; width: 10cqw; rotate: -8deg; }
.lg3 { right: 13cqw; top: 1cqw; animation-delay: -3s; width: 10.5cqw; rotate: 10deg; }
.lg4 { right: 2cqw; top: 15cqw; animation-delay: -4s; rotate: 12deg; }
.lg5 { left: 50%; top: -6cqw; width: 8cqw; margin-left: -4cqw; animation-delay: -.5s; opacity: .9; }
@keyframes floatG { 50% { transform: translateY(-2.2cqw); } }

.logo-title { display: flex; flex-direction: column; align-items: center; line-height: .86; margin-top: -1cqw; }
.lt { position: relative; display: block; font-family: var(--deco); font-weight: 900; letter-spacing: .02em; }
.lt::before {
  content: attr(data-text); position: absolute; inset: 0;
  color: #3a1d02; -webkit-text-stroke: 2.4cqw #3a1d02;
  text-shadow: 0 1.6cqw 2.4cqw rgba(0,0,0,.7), 0 0 6cqw rgba(255,190,60,.35);
}
.lt .fill {
  position: relative;
  background: linear-gradient(180deg, #fffdf0 0%, #ffe9a0 28%, #f7c044 50%, #c27b10 62%, #f9d46e 84%, #fff1b8 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: .25cqw rgba(255,248,215,.6);
}
.w1 { font-size: 17cqw; }
.w2 { font-size: 22cqw; margin-top: -1cqw; }
.logo-div { width: 62cqw; margin-top: 2.5cqw; opacity: .95; }
.tagline {
  margin-top: 1.5cqw;
  font-family: var(--display); font-weight: 700; font-size: 3.1cqw; letter-spacing: .16em; text-transform: uppercase;
  color: #cfe6ff; text-shadow: 0 0 2cqw rgba(120,190,255,.7), 0 .3cqw .6cqw #000;
}

.menu-buttons { position: relative; margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 4.4cqw; }
.btn-play { min-width: 66cqw; height: 19cqw; animation: breathe 2.6s ease-in-out infinite; }
.btn-play .btn-main { font-size: 8.5cqw; line-height: 1; }
.btn-play .btn-sub { font-family: var(--body); font-weight: 900; font-size: 3.2cqw; letter-spacing: .12em; opacity: .75; margin-top: .6cqw; }
@keyframes breathe { 50% { transform: scale(1.035); } }
.menu-buttons .btn-navy { min-width: 58cqw; }

.menu-foot { position: relative; margin: 7cqw 0 5cqw; display: flex; flex-direction: column; align-items: center; gap: 3cqw; }
.version { font-size: 2.7cqw; letter-spacing: .2em; text-transform: uppercase; color: rgba(200,220,255,.45); font-weight: 700; }

/* ================= MAP ================= */
#map::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(4,8,22,.55), rgba(4,8,22,.35) 40%, rgba(4,8,22,.65));
}
.map-scroll { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; touch-action: pan-y; }
.map-scroll::-webkit-scrollbar { display: none; }
.map-inner { position: relative; width: 100%; }
.map-path { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.map-path .glow { fill: none; stroke: rgba(255,214,110,.25); stroke-width: 7; stroke-linecap: round; filter: blur(1.2px); }
.map-path .road { fill: none; stroke: #1a2c55; stroke-width: 4; stroke-linecap: round; }
.map-path .edge { fill: none; stroke: #e9bf55; stroke-width: 4.8; stroke-linecap: round; }
.map-path .dots { fill: none; stroke: #ffe7a0; stroke-width: 1.1; stroke-linecap: round; stroke-dasharray: 0 3.2; }

.zone { position: absolute; left: -20%; right: -20%; pointer-events: none; }
.deco { position: absolute; pointer-events: none; opacity: .42; filter: blur(.25cqw) drop-shadow(0 0 2cqw rgba(255,255,255,.3)); animation: floatG 6s ease-in-out infinite; }

.chapter {
  position: absolute; left: 50%; translate: -50% -50%;
  display: flex; flex-direction: column; align-items: center;
  padding: 1.8cqw 8cqw 2cqw;
  border-radius: 3cqw;
  background: linear-gradient(180deg, rgba(28,60,120,.95), rgba(10,26,62,.95));
  box-shadow: var(--gold-ring), 0 2cqw 4cqw rgba(0,0,0,.6);
  white-space: nowrap;
  z-index: 2;
}
.chapter small { font-family: var(--display); font-weight: 700; font-size: 2.6cqw; letter-spacing: .3em; color: #9fc3ff; }
.chapter b { font-family: var(--display); font-weight: 900; font-size: 5cqw; letter-spacing: .06em; color: var(--gold-2); text-shadow: 0 .3cqw 0 #3a2204; }

.node {
  position: absolute; width: 17cqw; height: 17cqw; translate: -50% -50%;
  border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 38% 28%, #4c86e6 0%, #1a438f 45%, #0b2256 80%);
  box-shadow: 0 0 0 .55cqw #f8d878, 0 0 0 1.1cqw #7a4d0e, 0 0 0 1.4cqw #ffe7a0, 0 1.6cqw 2.4cqw rgba(0,0,0,.6), inset 0 -1.2cqw 2cqw rgba(0,0,0,.45), inset 0 1cqw 1.4cqw rgba(255,255,255,.3);
  z-index: 3;
  transition: transform .15s;
}
.node:active { transform: scale(.92); }
.node-num { font-family: var(--display); font-weight: 900; font-size: 6.4cqw; color: #fff; text-shadow: 0 .4cqw 0 #071a40, 0 0 2cqw rgba(140,200,255,.6); }
.node-stars { position: absolute; bottom: -4.6cqw; display: flex; align-items: flex-end; }
.node-stars img { width: 5.6cqw; filter: drop-shadow(0 .4cqw .5cqw rgba(0,0,0,.6)); }
.node-stars img:nth-child(2) { width: 6.6cqw; margin: 0 -.6cqw .9cqw; }
.node.done { background: radial-gradient(circle at 38% 28%, #ffe9a0 0%, #f2b636 45%, #a8640a 85%); }
.node.done .node-num { color: #4a2700; text-shadow: 0 .3cqw 0 rgba(255,245,210,.8); }
.node.locked { filter: grayscale(.8) brightness(.68); cursor: default; }
.node.locked .node-num { opacity: .6; }
.node .lock { position: absolute; width: 6cqw; bottom: -1.5cqw; right: -1.5cqw; color: #ffe7a0; filter: drop-shadow(0 .4cqw .4cqw #000); }
.node.current { width: 20cqw; height: 20cqw; animation: nodePulse 1.8s ease-in-out infinite; }
.node.current .node-num { font-size: 7.6cqw; }
@keyframes nodePulse {
  0%, 100% { box-shadow: 0 0 0 .55cqw #f8d878, 0 0 0 1.1cqw #7a4d0e, 0 0 0 1.4cqw #ffe7a0, 0 0 3cqw 1cqw rgba(255,220,120,.5), inset 0 -1.2cqw 2cqw rgba(0,0,0,.45), inset 0 1cqw 1.4cqw rgba(255,255,255,.3); }
  50% { box-shadow: 0 0 0 .55cqw #f8d878, 0 0 0 1.1cqw #7a4d0e, 0 0 0 1.4cqw #ffe7a0, 0 0 7cqw 3cqw rgba(255,220,120,.75), inset 0 -1.2cqw 2cqw rgba(0,0,0,.45), inset 0 1cqw 1.4cqw rgba(255,255,255,.3); }
}
.node-marker { position: absolute; width: 11cqw; left: 50%; margin-left: -5.5cqw; top: -14cqw; filter: drop-shadow(0 1.4cqw 1cqw rgba(0,0,0,.5)) drop-shadow(0 0 2cqw rgba(255,80,100,.6)); animation: marker 1.1s ease-in-out infinite; pointer-events: none; }
@keyframes marker { 50% { transform: translateY(-2.2cqw); } }

.map-head {
  position: absolute; left: 0; right: 0; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 4cqw 4cqw 6cqw;
  background: linear-gradient(180deg, rgba(4,10,26,.92), rgba(4,10,26,.6) 65%, transparent);
}
.map-title { font-family: var(--display); font-weight: 900; font-size: 7.5cqw; letter-spacing: .1em; color: var(--gold-2); text-shadow: 0 .4cqw 0 #3a2204, 0 0 3cqw rgba(255,200,90,.35); text-transform: uppercase; }

/* ================= GAME ================= */
#game::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(4,8,22,.35), rgba(4,8,22,.05) 30%, rgba(4,8,22,.1) 70%, rgba(4,8,22,.5));
}
.pause-btn { left: 3cqw; top: 3cqw; width: 12.5cqw; height: 12.5cqw; z-index: 3; }
.settings-btn { right: 3cqw; bottom: 2.2cqw; width: 11cqw; height: 11cqw; z-index: 3; }
.level-title { position: absolute; top: 4.4cqw; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; }
.level-title span { font-family: var(--display); font-weight: 900; font-size: 8.4cqw; letter-spacing: .05em; text-transform: uppercase; line-height: 1.1; }
.level-title img { width: 40cqw; margin-top: .4cqw; }

.hud {
  position: absolute; top: 20cqw; left: 4cqw; right: 4cqw; height: 24cqw;
  display: grid; grid-template-columns: 27cqw 1fr 21cqw; gap: 2.4cqw;
  padding: 1.9cqw;
  border-radius: 4cqw;
  background: linear-gradient(180deg, #1d3e7c, #0c2050 55%, #0a1838);
  box-shadow: var(--gold-ring), 0 1.6cqw 3cqw rgba(0,0,0,.6), inset 0 .4cqw 0 rgba(255,255,255,.14);
}
.hud-box {
  border-radius: 2.8cqw;
  background: linear-gradient(180deg, #0c1f48, #081633);
  box-shadow: inset 0 0 0 .3cqw rgba(120,160,240,.22), inset 0 .8cqw 1.6cqw rgba(0,0,0,.55);
}
.hud-goals { display: flex; flex-direction: column; justify-content: center; gap: .8cqw; padding: 0 2cqw; }
.goal { display: flex; align-items: center; justify-content: center; gap: 2cqw; }
.goal .gi { width: 9cqw; height: 9cqw; object-fit: contain; filter: drop-shadow(0 .6cqw .6cqw rgba(0,0,0,.6)); }
.goal-n { font-family: var(--display); font-weight: 900; font-size: 7cqw; color: #fff; text-shadow: 0 .4cqw 0 #071a40, 0 0 2cqw rgba(140,200,255,.4); min-width: 7cqw; text-align: center; }
.hud-goals.two .goal .gi { width: 7cqw; height: 7cqw; }
.hud-goals.two .goal-n { font-size: 5.4cqw; }
.goal.done .goal-n { color: #6dff9b; }
.goal.bump .gi { animation: bump .3s ease; }
@keyframes bump { 50% { transform: scale(1.35); } }
.check { width: 6cqw; height: 6cqw; color: #59f08b; filter: drop-shadow(0 .3cqw .3cqw #000); }

.hud-score { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3.2cqw; padding-top: 2cqw; }
.bar {
  position: relative; width: 100%; height: 3.6cqw;
  border-radius: 999px;
  background: linear-gradient(180deg, #050d22, #0f2047);
  box-shadow: 0 0 0 .3cqw #c89b3a, 0 0 0 .55cqw #3d2603, inset 0 .5cqw .8cqw rgba(0,0,0,.7);
}
.bar-fill {
  position: absolute; left: .3cqw; top: .3cqw; bottom: .3cqw; width: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff3b8 0%, #ffd34f 40%, #e09a12 75%, #ffcf55 100%);
  box-shadow: 0 0 1.6cqw rgba(255,200,80,.7);
  transition: width .4s ease;
}
.bar-star { position: absolute; top: 50%; width: 8.2cqw; translate: -50% -55%; filter: drop-shadow(0 .5cqw .5cqw rgba(0,0,0,.6)); }
.bar-star.lit { animation: starPop .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes starPop { 0% { scale: .4; } 60% { scale: 1.45; } 100% { scale: 1; } }
.score { font-family: var(--display); font-weight: 900; font-size: 5.4cqw; color: #fff4cf; text-shadow: 0 .35cqw 0 #3a2204, 0 0 2cqw rgba(255,210,110,.35); }

.hud-moves { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.moves-label { font-family: var(--display); font-weight: 900; font-size: 3.5cqw; letter-spacing: .1em; color: var(--gold-2); text-transform: uppercase; }
.moves { font-family: var(--display); font-weight: 900; font-size: 11.5cqw; line-height: 1; }
.moves.low { animation: lowMoves 1s ease-in-out infinite; }
@keyframes lowMoves { 50% { transform: scale(1.12); filter: drop-shadow(0 0 2cqw rgba(255,80,80,.9)) drop-shadow(0 .35cqw 0 #4a2a04); } }

/* Board */
.board {
  position: absolute; top: 50cqw; left: 3.5cqw; width: 93cqw; height: 93cqw;
  border-radius: 3.4cqw;
  background: linear-gradient(180deg, rgba(16,34,74,.86), rgba(7,16,40,.92));
  box-shadow: var(--gold-ring), 0 2.4cqw 5cqw rgba(0,0,0,.65), 0 0 8cqw rgba(70,150,255,.22), inset 0 0 4cqw rgba(0,0,0,.6);
  -webkit-backdrop-filter: blur(1cqw); backdrop-filter: blur(1cqw);
}
.board.shake { animation: shake .35s ease; }
@keyframes shake { 20% { translate: -1.2cqw .6cqw; } 40% { translate: 1cqw -.8cqw; } 60% { translate: -.6cqw .6cqw; } 80% { translate: .4cqw -.3cqw; } }
.orn {
  position: absolute; width: 3.2cqw; height: 3.2cqw; rotate: 45deg; z-index: 2;
  background: linear-gradient(135deg, #fff3c4, #e7ad2c 50%, #8a5208);
  box-shadow: 0 0 0 .3cqw #3d2603, 0 0 1.5cqw rgba(255,210,110,.6);
}
.orn.t { top: -2.1cqw; left: 50%; margin-left: -1.6cqw; }
.orn.b { bottom: -2.1cqw; left: 50%; margin-left: -1.6cqw; }
.orn.l { left: -2.1cqw; top: 50%; margin-top: -1.6cqw; }
.orn.r { right: -2.1cqw; top: 50%; margin-top: -1.6cqw; }
.grid { position: absolute; inset: 1.9cqw; }
.cells, .tiles, .bfx { position: absolute; inset: 0; }
.tiles { clip-path: inset(0 -20% -20% -20%); touch-action: none; cursor: pointer; }
.bfx { pointer-events: none; }

.cell { position: absolute; width: 12.5%; height: 12.5%; background: url(assets/board_cell.webp) center / 94% 94% no-repeat; }
.cell::after { content: ''; position: absolute; inset: 5%; border-radius: 18%; opacity: 0; transition: opacity .3s; }
.cell.f1::after, .cell.f2::after, .cell.crack::after {
  opacity: 1;
  background:
    linear-gradient(140deg, rgba(235,250,255,.6) 0%, rgba(150,210,255,.25) 45%, rgba(220,245,255,.5) 100%),
    repeating-linear-gradient(60deg, rgba(255,255,255,.16) 0 .3cqw, transparent .3cqw 2.2cqw);
  box-shadow: inset 0 0 0 .3cqw rgba(230,250,255,.8), inset 0 0 1.6cqw rgba(160,220,255,.6), 0 0 1.2cqw rgba(140,210,255,.35);
}
.cell.f2::after {
  background:
    linear-gradient(140deg, rgba(240,252,255,.85) 0%, rgba(160,215,255,.5) 45%, rgba(225,248,255,.75) 100%),
    repeating-linear-gradient(-60deg, rgba(255,255,255,.25) 0 .35cqw, transparent .35cqw 1.8cqw);
  box-shadow: inset 0 0 0 .3cqw #fff, inset 0 0 0 1cqw rgba(180,230,255,.55), inset 0 0 2cqw rgba(160,220,255,.8), 0 0 1.6cqw rgba(140,210,255,.5);
}
.cell.crack::after { animation: crack .45s ease forwards; }
@keyframes crack { 0% { opacity: 1; scale: 1; filter: brightness(2); } 100% { opacity: 0; scale: 1.25; } }

.tile { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; will-change: transform; }
.gem { position: absolute; inset: 6%; transform-origin: 50% 85%; }
.gem img { position: relative; width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 .5cqw .5cqw rgba(0,0,0,.5)); }
.tile.sel::before {
  content: ''; position: absolute; inset: 3%; border-radius: 22%;
  background: radial-gradient(circle, rgba(255,240,180,.35), transparent 70%);
  box-shadow: 0 0 0 .45cqw #ffe9a0, 0 0 3cqw rgba(255,215,106,.8);
}
.tile.sel .gem { animation: selPulse .9s ease-in-out infinite; }
@keyframes selPulse { 0%, 100% { transform: scale(1.06); } 50% { transform: scale(1.16); } }
.tile.hint .gem { animation: hint 1.4s ease-in-out infinite; }
@keyframes hint { 0%, 50%, 100% { transform: none; filter: none; } 15% { transform: scale(1.14) rotate(-7deg); filter: brightness(1.35); } 30% { transform: scale(1.14) rotate(7deg); filter: brightness(1.35); } }
.tile.land .gem { animation: land .28s ease-out; }
@keyframes land { 0% { transform: scale(1.08, .86); } 55% { transform: scale(.97, 1.05); } 100% { transform: none; } }
.tile.born .gem { animation: born .45s cubic-bezier(.3,1.6,.5,1); }
@keyframes born { 0% { transform: scale(1.8); filter: brightness(3); } 100% { transform: none; filter: none; } }
.tile.pop .gem { animation: pop .32s ease-in forwards; }
@keyframes pop { 0% { transform: scale(1); filter: brightness(1); } 35% { transform: scale(1.28); filter: brightness(2.2); } 100% { transform: scale(0) rotate(25deg); opacity: 0; filter: brightness(3); } }
.board.targeting .tiles { cursor: crosshair; }
.board.targeting .tile:hover .gem { transform: scale(1.12); filter: brightness(1.3); }

/* Special jewels */
.stripes {
  position: absolute; inset: 0;
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  animation: stripeShine 1.3s ease-in-out infinite;
}
.stripes.h { background: linear-gradient(180deg, transparent 0 30%, #d9a73c 30% 32.5%, #fffbea 32.5% 42.5%, #d9a73c 42.5% 45%, transparent 45% 55%, #d9a73c 55% 57.5%, #fffbea 57.5% 67.5%, #d9a73c 67.5% 70%, transparent 70%); }
.stripes.v { background: linear-gradient(90deg, transparent 0 30%, #d9a73c 30% 32.5%, #fffbea 32.5% 42.5%, #d9a73c 42.5% 45%, transparent 45% 55%, #d9a73c 55% 57.5%, #fffbea 57.5% 67.5%, #d9a73c 67.5% 70%, transparent 70%); }
@keyframes stripeShine { 50% { filter: brightness(1.25); opacity: .85; } }
.tile[data-special="h"] .gem img, .tile[data-special="v"] .gem img { filter: drop-shadow(0 0 1cqw rgba(255,255,255,.55)) drop-shadow(0 .5cqw .5cqw rgba(0,0,0,.5)); }
.tile[data-special="bomb"] .gem::before {
  content: ''; position: absolute; inset: -10%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.75), rgba(255,220,120,.35) 40%, transparent 68%);
  animation: bombPulse 1s ease-in-out infinite;
}
.tile[data-special="bomb"] .gem::after {
  content: ''; position: absolute; inset: -6%; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent, #fff6cf 12%, transparent 25%, transparent 50%, #fff6cf 62%, transparent 75%);
  -webkit-mask: radial-gradient(circle, transparent 60%, #000 62%, #000 67%, transparent 69%);
  mask: radial-gradient(circle, transparent 60%, #000 62%, #000 67%, transparent 69%);
  animation: spin 1.6s linear infinite;
}
.tile[data-special="bomb"] .gem img { filter: brightness(1.2) drop-shadow(0 0 1.4cqw rgba(255,240,180,.95)); }
@keyframes bombPulse { 50% { scale: 1.18; opacity: .65; } }
.tile[data-special="rainbow"] .gem::before {
  content: ''; position: absolute; inset: -18%;
  background: repeating-conic-gradient(rgba(255,255,255,.55) 0deg 4deg, transparent 4deg 30deg);
  -webkit-mask: radial-gradient(circle, #000 15%, transparent 62%); mask: radial-gradient(circle, #000 15%, transparent 62%);
  animation: spin 6s linear infinite;
}
.tile[data-special="rainbow"] .gem img { animation: rbShine 1.6s ease-in-out infinite; }
@keyframes rbShine { 0%, 100% { filter: brightness(1) drop-shadow(0 0 1cqw #fff); } 50% { filter: brightness(1.3) drop-shadow(0 0 2.4cqw rgba(255,255,255,.95)); } }

/* Board FX */
.beam { position: absolute; pointer-events: none; mix-blend-mode: screen; }
.beam.h { left: -4%; right: -4%; height: 12.5%; animation: beamH .5s ease-out forwards; }
.beam.v { top: -4%; bottom: -4%; width: 12.5%; animation: beamV .5s ease-out forwards; }
.beam::before { content: ''; position: absolute; inset: 0; border-radius: 999px; background: var(--beam); filter: blur(.6cqw); }
.beam.h::before { --beam: linear-gradient(180deg, transparent, var(--c) 25%, #fff 45% 55%, var(--c) 75%, transparent); }
.beam.v::before { --beam: linear-gradient(90deg, transparent, var(--c) 25%, #fff 45% 55%, var(--c) 75%, transparent); }
@keyframes beamH { 0% { transform: scaleX(0) scaleY(.4); opacity: 1; } 35% { transform: scaleX(1) scaleY(1.1); opacity: 1; } 100% { transform: scaleX(1) scaleY(.1); opacity: 0; } }
@keyframes beamV { 0% { transform: scaleY(0) scaleX(.4); opacity: 1; } 35% { transform: scaleY(1) scaleX(1.1); opacity: 1; } 100% { transform: scaleY(1) scaleX(.1); opacity: 0; } }
.blast {
  position: absolute; border-radius: 50%; pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(circle, #fff 0%, rgba(255,240,190,.9) 22%, var(--c) 45%, transparent 70%);
  animation: blast .55s ease-out forwards;
}
@keyframes blast { 0% { transform: scale(.2); opacity: 1; } 60% { opacity: .9; } 100% { transform: scale(1.25); opacity: 0; } }
.ring {
  position: absolute; border-radius: 50%; pointer-events: none;
  border: 1cqw solid rgba(255,245,210,.9); box-shadow: 0 0 3cqw rgba(255,220,140,.9), inset 0 0 3cqw rgba(255,220,140,.9);
  animation: ring .6s ease-out forwards;
}
@keyframes ring { 0% { transform: scale(.1); opacity: 1; } 100% { transform: scale(1.3); opacity: 0; border-width: .1cqw; } }
.hammer-fx { position: absolute; width: 18%; pointer-events: none; transform-origin: 80% 80%; animation: hammer .45s cubic-bezier(.5,0,.6,1) forwards; filter: drop-shadow(0 1cqw 1cqw rgba(0,0,0,.6)); }
@keyframes hammer { 0% { transform: translate(40%, -60%) rotate(50deg) scale(1.2); opacity: 0; } 30% { opacity: 1; } 70% { transform: translate(0, 0) rotate(-25deg) scale(1); } 100% { transform: translate(0, 0) rotate(-20deg) scale(1); opacity: 0; } }
.pts {
  position: absolute; translate: -50% -50%; pointer-events: none; white-space: nowrap;
  font-family: var(--display); font-weight: 900; font-size: 5.2cqw;
  color: #fff6d6; text-shadow: 0 .35cqw 0 #6b3f06, 0 0 2cqw rgba(255,200,80,.9), 0 0 .6cqw #000;
  animation: pts 1s ease-out forwards;
}
@keyframes pts { 0% { transform: translateY(0) scale(.5); opacity: 0; } 20% { transform: translateY(-2cqw) scale(1.15); opacity: 1; } 100% { transform: translateY(-9cqw) scale(1); opacity: 0; } }
.fly { position: absolute; left: 0; top: 0; z-index: 35; pointer-events: none; object-fit: contain; filter: drop-shadow(0 0 1.4cqw rgba(255,255,255,.7)); }

/* Boosters */
.boosters { position: absolute; top: 150cqw; left: 8cqw; right: 14cqw; display: flex; justify-content: space-between; }
.booster { position: relative; width: 17.5cqw; height: 17.5cqw; transition: transform .15s, filter .2s; filter: drop-shadow(0 1.2cqw 1.4cqw rgba(0,0,0,.55)); }
.booster img { width: 100%; height: 100%; object-fit: contain; display: block; }
.booster:hover { transform: translateY(-.8cqw); }
.booster:active { transform: scale(.92); }
.booster.empty img { filter: grayscale(.9) brightness(.6); }
.booster.active { transform: translateY(-1.6cqw) scale(1.08); filter: drop-shadow(0 0 3cqw rgba(255,220,120,.95)) drop-shadow(0 1.2cqw 1.4cqw rgba(0,0,0,.55)); animation: boostActive 1s ease-in-out infinite; }
@keyframes boostActive { 50% { transform: translateY(-2.2cqw) scale(1.12); } }
.badge {
  position: absolute; right: -1cqw; bottom: -.8cqw;
  min-width: 7cqw; height: 7cqw; padding: 0 1.2cqw;
  display: grid; place-items: center;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, #ff8c98, #d8172f 55%, #8d0a1d);
  box-shadow: 0 0 0 .45cqw #ffd76a, 0 .6cqw 1cqw rgba(0,0,0,.5);
  font-family: var(--display); font-weight: 900; font-size: 4.2cqw; color: #fff; line-height: 1;
  text-shadow: 0 .25cqw 0 rgba(0,0,0,.4);
}
.booster.empty .badge { background: radial-gradient(circle at 35% 30%, #8fa0c0, #46557a 60%, #26304a); }
.booster-hint {
  position: absolute; left: 50%; top: 144cqw; translate: -50% 0; z-index: 5;
  display: flex; align-items: center; gap: 3cqw;
  padding: 1.6cqw 2cqw 1.6cqw 5cqw; border-radius: 999px;
  background: rgba(6,16,40,.92); box-shadow: 0 0 0 .35cqw #e9bf55, 0 1cqw 2cqw rgba(0,0,0,.5);
  font-weight: 800; font-size: 3.4cqw; color: #ffe9a8; white-space: nowrap;
  opacity: 0; pointer-events: none; transform: translateY(2cqw); transition: .25s;
}
.booster-hint.show { opacity: 1; pointer-events: auto; transform: none; }
.booster-hint button { padding: 1.2cqw 3cqw; border-radius: 999px; background: #c8213a; color: #fff; font-weight: 900; font-size: 3cqw; }

/* Callout */
.callout {
  position: absolute; left: 0; right: 0; top: 88cqw; z-index: 30;
  text-align: center; pointer-events: none;
  font-family: var(--deco); font-weight: 900; font-size: 11cqw; line-height: 1.05;
  opacity: 0;
}
.callout span {
  display: inline-block;
  background: linear-gradient(180deg, #fffdf0 0%, #ffe9a0 30%, #f7c044 52%, #c27b10 66%, #fff1b8 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 .5cqw 0 #3a1d02) drop-shadow(0 0 3cqw rgba(255,200,80,.8));
}
.callout.small { font-size: 7cqw; }
.callout.go { animation: callout 1.5s cubic-bezier(.2,1.4,.4,1) forwards; }
@keyframes callout { 0% { opacity: 0; transform: scale(.3) rotate(-6deg); } 18% { opacity: 1; transform: scale(1.1) rotate(2deg); } 30% { transform: scale(1) rotate(0); } 78% { opacity: 1; transform: scale(1.04); } 100% { opacity: 0; transform: scale(1.3); } }

/* ================= MODALS ================= */
.modal-layer {
  position: absolute; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at center, rgba(4,10,30,.55), rgba(2,5,15,.85));
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.modal-layer.show { opacity: 1; pointer-events: auto; }
.modal {
  position: relative; width: 84cqw;
  padding: 9cqw 6cqw 7cqw;
  border-radius: 5cqw;
  background:
    radial-gradient(ellipse 90% 40% at 50% 0%, rgba(120,180,255,.28), transparent 70%),
    linear-gradient(180deg, #1f4386 0%, #0e2556 55%, #081633 100%);
  box-shadow: 0 0 0 .5cqw #f8d878, 0 0 0 1cqw #7a4d0e, 0 0 0 1.3cqw #ffe7a0, 0 3cqw 8cqw rgba(0,0,0,.75), 0 0 10cqw rgba(80,150,255,.3), inset 0 .5cqw 0 rgba(255,255,255,.15);
  display: flex; flex-direction: column; align-items: center; text-align: center;
  transform: scale(.75) translateY(6cqw); opacity: 0;
  transition: transform .45s cubic-bezier(.2,1.5,.4,1), opacity .25s;
}
.modal-layer.show .modal { transform: none; opacity: 1; }
.modal .orn.t { top: -2.2cqw; }
.modal .orn.b { bottom: -2.2cqw; }
.m-ribbon {
  position: absolute; top: -6.5cqw; left: 50%; translate: -50% 0;
  padding: 2.2cqw 10cqw 2.6cqw;
  background: linear-gradient(180deg, #fff2b3, #f2b636 50%, #b97510);
  clip-path: polygon(0 0, 100% 0, 94% 50%, 100% 100%, 0 100%, 6% 50%);
  font-family: var(--display); font-weight: 900; font-size: 6.4cqw; letter-spacing: .06em; text-transform: uppercase;
  color: #4a2700; text-shadow: 0 .3cqw 0 rgba(255,245,210,.7); white-space: nowrap;
  filter: drop-shadow(0 1cqw 1cqw rgba(0,0,0,.5));
}
.m-sub { font-family: var(--display); font-weight: 700; font-size: 3.4cqw; letter-spacing: .25em; text-transform: uppercase; color: #9fc3ff; margin-bottom: 2cqw; }
.m-div { width: 56cqw; margin: 1cqw 0 3cqw; }
.m-text { font-size: 4cqw; font-weight: 700; color: #d6e6ff; line-height: 1.45; margin-bottom: 4cqw; }
.m-btns { display: flex; flex-direction: column; gap: 3.6cqw; align-items: center; width: 100%; margin-top: 2cqw; }
.m-btns.row { flex-direction: row; justify-content: center; }
.m-btns.row .btn { min-width: 0; flex: 1; padding: 0 2cqw; }
.m-btns .btn { min-width: 56cqw; }

.goal-cards { display: flex; gap: 4cqw; justify-content: center; margin: 2cqw 0 5cqw; }
.goal-card {
  width: 23cqw; padding: 3cqw 0 2.4cqw; border-radius: 3cqw;
  background: linear-gradient(180deg, #0c1f48, #081633);
  box-shadow: inset 0 0 0 .3cqw rgba(120,160,240,.3), inset 0 .8cqw 1.6cqw rgba(0,0,0,.5);
  display: flex; flex-direction: column; align-items: center; gap: 1cqw;
}
.goal-card .gi { width: 12cqw; height: 12cqw; object-fit: contain; filter: drop-shadow(0 .8cqw .8cqw rgba(0,0,0,.6)); }
.goal-card b { font-family: var(--display); font-weight: 900; font-size: 6cqw; }
.goal-card small { font-size: 2.6cqw; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #9fc3ff; }
.goal-card.done b { color: #6dff9b; }
.frost-icon {
  display: block; border-radius: 22%;
  background: linear-gradient(140deg, rgba(240,252,255,.9) 0%, rgba(140,205,255,.55) 45%, rgba(225,248,255,.85) 100%),
    repeating-linear-gradient(-60deg, rgba(255,255,255,.3) 0 .3cqw, transparent .3cqw 1.6cqw), #24508f;
  box-shadow: inset 0 0 0 .35cqw #fff, inset 0 0 1.6cqw rgba(160,220,255,.9), 0 0 1.4cqw rgba(140,210,255,.55);
}
.goal .frost-icon { width: 8cqw !important; height: 8cqw !important; }
.hud-goals.two .goal .frost-icon { width: 6.4cqw !important; height: 6.4cqw !important; }
.goal-card .frost-icon { width: 11cqw !important; height: 11cqw !important; margin: .5cqw; }

.info-row { display: flex; gap: 3cqw; margin-bottom: 4cqw; }
.chip { padding: 1.6cqw 4cqw; border-radius: 999px; background: rgba(4,12,32,.6); box-shadow: inset 0 0 0 .3cqw rgba(233,191,85,.6); font-weight: 800; font-size: 3.4cqw; color: #ffe9a8; }
.chip b { font-family: var(--display); font-weight: 900; color: #fff; }

.win-stars { display: flex; align-items: flex-end; justify-content: center; margin: 1cqw 0 3cqw; height: 26cqw; }
.win-stars img { width: 21cqw; filter: drop-shadow(0 1.2cqw 1.2cqw rgba(0,0,0,.6)); }
.win-stars img:nth-child(2) { width: 27cqw; margin: 0 -2cqw 4cqw; }
.win-stars.mini { height: 15cqw; margin: 0 0 1cqw; }
.win-stars.mini img { width: 12cqw; }
.win-stars.mini img:nth-child(2) { width: 15cqw; margin: 0 -1cqw 2.5cqw; }
.win-stars img.lit { animation: winStar .55s cubic-bezier(.3,1.7,.5,1); }
@keyframes winStar { 0% { transform: scale(2.4) rotate(-30deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.win-score { font-family: var(--display); font-weight: 900; font-size: 9cqw; line-height: 1.1; }
.win-label { font-size: 3cqw; font-weight: 900; letter-spacing: .25em; text-transform: uppercase; color: #9fc3ff; }
.win-best { font-size: 3.4cqw; font-weight: 800; color: #ffe9a8; margin: 1.4cqw 0 3cqw; }
.new-best { display: inline-block; margin-left: 1.5cqw; padding: .3cqw 2cqw; border-radius: 999px; background: #d8172f; color: #fff; font-size: 2.8cqw; letter-spacing: .1em; animation: breathe 1s infinite; }
.reward { display: flex; align-items: center; gap: 2.5cqw; padding: 1.4cqw 5cqw 1.4cqw 1.4cqw; border-radius: 999px; background: rgba(4,12,32,.6); box-shadow: inset 0 0 0 .3cqw rgba(233,191,85,.6); font-weight: 800; font-size: 3.6cqw; color: #ffe9a8; margin-bottom: 3cqw; }
.reward img { width: 10cqw; }

/* Settings */
.set-list { width: 100%; display: flex; flex-direction: column; gap: 2.2cqw; margin-bottom: 4cqw; }
.set-row {
  display: flex; align-items: center; gap: 3cqw;
  padding: 2.2cqw 3cqw; border-radius: 3cqw;
  background: linear-gradient(180deg, rgba(8,22,54,.8), rgba(6,16,40,.8));
  box-shadow: inset 0 0 0 .3cqw rgba(120,160,240,.2);
}
.set-ico { width: 8cqw; height: 8cqw; flex: none; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 40% 30%, #2d5fb8, #0c2152 70%); box-shadow: 0 0 0 .3cqw #e9bf55; color: var(--gold-2); }
.set-ico svg { width: 55%; height: 55%; }
.set-row label { flex: 1; text-align: left; font-weight: 800; font-size: 3.8cqw; color: #e8f1ff; white-space: nowrap; }
.set-row input[type=range] { width: 25cqw; -webkit-appearance: none; appearance: none; height: 2.4cqw; border-radius: 999px; background: linear-gradient(90deg, #f2b636 var(--p), #0a1430 var(--p)); box-shadow: 0 0 0 .3cqw #7a4d0e, inset 0 .3cqw .6cqw rgba(0,0,0,.5); outline: none; }
.set-row input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 6cqw; height: 6cqw; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fffbe0, #f2b636 55%, #a8640a); box-shadow: 0 0 0 .35cqw #3d2603, 0 .6cqw 1cqw rgba(0,0,0,.5); cursor: pointer; }
.set-row input[type=range]::-moz-range-thumb { width: 6cqw; height: 6cqw; border: 0; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fffbe0, #f2b636 55%, #a8640a); box-shadow: 0 0 0 .35cqw #3d2603; cursor: pointer; }
.toggle { position: relative; width: 15cqw; height: 7.6cqw; border-radius: 999px; background: #0a1430; box-shadow: 0 0 0 .3cqw #7a4d0e, inset 0 .4cqw .8cqw rgba(0,0,0,.6); transition: background .25s; flex: none; }
.toggle span { position: absolute; top: .8cqw; left: .8cqw; width: 6cqw; height: 6cqw; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #e8eefc, #8c9bbb 60%, #4a5675); box-shadow: 0 .4cqw .8cqw rgba(0,0,0,.5); transition: transform .25s cubic-bezier(.3,1.5,.5,1), background .25s; }
.toggle.on { background: linear-gradient(180deg, #2ec46a, #13883f); }
.toggle.on span { transform: translateX(7.4cqw); background: radial-gradient(circle at 35% 30%, #fffbe0, #f2b636 55%, #a8640a); }
.quick-row { display: flex; gap: 5cqw; justify-content: center; margin: 1cqw 0 5cqw; }
.quick-row .round-btn { width: 14cqw; height: 14cqw; }
.quick-row .round-btn.off { filter: grayscale(1) brightness(.6); }

#toast {
  position: absolute; left: 50%; top: 6cqw; z-index: 60;
  translate: -50% 0; max-width: 88cqw;
  padding: 2.4cqw 5cqw; border-radius: 999px;
  background: rgba(6,16,40,.95); box-shadow: 0 0 0 .35cqw #e9bf55, 0 1.4cqw 3cqw rgba(0,0,0,.6);
  font-weight: 800; font-size: 3.5cqw; color: #ffe9a8; text-align: center;
  opacity: 0; transform: translateY(-4cqw); transition: .3s; pointer-events: none;
}
#toast.show { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .rays, .btn::after, #app > .bg { animation: none; }
}
