/* Le Chonk Cannon: the control bar under the frame, the medal card and the touch behaviour.
 * Game chrome (HUD, overlays, frame) comes from style.css. */

/* ---------- control bar: one glass panel with an orange edge ---------- */
.cannon-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, auto);
  align-items: center;
  gap: 14px 18px;
  min-width: 0;
  max-width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 122, 0, 0.12), rgba(255, 122, 0, 0) 70%),
    var(--surface);
  border: 1px solid var(--border-warm);
  box-shadow: var(--shadow-lift);
}
.cannon-angle { min-width: 0; display: grid; gap: 4px; }
.cannon-controls .field { min-width: 0; gap: 6px; }
.cannon-controls .field-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cannon-controls [data-hud="angle"] {
  color: var(--cream);
  font-family: var(--font-display);
  font-stretch: 112%;
  font-weight: 900;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.angle-scale {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* the range input is styled bare: style.css boxes every .field input */
#angle {
  width: 100%;
  min-height: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  touch-action: none;
}
#angle::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--orange-hi) var(--fill, 30%), rgba(255, 249, 240, 0.14) var(--fill, 30%));
  border: 1px solid rgba(255, 249, 240, 0.12);
}
#angle::-webkit-slider-thumb {
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  margin-top: -10px;
  border-radius: 50%;
  background: var(--cream);
  border: 4px solid var(--orange);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
}
#angle::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 249, 240, 0.14);
  border: 1px solid rgba(255, 249, 240, 0.12);
}
#angle::-moz-range-progress {
  height: 10px;
  border-radius: 999px;
  background: var(--orange-hi);
}
#angle::-moz-range-thumb {
  box-sizing: border-box;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--cream);
  border: 4px solid var(--orange);
}
#angle:focus-visible { outline: 2px solid var(--orange-hi); outline-offset: 6px; border-radius: 999px; }
#angle:disabled { opacity: 0.45; cursor: not-allowed; }

/* the launch button fills from left to right while the power builds (--charge is set by the game) */
#btn-charge {
  min-width: 0;
  width: 100%;
  min-height: 56px;
  font-size: 17px;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  background:
    linear-gradient(90deg, rgba(255, 249, 240, 0.55) var(--charge, 0%), rgba(255, 249, 240, 0) var(--charge, 0%)),
    linear-gradient(180deg, var(--orange-hi), var(--orange));
}
#btn-charge:not(:disabled):active { transform: translateY(1px) scale(0.985); }
#btn-charge:disabled { background: linear-gradient(180deg, var(--orange-hi), var(--orange)); }

/* ---------- HUD buttons: 44 px touch targets ---------- */
.game-hud .btn-sm { min-height: 44px; }

/* ---------- canvas ---------- */
#game {
  outline: none;
  cursor: crosshair;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
#game:focus-visible { box-shadow: inset 0 0 0 2px var(--orange-hi); }

/* ---------- medal card on the touchdown screen ---------- */
.medal-block { display: grid; justify-items: center; gap: 10px; width: 100%; }
.medal-block[hidden] { display: none; }
.medal-rack { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
.medal-tile {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  min-height: 64px;
  padding: 8px 6px;
  border-radius: 16px;
  border: 1px dashed var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--faint);
  transition: transform 0.3s var(--ease), background 0.3s, color 0.3s;
}
.medal-tile b {
  font-family: var(--font-display);
  font-stretch: 112%;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 0.02em;
}
.medal-tile small { font-size: 12px; font-weight: 700; }
.medal-tile.is-earned { border: 1px solid transparent; color: #1a0c04; }
.medal-tile[data-tier="bronze"].is-earned { background: linear-gradient(180deg, #f2b07a, #a85a22); }
.medal-tile[data-tier="silver"].is-earned { background: linear-gradient(180deg, #f7fbff, #97a4b4); }
.medal-tile[data-tier="gold"].is-earned { background: linear-gradient(180deg, #ffe38f, #d99a17); }
.medal-tile.is-top {
  animation: medal-pop 0.75s var(--ease) both;
  box-shadow: 0 0 0 3px rgba(255, 197, 61, 0.35), 0 14px 34px rgba(255, 197, 61, 0.3);
}
@keyframes medal-pop {
  0% { transform: scale(0.6) rotate(-6deg); }
  60% { transform: scale(1.12) rotate(3deg); }
  100% { transform: scale(1) rotate(0); }
}
.medal-title {
  margin: 0;
  font-family: var(--font-display);
  font-stretch: 112%;
  font-weight: 900;
  font-size: clamp(18px, 3vw, 24px);
  color: var(--cream);
  text-align: center;
  overflow-wrap: anywhere;
}
#ov-over .overlay-card { max-width: 500px; }

/* ---------- phones: the HUD sits in three even columns, the bar stacks, the launch button is full width ---------- */
@media (max-width: 640px) {
  .game-hud {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .game-hud .hud-spacer { display: none; }
  .game-hud .hud-chip {
    justify-content: space-between;
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    font-size: 12px;
  }
  .game-hud .btn-sm { width: 100%; padding: 0 10px; font-size: 13px; }
  .cannon-controls {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 12px 14px;
  }
  #btn-charge { min-height: 56px; }
  .medal-rack { gap: 6px; }
  .medal-tile b { font-size: 12.5px; }
}

/* very narrow phones (320 to 380 px): two HUD columns, Sound takes the last row */
@media (max-width: 380px) {
  .game-hud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-hud #btn-sound { grid-column: 1 / -1; }
}
