:root {
  --water-deep: #04222f;
  --water-mid: #0b4a5e;
  --water-hi: #146d84;
  --cyan: #3df7ff;
  --cyan-dim: #1fb9c9;
  --gold: #ffd23f;
  --green: #7dffa0;
  --danger: #ff5470;
  --glass: rgba(6, 26, 36, 0.58);
  --glass-brd: rgba(255, 255, 255, 0.14);
  --ink: #eafcff;
  --ink-dim: #9fc9d4;
  font-family: 'Outfit', sans-serif;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--water-deep);
  color: var(--ink);
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

canvas {
  display: block;
  position: absolute;
  inset: 0;
  touch-action: none;
}

/* ---------- shared overlay/panel styles ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 50;
}

.hidden {
  display: none !important;
}

.fade-in {
  animation: fadeIn .45s ease both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--glass-brd);
  border-radius: 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding: 28px 26px;
  max-width: 440px;
  width: min(92vw, 440px);
  text-align: center;
}

.title-font {
  font-family: 'Orbitron', sans-serif;
}

.logo {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(34px, 9vw, 52px);
  letter-spacing: 2px;
  background: linear-gradient(180deg, #eafffb 0%, var(--cyan) 45%, var(--green) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 18px rgba(61, 247, 255, 0.35));
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.logo .frog-emoji {
  font-size: 0.7em;
  filter: none;
  -webkit-text-fill-color: initial;
}

.tagline {
  color: var(--ink-dim);
  font-size: 14px;
  margin: 6px 0 22px;
  letter-spacing: .4px;
}

.btn {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 16px;
  border: none;
  border-radius: 30px;
  padding: 14px 22px;
  cursor: pointer;
  color: #04222f;
  background: linear-gradient(180deg, #8dffc7, var(--green) 55%, #3fe08a);
  box-shadow: 0 8px 22px rgba(125, 255, 160, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  width: 100%;
  margin: 6px 0;
  transition: transform .12s ease, box-shadow .12s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  /* 3D Border + Depth */
  box-shadow:
    /* Top highlight */
    inset 0 2px 0 rgba(255, 255, 255, 0.55),

    /* Left highlight */
    inset 1px 0 0 rgba(255, 255, 255, 0.25),

    /* Bottom shadow */
    inset 0 -3px 0 rgba(0, 0, 0, 0.18),

    /* Outer border */
    0 0 0 2px rgba(70, 255, 155, 0.28),

    /* Lift */
    0 8px 18px rgba(30, 120, 70, 0.35),

    /* Glow */
    0 0 18px rgba(125, 255, 160, 0.25);
}

.btn:active {
  transform: scale(0.96);
  box-shadow: 0 3px 10px rgba(125, 255, 160, 0.3);
}

