/* Design layer loaded after slate.css and custom.css; overrides the Bootswatch look while keeping Bootstrap's grid and JS hooks. */

:root {
  --bg: #16181c;
  --surface: #1f2228;
  --surface-2: #272b33;
  --surface-3: #30353e;
  --border: #30353e;
  --border-strong: #3c424d;
  --text: #e8e9eb;
  --muted: #8d939e;
  --accent: #76d6ff;
  --accent-soft: rgba(118, 214, 255, 0.12);
  --accent-line: rgba(118, 214, 255, 0.45);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, 0.12);
  --win: #4cd68a;
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html { scroll-padding-top: 72px; }

body {
  padding-top: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem !important;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-shadow: none;
}

h1 { font-size: clamp(30px, 4.5vw, 44px); }
h2 { font-size: clamp(24px, 3.5vw, 34px); }
h4 { font-size: 18px; }

a { color: var(--accent); }
a:hover { color: #a8e6ff; }

.lead { color: var(--muted); font-size: 17px; }
.text-success { color: var(--win) !important; }
.text-danger { color: var(--danger) !important; }

.page { min-height: 60vh; padding-bottom: 24px; }

/* ---------- navbar ---------- */

.navbar.site-nav {
  background: rgba(22, 24, 28, 0.88) !important;
  background-image: none !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  padding-top: 10px;
  padding-bottom: 10px;
}

.site-nav .navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
  text-shadow: none;
}

.site-nav .navbar-brand-logo { width: 28px; height: 28px; margin: 0; }

.site-nav .nav-link {
  color: var(--muted) !important;
  font-weight: 500;
  padding: 8px 12px !important;
  border-radius: var(--radius-sm);
  text-shadow: none;
  border: 0;
}

.site-nav .nav-link:hover,
.site-nav .show > .nav-link {
  color: var(--text) !important;
  background: var(--surface-2);
}

.site-nav .navbar-nav { gap: 2px; }
.site-nav .navbar-toggler { border-color: var(--border); }

.dropdown-menu {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  padding: 6px;
  max-height: 70vh;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}

/* Multi-column menus are Bootstrap rows; their negative margins would overflow the menu. */
.dropdown-menu .row { margin: 0; }
.dropdown-menu .row > ul { margin: 0; padding: 0 2px; }

.dropdown-item {
  color: var(--text);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 15px;
}

.dropdown-item:hover, .dropdown-item:focus {
  background: var(--surface-2);
  color: var(--text);
}

.teams-menu { width: 480px; max-width: 100%; }

@media (max-width: 991.98px) {
  .teams-menu { width: auto; }
  .site-nav .dropdown-menu { box-shadow: none; max-width: 100%; }
}

/* ---------- page headers and notices ---------- */

.landing-header, .season-header, .league-standings-header-text,
.golly-simulator-header, .postseason-series-header h2 {
  margin-top: 40px;
}

.landing-header h2, h2.landing-header { margin-bottom: 8px; }
.landing-header h4 { color: var(--muted); font-weight: 500; }
.landing-header p { color: var(--muted); }

.notify-header h4.text-success,
.loading-message h4 {
  color: var(--muted) !important;
  font-weight: 500;
  font-size: 16px;
  margin-top: 32px;
}

.notify-header h2.text-danger { margin-top: 48px; }
.notify-body p { color: var(--muted); max-width: 560px; margin: 0 auto; }

/* ---------- surfaces ---------- */

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

.card.bg-primary { background-color: var(--surface) !important; }

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  color: var(--text) !important;
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 16px;
}

.card-header:first-child { border-radius: var(--radius) var(--radius) 0 0; }

div.card-body { font-weight: 400; }

.list-group-item {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.list-group-item:first-child { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
.list-group-item:last-child { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.list-group-flush .list-group-item { border-radius: 0; background: transparent; }

/* ---------- buttons ---------- */

.btn {
  background-image: none !important;
  text-shadow: none !important;
  box-shadow: none !important;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-success, .btn-sim {
  background: var(--accent-soft) !important;
  border: 1px solid var(--accent-line) !important;
  color: var(--accent) !important;
}

.btn-success:hover, .btn-sim:hover,
.btn-success:focus, .btn-sim:focus {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #0d1a22 !important;
}

.btn-danger {
  background: var(--danger-soft) !important;
  border: 1px solid rgba(255, 107, 107, 0.5) !important;
  color: var(--danger) !important;
}

.btn-danger:hover { background: var(--danger) !important; color: #1a0d0d !important; }

.btn-secondary, .btn-default, .btn-ghost, .btn-primary {
  background: var(--surface-2) !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--text) !important;
}

.btn-secondary:hover, .btn-default:hover, .btn-ghost:hover, .btn-primary:hover {
  background: var(--surface-3) !important;
}

/* Simulator controls: text stays white; hover only lightens; Run turns solid red while running. */
#container-golly-controls .btn:focus { outline: none; }
#container-golly-controls .btn:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }

#container-golly-controls .btn,
#container-golly-controls .btn:focus {
  background: var(--surface-2) !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--text) !important;
}

#container-golly-controls .btn:hover { background: var(--surface-3) !important; }

#container-golly-controls .btn-danger,
#container-golly-controls .btn-danger:focus {
  background: #c94747 !important;
  border-color: #c94747 !important;
}

#container-golly-controls .btn-danger:hover { background: #d95757 !important; }

/* ---------- badges ---------- */

.badge {
  border-radius: 6px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 4px 8px;
}

.badge-primary { background: var(--surface-3); color: var(--text); }
.badge-success { background: rgba(76, 214, 138, 0.16); color: var(--win); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--accent-soft); color: var(--accent); }
.badge-warning { background: rgba(255, 182, 39, 0.14); color: #ffb627; }
.badge.bg-success, .badge.bg-danger, .badge.bg-secondary { color: #fff !important; }

/* ---------- tables ---------- */

.table { color: var(--text); margin-bottom: 0; }

.table th, .table td,
.table thead th, .table td {
  border-color: var(--border);
  border-top-color: var(--border);
  vertical-align: middle;
}

.table thead th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-strong);
}

