@import url('https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@700;900&family=Oswald:wght@600;700&display=swap');

:root {
  --primary-color: #0B162A;
  --secondary-color: #C83803;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Roboto Condensed', sans-serif;
  background: #111;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  color: white;
  gap: 16px;
}

/* ============================================
   SIDE PANEL
   ============================================ */
.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.panel-card {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 200px;
}

.panel-divider {
  height: 1px;
  background: #2a2a2a;
}

/* Kicker identity — logo + name */
.kicker-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}

.kicker-info {
  display: flex;
  flex-direction: column;
}

.kicker-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.kicker-team {
  font-size: 12px;
  color: #888;
  font-weight: 500;
}

/* Dropdown */
.kicker-select select {
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #333;
  background: #222;
  color: #aaa;
  cursor: pointer;
  width: 100%;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.kicker-select select:hover {
  border-color: #555;
}

.kicker-select select:focus {
  outline: none;
  border-color: var(--secondary-color);
}

/* Scoreboard — distance */
.scoreboard {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  min-width: 100px;
}

.scoreboard-number {
  font-family: 'Oswald', sans-serif;
  font-size: 52px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  min-width: 2ch;
  text-align: center;
}

.scoreboard-unit {
  font-family: 'Oswald', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: #555;
  letter-spacing: 2px;
}

/* Success rate */
.success-rate {
  text-align: center;
  padding: 10px 16px;
  border-radius: 8px;
  background: #222;
  border: 1px solid #333;
  min-width: 160px;
}

.rate-number {
  font-family: 'Oswald', sans-serif;
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  min-width: 4ch;
  text-align: center;
}

.rate-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #666;
  margin-top: 4px;
}

/* Kick markers toggle */
.marker-toggle {
  display: flex;
}

.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  cursor: pointer;
  font-size: 11px;
  color: #666;
  font-weight: 700;
  user-select: none;
}

.toggle-label input {
  display: none;
}

