/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Rich, deep palette */
  --white: #ffffff;
  --bg: #fafaf8;
  --bg-warm: #f5f3ef;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-hover: #fafaf8;

  /* Greens — refined, not garish */
  --emerald-950: #0a1f13;
  --emerald-900: #0f2b1a;
  --emerald-800: #14391f;
  --emerald-700: #1a5c2e;
  --emerald-600: #1f7a3a;
  --emerald-500: #22c55e;
  --emerald-400: #4ade80;
  --emerald-100: #dcfce7;
  --emerald-50: #f0fdf4;

  /* Warm neutrals */
  --stone-900: #1c1917;
  --stone-800: #292524;
  --stone-700: #44403c;
  --stone-600: #57534e;
  --stone-500: #78716c;
  --stone-400: #a8a29e;
  --stone-300: #d6d3d1;
  --stone-200: #e7e5e4;
  --stone-175: #eeedec;
  --stone-150: #f2f1ef;
  --stone-125: #f6f5f3;
  --stone-100: #f5f5f4;
  --stone-50: #fafaf9;

  /* Accents */
  --amber-500: #c9a227;
  --amber-100: #fef9e7;
  --amber-50: #fffdf4;
  --red: #dc2626;

  /* Depth */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0,0,0,0.2);
  --shadow-card: 0 0 0 1px rgba(0,0,0,0.03), 0 2px 4px rgba(0,0,0,0.04), 0 12px 24px rgba(0,0,0,0.04);
  --shadow-card-hover: 0 0 0 1px rgba(0,0,0,0.03), 0 4px 8px rgba(0,0,0,0.06), 0 24px 48px rgba(0,0,0,0.06);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition: 0.15s ease;
  --transition-slow: 0.3s var(--ease-out);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--stone-900);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Password Screen ===== */
.password-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--emerald-950);
  z-index: 1000;
  overflow: hidden;
}

.password-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(34,197,94,0.12) 0%, transparent 70%),
    radial-gradient(ellipse 60% 80% at 80% 90%, rgba(201,162,39,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 50% 50%, rgba(34,197,94,0.04) 0%, transparent 80%);
}

/* Subtle animated grain texture */
.password-screen::after {
  content: '';
  position: absolute;
  inset: -50%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  opacity: 0.5;
  pointer-events: none;
}

.password-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 60px 48px;
  text-align: center;
  box-shadow: var(--shadow-2xl), 0 0 0 1px rgba(255,255,255,0.05);
  max-width: 400px;
  width: 88%;
  position: relative;
}

.password-logo {
  font-size: 56px;
  margin-bottom: 16px;
  line-height: 1;
}

.password-card h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--stone-900);
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.password-card p {
  color: var(--stone-400);
  font-size: 14px;
  margin-bottom: 36px;
  letter-spacing: -0.1px;
}

#password-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#password-input {
  padding: 13px 16px;
  border: 1.5px solid var(--stone-200);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  text-align: center;
  outline: none;
  transition: all var(--transition);
  background: var(--stone-50);
  color: var(--stone-900);
}

#password-input:focus {
  border-color: var(--emerald-500);
  box-shadow: 0 0 0 3px rgba(34,197,94,0.12);
  background: var(--surface);
}

#password-form button {
  padding: 13px;
  background: var(--emerald-700);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: -0.2px;
}

#password-form button:hover {
  background: var(--emerald-600);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

#password-form button:active {
  transform: translateY(0);
}

