:root {
  --grass: #2fa461;
  --pitch: #176a45;
  --ink: #17304a;
  --panel: rgba(255, 255, 255, 0.92);
  --gold: #ffc943;
  --orange: #ff8a3d;
  --blue: #2d8cff;
  --red: #ef4e5c;
  --green: #31c879;
  --shadow: 0 14px 32px rgba(10, 28, 47, 0.22);
}

* { box-sizing: border-box; }

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: Fredoka, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  touch-action: manipulation;
}

body {
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 255, 255, 0.28), transparent 30%),
    linear-gradient(180deg, rgba(20, 118, 194, 0.12), rgba(0, 80, 35, 0.16)),
    url("assets/stadium_background.webp") center / cover no-repeat;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

.screen {
  position: absolute;
  inset: 0;
}

.loading-screen {
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  background:
    linear-gradient(180deg, rgba(20, 86, 124, 0.96), rgba(21, 108, 72, 0.98)),
    url("assets/grass_field_background.webp") center / cover;
}

.loading-ball {
  width: min(28vw, 150px);
  animation: bounce 1.2s ease-in-out infinite;
  filter: drop-shadow(0 16px 20px rgba(0, 0, 0, 0.28));
}

.loading-screen h1,
.home-hero h1 {
  margin: 18px 0 8px;
  font-size: clamp(38px, 10vw, 68px);
  letter-spacing: 0;
  text-shadow: 0 5px 16px rgba(0, 0, 0, 0.28);
}

.load-note {
  min-height: 24px;
  font-weight: 700;
}

.load-track {
  width: min(76vw, 420px);
  height: 14px;
  margin-top: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.24);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.22);
}

#load-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffed7a, #ff9a38);
  transition: width 260ms ease;
}

.home-screen {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: max(18px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(19, 102, 69, 0.42)),
    url("assets/grass_field_background.webp") center / cover;
}

.top-resource {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 2;
}

