:root {
  --bg: #111214;
  --surface: #1b1f24;
  --surface-2: #252a30;
  --text: #f7f7f7;
  --muted: #c2c8d0;
  --border: #39414b;
  --primary: #ef233c;
  --primary-2: #b5001a;
  --accent: #f5f5f5;
  --ok: #057a55;
  --warn: #b45309;
  --danger: #b91c1c;
  --shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 15% 10%, rgba(181, 0, 26, 0.2), transparent 30%),
    radial-gradient(circle at 85% 0%, rgba(0, 0, 0, 0.25), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
  min-height: 100vh;
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem;
}

.topbar {
  background: linear-gradient(135deg, #111, #2d0309 45%, #b5001a);
  color: #fff;
  border-radius: 14px;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  box-shadow: var(--shadow);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}

.topbar h1 {
  margin: 0.2rem 0 0;
  font-size: 1.35rem;
}

.top-actions {
  display: flex;
  gap: 0.5rem;
}

.tab-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Schedule styles */
.sched-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.sched-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.sched-item.next-game {
  border: 2px solid var(--primary);
  background: linear-gradient(135deg, rgba(181,0,26,0.05), transparent);
}

.sched-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sched-date {
  font-size: 0.8rem;
  color: var(--muted);
}

.sched-matchup {
  font-weight: 700;
  font-size: 0.95rem;
}

.sched-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  width: fit-content;
}

.sched-badge.regular { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.sched-badge.seeding { background: #fef3c7; color: #92400e; }
.sched-badge.playoffs { background: #dbeafe; color: #1e40af; }
.sched-badge.championship { background: #fde68a; color: #78350f; font-weight: 800; }

.sched-result {
  font-weight: 800;
  font-size: 1rem;
  white-space: nowrap;
}

.sched-result.win { color: var(--ok); }
.sched-result.loss { color: var(--danger); }
.sched-result.tie { color: var(--warn); }

.sched-countdown {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--primary);
  white-space: nowrap;
}

.next-game-hero {
  text-align: center;
  padding: 1rem 0;
}

.next-game-hero h3 {
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.next-matchup {
  font-size: 1.3rem;
  font-weight: 800;
  margin: 0.5rem 0 0.25rem;
}

.next-date {
  color: var(--muted);
  margin: 0;
}

.next-countdown {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0.5rem 0 0;
}

.tab-nav a {
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: center;
  padding: 0.75rem 0.5rem;
  font-weight: 700;
  min-height: 46px;
}

.tab-nav a.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

#app {
  margin-top: 0.85rem;
  display: grid;
  gap: 0.75rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

.card::after {
  content: '';
  position: absolute;
  bottom: -15px;
  right: -15px;
  width: 120px;
  height: 120px;
  background: url('../icons/falcon-logo.png') no-repeat center / contain;
  opacity: 0.04;
  pointer-events: none;
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 0.75rem;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.btn {
  border: 0;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
}

.btn:hover {
  background: var(--primary-2);
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.warn {
  background: var(--warn);
}

.btn.danger {
  background: var(--danger);
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  min-height: 42px;
  padding: 0.5rem 0.6rem;
  font: inherit;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  min-width: 1200px;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  border: 1px solid var(--border);
  text-align: center;
  padding: 0.4rem;
  font-size: 0.82rem;
}

th {
  background: #121212;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 1;
}

thead th.group {
  background: var(--primary);
}

td.sticky-col,
th.sticky-col {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 2;
}

th.sticky-col {
  background: #121212;
  color: #fff;
}

.stat-input {
  width: 72px;
  min-height: 38px;
  text-align: center;
  padding: 0.3rem;
}

.quarter-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
}

.quarter-tab {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  min-height: 46px;
  padding: 0.55rem 0.6rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.quarter-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.quarter-summary-card .kpi p {
  font-size: 1.2rem;
}

.kpi {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.8rem;
}

.kpi h3,
.kpi p {
  margin: 0;
}

.kpi p {
  margin-top: 0.25rem;
  font-size: 1.3rem;
  font-weight: 800;
}

.sparkline {
  width: 100%;
  height: 70px;
  display: block;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(181, 0, 26, 0.12), transparent);
}

.list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
}

.list li {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
}

.recap-text {
  line-height: 1.45;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 0.7rem;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.4rem;
}

.score-grid .box {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 0.6rem;
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 1rem;
  background: #111;
  color: #fff;
  padding: 0.65rem 0.95rem;
  border-radius: 999px;
  font-size: 0.88rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.toast.show {
  opacity: 1;
}

dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}

.pin-form {
  min-width: 280px;
  display: grid;
  gap: 0.8rem;
}

.pin-form h2 {
  margin: 0;
}

.pin-form menu {
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.pill {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.75rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

@media (max-width: 760px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .tab-nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .score-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .quarter-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-input {
    width: 60px;
  }
}
