* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* notch / home-indicator insets, readable from JS for stage fitting */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}
html, body {
  width: 100%;
  height: 100%;
  background: #0b1020;
  font-family: "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#game {
  position: relative;
  width: 100vw;
  height: 100vh;    /* fallback for old browsers */
  /* svh = the SMALL viewport (toolbars shown). Deliberately not dvh: dvh grows
     when the address bar auto-hides, and anything sized against that taller box
     gets clipped the moment the bar comes back. svh always fits. */
  height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#canvas {
  display: block;
  background: linear-gradient(#0e1838 0%, #243a72 38%, #5a7bc4 70%, #93b0e0 100%);
  box-shadow: 0 0 70px rgba(3, 8, 20, 0.48);
  touch-action: none;
  filter: saturate(1.06) contrast(1.025);
}

/* ---------- interactive tutorial hint ---------- */
.tuthint {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translate(-50%, -50%);
  z-index: 8;
  pointer-events: none;
  text-align: center;
  color: #fff;
  font-size: clamp(20px, 5.5vw, 34px);
  font-weight: 900;
  letter-spacing: 1px;
  padding: 14px 26px;
  border-radius: 18px;
  background: rgba(242, 103, 34, 0.9);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 3px rgba(255, 255, 255, 0.25) inset;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  animation: tutPulse 0.9s ease-in-out infinite;
  max-width: 84vw;
}
.tuthint.hidden { display: none; }
@keyframes tutPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.07); }
}

/* cinematic vignette over the 3D view (free — pure CSS, below the HUD) */
#game::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background: linear-gradient(to bottom, rgba(8, 15, 34, 0.18), transparent 23%, transparent 76%, rgba(4, 8, 18, 0.25));
  box-shadow: inset 0 0 130px 18px rgba(0, 0, 0, 0.28);
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  top: 14px;
  left: 50%;
  right: auto;
  width: min(100vw, 760px);
  transform: translateX(-50%);
  padding-right: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 6px;
  pointer-events: none;
  z-index: 5;
}
.hud-item {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  min-width: 126px;
  padding: 7px 11px;
  text-align: right;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(24, 38, 70, 0.74), rgba(10, 17, 34, 0.58));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), inset 0 1px rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}
.hud-item span { color: #ffd64a; margin-left: 4px; }

/* ---------- Top-right buttons ---------- */
#topbtns {
  position: absolute;
  top: 10px;
  left: max(12px, calc(50% - 368px));
  right: auto;
  display: flex;
  gap: 8px;
  z-index: 6;
}
.iconbtn {
  width: 40px; height: 40px;
  font-size: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.iconbtn:active { background: rgba(255, 255, 255, 0.3); }
.djcontrols { position: absolute; top: 58px; left: max(12px, calc(50% - 368px)); z-index: 7; display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid rgba(255,255,255,.2); border-radius: 14px; color: white; background: rgba(12,18,32,.78); backdrop-filter: blur(10px); }
.djcontrols.hidden { display: none; }
.djcontrols button { width: 32px; height: 30px; border: 0; border-radius: 9px; color: white; background: #f26722; font-size: 20px; font-weight: 800; }
.djcontrols span { min-width: 42px; text-align: center; font-size: 12px; font-weight: 800; }

/* ---------- Power-up badges ---------- */
#powerbar {
  position: absolute;
  top: 48px;
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  z-index: 5;
  pointer-events: none;
}
.badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 800;
  color: #102;
  background: #ffd64a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.badge .bar {
  width: 34px; height: 5px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 3px;
  overflow: hidden;
}
.badge .bar i {
  display: block; height: 100%;
  background: #102;
  border-radius: 3px;
}

/* ---------- Mobile / on-screen controls ---------- */
#touchControls {
  position: absolute;
  bottom: calc(18px + var(--sab, 0px));
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 14px;
  z-index: 6;
}
.tc {
  width: 62px; height: 62px;
  font-size: 24px;
  color: #fff;
  border: none;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.13);
  backdrop-filter: blur(4px);
  cursor: pointer;
}
.tc:active { background: rgba(255, 255, 255, 0.32); }

/* touch devices: hide the on-screen buttons — play by swiping instead (more screen) */
@media (pointer: coarse) {
  #touchControls { display: none !important; }
}