.btn.secondary {
  background: linear-gradient(180deg, rgba(61, 247, 255, 0.22), rgba(61, 247, 255, 0.08));
  color: var(--ink);
  border: 1px solid rgba(61, 247, 255, 0.4);
  box-shadow: 0 6px 18px rgba(61, 247, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  /* 3D Border + Glass Effect */
  box-shadow:
    /* Top highlight */
    inset 0 2px 0 rgba(255, 255, 255, 0.25),

    /* Left highlight */
    inset 1px 0 0 rgba(255, 255, 255, 0.12),

    /* Bottom shadow */
    inset 0 -3px 0 rgba(0, 0, 0, 0.22),

    /* Outer cyan border */
    0 0 0 2px rgba(61, 247, 255, 0.18),

    /* Depth */
    0 8px 20px rgba(0, 120, 140, 0.25),

    /* Neon glow */
    0 0 18px rgba(61, 247, 255, 0.18);
}

.btn.gold {
  background: linear-gradient(180deg, #ffe98a, var(--gold) 60%, #f5a623);
  box-shadow: 0 8px 22px rgba(255, 210, 63, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.btn.danger {
  background: linear-gradient(180deg, #ff9aab, var(--danger) 60%, #d43155);
  color: #fff;
  box-shadow: 0 8px 22px rgba(255, 84, 112, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-row {
  display: flex;
  gap: 10px;
}

.btn-row .btn {
  width: auto;
  flex: 1;
}

.icon-btn {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid var(--glass-brd);
  background: var(--glass);
  backdrop-filter: blur(10px);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
}

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

/* ---------- preloader ---------- */
#preloader {
  background: radial-gradient(120% 120% at 50% 20%, #0d5064 0%, #04222f 65%, #021419 100%);
  z-index: 100;
}

.pre-frog {
  font-size: 54px;
  margin-bottom: 6px;
  animation: hop 1.1s ease-in-out infinite;
}

@keyframes hop {

  0%,
  100% {
    transform: translateY(0) scaleY(1);
  }

  40% {
    transform: translateY(-22px) scaleY(1.05);
  }

  55% {
    transform: translateY(-22px) scaleY(0.95);
  }

  70% {
    transform: translateY(0) scaleY(0.85);
  }
}

.bar-track {
  width: min(70vw, 300px);
  height: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin-top: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  box-shadow: 0 0 12px var(--cyan);
  transition: width .12s linear;
}

.pre-label {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-dim);
  letter-spacing: 1px;
}

/* ---------- level select ---------- */
.level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 18px 0 6px;
}

.lvl-cell {
  aspect-ratio: 1/1;
  border-radius: 14px;
  border: 1px solid var(--glass-brd);
  background: linear-gradient(180deg, rgba(61, 247, 255, 0.14), rgba(61, 247, 255, 0.03));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 17px;
}

.lvl-cell.locked {
  opacity: 0.4;
  cursor: default;
  background: rgba(255, 255, 255, 0.04);
}

.lvl-cell.hard {
  border-color: rgba(255, 130, 90, 0.45);
  background: linear-gradient(180deg, rgba(255, 130, 90, 0.18), rgba(255, 130, 90, 0.04));
}

.lvl-cell.hard.locked {
  border-color: var(--glass-brd);
  background: rgba(255, 255, 255, 0.04);
}

.lvl-cell .stars {
  position: absolute;
  bottom: 4px;
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--gold);
}

.lvl-cell:active:not(.locked) {
  transform: scale(0.93);
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  gap: 10px;
  pointer-events: none;
}

#hud>* {
  pointer-events: auto;
}

.hud-chip {
  background: var(--glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-brd);
  border-radius: 14px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  font-weight: 700;
  /* 3D Glass Border */
  box-shadow:
    /* Top highlight */
    inset 0 2px 0 rgba(255, 255, 255, 0.18),

    /* Left highlight */
    inset 1px 0 0 rgba(255, 255, 255, 0.08),

    /* Bottom depth */
    inset 0 -2px 0 rgba(0, 0, 0, 0.28),

    /* Outer border */
    0 0 0 2px rgba(255, 255, 255, 0.05),

    /* Floating depth */
    0 8px 20px rgba(0, 0, 0, 0.25),

    /* Soft glow */
    0 0 16px rgba(61, 247, 255, 0.12);

  transition: transform .2s ease, box-shadow .2s ease;
}

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

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

.lives {
  display: flex;
  gap: 3px;
  font-size: 15px;
}

.lives span {
  opacity: 0.25;
  transition: opacity .2s;
}

.lives span.alive {
  opacity: 1;
}

#comboWrap {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 210, 63, 0.7);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}

/* ---------- tap hint ---------- */
#tapHint {
  position: absolute;
  left: 50%;
  bottom: 9%;
  transform: translateX(-50%);
  z-index: 15;
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  padding: 9px 18px;
  border-radius: 30px;
  animation: pulseHint 1.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulseHint {

  0%,
  100% {
    opacity: 0.55;
    transform: translateX(-50%) scale(1);
  }

  50% {
    opacity: 1;
    transform: translateX(-50%) scale(1.06);
  }
}

/* ---------- how to play ---------- */
.htp-demo {
  width: 120px;
  height: 120px;
  margin: 8px auto 14px;
  position: relative;
}

.htp-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.25);
}

.htp-target {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--gold);
}

.htp-leaf {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4fd88a, #1f8a52 70%);
  animation: spinLeaf 2.4s linear infinite;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.35);
}

.htp-leaf::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 34px;
  border-radius: 50% 50% 0 0/60% 60% 0 0;
  background: rgba(255, 255, 255, 0.55);
  filter: blur(1px);
}

@keyframes spinLeaf {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.htp-steps {
  text-align: left;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-dim);
  margin: 0 0 18px;
  padding-left: 20px;
}

.htp-steps li {
  margin-bottom: 6px;
}

.htp-steps b {
  color: var(--ink);
}

/* ---------- result stars ---------- */
.stars-row {
  font-size: 38px;
  margin: 8px 0 4px;
  letter-spacing: 6px;
}

.star {
  color: rgba(255, 255, 255, 0.18);
  text-shadow: none;
  transition: all .25s;
}

.star.on {
  color: var(--gold);
  text-shadow: 0 0 16px rgba(255, 210, 63, 0.8);
}

.stat-row {
  display: flex;
  justify-content: space-around;
  margin: 14px 0 20px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat b {
  font-family: 'Orbitron', sans-serif;
  font-size: 19px;
  color: var(--cyan);
}

.stat span {
  font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.top-right-fixed {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  z-index: 40;
  display: flex;
  gap: 8px;
}
.logo{height: 120px;border-radius: 30px;}