/* ============================================================
   FROSTY EVOLUTION - Stylesheet
   Ice/winter theme: frosted glass, cool blues, warm accents.
   One file on purpose - see EVOLUTION_LAUNCH_PLAN.md for why.
   ============================================================ */

/* ---------- Reset & base ---------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: dark;
}

body {
  font-family: 'Segoe UI', 'Inter', system-ui, sans-serif;
  background: linear-gradient(180deg, var(--frost-blue-dark) 0%, #001529 100%);
  color: var(--frost-white);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

img {
  max-width: 100%;
}

button, input {
  font-family: inherit;
}

/* ---------- Theme tokens ---------- */
:root {
  /* Colors */
  --frost-blue-dark: #002244;
  --frost-blue-mid: #1a4d7a;
  --frost-blue-light: #A5D8FF;
  --frost-white: #F0F8FF;
  --frosty-green: #69BE28;
  --frosty-gold: #FFD700;
  --frosty-orange: #FF6B00;
  --frosty-red: #DC3545;
  --frosty-gray: #8ba3bd;

  /* Glass */
  --frost-glass-bg: rgba(255, 255, 255, 0.08);
  --frost-glass-bg-strong: rgba(255, 255, 255, 0.14);
  --frost-glass-border: rgba(165, 216, 255, 0.25);
  --frost-glass-blur: blur(12px);

  /* Shadows */
  --frost-shadow-sm: 0 2px 8px rgba(0, 10, 25, 0.35);
  --frost-shadow-md: 0 4px 20px rgba(0, 10, 25, 0.45);
  --frost-shadow-lg: 0 8px 36px rgba(0, 10, 25, 0.55);

  /* Spacing */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 16px;
  --sp-lg: 24px;
  --sp-xl: 32px;

  /* Radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
}

/* ---------- Decorative snowfall ---------- */
.snowfall {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

/* Outer wrapper: handles position only (left-to-right drift + slight rise).
   Spin is deliberately a separate, independent animation on the svg inside -
   see .football-wrapper svg below - so it keeps visibly spiraling at a
   steady rate no matter how fast or slow any given ball crosses the screen. */
.football-wrapper {
  position: absolute;
  left: -50px;
  display: block;
  animation: football-fly linear infinite;
  user-select: none;
  filter: drop-shadow(0 3px 6px rgba(0, 10, 25, 0.35));
}

.football-wrapper svg {
  display: block;
}

/* The ball's shape and shading are completely static now - the only thing
   that moves is the lace pattern, scrolling top-to-bottom and clipped to
   the ball's own outline (see clip-path above) so it appears at the top
   edge and disappears at the bottom edge, like it's wrapping around a
   spinning surface. Both keyframe endpoints sit fully outside the clipped
   area, so the loop reset is invisible - no pop. */
.football-wrapper svg .fb-laces {
  animation: fb-laces-scroll 1.2s linear infinite;
}

/* Parabolic arc: y = -4H*t*(1-t), which is steepest right at launch (t=0),
   flattens toward the peak exactly at center (t=0.5), then falls away at
   the same rate on the way down - a real thrown-ball trajectory rather than
   a straight diagonal drift. X still moves at a constant rate throughout. */
@keyframes football-fly {
  0%   { transform: translate(0, 0); opacity: 0; }
  8%   { opacity: 0.9; }
  10%  { transform: translate(calc((100vw + 80px) * 0.10), -19.8px); }
  20%  { transform: translate(calc((100vw + 80px) * 0.20), -35.2px); }
  30%  { transform: translate(calc((100vw + 80px) * 0.30), -46.2px); }
  40%  { transform: translate(calc((100vw + 80px) * 0.40), -52.8px); }
  50%  { transform: translate(calc((100vw + 80px) * 0.50), -55px); }
  60%  { transform: translate(calc((100vw + 80px) * 0.60), -52.8px); }
  70%  { transform: translate(calc((100vw + 80px) * 0.70), -46.2px); }
  80%  { transform: translate(calc((100vw + 80px) * 0.80), -35.2px); }
  90%  { transform: translate(calc((100vw + 80px) * 0.90), -19.8px); }
  92%  { opacity: 0.9; }
  100% { transform: translate(calc((100vw + 80px) * 1.00), 0px); opacity: 0; }
}

@keyframes fb-laces-scroll {
  0%   { transform: translateY(-40px); }
  100% { transform: translateY(40px); }
}

/* ---------- Layout shell ---------- */
.app-shell {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: var(--sp-md);
}

.site-header {
  text-align: center;
  padding: var(--sp-lg) 0 var(--sp-md);
  position: relative;
}

.header-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
}

.snowman-icon {
  flex-shrink: 0;
  filter: drop-shadow(0 4px 10px rgba(0, 10, 25, 0.4));
}

.snowman-bob {
  animation: snowman-bob 3s ease-in-out infinite;
  transform-origin: 50% 100%;
}

@keyframes snowman-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

.snowman-arm-mug {
  animation: snowman-cheers 5s ease-in-out infinite;
  transform-origin: 63px 44px;
}

@keyframes snowman-cheers {
  0%, 65%, 100% { transform: rotate(0deg); }
  72%, 85%      { transform: rotate(-20deg); }
  92%           { transform: rotate(0deg); }
}

.frost-puffs .puff {
  opacity: 0;
  animation: puff-rise 2.4s ease-out infinite;
}

.frost-puffs .puff2 { animation-delay: 0.6s; }
.frost-puffs .puff3 { animation-delay: 1.2s; }

@keyframes puff-rise {
  0%   { transform: translateY(0) scale(0.6); opacity: 0; }
  25%  { opacity: 0.8; }
  100% { transform: translateY(-12px) scale(1.5); opacity: 0; }
}

.site-header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, var(--frost-white), var(--frost-blue-light), var(--frost-white));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: ice-shimmer 5s linear infinite;
}

