/* === Last Licks Web Game Styles === */

:root {
  --bg: #1a1a2e;
  --bg-light: #16213e;
  --bg-card: #0f3460;
  --accent: #e94560;
  --accent-gold: #f5c518;
  --text: #eee;
  --text-dim: #999;
  --green: #27ae60;
  --red: #e74c3c;
  --blue: #3498db;
  --tier1: #f5c518;
  --tier2: #c0c0c0;
  --tier3: #cd7f32;
  --tier4: #8b7355;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* === Screens === */
.screen { display: none; padding: 20px; max-width: 1200px; margin: 0 auto; }
.screen.active { display: block; }

/* === Title Screen === */
.title-card {
  text-align: center;
  padding: 60px 20px;
}
.box-art {
  max-width: 400px;
  width: 100%;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(233, 69, 96, 0.3);
  margin-bottom: 24px;
}
.title-card h1 {
  font-size: 3rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 4px;
  margin-bottom: 8px;
}
.subtitle {
  color: var(--text-dim);
  font-size: 1.2rem;
  margin-bottom: 32px;
}

/* === Buttons === */
.btn {
  padding: 10px 24px;
  border: 2px solid var(--text-dim);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn:hover { border-color: var(--text); background: rgba(255,255,255,0.05); }
.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.btn-primary:hover { background: #c73850; }
.btn-lg { font-size: 1.2rem; padding: 14px 36px; }

/* === Setup Screen === */
.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}
.setup-panel {
  background: var(--bg-light);
  border-radius: 12px;
  padding: 20px;
}
.setup-panel h3 {
  color: var(--accent);
  margin-bottom: 12px;
  font-size: 1.3rem;
}
.setup-panel h4 {
  margin: 16px 0 8px;
  color: var(--text-dim);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.input-name {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #333;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1.1rem;
  margin-bottom: 8px;
}
.input-name:focus { outline: none; border-color: var(--accent); }

/* Card pools */
.card-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
}
.card-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s;
  white-space: nowrap;
}
.card-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.card-chip.selected { border-color: var(--green); background: rgba(39, 174, 96, 0.15); }
.card-chip.taken { opacity: 0.3; cursor: not-allowed; pointer-events: none; }
.card-chip .tier-badge {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  text-align: center;
  line-height: 18px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #000;
}
.tier-1 { background: var(--tier1); }
.tier-2 { background: var(--tier2); }
.tier-3 { background: var(--tier3); }
.tier-4 { background: var(--tier4); }

.card-chip .chip-photo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.card-chip .chip-photo-placeholder {
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-light);
  flex-shrink: 0;
}
.card-chip .chip-stats {
  color: var(--text-dim);
  font-size: 0.75rem;
}

.selected-section {
  margin-top: 8px;
  min-height: 40px;
}
.selected-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.selected-cards .card-chip {
  border-color: var(--green);
  background: rgba(39, 174, 96, 0.1);
}

.setup-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
}

/* === Game Screen === */

/* Scoreboard */
#scoreboard {
  text-align: center;
  padding: 10px;
  background: var(--bg-light);
  border-radius: 12px;
  margin-bottom: 8px;
}
.score-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 1.3rem;
}
.sb-name { font-weight: 600; min-width: 120px; }
.sb-name:first-child { text-align: right; }
.sb-name:last-child { text-align: left; }
.sb-score {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--accent-gold);
  min-width: 50px;
  text-align: center;
}
.sb-divider { color: var(--text-dim); font-size: 2rem; }
.half-indicator {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 600;
}

/* Status bar */
#game-status {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}
.status-items {
  display: flex;
  gap: 32px;
}
.status-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-item .label {
  text-transform: uppercase;
  font-size: 0.8rem;
  color: var(--text-dim);
  letter-spacing: 1px;
}
.status-item .value {
  font-size: 1.5rem;
  font-weight: 700;
}
.outs-display {
  display: flex;
  gap: 6px;
}
.out-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--text-dim);
  background: transparent;
  transition: background 0.3s;
}
.out-dot.active {
  background: var(--red);
  border-color: var(--red);
}

