:root {
  --ink: #09214a;
  --ink-soft: #35547d;
  --night: #06183c;
  --ocean: #0a68ba;
  --cyan: #48dff7;
  --ice: #eefcff;
  --gold: #ffc640;
  --coral: #ff797f;
  --glass: rgba(246, 253, 255, 0.86);
  --glass-border: rgba(255, 255, 255, 0.72);
  --shadow: 0 16px 40px rgba(0, 35, 84, 0.24);
  --small-shadow: 0 7px 18px rgba(0, 35, 84, 0.2);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  overflow: hidden;
  background: var(--night);
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "Avenir Next", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  overscroll-behavior: none;
  touch-action: manipulation;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  color: inherit;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #ffcf58;
  outline-offset: 3px;
}

#app-shell {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  overflow: hidden;
  background: #0a6fc5;
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.35);
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
}

.screen.active {
  display: block;
  animation: screen-in 280ms ease-out;
}

.safe-top {
  padding-top: max(12px, env(safe-area-inset-top));
}

.safe-bottom {
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px) scale(0.992); }
  to { opacity: 1; transform: none; }
}

/* Map */

.map-backdrop {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(7, 45, 110, 0.12), rgba(2, 26, 85, 0.3)),
    url("assets/arctic-map-bg.png") center top / cover no-repeat;
  transform: scale(1.02);
}

.map-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 10%, rgba(255,255,255,.28), transparent 28%),
    linear-gradient(180deg, rgba(1, 25, 71, 0.12), transparent 24%, rgba(3, 25, 72, 0.18));
  pointer-events: none;
}

.top-hud,
.puzzle-header,
.league-header {
  position: relative;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding-left: 16px;
  padding-right: 16px;
}

.round-button {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  transition: transform 150ms ease, filter 150ms ease;
}

.round-button:active {
  transform: scale(.92);
}

.glass-button {
  background: linear-gradient(145deg, rgba(255,255,255,.94), rgba(200,239,255,.82));
  border: 2px solid rgba(255,255,255,.86);
  box-shadow: var(--small-shadow), inset 0 -4px 8px rgba(41,132,188,.16);
}

.dark-button {
  background: linear-gradient(145deg, #184b81, #0a2b5e);
  border: 2px solid rgba(255,255,255,.32);
  box-shadow: 0 6px 14px rgba(0,20,55,.28), inset 0 1px 0 rgba(255,255,255,.2);
}

.gear-icon {
  width: 23px;
  height: 23px;
  border: 5px dotted #23568c;
  border-radius: 50%;
  position: relative;
}

.gear-icon::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #23568c;
}

.hud-currency {
  display: flex;
  gap: 8px;
}

.currency-pill {
  height: 42px;
  min-width: 84px;
  padding: 0 12px 0 7px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: white;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(10,45,95,.88), rgba(4,26,70,.9));
  border: 2px solid rgba(255,255,255,.28);
  box-shadow: 0 6px 16px rgba(0,20,65,.26), inset 0 1px 0 rgba(255,255,255,.2);
  font-size: 15px;
}