.site-header p {
  color: var(--frosty-gray);
  margin-top: var(--sp-xs);
  font-size: 0.95rem;
}

@keyframes ice-shimmer {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

.site-footer {
  text-align: center;
  padding: var(--sp-lg) 0 var(--sp-md);
  color: var(--frosty-gray);
  font-size: 0.8rem;
}

/* ---------- Frost card (base component) ---------- */
.frost-card {
  background: var(--frost-glass-bg);
  backdrop-filter: var(--frost-glass-blur);
  -webkit-backdrop-filter: var(--frost-glass-blur);
  border: 1px solid var(--frost-glass-border);
  border-radius: var(--r-lg);
  box-shadow: var(--frost-shadow-md);
  padding: var(--sp-lg);
}

/* ---------- Login screen ---------- */
.login-screen {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  max-width: 380px;
  margin: var(--sp-xl) auto 0;
  width: 100%;
}

.login-screen h2 {
  text-align: center;
  font-size: 1.3rem;
  margin-bottom: var(--sp-sm);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  margin-bottom: var(--sp-md);
}

.field label {
  font-size: 0.85rem;
  color: var(--frost-blue-light);
}

.field input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--frost-glass-border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  color: var(--frost-white);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus {
  border-color: var(--frost-blue-light);
  box-shadow: 0 0 0 3px rgba(165, 216, 255, 0.2);
}

.field input::placeholder {
  color: rgba(240, 248, 255, 0.35);
}

.admin-link {
  text-align: center;
  font-size: 0.8rem;
}

.admin-link a {
  color: var(--frosty-gray);
  text-decoration: none;
}

.admin-link a:hover {
  color: var(--frost-blue-light);
  text-decoration: underline;
}

/* ---------- Team selection grid ---------- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--sp-sm);
  max-height: 360px;
  overflow-y: auto;
  padding: var(--sp-xs);
}

.team-option {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid transparent;
  border-radius: var(--r-sm);
  padding: var(--sp-sm);
  cursor: pointer;
  color: var(--frost-white);
  font-size: 0.8rem;
  text-align: left;
  transition: all 0.15s;
}

.team-option:hover {
  background: rgba(255, 255, 255, 0.09);
}

.team-option.selected {
  border-color: var(--frost-blue-light);
  background: rgba(165, 216, 255, 0.12);
}

.team-swatch {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--team-primary);
  border: 2px solid var(--team-accent);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  border: none;
  border-radius: var(--r-sm);
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s;
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--frost-blue-mid), var(--frost-blue-light));
  color: var(--frost-blue-dark);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(165, 216, 255, 0.3);
}

.btn-block {
  width: 100%;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--frost-glass-border);
  color: var(--frost-white);
}

.btn-ghost:hover {
  background: var(--frost-glass-bg);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* ---------- Tab navigation ---------- */
.tab-nav {
  display: flex;
  gap: var(--sp-xs);
  background: var(--frost-glass-bg);
  border: 1px solid var(--frost-glass-border);
  border-radius: var(--r-md);
  padding: var(--sp-xs);
  margin-bottom: var(--sp-lg);
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  white-space: nowrap;
  background: transparent;
  border: none;
  color: var(--frosty-gray);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  position: relative;
  transition: color 0.2s, background 0.2s;
}

.tab-btn.active {
  color: var(--frost-blue-dark);
  background: linear-gradient(135deg, var(--frost-blue-light), var(--frost-white));
  box-shadow: var(--frost-shadow-sm);
}

.tab-btn:not(.active):hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--frost-white);
}

