:root {
  --bg: #05090d;
  --panel: #151b25;
  --panel-deep: #090f16;
  --line: #283241;
  --text: #f4f7fb;
  --muted: #96a3b4;
  --accent: #a8ff1f;
  --accent-rgb: 168, 255, 31;
  --accent-2: #ff9f13;
  --glow-a: rgba(168, 255, 31, 0.14);
  --glow-b: rgba(255, 118, 18, 0.10);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 13% 14%, var(--glow-a), transparent 30rem),
    radial-gradient(circle at 88% 76%, var(--glow-b), transparent 30rem),
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.035) 1px, transparent 1px),
    linear-gradient(rgba(var(--accent-rgb), 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, 62px 62px, 62px 62px, auto;
  transition: background 800ms ease;
}

body[data-theme="1"] { --accent: #53f6ff; --accent-rgb: 83, 246, 255; --accent-2: #a8ff1f; --glow-a: rgba(34, 224, 255, .16); --glow-b: rgba(104, 255, 120, .10); }
body[data-theme="2"] { --accent: #ffb11a; --accent-rgb: 255, 177, 26; --accent-2: #ff4e78; --glow-a: rgba(255, 168, 24, .17); --glow-b: rgba(255, 65, 111, .11); }
body[data-theme="3"] { --accent: #bd76ff; --accent-rgb: 189, 118, 255; --accent-2: #48e8ff; --glow-a: rgba(178, 94, 255, .18); --glow-b: rgba(56, 224, 255, .11); }
body[data-theme="4"] { --accent: #ff617d; --accent-rgb: 255, 97, 125; --accent-2: #ffc72e; --glow-a: rgba(255, 74, 107, .16); --glow-b: rgba(255, 190, 30, .10); }
body[data-theme="5"] { --accent: #54ffb0; --accent-rgb: 84, 255, 176; --accent-2: #33b8ff; --glow-a: rgba(65, 255, 168, .15); --glow-b: rgba(45, 155, 255, .11); }
body[data-theme="6"] { --accent: #62a5ff; --accent-rgb: 98, 165, 255; --accent-2: #dc72ff; --glow-a: rgba(74, 135, 255, .17); --glow-b: rgba(204, 87, 255, .11); }
body[data-theme="7"] { --accent: #f5ff4a; --accent-rgb: 245, 255, 74; --accent-2: #42f5d4; --glow-a: rgba(224, 255, 42, .14); --glow-b: rgba(55, 244, 205, .11); }
body[data-theme="8"] { --accent: #ff8754; --accent-rgb: 255, 135, 84; --accent-2: #ffd948; --glow-a: rgba(255, 118, 64, .16); --glow-b: rgba(255, 216, 52, .09); }
body[data-theme="9"] { --accent: #f46dff; --accent-rgb: 244, 109, 255; --accent-2: #78a8ff; --glow-a: rgba(237, 75, 255, .17); --glow-b: rgba(100, 152, 255, .11); }
body[data-theme="10"] { --accent: #ecff22; --accent-rgb: 236, 255, 34; --accent-2: #ff7a22; --glow-a: rgba(217, 255, 27, .16); --glow-b: rgba(255, 93, 30, .12); }
body[data-theme="11"] { --accent: #36f3ff; --accent-rgb: 54, 243, 255; --accent-2: #ff5ba6; --glow-a: rgba(40, 225, 255, .16); --glow-b: rgba(255, 62, 151, .11); }
body[data-theme="12"] { --accent: #9de8ff; --accent-rgb: 157, 232, 255; --accent-2: #806dff; --glow-a: rgba(127, 218, 255, .17); --glow-b: rgba(111, 84, 255, .12); }
body[data-theme="13"] { --accent: #ff385f; --accent-rgb: 255, 56, 95; --accent-2: #38e8ff; --glow-a: rgba(255, 39, 82, .16); --glow-b: rgba(32, 217, 255, .12); }
body[data-theme="14"] { --accent: #ff65d5; --accent-rgb: 255, 101, 213; --accent-2: #ffb633; --glow-a: rgba(255, 76, 203, .17); --glow-b: rgba(255, 166, 31, .11); }
body[data-theme="15"] { --accent: #7dff32; --accent-rgb: 125, 255, 50; --accent-2: #ffe82c; --glow-a: rgba(100, 255, 35, .15); --glow-b: rgba(255, 226, 30, .10); }
body[data-theme="16"] { --accent: #c5f4ff; --accent-rgb: 197, 244, 255; --accent-2: #4d9dff; --glow-a: rgba(180, 238, 255, .18); --glow-b: rgba(53, 137, 255, .12); }
body[data-theme="17"] { --accent: #ff9c3d; --accent-rgb: 255, 156, 61; --accent-2: #55e7c2; --glow-a: rgba(255, 133, 38, .16); --glow-b: rgba(50, 222, 184, .11); }
body[data-theme="18"] { --accent: #7efc9b; --accent-rgb: 126, 252, 155; --accent-2: #c16cff; --glow-a: rgba(94, 246, 130, .15); --glow-b: rgba(180, 79, 255, .12); }
body[data-theme="19"] { --accent: #ffffff; --accent-rgb: 255, 255, 255; --accent-2: #a8ff1f; --glow-a: rgba(255, 255, 255, .13); --glow-b: rgba(147, 255, 22, .12); }
body[data-theme="20"] { --accent: #ffd83d; --accent-rgb: 255, 216, 61; --accent-2: #ff7b22; --glow-a: rgba(255, 207, 37, .26); --glow-b: rgba(255, 94, 24, .18); }
body[data-theme="21"] { --accent: #63eaff; --accent-rgb: 99, 234, 255; --accent-2: #ffd33d; --glow-a: rgba(54, 220, 255, .25); --glow-b: rgba(255, 204, 44, .18); }
body[data-theme="22"] { --accent: #fff06a; --accent-rgb: 255, 240, 106; --accent-2: #ff8b2e; --glow-a: rgba(255, 228, 60, .27); --glow-b: rgba(255, 119, 31, .18); }
body[data-theme="23"] { --accent: #ffb45a; --accent-rgb: 255, 180, 90; --accent-2: #5af5ce; --glow-a: rgba(255, 153, 51, .24); --glow-b: rgba(55, 235, 190, .17); }
body[data-theme="24"] { --accent: #73ffbb; --accent-rgb: 115, 255, 187; --accent-2: #ffe052; --glow-a: rgba(77, 255, 164, .23); --glow-b: rgba(255, 217, 48, .18); }
body[data-theme="25"] { --accent: #8de9ff; --accent-rgb: 141, 233, 255; --accent-2: #fff170; --glow-a: rgba(108, 221, 255, .25); --glow-b: rgba(255, 235, 71, .18); }
body[data-theme="26"] { --accent: #d79aff; --accent-rgb: 215, 154, 255; --accent-2: #ffd33f; --glow-a: rgba(195, 107, 255, .24); --glow-b: rgba(255, 204, 42, .18); }
body[data-theme="27"] { --accent: #ffce2f; --accent-rgb: 255, 206, 47; --accent-2: #ff4d76; --glow-a: rgba(255, 188, 27, .27); --glow-b: rgba(255, 53, 102, .18); }
body[data-theme="28"] { --accent: #d8f6ff; --accent-rgb: 216, 246, 255; --accent-2: #6ca7ff; --glow-a: rgba(190, 240, 255, .24); --glow-b: rgba(78, 137, 255, .19); }
body[data-theme="29"] { --accent: #fff36a; --accent-rgb: 255, 243, 106; --accent-2: #ff55c8; --glow-a: rgba(255, 230, 50, .28); --glow-b: rgba(255, 54, 188, .2); }
body[data-theme="30"] { --accent: #72ffc5; --accent-rgb: 114, 255, 197; --accent-2: #a66bff; --glow-a: rgba(65, 255, 177, .3); --glow-b: rgba(150, 77, 255, .22); }
body[data-theme="31"] { --accent: #ff806d; --accent-rgb: 255, 128, 109; --accent-2: #58edff; --glow-a: rgba(255, 91, 74, .29); --glow-b: rgba(55, 222, 255, .21); }
body[data-theme="32"] { --accent: #61ff83; --accent-rgb: 97, 255, 131; --accent-2: #ffe13e; --glow-a: rgba(49, 255, 94, .28); --glow-b: rgba(255, 216, 38, .21); }
body[data-theme="33"] { --accent: #ff5eee; --accent-rgb: 255, 94, 238; --accent-2: #4bcbff; --glow-a: rgba(255, 55, 226, .3); --glow-b: rgba(55, 186, 255, .22); }
body[data-theme="34"] { --accent: #e9f3a0; --accent-rgb: 233, 243, 160; --accent-2: #76a8ff; --glow-a: rgba(219, 240, 119, .27); --glow-b: rgba(87, 139, 255, .23); }
body[data-theme="35"] { --accent: #53dfff; --accent-rgb: 83, 223, 255; --accent-2: #246eff; --glow-a: rgba(43, 202, 255, .31); --glow-b: rgba(35, 90, 255, .23); }
body[data-theme="36"] { --accent: #ffc553; --accent-rgb: 255, 197, 83; --accent-2: #9cff4b; --glow-a: rgba(255, 169, 48, .3); --glow-b: rgba(127, 255, 53, .2); }
body[data-theme="37"] { --accent: #ff73c8; --accent-rgb: 255, 115, 200; --accent-2: #9a5cff; --glow-a: rgba(255, 75, 181, .3); --glow-b: rgba(125, 67, 255, .23); }
body[data-theme="38"] { --accent: #82f7ff; --accent-rgb: 130, 247, 255; --accent-2: #7bffb2; --glow-a: rgba(96, 235, 255, .29); --glow-b: rgba(80, 255, 159, .21); }
body[data-theme="39"] { --accent: #f2f6ff; --accent-rgb: 242, 246, 255; --accent-2: #ff8e45; --glow-a: rgba(224, 235, 255, .26); --glow-b: rgba(255, 111, 43, .23); }
body[data-theme="40"] { --accent: #8bdcff; --accent-rgb: 139, 220, 255; --accent-2: #805cff; --glow-a: rgba(98, 201, 255, .3); --glow-b: rgba(101, 65, 255, .24); }
body[data-theme="41"] { --accent: #ffac85; --accent-rgb: 255, 172, 133; --accent-2: #ffef63; --glow-a: rgba(255, 139, 95, .29); --glow-b: rgba(255, 231, 70, .2); }
body[data-theme="42"] { --accent: #79ff70; --accent-rgb: 121, 255, 112; --accent-2: #45edc4; --glow-a: rgba(76, 255, 64, .28); --glow-b: rgba(42, 225, 181, .22); }
body[data-theme="43"] { --accent: #c77dff; --accent-rgb: 199, 125, 255; --accent-2: #ff6fae; --glow-a: rgba(179, 87, 255, .3); --glow-b: rgba(255, 77, 153, .22); }
body[data-theme="44"] { --accent: #55ffe1; --accent-rgb: 85, 255, 225; --accent-2: #438dff; --glow-a: rgba(44, 255, 215, .3); --glow-b: rgba(53, 119, 255, .23); }
body[data-theme="45"] { --accent: #ffe75c; --accent-rgb: 255, 231, 92; --accent-2: #ff7855; --glow-a: rgba(255, 213, 45, .3); --glow-b: rgba(255, 87, 60, .22); }
body[data-theme="46"] { --accent: #b6ff7b; --accent-rgb: 182, 255, 123; --accent-2: #8c67ff; --glow-a: rgba(154, 255, 84, .28); --glow-b: rgba(116, 77, 255, .23); }
body[data-theme="47"] { --accent: #ff65b8; --accent-rgb: 255, 101, 184; --accent-2: #5afff1; --glow-a: rgba(255, 62, 163, .31); --glow-b: rgba(63, 255, 235, .22); }
body[data-theme="48"] { --accent: #ffffff; --accent-rgb: 255, 255, 255; --accent-2: #78b7ff; --glow-a: rgba(255, 255, 255, .3); --glow-b: rgba(82, 152, 255, .24); }
body[data-theme="49"] { --accent: #dfff36; --accent-rgb: 223, 255, 54; --accent-2: #ff42d0; --glow-a: rgba(199, 255, 33, .32); --glow-b: rgba(255, 39, 193, .24); }
body[data-theme="50"] { --accent: #73dfff; --accent-rgb: 115, 223, 255; --accent-2: #ffdb4f; --glow-a: rgba(70, 207, 255, .3); --glow-b: rgba(255, 210, 48, .22); }
body[data-theme="51"] { --accent: #ff5cf4; --accent-rgb: 255, 92, 244; --accent-2: #62f5ff; --glow-a: rgba(255, 48, 232, .31); --glow-b: rgba(65, 229, 255, .23); }
body[data-theme="52"] { --accent: #75ff9b; --accent-rgb: 117, 255, 155; --accent-2: #6c7cff; --glow-a: rgba(72, 255, 118, .29); --glow-b: rgba(82, 99, 255, .24); }
body[data-theme="53"] { --accent: #ff9f76; --accent-rgb: 255, 159, 118; --accent-2: #c96cff; --glow-a: rgba(255, 120, 74, .3); --glow-b: rgba(181, 77, 255, .23); }
body[data-theme="54"] { --accent: #d5f7ff; --accent-rgb: 213, 247, 255; --accent-2: #ff5b43; --glow-a: rgba(186, 239, 255, .29); --glow-b: rgba(255, 63, 40, .24); }
body[data-theme="55"] { --accent: #b1ff57; --accent-rgb: 177, 255, 87; --accent-2: #65a7ff; --glow-a: rgba(143, 255, 45, .29); --glow-b: rgba(74, 139, 255, .23); }
body[data-theme="56"] { --accent: #ffc04f; --accent-rgb: 255, 192, 79; --accent-2: #43f1ce; --glow-a: rgba(255, 162, 41, .3); --glow-b: rgba(46, 227, 190, .22); }
body[data-theme="57"] { --accent: #bd70ff; --accent-rgb: 189, 112, 255; --accent-2: #45eaff; --glow-a: rgba(169, 75, 255, .31); --glow-b: rgba(45, 216, 255, .23); }
body[data-theme="58"] { --accent: #fff4b2; --accent-rgb: 255, 244, 178; --accent-2: #58ffb7; --glow-a: rgba(255, 234, 139, .29); --glow-b: rgba(65, 255, 166, .22); }
body[data-theme="59"] { --accent: #ffffff; --accent-rgb: 255, 255, 255; --accent-2: #dfff36; --glow-a: rgba(255,255,255,.31); --glow-b: rgba(202,255,38,.25); }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .52;
  background-image:
    linear-gradient(90deg, rgba(var(--accent-rgb), .13) 1px, transparent 1px),
    linear-gradient(rgba(var(--accent-rgb), .13) 1px, transparent 1px);
  background-size: 84px 84px;
  mask-image: radial-gradient(circle at center, #000, transparent 84%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 105%, rgba(var(--accent-rgb), .19), transparent 42%),
    radial-gradient(circle at 50% -10%, color-mix(in srgb, var(--accent-2), transparent 80%), transparent 36%),
    linear-gradient(125deg, transparent 20%, rgba(var(--accent-rgb), .035) 50%, transparent 78%);
}

body:is([data-theme="1"], [data-theme="12"], [data-theme="16"], [data-theme="25"])::before {
  background-image:
    linear-gradient(35deg, transparent 46%, rgba(var(--accent-rgb), .24) 47% 48%, transparent 49%),
    linear-gradient(145deg, transparent 46%, rgba(var(--accent-rgb), .16) 47% 48%, transparent 49%);
  background-size: 120px 95px;
}
body:is([data-theme="2"], [data-theme="8"], [data-theme="10"], [data-theme="22"], [data-theme="27"])::before {
  background-image: repeating-conic-gradient(from 205deg at 50% 110%, rgba(var(--accent-rgb), .2) 0 4deg, transparent 5deg 15deg);
  background-size: 100% 100%;
}
body:is([data-theme="3"], [data-theme="9"], [data-theme="18"], [data-theme="21"], [data-theme="23"])::before {
  background-image: repeating-radial-gradient(circle at 72% 38%, transparent 0 38px, rgba(var(--accent-rgb), .19) 40px 42px, transparent 44px 78px);
  background-size: 100% 100%;
}
body:is([data-theme="5"], [data-theme="7"], [data-theme="15"], [data-theme="24"], [data-theme="26"])::before {
  background-image:
    radial-gradient(ellipse at 25% 25%, rgba(var(--accent-rgb), .24) 0 5px, transparent 6px),
    radial-gradient(ellipse at 75% 70%, color-mix(in srgb, var(--accent-2), transparent 75%) 0 7px, transparent 8px);
  background-size: 92px 116px, 128px 94px;
}
body:is([data-theme="4"], [data-theme="11"], [data-theme="14"], [data-theme="19"], [data-theme="29"])::before {
  background-image:
    linear-gradient(112deg, transparent 0 43%, rgba(var(--accent-rgb), .2) 44% 45%, transparent 46% 100%),
    linear-gradient(68deg, transparent 0 53%, color-mix(in srgb, var(--accent-2), transparent 79%) 54% 55%, transparent 56% 100%);
  background-size: 180px 180px;
}
body:is([data-theme="20"], [data-theme="28"])::before {
  background-image:
    radial-gradient(circle, rgba(var(--accent-rgb), .26) 0 8px, rgba(var(--accent-rgb), .08) 9px 12px, transparent 13px),
    linear-gradient(90deg, rgba(var(--accent-rgb), .1) 1px, transparent 1px);
  background-size: 74px 74px, 92px 92px;
}
body:is([data-theme="30"], [data-theme="35"], [data-theme="38"], [data-theme="40"], [data-theme="44"])::before {
  background-image:
    repeating-radial-gradient(ellipse at 50% 120%, transparent 0 42px, rgba(var(--accent-rgb), .22) 44px 47px, transparent 49px 84px),
    linear-gradient(105deg, transparent 45%, color-mix(in srgb, var(--accent-2), transparent 77%) 46% 47%, transparent 48%);
  background-size: 100% 100%, 150px 150px;
}
body:is([data-theme="31"], [data-theme="34"], [data-theme="42"], [data-theme="46"])::before {
  background-image:
    radial-gradient(ellipse at 20% 30%, rgba(var(--accent-rgb), .25) 0 8px, transparent 9px),
    radial-gradient(ellipse at 75% 68%, color-mix(in srgb, var(--accent-2), transparent 70%) 0 11px, transparent 12px),
    radial-gradient(circle, rgba(var(--accent-rgb), .13) 0 2px, transparent 3px);
  background-size: 114px 92px, 146px 126px, 34px 34px;
}
body:is([data-theme="32"], [data-theme="36"], [data-theme="45"], [data-theme="49"])::before {
  background-image:
    linear-gradient(90deg, rgba(var(--accent-rgb), .2) 2px, transparent 2px),
    linear-gradient(rgba(var(--accent-rgb), .2) 2px, transparent 2px),
    linear-gradient(45deg, transparent 47%, color-mix(in srgb, var(--accent-2), transparent 75%) 48% 52%, transparent 53%);
  background-size: 78px 78px, 78px 78px, 156px 156px;
}
body:is([data-theme="33"], [data-theme="37"], [data-theme="41"], [data-theme="43"], [data-theme="47"])::before {
  background-image:
    repeating-conic-gradient(from 20deg at 75% 35%, rgba(var(--accent-rgb), .18) 0 8deg, transparent 9deg 24deg),
    repeating-radial-gradient(circle at 22% 70%, transparent 0 28px, color-mix(in srgb, var(--accent-2), transparent 76%) 30px 32px, transparent 34px 62px);
  background-size: 100% 100%;
}
body:is([data-theme="39"], [data-theme="48"])::before {
  background-image:
    radial-gradient(circle at 20% 20%, #fff9 0 2px, transparent 3px),
    radial-gradient(circle at 70% 60%, rgba(var(--accent-rgb), .35) 0 3px, transparent 4px),
    linear-gradient(125deg, transparent 45%, rgba(var(--accent-rgb), .2) 46% 47%, transparent 48%);
  background-size: 66px 66px, 104px 104px, 180px 180px;
}
body:is([data-theme="50"], [data-theme="52"], [data-theme="55"], [data-theme="58"])::before {
  background-image:
    repeating-radial-gradient(circle at 30% 70%, transparent 0 34px, rgba(var(--accent-rgb), .23) 36px 39px, transparent 41px 76px),
    linear-gradient(60deg, transparent 47%, color-mix(in srgb, var(--accent-2), transparent 73%) 48% 51%, transparent 52%);
  background-size: 100% 100%, 140px 140px;
}
body:is([data-theme="51"], [data-theme="53"], [data-theme="57"], [data-theme="59"])::before {
  background-image:
    repeating-conic-gradient(from 10deg at 68% 38%, rgba(var(--accent-rgb), .2) 0 7deg, transparent 8deg 21deg),
    radial-gradient(circle at 18% 76%, color-mix(in srgb, var(--accent-2), transparent 70%) 0 6px, transparent 7px);
  background-size: 100% 100%, 90px 90px;
}
body:is([data-theme="54"], [data-theme="56"])::before {
  background-image:
    linear-gradient(120deg, transparent 43%, rgba(var(--accent-rgb), .22) 44% 46%, transparent 47%),
    linear-gradient(60deg, transparent 53%, color-mix(in srgb, var(--accent-2), transparent 73%) 54% 56%, transparent 57%);
  background-size: 124px 124px;
}

.game-shell { position: relative; z-index: 1; }

button, a { font: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
button { color: inherit; }
h1, h2, p { margin: 0; }

.is-hidden { display: none !important; }

.map-screen {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  width: min(1280px, 100%);
  height: 100dvh;
  margin: 0 auto;
  padding: clamp(12px, 2vw, 26px);
}
.map-header {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 18px;
  padding: 0 0 16px;
}
.map-header .brand { margin: 0; }
.map-progress-panel {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 54px;
  padding: 8px 10px 8px 20px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: rgba(15,22,31,.92);
  box-shadow: 0 16px 45px rgba(0,0,0,.25);
}
.map-progress-panel span { color: var(--muted); font-size: 14px; font-weight: 800; }
.map-progress-panel strong { color: var(--accent); font-size: 18px; }
.map-progress-panel button {
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  color: #071005;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}
.map-progress-panel .infinity-button {
  color: #effaff;
  border: 1px solid rgba(var(--accent-rgb), .42);
  background: rgba(var(--accent-rgb), .12);
}
.map-home { min-height: 54px; padding-inline: 24px; }
.map-viewport {
  position: relative;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border: 2px solid rgba(var(--accent-rgb), .24);
  border-radius: 30px;
  background: #070c12;
  box-shadow: inset 0 0 40px rgba(0,0,0,.38), 0 24px 80px rgba(0,0,0,.34);
  scroll-behavior: smooth;
  scrollbar-color: var(--accent) #111923;
  scrollbar-gutter: stable;
}
.map-viewport::-webkit-scrollbar { width: 14px; }
.map-viewport::-webkit-scrollbar-track {
  margin-block: 18px;
  border-radius: 999px;
  background: #111923;
}
.map-viewport::-webkit-scrollbar-thumb {
  border: 3px solid #111923;
  border-radius: 999px;
  background: var(--accent);
  background-clip: padding-box;
}
.level-map {
  position: relative;
  width: 100%;
  min-height: 100%;
  overflow: hidden;
}
.map-zone {
  position: absolute;
  inset-inline: 0;
  z-index: 0;
  overflow: hidden;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.map-zone::before,
.map-zone::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 28%, var(--zone-a), transparent 36%),
    radial-gradient(circle at 82% 72%, var(--zone-b), transparent 38%),
    linear-gradient(120deg, transparent, rgba(255,255,255,.025), transparent);
}
.map-zone::after {
  opacity: .34;
  background-image:
    linear-gradient(90deg, var(--zone-line) 1px, transparent 1px),
    linear-gradient(var(--zone-line) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: rotate(-6deg) scale(1.2);
}
.map-zone:not(.first-zone)::before,
.map-zone:not(.first-zone)::after {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 120px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 120px);
}
.level-map-svg {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  overflow: visible;
}
.map-road-shadow {
  fill: none;
  stroke: rgba(0,0,0,.58);
  stroke-width: 18;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.map-road {
  fill: none;
  stroke: rgba(255,255,255,.28);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 8px rgba(var(--accent-rgb),.25));
}
.map-node {
  cursor: pointer;
  outline: none;
}
.map-node .node-halo {
  fill: rgba(7,12,18,.82);
  stroke: rgba(255,255,255,.16);
  stroke-width: 3;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 160ms ease, fill 160ms ease, stroke 160ms ease;
}
.map-node .node-number {
  fill: #f5f8fb;
  font-size: 15px;
  font-weight: 900;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}
.map-node .node-stars {
  font-size: 14px;
  font-weight: 900;
  text-anchor: middle;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(0,0,0,.75);
  stroke-width: 3px;
}
.star-earned { color: #ffd846; fill: #ffd846; }
.star-empty { color: #6f7986; fill: #6f7986; text-shadow: none; }
.map-node.completed .node-halo { fill: var(--node-color); stroke: #fff9; }
.map-node.current .node-halo {
  fill: var(--node-color);
  stroke: #fff;
  stroke-width: 5;
  filter: drop-shadow(0 0 13px var(--node-color));
  animation: mapCurrent 1.2s ease-in-out infinite alternate;
}
.map-node.locked { cursor: not-allowed; opacity: .35; }
.map-node.locked .node-number { fill: #8792a1; }
.map-node:hover:not(.locked) .node-halo,
.map-node:focus-visible:not(.locked) .node-halo { transform: scale(1.12); stroke: #fff; }
.map-chapter-badge,
.map-infinity-badge { pointer-events: none; }
.map-chapter-box {
  fill: rgba(8,14,21,.92);
  stroke: var(--chapter-color);
  stroke-width: 2px;
  filter: drop-shadow(0 8px 13px rgba(0,0,0,.42));
}
.map-chapter-label {
  fill: #f7fbff;
  font-size: 15px;
  font-weight: 900;
  text-anchor: middle;
  dominant-baseline: middle;
  letter-spacing: .055em;
}
.map-stage-requirement {
  fill: #aeb9c6;
  font-size: 11px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: middle;
  letter-spacing: .02em;
}
.map-infinity-label {
  fill: #ecfbff;
  font-size: 17px;
  font-weight: 900;
  text-anchor: middle;
  dominant-baseline: middle;
  letter-spacing: .055em;
}
.result-stars {
  min-height: 36px;
  color: #ffd846;
  font-size: 31px;
  letter-spacing: .12em;
  text-shadow: 0 0 14px rgba(255,216,70,.42);
}
.result-stars:empty { display: none; }
.star-criteria {
  margin-top: -4px !important;
  color: #b7c2cf !important;
  font-size: 13px !important;
  font-weight: 800;
}
.star-criteria span,
.star-threshold-list span { display: block; }
.star-criteria span + span,
.star-threshold-list span + span { margin-top: 4px; }

@keyframes mapCurrent { to { filter: drop-shadow(0 0 22px var(--node-color)); } }

.game-shell {
  display: grid;
  grid-template-columns: minmax(210px, 280px) minmax(460px, 680px) minmax(190px, 250px);
  gap: clamp(16px, 2vw, 32px);
  align-items: start;
  width: min(1480px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: clamp(14px, 2vw, 30px);
}

.side-panel { min-width: 0; }

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 18px;
  color: inherit;
  text-decoration: none;
}

.brand:hover .brand-mark,
.brand:focus-visible .brand-mark {
  box-shadow: 0 0 44px rgba(184, 255, 46, .4);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  border-radius: 17px;
  color: #0a0f14;
  background: linear-gradient(135deg, #b8ff2e, #5ce677);
  font-size: 23px;
  font-weight: 900;
  box-shadow: 0 8px 24px rgba(184, 255, 46, .25);
}

h1 { font-size: clamp(24px, 2vw, 31px); line-height: 1; font-weight: 900; }
.brand p { margin-top: 5px; color: var(--muted); font-size: 14px; }

.panel {
  border: 2px solid var(--line);
  border-radius: 22px;
  background: rgba(21, 27, 37, .92);
  box-shadow: 0 18px 70px rgba(0, 0, 0, .25);
}

.brand-panel .panel, .action-panel .panel { margin-bottom: 14px; padding: 18px; }
.eyebrow { display: block; color: var(--muted); font-size: 13px; font-weight: 900; letter-spacing: .06em; }

.level-line {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 10px;
  margin: 8px 0 10px;
}

.level-line > strong { text-align: center; font-size: 50px; line-height: 1; }

.round-button {
  width: 40px;
  aspect-ratio: 1;
  border: 2px solid rgba(255,255,255,.08);
  border-radius: 50%;
  color: var(--text);
  background: #0a1119;
  font-size: 28px;
  cursor: pointer;
}

.round-button:disabled { opacity: .28; cursor: default; }
.progress-track { height: 7px; overflow: hidden; border-radius: 99px; background: #080e15; }
.progress-track span { display: block; width: 1%; height: 100%; border-radius: inherit; background: var(--accent); transition: width 400ms ease, background 700ms ease; }
.level-panel small { display: block; margin-top: 9px; color: var(--muted); }

.stats-panel { display: grid; gap: 11px; }
.stats-panel div { display: flex; justify-content: space-between; gap: 10px; }
.stats-panel .stats-stars {
  flex-direction: column;
  align-items: stretch;
  margin-top: 3px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.stats-panel .stats-stars strong {
  display: grid;
  gap: 4px;
  color: #ffd846;
  font-size: 11px;
}
.stats-panel span { color: var(--muted); }
.stats-panel strong { font-size: 18px; }

.controls-panel h2 { margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.controls-panel p { color: var(--text); font-size: 14px; line-height: 1.45; }
.controls-panel p + p { margin-top: 9px; color: var(--muted); }

.play-area {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: 100%;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 0 4px;
}
.topbar > div:first-child { flex: 1 1 auto; min-width: 0; }
.topbar > div:first-child strong {
  display: -webkit-box;
  margin-top: 5px;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.moves-pill { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 17px; border: 2px solid var(--line); border-radius: 99px; background: rgba(21,27,37,.9); }
.moves-pill { flex: 0 0 auto; }
.moves-pill span { color: var(--muted); font-size: 12px; font-weight: 900; }
.moves-pill strong { color: var(--accent); font-size: 24px; }
.top-map-button {
  min-height: 44px;
  padding: 0 17px;
  flex: 0 0 auto;
  border: 2px solid rgba(var(--accent-rgb), .34);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(9,15,22,.78);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.board-shell {
  position: relative;
  width: min(100%, 680px, calc(100dvh - 128px));
  padding: clamp(8px, 1.2vw, 15px);
  overflow: hidden;
  border: 3px solid rgba(var(--accent-rgb), .24);
  border-radius: 30px;
  background: rgba(10, 16, 23, .94);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .06), 0 24px 80px rgba(0,0,0,.36), 0 0 42px rgba(var(--accent-rgb),.07);
  transition: border-color 700ms ease;
}

.board {
  display: grid;
  grid-template-columns: repeat(var(--board-size, 8), 1fr);
  gap: clamp(4px, .65vw, 8px);
  width: 100%;
  aspect-ratio: 1;
  touch-action: none;
}

.cell {
  position: relative;
  min-width: 0;
  padding: 0;
  border: 1px solid rgba(255,255,255,.055);
  border-radius: clamp(8px, 1vw, 15px);
  background: rgba(4, 9, 15, .74);
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

@media (hover:hover) {
  .cell:hover { border-color: rgba(255,255,255,.16); background: rgba(13,21,31,.9); transform: translateY(-2px); }
}

.cell.selected { z-index: 2; border-color: var(--accent); background: rgba(var(--accent-rgb), .08); transform: scale(1.05); box-shadow: 0 0 20px rgba(var(--accent-rgb), .15); }
.cell.drag-ready {
  z-index: 2;
  border-color: rgba(var(--accent-rgb), .42);
  background: rgba(var(--accent-rgb), .06);
  transform: scale(1.025);
}
.cell.drag-source {
  border-color: rgba(var(--accent-rgb), .55);
  background: rgba(var(--accent-rgb), .08);
}
.cell.drag-source .gem,
.cell.drag-source .coin,
.cell.drag-source .bomb-counter { opacity: 0; }
.cell.drop-target {
  z-index: 3;
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), .16);
  transform: scale(1.07);
  box-shadow: inset 0 0 18px rgba(var(--accent-rgb), .16), 0 0 22px rgba(var(--accent-rgb), .2);
}
.cell.hint {
  z-index: 3;
  animation: hint 900ms ease 2;
}
.cell.hint .gem { animation: hintGem 900ms ease 2; }
.cell.frozen {
  cursor: not-allowed;
  border-color: rgba(168, 231, 255, .48);
  background: rgba(63, 153, 190, .13);
  box-shadow: inset 0 0 18px rgba(116, 220, 255, .16);
}
.cell.frozen:hover { transform: none; }

.frost {
  position: absolute;
  z-index: 5;
  inset: 2px;
  display: grid;
  place-items: center;
  overflow: hidden;
  pointer-events: none;
  border: 2px solid rgba(211, 247, 255, .72);
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(231, 251, 255, .28), transparent 38%),
    linear-gradient(40deg, transparent 42%, rgba(192, 241, 255, .32) 43% 47%, transparent 48%),
    rgba(68, 182, 224, .12);
  box-shadow: inset 0 0 16px rgba(202, 245, 255, .35), 0 0 12px rgba(76, 201, 255, .18);
  backdrop-filter: blur(1.2px);
}
.frost::before, .frost::after {
  content: "";
  position: absolute;
  width: 140%;
  height: 2px;
  background: rgba(220, 249, 255, .55);
  transform: rotate(34deg);
}
.frost::after { transform: rotate(-48deg); }
.frost span {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: clamp(16px, 45%, 29px);
  aspect-ratio: 1;
  border: 2px solid rgba(255,255,255,.72);
  border-radius: 50%;
  color: #06131b;
  background: rgba(215, 248, 255, .9);
  font-size: 15px;
  font-weight: 900;
  box-shadow: 0 2px 10px rgba(0,0,0,.3);
}
.cell.ice-hit { animation: iceHit 380ms ease; }
.cell.ice-break .frost { animation: iceBreak 420ms ease forwards; }
.cell.ice-denied { animation: iceDenied 360ms ease; }
.cell.chained {
  cursor: not-allowed;
  border-color: rgba(185, 199, 214, .42);
}
.chain-overlay {
  position: absolute;
  z-index: 6;
  inset: 3px;
  display: grid;
  place-items: center;
  overflow: hidden;
  pointer-events: none;
  border-radius: inherit;
}
.chain-overlay::before,
.chain-overlay::after {
  content: "";
  position: absolute;
  width: 145%;
  height: 9px;
  border: 2px solid #d5dee7;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, #4e5b69 0 9px, #b9c5d0 10px 15px);
  box-shadow: 0 2px 7px #0009, inset 0 1px 2px #fff6;
  transform: rotate(42deg);
}
.chain-overlay::after { transform: rotate(-42deg); }
.chain-overlay span {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: clamp(16px, 45%, 25px);
  aspect-ratio: 1;
  border: 2px solid #e3ebf2;
  border-radius: 50%;
  color: #f5f8fb;
  background: #202a35;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 2px 8px #000b;
}
.cell.chain-hit { animation: chainHit 380ms ease; }
.cell.chain-break .chain-overlay { animation: chainBreak 460ms ease forwards; }
.cell.chain-denied { animation: iceDenied 360ms ease; }

.cell.bomb-cell {
  border-color: rgba(255, 83, 61, .48);
  box-shadow: inset 0 0 17px rgba(255,54,39,.13);
}
.bomb-counter {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 7;
  display: grid;
  place-items: center;
  width: clamp(16px, 45%, 25px);
  aspect-ratio: 1;
  border: 2px solid #ffc3a8;
  border-radius: 50%;
  color: #fff;
  background: #d9362d;
  box-shadow: 0 0 10px rgba(255,54,39,.7);
  font-size: 11px;
  font-weight: 900;
  animation: bombTick 900ms ease-in-out infinite alternate;
}

.gem, .gem-preview {
  --gem: #a8ff1f;
  position: absolute;
  inset: 14%;
  display: block;
  background: linear-gradient(145deg, color-mix(in srgb, var(--gem), white 24%), var(--gem) 54%, color-mix(in srgb, var(--gem), black 26%));
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.12), inset -8px -9px 13px rgba(0,0,0,.15), 0 7px 16px color-mix(in srgb, var(--gem), transparent 72%);
  transition: transform 180ms ease, opacity 180ms ease;
}

.gem::after, .gem-preview::after {
  content: "";
  position: absolute;
  inset: 15% 52% 52% 17%;
  border-radius: 50%;
  background: rgba(255,255,255,.48);
  filter: blur(1px);
}

.gem.special-stripe-h::before,
.gem.special-stripe-v::before {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 3%;
  border-radius: inherit;
  background: linear-gradient(0deg,
    transparent 0 22%,
    rgba(255,255,255,.88) 23% 34%,
    transparent 35% 62%,
    rgba(255,255,255,.72) 63% 74%,
    transparent 75%);
  filter: drop-shadow(0 0 5px rgba(255,255,255,.8));
}

.gem.special-stripe-v::before {
  background: linear-gradient(90deg,
    transparent 0 22%,
    rgba(255,255,255,.88) 23% 34%,
    transparent 35% 62%,
    rgba(255,255,255,.72) 63% 74%,
    transparent 75%);
}

.gem.special-burst {
  outline: 3px solid rgba(255,255,255,.72);
  outline-offset: -4px;
  box-shadow: inset 0 0 14px rgba(255,255,255,.38), 0 0 20px color-mix(in srgb, var(--gem), white 25%) !important;
}
.gem.special-burst::before {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 8%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, transparent 30%, rgba(255,255,255,.7) 31% 34%, transparent 35% 65%, rgba(255,255,255,.7) 66% 69%, transparent 70%),
    linear-gradient(transparent 30%, rgba(255,255,255,.7) 31% 34%, transparent 35% 65%, rgba(255,255,255,.7) 66% 69%, transparent 70%);
  filter: drop-shadow(0 0 4px rgba(255,255,255,.75));
}
.gem.special-burst .bonus-mark {
  width: 58%;
  border-radius: 10px;
  font-size: clamp(9px, 1.5vw, 14px);
}
.gem.special-mystery {
  background: conic-gradient(from 30deg, #ff5dbb, #765cff, #35e8ff, #a8ff1f, #ffe34d, #ff5dbb) !important;
  box-shadow: inset 0 0 16px #fff6, 0 0 18px rgba(160,106,255,.58) !important;
}
.gem.special-mystery::before {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 9%;
  border-radius: inherit;
  background: radial-gradient(circle, transparent 35%, rgba(8,12,20,.45) 38% 52%, transparent 55%);
}

.bonus-mark {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 52%;
  aspect-ratio: 1;
  border: 2px solid rgba(255,255,255,.76);
  border-radius: 50%;
  color: #fff;
  background: rgba(5, 10, 16, .72);
  box-shadow: 0 0 10px rgba(255,255,255,.48), inset 0 0 7px rgba(255,255,255,.14);
  font-size: clamp(14px, 2.3vw, 24px);
  font-weight: 900;
  line-height: 1;
  transform: translate(-50%, -50%);
}

.gem.special-color .bonus-mark {
  width: 46%;
  color: #071015;
  background: rgba(255,255,255,.86);
  text-shadow: 0 0 7px #fff;
}

.gem.special-color {
  inset: 12% !important;
  border-radius: 50% !important;
  clip-path: none !important;
  background:
    radial-gradient(circle at 37% 30%, #fff 0 5%, transparent 7%),
    conic-gradient(#ff4568, #ffbd22, #a8ff1f, #22e8ef, #7b72ff, #ee59ff, #ff4568) !important;
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.22), inset -8px -9px 15px rgba(0,0,0,.2), 0 0 22px rgba(255,255,255,.24) !important;
  animation: colorPulse 1.9s ease-in-out infinite alternate;
  transform: none !important;
}
.gem.special-color::after { inset: 17% 55% 56% 20%; transform: none !important; }

.gem:is(.special-stripe-h, .special-stripe-v, .special-burst, .special-mystery) {
  animation: bonusAura 1.8s ease-in-out infinite alternate;
}
.gem:is(.special-stripe-h, .special-stripe-v, .special-burst, .special-mystery) .bonus-mark {
  animation: bonusMarkPulse 1.6s ease-in-out infinite alternate;
}
.cell.bonus-created { z-index: 6; }
.cell.bonus-created .gem { animation: bonusBorn 520ms cubic-bezier(.16,.9,.28,1.28) both; }

.cell.bonus-fire {
  z-index: 4;
  border-color: #fff;
  box-shadow: 0 0 28px var(--accent), inset 0 0 20px rgba(255,255,255,.3);
}

.bonus-beam,
.bonus-burst-effect,
.color-wave {
  position: absolute;
  z-index: 8;
  display: block;
  pointer-events: none;
}
.bonus-beam {
  overflow: hidden;
  border: 2px solid rgba(255,255,255,.85);
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb),.9), #fff, rgba(var(--accent-rgb),.9), transparent);
  box-shadow: 0 0 14px #fff, 0 0 30px rgba(var(--accent-rgb),.85);
}
.bonus-beam::before {
  content: "";
  position: absolute;
  inset: 30% 0;
  border-radius: inherit;
  background: #fff;
  box-shadow: 0 0 16px #fff;
}
.bonus-beam::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, #fff 0 2px, transparent 3px);
  background-size: 22px 100%;
  animation: beamParticles 340ms linear infinite;
}
.beam-h {
  transform: translateY(-50%);
  animation: beamRevealH 720ms cubic-bezier(.2,.8,.25,1) both;
}
.beam-v {
  background: linear-gradient(0deg, transparent, rgba(var(--accent-rgb),.9), #fff, rgba(var(--accent-rgb),.9), transparent);
  transform: translateX(-50%);
  animation: beamRevealV 720ms cubic-bezier(.2,.8,.25,1) both;
}
.beam-v::before { inset: 0 30%; }
.beam-v::after {
  background-size: 100% 22px;
  animation-name: beamParticlesV;
}
.bonus-burst-effect {
  border: 4px solid #fff;
  border-radius: 28%;
  background:
    linear-gradient(90deg, transparent 32%, rgba(255,255,255,.5) 33% 35%, transparent 36% 64%, rgba(255,255,255,.5) 65% 67%, transparent 68%),
    linear-gradient(transparent 32%, rgba(255,255,255,.5) 33% 35%, transparent 36% 64%, rgba(255,255,255,.5) 65% 67%, transparent 68%),
    radial-gradient(circle, rgba(var(--accent-rgb),.72), transparent 68%);
  box-shadow: inset 0 0 32px #fff8, 0 0 24px #fff, 0 0 56px rgba(var(--accent-rgb),.9);
  transform: translate(-50%, -50%);
  animation: burstGrid 760ms cubic-bezier(.16,.85,.25,1) both;
}
.color-wave {
  border: 6px solid #fff;
  border-radius: 50%;
  background: conic-gradient(from 90deg, #ff456855, #ffbd2255, #a8ff1f55, #22e8ef55, #7b72ff55, #ee59ff55, #ff456855);
  box-shadow: 0 0 35px #fff, inset 0 0 55px #fff8;
  transform: translate(-50%, -50%);
  animation: colorWave 800ms ease-out both;
}

.drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  pointer-events: none;
  will-change: transform;
  filter: drop-shadow(0 10px 9px rgba(0,0,0,.38));
  animation: grab 130ms ease both;
}

.drag-ghost .gem {
  opacity: 1;
}
.drag-ghost .coin {
  opacity: 1;
  animation: none;
}
.drag-ghost .bomb-counter { opacity: 1; }

.gem[data-type="0"], .gem-preview[data-type="0"] {
  --gem: #a8ff1f;
  border-radius: 30%;
  clip-path: none;
  transform: rotate(45deg) scale(.82);
}
.gem[data-type="1"], .gem-preview[data-type="1"] {
  --gem: #ff9f13;
  border-radius: 50%;
  clip-path: none;
}
.gem[data-type="2"], .gem-preview[data-type="2"] {
  --gem: #25e9ef;
  inset: 22% 8%;
  border-radius: 48%;
  clip-path: none;
}
.gem[data-type="3"], .gem-preview[data-type="3"] {
  --gem: #ff4767;
  inset: 13%;
  border-radius: 34%;
  clip-path: none;
}
.gem[data-type="4"], .gem-preview[data-type="4"] {
  --gem: #a36cff;
  border-radius: 52% 25% 52% 25%;
  clip-path: none;
  transform: rotate(45deg) scale(.86);
}
.gem[data-type="5"], .gem-preview[data-type="5"] {
  --gem: #ffe23c;
  inset: 11% 17% 15%;
  border-radius: 55% 55% 46% 46% / 68% 68% 38% 38%;
  clip-path: none;
}

.gem[data-type="0"]:not(.special-color) .bonus-mark,
.gem[data-type="4"]:not(.special-color) .bonus-mark { transform: translate(-50%, -50%) rotate(-45deg); }

body[data-skin="1"] .gem, body[data-skin="1"] .gem-preview { background: radial-gradient(circle at 31% 25%, #fff9 0 7%, transparent 9%), radial-gradient(circle at 68% 74%, color-mix(in srgb, var(--gem), white 24%), var(--gem) 58%, color-mix(in srgb, var(--gem), black 16%)); filter: saturate(1.08); box-shadow: inset 7px 8px 15px rgba(255,255,255,.13), inset -9px -10px 16px rgba(0,0,0,.16), 0 8px 19px color-mix(in srgb, var(--gem), transparent 68%); }
body[data-skin="2"] .gem, body[data-skin="2"] .gem-preview { background: linear-gradient(35deg, color-mix(in srgb, var(--gem), black 22%), var(--gem) 48%, color-mix(in srgb, var(--gem), white 30%)); box-shadow: inset 0 0 0 3px rgba(255,255,255,.22), 0 0 18px color-mix(in srgb, var(--gem), transparent 63%); }
body[data-skin="3"] .gem, body[data-skin="3"] .gem-preview { background: radial-gradient(ellipse at 38% 26%, color-mix(in srgb, var(--gem), white 42%) 0 12%, transparent 14%), linear-gradient(160deg, color-mix(in srgb, var(--gem), white 19%), var(--gem) 42%, color-mix(in srgb, var(--gem), #111827 38%)); box-shadow: inset 8px 10px 18px rgba(255,255,255,.1), inset -10px -12px 18px rgba(4,8,15,.28), 0 9px 22px color-mix(in srgb, var(--gem), transparent 62%); filter: contrast(1.08); }
body[data-skin="4"] .gem, body[data-skin="4"] .gem-preview { background: linear-gradient(155deg, #fff8 0 7%, transparent 9%), linear-gradient(145deg, color-mix(in srgb, var(--gem), #fff 38%), var(--gem) 48%, color-mix(in srgb, var(--gem), #392100 34%)); box-shadow: inset 0 0 0 4px rgba(255,226,128,.3), inset -8px -10px 14px rgba(63,34,0,.22), 0 0 22px color-mix(in srgb, var(--gem), transparent 55%); }
body[data-skin="5"] .gem, body[data-skin="5"] .gem-preview { background: linear-gradient(115deg, transparent 0 24%, #fff7 27%, transparent 31% 58%, color-mix(in srgb, var(--gem), white 34%) 62%, transparent 67%), linear-gradient(145deg, color-mix(in srgb, var(--gem), white 27%), var(--gem) 46%, color-mix(in srgb, var(--gem), #122044 31%)); box-shadow: inset 9px 8px 15px rgba(255,255,255,.11), inset -9px -10px 17px rgba(3,10,30,.24), 0 0 23px color-mix(in srgb, var(--gem), transparent 53%); filter: saturate(1.17) brightness(1.04); }
body[data-skin="6"] .gem, body[data-skin="6"] .gem-preview { background: radial-gradient(circle at 35% 28%, #fff8 0 6%, transparent 8%), linear-gradient(145deg, color-mix(in srgb, var(--gem), white 48%), color-mix(in srgb, var(--gem), white 14%) 55%, var(--gem)); box-shadow: inset -8px -9px 15px rgba(0,0,0,.09), 0 10px 18px rgba(0,0,0,.2); filter: saturate(.82) brightness(1.12); }
body[data-skin="7"] .gem, body[data-skin="7"] .gem-preview { background: radial-gradient(circle, color-mix(in srgb, var(--gem), #050812 58%) 0 28%, var(--gem) 32% 55%, color-mix(in srgb, var(--gem), white 38%) 76%, var(--gem)); box-shadow: inset 0 0 18px color-mix(in srgb, var(--gem), white 35%), 0 0 20px color-mix(in srgb, var(--gem), transparent 46%); filter: saturate(1.34); }
body[data-skin="8"] .gem, body[data-skin="8"] .gem-preview { background: radial-gradient(circle at 35% 28%, #fff 0 6%, #ffffff66 8%, transparent 15%), linear-gradient(145deg, #fff9, color-mix(in srgb, var(--gem), white 38%) 30%, var(--gem) 70%); box-shadow: inset -7px -8px 14px rgba(0,0,0,.13), inset 7px 6px 13px rgba(255,255,255,.24), 0 7px 20px color-mix(in srgb, var(--gem), transparent 55%); filter: brightness(1.09); }
body[data-skin="9"] .gem, body[data-skin="9"] .gem-preview { background: radial-gradient(circle at 24% 29%, #fff 0 2%, transparent 3%), radial-gradient(circle at 68% 23%, #fff9 0 2%, transparent 3%), radial-gradient(circle at 61% 69%, #fff8 0 2%, transparent 3%), linear-gradient(145deg, color-mix(in srgb, var(--gem), #1a1645 18%), var(--gem) 48%, #070b1b); box-shadow: inset 0 0 18px #fff2, 0 0 24px color-mix(in srgb, var(--gem), transparent 47%); filter: saturate(1.22); }
body[data-skin="10"] .gem, body[data-skin="10"] .gem-preview { background: linear-gradient(35deg, transparent 0 34%, #fff6 36% 39%, transparent 41%), linear-gradient(145deg, color-mix(in srgb, var(--gem), white 45%), var(--gem) 52%, color-mix(in srgb, var(--gem), #17314b 28%)); box-shadow: inset 7px 8px 14px #fff2, inset -8px -10px 15px #0015, 0 0 20px color-mix(in srgb, var(--gem), transparent 53%); filter: brightness(1.08); }
body[data-skin="11"] .gem, body[data-skin="11"] .gem-preview { background: radial-gradient(circle at 38% 30%, #fff8 0 5%, transparent 7%), radial-gradient(circle at 55% 65%, color-mix(in srgb, var(--gem), #ffef7a 35%), var(--gem) 45%, color-mix(in srgb, var(--gem), #310517 45%)); box-shadow: inset 0 -12px 18px #16000a66, 0 0 22px color-mix(in srgb, var(--gem), transparent 48%); filter: saturate(1.3); }
body[data-skin="12"] .gem, body[data-skin="12"] .gem-preview { background: linear-gradient(155deg, #fff9, color-mix(in srgb, var(--gem), white 18%) 28%, color-mix(in srgb, var(--gem), #2a3440 55%) 72%, #10151d); box-shadow: inset 8px 7px 14px #fff2, inset -9px -10px 16px #0007, 0 8px 18px #0006; filter: saturate(.45) contrast(1.16); }
body[data-skin="13"] .gem, body[data-skin="13"] .gem-preview { background: conic-gradient(from 35deg, color-mix(in srgb, var(--gem), #ff65c8 25%), color-mix(in srgb, var(--gem), #55ffe1 30%), color-mix(in srgb, var(--gem), #fff176 22%), var(--gem), color-mix(in srgb, var(--gem), #ff65c8 25%)); box-shadow: inset 0 0 16px #fff4, 0 0 24px color-mix(in srgb, var(--gem), transparent 44%); filter: brightness(1.08) saturate(1.2); }
body[data-skin="14"] .gem, body[data-skin="14"] .gem-preview { background: radial-gradient(circle at 32% 25%, #fff 0 5%, transparent 7%), linear-gradient(145deg, color-mix(in srgb, var(--gem), white 52%), color-mix(in srgb, var(--gem), #76fff0 18%) 43%, var(--gem) 72%); box-shadow: inset 7px 8px 14px rgba(255,255,255,.2), inset -8px -10px 15px rgba(0,35,55,.14), 0 0 24px color-mix(in srgb, var(--gem), transparent 42%); filter: brightness(1.16) saturate(1.08); }

body[data-skin="1"] .gem:not(.special-color), body[data-skin="1"] .gem-preview { scale: .96; }
body[data-skin="2"] .gem:not(.special-color), body[data-skin="2"] .gem-preview { border: 4px double rgba(255,255,255,.72); scale: 1.02; }
body[data-skin="3"] .gem:not(.special-color), body[data-skin="3"] .gem-preview { scale: .95; }
body[data-skin="4"] .gem:not(.special-color), body[data-skin="4"] .gem-preview { border: 4px solid rgba(255,232,139,.72); outline: 2px solid rgba(128,69,0,.42); outline-offset: -6px; scale: .96; }
body[data-skin="5"] .gem:not(.special-color), body[data-skin="5"] .gem-preview { scale: .95; }
body[data-skin="6"] .gem:not(.special-color), body[data-skin="6"] .gem-preview { scale: .91; }
body[data-skin="7"] .gem:not(.special-color), body[data-skin="7"] .gem-preview { scale: .96; }
body[data-skin="8"] .gem:not(.special-color), body[data-skin="8"] .gem-preview { scale: .9; }
body[data-skin="9"] .gem:not(.special-color), body[data-skin="9"] .gem-preview { scale: .94; }
body[data-skin="10"] .gem:not(.special-color), body[data-skin="10"] .gem-preview { scale: .94; }
body[data-skin="11"] .gem:not(.special-color), body[data-skin="11"] .gem-preview { scale: .97; }
body[data-skin="12"] .gem:not(.special-color), body[data-skin="12"] .gem-preview { scale: .91; }
body[data-skin="13"] .gem:not(.special-color), body[data-skin="13"] .gem-preview { scale: .95; }
body[data-skin="14"] .gem:not(.special-color), body[data-skin="14"] .gem-preview { scale: .93; }

.cell.coin-cell {
  border-color: rgba(255, 218, 73, .28);
  background: rgba(80, 52, 5, .22);
  cursor: grab;
}
.coin, .coin-preview {
  position: absolute;
  inset: 12%;
  display: grid;
  place-items: center;
  border: 4px solid #fff0a1;
  border-radius: 50%;
  color: #6d3d00;
  background:
    radial-gradient(circle at 35% 27%, rgba(255,255,255,.9) 0 5%, transparent 7%),
    linear-gradient(145deg, #fff176, #ffbd24 54%, #c66a00);
  box-shadow: inset 0 0 0 4px rgba(142,72,0,.25), inset -7px -8px 10px rgba(105,52,0,.2), 0 0 20px rgba(255,194,34,.38);
  font-size: clamp(17px, 3vw, 31px);
  font-weight: 900;
  animation: coinGlow 1.4s ease-in-out infinite alternate;
}
.coin-preview {
  position: relative;
  inset: auto !important;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
}
.coin-preview::before {
  content: "★";
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}
.coin-preview::after { display: none; }
.ice-preview,
.bonus-preview,
.mixed-preview,
.chain-preview,
.bomb-preview,
.gauntlet-preview {
  position: relative;
  inset: auto !important;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 18px;
  clip-path: none !important;
  transform: none !important;
  color: #fff;
  font-size: 25px;
  font-weight: 900;
}
.ice-preview {
  border: 3px solid #d9f8ff;
  background: linear-gradient(145deg, #dffaff, #4cc9f0 58%, #2673b8) !important;
  box-shadow: inset 0 0 12px #fff8, 0 0 18px #4cc9f077 !important;
}
.bonus-preview {
  border-radius: 50%;
  border: 3px solid #fff;
  background: conic-gradient(#a8ff1f, #25e9ef, #a36cff, #ff4767, #ff9f13, #a8ff1f) !important;
  box-shadow: inset 0 0 0 7px #0a101acc, 0 0 16px #ffffff66 !important;
}
.mixed-preview {
  border: 3px solid #ffe676;
  background: conic-gradient(from 45deg, #ffbd24, #54dfff, #a36cff, #a8ff1f, #ffbd24) !important;
  box-shadow: inset 0 0 12px #fff7, 0 0 18px #ffdb4f66 !important;
}
.chain-preview {
  border: 3px solid #d9e1ea;
  background: linear-gradient(145deg, #657383, #202934 62%, #0c1118) !important;
  box-shadow: inset 0 0 12px #fff4, 0 0 17px #9eabb866 !important;
}
.bomb-preview {
  border: 3px solid #ffac72;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #ffcf89 0 5%, #df3e35 7% 15%, #22131a 17% 65%, #05070a 68%) !important;
  box-shadow: inset 0 0 14px #ff5c4044, 0 0 18px #ff4f3b66 !important;
}
.gauntlet-preview {
  border: 3px solid #fff;
  background: conic-gradient(#55ffe1, #ffe75c, #ff65b8, #8c67ff, #55ffe1) !important;
  box-shadow: inset 0 0 0 7px #0b111bcc, 0 0 18px #ffffff77 !important;
}
.ice-preview::after,
.bonus-preview::after,
.mixed-preview::after,
.chain-preview::after,
.bomb-preview::after,
.gauntlet-preview::after { display: none; }

.cell.matched {
  z-index: 5;
  overflow: visible;
}
.cell.matched .gem { animation: gemShatter 410ms cubic-bezier(.2,.75,.3,1) forwards; }
.cell.matched::before,
.cell.matched::after {
  content: "";
  position: absolute;
  z-index: 6;
  inset: 5%;
  pointer-events: none;
  border-radius: 50%;
}
.cell.matched::before {
  border: 3px solid color-mix(in srgb, var(--burst-color, var(--accent)), white 40%);
  box-shadow: 0 0 15px var(--burst-color, var(--accent)), inset 0 0 12px var(--burst-color, var(--accent));
  animation: vanishRing 420ms ease-out both;
}
.cell.matched::after {
  background:
    radial-gradient(circle at 50% 4%, var(--burst-color, var(--accent)) 0 4%, transparent 5%),
    radial-gradient(circle at 92% 28%, #fff 0 3%, transparent 4%),
    radial-gradient(circle at 88% 82%, var(--burst-color, var(--accent)) 0 4%, transparent 5%),
    radial-gradient(circle at 18% 90%, #fff 0 3%, transparent 4%),
    radial-gradient(circle at 4% 36%, var(--burst-color, var(--accent)) 0 4%, transparent 5%);
  animation: vanishParticles 450ms ease-out both;
}
.cell.spawn .gem { animation: spawn 260ms cubic-bezier(.18,.9,.3,1.25) both; }
.cell.invalid { animation: shake 260ms ease; }

.combo-text {
  position: absolute;
  top: 48%;
  left: 50%;
  z-index: 5;
  pointer-events: none;
  color: var(--accent);
  font-size: clamp(25px, 5vw, 48px);
  font-weight: 900;
  opacity: 0;
  text-shadow: 0 4px 30px #000;
  transform: translate(-50%, -50%);
}
.combo-text.show { animation: combo 750ms ease both; }

.system-message {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 9;
  width: max-content;
  max-width: calc(100% - 40px);
  padding: 16px 24px;
  border: 2px solid rgba(var(--accent-rgb), .55);
  border-radius: 18px;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 0, rgba(var(--accent-rgb), .16), transparent 70%),
    rgba(10, 16, 24, .95);
  box-shadow: 0 18px 55px rgba(0,0,0,.46), 0 0 24px rgba(var(--accent-rgb), .15);
  text-align: center;
  font-size: clamp(16px, 2.4vw, 23px);
  font-weight: 900;
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.system-message.hidden { display: none; }
.system-message.show { animation: systemMessageIn 300ms cubic-bezier(.18,.9,.3,1.15) both; }

.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 13px;
  padding: 24px;
  text-align: center;
  background: rgba(5,9,13,.64);
  backdrop-filter: blur(8px);
}
.overlay::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(460px, calc(100% - 32px));
  height: min(360px, calc(100% - 32px));
  border: 2px solid rgba(var(--accent-rgb), .34);
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 0, rgba(var(--accent-rgb), .14), transparent 55%),
    rgba(13, 20, 29, .96);
  box-shadow: 0 28px 90px rgba(0,0,0,.52), 0 0 36px rgba(var(--accent-rgb), .12);
  transform: translate(-50%, -50%);
}
.overlay.hidden { display: none; }
.overlay:not(.hidden) > * { position: relative; z-index: 1; animation: objectivePop 420ms cubic-bezier(.18,.9,.3,1.18) both; }
.overlay h2 { color: var(--accent); font-size: clamp(38px, 7vw, 68px); font-weight: 900; }
.overlay p { max-width: 360px; color: var(--muted); line-height: 1.45; }
.overlay button, .primary-button {
  min-height: 52px;
  padding: 0 25px;
  border: 0;
  border-radius: 99px;
  color: #071005;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
}

.action-panel { display: grid; gap: 13px; align-content: start; }
.action-panel .panel { margin: 0; }
.home-button, .ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  border: 2px solid rgba(255,255,255,.09);
  border-radius: 99px;
  color: var(--text);
  background: rgba(8,13,19,.55);
  text-decoration: none;
  font-weight: 900;
  cursor: pointer;
}
.primary-button { width: 100%; }
.ghost-button { width: 100%; }
.ghost-button:disabled { opacity: .45; cursor: default; }
.admin-button {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 30;
  width: auto;
  min-height: 42px;
  padding: 0 16px;
  border: 2px dashed rgba(255, 112, 211, .5);
  border-radius: 14px;
  color: #ff9ee2;
  background: rgba(255, 70, 197, .07);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.admin-button[hidden] { display: none !important; }
.sound-button {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 30;
  min-height: 42px;
  padding: 0 16px;
  border: 2px solid rgba(255,255,255,.14);
  border-radius: 999px;
  color: var(--text);
  background: rgba(10,16,24,.84);
  box-shadow: 0 12px 34px rgba(0,0,0,.32);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.sound-button[aria-pressed="true"] {
  border-color: rgba(var(--accent-rgb), .42);
  color: var(--accent);
}
.map-button {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 30;
  min-height: 42px;
  padding: 0 17px;
  border: 2px solid rgba(var(--accent-rgb), .36);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(10,16,24,.88);
  box-shadow: 0 12px 34px rgba(0,0,0,.32);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.target-gem-wrap { display: flex; align-items: center; gap: 17px; margin: 16px 0 10px; }
.gem-preview { position: relative; inset: auto !important; width: 58px; height: 58px; flex: 0 0 auto; }
.target-gem-wrap strong { font-size: 27px; }
.target-panel p, .world-panel p { color: var(--muted); font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.world-panel strong { display: block; margin: 9px 0 5px; font-size: 19px; }
.leaderboard-panel {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.leaderboard-panel .leaderboard-list {
  max-height: 260px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: rgba(244, 247, 251, 0.62);
}

.auth-hint[hidden] {
  display: none;
}

.save-status {
  margin: 8px 0 0;
  font-size: 0.85rem;
  line-height: 1.35;
  color: rgba(184, 255, 46, 0.9);
  min-height: 1.2em;
}
.mobile-stats { display: none; }

@keyframes gemShatter {
  0% { opacity: 1; filter: brightness(1); }
  34% { opacity: 1; filter: brightness(1.85); transform: scale(1.17) rotate(-5deg); }
  100% { opacity: 0; filter: brightness(2.2); transform: scale(.08) rotate(38deg); }
}
@keyframes vanishRing {
  0% { opacity: 0; transform: scale(.25); }
  34% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.65); }
}
@keyframes vanishParticles {
  0% { opacity: 0; transform: scale(.25) rotate(0); }
  28% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.85) rotate(38deg); }
}
@keyframes spawn { from { opacity: 0; transform: scale(.15); } }
@keyframes shake { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
@keyframes combo { 0% { opacity: 0; transform: translate(-50%,-30%) scale(.7); } 22% { opacity: 1; transform: translate(-50%,-50%) scale(1); } 100% { opacity: 0; transform: translate(-50%,-90%) scale(1.08); } }
@keyframes hint { 50% { border-color: #fff; background: rgba(var(--accent-rgb), .2); transform: scale(1.06); box-shadow: 0 0 24px rgba(var(--accent-rgb), .5); } }
@keyframes hintGem { 50% { filter: brightness(1.35) drop-shadow(0 0 9px var(--accent)); } }
@keyframes grab { from { opacity: .55; } to { opacity: 1; } }
@keyframes colorPulse { to { filter: brightness(1.12) drop-shadow(0 0 6px rgba(255,255,255,.75)) drop-shadow(0 0 10px rgba(210,90,255,.58)); } }
@keyframes iceHit { 35% { filter: brightness(1.8); transform: scale(.96) rotate(-2deg); } 70% { transform: scale(1.03) rotate(2deg); } }
@keyframes iceBreak { 45% { opacity: 1; filter: brightness(2); } 100% { opacity: 0; transform: scale(1.35) rotate(8deg); } }
@keyframes iceDenied { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
@keyframes chainHit { 35% { filter: brightness(1.7); transform: scale(.97) rotate(-1deg); } 70% { transform: scale(1.02) rotate(1deg); } }
@keyframes chainBreak { 40% { opacity: 1; filter: brightness(1.8); } 100% { opacity: 0; transform: scale(1.3) rotate(18deg); } }
@keyframes bombTick { to { transform: scale(1.1); filter: brightness(1.25); box-shadow: 0 0 15px rgba(255,54,39,.85); } }
@keyframes coinGlow { to { filter: brightness(1.13); transform: translateY(-2px) rotate(2deg); } }
@keyframes objectivePop { from { opacity: 0; transform: translateY(16px) scale(.92); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes systemMessageIn { from { opacity: 0; transform: translate(-50%, -42%) scale(.9); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes bonusAura {
  from { filter: brightness(1) drop-shadow(0 0 3px color-mix(in srgb, var(--gem), white 10%)); }
  to { filter: brightness(1.1) drop-shadow(0 0 7px color-mix(in srgb, var(--gem), white 28%)) drop-shadow(0 0 10px var(--gem)); }
}
@keyframes bonusMarkPulse {
  to { box-shadow: 0 0 8px rgba(255,255,255,.72), 0 0 12px var(--gem), inset 0 0 6px rgba(255,255,255,.2); }
}
@keyframes bonusBorn {
  0% { opacity: .15; filter: brightness(2); scale: .35; }
  55% { opacity: 1; filter: brightness(1.45); scale: 1.18; }
  100% { opacity: 1; filter: brightness(1); scale: 1; }
}
@keyframes beamRevealH {
  0% { opacity: 0; clip-path: inset(0 50%); filter: blur(5px); }
  28% { opacity: 1; }
  72% { opacity: 1; clip-path: inset(0 0); filter: blur(0); }
  100% { opacity: 0; clip-path: inset(0 0); transform: translateY(-50%) scaleY(.3); }
}
@keyframes beamRevealV {
  0% { opacity: 0; clip-path: inset(50% 0); filter: blur(5px); }
  28% { opacity: 1; }
  72% { opacity: 1; clip-path: inset(0 0); filter: blur(0); }
  100% { opacity: 0; clip-path: inset(0 0); transform: translateX(-50%) scaleX(.3); }
}
@keyframes beamParticles { to { background-position: 44px 0; } }
@keyframes beamParticlesV { to { background-position: 0 44px; } }
@keyframes burstGrid {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.18) rotate(-18deg); }
  35% { opacity: 1; }
  72% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.35) rotate(8deg); }
}
@keyframes colorWave {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.08) rotate(-30deg); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.18) rotate(45deg); }
}

@media (max-width: 1050px) {
  .game-shell { grid-template-columns: minmax(180px,230px) minmax(420px,620px); justify-content: center; }
  .action-panel { display: none; }
}

@media (max-width: 900px) {
  .map-header { grid-template-columns: 1fr auto; }
  .map-home { display: none; }
}

@media (max-width: 720px) {
  .map-screen { padding: 8px; }
  .map-header { grid-template-columns: 1fr auto; gap: 8px; padding-bottom: 8px; }
  .map-header .brand { display: flex; }
  .map-header .brand-mark { width: 44px; border-radius: 13px; font-size: 18px; }
  .map-header h1 { font-size: 20px; }
  .map-header .brand p { font-size: 11px; }
  .map-home { display: none; }
  .map-progress-panel { gap: 8px; min-height: 44px; padding: 5px 6px 5px 12px; }
  .map-progress-panel span { font-size: 10px; }
  .map-progress-panel strong { font-size: 14px; }
  .map-progress-panel button { min-height: 34px; padding-inline: 11px; font-size: 11px; }
  .map-progress-panel .infinity-button {
    width: 34px;
    padding: 0;
    font-size: 0;
  }
  .map-progress-panel .infinity-button::after { content: "∞"; font-size: 18px; }
  .map-viewport { border-radius: 20px; }
  .game-shell { grid-template-columns: 1fr; align-items: start; gap: 10px; padding: 10px; }
  .brand-panel { display: contents; }
  .brand, .brand-panel .stats-panel, .controls-panel { display: none; }
  .level-panel { grid-row: 3; width: 100%; margin: 0 !important; padding: 13px !important; }
  .level-panel > .eyebrow, .level-panel small { display: none; }
  .level-line { grid-template-columns: 42px 1fr 42px; margin: 0 0 9px; }
  .level-line > strong { font-size: 32px; }
  .play-area { grid-row: 1; gap: 8px; }
  .topbar { min-height: 44px; }
  .topbar .eyebrow { font-size: 10px; }
  .topbar > div:first-child strong { max-width: 55vw; font-size: 13px; }
  .moves-pill { min-height: 40px; padding-inline: 13px; }
  .moves-pill strong { font-size: 20px; }
  .top-map-button { min-height: 40px; padding-inline: 12px; font-size: 11px; }
  .board-shell { width: min(100%, calc(100dvh - 160px)); min-width: 300px; padding: 7px; border-radius: 20px; }
  .board { gap: 3px; }
  .cell { border-radius: 8px; }
  .mobile-stats { display: flex; flex-wrap: wrap; justify-content: space-between; width: 100%; padding: 4px 5px; color: var(--muted); font-size: 13px; }
  .mobile-stats strong { margin-left: 4px; color: var(--text); }
  .mobile-star-moves {
    flex-basis: 100%;
    margin-top: 4px;
    color: #ffd846;
    text-align: center;
    font-size: 11px;
    font-weight: 800;
  }
}

@media (max-width: 520px) {
  .topbar > div:first-child { display: none; }
  .topbar { justify-content: flex-end; }
  .map-progress-panel > span:first-child,
  #mapStageGate { display: none; }
}

@media (max-width: 360px) {
  .map-progress-panel > span { display: none; }
  .map-progress-panel #mapCurrentButton {
    width: 34px;
    padding: 0;
    font-size: 0;
  }
  .map-progress-panel #mapCurrentButton::after { content: "◎"; font-size: 17px; }
  .game-shell { padding: 6px; }
  .board-shell { min-width: 280px; }
  .topbar > div:first-child { display: none; }
  .topbar { justify-content: flex-end; }
}