.coin-icon {
  display: inline-grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  color: #805100;
  background: radial-gradient(circle at 35% 28%, #fff5a8 0 12%, #ffd84f 13% 55%, #f4a918 56% 100%);
  border: 2px solid #ffe98a;
  box-shadow: inset 0 -3px 0 rgba(172,98,0,.2), 0 2px 4px rgba(0,0,0,.2);
  font-size: 15px;
  font-weight: 1000;
}

.trophy-icon {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 21px;
  border-radius: 4px 4px 10px 10px;
  background: linear-gradient(135deg, #fff2a4, #ffc52c 50%, #e9950b);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.65);
}

.trophy-icon::before,
.trophy-icon::after {
  content: "";
  position: absolute;
  top: 3px;
  width: 8px;
  height: 10px;
  border: 3px solid #ffc52c;
}

.trophy-icon::before {
  left: -8px;
  border-right: 0;
  border-radius: 7px 0 0 7px;
}

.trophy-icon::after {
  right: -8px;
  border-left: 0;
  border-radius: 0 7px 7px 0;
}

.brand-card {
  position: relative;
  z-index: 3;
  width: calc(100% - 34px);
  max-width: 440px;
  margin: 1px auto 8px;
  padding: 15px 22px 14px;
  text-align: center;
  color: white;
  border-radius: 27px;
  background:
    linear-gradient(135deg, rgba(7,39,100,.94), rgba(15,105,171,.86)),
    rgba(4,34,88,.86);
  border: 2px solid rgba(255,255,255,.45);
  box-shadow: 0 14px 36px rgba(0,30,86,.3), inset 0 1px 0 rgba(255,255,255,.26);
  backdrop-filter: blur(10px);
}

.brand-card::before,
.brand-card::after {
  content: "";
  position: absolute;
  top: 16px;
  width: 28px;
  height: 14px;
  background: radial-gradient(circle, rgba(255,255,255,.85) 0 2px, transparent 3px) 0 0 / 9px 9px;
  opacity: .75;
}

.brand-card::before { left: 15px; }
.brand-card::after { right: 15px; }

.eyebrow,
.mission-label,
.league-header span,
.standings-heading span {
  margin: 0;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.eyebrow {
  color: #aeefff;
}

.brand-card h1 {
  margin: 2px 0 1px;
  font-size: clamp(27px, 7vw, 36px);
  line-height: 1.02;
  letter-spacing: -.04em;
  text-shadow: 0 3px 0 rgba(0,30,79,.25);
}

.brand-subtitle,
.brand-signature {
  margin: 0;
}

.brand-subtitle {
  font-size: 14px;
  font-weight: 750;
}

.brand-signature {
  margin-top: 4px;
  color: #ffdf83;
  font-size: 12px;
  font-weight: 850;
}

.map-scroll {
  position: relative;
  z-index: 2;
  height: calc(100% - 210px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  padding: 8px 0 130px;
  mask-image: linear-gradient(to bottom, transparent 0, black 3%, black 92%, transparent 100%);
}

.map-scroll::-webkit-scrollbar,
.league-list::-webkit-scrollbar {
  display: none;
}

.journey-ribbon {
  width: calc(100% - 34px);
  margin: 0 auto 16px;
  padding: 11px 15px;
  border-radius: 17px;
  color: white;
  background: rgba(4,35,89,.78);
  border: 1px solid rgba(255,255,255,.38);
  box-shadow: var(--small-shadow);
  backdrop-filter: blur(8px);
}

.event-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 850;
}

.progress-track {
  height: 8px;
  margin-top: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(1,20,60,.54);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.3);
}

.progress-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #5df2ff, #65ffc7, #ffe168);
  box-shadow: 0 0 12px rgba(98,255,225,.75);
  transition: width 500ms cubic-bezier(.2,.8,.2,1);
}

.map-path {
  position: relative;
  min-height: 910px;
  padding: 0 20px 40px;
}

.map-path::before {
  content: "";
  position: absolute;
  top: 70px;
  bottom: 90px;
  left: 50%;
  width: 9px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.3), rgba(134,240,255,.8), rgba(255,255,255,.28));
  box-shadow: 0 0 18px rgba(91,229,255,.8);
  filter: blur(.2px);
}

.stage-row {
  position: relative;
  height: 118px;
  display: flex;
  align-items: center;
}

.stage-row.left { justify-content: flex-start; padding-left: 12px; }
.stage-row.right { justify-content: flex-end; padding-right: 12px; }

.stage-card {
  position: relative;
  width: 176px;
  min-height: 82px;
  padding: 12px 14px 10px 55px;
  text-align: left;
  border-radius: 23px 28px 24px 18px;
  color: var(--ink);
  background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(197,241,255,.94));
  border: 3px solid rgba(255,255,255,.9);
  box-shadow: 0 13px 22px rgba(0,50,110,.28), inset 0 -7px 12px rgba(54,160,207,.15);
  transition: transform 180ms ease, filter 180ms ease;
}

.stage-card::after {
  content: "";
  position: absolute;
  left: -12px;
  right: -10px;
  bottom: -9px;
  height: 18px;
  z-index: -1;
  border-radius: 50%;
  background: rgba(120,219,250,.74);
  filter: blur(.5px);
  transform: rotate(-2deg);
}

.stage-card:not(:disabled):active {
  transform: translateY(3px) scale(.98);
}

.stage-card.current {
  animation: current-pulse 2.3s ease-in-out infinite;
  border-color: #fff0a0;
  box-shadow: 0 0 0 5px rgba(255,209,76,.34), 0 15px 28px rgba(0,49,109,.35);
}

