/* game/game.css
 * ONE SHOT. Studio identity is black + chartreuse (#C6F542); this game's
 * own palette sits inside that frame: a dim floodlit night court, one
 * bright ring, one bright ball. The restraint of the rules should read in
 * the restraint of the palette. Semantic HTML first, transform/opacity/
 * filter animation only, one capped FX canvas.
 */

:root {
  --os-black: #0a0a0a;
  --os-court: #111319;
  --os-court-deep: #06070a;
  --os-chartreuse: #c6f542;
  --os-ink: #f5f5f0;
  --os-muted: rgba(245, 245, 240, 0.62);
  --os-line: rgba(245, 245, 240, 0.12);
  --os-miss: #ff6b57;
  --os-radius: 16px;
  --os-radius-lg: 26px;
  --os-font: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --os-font-mono: "Space Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--os-black);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--os-ink);
  font-family: var(--os-font);
  font-size: 16px;
  line-height: 1.4;
  background:
    radial-gradient(circle at 50% 0%, rgba(198, 245, 66, 0.06), transparent 48rem),
    linear-gradient(180deg, var(--os-court) 0%, var(--os-court-deep) 100%);
}

button {
  font: inherit;
  color: inherit;
}

button:not(:disabled) {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--os-chartreuse);
  outline-offset: 3px;
}

h1, h2, h3, p, dl, dt, dd {
  margin: 0;
}

.game-shell {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: clamp(12px, 2.4vw, 30px);
}

.game-frame {
  width: min(560px, 100%);
  display: grid;
  gap: clamp(12px, 2vw, 18px);
}

/* ---------------- Topbar ---------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 2.5px solid var(--os-chartreuse);
  background: radial-gradient(circle at 40% 35%, rgba(198, 245, 66, 0.5), transparent 70%);
}

.brand h1 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.day-chip {
  font-family: var(--os-font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--os-black);
  background: var(--os-chartreuse);
  padding: 7px 12px;
  border-radius: 999px;
}

.stat-strip {
  display: flex;
  gap: 14px;
  font-family: var(--os-font-mono);
  font-size: 0.72rem;
  color: var(--os-muted);
}

.stat-strip strong {
  color: var(--os-ink);
  font-size: 0.85rem;
}

/* ---------------- Screens ---------------- */

.screen {
  display: grid;
  gap: 16px;
}

.home-hero {
  border-radius: var(--os-radius-lg);
  padding: 26px 22px;
  background:
    radial-gradient(circle at 70% 0%, rgba(198, 245, 66, 0.1), transparent 60%),
    var(--os-court);
  border: 1px solid var(--os-line);
  display: grid;
  gap: 14px;
  text-align: center;
}

.home-hero h2 {
  font-size: clamp(1.7rem, 6vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.06;
}

.home-hero p {
  color: var(--os-muted);
  font-size: 0.95rem;
  max-width: 34ch;
  margin: 0 auto;
}

.course-tag {
  font-family: var(--os-font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--os-chartreuse);
}

.button {
  appearance: none;
  border: 1px solid var(--os-line);
  background: transparent;
  color: var(--os-ink);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 14px 20px;
  border-radius: 999px;
  transition: transform var(--duration-fast) var(--ease-out-expo), border-color var(--duration-fast);
  text-align: center;
}

.button:hover:not(:disabled) {
  border-color: var(--os-chartreuse);
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.button--primary {
  background: var(--os-chartreuse);
  color: var(--os-black);
  border-color: var(--os-chartreuse);
}

.button--primary:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 12px 28px -12px rgba(198, 245, 66, 0.55);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.button--ghost {
  background: transparent;
  color: var(--os-muted);
  border-color: var(--os-line);
}

.button--ghost:hover:not(:disabled) {
  color: var(--os-ink);
}

.home-actions {
  display: grid;
  gap: 10px;
}

.home-secondary {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.home-secondary .button {
  flex: 1;
  padding: 12px 14px;
  font-size: 0.82rem;
}

/* ---------------- Caddy ---------------- */

.caddy {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--os-radius);
  background: rgba(245, 245, 240, 0.04);
  border: 1px solid var(--os-line);
}

.caddy__portrait {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 32%, #3a3d47 0 34%, #23252c 35% 100%);
  border: 2px solid rgba(245, 245, 240, 0.2);
  position: relative;
}

.caddy__portrait::before,
.caddy__portrait::after {
  content: "";
  position: absolute;
  top: 46%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--os-ink);
}

.caddy__portrait::before { left: 30%; }
.caddy__portrait::after { right: 30%; }

.caddy__text {
  flex: 1;
  min-width: 0;
}

.caddy__name {
  font-family: var(--os-font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--os-chartreuse);
  display: block;
  margin-bottom: 3px;
}

.caddy__line {
  font-size: 0.92rem;
  color: var(--os-ink);
  line-height: 1.4;
}

/* ---------------- Aim screen ---------------- */

.aim-stage {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--os-radius-lg);
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(198, 245, 66, 0.05), transparent 60%),
    var(--os-court);
  border: 1px solid var(--os-line);
  touch-action: none;
  outline-offset: -3px;
}

