:root {
  --navy: #06163b;
  --deep: #08265a;
  --ice: #dff8ff;
  --cyan: #61e7ff;
  --gold: #ffd85d;
  --panel: rgba(235, 250, 255, .92);
  --shadow: 0 14px 34px rgba(0, 26, 73, .3);
  --hex-w: 54px;
  --hex-h: 60px;
  color-scheme: dark;
  font-family: ui-rounded, "SF Pro Rounded", "Avenir Next", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--navy);
  color: white;
  overscroll-behavior: none;
  user-select: none;
}
button, input { font: inherit; }
button { color: inherit; border: 0; cursor: pointer; }
button:disabled { opacity: .48; cursor: default; }

#app-shell, .screen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
}
.screen { display: none; overflow: hidden; }
.screen.active { display: flex; flex-direction: column; }
.safe-top { padding-top: max(12px, env(safe-area-inset-top)); }
.safe-bottom { padding-bottom: max(9px, env(safe-area-inset-bottom)); }

.map-backdrop, .game-backdrop, .league-sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.map-backdrop {
  background:
    linear-gradient(180deg, rgba(8, 33, 89, .02), rgba(4, 31, 82, .46)),
    url("assets/arctic-map-bg.png") center 43% / cover no-repeat,
    linear-gradient(#58cfff, #0878c4 58%, #053b88);
}
.map-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 10%, transparent 0 25%, rgba(4, 25, 72, .26) 90%);
}

