/* ============================================================
   UFC Stats -- Match Report
   Design tokens
   ============================================================ */

:root {
  /* surfaces -- aligned with resource/style5.css "Arena Terminal" theme,
     which main.inc.php loads on every page */
  --bg: #080b10;
  --surface: #101620;
  --surface-2: #141b27;
  --surface-3: #1a2230;
  --line: rgba(255, 255, 255, 0.08);
  --line-soft: rgba(255, 255, 255, 0.05);

  /* text */
  --text: #e9eef5;
  --text-dim: #8593a8;
  --text-faint: #5a6678;

  /* team colors */
  --red: #ff5151;
  --red-soft: rgba(255, 81, 81, 0.14);
  --red-line: rgba(255, 81, 81, 0.35);
  --blue: #5b8cff;
  --blue-soft: rgba(91, 140, 255, 0.14);
  --blue-line: rgba(91, 140, 255, 0.35);

  /* accents */
  --gold: #ffb627;
  --cyan: #27e3d4;
  --green: #43d17a;

  /* type -- matches style5.css's @import (Chakra Petch / Barlow / JetBrains Mono) */
  --font-display: "Chakra Petch", "Segoe UI", sans-serif;
  --font-body: "Barlow", "Segoe UI", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", monospace;

  --radius: 10px;
  --radius-sm: 6px;

  --nav-h: 60px;
  --subnav-h: 48px;
}

/* ============================================================
   Reset & base
   ============================================================ */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + var(--subnav-h) + 12px);
  -webkit-text-size-adjust: 100%;
  background-color: var(--bg);
  background-image:
    radial-gradient(720px 380px at 80% -6%, rgba(255, 182, 39, 0.10), transparent 70%),
    radial-gradient(620px 360px at 6% 2%, rgba(39, 227, 212, 0.08), transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: auto, auto, 46px 46px, 46px 46px;
  background-attachment: fixed;
  min-height: 100%;
}

body {
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

img {
  display: block;
  max-width: 100%;
}

/* ============================================================
   Site title + pill nav (matches existing site chrome)
   ============================================================ */

.site-title {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 36px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0 0 24px rgba(255, 182, 39, 0.35);
  margin: 8px 0 22px;
}

.site-title .accent {
  color: var(--gold);
}

.sitenav {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 8px 24px rgba(0, 0, 0, 0.4);
  padding: 14px 20px;
  text-align: center;
  margin-bottom: 24px;
}

.sitenav-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.sitenav-row + .sitenav-row {
  margin-top: 10px;
}

.sitenav-row a {
  display: inline-block;
  padding: 6px 12px;
  margin: 2px;
  border-radius: 7px;
  transition: color 0.15s ease, background 0.15s ease, text-shadow 0.15s ease;
}

.sitenav-row a:hover {
  color: var(--gold);
  background: rgba(255, 182, 39, 0.12);
  text-shadow: 0 0 12px rgba(255, 182, 39, 0.45);
}

.sitenav-row a.is-active {
  color: var(--gold);
  background: rgba(255, 182, 39, 0.12);
}

.sitenav-sep {
  color: var(--text-faint);
}

/* ============================================================
   Top navigation
   ============================================================ */

.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.06em;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--red) 0%, var(--red) 49%, var(--blue) 51%, var(--blue) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--bg);
}

.brand-sub {
  color: var(--text-faint);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-left: 2px;
}

.nav-links {
  display: flex;
  gap: 28px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-dim);
}

.nav-links a {
  transition: color 0.15s ease;
}

.nav-links a:hover,
.nav-links a.is-active {
  color: var(--text);
}

.nav-links a.is-active {
  color: var(--gold);
}

/* ============================================================
   Layout shell
   ============================================================ */

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

.section {
  margin-top: 56px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section-head .section-note {
  font-size: 12.5px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

/* ============================================================
   Hero / match header
   ============================================================ */

.hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}

.hero-map {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-map-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--surface-3);
  color: var(--text-dim);
  border: 1px solid var(--line);
}

.pill-gold {
  background: rgba(255, 182, 39, 0.12);
  border-color: rgba(255, 182, 39, 0.35);
  color: var(--gold);
}

.hero-meta {
  display: flex;
  gap: 22px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-dim);
}

.hero-meta dt {
  color: var(--text-faint);
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  margin-bottom: 3px;
}

.hero-meta dd {
  color: var(--text);
}

/* scoreline */

.scoreline {
  padding: 32px 24px 26px;
}

.scoreline-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}