.top-actions {
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.coin-pill {
  min-width: 96px;
  height: 44px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 8px;
  color: #563d00;
  font-size: 20px;
  font-weight: 800;
  border: 3px solid #fff4aa;
  background: linear-gradient(180deg, #fff19b 0%, #ffc940 48%, #f39b20 100%);
  box-shadow: 0 6px 0 #a65b12, 0 10px 18px rgba(20, 40, 60, 0.22), inset 0 3px 0 rgba(255, 255, 255, 0.55);
}

.coin-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: url("assets/ui-super/coin.png") center / contain no-repeat;
  filter: drop-shadow(0 2px 2px rgba(99, 51, 0, 0.25));
}

.coin-mini {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: -2px;
  margin-right: 2px;
  background: url("assets/ui-super/coin.png") center / contain no-repeat;
}

.icon-btn {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  font-size: 24px;
  font-weight: 900;
  background: rgba(13, 43, 73, 0.74);
  border: 3px solid #8dd3ff;
  background: linear-gradient(180deg, #54b7ff 0%, #2584f3 58%, #1764c3 100%);
  box-shadow: 0 5px 0 #063b82, 0 8px 14px rgba(15, 39, 61, 0.28), inset 0 3px 0 rgba(255, 255, 255, 0.42);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.text-btn {
  font-size: 16px;
}

.leaderboard-btn {
  width: auto;
  min-width: 64px;
  padding: 0 12px;
}

.shortcut-btn {
  position: relative;
  width: auto;
  min-width: 0;
  max-width: 180px;
  padding: 0 12px;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 6px;
  font-size: 14px;
  white-space: nowrap;
}

.shortcut-icon {
  font-size: 20px;
  line-height: 1;
}

.shortcut-btn.ready {
  border-color: #fff4aa;
  background: linear-gradient(180deg, #43dc85 0%, #1caf62 58%, #0e8849 100%);
}

.shortcut-btn.installed {
  border-color: #ffe08f;
}

.shortcut-reward-badge {
  position: absolute;
  right: -6px;
  top: -8px;
  min-width: 54px;
  height: 22px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #6d3100;
  font-size: 11px;
  font-weight: 900;
  background: linear-gradient(180deg, #fff29a 0%, #ffc73c 58%, #f09428 100%);
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 3px 0 #a65b12;
}

.shortcut-btn.claimed .shortcut-reward-badge {
  display: none;
}

.home-hero {
  min-height: 44vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: white;
}

.home-ball {
  width: min(32vw, 180px);
  filter: drop-shadow(0 18px 26px rgba(0, 0, 0, 0.35));
}

.home-hero p {
  max-width: 560px;
  margin: 0;
  padding: 0 12px;
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 700;
  text-shadow: 0 3px 8px rgba(0, 0, 0, 0.32);
}

.mode-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  width: min(560px, 100%);
  margin: 0 auto;
}

.mode-btn {
  height: 92px;
  display: grid;
  grid-template-columns: 58px 1fr;
  grid-template-rows: 1fr 1fr;
  align-items: center;
  gap: 0 10px;
  padding: 14px 18px;
  text-align: left;
  border-radius: 8px;
  color: white;
  font-size: 28px;
  font-weight: 900;
  box-shadow: var(--shadow), inset 0 2px 0 rgba(255, 255, 255, 0.22);
}

.mode-btn.primary {
  border: 4px solid rgba(255,255,255,0.55);
  background: linear-gradient(180deg, #41dd7b 0%, #1bbd62 56%, #10934d 100%);
}
.mode-btn.danger {
  border: 4px solid rgba(255,255,255,0.55);
  background: linear-gradient(180deg, #ffe36c 0%, #ffb534 58%, #ee792a 100%);
  color: #6b3600;
}

.mode-icon {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.mode-btn small {
  font-size: 15px;
  opacity: 0.82;
}

.game-screen {
  display: grid;
  grid-template-rows: 72px minmax(250px, 48vh) 66px 44px 82px 78px;
  background:
    linear-gradient(180deg, rgba(9, 70, 126, 0.18), rgba(8, 113, 54, 0.2)),
    url("assets/grass_field_background.webp") center / cover;
}

.hud {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: max(12px, env(safe-area-inset-top)) 10px 8px;
}

.hud-center {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.level-title,
.timer {
  min-width: 84px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  font-weight: 900;
  border: 3px solid #8dd3ff;
  background: linear-gradient(180deg, #49b4ff 0%, #197fe5 60%, #0d58b7 100%);
  box-shadow: 0 4px 0 #073b84, inset 0 3px 0 rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.timer.warning { background: #f0912f; }
.timer.danger { background: #db3043; animation: pulse 0.55s ease-in-out infinite; }

.settings-word {
  width: auto;
  min-width: 84px;
  height: 42px;
  padding: 0 12px;
  font-size: 15px;
  border-color: #8dd3ff;
  background: linear-gradient(180deg, #49b4ff 0%, #197fe5 60%, #0d58b7 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.board-wrap {
  position: relative;
  min-height: 0;
  margin: 0 12px;
  border: 8px solid rgba(255, 255, 255, 0.72);
  border-bottom-width: 12px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.2) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.22) 1px, transparent 1px),
    linear-gradient(180deg, rgba(71, 177, 91, 0.42), rgba(28, 145, 76, 0.46)),
    url("assets/grass_field_background.webp") center / cover;
  background-size: 42px 42px, 42px 42px, auto, cover;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.board {
  position: absolute;
  inset: 10px;
}

.tile {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #dbefff);
  border: 2px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 5px 9px rgba(3, 28, 51, 0.18), inset 0 -3px 0 rgba(31, 78, 116, 0.1);
  transition: transform 160ms ease, opacity 160ms ease, filter 160ms ease;
  overflow: visible;
}

.stack-shadow {
  position: absolute;
  border-radius: 8px;
  background: linear-gradient(180deg, #f6fbff, #b9cfe4);
  border: 1px solid rgba(255, 255, 255, 0.48);
  box-shadow: 0 2px 5px rgba(3, 28, 51, 0.08);
  opacity: 0.28;
  overflow: hidden;
}

.stack-shadow img {
  width: 90%;
  height: 90%;
  object-fit: contain;
  filter: saturate(0.6) brightness(0.9);
  opacity: 0.08;
}

.tile.clickable { cursor: pointer; }
.tile.clickable:active { transform: scale(0.92); }
.tile.blocked:not(.ice) { filter: grayscale(0.75) brightness(0.76); }
.tile.hidden-under { opacity: 0; pointer-events: none; }

.tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.stack-badge,
.mechanic-badge {
  position: absolute;
  right: -5px;
  bottom: -5px;
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: white;
  font-size: 14px;
  font-weight: 900;
  background: #183d62;
  border: 2px solid white;
}

.mechanic-badge {
  left: -6px;
  right: auto;
  top: -6px;
  bottom: auto;
  background: #ff8a31;
}

.tile.well {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.86), rgba(211,234,249,0.9)),
    url("assets/dropaway/box.png") center / 92% 92% no-repeat;
  box-shadow: 0 5px 9px rgba(3, 28, 51, 0.18), inset 0 0 0 4px rgba(26, 90, 144, 0.58), inset 0 -3px 0 rgba(31, 78, 116, 0.1);
}

.well-count-badge {
  position: absolute;
  right: 7%;
  bottom: 7%;
  min-width: 28%;
  height: 28%;
  padding: 0 3px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: white;
  font-size: clamp(10px, calc(var(--tile-size, 56px) * 0.24), 18px);
  line-height: 1;
  font-weight: 900;
  background: rgba(24, 61, 98, 0.88);
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 4px rgba(3, 28, 51, 0.18);
  pointer-events: none;
}

.tile.ice {
  filter: none;
  box-shadow: 0 0 0 5px rgba(84, 216, 255, 0.72), 0 8px 16px rgba(0, 92, 138, 0.3), inset 0 0 18px rgba(186, 246, 255, 0.74);
}
.tile.ice::before {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.62), rgba(114, 228, 255, 0.18) 34%, rgba(36, 188, 239, 0.46) 72%, rgba(215, 251, 255, 0.7)),
    url("assets/dropaway/ice.png") center / 100% 100% no-repeat;
  opacity: 0.96;
  pointer-events: none;
  z-index: 3;
  mix-blend-mode: normal;
}
.tile.ice img {
  filter: saturate(1.05) brightness(1.04);
}
.tile.ice .ice-crack {
  position: absolute;
  inset: -5px;
  border-radius: 10px;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
}
.tile.ice-stage-2 .ice-crack {
  opacity: 0.72;
  background:
    linear-gradient(122deg, transparent 0 41%, rgba(255, 255, 255, 0.95) 42% 44%, rgba(31, 154, 209, 0.45) 45% 46%, transparent 47%),
    linear-gradient(28deg, transparent 0 58%, rgba(255, 255, 255, 0.82) 59% 61%, transparent 62%);
}
.tile.ice-stage-1 .ice-crack {
  opacity: 0.9;
  background:
    linear-gradient(122deg, transparent 0 38%, rgba(255, 255, 255, 0.98) 39% 41%, rgba(31, 154, 209, 0.48) 42% 43%, transparent 44%),
    linear-gradient(28deg, transparent 0 55%, rgba(255, 255, 255, 0.9) 56% 58%, transparent 59%),
    linear-gradient(72deg, transparent 0 46%, rgba(255, 255, 255, 0.86) 47% 49%, transparent 50%),
    radial-gradient(circle at 28% 72%, rgba(255, 255, 255, 0.85) 0 5%, transparent 6%),
    radial-gradient(circle at 70% 26%, rgba(255, 255, 255, 0.72) 0 4%, transparent 5%);
}
.tile.blind img { opacity: 0; }
.tile.blind::after {
  content: "?";
  position: absolute;
  inset: max(4px, calc(var(--tile-size, 56px) * 0.12));
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  font-size: clamp(16px, calc(var(--tile-size, 56px) * 0.52), 42px);
  line-height: 1;
  font-weight: 900;
  background: linear-gradient(180deg, #a6adb6, #606b78);
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.28);
}
.tile.locked-layer { outline: 4px solid rgba(40, 40, 40, 0.65); }
.tile.safe { outline: 4px solid #ffcf42; }
.tile.locked-layer::before {
  content: "";
  position: absolute;
  inset: 10%;
  background: url("assets/dropaway/lock.png") center / contain no-repeat;
  pointer-events: none;
  z-index: 2;
}

.rope-line,
.slider-track,
.slider-block,
.safe-block {
  position: absolute;
  pointer-events: none;
}

.slider-track { z-index: 72; }
.slider-block { z-index: 88; }
.rope-line,
.safe-block { z-index: 82; }

.rope-line {
  height: 7px;
  transform-origin: left center;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, #8a562d 0 12px, #f0c17b 12px 21px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.28);
}

.rope-line.covered {
  height: 5px;
  opacity: 0.72;
  filter: saturate(0.85) brightness(0.92);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.slider-block,
.safe-block {
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  border-radius: 8px;
  border: 3px solid rgba(255, 255, 255, 0.64);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.26);
}

.slider-track {
  border-radius: 10px;
  border: 4px solid rgba(63, 70, 78, 0.9);
  background:
    repeating-linear-gradient(90deg, transparent 0 16px, rgba(59, 48, 42, 0.68) 16px 23px, transparent 23px 39px),
    linear-gradient(180deg, rgba(214, 223, 229, 0.42), rgba(90, 98, 106, 0.2));
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.28),
    inset 0 10px 14px rgba(255, 255, 255, 0.18),
    0 7px 14px rgba(0, 0, 0, 0.22);
}

.slider-track::before,
.slider-track::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e9eef2, #6d7882 55%, #303840);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.slider-track::before { top: 12px; }
.slider-track::after { bottom: 12px; }

.slider-block {
  border: 4px solid rgba(238, 244, 247, 0.9);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.32), transparent 28%),
    linear-gradient(180deg, #aeb8bf 0%, #7d8992 46%, #55606a 47%, #353e47 100%);
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 255, 0.36),
    inset 0 -7px 0 rgba(0, 0, 0, 0.24),
    0 9px 18px rgba(0, 0, 0, 0.36);
  overflow: hidden;
}

.slider-block::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 6px;
  background:
    radial-gradient(circle at 18% 28%, rgba(255, 255, 255, 0.5) 0 2px, transparent 3px),
    radial-gradient(circle at 80% 72%, rgba(0, 0, 0, 0.24) 0 2px, transparent 3px),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0 12px, rgba(0, 0, 0, 0.08) 12px 24px);
  border: 2px solid rgba(43, 49, 56, 0.25);
}

.safe-block {
  border: 4px solid rgba(239, 247, 255, 0.92);
  color: #f8fbff;
  font-size: clamp(24px, 8vw, 46px);
  text-shadow: 0 3px 0 rgba(28, 45, 62, 0.82), 0 5px 9px rgba(0, 0, 0, 0.35);
  background:
    url("assets/dropaway/lock.png") center / min(58%, 70px) auto no-repeat,
    radial-gradient(circle at 50% 32%, rgba(255, 255, 255, 0.45) 0 12%, transparent 26%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.16) 0 9px, rgba(28, 43, 58, 0.12) 9px 18px),
    linear-gradient(180deg, #96a8b8 0%, #607384 47%, #3d4c5b 48%, #273542 100%);
  box-shadow:
    inset 0 8px 0 rgba(255, 255, 255, 0.24),
    inset 0 -12px 0 rgba(18, 28, 38, 0.36),
    0 8px 18px rgba(0, 0, 0, 0.32);
  overflow: hidden;
}

.safe-block::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 8px;
  border: 3px solid rgba(225, 236, 245, 0.62);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 42%),
    radial-gradient(circle at 50% 50%, rgba(21, 31, 42, 0.18) 0 28%, transparent 29%);
  pointer-events: none;
}

