* { box-sizing: border-box; }
body { font-family: system-ui, sans-serif; margin: 0; padding: 1rem; max-width: 1400px; margin-left: auto; margin-right: auto; }

.nav { display: flex; gap: 1rem; margin-bottom: 1.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid #ddd; align-items: center; }
.nav a { color: #2563eb; text-decoration: none; font-weight: 500; }
.nav a:hover { text-decoration: underline; }
.nav a.router-link-active, .nav a.active { color: #1d4ed8; font-weight: 600; }
.nav-user { margin-left: auto; color: #6b7280; font-size: 0.9rem; }
.nav-logout { margin-left: 0.5rem; padding: 0.25rem 0.5rem; font-size: 0.85rem; cursor: pointer; border: 1px solid #ccc; background: #fff; border-radius: 4px; }
.nav-logout:hover { background: #f5f5f5; }

.content { min-height: 200px; }

.controls { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; margin-bottom: 1rem; }
.control { display: flex; flex-direction: column; gap: 0.25rem; }
.control label { font-size: 0.85rem; color: #555; }
select { padding: 0.5rem; min-width: 160px; }

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(520px, 1fr));
  gap: 1.5rem;
}

.game-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.game-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.game-card-title-block {
  flex: 1;
  min-width: 0;
}

.game-title {
  margin: 0 0 0.35rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #111827;
}

.game-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: #6b7280;
}

.meta-time { font-weight: 600; color: #374151; }
.meta-league { font-weight: 500; }
.meta-traded { color: #4b5563; }

.status-badge {
  flex-shrink: 0;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 6px;
}

.status-badge.pre-play { background: #dbeafe; color: #1d4ed8; }
.status-badge.in-play { background: #fef3c7; color: #b45309; }
.status-badge.closed { background: #e5e7eb; color: #4b5563; }

.game-card-runners {
  display: flex;
  flex-direction: column;
}

.runner-row {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e5e7eb;
}

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

.runner-info {
  flex: 0 0 140px;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.runner-name {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: #111827;
}

.runner-odds {
  display: flex;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.odds-back { color: #2563eb; }
.odds-lay { color: #dc2626; }

.runner-stats-vertical {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.7rem;
  color: #6b7280;
}

.stats-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  align-items: baseline;
}

.stats-label {
  font-weight: 600;
  color: #374151;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  min-width: 20px;
}

.stats-value {
  white-space: nowrap;
}

.stats-pct {
  color: #9ca3af;
}

.stats-range {
  color: #9ca3af;
  font-size: 0.65rem;
}

.stats-ipp {
  font-weight: 600;
  color: #059669;
}

.runner-chart {
  flex: 1;
  min-width: 200px;
}

.chart-placeholder {
  height: 120px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #6b7280;
  font-size: 0.85rem;
}

.chart-placeholder-full {
  grid-column: 1 / -1;
  height: 120px;
  min-height: 120px;
}

.games-table { width: 100%; border-collapse: collapse; }
.games-table th, .games-table td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid #ddd; vertical-align: top; }
.games-table th { background: #f0f0f0; font-weight: 600; }
.game-row.in-play { background: rgba(255, 200, 0, 0.08); }
.focused-view { margin-top: 1rem; padding: 1rem; border: 1px solid #ddd; border-radius: 8px; background: #fafafa; }
.focused-cell { vertical-align: top; padding: 1rem; }

.chart-small { position: relative; height: 120px; min-width: 200px; }
.chart-large { position: relative; height: 350px; }

.market-info { font-size: 0.9rem; }
.market-info strong { display: block; margin-bottom: 0.25rem; }
.market-meta { color: #666; font-size: 0.85rem; }

.btn { padding: 0.4rem 0.75rem; cursor: pointer; border: 1px solid #ccc; background: #fff; border-radius: 4px; font-size: 0.9rem; }
.btn:hover { background: #f5f5f5; }
.btn-focus { padding: 0.25rem 0.5rem; font-size: 0.85rem; }
.btn-back { margin-bottom: 1rem; }

.loading { color: #666; font-style: italic; }
.error { color: #c00; }

.status { font-size: 0.85rem; }
.status.connected { color: #16a34a; }
.status.disconnected { color: #dc2626; }

/* Login styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.login-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.login-card h1 {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    color: #111827;
}

.login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
}

.form-group input {
    padding: 0.6rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.15s;
}

.form-group input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 0.7rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
}

.btn-primary:disabled {
    background: #93c5fd;
    cursor: not-allowed;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.25rem 0;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.login-divider span {
    color: #9ca3af;
    font-size: 0.85rem;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    background: #fff;
    border: 1px solid #d1d5db;
    padding: 0.65rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: #374151;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-google:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #9ca3af;
}

.btn-google:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
}

.google-icon {
    flex-shrink: 0;
}
