:root {
  --ink: #153047;
  --cream: #fff3c9;
  --panel: rgba(255, 250, 224, 0.76);
  --panel-strong: rgba(255, 238, 153, 0.94);
  --orange: #ff8a1d;
  --green: #18c267;
  --green-dark: #0c7c46;
  --blue: #29a7ff;
  --shadow: rgba(28, 48, 68, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #78d9ff;
  color: var(--ink);
  font-family: "Nunito", "Trebuchet MS", sans-serif;
}

body {
  touch-action: none;
  user-select: none;
}

#game-root {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.82), transparent 16rem),
    linear-gradient(180deg, #55c9ff 0%, #9ae8ff 48%, #7ed978 100%);
}

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

.hud {
  position: absolute;
  inset: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) auto max(18px, env(safe-area-inset-left));
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  pointer-events: none;
}

.score-card {
  min-width: 112px;
  padding: 12px 16px 10px;
  border: 3px solid rgba(21, 48, 71, 0.82);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 10px 0 rgba(21, 48, 71, 0.18), 0 18px 34px var(--shadow);
  backdrop-filter: blur(10px);
}

.score-card .label {
  display: block;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.score-card strong {
  display: block;
  margin-top: 2px;
  font-family: "Bungee", "Trebuchet MS", sans-serif;
  font-size: clamp(1.6rem, 5vw, 3rem);
  line-height: 0.95;
  color: var(--orange);
  text-shadow: 2px 3px 0 #fff, 4px 6px 0 rgba(21, 48, 71, 0.18);
}

.high-score strong {
  color: var(--green);
}

.message-panel {
  position: absolute;
  left: 50%;
  bottom: max(38px, calc(env(safe-area-inset-bottom) + 26px));
  z-index: 3;
  width: min(620px, calc(100vw - 28px));
  padding: clamp(18px, 4vw, 30px);
  border: 4px solid rgba(21, 48, 71, 0.88);
  border-radius: 30px;
  background: var(--panel-strong);
  box-shadow: 0 14px 0 rgba(21, 48, 71, 0.2), 0 28px 60px var(--shadow);
  text-align: center;
  transform: translateX(-50%);
  transition: opacity 180ms ease, transform 180ms ease;
}

.message-panel.hidden {
  opacity: 0;
  transform: translate(-50%, 18px) scale(0.98);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green-dark);
  font-size: clamp(0.78rem, 2.4vw, 0.95rem);
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: "Bungee", "Trebuchet MS", sans-serif;
  font-size: clamp(2rem, 8vw, 4.8rem);
  line-height: 0.96;
  color: var(--blue);
  text-shadow: 3px 4px 0 #fff, 6px 8px 0 rgba(21, 48, 71, 0.18);
}

#status-subtitle {
  max-width: 42rem;
  margin: 12px auto 0;
  font-size: clamp(1rem, 3vw, 1.18rem);
  font-weight: 900;
}

@media (max-width: 560px) {
  .hud {
    align-items: flex-start;
  }

  .score-card {
    min-width: 86px;
    padding: 10px 12px 8px;
    border-radius: 16px;
  }

  .message-panel {
    bottom: max(22px, calc(env(safe-area-inset-bottom) + 16px));
    border-radius: 24px;
  }
}
