:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --gold: #ffd529;
  --green: #48dc78;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: #06140d;
  color: white;
}

button {
  font: inherit;
}

.game-shell {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  background: radial-gradient(circle at 50% 0%, #173d28, #06140d 70%);
}

.scoreboard {
  min-height: 82px;
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 10px clamp(14px, 3vw, 44px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(3, 12, 8, 0.92);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  z-index: 20;
}

.brand {
  display: flex;
  flex-direction: column;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 0.95;
}

.brand-kicker,
.result-kicker {
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.brand strong {
  margin-top: 5px;
  font-size: clamp(1.1rem, 2.3vw, 1.75rem);
  font-style: italic;
}

.stats {
  display: flex;
  gap: clamp(16px, 4vw, 48px);
}

.stats div {
  min-width: 62px;
  text-align: center;
}

.stats span {
  display: block;
  margin-bottom: 2px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stats strong {
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
}

.reset-button,
.result-card button {
  border: 0;
  border-radius: 999px;
  background: var(--gold);
  color: #16200f;
  cursor: pointer;
  font-weight: 900;
  box-shadow: 0 8px 22px rgba(255, 213, 41, 0.24);
}

.reset-button {
  justify-self: end;
  padding: 11px 18px;
}

.pitch {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  user-select: none;
  touch-action: manipulation;
}

.scene {
  position: relative;
  width: min(100%, calc((100vh - 82px) * 1.913043));
  max-height: 100%;
  aspect-ratio: 1408 / 736;
  overflow: hidden;
}

.pitch-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  filter: saturate(1.08) contrast(1.03);
}

.goal-area {
  position: absolute;
  left: 25.9%;
  top: 26.6%;
  width: 48.5%;
  height: 39.2%;
}

.target {
  position: absolute;
  z-index: 8;
  width: clamp(26px, 6.8%, 54px);
  aspect-ratio: 1;
  padding: 0;
  border: 3px solid rgba(255, 255, 255, 0.171);
  border-radius: 50%;
  background: rgba(255, 212, 41, 0);
  cursor: crosshair;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px rgba(255, 213, 41, 0.13), 0 0 10px rgba(255, 212, 41, 0);
  transition: transform 150ms ease, background 150ms ease, opacity 180ms ease;
}

.target::after {
  content: "";
  position: absolute;
  inset: 32%;
  border-radius: 50%;
  background: white;
}

.target:hover,
.target:focus-visible {
  outline: none;
  background: rgba(72, 220, 120, 0.56);
  transform: translate(-50%, -50%) scale(1.16);
}

.target:disabled {
  cursor: default;
  opacity: 0.26;
}

.target-top-left { left: 13%; top: 18%; }
.target-bottom-left { left: 14%; top: 75%; }
.target-center { left: 50%; top: 49%; }
.target-top-right { left: 87%; top: 18%; }
.target-bottom-right { left: 86%; top: 75%; }

.keeper {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 0;
  width: 34%;
  height: 95%;
  object-fit: contain;
  object-position: center bottom;
  transform: translateX(-50%);
  transform-origin: center bottom;
  filter: drop-shadow(0 9px 8px rgba(0, 0, 0, 0.42));
  transition: opacity 100ms linear, transform 180ms ease-out;
  pointer-events: none;
}

.keeper.diving {
  width: 68%;
  height: 72%;
}

.keeper.to-top-left { left: 31%; bottom: 23%; }
.keeper.to-bottom-left { left: 31%; bottom: 0; }
.keeper.to-center { left: 50%; bottom: 0; width: 34%; height: 95%; }
.keeper.to-top-right { left: 69%; bottom: 23%; }
.keeper.to-bottom-right { left: 69%; bottom: 0; }

.ball {
  position: absolute;
  z-index: 12;
  left: 50%;
  top: 91.4%;
  width: clamp(42px, 5.8%, 88px);
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 10px 7px rgba(0, 0, 0, 0.52));
  pointer-events: none;
  will-change: left, top, width, transform;
}

.ball.shooting {
  transition: left 680ms cubic-bezier(.18, .73, .24, 1), top 680ms cubic-bezier(.18, .73, .24, 1), width 680ms ease-in, transform 680ms linear;
  transform: translate(-50%, -50%) rotate(620deg);
}

.message {
  position: absolute;
  z-index: 15;
  left: 50%;
  bottom: 1.7%;
  min-width: min(88vw, 360px);
  padding: 10px 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(2, 11, 7, 0.78);
  backdrop-filter: blur(8px);
  color: white;
  font-size: clamp(0.84rem, 1.7vw, 1rem);
  font-weight: 800;
  text-align: center;
  transform: translateX(-50%);
}

.message.goal { color: #75ff9e; }
.message.save { color: #ffd95a; }

.result-modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 8, 4, 0.76);
  backdrop-filter: blur(8px);
}

.result-modal[hidden] {
  display: none;
}

.result-card {
  width: min(92vw, 440px);
  padding: 38px 30px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 28px;
  background: linear-gradient(145deg, #153d27, #07160e);
  text-align: center;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.58);
}

.result-card h1 {
  margin: 10px 0;
  font-size: clamp(1.9rem, 7vw, 3rem);
}

.result-card p {
  margin: 0 0 24px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.6;
}

.result-card p strong {
  display: inline-block;
  margin: 8px 0 5px;
  color: var(--gold);
  font-size: clamp(1.35rem, 5vw, 2rem);
  line-height: 1.15;
}

.result-card button {
  padding: 13px 24px;
}

@media (max-width: 700px) {
  .scoreboard {
    min-height: 72px;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    padding: 8px 10px;
  }

  .brand-kicker { display: none; }
  .brand strong { font-size: 0.98rem; }
  .stats { justify-content: center; gap: 9px; }
  .stats div { min-width: 48px; }
  .stats span { font-size: 0.53rem; }
  .stats strong { font-size: 1rem; }
  .reset-button { padding: 9px 11px; font-size: 0.74rem; }
  .scene { width: min(100%, calc((100vh - 72px) * 1.913043)); }
}

@media (orientation: portrait) {
  body { overflow: auto; }
  .game-shell { min-height: 640px; }
  .pitch { align-items: start; background: #07170f; }
  .scene {
    width: max(100%, 850px);
    max-height: none;
    transform-origin: top center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