/* ---------- Week selector ---------- */
.week-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  margin-bottom: var(--sp-md);
  flex-wrap: wrap;
}

.week-bar select {
  background: var(--frost-glass-bg-strong);
  border: 1px solid var(--frost-glass-border);
  color: var(--frost-white);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: 0.95rem;
}

.lock-status {
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}

.lock-status.open {
  background: rgba(105, 190, 40, 0.18);
  color: var(--frosty-green);
}

.lock-status.locked {
  background: rgba(220, 53, 69, 0.18);
  color: var(--frosty-red);
}

.countdown-display {
  text-align: center;
  font-size: 0.85rem;
  color: var(--frost-blue-light);
  margin-bottom: var(--sp-md);
  letter-spacing: 0.3px;
}

.countdown-display .countdown-time {
  font-weight: 700;
  color: var(--frost-white);
  font-variant-numeric: tabular-nums;
}

/* ---------- Game pick cards ---------- */
.games-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.game-card {
  background: var(--frost-glass-bg);
  border: 1px solid var(--frost-glass-border);
  border-radius: var(--r-md);
  padding: var(--sp-md);
  box-shadow: var(--frost-shadow-sm);
}

.game-card .kickoff-time {
  font-size: 0.75rem;
  color: var(--frosty-gray);
  margin-bottom: var(--sp-sm);
  text-align: center;
}

.matchup {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--sp-sm);
}

.team-choice {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid transparent;
  border-radius: var(--r-sm);
  padding: var(--sp-sm) var(--sp-sm);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
  font-size: 0.9rem;
}

.team-choice:hover {
  border-color: var(--frost-glass-border);
  background: rgba(255, 255, 255, 0.09);
}

.team-choice.selected {
  border-color: var(--frosty-green);
  background: rgba(105, 190, 40, 0.15);
  color: var(--frosty-green);
}

.team-choice .team-abbr {
  display: block;
  font-size: 1.05rem;
}

.team-choice .team-name {
  display: block;
  font-size: 0.7rem;
  color: var(--frosty-gray);
  font-weight: 400;
  margin-top: 2px;
}

.matchup .at-sign {
  color: var(--frosty-gray);
  font-size: 0.8rem;
  font-weight: 400;
}

.game-card.locked .team-choice {
  cursor: not-allowed;
  opacity: 0.55;
}

.game-card.locked .team-choice:hover {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.05);
}

/* ---------- Tiebreaker ---------- */
.tiebreaker-box {
  margin-top: var(--sp-lg);
  text-align: center;
}

.tiebreaker-box label {
  display: block;
  margin-bottom: var(--sp-sm);
  font-size: 0.9rem;
  color: var(--frost-blue-light);
}

.tiebreaker-box input {
  width: 120px;
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--frost-glass-border);
  border-radius: var(--r-sm);
  padding: 10px;
  color: var(--frost-white);
  font-size: 1.2rem;
  font-weight: 700;
}

/* ---------- Status messages ---------- */
.status-msg {
  margin-top: var(--sp-md);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: 0.9rem;
  text-align: center;
}

.status-msg.success {
  background: rgba(105, 190, 40, 0.15);
  color: var(--frosty-green);
}

.status-msg.error {
  background: rgba(220, 53, 69, 0.15);
  color: var(--frosty-red);
}

.status-msg.info {
  background: rgba(165, 216, 255, 0.12);
  color: var(--frost-blue-light);
}

/* ---------- Placeholder / coming soon ---------- */
.coming-soon {
  text-align: center;
  padding: var(--sp-xl) var(--sp-md);
  color: var(--frosty-gray);
}

.coming-soon .icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: var(--sp-sm);
}

/* ---------- Standings table ---------- */
.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.standings-table th, .standings-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--frost-glass-border);
}

.standings-table th {
  color: var(--frost-blue-light);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.standings-table tr:first-child td {
  color: var(--frosty-gold);
  font-weight: 700;
}

/* ---------- Utility ---------- */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .site-header h1 {
    font-size: 1.5rem;
  }

  .matchup {
    grid-template-columns: 1fr auto 1fr;
    gap: var(--sp-xs);
  }

  .team-choice .team-name {
    display: none;
  }

  .frost-card {
    padding: var(--sp-md);
  }
}
