/* Interactive web UI for ADSFR cash prizes — mobile-first, brandable. */
:root {
  --fc-blue: #002850;
  --fc-blue-2: #003c78;
  --fc-blue-3: #0078a9;
  --fc-cyan: #17a2c9;
  --ink: #0b1b2b;
  --muted: #5b7186;
  --line: #cdd9e6;
  --bg: #f3f6f9;
  --card: #ffffff;
  --gold: #e0a213;
  --shadow: 0 2px 4px rgba(15, 40, 80, 0.10), 0 10px 26px rgba(15, 40, 80, 0.12);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Open Sans', -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: linear-gradient(170deg, #eaf1f8 0%, #dde7f1 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* --- Top bar ------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--fc-blue);
  color: #fff;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px;
}
.topbar img { height: 40px; }
.topbar .title { flex: 1; min-width: 0; }
.topbar h1 { font-size: 18px; font-weight: 800; margin: 0; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { font-size: 12px; color: #9fc4de; letter-spacing: 0.12em; text-transform: uppercase; }
.live {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 800; letter-spacing: 0.14em;
  background: rgba(224, 38, 38, 0.9); padding: 5px 11px; border-radius: 999px;
}
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 1.6s ease infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.3 } }

/* --- Summary strip ------------------------------------------------------- */
.summary {
  display: flex; gap: 12px; flex-wrap: wrap;
  padding: 16px 20px 4px;
  max-width: 1120px; margin: 0 auto;
}
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  border-top: 3px solid var(--fc-blue-3);
  padding: 12px 16px; box-shadow: var(--shadow); flex: 1; min-width: 150px;
}
.stat .n { font-size: 26px; font-weight: 800; color: var(--fc-blue); font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 2px; }