.password-error {
  color: var(--red);
  font-size: 13px;
  min-height: 18px;
  font-weight: 500;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.password-card.shake { animation: shake 0.35s ease; }

/* ===== Navbar ===== */
.navbar {
  background: var(--emerald-800);
  color: var(--white);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.nav-logo {
  color: var(--white);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  letter-spacing: -0.3px;
  opacity: 0.95;
  transition: opacity var(--transition);
}

.nav-logo:hover { opacity: 1; }

.nav-dropdown {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 7px 32px 7px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  width: auto;
  flex-shrink: 1;
  min-width: 0;
  transition: all var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='rgba(255,255,255,0.5)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.nav-dropdown:hover {
  background-color: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.18);
}

.nav-dropdown option {
  background: var(--surface);
  color: var(--stone-900);
}

/* ===== Landing Page ===== */
.landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 56px);
  text-align: center;
  padding: 40px 24px;
  position: relative;
  background: var(--bg);
}

.landing::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 600px;
  background: radial-gradient(ellipse, rgba(34,197,94,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.landing-ball {
  font-size: 72px;
  margin-bottom: 24px;
  animation: float 4s ease-in-out infinite;
  position: relative;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.landing h1 {
  font-size: 56px;
  font-weight: 800;
  color: var(--stone-900);
  letter-spacing: -2.5px;
  line-height: 1.05;
  position: relative;
}

.landing-subtitle {
  font-size: 18px;
  color: var(--stone-400);
  margin: 12px 0 44px;
  font-weight: 400;
  letter-spacing: -0.2px;
}

.landing-btn {
  display: inline-flex;
  align-items: center;
  padding: 14px 40px;
  background: var(--emerald-700);
  color: var(--white);
  text-decoration: none;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 600;
  transition: all var(--transition);
  letter-spacing: -0.2px;
  box-shadow: 0 4px 14px rgba(26,92,46,0.35);
  position: relative;
}

.landing-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(26,92,46,0.4);
  background: var(--emerald-600);
}

.landing-btn:active {
  transform: translateY(0);
}

/* ===== Page Titles ===== */
.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--stone-900);
  margin: 36px 0 28px;
  letter-spacing: -1px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--stone-400);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  margin-top: 28px;
  padding: 6px 0;
  transition: color var(--transition);
  letter-spacing: -0.1px;
}

.back-link:hover {
  color: var(--stone-900);
}

/* ===== Totals Table ===== */
.totals-table-wrap {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 40px;
  transition: all 0.25s var(--ease-out);
}

.totals-table-wrap:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.totals-table-wrap .table-scroll {
  overflow-x: auto;
}

.totals-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.totals-table th {
  background: var(--stone-200);
  color: var(--stone-500);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  white-space: nowrap;
  border-bottom: 1px solid var(--stone-300);
}

.totals-table th:not(:first-child) {
  text-align: right;
  width: 1%;
}

.totals-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--stone-200);
  font-size: 14px;
  color: var(--stone-700);
  white-space: nowrap;
}

.totals-table td:not(:first-child) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  width: 1%;
}

.totals-table tr:last-child td {
  border-bottom: none;
}

.totals-table tbody tr {
  transition: background var(--transition);
}

.totals-table tbody tr:hover {
  background: var(--emerald-50);
}

.totals-table .team-link {
  color: var(--stone-900);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition);
  letter-spacing: -0.2px;
}

.totals-table .team-link:hover {
  color: var(--emerald-600);
}

.totals-remaining {
  color: var(--stone-900) !important;
  font-weight: 700 !important;
}

/* ===== Summary Team Cards ===== */
.summary-team-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  overflow-x: auto;
  transition: all 0.25s var(--ease-out);
  margin-bottom: 24px;
}

.summary-team-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.summary-team-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--stone-300);
  background: var(--stone-175);
  min-width: 520px;
}

.summary-team-header a,
.summary-team-header span:first-child {
  color: var(--stone-900);
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.4px;
  transition: color var(--transition);
}

.summary-team-header a:hover {
  color: var(--emerald-600);
}

.summary-team-header .keeper-badge {
  background: var(--emerald-50);
  color: var(--emerald-700);
  padding: 5px 14px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.1px;
}

.summary-keeper-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 14px;
}

.summary-keeper-table .summary-remove-col { width: 40px; }

