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

:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.15);
  --text-primary: #fff;
  --text-secondary: rgba(255, 255, 255, 0.8);
  --accent: #4a9eff;
  --border: rgba(74, 158, 255, 0.3);
  --win-color: #2ecc71;
  --loss-color: #e74c3c;
}

body.light-mode {
  --bg-primary: #f5f7fa;
  --bg-secondary: #e8ecf1;
  --bg-card: rgba(0, 0, 0, 0.05);
  --bg-card-hover: rgba(0, 0, 0, 0.1);
  --text-primary: #2c3e50;
  --text-secondary: #5a6c7d;
  --accent: #3498db;
  --border: rgba(52, 152, 219, 0.3);
  --win-color: #27ae60;
  --loss-color: #c0392b;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  min-height: 100vh;
  padding: 20px;
  color: var(--text-primary);
  transition: background 0.3s ease, color 0.3s ease;
}

header {
  text-align: center;
  margin-bottom: 40px;
}

.header-top {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-bottom: 10px;
}

header h1 {
  font-size: 2.5rem;
}

.header-buttons {
  display: flex;
  gap: 10px;
}

#dark-mode-toggle,
#roast-mode-toggle,
#settings-toggle {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 10px 15px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

#dark-mode-toggle,
#settings-toggle {
  font-size: 1.2rem;
  padding: 10px 15px;
}

#dark-mode-toggle:hover,
#roast-mode-toggle:hover,
#settings-toggle:hover {
  background: var(--bg-card-hover);
  transform: scale(1.05);
}

#roast-mode-toggle.active {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
  border-color: #ff6b6b;
  color: white;
  font-weight: bold;
}

#settings-toggle {
  min-width: 45px;
}

#settings-panel {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-primary);
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
  padding: 30px;
  overflow-y: auto;
  transition: right 0.3s ease;
  z-index: 1000;
}

#settings-panel.visible {
  right: 0;
}

#settings-panel.hidden {
  right: -400px;
}

#close-settings {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--loss-color);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.2s ease;
}

#close-settings:hover {
  background: #c0392b;
  transform: scale(1.1);
}

#settings-panel h2 {
  font-size: 2rem;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--border);
}

.settings-section {
  margin-bottom: 30px;
}

.settings-section h3 {
  font-size: 1.2rem;
  margin-bottom: 15px;
  color: var(--accent);
}

.setting-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: 8px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.setting-item:hover {
  background: var(--bg-card-hover);
}

.setting-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent);
}

.setting-item span {
  font-size: 1rem;
  color: var(--text-primary);
}

header p {
  font-size: 1.1rem;
  opacity: 0.8;
}

.header-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.search-filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
}

#team-search {
  padding: 10px 15px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.95rem;
  width: 250px;
  transition: all 0.2s ease;
}

#team-search:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

#team-search::placeholder {
  color: var(--text-secondary);
}

#division-filter {
  padding: 10px 15px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

#division-filter:focus {
  outline: none;
  border-color: var(--accent);
}

.cache-info {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 0.9rem;
}

#last-updated {
  opacity: 0.7;
  font-style: italic;
}

#refresh-btn {
  background: var(--bg-card);
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

#refresh-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

#refresh-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

main {
  max-width: 1400px;
  margin: 0 auto;
  transition: margin-left 0.3s ease;
}

main.flyout-open {
  margin-left: 500px;
}

#main-container {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 25px;
  margin-bottom: 30px;
}

#teams-section {
  min-width: 0;
  max-width: 100%;
}

#teams-grid {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

#schedule-section {
  position: sticky;
  top: 20px;
  height: fit-content;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 20px;
}

#schedule-section h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: var(--accent);
  border-bottom: 2px solid var(--border);
  padding-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

#headlines-section {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

#headlines-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.headline-item {
  display: block;
  background: var(--bg-card-hover);
  border-radius: 6px;
  padding: 8px 10px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s ease;
  border-left: 2px solid var(--accent);
}

.headline-item:hover {
  background: rgba(74, 158, 255, 0.2);
  transform: translateX(3px);
}

.headline-content h4 {
  font-size: 0.85rem;
  line-height: 1.3;
  color: var(--text-primary);
  font-weight: 500;
}

.no-headlines {
  text-align: center;
  opacity: 0.6;
  padding: 10px;
  font-size: 0.9rem;
}

#live-indicator {
  font-size: 0.75rem;
  color: #e74c3c;
  animation: pulse 2s ease-in-out infinite;
}

#live-indicator.hidden {
  display: none;
}