/* ---------- Overlays ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  color: #fff;
  background: rgba(7, 11, 26, 0.8);
  backdrop-filter: blur(4px);
  padding: 24px;
}
.overlay.hidden { display: none; }

/* ---- dedicated loading screen (fills a % bar before the game reveals) ---- */
#loadScreen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 28px 24px;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(circle at 50% 37%, rgba(255, 113, 24, .2) 0, transparent 29%),
    radial-gradient(circle at 14% 12%, rgba(255, 164, 66, .1) 0, transparent 28%),
    linear-gradient(155deg, #17110f 0%, #0e0d12 48%, #050609 100%);
  transition: opacity .7s ease, visibility .7s;
}
#loadScreen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 20%, rgba(255,255,255,.035) 36%, transparent 52%),
    linear-gradient(to bottom, rgba(255,255,255,.04), transparent 20%, transparent 78%, rgba(242,103,34,.06));
  animation: loadSheen 4.8s ease-in-out infinite;
}
#loadScreen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 130px 30px rgba(0,0,0,.62);
}
#loadScreen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.load-content {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(100%, 430px);
}
.load-grid {
  position: absolute;
  left: -12%;
  right: -12%;
  bottom: -21%;
  height: 62%;
  opacity: .18;
  transform: perspective(360px) rotateX(63deg);
  transform-origin: center bottom;
  background-image:
    linear-gradient(rgba(255,121,43,.28) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,121,43,.28) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: linear-gradient(to top, #000, transparent 88%);
  mask-image: linear-gradient(to top, #000, transparent 88%);
}
.load-ambient { position: absolute; inset: 0; pointer-events: none; }
.load-ambient i {
  position: absolute;
  display: block;
  border-radius: 50%;
  background: #ff792b;
  box-shadow: 0 0 18px #ff792b;
  animation: loadFloat 5s ease-in-out infinite;
}
.load-ambient i:nth-child(1) { top: 18%; left: 14%; width: 4px; height: 4px; }
.load-ambient i:nth-child(2) { top: 27%; right: 13%; width: 6px; height: 6px; animation-delay: -1.8s; }
.load-ambient i:nth-child(3) { bottom: 24%; left: 22%; width: 3px; height: 3px; animation-delay: -3.1s; }
.load-kicker {
  margin: 0 0 30px;
  color: rgba(255,255,255,.62);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 4px;
}
.load-logo-orbit {
  position: relative;
  display: grid;
  place-items: center;
  width: 210px;
  height: 150px;
}
#loadScreen .brandlogo {
  position: relative;
  z-index: 2;
  margin: 0;
  transform: scale(1.06);
  animation: logoBreathe 2.8s ease-in-out infinite;
}
.orbit {
  position: absolute;
  border: 1px solid rgba(255,133,55,.26);
  border-radius: 50%;
}
.orbit::after {
  content: "";
  position: absolute;
  top: 50%;
  left: -3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff9a4b;
  box-shadow: 0 0 12px #ff792b;
}
.orbit-one { width: 190px; height: 114px; transform: rotate(-12deg); animation: orbitSpin 6s linear infinite; }
.orbit-two { width: 165px; height: 138px; transform: rotate(38deg); animation: orbitSpinReverse 8s linear infinite; }
.loadtag {
  margin: 12px 0 0;
  color: #ff8b3d;
  font-size: clamp(18px, 5vw, 24px);
  font-weight: 900;
  letter-spacing: 6px;
  text-transform: uppercase;
  text-shadow: 0 0 25px rgba(255,121,43,.3);
}
.load-copy {
  margin-top: 9px;
  color: rgba(255,255,255,.62);
  font-size: 12px;
  letter-spacing: .3px;
}
.load-progress { width: min(88vw, 360px); margin-top: 56px; }
.load-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: rgba(255,255,255,.55);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.8px;
}
#loadpct { color: #ff9a4b; font-size: 13px; letter-spacing: .04em; }
.loadbar {
  position: relative;
  width: 100%;
  height: 8px;
  overflow: hidden;
  padding: 2px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: rgba(255,255,255,.055);
  box-shadow: inset 0 1px 5px rgba(0,0,0,.7), 0 0 0 1px rgba(0,0,0,.2);
}
.loadbar i {
  position: relative;
  display: block;
  width: 0%;
  height: 100%;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff5a13, #ff9f48, #ffe0bb);
  box-shadow: 0 0 15px rgba(255,108,27,.8);
  transition: width .28s ease;
}
.loadbar i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.9), transparent);
  transform: translateX(-100%);
  animation: barShimmer 1.35s linear infinite;
}
.load-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  color: rgba(255,255,255,.38);
  font-size: 10px;
}
.load-tip span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ff792b;
  box-shadow: 0 0 9px #ff792b;
  animation: tipPulse 1.2s ease-in-out infinite;
}
@keyframes loadSheen {
  0%, 100% { transform: translateX(-20%); opacity: .45; }
  50% { transform: translateX(20%); opacity: .9; }
}
@keyframes loadFloat {
  0%, 100% { transform: translateY(0) scale(1); opacity: .35; }
  50% { transform: translateY(-18px) scale(1.45); opacity: .9; }
}
@keyframes logoBreathe {
  0%, 100% { transform: scale(1.04); filter: drop-shadow(0 12px 22px rgba(242,103,34,.25)); }
  50% { transform: scale(1.09); filter: drop-shadow(0 16px 32px rgba(242,103,34,.46)); }
}
@keyframes orbitSpin { to { transform: rotate(348deg); } }
@keyframes orbitSpinReverse { to { transform: rotate(-322deg); } }
@keyframes barShimmer { to { transform: translateX(160%); } }
@keyframes tipPulse { 50% { opacity: .3; transform: scale(.65); } }
@media (prefers-reduced-motion: reduce) {
  #loadScreen *, #loadScreen::before { animation: none !important; }
}
@media (max-height: 650px) {
  .load-kicker { margin-bottom: 12px; }
  .load-logo-orbit { height: 120px; transform: scale(.86); }
  .load-progress { margin-top: 28px; }
}