.aim-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.course-canvas {
  z-index: 5;
}

.fx-canvas {
  z-index: 8;
  pointer-events: none;
}

.fx-vignette {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: 0;
  border-radius: inherit;
}

.fx-vignette--make {
  animation: fxVignetteMake 460ms ease-out;
}

.fx-vignette--miss {
  animation: fxVignetteMiss 300ms ease-out;
}

@keyframes fxVignetteMake {
  0% { opacity: 0; box-shadow: inset 0 0 0 rgba(198, 245, 66, 0); }
  30% { opacity: 1; box-shadow: inset 0 0 110px 36px rgba(198, 245, 66, 0.5); }
  100% { opacity: 0; box-shadow: inset 0 0 0 rgba(198, 245, 66, 0); }
}

@keyframes fxVignetteMiss {
  0% { opacity: 0; box-shadow: inset 0 0 0 rgba(255, 107, 87, 0); }
  30% { opacity: 1; box-shadow: inset 0 0 90px 30px rgba(255, 107, 87, 0.4); }
  100% { opacity: 0; box-shadow: inset 0 0 0 rgba(255, 107, 87, 0); }
}

.fx-banner {
  position: absolute;
  top: 12%;
  left: 50%;
  z-index: 15;
  transform: translate(-50%, -8px);
  opacity: 0;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--os-black);
  background: var(--os-chartreuse);
  padding: 8px 18px;
  border-radius: 999px;
  pointer-events: none;
}

.fx-banner.is-active {
  animation: bannerSlide 1400ms var(--ease-out-expo);
}

@keyframes bannerSlide {
  0% { opacity: 0; transform: translate(-50%, -16px) scale(0.9); }
  16% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  80% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, 8px) scale(0.96); }
}

.power-meter {
  position: absolute;
  left: 16px;
  bottom: 16px;
  top: 16px;
  z-index: 12;
  width: 8px;
  border-radius: 999px;
  background: rgba(245, 245, 240, 0.12);
  overflow: hidden;
  pointer-events: none;
  --power: 0;
}

.power-meter::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--power) * 100%);
  background: linear-gradient(180deg, var(--os-chartreuse), #8fd41a);
  transition: height 40ms linear;
}

.aim-hint {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 12;
  font-family: var(--os-font-mono);
  font-size: 0.68rem;
  color: var(--os-muted);
  pointer-events: none;
  text-align: right;
  max-width: 46%;
}

/* ---------------- Reveal screen ---------------- */

.reveal-panel {
  border-radius: var(--os-radius-lg);
  padding: 28px 22px;
  background: var(--os-court);
  border: 1px solid var(--os-line);
  display: grid;
  gap: 16px;
  text-align: center;
}

.reveal-day {
  font-family: var(--os-font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--os-muted);
}

.reveal-headline {
  font-size: clamp(2rem, 8vw, 2.9rem);
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1;
}

.reveal-headline[data-outcome="made"] {
  color: var(--os-chartreuse);
}

.reveal-headline[data-outcome="missed"] {
  color: var(--os-ink);
}