.bye-week-notice {
  background: rgba(149, 165, 166, 0.15);
  border-left: 3px solid #95a5a6;
  padding: 10px 12px;
  margin-bottom: 15px;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #ecf0f1;
  font-style: italic;
}

#weekly-schedule {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.game-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-card-hover);
  border-radius: 4px;
  font-size: 0.85rem;
  border-left: 2px solid var(--accent);
}

.game-matchup {
  font-weight: 600;
  white-space: nowrap;
  min-width: 0;
}

.game-score {
  font-weight: bold;
  color: var(--win-color);
  min-width: 60px;
  text-align: center;
  white-space: nowrap;
}

.game-score.live {
  color: var(--loss-color);
  animation: pulse 2s ease-in-out infinite;
}

.game-score.final {
  color: var(--win-color);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.game-datetime {
  font-size: 0.75rem;
  opacity: 0.7;
  white-space: nowrap;
}

.no-games {
  text-align: center;
  opacity: 0.6;
  padding: 20px;
}

.bracket-section {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 30px;
}

.bracket-section h2 {
  font-size: 1.8rem;
  margin-bottom: 20px;
  color: var(--accent);
  border-bottom: 2px solid var(--border);
  padding-bottom: 10px;
}

#bracket-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
}

.conference-bracket h3 {
  font-size: 1.3rem;
  margin-bottom: 15px;
  color: var(--accent);
  text-align: center;
}

.bracket-note {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 15px;
  font-style: italic;
}

.bracket-seeds {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bracket-seed {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-card-hover);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.bracket-seed:hover {
  background: rgba(74, 158, 255, 0.2);
  transform: translateX(3px);
}

.seed-number {
  font-weight: bold;
  color: var(--accent);
  min-width: 25px;
  font-size: 1.1rem;
}

.seed-team {
  flex: 1;
  font-weight: 500;
}

.seed-record {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.standings-section {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 30px;
}

.standings-section h2 {
  font-size: 1.8rem;
  margin-bottom: 20px;
  color: var(--accent);
  border-bottom: 2px solid var(--border);
  padding-bottom: 10px;
}

#standings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.conference-standings {
  background: var(--bg-card-hover);
  border-radius: 8px;
  padding: 15px;
}

.conference-standings h3 {
  font-size: 1.2rem;
  margin-bottom: 15px;
  color: var(--accent);
  text-align: center;
}

.standings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.standing-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.standing-item:hover {
  background: var(--bg-card-hover);
  transform: translateX(5px);
}

.standing-item.playoff-spot {
  border-left: 3px solid var(--win-color);
}

.standing-item.division-leader {
  border-left: 3px solid gold;
  font-weight: bold;
}

.standing-rank {
  font-weight: bold;
  color: var(--accent);
  min-width: 25px;
}

.standing-team {
  flex: 1;
  padding: 0 10px;
}

.standing-record {
  font-weight: bold;
  color: var(--text-secondary);
}

.division-section {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 20px;
}

.division-section.hidden {
  display: none;
}

.division-header {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: var(--accent);
  border-bottom: 2px solid var(--border);
  padding-bottom: 10px;
}

.division-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}

.team-card {
  background: var(--bg-card-hover);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.team-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.team-card img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: 15px;
}

.team-card h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.team-card .record {
  font-size: 0.9rem;
  opacity: 0.8;
}

#team-details {
  position: fixed;
  top: 0;
  left: -500px;
  width: 500px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-primary);
  backdrop-filter: blur(10px);
  box-shadow: 5px 0 20px rgba(0, 0, 0, 0.5);
  padding: 30px;
  overflow-y: auto;
  transition: left 0.3s ease;
  z-index: 1000;
}

#team-details.visible {
  left: 0;
}

#team-details.hidden {
  left: -500px;
}

#close-details {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--loss-color);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 10;
  transition: all 0.2s ease;
}

#close-details:hover {
  background: #c0392b;
  transform: scale(1.1);
}

#team-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

#team-logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
}

#team-name {
  font-size: 2rem;
  margin-bottom: 10px;
}

#team-record {
  font-size: 1.2rem;
  opacity: 0.9;
}

#team-details h3 {
  font-size: 1.5rem;
  margin-bottom: 15px;
  margin-top: 30px;
  color: var(--accent);
}

#team-details h3:first-of-type {
  margin-top: 0;
}

.loading, .no-data {
  text-align: center;
  padding: 20px;
  opacity: 0.6;
  font-style: italic;
}

#schedule-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.schedule-item {
  background: var(--bg-card);
  padding: 15px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.schedule-item .week {
  font-weight: bold;
  color: var(--accent);
  min-width: 80px;
}

