:root {
  --gold: #f4b942;
  --gold-dim: #c9932c;
  --cyan: #4ee3ff;
  --pink: #ff6fb0;
  --green: #5bffa0;
  --wood: #8b5a2b;
  --wood-dark: #4a2f16;
  --panel: rgba(20, 12, 6, 0.55);
  --panel-strong: rgba(15, 9, 5, 0.82);
  --danger: #ff5252;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #000;
  font-family: 'Outfit', sans-serif;
  overflow: hidden;
  touch-action: none;
}

#stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  background:
    linear-gradient(rgba(0, 0, 0, 0.25),
      rgba(0, 0, 0, 0.45)),
    url('./bg.png') center center / cover no-repeat;

  background-color: #000;
}

#gameContainer {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 520px;
  aspect-ratio: 9/16;
  max-height: 100vh;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

@media (min-aspect-ratio: 9/16) {
  #gameContainer {
    height: 100vh;
    width: calc(100vh * 9 / 16);
  }
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.hud-pill {
  position: absolute;
  background: linear-gradient(180deg, rgba(60, 38, 18, 0.75), rgba(20, 12, 6, 0.75));
  border: 1px solid rgba(244, 185, 66, 0.35);
  border-radius: 14px;
  padding: 6px 14px;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#scoreBox {
  top: 14px;
  left: 14px;
}

#timeBox {
  top: 14px;
  right: 14px;
}

.hud-label {
  font-family: 'Outfit';
  font-size: 11px;
  letter-spacing: 1px;
  color: #e7c98a;
  text-transform: uppercase;
  opacity: 0.85;
}

.hud-value {
  font-family: 'Orbitron';
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 10px rgba(244, 185, 66, 0.6);
}

#timeBox .hud-value.low {
  color: var(--danger);
  text-shadow: 0 0 12px rgba(255, 82, 82, 0.8);
  animation: pulse 0.5s infinite;
}

#livesWrap {
  position: absolute;
  top: 64px;
  right: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

#heartIcon {
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 0 6px rgba(255, 82, 120, 0.7));
}

#livesValue {
  font-family: 'Orbitron';
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 82, 120, 0.6);
}

#comboFloat {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  font-family: 'Orbitron';
  font-weight: 900;
  font-size: 0px;
  color: var(--gold);
  text-shadow: 0 0 16px rgba(244, 185, 66, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: none;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.45;
  }
}

/* ---------- Corner buttons ---------- */
.corner-btn {
  position: absolute;
  bottom: 14px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 30%, #3a2413, #17100a 75%);
  border: 2px solid rgba(244, 185, 66, 0.4);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55), inset 0 2px 4px rgba(255, 255, 255, 0.06);
  pointer-events: all;
  cursor: pointer;
  z-index: 6;
}

#muteBtn {
  left: 14px;
}

#pauseBtn {
  right: 14px;
}

.corner-btn svg {
  width: 26px;
  height: 26px;
}

.corner-btn:active {
  transform: scale(0.92);
}

.flame {
  filter: drop-shadow(0 0 6px rgba(255, 140, 40, 0.9));
}

/* ---------- Overlays / Modals ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 2, 1, 0.72);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.overlay.show {
  opacity: 1;
  pointer-events: all;
}

.modal {
  width: 86%;
  max-width: 380px;
  background: linear-gradient(180deg, rgba(50, 32, 16, 0.95), rgba(18, 11, 6, 0.97));
  border: 1px solid rgba(244, 185, 66, 0.4);
  border-radius: 30px;
  padding: 22px 20px 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: translateY(10px) scale(0.97);
  transition: transform 0.35s cubic-bezier(.2, 1.4, .4, 1);
}

.overlay.show .modal {
  transform: translateY(0) scale(1);
}

.modal h2 {
  font-family: 'Orbitron';
  font-weight: 900;
  font-size: 24px;
  margin: 0 0 4px;
  color: var(--gold);
  text-shadow: 0 0 16px rgba(244, 185, 66, 0.6);
  letter-spacing: 1px;
}

.modal .sub {
  color: #d8c3a0;
  font-size: 13px;
  margin-bottom: 16px;
}

.htp-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 9px 12px;
  margin-bottom: 8px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.htp-row .icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
}

.htp-row .txt {
  font-size: 13px;
  color: #eee0c8;
  line-height: 1.3;
}

.htp-row .txt b {
  color: #fff;
}

.btn {
  font-family: 'Orbitron';
  font-weight: 700;
  letter-spacing: 1px;
  border: none;
  border-radius: 30px;
  padding: 13px 20px;
  font-size: 15px;
  background: linear-gradient(180deg, #ffd15c, #e69a1a);
  color: #3a2205;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 6px 0 #a86e11, 0 10px 18px rgba(0, 0, 0, 0.4);
  margin-top: 10px;
  transition: transform 0.08s ease;
  margin-bottom: 5px;
}

.btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #a86e11, 0 4px 10px rgba(0, 0, 0, 0.4);
}

.btn.secondary {
  background: linear-gradient(180deg, #4b3d2a, #2c2113);
  color: #f4d999;
  box-shadow: 0 6px 0 #17110a, 0 10px 18px rgba(0, 0, 0, 0.4);
}

.score-line {
  display: flex;
  justify-content: space-between;
  padding: 8px 4px;
  font-family: 'Orbitron';
}

.score-line .k {
  color: #c9b48a;
  font-size: 13px;
}

.score-line .v {
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}

.newbest {
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-top: 2px;
  display: none;
}

.gem-title-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 8px;
  display: block;
}

/* ---------- Preloader ---------- */
#preloader {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: radial-gradient(ellipse at 50% 40%, #241408 0%, #0a0603 80%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease;
}

#preloader.hide {
  opacity: 0;
  pointer-events: none;
}

#preloDiamond {
  width: 74px;
  height: 74px;
  animation: spinFloat 1.6s ease-in-out infinite;
}

@keyframes spinFloat {
  0% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-10px) rotate(180deg);
  }

  100% {
    transform: translateY(0) rotate(360deg);
  }
}

#preloTitle {
  font-family: 'Orbitron';
  font-weight: 900;
  color: var(--gold);
  font-size: 22px;
  margin-top: 18px;
  letter-spacing: 2px;
  text-shadow: 0 0 20px rgba(244, 185, 66, 0.6);
}

#preloSub {
  color: #a68a5e;
  font-size: 12px;
  margin-top: 6px;
  letter-spacing: 1px;
}

#barTrack {
  width: 200px;
  height: 10px;
  border-radius: 6px;
  margin-top: 20px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  border: 1px solid rgba(244, 185, 66, 0.3);
}

#barFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffd15c, #e69a1a);
  border-radius: 6px;
}

#preloPct {
  margin-top: 8px;
  font-family: 'Orbitron';
  font-size: 12px;
  color: #e7c98a;
}

/* combo popup text spans */
.float-txt {
  position: absolute;
  font-family: 'Orbitron';
  font-weight: 800;
  pointer-events: none;
  z-index: 4;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
}
.logo{
  border-radius: 30px;
}