.safe-block::after {
  content: "";
  position: absolute;
  right: 9px;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, #f4fbff 0 28%, #aabac7 30% 58%, #283846 60%);
  box-shadow: 0 2px 4px rgba(18, 28, 38, 0.36);
  pointer-events: none;
}

.stadium-floor {
  display: contents;
}

.ball-origin {
  grid-row: 3;
  align-self: center;
  justify-self: center;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.24);
}

.ball-origin img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.25));
}

.flying-ball {
  position: fixed;
  z-index: 80;
  width: 40px;
  height: 40px;
  pointer-events: none;
  background: url("assets/soccer_ball.webp") center / contain no-repeat;
  transition: transform 280ms cubic-bezier(0.2, 0.75, 0.25, 1), opacity 280ms ease;
}

.hit-effect {
  position: fixed;
  z-index: 90;
  width: 90px;
  height: 90px;
  margin: -45px 0 0 -45px;
  pointer-events: none;
  border-radius: 50%;
  background:
    url("assets/dropaway/fx_circle_glow.png") center / 88% 88% no-repeat,
    url("assets/dropaway/fx_glow_small.png") center / contain no-repeat;
  animation: hitFlash 620ms ease-out forwards;
  mix-blend-mode: screen;
}

.hit-effect span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 13px;
  height: 13px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 18%, #ffe36d 19% 54%, rgba(255, 138, 61, 0) 70%);
  animation: hitSpark 560ms ease-out forwards;
}