.toggle-switch {
  width: 36px;
  height: 20px;
  background: #333;
  border-radius: 10px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #888;
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.toggle-label input:checked + .toggle-switch {
  background: #22c55e;
}

.toggle-label input:checked + .toggle-switch::after {
  transform: translateX(16px);
  background: #fff;
}

.success-rate.easy .rate-number { color: #22c55e; }
.success-rate.medium .rate-number { color: #eab308; }
.success-rate.hard .rate-number { color: #f97316; }
.success-rate.extreme .rate-number { color: #ef4444; }

/* ============================================
   KICK MARKERS (checkmarks and Xs)
   ============================================ */
.kick-marker {
  position: absolute;
  font-size: 14px;
  font-weight: 900;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  z-index: 5;
  pointer-events: auto;
}

.kick-marker:hover {
  z-index: 15;
}

.kick-marker.made {
  background: rgba(34, 197, 94, 0.9);
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.kick-marker.missed {
  background: rgba(239, 68, 68, 0.9);
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.kick-tooltip {
  position: fixed;
  display: none;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.4;
  z-index: 100;
  transform: translate(-50%, -100%);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.kicker-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kicker-stat {
  font-size: 11px;
  color: #555;
  display: flex;
  justify-content: space-between;
}

.kicker-stat span {
  color: #ccc;
  font-weight: 700;
}

/* ============================================
   FIELD WRAPPER
   ============================================ */
.field-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

/* ============================================
   FIELD - Realistic look based on Soldier Field
   ============================================ */
.field {
  position: relative;
  border: 5px solid white;
  cursor: pointer;
  user-select: none;
  overflow: visible;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  touch-action: none;

  /* Natural grass - yellowish green like real turf */
  background-color: #6b8c42;
}

/* ============================================
   END ZONES - Both navy like real Soldier Field
   ============================================ */
.end-zone {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-color);
  overflow: hidden;
  z-index: 2;
}

.end-zone-text {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* ============================================
   MIDFIELD LOGO
   ============================================ */
.midfield-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1;
  opacity: 0.7;
}

.midfield-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ============================================
   YARD LINES
   ============================================ */
.yard-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.7);
  pointer-events: none;
  z-index: 1;
}

.yard-line.major {
  background: rgba(255, 255, 255, 0.9);
}

.yard-number {
  position: absolute;
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  color: white;
  opacity: 0.85;
  pointer-events: none;
  z-index: 1;
}

/* ============================================
   LINE OF SCRIMMAGE
   ============================================ */
.marker {
  position: absolute;
  background: #ffff00;
  cursor: pointer;
  z-index: 10;
  box-shadow:
    0 0 12px rgba(255, 255, 0, 1),
    0 0 30px rgba(255, 255, 0, 0.5);
  will-change: transform;
  touch-action: none;
}

.ball-spot {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(145deg, #a0522d, #6b3510);
  border: 2px solid white;
  border-radius: 45%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

/* ============================================
   GOAL POST
   ============================================ */
.goal-post {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 20;
  pointer-events: none;
}

.goal-post .crossbar { background: #ffd700; }
.goal-post .upright-container { display: flex; justify-content: space-between; }
.goal-post .upright { background: #ffd700; }
.goal-post .post { background: linear-gradient(to bottom, #ffd700, #b8860b); }

/* ============================================
   INSTRUCTIONS
   ============================================ */
.instructions {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #444;
  letter-spacing: 2px;
}

.site-footer {
  position: fixed;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #444;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.site-footer a {
  color: #666;
  text-decoration: none;
}

.site-footer a:hover {
  color: #999;
}

/* ============================================
   PORTRAIT MODE
   ============================================ */
@media (orientation: portrait) {
  body {
    flex-direction: column;
    gap: 12px;
    padding: 10px;
  }

  .panel-card {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 12px 16px;
    min-width: unset;
    width: 100%;
    justify-content: center;
  }

  .kicker-identity {
    gap: 8px;
    flex-shrink: 0;
  }

  .panel-logo {
    width: 28px;
    height: 28px;
  }

  .kicker-name {
    font-size: 13px;
  }

  .kicker-team {
    font-size: 10px;
  }

  .kicker-select {
    flex-shrink: 0;
  }

  .kicker-select select {
    font-size: 10px;
    padding: 6px 24px 6px 8px;
  }

  .panel-divider {
    display: none;
  }

  .scoreboard {
    flex-shrink: 0;
  }

  .scoreboard-number {
    font-size: 36px;
  }

  .scoreboard-unit {
    font-size: 13px;
  }

  .success-rate {
    padding: 6px 12px;
    flex-shrink: 0;
    min-width: 120px;
  }

  .rate-number {
    font-size: 28px;
  }

  .rate-label {
    font-size: 8px;
  }

  .kicker-stats {
    display: none;
  }

  .marker-toggle {
    display: none;
  }

  /* panel-divider hidden above */

  .kick-marker {
    width: 16px;
    height: 16px;
    font-size: 11px;
  }

  .field {
    width: min(92vw, 360px);
    height: auto;
    aspect-ratio: 53.3 / 120;
    max-height: calc(100dvh - 160px);

    /* Vertical grass stripes - 5 yard intervals (83.34% / 20 = 4.167%) */
    background:
      repeating-linear-gradient(
        180deg,
        #6b8c42 0%, #6b8c42 4.167%,
        #5f7d3a 4.167%, #5f7d3a 8.334%
      );
  }

  .end-zone {
    left: 0;
    right: 0;
    height: 8.33%;
  }

  .end-zone.goal {
    top: 0;
    border-bottom: 3px solid white;
  }

  .end-zone.team {
    bottom: 0;
    border-top: 3px solid white;
  }

  .end-zone-text {
    font-size: clamp(10px, 3.5vw, 16px);
    letter-spacing: 0.2em;
  }

  .midfield-logo {
    width: 50px;
    height: 50px;
  }

  .yard-line {
    left: 0;
    right: 0;
    height: 2px;
  }

  .yard-number {
    font-size: 9px;
  }
  .yard-number.left { left: 5px; }
  .yard-number.right { right: 5px; }

  .marker {
    left: 0;
    right: 0;
    top: 0;
    height: 5px;
  }

  .ball-spot {
    width: 14px;
    height: 9px;
  }

  .goal-post {
    left: 50%;
    transform: translateX(-50%);
    top: -28px;
  }

  .goal-post .upright-container { width: 28px; order: 1; }
  .goal-post .upright { width: 2px; height: 14px; }
  .goal-post .crossbar { width: 28px; height: 3px; order: 2; }
  .goal-post .post { width: 3px; height: 10px; order: 3; }
}

/* ============================================
   LANDSCAPE MODE
   ============================================ */
@media (orientation: landscape) {
  body {
    flex-direction: row;
    gap: 20px;
  }

  .panel-card {
    gap: 16px;
    padding: 22px;
  }

  .field {
    height: min(88vh, 88dvh, 520px);
    width: auto;
    aspect-ratio: 120 / 53.3;
    max-width: calc(100vw - 260px);

    /* Horizontal grass stripes - 5 yard intervals (83.34% / 20 = 4.167%) */
    background:
      repeating-linear-gradient(
        90deg,
        #6b8c42 0%, #6b8c42 4.167%,
        #5f7d3a 4.167%, #5f7d3a 8.334%
      );
  }

  .end-zone {
    top: 0;
    bottom: 0;
    width: 8.33%;
    writing-mode: vertical-rl;
    text-orientation: mixed;
  }

  .end-zone.goal {
    left: 0;
    border-right: 3px solid white;
  }

  .end-zone.team {
    right: 0;
    border-left: 3px solid white;
  }

  .end-zone-text {
    font-size: clamp(12px, 1.8vw, 20px);
    letter-spacing: 0.25em;
  }

  .midfield-logo {
    width: 65px;
    height: 65px;
  }

  .yard-line {
    top: 0;
    bottom: 0;
    width: 2px;
  }

  .yard-number {
    writing-mode: horizontal-tb;
    font-size: 10px;
  }
  .yard-number.left { top: 5px; }
  .yard-number.right { bottom: 5px; }

  .marker {
    top: 0;
    bottom: 0;
    left: 0;
    width: 5px;
  }

  .ball-spot {
    width: 9px;
    height: 14px;
  }

  .goal-post {
    top: 50%;
    transform: translateY(-50%);
    left: -36px;
    flex-direction: row;
  }

  .goal-post .upright-container { flex-direction: column; height: 32px; order: 1; }
  .goal-post .upright { width: 16px; height: 2px; }
  .goal-post .crossbar { width: 3px; height: 32px; order: 2; }
  .goal-post .post { width: 12px; height: 3px; order: 3; }

  .instructions {
    display: none;
  }
}

/* ============================================
   LARGE DESKTOP
   ============================================ */
@media (orientation: landscape) and (min-width: 1100px) {
  .field {
    height: min(90vh, 90dvh, 600px);
    max-width: calc(100vw - 300px);
  }

  .scoreboard-number {
    font-size: 80px;
  }

  .end-zone-text {
    font-size: 22px;
  }

  .midfield-logo {
    width: 85px;
    height: 85px;
  }

  .yard-number {
    font-size: 12px;
  }
}

/* ============================================
   EXTRA LARGE DESKTOP
   ============================================ */
@media (orientation: landscape) and (min-width: 1400px) {
  .field {
    height: min(90vh, 90dvh, 700px);
  }

  .scoreboard-number {
    font-size: 88px;
  }

  .midfield-logo {
    width: 100px;
    height: 100px;
  }

  .end-zone-text {
    font-size: 26px;
    letter-spacing: 0.3em;
  }

  .yard-number {
    font-size: 14px;
  }
}