.table td { font-variant-numeric: tabular-nums; }
.table-striped tbody tr:nth-of-type(odd) { background-color: rgba(255, 255, 255, 0.025); }
.table-hover tbody tr:hover { background-color: var(--surface-2); color: var(--text); }

/* ---------- pagination (season day jump) ---------- */

.pagination { flex-wrap: wrap; gap: 4px; justify-content: center; }

.page-link {
  background: var(--surface);
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  min-width: 38px;
  text-align: center;
}

.page-link:hover { background: var(--surface-2); color: var(--accent); }
.page-item.active .page-link { background: var(--accent); color: #0d1a22; }
.season-number-button { width: auto; }

/* ---------- league columns ---------- */

div.league-container, div#ws-league-container { margin-top: 24px; }

.league-container-header {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.league-container-header:has(> span:empty) { display: none; }

/* ---------- game cards ---------- */

.game-card {
  margin-bottom: 14px;
  transition: border-color 0.15s, transform 0.15s;
}

.game-card:hover { border-color: var(--border-strong); }
.game-card .card-body { padding: 14px 16px; }

.game-card-description {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
}

.game-card-team {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  min-width: 0;
}

.team-swatch {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  color: var(--muted);
  background: currentColor;
}

.game-card-lost .team-swatch {
  background: transparent;
  border: 2px solid currentColor;
}

.game-card-team-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 16px;
}

.game-card-record {
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  margin-left: 2px;
}

.game-card-score {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.game-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

.game-card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 2px;
}

.game-card-map .map-name { color: var(--text); }
.game-card-actions { margin-top: 12px; }
.game-card-actions .btn { width: 100%; }

.game-winner { font-weight: 700; }
.game-loser { font-weight: 400; opacity: 0.7; }

/* ---------- seed tables ---------- */

div.seed-table-header { margin-top: 56px; }
.seed-table h4 { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; margin: 16px 0 12px; }
.seed-table .list-group { margin-bottom: 16px; }
.seed-table-team-name { font-weight: 600; }

.seed-number {
  font-family: var(--mono);
  font-size: 13px;
  min-width: 28px;
  border-radius: 6px;
}

/* ---------- champion / countdown / minilife ---------- */

h3.champion-header { font-size: clamp(22px, 3vw, 30px); margin-top: 8px; }
#champion-icon-container .team-icon { width: 120px; height: 120px; margin: 24px auto 8px; }

.flipdown-clock { padding: 24px 0 48px; }

/* 510px and 312px are the countdown's own digit widths on wide and phone screens. */
.flipdown { margin-left: auto; margin-right: auto; }

@media (max-width: 650px) {
  .flipdown { width: 510px !important; }
}

@media (max-width: 550px) {
  .flipdown { width: 312px !important; }
}

.minilife { margin-top: 24px; }
.minilife-title { color: var(--text); font-size: 20px; margin: 0 0 12px; }
.minilife .btn { margin-right: 4px; }

.minilife-stats {
  display: flex;
  gap: 20px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 14px;
}

.minilife-stats b { color: var(--text); font-family: var(--mono); }

.minilife #canvas {
  border: 1px solid var(--border);
  background: var(--surface);
}

/* ---------- season page ---------- */

.season-day-header h2 {
  font-size: 22px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* ---------- standings ---------- */

.league-standings-league-header-text { margin-top: 40px; margin-bottom: 20px; }
.league-standings-division-header-text { font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

/* ---------- maps ---------- */

#row-maps { row-gap: 8px; }
.map-card-container { display: flex; }

.map-card {
  max-width: none;
  width: 100%;
  margin-bottom: 20px;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}

.map-card:hover { border-color: var(--accent-line); transform: translateY(-2px); }

/* Map images have a black background; lighten swaps it for the simulator's gray. */
.map-card-figure { border-bottom: 1px solid var(--border); background: #24262a; isolation: isolate; }

.map-card-image { display: block; width: 100%; height: auto; image-rendering: pixelated; mix-blend-mode: lighten; }
.map-card-body { padding: 14px 16px 4px; }
.map-card-header { font-size: 17px; margin: 0 0 6px; }
.map-card-header .badge { margin-right: 4px; }
.map-card-description-text { color: var(--muted); font-size: 14px; margin-top: 8px; }
.map-card .badge.invisible { display: none; }
.map-card-simulate { padding: 0 16px 16px; margin-bottom: 0; }
.map-card-simulate .btn { width: 100%; }

/* ---------- simulator ---------- */

.golly-simulator-header { color: var(--text) !important; margin-bottom: 24px; }
#container-golly-header .row { margin-left: 0; margin-right: 0; }

.scoreboard-panel { font-size: 17px; }
table.scoreboard-panel-table thead th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.scoreboard-table-column-score, #livecells1, #livecells2 { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.form-control, .custom-select {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
}

/* ---------- footer ---------- */

.site-footer {
  margin-top: 96px;
  border-top: 1px solid var(--border);
}

.site-footer-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 16px 48px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.site-footer-inner p { margin: 6px 0; }

.site-footer-cups {
  display: inline-block;
  margin-bottom: 16px;
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.site-footer-cups:hover { border-color: var(--accent-line); color: var(--accent); text-decoration: none; }

.statcounter { display: none; }

@media (prefers-reduced-motion: reduce) {
  .game-card, .map-card, .btn { transition: none; }
  .map-card:hover { transform: none; }
}