@keyframes current-pulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.stage-card.completed {
  background: linear-gradient(145deg, #faffff, #c8fff0);
}

.stage-card.locked {
  filter: saturate(.35) brightness(.78);
  opacity: .86;
}

.stage-number {
  position: absolute;
  left: 9px;
  top: 15px;
  width: 40px;
  height: 46px;
  display: grid;
  place-items: center;
  color: white;
  border-radius: 45% 55% 50% 50% / 55% 45% 55% 45%;
  background: linear-gradient(145deg, #54dcff, #1376c5);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.55), 0 5px 9px rgba(0,67,132,.28);
  font-size: 18px;
  font-weight: 1000;
}

.completed .stage-number {
  background: linear-gradient(145deg, #66efc4, #14a787);
}

.stage-card strong,
.stage-card small {
  display: block;
}

.stage-card strong {
  font-size: 15px;
  line-height: 1.1;
}

.stage-card small {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.stage-status {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #126e77;
  background: rgba(97,233,216,.26);
  font-size: 9px;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.locked .stage-status {
  color: #5c6d85;
  background: rgba(70,90,120,.12);
}

.map-chest {
  position: absolute;
  z-index: 4;
  width: 60px;
  height: 49px;
  top: 85px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 12px 12px 15px 15px;
  background: linear-gradient(90deg, #9b4f25, #e27a2d 45%, #9d4b20);
  border: 3px solid #ffd65d;
  box-shadow: 0 10px 18px rgba(0,36,80,.32), inset 0 -8px 0 rgba(88,39,23,.18);
}

.map-chest::before {
  content: "";
  position: absolute;
  left: -3px;
  right: -3px;
  top: -15px;
  height: 25px;
  border-radius: 22px 22px 7px 7px;
  background: linear-gradient(#f08a33, #aa5325);
  border: 3px solid #ffd65d;
}

.map-chest::after {
  content: "";
  position: absolute;
  left: 21px;
  top: 13px;
  width: 13px;
  height: 16px;
  border-radius: 4px;
  background: #ffe373;
  box-shadow: inset 0 -4px 0 #dc9c1c;
}

.map-chest.available {
  animation: chest-bounce 1.5s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(255,219,87,.8));
}

.map-chest.claimed {
  filter: grayscale(.55) brightness(.82);
  opacity: .82;
}

@keyframes chest-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0) rotate(-2deg); }
  50% { transform: translateX(-50%) translateY(-7px) rotate(2deg); }
}

.grand-destination {
  position: relative;
  width: 238px;
  min-height: 88px;
  margin: 16px auto 0;
  padding: 18px 16px 14px 78px;
  color: #563700;
  border-radius: 28px;
  background: linear-gradient(145deg, #fff9c5, #ffd253);
  border: 3px solid #fff8c1;
  box-shadow: 0 0 0 5px rgba(255,215,77,.22), 0 18px 28px rgba(0,45,100,.32);
}

.grand-destination::before {
  content: "7";
  position: absolute;
  left: 18px;
  top: 14px;
  width: 51px;
  height: 55px;
  display: grid;
  place-items: center;
  color: white;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffcf4b, #ef7f23);
  border: 3px solid white;
  font-size: 23px;
  font-weight: 1000;
}

.grand-destination strong,
.grand-destination small {
  display: block;
}

.grand-destination small {
  margin-top: 3px;
  font-weight: 800;
}

.bottom-nav {
  position: absolute;
  z-index: 20;
  left: 12px;
  right: 12px;
  bottom: 8px;
  height: 76px;
  display: grid;
  grid-template-columns: 1fr 96px 1fr;
  align-items: end;
  padding-left: 14px;
  padding-right: 14px;
  border-radius: 27px;
  background: linear-gradient(180deg, rgba(246,253,255,.96), rgba(194,232,249,.96));
  border: 2px solid rgba(255,255,255,.9);
  box-shadow: 0 15px 35px rgba(0,26,75,.32), inset 0 -5px 12px rgba(66,139,177,.12);
  backdrop-filter: blur(12px);
}

.nav-button {
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #56708f;
  background: transparent;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.nav-button.active {
  color: #0873bd;
}

.nav-map-icon {
  width: 24px;
  height: 21px;
  border-radius: 8px 8px 5px 5px;
  background: linear-gradient(145deg, #78ecff, #198bcf);
  clip-path: polygon(0 28%, 28% 0, 54% 25%, 76% 3%, 100% 27%, 100% 100%, 0 100%);
}

.play-button {
  align-self: center;
  width: 82px;
  height: 82px;
  margin-top: -28px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  color: #17375e;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff9a0, #ffc329 56%, #ef9718);
  border: 5px solid rgba(255,255,255,.95);
  box-shadow: 0 9px 18px rgba(99,61,0,.34), inset 0 4px 0 rgba(255,255,255,.62);
}

.play-button span {
  width: 0;
  height: 0;
  margin-left: 5px;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 19px solid #17548a;
  filter: drop-shadow(0 2px 0 rgba(255,255,255,.35));
}

.play-button strong {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* Puzzle */

.puzzle-screen {
  background: linear-gradient(180deg, #0f69c2, #042e77);
}

.puzzle-backdrop,
.league-sky {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 28%, rgba(93,242,255,.42), transparent 28%),
    linear-gradient(180deg, #135ec3 0, #0e8ec9 45%, #05347d 100%);
}

.puzzle-backdrop::after {
  content: "";
  position: absolute;
  inset: 40% 0 0;
  background:
    radial-gradient(ellipse at 50% 15%, rgba(91,232,255,.55), transparent 42%),
    linear-gradient(180deg, rgba(0,180,221,.35), rgba(2,34,100,.85));
}

.aurora {
  position: absolute;
  top: -9%;
  width: 45%;
  height: 45%;
  border-radius: 50%;
  filter: blur(26px);
  opacity: .62;
  transform: rotate(24deg);
}

.aurora-one {
  left: 4%;
  background: rgba(75,255,217,.55);
}

.aurora-two {
  right: 3%;
  background: rgba(177,111,255,.56);
}

.ice-cliff {
  position: absolute;
  bottom: -7%;
  width: 35%;
  height: 56%;
  background: linear-gradient(135deg, #dffbff, #5dcdf1 45%, #147bbf);
  filter: drop-shadow(0 0 20px rgba(62,213,255,.35));
}

.ice-cliff.left {
  left: -24%;
  clip-path: polygon(0 13%, 60% 0, 82% 23%, 100% 47%, 78% 100%, 0 100%);
}

.ice-cliff.right {
  right: -24%;
  clip-path: polygon(18% 15%, 66% 0, 100% 17%, 100% 100%, 11% 100%, 0 53%);
}

.puzzle-header {
  height: 72px;
  color: white;
  background: linear-gradient(180deg, rgba(2,24,73,.62), transparent);
}

.back-chevron {
  width: 13px;
  height: 13px;
  border-left: 4px solid white;
  border-bottom: 4px solid white;
  transform: rotate(45deg);
  margin-left: 5px;
}

.puzzle-title {
  text-align: center;
}

.puzzle-title span,
.puzzle-title strong {
  display: block;
}

.puzzle-title span {
  color: #b8eeff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.puzzle-title strong {
  font-size: 18px;
  text-shadow: 0 2px 0 rgba(0,22,71,.3);
}

.stage-reward {
  height: 39px;
  min-width: 68px;
  padding: 0 9px 0 5px;
  display: flex;
  align-items: center;
  gap: 5px;
  border-radius: 20px;
  background: rgba(3,30,79,.65);
  border: 1px solid rgba(255,255,255,.28);
}

.stage-reward .coin-icon {
  width: 25px;
  height: 25px;
}

.puzzle-content {
  position: relative;
  z-index: 4;
  height: calc(100% - 72px - 96px - max(10px, env(safe-area-inset-bottom)));
  display: grid;
  grid-template-rows: auto minmax(208px, 1fr) auto;
  gap: 9px;
  padding: 0 13px 7px;
}

.mission-card,
.word-tray-panel,
.standings-panel,
.league-reward {
  border: 2px solid rgba(255,255,255,.72);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.65);
  backdrop-filter: blur(12px);
}

.mission-card {
  padding: 10px 12px;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(245,253,255,.95), rgba(195,238,255,.9));
}

.mission-copy,
.tray-caption,
.standings-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mission-copy {
  color: #3f6d95;
  font-size: 11px;
  font-weight: 850;
}

.mission-label {
  color: #1767a2;
}

.target-words {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.target-word {
  flex: 1;
  min-width: 0;
  padding: 7px 7px 6px;
  text-align: center;
  border-radius: 12px;
  color: #436282;
  background: rgba(255,255,255,.68);
  border: 1px solid rgba(65,143,184,.16);
  box-shadow: inset 0 -3px 5px rgba(45,134,176,.09);
  font-size: clamp(9px, 2.6vw, 12px);
  font-weight: 1000;
  letter-spacing: .11em;
  white-space: nowrap;
  overflow: hidden;
}

.target-word.found {
  color: #087e72;
  background: linear-gradient(145deg, #d9fff6, #aef2df);
  text-decoration: none;
  animation: word-found 400ms cubic-bezier(.2,.85,.2,1.35);
}

@keyframes word-found {
  0% { transform: scale(.7); opacity: .4; }
  100% { transform: scale(1); opacity: 1; }
}

.letter-lagoon {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-radius: 34px 34px 48% 48% / 28px 28px 22% 22%;
  background:
    radial-gradient(ellipse at 50% 5%, rgba(230,255,255,.9), transparent 22%),
    radial-gradient(ellipse at 50% 55%, rgba(51,227,255,.38), transparent 50%),
    linear-gradient(180deg, rgba(17,150,211,.78), rgba(2,67,145,.86));
  border: 3px solid rgba(193,247,255,.68);
  box-shadow: inset 0 0 35px rgba(0,34,102,.34), 0 15px 30px rgba(0,28,80,.24);
}

.letter-lagoon::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 21%, rgba(255,255,255,.75) 0 2px, transparent 3px),
    radial-gradient(circle at 82% 31%, rgba(255,255,255,.7) 0 2px, transparent 3px),
    radial-gradient(circle at 34% 78%, rgba(255,255,255,.48) 0 1.5px, transparent 2.5px);
  background-size: 91px 83px, 113px 99px, 73px 65px;
  opacity: .7;
}

.lagoon-glow {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 4%;
  height: 40px;
  border-radius: 50%;
  background: rgba(79,238,255,.24);
  filter: blur(12px);
}

.letter-board {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-height: 210px;
  padding: 14px 15px;
  display: flex;
  align-content: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 5px;
}

.hex-tile {
  position: relative;
  width: clamp(43px, 11.4vw, 55px);
  height: clamp(49px, 13vw, 62px);
  flex: 0 0 clamp(43px, 11.4vw, 55px);
  display: grid;
  place-items: center;
  color: #123d70;
  clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0 50%);
  background: linear-gradient(145deg, #ffffff 0 15%, #d7f7ff 48%, #80cfee 100%);
  filter: drop-shadow(0 5px 3px rgba(0,38,91,.32));
  font-size: clamp(20px, 6vw, 28px);
  font-weight: 1000;
  text-shadow: 0 2px 0 white;
  transition: transform 160ms ease, filter 160ms ease, opacity 220ms ease;
  animation: tile-arrive 320ms both;
}

.hex-tile::before {
  content: "";
  position: absolute;
  inset: 5px;
  z-index: -1;
  clip-path: inherit;
  border: 2px solid rgba(255,255,255,.86);
  background: linear-gradient(150deg, rgba(255,255,255,.5), transparent 48%);
}

.hex-tile:active {
  transform: translateY(4px) scale(.95);
  filter: drop-shadow(0 2px 2px rgba(0,38,91,.27));
}

.hex-tile.selected {
  color: #694500;
  background: linear-gradient(145deg, #fffbd3, #ffd44c 60%, #f19c19);
  transform: translateY(-7px);
  filter: drop-shadow(0 0 9px rgba(255,220,81,.78)) drop-shadow(0 6px 3px rgba(0,38,91,.28));
}

.hex-tile.hint {
  animation: hint-pulse 850ms ease-in-out 2;
}

.hex-tile.cleared {
  animation: tile-clear 430ms ease-in forwards;
  pointer-events: none;
}

@keyframes tile-arrive {
  from { opacity: 0; transform: translateY(14px) scale(.8) rotate(-5deg); }
  to { opacity: 1; transform: none; }
}

@keyframes tile-clear {
  55% { transform: translateY(-16px) scale(1.15); opacity: 1; filter: brightness(1.4) drop-shadow(0 0 15px white); }
  100% { transform: translateY(-25px) scale(.2) rotate(16deg); opacity: 0; }
}

@keyframes hint-pulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px) scale(1.1); filter: drop-shadow(0 0 15px #fff47a); }
}

.word-tray-panel {
  padding: 8px 10px 10px;
  border-radius: 21px;
  background: linear-gradient(145deg, rgba(248,254,255,.97), rgba(192,235,252,.94));
}

.tray-caption {
  margin-bottom: 6px;
  color: #385c82;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.tray-caption button {
  min-width: 48px;
  padding: 5px 7px;
  color: #176da9;
  background: transparent;
  font-size: 11px;
  font-weight: 900;
}

.letter-tray {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.tray-slot {
  height: 39px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #184f7b;
  background: rgba(32,112,162,.12);
  border: 2px solid rgba(40,122,170,.18);
  box-shadow: inset 0 3px 7px rgba(0,56,109,.1);
  font-size: 19px;
  font-weight: 1000;
}

.tray-slot.filled {
  background: linear-gradient(145deg, #fff5ad, #ffd24a);
  border-color: #fff0a0;
  box-shadow: 0 4px 8px rgba(125,85,0,.2), inset 0 -3px 0 rgba(213,143,17,.2);
}

.primary-action {
  width: 100%;
  min-height: 43px;
  margin-top: 7px;
  border-radius: 15px;
  color: white;
  background: linear-gradient(180deg, #2bc1ef, #0878c1);
  border: 2px solid #9befff;
  box-shadow: 0 6px 10px rgba(0,78,140,.3), inset 0 2px 0 rgba(255,255,255,.42);
  font-size: 14px;
  font-weight: 1000;
  letter-spacing: .02em;
}

.primary-action:disabled {
  filter: grayscale(.6);
  opacity: .55;
}

.booster-dock {
  position: absolute;
  z-index: 10;
  left: 13px;
  right: 13px;
  bottom: 7px;
  height: 88px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  padding: 8px 10px;
  border-radius: 25px;
  background: linear-gradient(180deg, rgba(238,251,255,.98), rgba(162,222,247,.98));
  border: 2px solid rgba(255,255,255,.92);
  box-shadow: 0 16px 34px rgba(0,25,72,.36), inset 0 -5px 9px rgba(28,119,168,.13);
}

.booster-button {
  position: relative;
  min-width: 0;
  border-radius: 18px;
  display: grid;
  grid-template-columns: 38px 1fr;
  grid-template-rows: 1fr 1fr;
  align-items: center;
  padding: 5px 7px;
  color: #234e76;
  background: rgba(255,255,255,.6);
  border: 1px solid rgba(41,129,171,.16);
}

.booster-button.featured {
  background: linear-gradient(145deg, #fff8c2, #ffe36a);
}

.booster-button:disabled {
  opacity: .45;
  filter: grayscale(.7);
}

.booster-glyph {
  grid-row: 1 / 3;
  width: 34px;
  height: 34px;
  display: block;
  border-radius: 12px;
  background: linear-gradient(145deg, #75eaff, #178bc9);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.55), 0 3px 7px rgba(0,64,112,.24);
}

.undo-glyph::before {
  content: "↶";
  display: grid;
  place-items: center;
  color: white;
  font-size: 27px;
  font-weight: 1000;
}

.hint-glyph {
  background: linear-gradient(145deg, #fff19a, #f4ae20);
}

.hint-glyph::before {
  content: "";
  display: block;
  width: 14px;
  height: 18px;
  margin: 6px auto 0;
  border-radius: 50% 50% 45% 45%;
  background: white;
  box-shadow: 0 16px 0 -4px white;
}

.shuffle-glyph::before {
  content: "⇄";
  display: grid;
  place-items: center;
  color: white;
  font-size: 24px;
  font-weight: 1000;
}

.booster-button strong {
  align-self: end;
  font-size: 10px;
  text-transform: uppercase;
}

.booster-button small {
  align-self: start;
  color: #0c72ad;
  font-size: 12px;
  font-weight: 1000;
}

/* League */

.league-screen {
  background: #0b3c85;
}

.league-sky {
  background:
    radial-gradient(circle at 50% 8%, rgba(113,250,221,.48), transparent 22%),
    radial-gradient(circle at 15% 0, rgba(187,112,255,.55), transparent 28%),
    linear-gradient(180deg, #102a6c, #0d65ad 42%, #052657);
}

.league-sky::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle, white 0 1px, transparent 1.5px) 0 0 / 53px 47px,
    radial-gradient(circle, rgba(175,241,255,.9) 0 1.5px, transparent 2px) 20px 11px / 79px 67px;
  opacity: .45;
}

.league-header {
  color: white;
  justify-content: flex-start;
  gap: 14px;
}

.league-header > div:nth-child(2) {
  flex: 1;
}

.league-header h2 {
  margin: 0;
  font-size: 23px;
}

.league-header span {
  color: #a7eaff;
}

.league-shield {
  width: 47px;
  height: 54px;
  display: grid;
  place-items: center;
  color: white;
  clip-path: polygon(50% 0, 100% 18%, 88% 78%, 50% 100%, 12% 78%, 0 18%);
  background: linear-gradient(145deg, #d8f8ff, #63b6e8 45%, #2863ac);
  filter: drop-shadow(0 6px 5px rgba(0,12,50,.32));
}

.league-shield span {
  color: white;
  font-size: 16px;
  text-shadow: 0 2px 0 rgba(0,30,84,.28);
}

.league-content {
  position: relative;
  z-index: 3;
  height: calc(100% - 74px - 92px);
  overflow-y: auto;
  padding: 0 13px 25px;
  overscroll-behavior: contain;
}

.league-hero {
  text-align: center;
  color: white;
}

.league-hero p {
  margin: 2px 0 0;
  color: #b8efff;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .11em;
}

.league-hero > strong {
  display: block;
  margin-top: 1px;
  font-size: 19px;
}

.podium {
  height: 139px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  padding: 4px 16px 0;
}

.podium-player {
  width: 31%;
  text-align: center;
  color: white;
}

.podium-player:nth-child(2) {
  order: -1;
}

.podium-player:nth-child(1) .podium-avatar {
  width: 62px;
  height: 62px;
  border-color: #ffe574;
  box-shadow: 0 0 18px rgba(255,221,74,.66);
}

.podium-avatar {
  position: relative;
  width: 50px;
  height: 50px;
  margin: 0 auto 4px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #17426e;
  background: linear-gradient(145deg, white, #a9e8f7);
  border: 3px solid #b9f1ff;
  font-weight: 1000;
}

.podium-rank {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffc940;
  border: 2px solid white;
  font-size: 10px;
}

.podium-player strong,
.podium-player small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-player strong { font-size: 11px; }
.podium-player small { color: #bceeff; font-size: 10px; }

.standings-panel {
  padding: 14px 12px 10px;
  border-radius: 28px;
  background: linear-gradient(160deg, rgba(248,253,255,.97), rgba(191,231,247,.95));
}

.standings-heading h3 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
}

.standings-heading span {
  color: #3c82a8;
}

.reward-badge {
  height: 38px;
  padding: 0 10px 0 5px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #875000;
  border-radius: 20px;
  background: #fff1a3;
  font-size: 12px;
  font-weight: 1000;
}

.reward-badge .coin-icon {
  width: 26px;
  height: 26px;
}

.league-list {
  max-height: 275px;
  margin-top: 9px;
  overflow-y: auto;
  scrollbar-width: none;
}

.league-row {
  min-height: 47px;
  display: grid;
  grid-template-columns: 31px 38px 1fr auto;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  margin-bottom: 5px;
  border-radius: 14px;
  color: #294e74;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(57,123,160,.1);
}

.league-row.is-player {
  color: #674400;
  background: linear-gradient(135deg, #fff8bd, #ffdc5c);
  border-color: #ffe990;
  box-shadow: 0 5px 11px rgba(144,93,0,.18);
}

.league-rank {
  text-align: center;
  font-size: 13px;
  font-weight: 1000;
}

.league-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: linear-gradient(145deg, #6de8f4, #2085c1);
  border: 2px solid white;
  font-size: 12px;
  font-weight: 1000;
}

.league-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 900;
}

.league-score {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 1000;
}

.league-score .trophy-icon {
  transform: scale(.68);
}

.league-reward {
  min-height: 70px;
  margin: 10px 0 5px;
  padding: 8px 13px;
  display: grid;
  grid-template-columns: 58px 1fr 20px;
  align-items: center;
  border-radius: 22px;
  color: white;
  background: linear-gradient(135deg, rgba(23,95,160,.92), rgba(5,50,113,.95));
}

.mini-chest {
  width: 47px;
  height: 35px;
  border-radius: 8px 8px 10px 10px;
  background: linear-gradient(90deg, #b35329, #ee8a34, #9b441f);
  border: 3px solid #ffd355;
  box-shadow: 0 5px 8px rgba(0,0,0,.25);
}

.mini-chest span {
  display: block;
  width: 11px;
  height: 14px;
  margin: 10px auto 0;
  border-radius: 3px;
  background: #ffe174;
}

.league-reward span,
.league-reward strong {
  display: block;
}

.league-reward span {
  color: #b9ebff;
  font-size: 10px;
  font-weight: 800;
}

.league-reward strong {
  font-size: 13px;
}

.league-arrow {
  color: white !important;
  font-size: 30px !important;
}

/* Modals, rewards, settings */

.modal-layer {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(22px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
  background: rgba(2,17,51,.66);
  backdrop-filter: blur(9px);
}

.modal-layer.open {
  display: flex;
  animation: fade-in 180ms ease-out;
}

.modal-card {
  position: relative;
  width: min(100%, 390px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 25px 23px 21px;
  text-align: center;
  border-radius: 34px;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 0, rgba(255,255,255,.98), transparent 35%),
    linear-gradient(160deg, #f9ffff, #c9efff);
  border: 3px solid white;
  box-shadow: 0 30px 70px rgba(0,19,63,.48), inset 0 -10px 25px rgba(56,151,195,.12);
  animation: modal-pop 380ms cubic-bezier(.2,.85,.2,1.25);
}

.modal-card.reward-modal {
  background:
    radial-gradient(circle at 50% 0, rgba(255,255,211,.96), transparent 34%),
    linear-gradient(160deg, #faffff, #b8eaff);
}

.modal-card.grand-modal {
  color: #533400;
  background:
    radial-gradient(circle at 50% 0, white, transparent 32%),
    linear-gradient(160deg, #fffbd1, #ffd45a);
  border-color: #fff8bc;
  box-shadow: 0 30px 70px rgba(0,19,63,.48), 0 0 38px rgba(255,220,79,.58);
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes modal-pop {
  from { opacity: 0; transform: translateY(20px) scale(.82); }
  to { opacity: 1; transform: none; }
}

.modal-kicker {
  color: #207ab0;
  font-size: 11px;
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: .13em;
}

.modal-card h2 {
  margin: 6px 0 6px;
  font-size: clamp(28px, 8vw, 38px);
  line-height: 1;
  letter-spacing: -.04em;
}

.modal-card p {
  margin: 7px auto;
  max-width: 300px;
  color: #496785;
  font-size: 14px;
  line-height: 1.42;
  font-weight: 650;
}

.grand-modal p {
  color: #73510c;
}

.reward-art {
  position: relative;
  width: 138px;
  height: 116px;
  margin: 4px auto 12px;
}

.reward-art::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,224,88,.7), transparent 68%);
  animation: reward-glow 1.5s ease-in-out infinite;
}

@keyframes reward-glow {
  50% { transform: scale(1.13); opacity: .62; }
}

.big-chest {
  position: absolute;
  left: 21px;
  right: 21px;
  bottom: 6px;
  height: 68px;
  border-radius: 15px 15px 20px 20px;
  background: linear-gradient(90deg, #8d421f, #e37a2d 42%, #9a451f);
  border: 5px solid #ffd658;
  box-shadow: 0 13px 16px rgba(89,48,0,.3), inset 0 -12px 0 rgba(70,27,12,.16);
}

.big-chest::before {
  content: "";
  position: absolute;
  left: -5px;
  right: -5px;
  top: -29px;
  height: 39px;
  border-radius: 45px 45px 10px 10px;
  background: linear-gradient(#f29339, #9e4721);
  border: 5px solid #ffd658;
}

.big-chest::after {
  content: "";
  position: absolute;
  left: 37px;
  top: 17px;
  width: 22px;
  height: 27px;
  border-radius: 5px;
  background: #ffdf6f;
  box-shadow: inset 0 -6px 0 #d69514;
}

.reward-chips {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 15px 0;
}

.reward-chip {
  min-width: 88px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 17px;
  color: #775000;
  background: rgba(255,255,255,.68);
  border: 1px solid rgba(199,151,30,.16);
  font-weight: 1000;
}

.modal-actions {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.modal-button {
  min-height: 50px;
  border-radius: 17px;
  font-weight: 1000;
}

.modal-button.primary {
  color: white;
  background: linear-gradient(180deg, #37c8ed, #0877bf);
  border: 2px solid #9aedff;
  box-shadow: 0 7px 12px rgba(0,91,150,.25), inset 0 2px 0 rgba(255,255,255,.35);
}

.modal-button.gold {
  color: #694300;
  background: linear-gradient(180deg, #fff099, #ffc42f);
  border: 2px solid #fff7c3;
  box-shadow: 0 7px 12px rgba(117,72,0,.25), inset 0 2px 0 rgba(255,255,255,.5);
}

.modal-button.secondary {
  color: #356289;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(44,116,158,.15);
}

.settings-form {
  margin-top: 16px;
  display: grid;
  gap: 11px;
  text-align: left;
}

.settings-form label,
.setting-row {
  color: #244d75;
  font-size: 12px;
  font-weight: 900;
}

.settings-form input[type="text"] {
  width: 100%;
  min-height: 48px;
  margin-top: 5px;
  padding: 0 13px;
  border: 2px solid rgba(48,133,180,.22);
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255,255,255,.72);
  font-size: 16px;
  font-weight: 800;
}

.setting-row {
  min-height: 48px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 14px;
  background: rgba(255,255,255,.55);
}

.setting-row input {
  width: 24px;
  height: 24px;
  accent-color: #138ac5;
}

.toast {
  position: fixed;
  z-index: 150;
  left: 50%;
  bottom: max(106px, calc(env(safe-area-inset-bottom) + 94px));
  max-width: calc(100% - 40px);
  padding: 11px 17px;
  border-radius: 999px;
  color: white;
  background: rgba(4,28,72,.94);
  border: 1px solid rgba(255,255,255,.35);
  box-shadow: 0 10px 24px rgba(0,19,60,.34);
  font-size: 12px;
  font-weight: 850;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.confetti-layer {
  position: fixed;
  z-index: 140;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 18px;
  border-radius: 3px;
  animation: confetti-fall 2.5s ease-in forwards;
}

@keyframes confetti-fall {
  to {
    transform: translate3d(var(--drift), 110vh, 0) rotate(760deg);
    opacity: .7;
  }
}

.shake {
  animation: shake 320ms ease;
}

@keyframes shake {
  25% { transform: translateX(-7px); }
  50% { transform: translateX(7px); }
  75% { transform: translateX(-4px); }
}

/* Compact phones */

@media (max-height: 720px) {
  .brand-card {
    padding-top: 10px;
    padding-bottom: 9px;
  }

  .brand-card h1 {
    font-size: 26px;
  }

  .brand-subtitle { font-size: 12px; }
  .brand-signature { font-size: 10px; }

  .map-scroll {
    height: calc(100% - 188px);
  }

  .puzzle-header {
    height: 62px;
  }

  .puzzle-content {
    height: calc(100% - 62px - 84px - max(8px, env(safe-area-inset-bottom)));
    grid-template-rows: auto minmax(168px, 1fr) auto;
    gap: 6px;
    padding-bottom: 4px;
  }

  .mission-card {
    padding: 7px 10px;
  }

  .target-words {
    margin-top: 5px;
  }

  .letter-board {
    min-height: 170px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .hex-tile {
    width: clamp(39px, 10.7vw, 48px);
    height: clamp(44px, 12vw, 54px);
    flex-basis: clamp(39px, 10.7vw, 48px);
    font-size: 20px;
  }

  .word-tray-panel {
    padding-top: 6px;
    padding-bottom: 7px;
  }

  .tray-caption {
    margin-bottom: 4px;
  }

  .tray-slot {
    height: 33px;
  }

  .primary-action {
    min-height: 38px;
    margin-top: 5px;
  }

  .booster-dock {
    height: 78px;
  }

  .booster-glyph {
    width: 30px;
    height: 30px;
  }

  .league-content {
    height: calc(100% - 66px - 86px);
  }

  .podium {
    height: 112px;
  }

  .league-list {
    max-height: 215px;
  }
}

@media (min-width: 521px) {
  body {
    background:
      radial-gradient(circle at 50% 30%, #1853a2, #020b25 70%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