.score-side {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.score-side.is-blue {
  align-items: flex-end;
  text-align: right;
}

.team-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.score-side.is-red .team-name { color: var(--red); }
.score-side.is-blue .team-name { color: var(--blue); }

.team-score {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 64px;
  line-height: 1;
  letter-spacing: 0.02em;
}

.score-vs {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 0.18em;
  padding-top: 18px;
}

/* frag bar -- the signature tug-of-war meter */

.fragbar {
  margin-top: 20px;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  display: flex;
  border: 1px solid var(--line);
}

.fragbar-fill {
  height: 100%;
}

.fragbar-fill.is-red {
  background: linear-gradient(90deg, #c0303f, var(--red));
  width: 0%;
  transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.fragbar-fill.is-blue {
  background: linear-gradient(90deg, var(--blue), #1c7fd6);
  width: 0%;
  transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
  margin-left: auto;
}

.fragbar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
}

.hero-mutators {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 24px 22px;
  border-top: 1px solid var(--line);
}

.mutator-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px 9px;
}

/* ============================================================
   Sticky sub navigation (section tabs)
   ============================================================ */

.subnav {
  position: sticky;
  top: var(--nav-h);
  z-index: 40;
  display: flex;
  gap: 4px;
  margin-top: 22px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.subnav a {
  flex: 1;
  text-align: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: background 0.15s ease, color 0.15s ease;
}

.subnav a:hover {
  color: var(--text);
}

.subnav a.is-active {
  background: var(--surface-3);
  color: var(--text);
}

/* ============================================================
   Roster cards
   ============================================================ */

.roster-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.roster-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.roster-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 14px;
}

.roster-card.is-red .roster-head {
  background: var(--red-soft);
  color: var(--red);
  border-bottom: 1px solid var(--red-line);
}

.roster-card.is-blue .roster-head {
  background: var(--blue-soft);
  color: var(--blue);
  border-bottom: 1px solid var(--blue-line);
}

.roster-head .roster-score {
  font-size: 18px;
}

.roster-table-wrap {
  overflow-x: auto;
}

.roster-table {
  min-width: 760px;
}

.roster-table th,
.roster-table td {
  padding: 10px 12px;
  font-size: 12.5px;
  text-align: right;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.roster-table th {
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--surface-2);
}

.roster-table th:first-child,
.roster-table td:first-child {
  text-align: left;
}

.roster-table tbody tr:last-child td {
  border-bottom: none;
}

.roster-table tbody tr:hover {
  background: var(--surface-2);
}

.player-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body);
  font-weight: 600;
  position: relative;
  padding-right: 44px;
}

.player-name,
.player-name-link {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-name-link {
  color: var(--text);
  transition: color 0.15s ease;
}

.player-name-link:hover {
  color: var(--gold);
  text-decoration: underline;
}

.player-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  color: var(--bg);
  flex: none;
}

.roster-card.is-red .player-avatar { background: var(--red); }
.roster-card.is-blue .player-avatar { background: var(--blue); }

.mvp-badge {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 700;
  color: var(--gold);
  border: 1px solid rgba(255, 182, 39, 0.4);
  background: rgba(255, 182, 39, 0.1);
  border-radius: 4px;
  padding: 1px 5px;
  letter-spacing: 0.08em;
  font-family: var(--font-display);
}

.roster-foot td {
  font-weight: 700;
  color: var(--text);
  background: var(--surface-2);
  border-top: 1px solid var(--line);
}

/* ============================================================
   Player weapons table
   ============================================================ */

.pw-table {
  font-family: var(--font-mono);
  font-size: 11.5px;
  min-width: 640px;
}

.pw-table th,
.pw-table td {
  padding: 8px 10px;
  text-align: center;
  border: 1px solid var(--line-soft);
}

.pw-table thead th {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--surface-2);
  white-space: nowrap;
}

.pw-table thead th:first-child {
  text-align: left;
}

.pw-table tbody th {
  text-align: left;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  background: var(--surface-2);
  color: var(--text);
  white-space: nowrap;
  border-left: 3px solid transparent;
}

.pw-table tr.is-red th {
  border-left-color: var(--red);
}

.pw-table tr.is-blue th {
  border-left-color: var(--blue);
}

.pw-table td.pw-empty {
  color: var(--text-faint);
}

.pw-table .pw-kills {
  color: var(--text-faint);
  margin-right: 6px;
}

.pw-table .pw-dmg {
  color: var(--text);
  font-weight: 700;
}

/* ============================================================
   Damage matrix
   ============================================================ */

.matrix-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  overflow-x: auto;
}

.matrix-table {
  font-family: var(--font-mono);
  font-size: 11.5px;
  min-width: 640px;
}

.matrix-table th,
.matrix-table td {
  padding: 8px 10px;
  text-align: center;
  border: 1px solid var(--line-soft);
}

.matrix-table thead th {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--surface-2);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  height: 90px;
  white-space: nowrap;
}

.matrix-table thead th:first-child {
  writing-mode: horizontal-tb;
  transform: none;
  height: auto;
}

.matrix-table tbody th {
  text-align: left;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  background: var(--surface-2);
  color: var(--text);
  white-space: nowrap;
}

.matrix-table td.self {
  background: var(--surface-3);
  color: var(--text-faint);
}

.matrix-table td {
  color: var(--text);
}

.matrix-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}

.matrix-legend-scale {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--surface-3), var(--gold));
  max-width: 220px;
}

/* ============================================================
   Awards
   ============================================================ */

.awards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.award-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.award-title {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
}

.award-player {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 4px;
}

.award-value {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.award-note {
  font-size: 12px;
  color: var(--text-faint);
}

/* ============================================================
   Homepage: stat grid + last match card
   ============================================================ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 6px;
}

.last-match-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.last-match-card .award-title {
  margin-bottom: 0;
}

.last-match-info {
  text-align: right;
}

.last-match-map {
  font-weight: 700;
  font-size: 16px;
}

.last-match-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.title-msg {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--gold);
  margin: 22px 0;
}

.welcome-text {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 22px;
  color: var(--text-dim);
  line-height: 1.7;
}

/* ============================================================
   Footer
   ============================================================ */

.footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.footer a {
  color: var(--text-dim);
}

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

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 860px) {
  .nav-links {
    display: none;
  }

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

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

  .scoreline-row {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .score-side.is-blue {
    align-items: center;
    text-align: center;
  }

  .score-vs {
    padding-top: 0;
  }

  .hero-meta {
    flex-wrap: wrap;
    gap: 16px;
  }

  .weapon-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .weapon-side {
    text-align: left !important;
  }

  .subnav {
    overflow-x: auto;
  }

  .subnav a {
    flex: none;
  }
}

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

  .team-score {
    font-size: 48px;
  }

  .page {
    padding: 20px 14px 60px;
  }
}

/* ============================================================
   Reduced motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .fragbar-fill {
    transition: none;
  }
}