/* Diamond */
#diamond-container {
  display: flex;
  justify-content: center;
  margin: 8px 0;
}
.diamond {
  position: relative;
  width: 180px;
  height: 180px;
}
.base {
  position: absolute;
  width: 28px;
  height: 28px;
  transform: rotate(45deg);
  border: 3px solid var(--text-dim);
  background: transparent;
  transition: all 0.3s;
}
.base.occupied {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.5);
}
.base-2nd { top: 10px; left: 50%; margin-left: -14px; }
.base-3rd { top: 50%; left: 10px; margin-top: -14px; }
.base-1st { top: 50%; right: 10px; margin-top: -14px; }
.base-home { bottom: 10px; left: 50%; margin-left: -14px; border-radius: 0 0 6px 6px; }

/* Matchup cards */
#matchup {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}
.matchup-card {
  background: var(--bg-light);
  border: 2px solid var(--bg-card);
  border-radius: 12px;
  padding: 10px 18px;
  text-align: center;
  min-width: 160px;
  transition: border-color 0.3s;
}
.matchup-card .mc-photo {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 6px;
  display: block;
  border: 2px solid var(--bg-card);
}
.matchup-card .mc-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.matchup-card .mc-name {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.matchup-card .mc-tier {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.mc-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
}
.pitcher-matchup { border-color: var(--accent); }

/* Matchup + Lineup 3-column row */
#matchup-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  margin: 12px auto;
  max-width: 960px;
}
.lineup-panel {
  flex: 1;
  background: var(--bg-light);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 150px;
  max-width: 220px;
}
.lineup-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.lineup-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lineup-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 5px;
  border-radius: 4px;
  font-size: 0.75rem;
  opacity: 0.6;
}
.lineup-row.lineup-active {
  opacity: 1;
  background: rgba(231, 76, 60, 0.15);
  border-left: 3px solid var(--accent);
}
.lineup-order {
  font-weight: 700;
  color: var(--accent);
  min-width: 20px;
  text-align: center;
}
.lineup-photo {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.lineup-photo-placeholder {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-card);
  flex-shrink: 0;
}
.lineup-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lineup-tier {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  text-align: center;
  line-height: 16px;
  font-size: 0.6rem;
  font-weight: 700;
  color: #000;
  flex-shrink: 0;
}
.lineup-stats {
  color: var(--text-dim);
  font-size: 0.7rem;
  white-space: nowrap;
}

.vs-badge {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text-dim);
}

/* Action area */
#action-area {
  background: var(--bg-light);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  margin: 16px 0;
  min-height: 160px;
}
.phase-panel h3 { margin-bottom: 12px; font-size: 1.2rem; }
.phase-hint {
  color: var(--text-dim);
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.dice-btn { font-size: 1.5rem; min-width: 160px; }

/* Guess buttons */
.guess-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
}
.btn-guess {
  padding: 16px 28px;
  font-size: 1.2rem;
  font-weight: 700;
  border: 3px solid var(--blue);
  border-radius: 12px;
  min-width: 100px;
}
.btn-guess:hover { background: rgba(52, 152, 219, 0.2); border-color: var(--blue); }
.btn-guess small { font-weight: 400; opacity: 0.7; }

/* Pitch choice */
.pitch-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
}
.btn-pitch {
  padding: 14px 24px;
  font-size: 1.1rem;
  font-weight: 700;
  border: 3px solid var(--green);
  border-radius: 12px;
  min-width: 120px;
}
.btn-pitch:hover { background: rgba(39, 174, 96, 0.2); }
.btn-pitch small { font-weight: 400; opacity: 0.7; }

/* Roll reveal */
.roll-reveal { margin-bottom: 16px; }
.die-value {
  display: inline-block;
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--accent-gold);
  background: var(--bg);
  width: 60px;
  height: 60px;
  line-height: 60px;
  text-align: center;
  border-radius: 12px;
  border: 3px solid var(--accent-gold);
  vertical-align: middle;
  margin-left: 8px;
}