.tray {
  grid-row: 5;
  align-self: center;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
  height: 74px;
  padding: 0 12px;
}

.slot {
  aspect-ratio: 1 / 1;
  height: auto;
  min-width: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.32);
  border: 2px dashed rgba(255, 255, 255, 0.65);
}

.slot.filled {
  border-style: solid;
  background: rgba(255, 255, 255, 0.8);
}

.slot img {
  width: 86%;
  height: 86%;
  object-fit: contain;
}

.removed-stack {
  grid-row: 4;
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  height: 42px;
  margin: 0 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  pointer-events: auto;
}

.held-tile {
  position: absolute;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.held-tile img {
  width: 82%;
  height: 82%;
  object-fit: contain;
}

.boosters {
  grid-row: 6;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 4px 10px max(8px, env(safe-area-inset-bottom));
}

.booster {
  min-width: 0;
  height: 68px;
  display: grid;
  grid-template-rows: 46px 18px;
  place-items: center;
  gap: 2px;
  padding: 0 2px;
  border-radius: 0;
  color: white;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.booster .ico {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.72);
  background: linear-gradient(180deg, #58c3ff 0%, #2586ef 56%, #135cbf 100%);
  box-shadow: 0 4px 0 #073b84, 0 7px 12px rgba(15, 39, 61, 0.22), inset 0 2px 0 rgba(255, 255, 255, 0.4);
  font-size: 20px;
  filter: drop-shadow(0 3px 2px rgba(9, 45, 84, 0.28));
}
.booster .ico.art img {
  max-width: 25px;
  max-height: 25px;
  object-fit: contain;
  display: block;
}
.booster .ico.art img[src*="booster_shuffle"] {
  max-width: 23px;
  max-height: 23px;
}
.booster .ico.art img[src*="booster_remove"] {
  max-width: 22px;
  max-height: 22px;
  transform: rotate(-90deg);
}
.booster .name {
  width: 100%;
  min-width: 0;
  color: white;
  font-size: 12px;
  line-height: 18px;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
}
.booster.used { filter: grayscale(1); opacity: 0.55; }

.modal-layer {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(7, 21, 36, 0.62);
}

.modal {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 20px;
  border-radius: 8px;
  border: 5px solid rgba(255, 255, 255, 0.95);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(237, 249, 255, 0.98));
  box-shadow: 0 16px 38px rgba(0, 32, 64, 0.28), inset 0 -10px 0 rgba(70, 151, 218, 0.1);
  text-align: center;
}

.modal-close {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  font-size: 26px;
  line-height: 1;
  font-weight: 900;
  background: linear-gradient(180deg, #ff7784 0%, #ef4e5c 58%, #b72736 100%);
  border: 3px solid rgba(255, 255, 255, 0.78);
  box-shadow: 0 4px 0 #7c1724, 0 7px 12px rgba(31, 12, 18, 0.22);
}

.modal h2 {
  margin: 8px 0 10px;
  font-size: 30px;
  letter-spacing: 0;
}

.modal p {
  margin: 8px 0;
  line-height: 1.45;
  font-weight: 700;
}

.modal-icon {
  width: 74px;
  height: 74px;
  margin: 0 auto 8px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #fff3a8, #ff9f35);
  color: white;
  font-size: 42px;
  box-shadow: var(--shadow);
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.action-btn {
  min-width: 124px;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 8px;
  color: white;
  font-size: 18px;
  font-weight: 900;
  border: 3px solid rgba(255, 255, 255, 0.62);
  background: linear-gradient(180deg, #4ee884 0%, #20bf65 58%, #10934d 100%);
  box-shadow: 0 5px 0 #0a6f3b, inset 0 3px 0 rgba(255, 255, 255, 0.4);
}

.action-btn.secondary {
  background: linear-gradient(180deg, #62baff 0%, #2586ef 58%, #135cbf 100%);
  box-shadow: 0 5px 0 #073b84, inset 0 3px 0 rgba(255, 255, 255, 0.4);
}
.action-btn.warning {
  background: linear-gradient(180deg, #ffe77a 0%, #ffc637 55%, #f09128 100%);
  box-shadow: 0 5px 0 #a65b12, inset 0 3px 0 rgba(255, 255, 255, 0.48);
  color: #6d3100;
}

.ad-modal {
  width: min(620px, calc(100vw - 24px));
  padding: 14px;
}

.ad-modal h2 {
  margin-top: 0;
  font-size: 22px;
}

.video-ad {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
  background: #071524;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.14);
}

.video-ad-player {
  display: block;
  width: 100%;
  max-height: min(70vh, 560px);
  object-fit: contain;
  background: #071524;
}

.video-ad-cta {
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  transform: translateX(-50%);
  min-width: 150px;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 999px;
  color: #0d3e22;
  font-size: 18px;
  font-weight: 900;
  text-decoration: none;
  border: 3px solid rgba(255, 255, 255, 0.9);
  background: linear-gradient(180deg, #fff27a 0%, #ffc83c 52%, #f08f28 100%);
  box-shadow: 0 5px 0 #a65b12, 0 10px 18px rgba(0, 0, 0, 0.28), inset 0 3px 0 rgba(255, 255, 255, 0.5);
}

.ad-close-confirm {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 20, 34, 0.68);
}

.ad-close-card {
  width: min(420px, 100%);
  padding: 20px;
  border-radius: 8px;
  border: 4px solid rgba(255, 255, 255, 0.92);
  background: linear-gradient(180deg, #fff, #eaf7ff);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.32);
  text-align: center;
}

.ad-close-card h3 {
  margin: 0 0 10px;
  color: #12385c;
  font-size: 24px;
}

.ad-close-card p {
  margin: 0;
  color: #31506d;
  font-weight: 900;
}

.booster-modal {
  padding-top: 24px;
}

.booster-detail {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.booster-detail-icon {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  font-size: 42px;
  border: 5px solid rgba(255, 255, 255, 0.86);
  background: linear-gradient(180deg, #58c3ff 0%, #2586ef 56%, #135cbf 100%);
  box-shadow: 0 7px 0 #073b84, 0 12px 20px rgba(15, 39, 61, 0.24), inset 0 4px 0 rgba(255, 255, 255, 0.42);
}

.booster-detail-icon img {
  max-width: 54px;
  max-height: 54px;
  object-fit: contain;
  display: block;
}

.booster-detail-icon img[src*="booster_remove"] {
  transform: rotate(-90deg);
}

.booster-modal .modal-actions {
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 12px;
}

.booster-modal .action-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 8px;
}

.stars-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  font-size: 36px;
  color: #ffbf24;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.mechanic-progress {
  margin: 14px 0 4px;
}

.rank-list {
  display: grid;
  gap: 8px;
  margin: 8px 0;
}

.rank-row {
  min-height: 48px;
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  text-align: left;
  font-weight: 900;
  background: rgba(45, 140, 255, 0.1);
  border: 2px solid rgba(45, 140, 255, 0.18);
}

.rank-row.local {
  background: rgba(255, 201, 67, 0.18);
  border-color: rgba(255, 201, 67, 0.45);
}

.rank-no {
  color: #0d58b7;
}

.rank-row strong {
  color: #0d7140;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 900;
}

.progress-img {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: white;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.progress-img img {
  width: 80%;
  height: 80%;
  object-fit: contain;
}

.progress-track {
  height: 12px;
  margin-top: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #d7e2eb;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #34c978, #ffcf34);
}

.setting-row,
.dev-row {
  min-height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(23, 48, 74, 0.12);
  font-weight: 900;
}

.toggle {
  width: 58px;
  height: 30px;
  padding: 3px;
  border-radius: 999px;
  background: #aab5bf;
}

.toggle::after {
  content: "";
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  transition: transform 160ms ease;
}

.toggle.on { background: #29c477; }
.toggle.on::after { transform: translateX(28px); }

.dev-panel {
  position: absolute;
  right: 12px;
  top: 86px;
  z-index: 110;
  width: min(340px, calc(100vw - 24px));
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.auto-validator {
  position: absolute;
  left: 12px;
  top: 82px;
  z-index: 115;
  max-width: 250px;
  padding: 9px 12px;
  border-radius: 8px;
  color: white;
  font-size: 12px;
  font-weight: 800;
  background: rgba(24, 52, 82, 0.88);
  box-shadow: var(--shadow);
  pointer-events: none;
}

.auto-validator strong {
  display: block;
  font-size: 14px;
  color: #ffe071;
}

.dev-panel h3 { margin: 0 0 8px; }
.dev-panel input {
  width: 98px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid #cbd7e2;
  padding: 0 8px;
}

.dev-panel button {
  min-height: 36px;
  border-radius: 8px;
  color: white;
  font-weight: 900;
  background: #246eb9;
  padding: 6px 10px;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 26px;
  z-index: 130;
  transform: translateX(-50%);
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 8px;
  color: white;
  font-weight: 900;
  background: rgba(15, 39, 61, 0.92);
  box-shadow: var(--shadow);
}

.tutorial-hand {
  position: absolute;
  width: 96px;
  height: 96px;
  z-index: 30;
  pointer-events: none;
  animation: handTap 1s ease-in-out infinite;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.28));
}

.spinner {
  width: 58px;
  height: 58px;
  margin: 12px auto;
  border: 7px solid rgba(43, 144, 255, 0.2);
  border-top-color: #2b90ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.reward-star {
  position: fixed;
  z-index: 140;
  pointer-events: none;
  color: #ffbf24;
  font-size: 24px;
  transition: transform 620ms cubic-bezier(0.22, 0.78, 0.22, 1), opacity 620ms ease;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-18px); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes handTap {
  0%, 100% { transform: translate(18px, 20px) scale(1); opacity: 0.95; }
  50% { transform: translate(0, 0) scale(0.92); opacity: 0.7; }
}

@keyframes hitFlash {
  0% { transform: scale(0.35) rotate(0deg); opacity: 0; }
  18% { opacity: 1; }
  100% { transform: scale(1.55) rotate(24deg); opacity: 0; }
}

@keyframes hitSpark {
  0% { transform: translate(0, 0) scale(0.6); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.1); opacity: 0; }
}

@media (min-width: 720px) {
  .game-screen {
    width: min(680px, 100vw);
    left: 50%;
    transform: translateX(-50%);
    border-left: 1px solid rgba(255, 255, 255, 0.25);
    border-right: 1px solid rgba(255, 255, 255, 0.25);
  }
}

@media (max-width: 430px) {
  .home-screen {
    padding-left: 12px;
    padding-right: 12px;
  }
  .top-resource {
    gap: 6px;
  }
  .top-actions {
    gap: 6px;
  }
  .shortcut-btn {
    width: 46px;
    height: 46px;
    padding: 0;
  }
  .shortcut-btn [data-i18n] {
    display: none;
  }
  .shortcut-reward-badge {
    min-width: 50px;
    height: 20px;
    font-size: 10px;
    right: -8px;
    top: -7px;
  }
  .top-resource .coin-pill {
    min-width: 74px;
    height: 42px;
    padding: 0 8px;
    font-size: 16px;
  }
  .top-resource .coin-icon {
    width: 22px;
    height: 22px;
  }
  .top-resource .leaderboard-btn {
    min-width: 54px;
    padding: 0 8px;
    font-size: 14px;
  }
  .top-resource #lang-btn {
    width: 42px;
    height: 42px;
    font-size: 16px;
  }
}

@media (max-width: 380px) {
  .hud {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 4px;
    padding: max(10px, env(safe-area-inset-top)) 6px 8px;
  }
  .hud-center { gap: 4px; }
  .hud .coin-pill {
    position: static;
    min-width: 62px;
    height: 40px;
    padding: 0 7px;
    gap: 4px;
    font-size: 14px;
    border-width: 2px;
  }
  .hud .coin-icon {
    width: 20px;
    height: 20px;
  }
  .level-title, .timer { min-width: 64px; height: 40px; font-size: 14px; }
  .settings-word { min-width: 64px; height: 40px; padding: 0 8px; font-size: 14px; }
  .booster .name { font-size: 11px; }
  .game-screen { grid-template-rows: 72px minmax(230px, 46vh) 60px 40px 76px 76px; }
}
