/* HUD + overlays. Everything transitions on .hidden (defined in base.css). */

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.hud-left {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  left: calc(14px + env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 10px;
}

#level-badge {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 900;
  color: var(--ink);
  background: linear-gradient(160deg, var(--gold), var(--gold-deep));
  box-shadow: 0 3px 10px rgba(10, 4, 24, 0.4), inset 0 -3px 0 rgba(0, 0, 0, 0.15);
}

.level-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

#level-bar {
  width: 110px;
  height: 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

#level-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold), var(--gold-deep));
  transition: width 0.25s;
}

#size-label {
  font-size: 14px;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(10, 4, 24, 0.5);
}

#score {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 900;
  text-shadow: 0 2px 10px rgba(10, 4, 24, 0.45);
  font-variant-numeric: tabular-nums;
}

.hud-right {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: calc(14px + env(safe-area-inset-right));
  display: flex;
  gap: 10px;
}

.hud-right button {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 20px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: auto;
  transition: transform 0.1s;
}

.hud-right button:active {
  transform: scale(0.9);
}

#combo {
  position: absolute;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(34px, 6vw, 52px);
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 3px 0 rgba(140, 80, 20, 0.4),
               0 6px 20px rgba(10, 4, 24, 0.45),
               0 0 26px rgba(255, 209, 102, 0.5);
  transition: opacity 0.25s;
}

#toast {
  position: absolute;
  top: calc(78px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 26px;
  border-radius: 99px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: opacity 0.4s;
}

/* --- Overlays -------------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(14, 6, 30, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity 0.3s, visibility 0.3s;
}

.panel {
  text-align: center;
  padding: clamp(28px, 5vw, 48px) clamp(28px, 6vw, 60px);
  border-radius: 30px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  box-shadow: 0 24px 70px rgba(8, 3, 20, 0.55);
  max-width: min(92vw, 560px);
}

.title-hole {
  width: 86px;
  height: 86px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #050310 30%, #241243 100%);
  box-shadow: 0 0 0 7px var(--cream), 0 10px 30px rgba(8, 3, 20, 0.6);
  animation: bob 3.2s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-7px) scale(1.04); }
}

h1 {
  font-size: clamp(32px, 6vw, 52px);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.05;
  white-space: nowrap;
  background: linear-gradient(180deg, var(--cream) 35%, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

h2 {
  font-size: clamp(30px, 6vw, 44px);
  font-weight: 900;
  margin-bottom: 18px;
}

.tagline {
  margin-top: 8px;
  font-size: clamp(15px, 2.5vw, 19px);
  opacity: 0.85;
}

#best-line {
  margin: 14px 0 22px;
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
}

.big-btn {
  display: inline-block;
  padding: 16px 58px;
  border-radius: 99px;
  font-size: clamp(20px, 3.5vw, 26px);
  font-weight: 900;
  color: var(--ink);
  background: linear-gradient(160deg, var(--gold), var(--gold-deep));
  box-shadow: 0 6px 20px rgba(255, 159, 67, 0.35), inset 0 -4px 0 rgba(0, 0, 0, 0.15);
  transition: transform 0.12s, box-shadow 0.12s;
}

.big-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 10px 26px rgba(255, 159, 67, 0.45), inset 0 -4px 0 rgba(0, 0, 0, 0.15);
}

.big-btn:active {
  transform: translateY(1px) scale(0.98);
}

.btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.mid-btn {
  padding: 12px 24px;
  border-radius: 99px;
  font-size: 15px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--panel-line);
  transition: background 0.15s, transform 0.1s;
}

.mid-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.mid-btn:active {
  transform: scale(0.96);
}

.hints {
  margin-top: 22px;
  font-size: 13px;
  opacity: 0.62;
  line-height: 1.6;
}

/* --- Micro-animations ------------------------------------------------- */

.pop {
  animation: pop 0.45s cubic-bezier(0.2, 2.2, 0.4, 1);
}

@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

#combo.pop {
  animation: combo-pop 0.45s cubic-bezier(0.2, 2.2, 0.4, 1);
}

@keyframes combo-pop {
  0% { transform: translateX(-50%) scale(0.6); }
  45% { transform: translateX(-50%) scale(1.25); }
  100% { transform: translateX(-50%) scale(1); }
}

#toast.slide {
  animation: slide-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes slide-in {
  0% { transform: translateX(-50%) translateY(-16px); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@media (max-width: 640px) {
  #level-badge { width: 44px; height: 44px; font-size: 20px; }
  #level-bar { width: 84px; }
  .hud-right button { width: 44px; height: 44px; }
}