.summary-keeper-table th {
  padding: 10px 24px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--stone-500);
  border-bottom: 1px solid var(--stone-300);
  white-space: nowrap;
  background: var(--stone-125);
}

.summary-keeper-table td {
  padding: 12px 24px;
  border-bottom: 1px solid var(--stone-200);
  color: var(--stone-700);
  white-space: nowrap;
}

/* Last row border hidden by card overflow:hidden */

.summary-no-keepers {
  padding: 28px;
  text-align: center;
  color: var(--stone-300);
  font-size: 14px;
}

.summary-keeper-empty {
  padding: 12px 24px;
  border-bottom: 1px solid var(--stone-200);
  color: var(--stone-200);
  font-size: 14px;
  height: 44px;
}

/* Summary remove button (team page only) */
.summary-remove-col {
  width: 28px;
  padding: 0 !important;
}

.summary-remove-cell {
  width: 28px;
  padding: 0 4px 0 12px !important;
  vertical-align: middle;
}

.summary-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  background: var(--stone-100);
  color: var(--stone-400);
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition);
  padding: 0;
  font-family: inherit;
}

.summary-remove-btn:hover {
  background: var(--red);
  color: var(--white);
  transform: scale(1.1);
}

/* Explosion animation for summary remove */
@keyframes charExplode {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--ex), var(--ey)) rotate(var(--er)) scale(0.3);
  }
}

.exploding-char {
  display: inline-block;
  animation: charExplode 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

tr.exploding {
  pointer-events: none;
}

/* Implosion animation — reverse of explosion, chars fly IN from random positions */
@keyframes charImplode {
  0% {
    opacity: 0;
    transform: translate(var(--ix), var(--iy)) rotate(var(--ir)) scale(0.3);
  }
  100% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
}

.imploding-char {
  display: inline-block;
  opacity: 0;
  animation: charImplode 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Last empty row border hidden by card overflow:hidden */

.empty-slot-row td {
  height: 44px;
}

/* Keeper total row */
.keeper-total-row td {
  border-top: 2px solid var(--stone-300);
  border-bottom: none !important;
  padding-top: 12px;
  padding-bottom: 14px;
  background: var(--stone-125);
}

.keeper-total-label {
  font-weight: 600 !important;
  color: var(--stone-500) !important;
  text-align: right !important;
  padding-right: 12px !important;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.keeper-total-value {
  color: var(--stone-900) !important;
  font-size: 15px;
}

/* ===== Team Page ===== */
.team-header {
  position: relative;
}

.keeper-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 28px;
  letter-spacing: -0.1px;
  transition: all var(--transition);
}

/* Age column */
.player-age {
  color: var(--stone-400);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* Stat divider — vertical separator between keeper info and 2025 stats */
.stat-divider {
  width: 1px !important;
  min-width: 1px !important;
  max-width: 1px !important;
  padding: 0 !important;
  background: var(--stone-200);
  border-bottom: none !important;
}

th.stat-divider {
  background: var(--stone-300);
}

/* Stat label row — minimal row above stat column headers */
.stat-label-row th {
  background: var(--surface);
  border-bottom: none;
  padding: 0;
  height: 0;
  line-height: 0;
}

.stat-label-cell {
  text-align: left !important;
  color: var(--stone-400) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 16px 2px !important;
  height: auto !important;
  line-height: normal !important;
}

/* Stat columns */
.stat-col {
  font-size: 13px !important;
}

.stat-cell {
  font-variant-numeric: tabular-nums;
  color: var(--stone-700);
  font-size: 14px;
  text-align: right;
}

.roster-table th.stat-col {
  text-align: right;
  color: var(--stone-500) !important;
  font-size: 11px !important;
}

/* Roster Table */
.roster-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--stone-400);
  margin: 36px 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* Two-div approach: outer card for styling, inner for scrolling */
.roster-card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
  transition: all 0.25s var(--ease-out);
}

.roster-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.roster-table-scroll {
  overflow-x: auto;
}

.roster-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 650px;
}