/* START screen = the live "thief" scene. Show ONLY the PLAY button (and, while
   still loading, the progress line) over the 3D background — no panel, no chrome. */
body.menu #startScreen {
  background: transparent;
  backdrop-filter: none;
  justify-content: flex-end;
  padding-bottom: max(21vh, calc(150px + env(safe-area-inset-bottom)));
}
body.menu #startScreen .brandlogo,
body.menu #startScreen h1,
body.menu #startScreen p.tag:not(#loadline),
body.menu #startScreen .controls { display: none; }
body.menu #hud,
body.menu #topbtns { display: none; }
body.menu #startScreen #loadline { text-shadow: 0 2px 8px rgba(0,0,0,.8); }
body.menu #startScreen .bigbtn {
  position: relative;
  z-index: 3;
  min-width: min(66vw, 288px);
  min-height: 82px;
  padding: 10px 44px;
  border: 6px solid #fff;
  color: #fff;
  font-size: clamp(32px, 9vw, 56px);
  background: linear-gradient(#ffb35d, #ff540b);
  box-shadow: 0 8px 18px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.8);
}

/* Figma home-screen chrome. It sits over the live Three.js menu scene; no
   background image or animation is replaced by this layer. */
#homeUi {
  position: absolute;
  inset: 0;
  left: 50%;
  width: min(100%, 440px);
  transform: translateX(-50%);
  z-index: 2;
  pointer-events: none;
  color: #111;
  font-family: "Segoe UI", system-ui, sans-serif;
}
#homeUi button { font: inherit; pointer-events: auto; cursor: pointer; }
.home-topbar {
  position: absolute;
  top: max(22px, env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.wallet-card {
  position: relative;
  display: flex;
  align-items: center;
  width: 150px;
  height: 42px;
  padding-left: 70px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 5px 4px 12px rgba(0,0,0,.25);
}
.wallet-card strong { font-size: 23px; line-height: 1; }
.wallet-mark {
  position: absolute;
  left: -1px;
  display: grid;
  place-items: center;
  width: 49px;
  height: 49px;
  border: 4px solid #ffad67;
  border-radius: 50%;
  color: #fff;
  font-size: 30px;
  font-weight: 400;
  background: linear-gradient(#ff941f, #ef6b16);
  box-shadow: 0 2px 4px rgba(0,0,0,.28), inset 0 0 0 1px rgba(255,255,255,.5);
}
.home-square {
  display: grid;
  place-items: center;
  width: 50px;
  height: 52px;
  border: 2px solid #ff832a;
  border-radius: 12px;
  background: #fff;
  box-shadow: 5px 4px 12px rgba(0,0,0,.25);
}
.home-square img { width: 35px; height: 34px; object-fit: contain; }
.season-card {
  position: absolute;
  top: max(86px, calc(env(safe-area-inset-top) + 72px));
  right: 16px;
  display: flex;
  width: 214px;
  height: 68px;
  overflow: visible;
  padding: 8px 8px 7px 12px;
  border: 2px solid #fff;
  border-radius: 12px;
  color: #fff;
  text-align: left;
  background: linear-gradient(90deg, #ffa143, #ff6b00);
  box-shadow: 5px 4px 12px rgba(0,0,0,.25);
}
.season-copy { display: flex; flex-direction: column; align-items: flex-start; z-index: 1; }
.season-copy small { font-size: 10px; line-height: 12px; }
.season-copy strong { font-size: 15px; font-style: italic; line-height: 17px; text-shadow: 0 1px #c95700; white-space: nowrap; }
.season-time {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  padding: 2px 8px;
  border-radius: 25px;
  color: #fff;
  font-size: 10px;
  background: rgba(36,36,36,.8);
}
.season-time img { width: 13px; height: 13px; object-fit: contain; }
.season-art {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 94px;
  height: 73px;
  object-fit: contain;
}
.home-side {
  position: absolute;
  top: 152px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.shortcut-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 71px;
  height: 75px;
  padding: 5px 3px 7px;
  border: 2px solid #ff832a;
  border-radius: 12px;
  color: #000;
  background: #fff;
  box-shadow: 2px 5px 10px rgba(0,0,0,.25);
}
.shortcut-card img { width: 44px; height: 43px; object-fit: contain; margin-bottom: 2px; }
.shortcut-card strong { font-size: 8px; line-height: 8px; }
.notice-dot {
  position: absolute;
  top: -11px;
  right: -10px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 2px solid #ff7068;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  background: linear-gradient(#ff4747, #df1111);
  box-shadow: 0 2px 4px rgba(0,0,0,.25);
}
.mystery-card {
  position: absolute;
  top: 174px;
  right: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 73px;
  height: 84px;
  padding: 42px 3px 4px;
  border: 2px solid #ff832a;
  border-radius: 12px;
  color: #000;
  background: #fff;
  box-shadow: 5px 4px 12px rgba(0,0,0,.25);
}
.mystery-card > img {
  position: absolute;
  top: -46px;
  width: 65px;
  height: 65px;
  object-fit: contain;
  filter: drop-shadow(0 8px 7px rgba(0,0,0,.5));
}
.mystery-card > span { font-size: 8px; line-height: 9px; font-weight: 800; white-space: nowrap; }
.mystery-card > small {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
  padding: 2px 5px;
  border-radius: 20px;
  color: #fff;
  font-size: 7px;
  line-height: 8px;
  background: #000;
}
.mystery-card > small img { width: 10px; height: 10px; object-fit: contain; }
.home-bottom-nav { display: none;
  position: absolute;
  bottom: max(48px, calc(18px + env(safe-area-inset-bottom)));
  left: 50%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(73vw, 320px);
  height: 60px;
  transform: translateX(-50%);
  border-radius: 17px;
  background: #fff;
  box-shadow: 16px 8px 16px rgba(0,0,0,.25);
  pointer-events: auto;
}
.nav-item {
  position: relative;
  display: grid;
  place-items: center;
  border: 0;
  color: #ff792b;
  background: transparent;
}
.nav-item + .nav-item::before {
  content: "";
  position: absolute;
  left: 0;
  width: 1px;
  height: 36px;
  background: #ddd;
}
.nav-item img { width: 32px; height: 40px; object-fit: contain; }
.nav-item:first-child img { width: 32px; height: 29px; filter: brightness(0) invert(1); }
.nav-item.active {
  margin: -4px 0 -3px -4px;
  border: 3px solid #ffab6e;
  border-radius: 15px;
  background: linear-gradient(#ffb271, #f1500b);
  box-shadow: inset 0 0 0 1px #fff;
}

body:not(.menu) #homeUi { display: none; }

@media (max-height: 700px) {
  body.menu #startScreen { padding-bottom: max(138px, calc(122px + env(safe-area-inset-bottom))); }
  body.menu #startScreen .bigbtn { min-height: 68px; font-size: 34px; }
  .home-side { top: 130px; }
  .mystery-card { top: 152px; }
}

@media (pointer: coarse) {
  /* svh, NEVER dvh. The dynamic viewport unit grows to the toolbar-hidden
     height, so a min-height in dvh silently overrode the 100svh above and put
     the bottom of the layout back underneath the browser chrome. */
  #game,
  .overlay { min-height: 100svh; }
  body.menu #startScreen {
    padding-bottom: max(23svh, calc(168px + env(safe-area-inset-bottom)));
  }
}
/* The on-screen arrow pad belongs to gameplay only — on a desktop browser it
   was drawing a grey slab straight through the home screen's bottom bar. */
body.menu #touchControls { display: none; }

.overlay h1 {
  font-size: clamp(30px, 7vw, 56px);
  letter-spacing: 3px;
  color: #fff;
  text-shadow: 0 4px 0 #b8480f, 0 8px 20px rgba(0, 0, 0, 0.5);
}
.brandlogo {
  font-size: clamp(40px, 10vw, 78px);
  font-weight: 900;
  letter-spacing: -2px;
  color: #fff;
  background: #f26722;
  padding: 4px 22px;
  border-radius: 10px;
  line-height: 1.05;
  box-shadow: 0 8px 24px rgba(242, 103, 34, 0.5);
}
.brandlogo span { color: #ffe9dc; }
.tag, .result { font-size: 18px; opacity: 0.9; }
.result span { color: #ffd64a; font-weight: 700; }

button.bigbtn, button.smallbtn {
  font-weight: 800;
  letter-spacing: 2px;
  color: #102;
  background: linear-gradient(#ffe27a, #ffc21c);
  border: none;
  border-radius: 40px;
  cursor: pointer;
  box-shadow: 0 6px 0 #b8860b, 0 10px 18px rgba(0, 0, 0, 0.4);
  transition: transform 0.08s ease;
}
button.bigbtn { margin-top: 6px; padding: 14px 46px; font-size: 20px; }
button.smallbtn { padding: 9px 28px; font-size: 15px; }
button.bigbtn:active, button.smallbtn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #b8860b;
}

.controls {
  margin-top: 18px;
  font-size: 15px;
  line-height: 1.7;
  opacity: 0.9;
}
.controls b { color: #ffd64a; letter-spacing: 1px; }
.legend { margin-top: 8px; }
.legend .pu {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
}
.muted { opacity: 0.6; font-size: 13px; margin-top: 6px; }

/* ---------- Figma Game Over screen ---------- */
#overScreen {
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
  overflow: hidden;
  background: rgba(8, 7, 10, .72);
  backdrop-filter: blur(8px) saturate(.8);
}
#overScreen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 20%, rgba(255,124,43,.22), transparent 34%),
              linear-gradient(to bottom, rgba(7,7,8,.12), rgba(7,7,8,.58));
  pointer-events: none;
}
.gameover-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(100%, 406px);
  padding: 28px 20px 22px;
  border: 2px solid rgba(255,255,255,.84);
  border-radius: 30px;
  color: #17100c;
  background: radial-gradient(circle at 50% 0, rgba(255,255,255,.95), transparent 30%),
              linear-gradient(155deg, rgba(255,255,255,.98), rgba(255,242,230,.96));
  box-shadow: 0 24px 70px rgba(0,0,0,.55), inset 0 0 0 8px rgba(255,126,45,.08);
  animation: gameoverEnter .42s cubic-bezier(.2,.8,.2,1) both;
}
.gameover-glow {
  position: absolute;
  top: -56px;
  left: 50%;
  width: 230px;
  height: 110px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(255,111,24,.34);
  filter: blur(38px);
}
.gameover-title { position: relative; text-align: center; }
.gameover-title > span {
  display: inline-block;
  margin-bottom: 5px;
  color: #d75a13;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 3px;
}
#overScreen .gameover-title h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(34px, 10vw, 52px);
  line-height: .98;
  letter-spacing: 1px;
  -webkit-text-stroke: 1px #d95a15;
  text-shadow: 0 4px 0 #c84c0b, 0 8px 18px rgba(150,58,10,.3);
}
.earned-card {
  position: relative;
  width: 100%;
  margin-top: 25px;
  padding: 27px 14px 15px;
  border: 1px solid rgba(255,126,45,.35);
  border-radius: 20px;
  background: rgba(255,255,255,.9);
  box-shadow: 0 9px 25px rgba(125,61,20,.12), inset 0 0 0 4px #fff4eb;
}
.earned-heading {
  position: absolute;
  top: -16px;
  left: 50%;
  min-width: 168px;
  padding: 9px 24px;
  transform: translateX(-50%);
  border: 3px solid #fff;
  border-radius: 25px;
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: .7px;
  background: linear-gradient(#ffad5d, #f0550c);
  box-shadow: 0 5px 12px rgba(177,66,8,.28), inset 0 0 0 1px #ffca98;
}
.earned-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.earned-item {
  display: grid;
  grid-template-columns: 48px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  min-height: 78px;
  padding: 10px;
  border: 1px solid #ffd1ad;
  border-radius: 15px;
  text-align: left;
  background: linear-gradient(145deg, #fff, #fff4e9);
}
.earned-icon {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  color: #fff;
  font-size: 23px;
  font-weight: 900;
  background: linear-gradient(#ffab57, #f0550c);
  box-shadow: 0 4px 9px rgba(193,72,10,.25), inset 0 0 0 2px rgba(255,255,255,.46);
}
.token-icon { border-radius: 50%; font-size: 22px; }
.earned-item small {
  align-self: end;
  color: #8a7060;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .6px;
}
.earned-item strong {
  align-self: start;
  color: #23130b;
  font-size: clamp(18px, 5vw, 25px);
  line-height: 1.05;
}
.best-score-card {
  position: relative;
  display: flex;
  align-items: center;
  width: 88%;
  min-height: 76px;
  margin-top: 15px;
  padding: 10px 88px 10px 18px;
  border-radius: 18px;
  color: #fff;
  text-align: left;
  background: linear-gradient(120deg, #27201c, #0f0d0c);
  box-shadow: 0 8px 20px rgba(0,0,0,.25), inset 0 0 0 1px rgba(255,255,255,.1);
}
.crown-mark { margin-right: 13px; color: #ff9b48; font-size: 31px; text-shadow: 0 0 12px rgba(255,130,42,.5); }
.best-score-card div { display: flex; flex-direction: column; }
.best-score-card small { color: #ffc08d; font-size: 8px; font-weight: 900; letter-spacing: 1px; }
.best-score-card strong { font-size: 29px; line-height: 1.05; }
.new-best {
  position: absolute;
  right: 12px;
  padding: 5px 7px;
  border-radius: 8px;
  color: #4a2109;
  font-size: 7px;
  font-weight: 900;
  background: #ff9b48;
}
.new-best.hidden { display: none; }
.gameover-actions {
  display: grid;
  grid-template-columns: 52px minmax(160px, 233px) 52px;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 22px;
}
.gameover-actions button { cursor: pointer; }
.gameover-side-btn {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 2px solid #ff832a;
  border-radius: 13px;
  color: #f26722;
  background: #fff;
  box-shadow: 0 5px 12px rgba(0,0,0,.18);
}
.gameover-side-btn img { width: 28px; height: 25px; object-fit: contain; }
.share-score-btn span { font-size: 29px; font-weight: 800; transform: translate(-1px, 1px); }
.gameover-retry {
  height: 64px;
  border: 5px solid #fff;
  border-radius: 40px;
  color: #fff;
  font-size: 31px;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(#ffad5d, #f0550c);
  box-shadow: 0 7px 15px rgba(159,56,5,.35), inset 0 0 0 1px #ffc28e;
}
.gameover-retry:active, .gameover-side-btn:active { transform: translateY(3px); }
@keyframes gameoverEnter {
  from { opacity: 0; transform: translateY(28px) scale(.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-height: 700px) {
  .gameover-shell { padding-top: 19px; padding-bottom: 16px; transform: scale(.9); }
  .earned-card { margin-top: 20px; }
  .best-score-card { min-height: 66px; }
  .gameover-actions { margin-top: 14px; }
}
