
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700;800;900&display=swap');
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --clr-bg: #1a1a2e;
    --clr-accent: #e94560;
    --clr-gold: #ffd700;
    --clr-white: #ffffff;
    --font: 'Nunito', sans-serif;
  }

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}

.game-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  transition: color 0.2s ease, transform 0.2s ease;
}
.back-btn:hover {
  color: var(--clr-accent);
  transform: translateX(-2px);
}
.game-header .game-titlle {
  font-family: 'Syne', sans-serif;
  font-weight: 900;
  /* font-size: 1.2rem; */
  font-size: clamp(12px, 10vw, 32px);
    letter-spacing: -1px;
    color: #fff;
}

.game-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    background: var(--clr-bg);
    font-family: var(--font);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }

#game-container {
    position: relative;
    width: 100vw;
    height: calc(100vh - 56px);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
  }

canvas#gameCanvas {
    display: block;
    touch-action: none;
  }

  /* ── HUD ── */
#hud {
    position: absolute; top: 0; left: 0; right: 0;
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 20px 24px 0;
    pointer-events: none;
    z-index: 10;
  }
.hud-score {
    display: flex; flex-direction: column; align-items: center;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(8px);
    border-radius: 16px;
    padding: 10px 22px;
    border: 1px solid rgba(255,255,255,0.12);
  }
.hud-label {
    font-size: 10px; font-weight: 700; letter-spacing: 2px;
    color: rgba(255,255,255,0.5); text-transform: uppercase;
  }
.hud-value {
    font-size: 28px; font-weight: 900;
    color: #fff;
    line-height: 1.1;
    text-shadow: 0 0 20px rgba(255,255,255,0.3);
  }
#best-value { color: var(--clr-gold); text-shadow: 0 0 20px rgba(255,215,0,0.4); }

  /* ── SCREENS ── */
.screen {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    z-index: 20;
    transition: opacity 0.4s ease, transform 0.4s ease;
  }
.screen.hidden { opacity: 0; pointer-events: none; transform: scale(0.97); }

  /* Start Screen */
#start-screen {
    background: linear-gradient(160deg, #0f0c29, #302b63, #24243e);
  }
#start-screen .game-title {
    font-size: clamp(42px, 10vw, 72px);
    font-weight: 900;
    letter-spacing: -1px;
    color: #fff;
    line-height: 1;
    text-align: center;
  }
#start-screen .game-title span {
    color: #e94560;
    display: block;
  }
  .title-sub {
    margin-top: 10px;
    font-size: 14px; font-weight: 700;
    letter-spacing: 3px; text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    text-align: center;
  }
  .start-best {
    margin-top: 32px;
    display: flex; flex-direction: column; align-items: center;
    background: rgba(255,215,0,0.08);
    border: 1px solid rgba(255,215,0,0.25);
    border-radius: 20px;
    padding: 12px 36px;
  }
  .start-best .label { font-size: 10px; letter-spacing: 2px; color: rgba(255,215,0,0.6); text-transform: uppercase; }
  .start-best .value { font-size: 36px; font-weight: 900; color: var(--clr-gold); }

  .btn-play {
    margin-top: 40px;
    width: 180px; height: 64px;
    background: linear-gradient(135deg, #e94560, #c62a47);
    border: none; border-radius: 32px;
    color: #fff; font-family: var(--font);
    font-size: 20px; font-weight: 900;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(233,69,96,0.5);
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative; overflow: hidden;
  }
  .btn-play::after {
    content: '';
    position: absolute; top: 0; left: -100%;
    width: 60%; height: 100%;
    background: rgba(255,255,255,0.15);
    transform: skewX(-20deg);
    animation: shimmer 2.5s infinite;
  }
  @keyframes shimmer { to { left: 150%; } }
  .btn-play:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 12px 40px rgba(233,69,96,0.65); }
  .btn-play:active { transform: scale(0.97); }

  .tap-hint {
    margin-top: 20px;
    font-size: 13px; color: rgba(255,255,255,0.35);
    letter-spacing: 1px;
    animation: pulse-hint 2s infinite;
  }
  @keyframes pulse-hint { 0%,100%{opacity:.35} 50%{opacity:.7} }

  /* Game Over Screen */
  #gameover-screen {
    background: rgba(10, 8, 20, 0.88);
    backdrop-filter: blur(16px);
  }
  .go-title {
    font-size: clamp(36px, 8vw, 60px);
    font-weight: 900; color: #fff;
    text-align: center;
  }
  .go-title span { color: var(--clr-accent); }
  .go-scores {
    margin-top: 28px;
    display: flex; gap: 20px;
  }
  .go-score-box {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 16px 28px;
    text-align: center;
    min-width: 110px;
  }
  .go-score-box.gold { border-color: rgba(255,215,0,0.3); background: rgba(255,215,0,0.07); }
  .go-score-box .label { font-size: 10px; letter-spacing: 2px; color: rgba(255,255,255,0.45); text-transform: uppercase; }
  .go-score-box .value { font-size: 40px; font-weight: 900; color: #fff; }
  .go-score-box.gold .value { color: var(--clr-gold); }
  .new-best-badge {
    background: var(--clr-gold); color: #1a1a00;
    font-size: 11px; font-weight: 900; letter-spacing: 1px;
    border-radius: 20px; padding: 3px 12px;
    margin-top: 4px; display: inline-block;
    animation: pop-in 0.4s cubic-bezier(0.34,1.56,0.64,1);
  }
  @keyframes pop-in { from{transform:scale(0)} to{transform:scale(1)} }

  .btn-restart {
    margin-top: 36px;
    width: 200px; height: 60px;
    background: linear-gradient(135deg, #e94560, #c62a47);
    border: none; border-radius: 30px;
    color: #fff; font-family: var(--font);
    font-size: 18px; font-weight: 900;
    cursor: pointer;
    box-shadow: 0 8px 28px rgba(233,69,96,0.45);
    transition: transform 0.15s, box-shadow 0.15s;
  }
  .btn-restart:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(233,69,96,0.6); }
  .btn-restart:active { transform: scale(0.97); }

  /* Combo popup */
#combo-display {
    position: absolute;
    top: 100px; left: 50%;
    transform: translateX(-50%);
    pointer-events: none; z-index: 30;
    text-align: center;
    transition: opacity 0.3s;
  }
#combo-text {
    font-size: 28px; font-weight: 900;
    color: #fff;
    text-shadow: 0 0 30px rgba(255,255,255,0.8);
    display: none;
  }
#combo-multiplier {
    font-size: 18px; font-weight: 700;
    color: var(--clr-gold);
    display: none;
  }

  /* Sound toggle */
#sound-toggle {
    position: absolute; bottom: 28px; right: 24px;
    width: 44px; height: 44px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    z-index: 10;
    transition: background 0.2s;
  }
#sound-toggle:hover { background: rgba(255,255,255,0.18); }