.roster-table th {
  padding: 11px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--stone-500);
  white-space: nowrap;
  position: sticky;
  top: 0;
  border-bottom: 1px solid var(--stone-200);
  background: var(--stone-150);
}

.roster-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--stone-200);
  white-space: nowrap;
  color: var(--stone-700);
}

.roster-table tr:last-child td {
  border-bottom: none;
}

/* Sticky first two cols (selector + player name) */
.roster-table th:first-child,
.roster-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: inherit;
  overflow: visible;
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  padding: 8px 4px 8px 8px;
}

.roster-table th:nth-child(2),
.roster-table td:nth-child(2) {
  position: sticky;
  left: 44px;
  z-index: 2;
  background: inherit;
}

.roster-table th:first-child {
  background: var(--stone-150);
  z-index: 3;
}

.roster-table th:nth-child(2) {
  background: var(--stone-150);
  z-index: 3;
}

/* Subtle shadow on the sticky edge when scrolled */
.roster-table td:nth-child(2)::after,
.roster-table th:nth-child(2)::after {
  content: '';
  position: absolute;
  top: 0;
  right: -6px;
  bottom: 0;
  width: 6px;
  pointer-events: none;
  background: linear-gradient(to right, rgba(0,0,0,0.04), transparent);
}

/* Row states */
.roster-row {
  transition: all var(--transition);
  background: var(--surface);
}

.roster-row:hover {
  background: var(--stone-50);
}

.roster-row.keeper-selected {
  background: var(--emerald-50);
}

.roster-row.keeper-selected:hover {
  background: var(--emerald-100);
}

.roster-row.ineligible {
  opacity: 0.35;
}

.roster-row.ineligible td {
  color: var(--stone-400);
}

/* Player name */
.player-name-cell {
  font-weight: 600;
  color: var(--stone-900);
  letter-spacing: -0.2px;
  position: relative;
}

.player-mlb-team {
  color: var(--stone-400);
  font-size: 12px;
  font-weight: 400;
  margin-left: 6px;
}

.player-positions {
  color: var(--stone-500);
  font-size: 13px;
}

.keeper-note-text {
  font-size: 11px;
  color: var(--stone-400);
  font-style: italic;
}

.price-keeper-tag {
  color: var(--emerald-600);
  font-size: 11px;
  font-weight: 600;
}

/* ===== Baseball Selector ===== */
.keeper-selector {
  width: 36px;
  height: 36px;
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.keeper-selector.disabled {
  cursor: default;
}

.keeper-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--stone-200);
  transition: all var(--transition);
  position: absolute;
  background: var(--surface);
}

.keeper-selector:not(.disabled):hover .keeper-circle {
  border-color: var(--emerald-400);
  box-shadow: 0 0 0 3px rgba(34,197,94,0.08);
}

.keeper-baseball {
  font-size: 26px;
  position: absolute;
  opacity: 0;
  pointer-events: none;
  line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.15));
}

.keeper-baseball.visible {
  opacity: 1;
}

/* Baseball lob-in: ball travels a STRAIGHT path from start to circle.
   3D perspective comes purely from scale — grows huge (close to viewer)
   at midpoint, then shrinks to normal as it lands in the circle. */
@keyframes baseballLobIn {
  0% {
    opacity: 0;
    transform: translate(var(--start-x), var(--start-y)) rotate(0deg) scale(0.15);
  }
  8% {
    opacity: 1;
    transform: translate(calc(var(--start-x) * 0.88), calc(var(--start-y) * 0.88)) rotate(calc(var(--spin) * 0.08)) scale(0.35);
  }
  25% {
    opacity: 1;
    transform: translate(calc(var(--start-x) * 0.6), calc(var(--start-y) * 0.6)) rotate(calc(var(--spin) * 0.25)) scale(1.2);
  }
  42% {
    opacity: 1;
    transform: translate(calc(var(--start-x) * 0.35), calc(var(--start-y) * 0.35)) rotate(calc(var(--spin) * 0.42)) scale(2.2);
  }
  60% {
    opacity: 1;
    transform: translate(calc(var(--start-x) * 0.18), calc(var(--start-y) * 0.18)) rotate(calc(var(--spin) * 0.6)) scale(1.5);
  }
  80% {
    opacity: 1;
    transform: translate(calc(var(--start-x) * 0.05), calc(var(--start-y) * 0.05)) rotate(calc(var(--spin) * 0.8)) scale(1.08);
  }
  100% {
    opacity: 1;
    transform: translate(0, 0) rotate(var(--spin)) scale(1);
  }
}

