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

:root {
  --gold: #FFD700;
  --gold-dark: #B8860B;
  --purple: #6B2D8B;
  --purple-light: #9B4DCA;
  --green: #2E8B57;
  --green-light: #3CB371;
  --bg-dark: #1a1a2e;
  --bg-card: #252542;
  --bg-card-hover: #2d2d4a;
  --text: #f0f0f0;
  --text-muted: #a0a0b0;
  --border: #3a3a5a;
}

body {
  font-family: 'Inter', 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

/* Navigation */
nav {
  background: rgba(0, 0, 0, 0.4);
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

nav .nav-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

nav .logo {
  color: var(--gold);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 1.5rem;
}

nav ul a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

nav ul a:hover {
  color: var(--gold);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

header {
  text-align: center;
  padding: 20px 0 16px;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 12px;
}

@media (max-width: 600px) {
  .controls {
    max-width: none;
    width: 100%;
    padding: 0 12px;
    gap: 4px;
  }
  
  .filter-row {
    min-width: 0;
  }
  
  select {
    padding: 6px 4px;
    font-size: 0.8rem;
    min-width: 0;
    text-overflow: ellipsis;
  }
}

.filter-row {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-row label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

select {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  min-width: 0;
}

select:focus {
  outline: none;
  border-color: var(--gold);
}

.stats-bar {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

/* Game Grid - 3 columns desktop, 1 column mobile */
.game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* Ad Slot - spans full width between ticket rows */
.ad-slot {
  grid-column: 1 / -1;
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-placeholder {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

@media (max-width: 900px) {
  .game-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .game-grid {
    grid-template-columns: 1fr;
  }
}

/* Game Card */
.game-card {
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border);
}

.game-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.game-card.expanded {
  border-color: var(--gold);
}

/* Card Header - Name and Number */
.card-header {
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-light) 100%);
}

.card-title {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  margin-bottom: 2px;
}

.card-number {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* Ticket Image - Wide Rectangle */
.ticket-image-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-dark);
}

.ticket-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top; /* Show from top down so ticket title is visible */
  transition: transform 0.3s ease;
}

.game-card:hover .ticket-image {
  transform: scale(1.05);
}

.ticket-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-card) 100%);
}

/* Price and EV Row */
.card-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

.price-badge {
  background: var(--purple);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 1rem;
}

.ev-display {
  text-align: right;
}

.ev-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ev-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--green-light);
}

.ev-value.high {
  color: var(--gold);
}

.ev-value.low {
  color: var(--text-muted);
}

/* Expand Indicator */
.expand-hint {
  text-align: center;
  padding: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.expand-hint .arrow {
  display: inline-block;
  transition: transform 0.2s;
}

.game-card.expanded .expand-hint .arrow {
  transform: rotate(180deg);
}

/* Expanded Details */
.card-details {
  display: none;
  padding: 14px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.game-card.expanded .card-details {
  display: block;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  color: var(--text-muted);
}

.detail-value {
  font-weight: 600;
}

/* Prize Table */
.prize-table {
  margin-top: 14px;
}

.prize-table-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.prize-table-header h4 {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
  padding: 0;
  line-height: 1;
}

.remaining-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
}

.prize-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 0.85rem;
}

.prize-amount {
  color: var(--gold);
  font-weight: 600;
}

.prize-remaining {
  color: var(--text-muted);
}

.prize-remaining.depleted {
  color: #ff6b6b;
}

.prize-remaining.low {
  color: #ffa500;
}

.prize-row.free-ticket {
  background: rgba(255, 215, 0, 0.1);
  margin: 0 -14px;
  padding: 5px 14px;
}

.prize-row.free-ticket .prize-amount::after {
  content: ' (Free Ticket)';
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: normal;
}

/* Top pick highlight */
.game-card.top-pick {
  border-color: var(--gold);
}

.game-card.top-pick .card-header {
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 100%);
  color: #000;
}

.game-card.top-pick .card-header .card-number {
  color: rgba(0, 0, 0, 0.7);
}

/* Footer */
footer {
  background: rgba(0, 0, 0, 0.4);
  border-top: 1px solid var(--border);
  padding: 2rem 1rem;
  margin-top: 3rem;
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

footer .disclaimer {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1rem;
}

footer .footer-links {
  font-size: 0.85rem;
  color: #71717a;
  margin-bottom: 0.5rem;
}

footer .footer-links a {
  color: #a1a1aa;
  text-decoration: none;
}

footer .footer-links a:hover {
  color: var(--gold);
}

footer .data-source {
  font-size: 0.75rem;
  color: #52525b;
  margin-top: 0.5rem;
}

/* Loading state */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}

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

/* Search Box */
.search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 12px;
}

.search-row label {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.search-row input {
  flex: 1;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
}

.search-row input:focus {
  outline: none;
  border-color: var(--gold);
}

.search-row input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

/* No Results */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.no-results p {
  font-size: 1.1rem;
}