.schedule-item .opponent {
  flex: 1;
  padding: 0 15px;
}

.schedule-item .result {
  font-weight: bold;
  min-width: 100px;
  text-align: right;
}

.schedule-item .result.win {
  color: var(--win-color);
}

.schedule-item .result.loss {
  color: var(--loss-color);
}

.schedule-item .result.bye {
  color: #95a5a6;
  font-style: italic;
}

@media (max-width: 1600px) {
  /* Make team cards more compact */
  .team-card {
    padding: 12px;
  }
  
  .team-card img {
    width: 60px;
    height: 60px;
    margin-bottom: 10px;
  }
  
  .team-card h3 {
    font-size: 0.85rem;
  }
  
  .team-card .record {
    font-size: 0.8rem;
  }
  
  .division-grid {
    gap: 10px;
  }
  
  .division-section {
    padding: 15px;
  }
  
  /* Narrower flyout on medium screens */
  #team-details {
    width: 400px;
  }
  
  /* Smaller shift on medium screens */
  main.flyout-open {
    margin-left: 400px;
  }
}

@media (max-width: 1024px) {
  #main-container {
    grid-template-columns: 1fr;
  }
  
  #schedule-section {
    position: static;
    max-height: none;
    order: -1;
  }
  
  #bracket-container {
    grid-template-columns: 1fr;
  }
  
  #team-details {
    width: 100vw;
    max-width: 100vw;
    left: -100vw;
  }
  
  #team-details.visible {
    left: 0;
  }
  
  #team-details.hidden {
    left: -100vw;
  }
  
  .division-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  
  #standings-grid {
    grid-template-columns: 1fr;
  }
  
  .search-filter-bar {
    flex-direction: column;
    width: 100%;
  }
  
  #team-search {
    width: 100%;
  }
}

.game-reaction {
  display: inline-block;
  margin-left: 8px;
  font-size: 1.2rem;
  animation: bounce 0.5s ease-in-out;
}

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

.roast-text {
  margin-top: 10px;
  padding: 8px;
  background: rgba(255, 107, 107, 0.15);
  border-left: 3px solid #ff6b6b;
  border-radius: 4px;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.3;
}

.streak-badge {
  font-size: 0.9rem;
  margin-left: 5px;
  display: inline-block;
  animation: pulse-streak 2s ease-in-out infinite;
}

.streak-badge.hot-streak {
  filter: drop-shadow(0 0 3px rgba(255, 100, 0, 0.5));
}

.streak-badge.cold-streak {
  filter: drop-shadow(0 0 3px rgba(100, 150, 255, 0.5));
}

@keyframes pulse-streak {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.prediction {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  cursor: help;
}

.team-meme-section {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

.team-meme {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.team-meme img {
  width: 100%;
  max-width: 400px;
  height: auto;
  border-radius: 8px;
  margin-bottom: 15px;
}

.team-meme p {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.4;
}

.reaction-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.reaction-modal.visible {
  opacity: 1;
}

.reaction-modal-content {
  background: var(--bg-primary);
  border: 2px solid var(--accent);
  border-radius: 16px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  position: relative;
  transform: scale(0.8);
  transition: transform 0.3s ease;
}

.reaction-modal.visible .reaction-modal-content {
  transform: scale(1);
}

.reaction-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--loss-color);
  color: white;
  border: none;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.2s ease;
}

.reaction-modal-close:hover {
  background: #c0392b;
  transform: scale(1.1);
}

.reaction-modal-content h3 {
  font-size: 1.5rem;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.reaction-result {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 20px;
  color: var(--accent);
}

.reaction-modal-content img {
  width: 100%;
  max-width: 400px;
  height: auto;
  border-radius: 12px;
  margin-bottom: 20px;
}

.reaction-text {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

@media (max-width: 768px) {
  .division-header {
    font-size: 1.2rem;
  }
  
  header h1 {
    font-size: 1.5rem;
  }
  
  .header-top {
    flex-direction: column;
    gap: 10px;
  }
  
  .header-buttons {
    flex-direction: row;
    width: 100%;
    justify-content: center;
  }
  
  #roast-mode-toggle {
    font-size: 0.8rem;
    padding: 8px 12px;
  }
  
  #team-header {
    flex-direction: column;
    text-align: center;
  }
  
  .schedule-item {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  
  .schedule-item .week,
  .schedule-item .result {
    min-width: auto;
  }
  
  .reaction-modal-content {
    padding: 20px;
  }
  
  .team-meme img,
  .reaction-modal-content img {
    max-width: 100%;
  }
  
  .roast-text {
    font-size: 0.75rem;
  }
}