/* Baseball BLASTED off: brief squash on contact, then rockets away
   shrinking rapidly as it flies into the distance */
@keyframes baseballBlastOff {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  7% {
    opacity: 1;
    transform: translate(0, 1px) rotate(0deg) scaleX(1.2) scaleY(0.8);
  }
  15% {
    opacity: 1;
    transform: translate(calc(var(--end-x) * 0.04), calc(var(--end-y) * 0.04)) rotate(calc(var(--spin) * 0.06)) scale(1.6);
  }
  30% {
    opacity: 1;
    transform: translate(calc(var(--end-x) * 0.15), calc(var(--end-y) * 0.15)) rotate(calc(var(--spin) * 0.2)) scale(1.1);
  }
  55% {
    opacity: 0.7;
    transform: translate(calc(var(--end-x) * 0.45), calc(var(--end-y) * 0.45)) rotate(calc(var(--spin) * 0.5)) scale(0.5);
  }
  100% {
    opacity: 0;
    transform: translate(var(--end-x), var(--end-y)) rotate(var(--spin)) scale(0.08);
  }
}

.keeper-baseball.dropping {
  animation: baseballLobIn 1s ease-in-out forwards;
}

.keeper-baseball.launching {
  animation: baseballBlastOff 0.55s ease-out forwards;
}

/* Fixed-position overlay for animations — never clipped by scroll containers.
   Position is set via JS to the center of the circle minus half the emoji size. */
.keeper-baseball-overlay {
  position: fixed;
  z-index: 9999;
  font-size: 26px;
  line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.keeper-baseball-overlay.dropping {
  animation: baseballLobIn 1s ease-in-out forwards;
}

.keeper-baseball-overlay.launching {
  animation: baseballBlastOff 0.55s ease-out forwards;
}

/* Max keeper shake */
@keyframes keeperShake {
  0%, 100% { transform: translateX(0); }
  15%, 45%, 75% { transform: translateX(-4px); }
  30%, 60%, 90% { transform: translateX(4px); }
}

.keeper-selector.shake-error {
  animation: keeperShake 0.4s ease;
}

.keeper-max-msg {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  color: var(--stone-900);
  border: 1px solid var(--stone-200);
  padding: 12px 24px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  z-index: 200;
  letter-spacing: -0.1px;
  animation: toastIn 0.25s var(--ease-out), toastOut 0.25s ease 2s forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  to { opacity: 0; transform: translateX(-50%) translateY(8px) scale(0.95); }
}

/* ===== Draft Results ===== */
.draft-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--stone-400);
  padding-left: 4px;
}

.control-buttons {
  display: flex;
  gap: 6px;
}

.team-filter-select {
  padding: 8px 32px 8px 14px;
  border: 1.5px solid var(--stone-200);
  background: var(--surface);
  color: var(--stone-700);
  border-radius: 100px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: -0.1px;
  appearance: none;
  -webkit-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='%2378716c' 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 12px center;
  width: fit-content;
  max-width: 280px;
}

.team-filter-select:hover {
  border-color: var(--stone-300);
  background-color: var(--stone-50);
  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='%2378716c' 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 12px center;
}