/* Guess result */
.guess-result h3 {
  font-size: 1.3rem;
}
.guess-correct { color: var(--green); }
.guess-wrong { color: var(--red); }

/* Result display */
.result-display {
  padding: 16px;
  margin-bottom: 16px;
}
.result-display h3 {
  font-size: 1.5rem;
  margin-bottom: 12px;
}
.result-breakdown {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  max-width: 400px;
  margin: 0 auto 16px;
  font-size: 0.95rem;
}
.result-breakdown .rb-label {
  color: var(--text-dim);
  text-align: right;
}
.result-breakdown .rb-vs { color: var(--text-dim); }
.result-breakdown .rb-value { text-align: left; font-weight: 700; }

.hit-result {
  font-size: 2rem;
  font-weight: 900;
  text-transform: uppercase;
  margin: 12px 0;
  letter-spacing: 2px;
}
.hit-out { color: var(--red); }
.hit-single { color: var(--blue); }
.hit-double { color: var(--green); }
.hit-triple { color: var(--accent-gold); }
.hit-home_run { color: var(--accent-gold); text-shadow: 0 0 20px rgba(245, 197, 24, 0.5); }
.hit-replay { color: var(--text-dim); }

/* Pitcher switch button */
.btn-switch {
  padding: 8px 18px;
  border: 2px solid #e67e22;
  border-radius: 8px;
  background: rgba(230, 126, 34, 0.15);
  color: #e67e22;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-switch:hover { background: rgba(230, 126, 34, 0.3); }

.runs-scored {
  font-size: 1.2rem;
  color: var(--green);
  font-weight: 700;
}

/* Game over */
.game-over-display h2 {
  font-size: 2.5rem;
  color: var(--accent-gold);
  margin-bottom: 8px;
}
.game-over-display .final-score {
  font-size: 1.5rem;
  margin-bottom: 16px;
}
.game-over-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
}

/* At-bat log */
#at-bat-log {
  background: var(--bg-light);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}
#at-bat-log h4 {
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.log-entry {
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.log-entry:nth-child(odd) { background: rgba(255,255,255,0.03); }
.log-entry .log-batter { font-weight: 600; min-width: 140px; }
.log-entry .log-detail { color: var(--text-dim); }
.log-entry .log-result { font-weight: 700; min-width: 80px; text-align: right; }

/* Half-over display */
#half-over-display h3 { font-size: 1.5rem; margin-bottom: 8px; }
#half-over-display p { font-size: 1.1rem; color: var(--text-dim); }

/* Manager bar */
#manager-bar {
  background: var(--bg-light);
  border-radius: 8px;
  padding: 8px 16px;
  margin-bottom: 12px;
}
.manager-info {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.85rem;
}
.mgr-label { color: var(--text-dim); }
.mgr-label strong { color: var(--text); }
.mgr-note {
  color: #e67e22;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 4px 0;
}
.manager-notes { margin-bottom: 8px; }

/* Manager chips in draft */
.manager-chip .mgr-ability {
  font-size: 0.7rem;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.manager-pool { max-height: 180px; }

/* Season screen */
#season-header {
  text-align: center;
  background: var(--bg-light);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
#season-header h2 {
  color: var(--accent-gold);
  margin-bottom: 8px;
}
#season-content .setup-panel {
  margin-bottom: 16px;
}
#season-log {
  background: var(--bg-light);
  border-radius: 12px;
  padding: 16px;
}

/* Responsive */
@media (max-width: 768px) {
  .setup-grid { grid-template-columns: 1fr; }
  #matchup { flex-direction: column; gap: 8px; }
  .guess-buttons, .pitch-buttons { flex-direction: column; align-items: center; }
  .score-row { font-size: 1rem; }
  .sb-score { font-size: 2rem; }
}

/* Animations */
@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.pop-in { animation: popIn 0.3s ease-out; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.shake { animation: shake 0.4s ease-in-out; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.pulse { animation: pulse 0.5s ease-in-out; }
