/* Denver Christian athletic brand colors (DCS brand guide) — royal blue, grey, black, white. */
:root {
  --brand: #0062af;      /* royal blue, PMS 2133 */
  --brand-2: #00438c;    /* dark blue, PMS 7687 (gradients / hover) */
  --black: #000000;      /* PMS Black */
  --grey: #a1abb2;       /* PMS 429 */
  --grey-dark: #72808a;  /* PMS 430 */
  --grey-light: #d8dcdb; /* PMS 427 */
  --accent: var(--grey);
  --live: #d62f2f;       /* functional: live games only */
  --win: var(--brand);

  --bg: #f3f4f4;
  --surface: #ffffff;
  --ink: #0b0b0b;
  --muted: var(--grey-dark);
  --line: var(--grey-light);
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 1px 3px rgba(0, 0, 0, .08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 1.35rem; font-weight: 700; margin-top: 1.6em; }
h3.sub { font-size: 1.05rem; margin-top: 1.6em; }
h4 { font-size: 1rem; }
button, input, select, textarea { font: inherit; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 460px; padding-top: 40px; }
.row { display: flex; align-items: center; gap: 16px; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.strong { font-weight: 600; }
.center { text-align: center; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 4px 0; }
.state { padding: 60px 16px; text-align: center; color: var(--muted); }
.state.error { color: var(--live); }
main { min-height: 70vh; padding-bottom: 60px; }

/* Header / footer */
.site-head { background: var(--black); color: #fff; border-bottom: 3px solid var(--brand); }
.site-head .row { height: 64px; }
.site-head a { color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 40px; width: auto; display: block; }
.mark { background: var(--brand); color: #fff; border-radius: 8px; padding: 2px 7px; font-weight: 800; letter-spacing: .02em; }
.nav { opacity: .85; font-size: .95rem; }
.site-foot { background: var(--black); padding: 20px 0; color: var(--grey); font-size: .9rem; }
.site-foot a { color: var(--grey-light); }

/* Hero */
.hero { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; padding: 48px 0 40px; margin-bottom: 8px; }
.hero.slim { padding: 32px 0 28px; }
.hero a { color: #fff; opacity: .85; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 600; opacity: .8; margin: 0 0 8px; }
.lede { font-size: 1.05rem; opacity: .9; margin: 0; max-width: 680px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 20px; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 1.6rem; font-weight: 800; }
.hero-stats span { font-size: .8rem; opacity: .8; }
.year-nav { display: flex; gap: 16px; margin-top: 12px; font-weight: 600; }
.champ-banner {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 18px;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2); border-radius: var(--radius); padding: 12px 18px;
}
.champ-banner strong { font-size: 1.2rem; }
.champ-banner .muted { color: rgba(255, 255, 255, .8); }
.trophy { font-size: 1.8rem; }

/* Event logos */
.hero-row { display: flex; align-items: center; gap: 24px; }
.hero-main { flex: 1; min-width: 0; }
.event-logo { width: 150px; height: 150px; object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .35)); }
.card-logo { width: 72px; height: 72px; object-fit: contain; align-self: flex-start; }
@media (max-width: 640px) {
  .hero-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .event-logo { width: 110px; height: 110px; }
}

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.t-card { display: flex; flex-direction: column; gap: 6px; color: var(--ink); margin: 0; transition: transform .1s, box-shadow .1s; border-top: 4px solid var(--brand); }
.t-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(16, 24, 40, .1); }
.card-kicker { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.card-title { font-size: 1.2rem; font-weight: 700; }
.card-stats { display: flex; gap: 24px; margin: 6px 0; }
.card-stats div { display: flex; flex-direction: column; }
.card-stats strong { font-size: 1.3rem; }
.card-stats span { font-size: .78rem; color: var(--muted); }
.card-foot { border-top: 1px solid var(--line); padding-top: 8px; font-size: .9rem; color: var(--muted); }
.card-foot strong { color: var(--ink); }

/* Live */
.live-dot { display: inline-flex; align-items: center; gap: 5px; background: var(--live); color: #fff; font-size: .7rem; font-weight: 700; letter-spacing: .06em; padding: 2px 7px; border-radius: 999px; vertical-align: middle; }
.live-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.4s infinite; }
.live-dot.sm { font-size: .62rem; padding: 1px 6px; }
@keyframes pulse { 50% { opacity: .3; } }
.live-banner { margin: 20px 0; display: flex; flex-direction: column; gap: 8px; }
.live-link { background: #fff2f2; border: 1px solid #f3c4c4; border-radius: var(--radius); padding: 12px 16px; color: var(--ink); font-weight: 600; }

/* Tabs / segmented */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 20px 0 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--black); border-color: var(--brand); }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--grey-light); border-radius: 10px; padding: 3px; margin-bottom: 16px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.data th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #fafbfc; font-weight: 600; }
table.data tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data.compact th, table.data.compact td { padding: 6px 8px; }