.team-filter-select:focus {
  outline: none;
  border-color: var(--emerald-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.sort-btn {
  padding: 8px 20px;
  border: 1.5px solid var(--stone-200);
  background: var(--surface);
  color: var(--stone-600);
  border-radius: 100px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: -0.1px;
}

.sort-btn.active {
  background: var(--stone-900);
  color: var(--surface);
  border-color: var(--stone-900);
}

.sort-btn:hover:not(.active) {
  border-color: var(--stone-300);
  background: var(--stone-50);
}

.filter-btn.active {
  background: var(--emerald-600);
  border-color: var(--emerald-600);
  color: #fff;
}

.filter-btn:hover:not(.active) {
  border-color: var(--emerald-400);
  color: var(--emerald-700);
}

.draft-table-wrap {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow-x: auto;
  margin-bottom: 48px;
  transition: all 0.25s var(--ease-out);
}

.draft-table-wrap:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.draft-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 500px;
}

.draft-table th {
  padding: 12px 20px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--stone-500);
  white-space: nowrap;
  border-bottom: 1px solid var(--stone-200);
  background: var(--stone-150);
}

.draft-table td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--stone-100);
  color: var(--stone-700);
}

.draft-table tr:last-child td {
  border-bottom: none;
}

.draft-table tbody tr {
  transition: background var(--transition);
}

.draft-table tbody tr:hover {
  background: var(--emerald-50);
}

.draft-table .keeper-tag {
  display: inline-flex;
  align-items: center;
  background: var(--amber-100);
  color: var(--amber-500);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.draft-price {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--stone-900);
}

.draft-player-link {
  color: var(--stone-900);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition);
}

.draft-player-link:hover {
  color: var(--emerald-600);
}

.draft-team-link {
  color: var(--stone-700);
  text-decoration: none;
  transition: color var(--transition);
}

.draft-team-link:hover {
  color: var(--emerald-600);
}

.keeper-year-pill {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.keeper-year-pill.year-1 {
  background: var(--emerald-100);
  color: var(--emerald-700);
}

.keeper-year-pill.year-2 {
  background: #dbeafe;
  color: #1d4ed8;
}

.keeper-year-pill.year-3 {
  background: #fae8ff;
  color: #9333ea;
}

/* ===== Loading State ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--stone-400);
  font-size: 14px;
  font-weight: 500;
}

.loading::after {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--stone-200);
  border-top-color: var(--emerald-500);
  border-radius: 50%;
  margin-left: 10px;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .landing h1 { font-size: 38px; letter-spacing: -1.5px; }
  .landing-subtitle { font-size: 16px; }
  .landing-ball { font-size: 56px; }
  .page-title { font-size: 24px; }
  .password-card { padding: 44px 32px; }
  .password-logo { font-size: 48px; }
  .nav-dropdown { font-size: 12px; }
  .totals-table { font-size: 13px; }
  .totals-table th, .totals-table td { padding: 10px 10px; }
  .totals-table th:first-child, .totals-table td:first-child { padding-right: 6px; }
  .roster-table { font-size: 13px; }
  .roster-table th, .roster-table td { padding: 10px 12px; }
  .summary-keeper-table th, .summary-keeper-table td { padding: 8px 12px; }
  .team-filter-select { width: 100%; min-width: unset; }
}

@media (max-width: 480px) {
  .navbar { padding: 0 16px; height: 52px; }
  .nav-logo { font-size: 14px; }
  .container { padding: 0 16px; }
  .landing h1 { font-size: 30px; }
  .page-title { font-size: 22px; margin: 24px 0 20px; }
  .summary-grid { gap: 12px; }
  .control-buttons { flex-wrap: wrap; }
  .summary-keeper-table th, .summary-keeper-table td { padding: 8px 8px; }
}

/* ===== Page Transitions ===== */
.page {
  animation: fadeIn 0.3s var(--ease-out);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Page Container ===== */
.page-container {
  min-height: calc(100vh - 56px);
  padding-bottom: 48px;
}