.reveal-stats {
  display: grid;
  gap: 8px;
}

.reveal-stats dl {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--os-line);
}

.reveal-stats dl:last-child {
  border-bottom: 0;
}

.reveal-stats dt {
  color: var(--os-muted);
  font-size: 0.82rem;
}

.reveal-stats dd {
  font-weight: 700;
  font-size: 0.88rem;
}

.reveal-actions {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.button--share {
  background: var(--os-chartreuse);
  color: var(--os-black);
  border-color: var(--os-chartreuse);
  font-weight: 800;
}

/* ---------------- Practice yard ---------------- */

.practice-list {
  display: grid;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
}

.practice-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(245, 245, 240, 0.03);
  border: 1px solid var(--os-line);
  text-align: left;
}

.practice-item:hover {
  border-color: var(--os-chartreuse);
}

.practice-item__date {
  font-family: var(--os-font-mono);
  font-size: 0.82rem;
}

.practice-item__status {
  font-size: 0.74rem;
  color: var(--os-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.practice-banner {
  text-align: center;
  font-family: var(--os-font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--os-muted);
  padding: 10px;
  border: 1px dashed var(--os-line);
  border-radius: 12px;
}

/* ---------------- Footer / controls ---------------- */

.controls {
  display: grid;
  gap: 10px;
}

.status {
  text-align: center;
  font-size: 0.84rem;
  color: var(--os-muted);
  min-height: 1.2em;
}

.control-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.control-buttons .button {
  padding: 10px 16px;
  font-size: 0.8rem;
}

/* ---------------- Install / share overlays ---------------- */

.os-install {
  appearance: none;
  cursor: pointer;
  border: 0;
  background: var(--os-chartreuse);
  color: var(--os-black);
  font: 700 12px/1 var(--os-font);
  letter-spacing: 0.02em;
  padding: 9px 13px;
  border-radius: 999px;
  white-space: nowrap;
  display: none;
  align-items: center;
  gap: 6px;
}

.os-install.show {
  display: inline-flex;
}

.os-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 4, 4, 0.78);
  backdrop-filter: blur(4px);
}

.os-overlay.show {
  display: flex;
}

.os-overlay .panel {
  background: var(--os-court);
  border: 1px solid var(--os-line);
  border-radius: 18px;
  max-width: 380px;
  width: 100%;
  padding: 26px 24px;
  box-shadow: 0 30px 80px -30px #000;
}

.os-overlay h3 {
  margin: 0 0 10px;
  font-size: 1.15rem;
}

.os-overlay p, .os-overlay li {
  color: var(--os-muted);
  font-size: 14px;
  line-height: 1.55;
}

.os-overlay ol {
  margin: 12px 0;
  padding-left: 20px;
}

.os-overlay .preview {
  width: 100%;
  border-radius: 12px;
  margin: 4px 0 14px;
  display: block;
}

.os-overlay .acts {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.os-overlay .acts a,
.os-overlay .acts button {
  flex: 1;
  min-width: 130px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  font: 700 13px/1 var(--os-font);
  padding: 12px 14px;
  border-radius: 11px;
  border: 0;
}

.os-overlay .acts .primary {
  background: var(--os-chartreuse);
  color: var(--os-black);
}

.os-overlay .acts .ghost {
  background: transparent;
  color: var(--os-ink);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.os-overlay .close {
  margin-top: 14px;
  width: 100%;
  background: none;
  border: 0;
  color: rgba(245, 245, 240, 0.5);
  font: 600 12px var(--os-font);
  cursor: pointer;
}

/* ---------------- Reduced motion ---------------- */

@media (prefers-reduced-motion: reduce) {
  .fx-vignette--make,
  .fx-vignette--miss,
  .fx-banner.is-active {
    animation-duration: 200ms;
  }
  .button,
  .button--primary {
    transition: none;
  }
}

/* ---------------- Small screens ---------------- */

@media (max-width: 380px) {
  .home-hero {
    padding: 20px 16px;
  }
  .reveal-panel {
    padding: 22px 16px;
  }
}