/* --- Controls ------------------------------------------------------------ */
.controls {
  max-width: 1120px; margin: 12px auto 0; padding: 0 20px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.search {
  position: relative;
  flex: 1; min-width: 180px;
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 9px 13px;
}
.search input { border: none; outline: none; font: inherit; width: 100%; background: transparent; }

/* Type-ahead category suggestions */
.search-suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 40, 80, 0.22);
  overflow: hidden auto; max-height: 340px;
}
.ac-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  padding: 11px 14px; border: none; border-bottom: 1px solid #eef2f6; background: var(--card);
  font: inherit; text-align: left; cursor: pointer;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item.active { background: #eef4f9; }
.ac-name { font-weight: 700; font-size: 14px; color: var(--ink); }
.ac-meta { font-size: 12px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.ac-empty { padding: 12px 14px; color: var(--muted); font-style: italic; font-size: 13px; }
.sortsel { border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; background: var(--card); font: inherit; color: var(--ink); }

/* Per-card "Show who's entered" button — pinned to the bottom of the card so
   it lines up across cards regardless of how many places pay out. */
.show-entered {
  display: flex; align-items: center; gap: 8px; width: calc(100% - 32px);
  margin: auto 16px 14px; padding: 9px 12px;
  background: #eef4f9; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 13px; font-weight: 700; color: var(--fc-blue-2);
  cursor: pointer; transition: background .12s ease, border-color .12s ease;
}
.show-entered:hover { background: #e2edf6; border-color: var(--fc-blue-3); }
.show-entered .se-ico { font-size: 14px; }
.show-entered .se-count {
  margin-left: auto; font-size: 12px; font-weight: 800; color: #fff;
  background: var(--fc-blue-3); border-radius: 999px; padding: 1px 8px;
  font-variant-numeric: tabular-nums;
}

/* "Who's entered" modal popup */
body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(11, 27, 43, 0.55); backdrop-filter: blur(2px);
}
.modal {
  display: flex; flex-direction: column;
  width: 100%; max-width: 640px; max-height: 85vh;
  background: var(--card); border-radius: 16px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 40, 80, 0.4);
}
.modal-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 18px; background: linear-gradient(135deg, var(--fc-blue) 0%, var(--fc-blue-2) 100%);
  color: #fff;
}
.modal-head-text { flex: 1; min-width: 0; }
.modal-title { font-size: 18px; font-weight: 800; line-height: 1.2; }
.modal-sub { font-size: 13px; color: #b9d4ea; margin-top: 2px; }
.modal-close {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 8px;
  border: none; background: rgba(255,255,255,0.15); color: #fff;
  font-size: 22px; line-height: 1; cursor: pointer;
}
.modal-close:hover { background: rgba(255,255,255,0.28); }
.modal-search {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.modal-search input { flex: 1; border: none; outline: none; font: inherit; background: transparent; }
.modal-body { padding: 12px 16px 16px; overflow-y: auto; }
.em-count { font-size: 12px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.em-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.em-team {
  display: flex; align-items: center; gap: 8px;
  background: #f5f9fd; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
}
.em-num {
  flex-shrink: 0; min-width: 26px; text-align: center;
  font-size: 12px; font-weight: 800; color: #fff; background: var(--fc-blue-3);
  border-radius: 999px; padding: 2px 7px; font-variant-numeric: tabular-nums;
}
.em-num-none { background: #c7d2dd; color: #566; }
.em-name {
  font-size: 14px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.em-empty { padding: 24px 8px; text-align: center; color: var(--muted); font-style: italic; }

/* --- Category selector (wrapping grid — all categories visible) --------- */
.rail-wrap { max-width: 1120px; margin: 12px auto 0; padding: 0 20px; }
.rail-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin: 0 2px 8px;
}
.rail {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px;
}
.chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 12px; padding: 10px 14px; cursor: pointer; text-align: left; width: 100%;
  box-shadow: 0 1px 2px rgba(15, 40, 80, 0.06);
  font: inherit; transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
.chip:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--fc-blue-3); }
.chip .cname { font-weight: 700; font-size: 14px; line-height: 1.2; }
.chip .cmeta { font-size: 11px; color: var(--muted); }
.chip.hot .cmeta { color: var(--gold); font-weight: 700; }
/* Selected category: solid FC-blue fill — unmistakable. */
.chip.active {
  background: var(--fc-blue); border-color: var(--fc-blue); color: #fff;
  box-shadow: 0 4px 12px rgba(0, 40, 80, 0.28);
}
.chip.active .cmeta { color: #cfe4f2; }
.chip.active.hot .cmeta { color: #ffd775; }

/* --- Mobile category dropdown (multi-select) ---------------------------- */
.cat-mobile { display: none; max-width: 1120px; margin: 12px auto 0; padding: 0 20px; }
.catdd { position: relative; }
.catdd-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 40, 80, 0.06);
}
.catdd-btn .catdd-chev { color: var(--fc-blue-3); font-size: 14px; transition: transform .15s ease; }
.catdd.open .catdd-btn { border-color: var(--fc-blue-3); }
.catdd.open .catdd-chev { transform: rotate(180deg); }
.catdd-panel {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 40, 80, 0.22); overflow: hidden;
}
.catdd-actions {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: #f5f9fd;
}
.catdd-actions button {
  border: 1px solid var(--line); background: var(--card); color: var(--fc-blue-2);
  border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.catdd-actions .dd-done { margin-left: auto; background: var(--fc-blue); border-color: var(--fc-blue); color: #fff; }
.catdd-list { max-height: 320px; overflow-y: auto; }
.dd-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 14px; border-bottom: 1px solid #eef2f6; cursor: pointer; text-align: left;
}
.dd-item:last-child { border-bottom: none; }
.dd-item input { width: 18px; height: 18px; accent-color: var(--fc-blue-3); flex-shrink: 0; }
.dd-item .dd-name { font-weight: 700; font-size: 14px; color: var(--ink); }
.dd-item .dd-meta { font-size: 11px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.dd-item.hot .dd-meta { color: var(--gold); font-weight: 700; }
.dd-item.on { background: #f5f9fd; }

/* --- Multi-category stacked sections ------------------------------------- */
.cat-section { margin-top: 18px; }
.cat-section:first-child { margin-top: 6px; }
.cat-section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 0 2px 10px; padding-bottom: 8px; border-bottom: 2px solid var(--line);
}
.cat-section-head h3 { margin: 0; font-size: 20px; color: var(--fc-blue); }
.cat-section-pot { font-size: 16px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }

/* --- Category detail ----------------------------------------------------- */
.detail { max-width: 1120px; margin: 8px auto 40px; padding: 0 20px; }
.detail-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 18px 2px 12px; }
.detail-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.detail-head h2 { margin: 0; font-size: 28px; color: var(--fc-blue); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--fc-blue);
  font-size: 26px; line-height: 1; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 2px rgba(15, 40, 80, 0.08); transition: background .12s ease, transform .12s ease;
}
.stepper:hover { background: #eef4f9; transform: translateY(-1px); }
.stepper:active { transform: translateY(0); }
.detail-head .catpot { text-align: right; }
.detail-head .catpot .n { font-size: 24px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.detail-head .catpot .l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

/* Projection slider */
.projector {
  background: linear-gradient(180deg, #eef5fb, #e6eff8);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 18px; margin-bottom: 18px;
}
.projector .prow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.projector label { font-weight: 700; color: var(--fc-blue-2); font-size: 14px; }
.projector input[type=range] { flex: 1; min-width: 160px; accent-color: var(--fc-blue-3); }
.projector .pval {
  font-variant-numeric: tabular-nums; font-weight: 800; color: var(--fc-blue);
  min-width: 108px; text-align: right;
}
.projector .phint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* Bracket cards */
.brackets { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.bracket {
  background: var(--card); border: 1px solid rgba(0, 40, 80, 0.14); border-radius: 16px;
  box-shadow: 0 2px 4px rgba(0, 40, 80, 0.08), 0 14px 30px rgba(0, 40, 80, 0.14);
  overflow: hidden; display: flex; flex-direction: column;
}
.bracket-top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--fc-blue) 0%, var(--fc-blue-2) 100%);
}
.bracket-entry { font-size: 25px; font-weight: 800; color: #fff; }
.bracket-entry small { font-size: 12px; font-weight: 600; color: rgba(255, 255, 255, 0.7); }
.bracket-boats { font-size: 13px; color: rgba(255, 255, 255, 0.75); font-weight: 600; text-align: right; }
.bracket-boats b { color: #fff; font-size: 16px; }
.bracket-boats small { color: rgba(255, 255, 255, 0.6); }
.places { padding: 6px 16px 14px; display: flex; flex-direction: column; }
.pl {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-top: 1px solid #f1f5f9;
}
.pl:first-child { border-top: none; }
.pl .badge {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #0b1220;
}
.pl.r1 .badge { background: linear-gradient(135deg, #fde68a, #e0a213); }
.pl.r2 .badge { background: linear-gradient(135deg, #e2e8f0, #94a3b8); }
.pl.r3 .badge { background: linear-gradient(135deg, #fdba74, #c2410c); }
.pl .place-name { flex: 1; color: var(--muted); font-weight: 600; font-size: 13px; }
.pl .amt { font-weight: 800; font-variant-numeric: tabular-nums; }
.pl.r1 .amt { font-size: 20px; color: var(--fc-blue); }
.pl.r2 .amt { font-size: 17px; color: var(--fc-blue-2); }
.pl.r3 .amt { font-size: 15px; color: var(--fc-blue-3); }
.pl.projected .amt::after { content: ' ▲'; color: var(--gold); font-size: 11px; }
.empty-bracket { padding: 14px 16px; color: #94a3b8; font-style: italic; font-size: 13px; }

/* --- States -------------------------------------------------------------- */
.state { text-align: center; padding: 60px 20px; color: var(--muted); }
.state h2 { color: var(--fc-blue); }
[hidden] { display: none !important; }

/* --- Mobile ---------------------------------------------------------------- */
@media (max-width: 640px) {
  html, body { overflow-x: hidden; }
  .summary, .controls, .rail-wrap, .detail { padding-left: 14px; padding-right: 14px; }

  /* One bracket per row — full-width, easy to read on a phone. */
  .brackets { grid-template-columns: 1fr; gap: 12px; }
  /* Swap the category grid for the compact multi-select dropdown. */
  .rail-wrap { display: none; }
  .cat-mobile { display: block; }

  /* Stats: three compact tiles across the top. */
  .summary { gap: 8px; }
  .stat { min-width: 0; flex: 1 1 0; padding: 10px 12px; }
  .stat .n { font-size: 18px; }
  .stat .l { font-size: 10px; letter-spacing: 0.04em; }

  /* Controls stack: search full width, sort + toggle share the next row. */
  .controls { gap: 8px; }
  .search { flex: 1 1 100%; }
  .sortsel { flex: 1 1 auto; }
  .toggle { flex: 0 0 auto; margin-left: auto; }

  .detail-head { flex-wrap: wrap; gap: 8px; }
  .detail-head h2 { font-size: 22px; }
  .detail-title { flex: 1 1 100%; }
  .detail-head .catpot { text-align: left; }
}

@media (max-width: 380px) {
  .stat .n { font-size: 16px; }
  .toggle-label { display: none; } /* keep just the switch when space is tight */
}