/* Leaders */
.leader-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.leader-card { margin: 0; }
.leader-title { font-weight: 700; margin-bottom: 8px; color: var(--brand); }
.leader-list { list-style: none; margin: 0; padding: 0; }
.leader-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.leader-list li:last-child { border-bottom: 0; }
.leader-list li:first-child .val { color: var(--brand); }
.rank { width: 22px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9rem; }
.who { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.val { font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td, tr.clickable.open td { background: #f2f6fb; }
.caret { color: var(--brand); display: inline-block; width: 12px; }
tr.detail-row > td { background: #f8fafc; padding: 6px 12px 12px 34px; }
table.data.inner { width: auto; min-width: 320px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
table.data.records { table-layout: fixed; min-width: 620px; }
.records th:first-child { width: 17%; }
.records td { vertical-align: top; white-space: normal; overflow-wrap: anywhere; }
.rec-who + .rec-who { margin-top: 6px; }
.rec-name { font-weight: 600; }
.rec-val { font-weight: 800; font-size: 1.15rem; color: var(--brand); font-variant-numeric: tabular-nums; }
.award-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

/* Bracket */
.bracket-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 14px; }
.champ-line { margin: 0 0 14px; }
.scroll-x { overflow-x: auto; padding-bottom: 8px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.bracket { display: grid; grid-template-columns: repeat(var(--rounds), minmax(210px, 1fr)); gap: 28px; min-width: min-content; }
.round { display: flex; flex-direction: column; }
.round-title { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.round-slots { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 12px; }
.slot { display: flex; flex-direction: column; justify-content: center; flex: 1; }
.game { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.game[role='button'] { cursor: pointer; }
.game[role='button']:hover { border-color: var(--brand-2); }
.game.live { border-color: var(--live); box-shadow: 0 0 0 2px rgba(214, 47, 47, .15); }
.game.title-game { border-top: 3px solid var(--brand); }
.game.bye { visibility: hidden; min-height: 70px; }
.game-meta { display: flex; justify-content: space-between; gap: 8px; font-size: .7rem; color: var(--muted); padding: 4px 10px; background: #fafbfc; border-bottom: 1px solid var(--line); }
.game-meta > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.game-meta > span:last-child { white-space: nowrap; flex-shrink: 0; }
.team-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; }
.team-row + .team-row { border-top: 1px solid var(--line); }
.team-row .swatch { width: 4px; align-self: stretch; border-radius: 2px; background: var(--line); }
.team-row .seed { width: 16px; font-size: .75rem; color: var(--muted); text-align: right; }
.team-row .tname { flex: 1; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-row .tname a { color: inherit; }
.team-row .tbd { color: var(--muted); font-style: italic; }
.team-row .score { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 24px; text-align: right; }
.team-row.won .tname, .team-row.won .score { font-weight: 800; }
.team-row.won .score { color: var(--win); }
.team-row.lost { opacity: .6; }
/* Mirrored Katte bracket */
.mirror-bracket { display: grid; grid-template-columns: repeat(5, minmax(185px, 1fr)); grid-template-rows: auto repeat(8, minmax(44px, auto)) auto;
  column-gap: 18px; row-gap: 8px; min-width: 1000px; }
.mb-title { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding-bottom: 4px; }
.mb-title.center { text-align: center; }
.mb-title.right { text-align: right; }
.mb-cell { display: flex; flex-direction: column; justify-content: center; }
.mb-cell.corner { margin-top: 18px; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(10, 15, 25, .5); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 20px; width: 100%; max-width: 860px; position: relative; }
.modal .eyebrow { color: var(--muted); opacity: 1; }
.modal-x { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 1.6rem; cursor: pointer; color: var(--muted); }
.box-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-top: 12px; }

/* Buttons + forms */
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.btn:hover:not(:disabled) { border-color: var(--brand-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--brand-2); border-color: var(--brand-2); }
.btn.live { background: var(--live); border-color: var(--live); color: #fff; }
.btn.danger { color: var(--live); border-color: #f0c2c2; }
.btn.ghost { background: none; }
.btn.sm { padding: 4px 10px; font-size: .85rem; }
input, select, textarea { border: 1px solid #cfd4dc; border-radius: 8px; padding: 7px 10px; background: #fff; color: var(--ink); min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-2); outline-offset: -1px; }
input[type='color'] { padding: 2px; width: 44px; height: 34px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.form .wide, .field.wide { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: .8rem; font-weight: 600; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.ok { color: var(--win); font-size: .9rem; font-weight: 600; }
.err { color: var(--live); font-size: .9rem; font-weight: 600; }
.form-table td { white-space: normal; }
.stat-in { width: 64px; padding: 5px 6px; text-align: right; }
.score-in { width: 72px; font-size: 1.2rem; font-weight: 700; text-align: center; }
.danger-zone { margin-top: 28px; padding-top: 16px; border-top: 1px dashed var(--line); display: flex; gap: 12px; align-items: center; }

/* Admin */
.admin-bar { background: #fff; border-bottom: 1px solid var(--line); }
.admin-bar .row { height: 48px; flex-wrap: wrap; }
.admin { padding-top: 12px; }
.list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.list-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; color: var(--ink); }
a.list-row:hover { text-decoration: none; border-color: var(--brand-2); }
.badge { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eef0f4; color: var(--muted); }
.badge.live { background: var(--live); color: #fff; }
.badge.final { background: #e1edf7; color: var(--brand); }
.game-edit { display: flex; flex-direction: column; gap: 10px; }
.game-edit.live { border-color: var(--live); }
.ge-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ge-label { font-weight: 700; width: 220px; }
.ge-score { display: grid; grid-template-columns: 1fr auto auto auto 1fr; gap: 8px; align-items: center; }
.ge-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }

@media (max-width: 640px) {
  .ge-score { grid-template-columns: 1fr auto; }
  .ge-score > span { display: none; }
  .hero { padding: 32px 0 28px; }
}