.top-hud, .game-header, .league-header {
  position: relative;
  z-index: 5;
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: 14px;
}
.round-button {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(#4bd9ff, #1477c9);
  border: 2px solid rgba(255,255,255,.78);
  box-shadow: 0 6px 0 #075292, 0 10px 18px rgba(0, 28, 77, .28);
  font-size: 24px;
  font-weight: 900;
}
.dark-button { background: linear-gradient(#275a93, #102f65); }
.hud-currency { display: flex; gap: 8px; }
.currency-pill, .game-coins {
  height: 40px;
  min-width: 94px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 22px;
  background: rgba(5, 36, 91, .78);
  border: 2px solid rgba(181, 238, 255, .62);
  box-shadow: inset 0 2px rgba(255,255,255,.13), 0 5px 12px rgba(0,22,65,.25);
}
.coin-icon { color: #ffe378; filter: drop-shadow(0 2px #a96c0c); }

.brand-card {
  position: relative;
  z-index: 3;
  width: min(92vw, 420px);
  margin: 2px auto 8px;
  padding: 12px 18px 13px;
  text-align: center;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 25px;
  background: linear-gradient(180deg, rgba(8, 58, 126, .76), rgba(6, 35, 91, .7));
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.24);
  backdrop-filter: blur(12px);
}
.eyebrow { margin: 0 0 3px; font-size: 10px; letter-spacing: .16em; color: #9aefff; font-weight: 900; }
.brand-card h1 { margin: 0; font-size: clamp(25px, 7vw, 34px); line-height: 1; text-shadow: 0 3px 0 #104a91; }
.brand-subtitle { margin: 6px 0 0; font-weight: 750; font-size: 13px; }
.brand-signature { margin: 3px 0 0; color: #ffe494; font: italic 700 12px Georgia, serif; }

.map-scroll {
  position: relative;
  z-index: 2;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  padding: 0 12px 126px;
}
.map-scroll::-webkit-scrollbar { display: none; }
.journey-ribbon {
  position: sticky;
  top: 0;
  z-index: 6;
  width: min(92vw, 420px);
  margin: 0 auto 10px;
  padding: 10px 15px;
  color: #07336f;
  background: rgba(237, 252, 255, .93);
  border: 2px solid white;
  border-radius: 18px;
  box-shadow: 0 8px 18px rgba(0, 37, 91, .26);
}
.journey-ribbon > div:first-child { display: flex; justify-content: space-between; font-size: 12px; font-weight: 900; }
.progress-track, .goal-track {
  height: 11px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 10px;
  background: #b9d8e8;
  box-shadow: inset 0 2px 3px rgba(0, 52, 94, .22);
}
.progress-track span, .goal-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #38e2f7, #4a8cff 55%, #b45dff);
  box-shadow: inset 0 2px rgba(255,255,255,.55);
  transition: width .45s cubic-bezier(.2,.8,.2,1);
}
.map-path {
  position: relative;
  width: min(94vw, 430px);
  min-height: 790px;
  margin: auto;
}
.map-path::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 54px;
  width: 12px;
  height: 650px;
  transform: translateX(-50%);
  background: repeating-linear-gradient(180deg, rgba(223,248,255,.9) 0 17px, rgba(122,211,238,.65) 17px 29px);
  border-radius: 20px;
  filter: drop-shadow(0 3px 3px rgba(0,67,120,.35));
}
.stage-node {
  position: absolute;
  left: var(--node-x);
  top: var(--node-y);
  width: 104px;
  height: 76px;
  transform: translate(-50%, -50%);
  border-radius: 50% 48% 46% 53%;
  background: linear-gradient(145deg, #f8ffff 0 45%, #9bdbed 48% 73%, #4fa8d0 76%);
  border: 3px solid white;
  box-shadow: 0 10px 0 #277fb3, 0 17px 23px rgba(0,45,91,.36);
  color: #0a4683;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 5px;
  transition: transform .2s;
}
.stage-node strong { font-size: 24px; line-height: 1; }
.stage-node small { display: block; max-width: 88px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 9px; font-weight: 900; }
.stage-node.current { animation: floatNode 1.8s ease-in-out infinite; box-shadow: 0 10px 0 #b86c10, 0 0 0 7px rgba(255,219,93,.45), 0 18px 28px rgba(0,45,91,.4); }
.stage-node.completed::after { content: "✓"; position: absolute; right: -7px; top: -8px; width: 26px; height: 26px; border-radius: 50%; background: #44d67e; color: white; display: grid; place-items: center; border: 2px solid white; }
.stage-node.locked { filter: saturate(.35); color: #6c8191; }
.stage-node.locked::after { content: "🔒"; position: absolute; font-size: 22px; }
.stage-node.locked > * { opacity: .28; }
.map-chest {
  position: absolute;
  left: var(--chest-x);
  top: var(--chest-y);
  transform: translate(-50%, -50%);
  width: 60px;
  height: 48px;
  border-radius: 12px 12px 17px 17px;
  background: linear-gradient(#ffd75b 0 35%, #dc7f18 36% 100%);
  border: 3px solid #fff3a3;
  box-shadow: 0 7px 0 #8c4712, 0 12px 18px rgba(0,35,77,.35);
  font-size: 23px;
}
.map-chest.available { animation: chestGlow 1.3s infinite alternate; }
.map-chest.claimed { filter: grayscale(.7); opacity: .68; }
.memory-button {
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 45px;
  transform: translateX(-50%);
  min-width: 205px;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 22px;
  background: linear-gradient(#fff4a5, #ffbf3d);
  color: #714208;
  border: 2px solid white;
  box-shadow: 0 6px 0 #ad6818, 0 10px 18px rgba(0,37,77,.25);
  font-weight: 950;
}

.bottom-nav {
  position: absolute;
  z-index: 12;
  left: 0; right: 0; bottom: 0;
  height: calc(82px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 38px;
  padding-top: 10px;
  background: linear-gradient(rgba(4,31,80,.82), rgba(3,17,51,.98));
  border-top: 1px solid rgba(155,227,255,.45);
  backdrop-filter: blur(16px);
}
.nav-button { width: 70px; background: none; display: grid; gap: 2px; place-items: center; font-weight: 800; color: #acd9ee; }
.nav-button span { font-size: 23px; }
.nav-button.active { color: white; }
.play-button {
  width: 84px;
  height: 62px;
  margin-top: -26px;
  border-radius: 31px;
  background: linear-gradient(#ffe882, #ffad29);
  color: #653c02;
  border: 3px solid #fff5c0;
  box-shadow: 0 8px 0 #b56412, 0 12px 24px rgba(0,17,51,.5);
  display: flex;
  gap: 5px;
  justify-content: center;
  align-items: center;
}

/* Game */
.game-screen { background: linear-gradient(#136bb8, #087bc7 42%, #07508f); }
.game-backdrop {
  background:
    radial-gradient(ellipse at 50% 28%, rgba(134,242,255,.48), transparent 42%),
    linear-gradient(180deg, #72d9f1 0 32%, #139ccc 33% 60%, #0873b8 100%);
}
.game-backdrop::before, .game-backdrop::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  top: 22%;
  border-radius: 45%;
  background: linear-gradient(145deg, #f7ffff, #a5dce9 65%, #5ba7cb);
  box-shadow: inset -13px -16px 0 rgba(35,119,170,.26);
  transform: rotate(29deg);
}
.game-backdrop::before { left: -125px; }
.game-backdrop::after { right: -125px; transform: rotate(-29deg); }
.game-header { min-height: 62px; }
.stage-title { text-align: center; display: grid; line-height: 1.05; }
.stage-title span { font-size: 9px; letter-spacing: .15em; color: #b9f3ff; font-weight: 900; }
.stage-title strong { font-size: 18px; text-shadow: 0 2px #074776; }
.game-coins { min-width: 72px; height: 38px; font-size: 13px; }
.goal-card {
  position: relative;
  z-index: 4;
  width: min(92vw, 410px);
  margin: 2px auto 5px;
  padding: 8px 14px 10px;
  border-radius: 18px;
  background: rgba(238,251,255,.93);
  color: #07366d;
  border: 2px solid white;
  box-shadow: 0 8px 20px rgba(0,53,92,.25);
}
.goal-row { display: flex; align-items: center; justify-content: space-between; }
.goal-row > div:first-child { display: flex; gap: 8px; align-items: baseline; }
.goal-row span { font-size: 9px; font-weight: 950; letter-spacing: .08em; }
.goal-row strong { font-size: 14px; }
.chain-badge { opacity: 0; color: #7d33ad; font-size: 10px; font-weight: 950; transition: opacity .2s, transform .2s; }
.chain-badge.show { opacity: 1; transform: scale(1.08); }
.goal-track { margin-top: 5px; height: 9px; }

.board-wrap {
  position: relative;
  z-index: 3;
  width: min(96vw, 430px);
  height: min(46vh, 390px);
  min-height: 298px;
  margin: 0 auto;
  display: grid;
  place-items: center;
}
.ice-rim {
  position: absolute;
  width: min(94vw, 410px);
  height: 96%;
  border-radius: 42% 45% 40% 47%;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(21,142,197,.48), transparent 62%),
    linear-gradient(150deg, rgba(239,255,255,.95), rgba(118,209,232,.86));
  clip-path: polygon(6% 14%, 22% 3%, 50% 7%, 72% 1%, 95% 15%, 97% 44%, 89% 76%, 63% 96%, 35% 93%, 8% 80%, 1% 46%);
  filter: drop-shadow(0 14px 16px rgba(0,59,98,.32));
}
.hex-board {
  position: relative;
  width: 330px;
  height: 348px;
  transform-origin: center;
}
.hex-cell {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--hex-w);
  height: var(--hex-h);
  transform: translate(-50%, -50%);
  clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%);
  background: linear-gradient(145deg, rgba(238,253,255,.9), rgba(139,205,221,.88));
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.52);
  transition: filter .2s, transform .2s, opacity .2s;
}
.hex-cell::after {
  content: "";
  position: absolute;
  inset: 6px;
  clip-path: inherit;
  border: 2px dashed rgba(50,132,170,.24);
}
.hex-cell.valid { filter: drop-shadow(0 0 9px #fff67a); animation: validPulse .8s infinite alternate; }
.hex-cell.invalid, .hex-cell.blocked { filter: saturate(.25) brightness(.72); opacity: .6; }
.hex-cell.locked { background: linear-gradient(#9bc2d3, #6e94a9); }
.hex-cell.locked::after { content: "🔒"; inset: 0; display: grid; place-items: center; clip-path: none; border: 0; font-size: 19px; }
.cell-number { position: absolute; inset: auto 0 7px; text-align: center; z-index: 3; color: white; font-size: 9px; font-weight: 950; text-shadow: 0 1px 2px #174a66; }
.flower-cell { display: grid; place-items: center; font-size: 33px; filter: drop-shadow(0 4px 3px rgba(0,65,97,.3)); }
.flower-cell small { position: absolute; bottom: 4px; right: 5px; min-width: 17px; height: 17px; display: grid; place-items: center; border-radius: 50%; background: #6a3ba2; font-size: 9px; font-weight: 950; }
.stack {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--hex-w);
  height: var(--hex-h);
  transform: translate(-50%, -50%);
  z-index: var(--z, 5);
  pointer-events: none;
  filter: drop-shadow(0 7px 5px rgba(0, 48, 84, .34));
}
.hex-layer {
  position: absolute;
  inset: 0;
  transform: translateY(calc(var(--depth) * -3.25px));
  clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%);
  background:
    linear-gradient(155deg, rgba(255,255,255,.42), transparent 31%),
    var(--color);
  box-shadow:
    inset 0 3px rgba(255,255,255,.35),
    inset 0 -6px rgba(37,50,96,.22),
    0 4px 0 color-mix(in srgb, var(--color) 66%, #173a66);
}
.hex-layer:last-child::after {
  content: "";
  position: absolute;
  inset: 5px 8px 18px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  filter: blur(4px);
}
.stack.selected { filter: drop-shadow(0 0 10px #fff47a) drop-shadow(0 8px 5px rgba(0,48,84,.3)); }
.stack.protected::after {
  content: attr(data-protected);
  position: absolute;
  right: -5px;
  bottom: -8px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #304f84;
  border: 2px solid white;
  font-size: 10px;
  font-weight: 950;
}
.animation-layer { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.merge-ghost {
  position: absolute;
  width: 50px;
  height: 55px;
  clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%);
  background: var(--color);
  animation: mergeFlight .42s cubic-bezier(.2,.8,.3,1) forwards;
  filter: drop-shadow(0 5px 7px rgba(0,44,77,.45));
}
.clear-burst {
  position: absolute;
  width: 58px; height: 58px;
  border-radius: 50%;
  border: 8px solid var(--color);
  animation: clearBurst .55s ease-out forwards;
}

.candidate-panel {
  position: relative;
  z-index: 6;
  width: min(94vw, 420px);
  margin: 1px auto 0;
  padding: 6px 12px 8px;
  border-radius: 20px;
  background: rgba(4,42,91,.48);
  border: 1px solid rgba(199,244,255,.35);
  backdrop-filter: blur(8px);
}
.candidate-caption { display: flex; justify-content: space-between; align-items: baseline; padding: 0 5px 5px; }
.candidate-caption span { font-size: 11px; font-weight: 950; text-transform: uppercase; letter-spacing: .08em; }
.candidate-caption small { color: #b9edff; font-size: 9px; }
.candidate-tray { display: flex; justify-content: space-evenly; align-items: flex-end; min-height: 74px; }
.candidate-stack {
  position: relative;
  width: 66px;
  height: 62px;
  background: none;
  touch-action: none;
  transition: transform .18s, filter .18s;
}
.candidate-stack.selected { transform: translateY(-8px) scale(1.08); filter: drop-shadow(0 0 10px #fff47a); }
.candidate-stack .stack { left: 50%; top: 58%; transform: translate(-50%, -50%) scale(.93); }
.candidate-stack .slot-label { position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%); font-size: 8px; color: #bcecff; font-weight: 900; }

.booster-dock {
  position: relative;
  z-index: 7;
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: flex-start;
  padding-top: 7px;
  min-height: calc(78px + env(safe-area-inset-bottom));
  background: linear-gradient(rgba(3,31,74,.25), rgba(3,22,59,.85));
}
.booster-button {
  position: relative;
  width: 84px;
  min-height: 56px;
  padding: 6px 5px;
  border-radius: 16px;
  background: linear-gradient(#f4fdff, #a6ddea);
  color: #0b4978;
  border: 2px solid white;
  box-shadow: 0 5px 0 #4a98b6, 0 8px 12px rgba(0,26,66,.3);
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
}
.booster-button.featured { background: linear-gradient(#fff4b1, #ffc94b); box-shadow: 0 5px 0 #bd731d, 0 8px 12px rgba(0,26,66,.3); }
.booster-icon { grid-row: span 2; font-size: 23px; }
.booster-button strong { font-size: 10px; text-align: left; }
.booster-button small { font-weight: 950; text-align: left; }
.booster-button.active { box-shadow: 0 0 0 4px #fff47a, 0 5px 0 #4a98b6; }

/* League */
.league-screen { background: linear-gradient(#4cc9ee, #0c75ba 54%, #062b69); }
.league-sky { background: radial-gradient(circle at 50% 0, #c5fbff 0, transparent 36%), linear-gradient(160deg, #5ee7ee, #237ac2 55%, #102c70); }
.league-header { justify-content: space-between; min-height: 82px; }
.league-header > div:nth-child(2) { text-align: center; }
.league-header span { font-size: 9px; letter-spacing: .12em; font-weight: 900; color: #c4f8ff; }
.league-header h2 { margin: 2px 0 0; font-size: 25px; }
.league-shield { width: 45px; height: 50px; display: grid; place-items: center; background: linear-gradient(#e9fdff,#79ccea); color: #15548b; clip-path: polygon(50% 0,96% 17%,84% 75%,50% 100%,16% 75%,4% 17%); font-weight: 950; }
.league-content { position: relative; z-index: 2; flex: 1; overflow-y: auto; padding: 0 14px 130px; scrollbar-width: none; }
.league-content::-webkit-scrollbar { display: none; }
.league-hero { text-align: center; }
.league-hero p { margin: 4px 0; font-size: 11px; color: #d3f8ff; }
.league-hero > strong { display: block; font-size: 19px; }
.podium { height: 150px; display: flex; justify-content: center; align-items: flex-end; gap: 5px; margin-top: 5px; }
.podium-card { width: 29%; padding: 9px 3px; border-radius: 18px 18px 5px 5px; background: linear-gradient(#effeff,#7bccec); color: #0c477c; box-shadow: 0 7px 0 #206b9f; }
.podium-card.first { min-height: 128px; background: linear-gradient(#fff4a2,#ffc23c); box-shadow: 0 7px 0 #b66a15; }
.podium-card.second { min-height: 105px; }
.podium-card.third { min-height: 88px; }
.podium-card b, .podium-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.standings-panel {
  margin-top: 12px;
  border-radius: 25px;
  padding: 14px 11px;
  background: rgba(239,252,255,.94);
  color: #0a3b70;
  box-shadow: var(--shadow);
}
.standings-heading { display: flex; justify-content: space-between; align-items: center; padding: 0 7px 8px; }
.standings-heading span { font-size: 8px; letter-spacing: .1em; color: #3683a6; font-weight: 950; }
.standings-heading h3 { margin: 2px 0; }
.standings-heading b { font-size: 9px; color: #7b51aa; }
.league-list { display: grid; gap: 5px; }
.league-row {
  display: grid;
  grid-template-columns: 29px 1fr auto;
  align-items: center;
  min-height: 42px;
  padding: 5px 10px;
  border-radius: 13px;
  background: rgba(180,226,239,.45);
  font-size: 12px;
}
.league-row.is-player { background: linear-gradient(90deg, #ffe178, #ffbc4a); box-shadow: inset 0 0 0 2px white; }
.league-row .rank { font-weight: 950; }
.league-row .name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 850; }
.league-row .score { font-weight: 950; }
.league-reward { display: flex; align-items: center; gap: 12px; margin: 12px 0; padding: 12px; border-radius: 18px; background: rgba(7,40,96,.72); }
.league-reward div:nth-child(2) { display: grid; }
.league-reward span { font-size: 10px; color: #aeefff; }
.mini-chest { width: 48px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: linear-gradient(#ffe875,#df851b); color: white; font-size: 20px; box-shadow: 0 5px 0 #8e4b10; }

/* Modal, toast, particles */
.modal-layer { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(2,14,45,.72); backdrop-filter: blur(8px); }
.modal-layer.open { display: flex; }
.modal-card {
  width: min(92vw, 390px);
  max-height: 86vh;
  overflow-y: auto;
  padding: 24px 20px 20px;
  text-align: center;
  border-radius: 28px;
  background: linear-gradient(#f7ffff,#c9eff7);
  color: #093a70;
  border: 3px solid white;
  box-shadow: 0 15px 0 #4b9dbb, 0 26px 50px rgba(0,18,55,.45);
}
.modal-card.grand { background: linear-gradient(#fff8b8,#ffd24f 58%,#f6a82f); box-shadow: 0 15px 0 #a76317, 0 26px 50px rgba(0,18,55,.45); }
.modal-icon { font-size: 55px; filter: drop-shadow(0 5px 4px rgba(0,51,84,.22)); }
.modal-card h2 { margin: 8px 0 7px; font-size: 28px; }
.modal-card p { line-height: 1.45; white-space: pre-line; }
.modal-actions { display: flex; gap: 9px; margin-top: 17px; }
.modal-actions button {
  flex: 1;
  min-height: 48px;
  border-radius: 16px;
  background: linear-gradient(#53def9,#1786cf);
  border: 2px solid white;
  box-shadow: 0 5px 0 #0d5d9c;
  font-weight: 950;
}
.modal-actions .secondary { background: linear-gradient(#e9f5f7,#a5cbd7); color: #164e70; box-shadow: 0 5px 0 #658fa0; }
.modal-actions .danger { background: linear-gradient(#ff8585,#dc475c); box-shadow: 0 5px 0 #8c2637; }
.settings-grid { display: grid; gap: 12px; text-align: left; }
.settings-grid label { display: grid; gap: 5px; font-size: 11px; font-weight: 900; }
.settings-grid input[type="text"] { width: 100%; padding: 11px 12px; border: 2px solid #86c9dc; border-radius: 13px; background: white; color: #10395f; font-weight: 800; user-select: text; }
.setting-toggle { display: flex !important; grid-template-columns: 1fr auto; align-items: center; justify-content: space-between; padding: 8px 0; }
.setting-toggle input { width: 25px; height: 25px; }
.toast {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  transform: translate(-50%, 30px);
  padding: 10px 16px;
  max-width: 86vw;
  border-radius: 18px;
  background: rgba(3,24,65,.93);
  border: 1px solid rgba(180,239,255,.6);
  box-shadow: 0 8px 24px rgba(0,17,49,.36);
  opacity: 0;
  pointer-events: none;
  font-size: 12px;
  font-weight: 850;
  text-align: center;
  transition: opacity .22s, transform .22s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.confetti-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; overflow: hidden; }
.confetti { position: absolute; top: -20px; width: 9px; height: 15px; background: var(--c); animation: confettiFall 2.3s linear forwards; }

@keyframes floatNode { 0%,100% { transform: translate(-50%,-50%); } 50% { transform: translate(-50%,calc(-50% - 8px)); } }
@keyframes chestGlow { to { filter: drop-shadow(0 0 13px #fff184); transform: translate(-50%,-55%) scale(1.04); } }
@keyframes validPulse { to { transform: translate(-50%,-50%) scale(1.05); } }
@keyframes mergeFlight { from { transform: translate(var(--from-x),var(--from-y)) scale(1); } to { transform: translate(var(--to-x),var(--to-y)) scale(.75); opacity: .5; } }
@keyframes clearBurst { from { transform: translate(-50%,-50%) scale(.25); opacity: 1; } to { transform: translate(-50%,-50%) scale(2); opacity: 0; } }
@keyframes confettiFall { to { transform: translate(var(--drift),110vh) rotate(720deg); } }

@media (max-height: 740px) {
  .game-header { min-height: 54px; }
  .goal-card { padding-block: 6px; }
  .board-wrap { height: 42vh; min-height: 270px; }
  .hex-board { transform: scale(.89); }
  .candidate-panel { padding-block: 4px; }
  .candidate-tray { min-height: 62px; }
  .booster-dock { min-height: calc(68px + env(safe-area-inset-bottom)); }
  .brand-card { padding-block: 8px; }
}
@media (max-width: 374px) {
  :root { --hex-w: 50px; --hex-h: 56px; }
  .hex-board { transform: scale(.91); }
  .booster-button { width: 78px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .001ms !important; }
}

/* --------------------------------------------------------------------------
   V3.1 PREMIUM VISUAL MATCH PASS
   Presentation-only overrides. Game state, placement, merge and reward rules
   remain in the existing JavaScript engine.
   -------------------------------------------------------------------------- */
:root {
  --navy: #102b62;
  --deep: #163f7b;
  --ice: #f3fbff;
  --cyan: #37dff5;
  --gold: #ffd43b;
  --panel: #f5fbff;
  --shadow: 0 16px 34px rgba(25, 48, 75, .27);
  --hex-w: 62px;
  --hex-h: 54px;
}

body {
  background: #dbeaf3;
  letter-spacing: -.01em;
}

/* Premium journey map */
.map-backdrop {
  background:
    linear-gradient(180deg, rgba(20, 92, 180, .04), rgba(5, 61, 142, .27)),
    url("assets/arctic-map-bg-v31.png") center 46% / cover no-repeat,
    linear-gradient(#45cbff, #0877ca);
}
.map-backdrop::after {
  background:
    linear-gradient(180deg, rgba(4, 36, 101, .12), transparent 24%, transparent 72%, rgba(2, 34, 91, .34)),
    radial-gradient(circle at 50% 8%, rgba(255,255,255,.4), transparent 34%);
}
.top-hud { min-height: 72px; padding-inline: 16px; }
.round-button {
  width: 48px;
  height: 48px;
  background: linear-gradient(180deg, #5ce9ff, #128bd4 60%, #0869bd);
  border: 3px solid rgba(255,255,255,.95);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.5), 0 6px 0 #07539b, 0 11px 18px rgba(9,41,91,.34);
}
.round-button:active, .booster-button:active, .play-button:active { transform: translateY(3px); box-shadow: 0 2px 0 #234c78; }
.currency-pill, .game-coins {
  height: 43px;
  min-width: 96px;
  border-radius: 24px;
  color: white;
  background: linear-gradient(180deg, #254f8f, #112e69);
  border: 3px solid #8edcff;
  box-shadow: inset 0 3px 0 rgba(255,255,255,.2), inset 0 -3px 0 rgba(0,15,52,.2), 0 6px 12px rgba(10,36,82,.3);
}
.brand-card {
  width: min(92vw, 410px);
  margin-top: 4px;
  border: 3px solid rgba(255,255,255,.92);
  border-radius: 27px;
  background: linear-gradient(180deg, rgba(27, 93, 174, .93), rgba(16, 52, 125, .94));
  box-shadow: inset 0 3px 0 rgba(255,255,255,.2), inset 0 -4px 0 rgba(0,20,71,.22), 0 11px 0 rgba(6,47,115,.48), 0 18px 30px rgba(6,34,85,.28);
}
.brand-card h1 {
  font-weight: 950;
  letter-spacing: -.045em;
  text-shadow: 0 3px 0 #0b3a86, 0 5px 12px rgba(0,15,54,.3);
}
.journey-ribbon {
  color: #183c67;
  border: 3px solid #fff;
  background: linear-gradient(#ffffff, #dff3fb);
  box-shadow: inset 0 -4px 0 #b8dae7, 0 7px 0 rgba(23,88,137,.58), 0 14px 22px rgba(6,47,100,.25);
}
.map-path::before {
  width: 15px;
  background: repeating-linear-gradient(180deg, #ffffff 0 14px, #65c8ed 14px 24px);
  border: 3px solid rgba(28,114,170,.38);
  box-shadow: 0 4px 0 rgba(9,72,133,.24);
}
.stage-node {
  width: 112px;
  height: 79px;
  border: 4px solid #fff;
  background:
    radial-gradient(ellipse at 34% 20%, rgba(255,255,255,.95), transparent 27%),
    linear-gradient(155deg, #ffffff 0 39%, #c8f2fb 40% 61%, #68c3e5 63% 80%, #3190c5 82%);
  box-shadow: inset 0 -5px 0 rgba(31,128,174,.22), 0 10px 0 #277eb2, 0 17px 25px rgba(0,45,91,.38);
}
.stage-node strong {
  color: #175b96;
  font-size: 28px;
  text-shadow: 0 2px 0 white;
}
.stage-node small { font-size: 10px; color: #164c79; }
.stage-node.current {
  box-shadow: inset 0 -5px 0 rgba(172,95,0,.12), 0 10px 0 #b86c10, 0 0 0 7px rgba(255,222,77,.58), 0 18px 28px rgba(0,45,91,.4);
}
.map-chest {
  width: 66px;
  height: 52px;
  border: 4px solid #fff4a8;
  background: linear-gradient(#ffed75 0 35%, #ffb126 36% 59%, #d97611 60%);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.55), 0 8px 0 #8c4712, 0 13px 18px rgba(0,35,77,.35);
}
.bottom-nav {
  background: linear-gradient(180deg, rgba(21,57,111,.93), #091e4d);
  border-top: 3px solid rgba(171,230,255,.75);
  box-shadow: 0 -7px 22px rgba(5,40,86,.25);
}
.play-button {
  background: linear-gradient(#fff58f, #ffd23a 50%, #f09a16);
  border: 4px solid #fff8c5;
  box-shadow: inset 0 3px 0 rgba(255,255,255,.5), 0 8px 0 #a95a0d, 0 13px 22px rgba(0,17,51,.48);
}

/* Game shell: quieter background, stronger play surface */
.game-screen {
  background: linear-gradient(180deg, #dff5fb, #c9e7f2 54%, #b9d7e6);
  color: #173957;
}
.game-backdrop {
  background:
    radial-gradient(circle at 22% 22%, rgba(255,255,255,.72), transparent 27%),
    radial-gradient(circle at 82% 31%, rgba(255,255,255,.52), transparent 25%),
    linear-gradient(180deg, #edfaff 0%, #d9eff6 54%, #c7e0ec 100%);
}
.game-backdrop::before, .game-backdrop::after {
  width: 110px;
  height: 110px;
  top: 55%;
  opacity: .22;
  background: linear-gradient(145deg, #ffffff, #a9d2df);
  box-shadow: none;
}
.game-header {
  min-height: 66px;
  color: white;
  padding-inline: 13px;
  background: linear-gradient(180deg, #2465a7, #19477f);
  border-bottom: 3px solid #75c9ed;
  box-shadow: 0 6px 13px rgba(36,67,99,.22);
}
.game-header .dark-button {
  background: linear-gradient(#447bb4, #173f78);
  border-color: #c7efff;
}
.stage-title span { color: #bdf3ff; font-size: 10px; }
.stage-title strong { font-size: 19px; text-shadow: 0 2px 0 #0b3268; }
.goal-card {
  width: min(94vw, 420px);
  margin-top: 8px;
  padding: 9px 15px 11px;
  border: 3px solid white;
  border-radius: 20px;
  background: linear-gradient(#ffffff, #e5f3f8);
  color: #22405c;
  box-shadow: inset 0 -4px 0 #bfd7e1, 0 6px 0 #8eb6c7, 0 11px 18px rgba(47,74,98,.2);
}
.goal-row span { font-size: 10px; color: #5d7486; }
.goal-row strong { font-size: 16px; }
.goal-track {
  height: 12px;
  border: 2px solid #9eb7c2;
  background: #76848d;
  box-shadow: inset 0 3px 4px rgba(30,45,55,.38);
}
.goal-track span {
  background: linear-gradient(180deg, #68f3ff, #20bddb 56%, #1491c4);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.55), 0 0 8px rgba(27,206,236,.5);
}
.chain-badge {
  color: white;
  background: linear-gradient(#ae5cff, #6c2fd0);
  border: 2px solid #dcb8ff;
  padding: 4px 8px;
  border-radius: 12px;
  box-shadow: 0 3px 0 #482098;
}

/* Dense gray socket board */
.board-wrap {
  width: min(100vw, 440px);
  height: clamp(312px, 42vh, 366px);
  min-height: 312px;
  margin: 1px auto 0;
}
.ice-rim {
  width: min(98vw, 424px);
  height: 96%;
  border: 4px solid #e8f0f4;
  border-radius: 38px;
  clip-path: none;
  background:
    radial-gradient(circle at 50% 38%, rgba(255,255,255,.14), transparent 48%),
    linear-gradient(155deg, #7f8b98, #596573 60%, #44515e);
  box-shadow:
    inset 0 7px 0 rgba(255,255,255,.26),
    inset 0 -9px 0 rgba(24,35,45,.35),
    0 9px 0 #33414e,
    0 17px 28px rgba(47,65,82,.3);
  filter: none;
}
.ice-rim::after {
  content: "";
  position: absolute;
  inset: 13px;
  border-radius: 28px;
  border: 2px solid rgba(32,44,55,.28);
  box-shadow: inset 0 0 22px rgba(22,35,46,.2);
}
.hex-board {
  width: 360px;
  height: 320px;
}
.hex-cell {
  width: var(--hex-w);
  height: var(--hex-h);
  clip-path: polygon(16% 2%, 84% 2%, 100% 50%, 84% 98%, 16% 98%, 0 50%);
  background:
    linear-gradient(150deg, rgba(255,255,255,.23), transparent 30%),
    linear-gradient(180deg, #929ca7, #66717d);
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,.22),
    inset 0 -6px 0 rgba(22,32,42,.32),
    0 4px 0 #3d4853;
}
.hex-cell::after {
  inset: 6px 8px;
  border: 0;
  clip-path: inherit;
  background: linear-gradient(180deg, #5e6873, #7a858f);
  box-shadow: inset 0 4px 7px rgba(22,30,39,.42), 0 1px 0 rgba(255,255,255,.2);
}
.hex-cell.valid {
  filter: drop-shadow(0 0 10px #fff26a);
  animation: premiumPulse .65s infinite alternate;
}
.hex-cell.invalid, .hex-cell.blocked { filter: saturate(.25) brightness(.62); opacity: .72; }
.hex-cell.locked {
  background: linear-gradient(#56616b, #303a44);
}
.hex-cell.locked::after {
  background: rgba(39,48,57,.83);
  color: white;
  text-shadow: 0 2px 2px #101821;
}
.cell-number {
  inset: auto 0 5px;
  font-size: 12px;
  text-shadow: 0 2px 0 #18232d, 0 0 4px #17232d;
}

/* Wide plastic hex discs */
.stack {
  width: 66px;
  height: 52px;
  filter: drop-shadow(0 9px 6px rgba(32, 43, 55, .36));
}
.hex-layer {
  transform: translateY(calc(var(--depth) * -3.2px));
  clip-path: polygon(16% 1%, 84% 1%, 100% 50%, 84% 99%, 16% 99%, 0 50%);
  background:
    linear-gradient(180deg, rgba(255,255,255,.5) 0 9%, rgba(255,255,255,.12) 18%, transparent 42%),
    linear-gradient(110deg, rgba(255,255,255,.2), transparent 38%, rgba(0,0,0,.08) 85%),
    var(--color);
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,.42),
    inset 0 -7px 0 rgba(16,29,62,.24),
    0 5px 0 color-mix(in srgb, var(--color) 58%, #152d5a),
    0 7px 3px rgba(20,32,54,.18);
}
.hex-layer::before {
  content: "";
  position: absolute;
  inset: 5px 10px 20px;
  border-radius: 50%;
  background: rgba(255,255,255,.24);
  filter: blur(4px);
}
.hex-layer:last-of-type::after {
  inset: 7px 13px 21px;
  background: rgba(255,255,255,.2);
}
.stack-count {
  position: absolute;
  z-index: 30;
  left: 50%;
  top: 50%;
  transform: translate(-50%, calc(-50% + var(--label-offset)));
  min-width: 28px;
  text-align: center;
  color: #fff;
  font-size: 21px;
  line-height: 1;
  font-weight: 1000;
  letter-spacing: -.05em;
  -webkit-text-stroke: 1.5px rgba(15,27,50,.82);
  text-shadow: 0 2px 0 rgba(14,29,55,.78), 0 3px 5px rgba(8,18,34,.45);
  pointer-events: none;
}
.hex-board .stack { animation: stackSettleV31 .24s cubic-bezier(.18,.85,.32,1.24); }
.stack.selected {
  filter: drop-shadow(0 0 13px #ffe96a) drop-shadow(0 11px 7px rgba(27,39,52,.34));
}
.merge-ghost {
  width: 64px;
  height: 50px;
  clip-path: polygon(16% 1%, 84% 1%, 100% 50%, 84% 99%, 16% 99%, 0 50%);
  background:
    linear-gradient(180deg, rgba(255,255,255,.45), transparent 30%),
    var(--color);
  border-bottom: 6px solid color-mix(in srgb, var(--color) 56%, #152d5a);
}
.clear-burst {
  width: 70px;
  height: 70px;
  border-width: 10px;
  box-shadow: 0 0 20px var(--color);
}
.clear-burst::after {
  content: "✦";
  position: absolute;
  inset: -17px;
  display: grid;
  place-items: center;
  color: white;
  font-size: 38px;
  text-shadow: 0 0 10px var(--color);
  animation: sparklePop .55s ease-out forwards;
}

/* Sturdy three-slot tray */
.candidate-panel {
  width: min(96vw, 430px);
  margin-top: 0;
  padding: 8px 12px 10px;
  border: 4px solid #84b6d4;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.12), transparent 22%),
    linear-gradient(#284d75, #173656);
  box-shadow:
    inset 0 5px 0 rgba(255,255,255,.12),
    inset 0 -7px 0 rgba(3,20,42,.28),
    0 7px 0 #102a47,
    0 12px 20px rgba(35,54,72,.3);
  backdrop-filter: none;
}
.candidate-caption { padding: 0 7px 4px; }
.candidate-caption span { color: white; font-size: 12px; }
.candidate-caption small { color: #bdeaff; font-size: 10px; }
.candidate-tray {
  min-height: 92px;
  justify-content: space-between;
  gap: 7px;
}
.candidate-stack {
  width: 31%;
  max-width: 112px;
  height: 88px;
  border-radius: 18px;
  background: linear-gradient(180deg, #18344f, #10273f);
  box-shadow:
    inset 0 5px 8px rgba(0,10,23,.52),
    inset 0 -2px 0 rgba(255,255,255,.1),
    0 2px 0 rgba(255,255,255,.15);
}
.candidate-stack .stack {
  left: 50%;
  top: 56%;
  transform: translate(-50%, -50%) scale(1.1);
}
.candidate-stack.selected {
  transform: translateY(-9px) scale(1.035);
  filter: drop-shadow(0 0 12px #ffe85c);
  background: linear-gradient(180deg, #365671, #17324c);
  box-shadow: inset 0 0 0 3px #ffe66a, inset 0 5px 9px rgba(0,10,23,.35), 0 6px 0 #aa7412;
}
.candidate-stack.selected .stack { transform: translate(-50%, -57%) scale(1.15); }
.candidate-stack .slot-label {
  display: none;
}

/* Premium booster control deck */
.booster-dock {
  flex: 1 1 auto;
  gap: 9px;
  min-height: calc(88px + env(safe-area-inset-bottom));
  padding: 9px 10px max(9px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #315d8d, #173b70 58%, #0b2656);
  border-top: 3px solid #8dd7f3;
  box-shadow: 0 -7px 18px rgba(35,55,74,.24);
}
.booster-button {
  width: 98px;
  min-height: 65px;
  padding: 6px 7px;
  grid-template-columns: 40px 1fr;
  border-radius: 19px;
  border: 3px solid #fff;
  background: linear-gradient(180deg, #ffffff 0 30%, #d8edf5 31% 70%, #9ecbdc);
  color: #173d61;
  box-shadow:
    inset 0 3px 0 rgba(255,255,255,.8),
    inset 0 -4px 0 rgba(49,114,143,.2),
    0 6px 0 #477f9a,
    0 10px 13px rgba(10,33,67,.33);
}
.booster-button.featured {
  background: linear-gradient(180deg, #fffcec 0 26%, #ffe877 27% 69%, #ffbe31);
  color: #684008;
  box-shadow: inset 0 3px 0 white, inset 0 -4px 0 rgba(193,111,15,.16), 0 6px 0 #ba711b, 0 10px 13px rgba(10,33,67,.33);
}
.booster-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #6fe7ff, #2488cf);
  border: 2px solid #fff;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.5), 0 3px 0 #17609d;
  font-size: 22px;
  text-shadow: 0 2px 2px rgba(0,31,66,.28);
}
.featured .booster-icon {
  background: linear-gradient(145deg, #fff48b, #ffb728);
  box-shadow: inset 0 2px 0 white, 0 3px 0 #b16a13;
}
.booster-button strong { font-size: 11px; font-weight: 950; }
.booster-button small {
  width: 25px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #224a70;
  color: white;
  font-size: 11px;
}
.booster-button.active {
  box-shadow: inset 0 0 0 3px #fff16a, 0 6px 0 #84610f, 0 0 17px #ffe566;
}

/* Modal and league weight */
.modal-card {
  border: 4px solid white;
  border-radius: 30px;
  background: linear-gradient(#ffffff, #e7f5fa 58%, #c8e6f0);
  box-shadow: inset 0 -6px 0 #a7cddc, 0 13px 0 #477f9f, 0 26px 50px rgba(0,18,55,.45);
}
.modal-actions button {
  border: 3px solid white;
  box-shadow: inset 0 3px 0 rgba(255,255,255,.4), 0 6px 0 #0d5d9c;
}
.standings-panel {
  border: 3px solid white;
  background: linear-gradient(#ffffff, #e8f6fa);
  box-shadow: inset 0 -5px 0 #badce7, 0 8px 0 #2d78a3, var(--shadow);
}
.league-row { border: 1px solid rgba(70,135,165,.18); box-shadow: inset 0 -2px 0 rgba(71,133,160,.12); }
.league-row.is-player { border: 2px solid white; box-shadow: inset 0 -3px 0 #e8a72b, 0 4px 0 #9f6315; }

@keyframes stackSettleV31 {
  0% { transform: translate(-50%, calc(-50% - 13px)) scale(.91); opacity: .45; }
  70% { transform: translate(-50%, calc(-50% + 3px)) scale(1.035); }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
@keyframes premiumPulse {
  to { transform: translate(-50%, -50%) scale(1.07); filter: drop-shadow(0 0 12px #fff26a); }
}
@keyframes sparklePop {
  from { transform: scale(.25) rotate(-30deg); opacity: 1; }
  to { transform: scale(1.9) rotate(30deg); opacity: 0; }
}

@media (max-height: 740px) {
  .game-header { min-height: 55px; }
  .goal-card { margin-top: 5px; padding-block: 6px 8px; }
  .board-wrap { height: 286px; min-height: 286px; }
  .ice-rim { height: 97%; }
  .hex-board { transform: scale(.84); }
  .candidate-panel { padding-block: 5px 7px; }
  .candidate-tray { min-height: 73px; }
  .candidate-stack { height: 71px; }
  .candidate-stack .stack { transform: translate(-50%, -50%) scale(.94); }
  .candidate-stack.selected .stack { transform: translate(-50%, -56%) scale(1); }
  .booster-dock { min-height: calc(76px + env(safe-area-inset-bottom)); padding-top: 6px; }
  .booster-button { min-height: 56px; }
}
@media (min-width: 410px) and (min-height: 820px) {
  .board-wrap { height: 378px; }
  .hex-board { transform: scale(1.06); }
  .candidate-panel { margin-top: 3px; }
}
@media (max-width: 374px) {
  :root { --hex-w: 60px; --hex-h: 52px; }
  .board-wrap { width: 100vw; }
  .hex-board { transform: scale(.82); }
  .candidate-panel { width: 97vw; }
  .booster-button { width: 92px; }
}

/* --------------------------------------------------------------------------
   V3.2 REFERENCE-LAYOUT COMPOSITION
   Uses the supplied screenshot as a layout reference while retaining original
   branding, art, controls and the complete V3 engine.
   -------------------------------------------------------------------------- */
:root {
  --hex-w: 76px;
  --hex-h: 66px;
}

.game-screen {
  color: #173957;
  background: #b8d5e9;
}
.game-backdrop {
  background:
    radial-gradient(circle at 50% 20%, rgba(255,255,255,.3), transparent 34%),
    linear-gradient(180deg, #c7dfef, #b4d2e6 68%, #aac9df);
}
.game-backdrop::before,
.game-backdrop::after { display: none; }

/* Three-part HUD: home/coins, center progress and settings */
.game-header {
  position: relative;
  min-height: 118px;
  padding: 0;
  color: white;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.game-header #game-back-button {
  position: absolute;
  z-index: 8;
  left: 17px;
  top: max(18px, env(safe-area-inset-top));
  width: 50px;
  height: 50px;
  font-size: 25px;
  color: #fff7a0;
  background: linear-gradient(145deg, #ffd93e, #ff9d12);
  border-color: #fff176;
  box-shadow: inset 0 3px 0 rgba(255,255,255,.6), 0 5px 0 #c36a09, 0 9px 14px rgba(57,80,102,.22);
}
.game-coins {
  position: absolute;
  z-index: 7;
  left: 48px;
  top: max(24px, calc(env(safe-area-inset-top) + 6px));
  width: 104px;
  height: 41px;
  padding-left: 19px;
  color: white;
  font-size: 18px;
  border: 3px solid #5b8fd1;
  border-radius: 8px 25px 25px 8px;
  background: linear-gradient(180deg, #2e6fd1, #174caf);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.17), 0 4px 0 #17408b;
}
.game-coins .coin-icon { display: none; }
.game-settings-button {
  position: absolute;
  z-index: 8;
  right: 18px;
  top: max(18px, env(safe-area-inset-top));
  width: 53px;
  height: 53px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  color: white;
  font-size: 30px;
  font-weight: 950;
  background: linear-gradient(150deg, #56b9ff, #177ee8 58%, #0959c6);
  border: 3px solid #93d9ff;
  box-shadow: inset 0 4px 0 rgba(255,255,255,.35), inset 0 -4px 0 rgba(0,46,132,.24), 0 5px 0 #0b4da7, 0 9px 15px rgba(42,73,103,.24);
}
.stage-title {
  position: absolute;
  z-index: 8;
  left: 56%;
  top: max(77px, calc(env(safe-area-inset-top) + 59px));
  transform: translateX(-50%);
  width: 210px;
  color: #31526d;
}
.stage-title span { color: #66829a; font-size: 9px; }
.stage-title strong { color: #264a69; font-size: 16px; text-shadow: 0 2px 0 white; }

.goal-card {
  position: absolute;
  z-index: 9;
  left: 56%;
  top: max(19px, env(safe-area-inset-top));
  transform: translateX(-50%);
  width: 140px;
  height: 47px;
  margin: 0;
  padding: 7px 10px 8px 40px;
  border: 3px solid #4d86cc;
  border-radius: 9px 27px 27px 9px;
  color: white;
  background: linear-gradient(180deg, #3277d4, #154bae);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.16), 0 4px 0 #153f8b, 0 8px 14px rgba(47,74,98,.18);
}
.goal-card::before {
  content: "";
  position: absolute;
  left: -16px;
  top: -4px;
  width: 50px;
  height: 50px;
  clip-path: polygon(22% 3%, 78% 3%, 100% 50%, 78% 97%, 22% 97%, 0 50%);
  background: linear-gradient(105deg, #f148ce 0 22%, #83f047 22% 43%, #ffe73e 43% 64%, #32adff 64% 82%, #315ce9 82%);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.45), 0 5px 0 #314ca7;
}
.goal-row { height: 27px; justify-content: center; }
.goal-row > div:first-child { display: block; }
.goal-row span { display: none; }
.goal-row strong {
  color: white;
  font-size: 20px;
  letter-spacing: -.03em;
  text-shadow: 0 2px 0 #092d82;
}
.chain-badge {
  position: absolute;
  right: -8px;
  top: 44px;
  white-space: nowrap;
}
.goal-track {
  position: absolute;
  left: 39px;
  right: 12px;
  bottom: 5px;
  height: 6px;
  margin: 0;
  border: 0;
  background: rgba(5,37,103,.56);
}

/* Free-standing socket grid */
.board-wrap {
  width: 100%;
  height: clamp(374px, 48vh, 445px);
  min-height: 374px;
  margin: 0 auto;
  overflow: visible;
}
.ice-rim { display: none; }
.hex-board {
  width: 380px;
  height: 410px;
}
.hex-cell {
  width: var(--hex-w);
  height: var(--hex-h);
  clip-path: polygon(18% 3%, 82% 3%, 100% 50%, 82% 97%, 18% 97%, 0 50%);
  background:
    linear-gradient(150deg, rgba(255,255,255,.32), transparent 30%),
    linear-gradient(180deg, #c1bdc2, #aaa7ae);
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,.28),
    inset 0 -5px 0 rgba(81,79,87,.2),
    0 5px 3px #777881,
    0 8px 8px rgba(70,83,96,.18);
}
.hex-cell::after {
  inset: 5px 7px;
  background: linear-gradient(180deg, rgba(170,167,175,.72), rgba(191,187,193,.76));
  box-shadow: inset 0 3px 4px rgba(85,82,91,.22), 0 1px 0 rgba(255,255,255,.34);
}
.hex-cell.locked {
  background: linear-gradient(#99969e, #77757c);
}
.hex-cell.locked::after { background: rgba(128,125,133,.8); }

/* Taller, flatter piles with embossed color symbols */
.stack {
  width: 80px;
  height: 64px;
  filter: drop-shadow(0 9px 6px rgba(59,63,71,.32));
}
.hex-layer {
  transform: translateY(calc(var(--depth) * -3.8px));
  clip-path: polygon(18% 2%, 82% 2%, 100% 50%, 82% 98%, 18% 98%, 0 50%);
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,.42),
    inset 0 -7px 0 rgba(16,29,62,.2),
    0 5px 0 color-mix(in srgb, var(--color) 60%, #173260),
    0 7px 2px rgba(20,32,54,.18);
}
.stack-symbol {
  position: absolute;
  z-index: 27;
  left: 50%;
  top: 50%;
  transform: translate(-50%, calc(-50% + var(--label-offset) + 7px));
  color: rgba(25,40,75,.27);
  font-size: 34px;
  font-weight: 950;
  text-shadow: 0 1px rgba(255,255,255,.18);
  pointer-events: none;
}
.stack-count {
  z-index: 31;
  font-size: 23px;
  -webkit-text-stroke: 1.7px rgba(24,31,52,.88);
}

/* Deep three-piece trough */
.candidate-panel {
  width: min(91vw, 410px);
  min-height: 126px;
  margin: 0 auto;
  padding: 13px 18px 11px;
  border: 7px solid #91a7ba;
  border-radius: 28px;
  background: linear-gradient(180deg, #7f98ad, #6f899f);
  box-shadow:
    inset 0 7px 10px rgba(34,58,78,.42),
    inset 0 -4px 0 rgba(255,255,255,.16),
    0 6px 0 #536b80,
    0 12px 16px rgba(67,84,99,.22);
}
.candidate-caption { display: none; }
.candidate-tray {
  min-height: 93px;
  gap: 8px;
  align-items: center;
}
.candidate-stack {
  width: 31%;
  height: 92px;
  max-width: 112px;
  background: none;
  box-shadow: none;
  overflow: visible;
}
.candidate-stack .stack {
  top: 57%;
  transform: translate(-50%, -50%) scale(1.17);
}
.candidate-stack.selected {
  background: rgba(255,255,255,.16);
  box-shadow: inset 0 0 0 3px #ffe66a, 0 5px 0 #667a8e;
}
.candidate-stack.selected .stack { transform: translate(-50%, -59%) scale(1.22); }

/* Booster milestone row, retaining real Hammer / Move / Refresh behavior */
.booster-dock {
  flex: 1 1 auto;
  min-height: calc(106px + env(safe-area-inset-bottom));
  gap: 20px;
  padding: 16px 12px max(12px, env(safe-area-inset-bottom));
  background: transparent;
  border: 0;
  box-shadow: none;
}
.booster-button,
.booster-button.featured {
  width: 86px;
  min-height: 75px;
  padding: 7px 5px 6px;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 37px 16px 16px;
  place-items: center;
  border: 3px solid #78caff;
  border-radius: 19px;
  color: white;
  background: linear-gradient(180deg, #3eb3ff, #1680eb 63%, #0963d4);
  box-shadow: inset 0 4px 0 rgba(255,255,255,.34), inset 0 -4px 0 rgba(0,47,137,.22), 0 5px 0 #0752af, 0 9px 14px rgba(59,80,99,.2);
}
.booster-icon,
.featured .booster-icon {
  grid-row: auto;
  width: 38px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: rgba(9,78,176,.3);
  box-shadow: inset 0 2px 4px rgba(0,40,113,.3);
  font-size: 23px;
}
.booster-button strong {
  color: white;
  font-size: 11px;
  text-align: center;
  text-shadow: 0 2px 0 #08469b;
}
.booster-button small {
  width: 28px;
  height: 19px;
  color: white;
  background: #0a4ca7;
  text-align: center;
}

@media (max-height: 740px) {
  .game-header { min-height: 94px; }
  .game-header #game-back-button,
  .game-settings-button { top: max(9px, env(safe-area-inset-top)); }
  .game-coins { top: max(15px, calc(env(safe-area-inset-top) + 6px)); }
  .goal-card { top: max(10px, env(safe-area-inset-top)); }
  .stage-title { top: max(65px, calc(env(safe-area-inset-top) + 52px)); }
  .board-wrap { height: 300px; min-height: 300px; }
  .hex-board { transform: scale(.72); }
  .candidate-panel { min-height: 100px; padding-block: 7px; }
  .candidate-tray { min-height: 78px; }
  .candidate-stack { height: 76px; }
  .candidate-stack .stack { transform: translate(-50%, -50%) scale(.98); }
  .candidate-stack.selected .stack { transform: translate(-50%, -57%) scale(1.04); }
  .booster-dock { min-height: calc(88px + env(safe-area-inset-bottom)); gap: 14px; padding-top: 9px; }
  .booster-button, .booster-button.featured { min-height: 68px; }
}
@media (min-width: 410px) and (min-height: 820px) {
  .board-wrap { height: 455px; }
  .hex-board { transform: scale(1.06); }
  .candidate-panel { width: 405px; }
}
@media (max-width: 374px) {
  :root { --hex-w: 73px; --hex-h: 63px; }
  .hex-board { transform: scale(.88); }
  .candidate-panel { width: 94vw; }
  .booster-dock { gap: 12px; }
  .booster-button, .booster-button.featured { width: 82px; }
}

/* --------------------------------------------------------------------------
   V3.3 TOY-BOX ART DIRECTION
   Glossy molded pieces on a neutral socket board. Arctic illustration remains
   on the journey screens; gameplay stays quiet so the pieces do the talking.
   -------------------------------------------------------------------------- */
:root {
  --toy-blue-1: #59c7ff;
  --toy-blue-2: #177be9;
  --toy-blue-3: #084fbc;
  --socket-top: #c7c5cb;
  --socket-bottom: #aaa8b0;
}

.game-screen {
  background: #bfd7e8;
}
.game-backdrop {
  opacity: 1;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255,255,255,.42), transparent 48%),
    linear-gradient(180deg, #cfe4f1 0%, #bdd7e9 56%, #b3cee2 100%);
}

/* Heavier, more collectible HUD widgets */
.game-header #game-back-button,
.game-settings-button {
  border-width: 3px;
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,.55),
    inset 0 -5px 0 rgba(0,54,135,.2),
    0 5px 0 #0b4eac,
    0 10px 16px rgba(52,77,101,.26);
}
.game-header #game-back-button {
  border-radius: 50%;
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,.62),
    inset 0 -4px 0 rgba(173,85,0,.2),
    0 5px 0 #c36a09,
    0 10px 16px rgba(52,77,101,.24);
}
.game-coins,
.goal-card {
  border-width: 3px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.13), transparent 38%),
    linear-gradient(180deg, #347bdd, #1752bd);
  box-shadow:
    inset 0 3px 0 rgba(255,255,255,.2),
    inset 0 -3px 0 rgba(2,39,119,.22),
    0 4px 0 #123f91,
    0 9px 15px rgba(52,75,99,.22);
}
.game-coins strong,
.goal-row strong {
  font-weight: 1000;
  text-shadow: 0 2px 0 #082a76, 0 0 2px #082a76;
}
.goal-card::before {
  filter: saturate(1.22) drop-shadow(0 4px 0 #314ca7);
}
.stage-title strong {
  font-weight: 1000;
  letter-spacing: -.025em;
  text-shadow: 0 2px 0 rgba(255,255,255,.9);
}

/* Dense molded honeycomb sockets */
.board-wrap {
  isolation: isolate;
}
.hex-board {
  filter: drop-shadow(0 9px 8px rgba(77,86,99,.18));
}
.hex-cell {
  border: 0;
  background:
    linear-gradient(150deg, rgba(255,255,255,.45), transparent 29%),
    linear-gradient(180deg, var(--socket-top), var(--socket-bottom));
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,.42),
    inset 0 -6px 0 rgba(75,73,82,.17),
    0 4px 0 #85848b,
    0 7px 8px rgba(69,76,86,.2);
}
.hex-cell::after {
  inset: 6px 8px 7px;
  border: 0;
  background:
    linear-gradient(180deg, rgba(165,163,171,.74), rgba(190,187,194,.8));
  box-shadow:
    inset 0 4px 6px rgba(69,67,76,.24),
    inset 0 -2px 0 rgba(255,255,255,.25),
    0 1px 0 rgba(255,255,255,.38);
}
.hex-cell.valid {
  filter: drop-shadow(0 0 8px #fff16c) brightness(1.06);
}

/* Wide plastic-poker-chip stack, not crystal or gemstone */
.stack {
  width: 82px;
  height: 63px;
  filter: drop-shadow(0 10px 7px rgba(47,53,65,.34));
}
.hex-layer {
  clip-path: polygon(19% 1%, 81% 1%, 100% 50%, 81% 99%, 19% 99%, 0 50%);
  background:
    linear-gradient(180deg, rgba(255,255,255,.46) 0 10%, transparent 31%),
    radial-gradient(ellipse at 50% 26%, rgba(255,255,255,.18), transparent 56%),
    var(--color);
  border: 1px solid rgba(30,39,65,.11);
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,.43),
    inset 0 -8px 0 rgba(20,31,63,.2),
    inset 0 -10px 11px rgba(29,38,70,.08),
    0 4px 0 color-mix(in srgb, var(--color) 62%, #18315c),
    0 6px 2px rgba(22,31,51,.2);
}
.hex-layer:last-child::before {
  content: "";
  position: absolute;
  inset: 6px 11px 22px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,.3), rgba(255,255,255,0));
  filter: blur(2px);
}
.hex-layer:last-child::after {
  inset: 8px 12px 19px;
  background: rgba(255,255,255,.11);
  filter: blur(3px);
}
.stack-symbol {
  color: rgba(20,37,74,.22);
  font-size: 33px;
  text-shadow: 0 1px rgba(255,255,255,.23);
}
.stack-count {
  font-size: 24px;
  font-weight: 1000;
  color: white;
  -webkit-text-stroke: 2px rgba(22,30,54,.78);
  text-shadow: 0 3px 3px rgba(12,25,56,.42);
}
.stack.selected {
  filter:
    drop-shadow(0 0 5px #fff)
    drop-shadow(0 0 12px #ffe947)
    drop-shadow(0 12px 7px rgba(47,53,65,.34));
}

/* A thick molded holder shaped around the next three moves */
.candidate-panel {
  border: 7px solid #9eb4c7;
  border-bottom-color: #8298ac;
  background:
    linear-gradient(180deg, rgba(255,255,255,.12), transparent 23%),
    linear-gradient(180deg, #8099ae, #70899f);
  box-shadow:
    inset 0 8px 12px rgba(30,54,75,.42),
    inset 0 -4px 0 rgba(255,255,255,.15),
    0 6px 0 #536b80,
    0 13px 18px rgba(60,78,96,.24);
}
.candidate-panel::before,
.candidate-panel::after {
  content: "";
  position: absolute;
  top: 13px;
  bottom: 13px;
  width: 2px;
  background: linear-gradient(transparent, rgba(36,62,83,.34), transparent);
}
.candidate-panel::before { left: 34%; }
.candidate-panel::after { right: 34%; }
.candidate-stack {
  border-radius: 19px;
}
.candidate-stack.selected {
  transform: translateY(-5px);
  background: rgba(255,255,255,.16);
  box-shadow:
    inset 0 0 0 3px #fff06d,
    0 4px 0 #5e7489,
    0 0 15px rgba(255,234,63,.42);
}

/* Classic glossy mobile-game boosters */
.booster-button,
.booster-button.featured {
  overflow: visible;
  border: 3px solid #83d4ff;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.28), transparent 25%),
    linear-gradient(180deg, var(--toy-blue-1), var(--toy-blue-2) 60%, var(--toy-blue-3));
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,.36),
    inset 0 -5px 0 rgba(0,44,133,.25),
    0 5px 0 #0752af,
    0 10px 14px rgba(57,76,95,.22);
}
.booster-button::before {
  content: "";
  position: absolute;
  inset: 5px 7px auto;
  height: 17px;
  border-radius: 14px 14px 50% 50%;
  background: linear-gradient(180deg, rgba(255,255,255,.28), transparent);
  pointer-events: none;
}
.booster-icon,
.featured .booster-icon {
  position: relative;
  width: 42px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(4,83,188,.18), rgba(3,49,133,.4));
  box-shadow:
    inset 0 3px 5px rgba(0,36,110,.32),
    0 1px 0 rgba(255,255,255,.25);
  filter: drop-shadow(0 2px 1px rgba(8,42,102,.25));
}
.booster-button strong {
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: -.02em;
}
.booster-button small {
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 10px;
  box-shadow: inset 0 2px 2px rgba(0,29,93,.35);
}

/* Keep the event wrapper rich, rounded and reward-heavy */
.brand-card,
.journey-ribbon,
.standings-panel,
.league-reward {
  border-width: 3px;
  box-shadow:
    inset 0 3px 0 rgba(255,255,255,.2),
    0 7px 0 rgba(5,55,110,.35),
    0 15px 26px rgba(0,31,78,.27);
}
.stage-node {
  border-width: 3px;
  box-shadow:
    inset 0 5px 0 rgba(255,255,255,.5),
    inset 0 -6px 0 rgba(11,81,143,.2),
    0 7px 0 #1165a7,
    0 12px 19px rgba(0,46,91,.3);
}
.map-chest {
  filter: saturate(1.16) drop-shadow(0 7px 5px rgba(0,46,91,.35));
}
.modal-card {
  border-width: 4px;
  box-shadow:
    inset 0 5px 0 rgba(255,255,255,.42),
    0 9px 0 #6aa8bf,
    0 22px 45px rgba(0,25,73,.42);
}
.modal-actions button {
  border-width: 3px;
  border-radius: 18px;
  box-shadow:
    inset 0 3px 0 rgba(255,255,255,.35),
    0 5px 0 #2c6a91,
    0 10px 16px rgba(0,35,78,.2);
}

@media (max-height: 740px) {
  .board-wrap {
    height: 320px;
    min-height: 320px;
  }
  .hex-board {
    transform: scale(.92);
  }
  .candidate-panel {
    min-height: 102px;
  }
  .candidate-stack .stack {
    transform: translate(-50%, -50%) scale(1.04);
  }
  .candidate-stack.selected .stack {
    transform: translate(-50%, -58%) scale(1.1);
  }
}

@media (max-height: 690px) {
  .game-header { min-height: 88px; }
  .board-wrap { height: 305px; min-height: 305px; }
  .hex-board { transform: scale(.88); }
  .candidate-panel { min-height: 98px; }
  .booster-dock {
    min-height: calc(83px + env(safe-area-inset-bottom));
    padding-top: 7px;
  }
  .booster-button,
  .booster-button.featured {
    min-height: 66px;
  }
}
