:root {
  color-scheme: light;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #0f2a13;
  color: #123;
  overflow: hidden;
}

.page {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 3.5vw, 3rem);
  line-height: 1.05;
}

.subtitle {
  margin-top: 0.5rem;
  color: #3b4e59;
  font-size: 1.05rem;
}

.pitch {
  --grid-columns: 60;
  --grid-rows: 30;
  --pitch-left: 12.6%;
  --pitch-right: 87.5%;
  --pitch-top: 15.8%;
  --pitch-bottom: 92.8%;
  position: relative;
  width: max(100vw, calc(100vh * 1.5077));
  height: max(100vh, calc(100vw / 1.5077));
  border-radius: 1rem;
  overflow: hidden;
  margin: 0;
  box-shadow: 0 20px 45px rgba(15, 55, 30, 0.2);
  touch-action: none;
  cursor: grab;
  transform-origin: 0 0;
}

.pitch:active {
  cursor: grabbing;
}

.pitch__image {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
}

.pitch__grid-svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pitch__grid-svg line {
  stroke: rgba(255, 255, 255, 0.7);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.cow-marker {
  position: absolute;
  width: 5%;
  min-width: 44px;
  border: 0;
  background: transparent;
  transform: translate(-50%, -50%);
  transform-origin: 50% 100%;
  padding: 0;
  cursor: default;
  pointer-events: none;
  animation: cow-bob 2.8s ease-in-out infinite;
}

.cow-marker--updated {
  animation: cow-bob 2.8s ease-in-out infinite, cow-hop 0.8s ease-out 1;
}

.pitch--interactive .cow-marker {
  cursor: pointer;
  pointer-events: auto;
}

.cow-marker__lottie {
  width: 100%;
  height: 100%;
  min-height: 44px;
  display: block;
  filter: drop-shadow(0 6px 9px rgba(0, 0, 0, 0.28));
}

.pitch__hotspot {
  position: absolute;
  left: var(--pitch-left);
  top: var(--pitch-top);
  width: calc(var(--pitch-right) - var(--pitch-left));
  height: calc(var(--pitch-bottom) - var(--pitch-top));
  border: 0;
  background: transparent;
  cursor: crosshair;
}

.plot-info {
  margin-top: 0.6rem;
  margin-bottom: 0;
  color: #f0fff6;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.page--fullscreen {
  width: 100vw;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  display: grid;
  place-items: center;
}

.pitch-viewport {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  position: relative;
}

.pitch__hud {
  position: absolute;
  left: 1rem;
  top: 1rem;
  z-index: 10;
  color: #f3fff8;
  background: rgba(7, 26, 14, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 0.75rem;
  padding: 0.7rem 0.9rem;
  backdrop-filter: blur(4px);
}

.pitch__hud h1 {
  font-size: clamp(1.2rem, 1.7vw, 2rem);
  color: #f6fffa;
}

.pitch__hud .subtitle {
  margin-top: 0.4rem;
  margin-bottom: 0;
  color: #d4ead8;
  font-size: clamp(0.86rem, 1.2vw, 1rem);
}

.page--admin .pitch__hud {
  left: auto;
  right: 1rem;
}

.pitch__zoom-controls {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 10;
  display: flex;
  gap: 0.45rem;
}

.pitch__zoom-controls button {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(7, 26, 14, 0.62);
  color: #f3fff8;
  border-radius: 0.55rem;
  min-width: 2.2rem;
  height: 2.2rem;
  padding: 0 0.6rem;
  font-size: 1rem;
  font-weight: 700;
}

@media (max-width: 900px) {
  .pitch__hud {
    left: 0.65rem;
    top: 0.65rem;
    max-width: min(78vw, 460px);
    padding: 0.55rem 0.65rem;
  }

  .page--admin .pitch__hud {
    right: 0.65rem;
    left: auto;
  }

  .pitch__hud .subtitle {
    font-size: 0.86rem;
  }

  .plot-info {
    margin-top: 0.4rem;
    font-size: 0.88rem;
  }

  .pitch__zoom-controls {
    right: 0.65rem;
    bottom: 0.65rem;
  }
}

.auth-page {
  width: min(440px, 100%);
  margin: 10vh auto 0;
  padding: 1.5rem;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

.auth-form {
  margin-top: 1rem;
  display: grid;
  gap: 0.5rem;
}

.auth-form input {
  border: 1px solid #9eb0b2;
  border-radius: 0.5rem;
  padding: 0.65rem 0.7rem;
  font-size: 1rem;
}

.auth-form input[type="submit"] {
  margin-top: 0.4rem;
  border: 0;
  background: #1e7f4f;
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.flash-stack {
  position: fixed;
  top: 0.6rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
}

.flash {
  margin: 0;
  padding: 0.65rem 0.9rem;
  border-radius: 0.5rem;
  background: #e3f3f8;
}

.flash--alert {
  background: #ffe7e1;
}

@keyframes cow-bob {
  0% {
    transform: translate(-50%, -50%) rotate(-1deg);
  }
  25% {
    transform: translate(-49%, -51%) rotate(1.5deg);
  }
  50% {
    transform: translate(-50%, -50%) rotate(-1deg);
  }
  75% {
    transform: translate(-51%, -49%) rotate(1deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(-1deg);
  }
}

@keyframes cow-hop {
  0% {
    filter: brightness(1);
    transform: translate(-50%, -50%) scale(1);
  }
  35% {
    filter: brightness(1.18);
    transform: translate(-50%, -57%) scale(1.08);
  }
  100% {
    filter: brightness(1);
    transform: translate(-50%, -50%) scale(1);
  }
}
