:root {
  --bg: #0e1014;
  --text: #e8ecf1;
  --accent: #FFB450;
  --accent-dark: #C26314;
  --accent-light: #FFCA84;
  --ok: #2ecc71;
  --ok-dark: #1e9a50;
  --ok-text: #0b5;
  --edge-gap: max(50px, env(safe-area-inset-bottom));
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(1200px 800px at 50% 0%, #141824 0%, var(--bg) 70%);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

#game-wrapper {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(#111521, #0c0e14);
}

#game {
  width: 100%;
  height: 100%;
  display: block;
  /* Top layer: image with height = screen height (100vh) and preserved aspect ratio; bottom: fallback gradient */
  background: url('https://firebasestorage.googleapis.com/v0/b/sticky-20bca.appspot.com/o/sgm-asset%2Fa18146a3-eafe-462a-8c77-fdb04320ab6e%2F7ae775e1-3179-47ac-aa49-6aac5e0de49c.png?alt=media&token=b8592043-e64c-4a68-ada2-6815457045f5') center top / auto 100vh no-repeat, radial-gradient(1000px 700px at 50% 45%, #0f1c3a 0%, #0b0d13 65%);
  outline: none;
}

/* HUD - balance at the top (centered) */
#hud {
  position: absolute;
  inset: var(--edge-gap) 0 auto 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0 .9rem;
  pointer-events: none;
}

#hud .hud-center {
  width: 100%;
  display: flex;
  justify-content: center;
}

#balance-banner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* shrink to text width */
  width: fit-content;
  height: fit-content;
  min-height: clamp(40px, 8vh, 64px);
  min-width: 220px;
  padding: 0 clamp(.6rem, 2.5vw, 1.2rem);
  border-radius: 12px;
  background: url('https://firebasestorage.googleapis.com/v0/b/sticky-20bca.appspot.com/o/sgm-asset%2Ffa2211d3-2f81-4876-9c62-ce33bbb49dd8%2F765a8d24-8800-47b7-ac1e-418c819b9d7e.png?alt=media&token=43cd311d-503c-4898-ac17-a7247dfc6b8f') center / 100% 100% no-repeat;
  border: none;
  box-shadow: none;
  pointer-events: none;
}

#balance-text {
  color: #34BE57;
  margin: 0;
  font-family: 'AvenirNextWorld-Bold', 'AvenirNextWorld-Medium', system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
  font-size: 25.127px;
  letter-spacing: .5px;
  display: inline-block;
  height: 1em;
  width: max-content;
  text-shadow: 0 2.6px 0 #208B80;
  white-space: nowrap;
  /* keep on one line so banner width follows text */
}

/* SPIN button fixed at the bottom */
.button {
  width: clamp(180px, 45vw, 260px);
  height: 64px;
  padding: 16px 40px;
  border-radius: 12px;
  border: 3px solid #000;
  background: var(--accent);
  color: #593817;
  font-family: 'Jersey 20', sans-serif;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: transform .08s ease, filter .15s ease, opacity .15s ease;
  touch-action: manipulation;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow:
    0px 4px 4px rgba(0, 0, 0, .25),
    5px 0 0 var(--accent-light) inset,
    0 -6px 0 var(--accent-dark) inset,
    0 5px 0 var(--accent-light) inset,
    -4px 0 0 var(--accent-dark) inset;
}

.button:hover,
.button:active {
  transform: translateY(-2px);
}

.button.disabled,
.button:disabled {
  opacity: .55;
  filter: grayscale(.35);
  cursor: not-allowed;
}

#spin-btn {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: var(--edge-gap);

  /* Image button */
  background: url('https://firebasestorage.googleapis.com/v0/b/sticky-20bca.appspot.com/o/sgm-asset%2F8640b1f9-abe5-4343-9bef-3b7810ab7381%2Fbd6cb318-bb04-4014-aac1-ae36dc9ed2cd.png?alt=media&token=5223645a-7c7b-4e48-a11b-069cd194861a') center / contain no-repeat;
  border: none;
  box-shadow: none;
  color: #FFBE00;
  /* keep aria-label for a11y */
  text-shadow: 0 2.852px 0 #DB2B00;
  font-family: 'AvenirNextWorld-Bold', 'Avenir Next World', system-ui, sans-serif;
  font-weight: 700;
  padding: 0;

  /* Keep responsive sizing */
  width: 145px;
  height: 70px;
  background-color: transparent;
}

/* Text utility with stroke like other templates */
.text-stroke {
  -webkit-text-stroke: var(--stroke-width, 6px) #000;
  paint-order: stroke fill;
}

.text-stroke-xl {
  --stroke-width: 6px;
}

.title-text {
  color: #FFF;
  text-align: center;
  text-shadow: 0 4px 4px rgba(0, 0, 0, .25);
  -webkit-text-stroke: var(--stroke-width, 6px) #000;
  font-family: 'Jersey 20', sans-serif;
}

/* Loading overlay (reference: liquid-sort) */
.loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 22, 1);
  z-index: 20000;
}

.loading-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.loading-bar {
  width: min(320px, 70vw);
  height: 10px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 0 14px rgba(255, 180, 80, 0.35);
}

.loading-progress {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-light), var(--accent));
  border-radius: 6px;
  transition: width 0.25s ease;
  box-shadow: 0 0 10px rgba(255, 180, 80, 0.6);
}

.loading-text {
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  font-family: 'Jersey 20', sans-serif;
}

/* Game Over overlay */
.gameover-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 22, 0.96);
  z-index: 25000;
}

.gameover-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

/* Avenir Next World font faces (for spend feedback visual) */
@font-face {
  font-family: 'AvenirNextWorld-Medium';
  src: url('https://firebasestorage.googleapis.com/v0/b/sticky-20bca.appspot.com/o/fonts%2FAvenirNextWorld-Medium.otf?alt=media&token=6d0c0700-529c-45a3-bfd7-dc79b07030cd') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'AvenirNextWorld-Bold';
  src: url('https://firebasestorage.googleapis.com/v0/b/sticky-20bca.appspot.com/o/fonts%2FAvenirNextWorld-Bold.otf?alt=media&token=8d06a955-d494-4533-b00f-f419be3a1781') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
