/* HCSS house style */
:root {
  --darkblue: #1a3761;
  --gold: #dbad50;
  --darkgray: #a9abb8;
  --lightgray: #efefef;
  --lightblue: #82a0bc;
  --green: #a4a58d;
  --red: #c48469;
  --yellow: #d79c5a;
  --white: #ffffff;
  --text: #21304a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Neue Haas Grotesk", "Neue Haas Grotesk Text Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--lightgray);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---------- header ---------- */
.topbar {
  background: var(--darkblue);
  color: var(--white);
  border-bottom: 4px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.brand { display: flex; align-items: center; gap: 13px; }
.logo {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
.logo img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 7px;
}
.logo .ball {
  position: absolute;
  right: -9px;
  bottom: -6px;
  font-size: 15px;
  line-height: 1;
  animation: juggle 3s ease-in-out infinite;
}
@keyframes juggle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  30%      { transform: translateY(-9px) rotate(150deg); }
  55%      { transform: translateY(0) rotate(280deg); }
  72%      { transform: translateY(-4px) rotate(330deg); }
  88%      { transform: translateY(0) rotate(360deg); }
}
.topbar .accent { color: var(--gold); }
.topright { display: flex; align-items: center; gap: 14px; }
.userbox { font-size: 0.9rem; display: flex; align-items: center; gap: 10px; }
.langbtn {
  background: none;
  border: 1.5px solid var(--lightblue);
  border-radius: 6px;
  color: var(--white);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  cursor: pointer;
}
.langbtn:hover { border-color: var(--gold); color: var(--gold); }
.linklike {
  background: none;
  border: none;
  color: var(--lightblue);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  text-decoration: underline;
  padding: 0;
}

/* ---------- layout ---------- */
.container { max-width: 860px; margin: 0 auto; padding: 16px 12px 90px; }
.footer {
  max-width: 860px;
  margin: 0 auto;
  padding: 18px 16px 28px;
  color: var(--darkgray);
  font-size: 0.78rem;
  text-align: center;
}
h2 { color: var(--darkblue); margin: 8px 0 4px; }
.muted { color: var(--darkgray); }

/* ---------- name picker ---------- */
.name-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.name-grid button {
  background: var(--white);
  border: 2px solid var(--darkblue);
  border-radius: 10px;
  color: var(--darkblue);
  font: inherit;
  font-weight: 600;
  padding: 16px 8px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.name-grid button:hover {
  background: var(--darkblue);
  color: var(--gold);
}

.register {
  display: flex;
  gap: 8px;
  margin-top: 22px;
}
.register input {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 11px 14px;
  border: 2px solid var(--lightblue);
  border-radius: 8px;
  color: var(--text);
  background: var(--white);
}
.register input:focus { outline: none; border-color: var(--gold); }
.register-error { color: var(--red); font-size: 0.88rem; }

/* ---------- tabs ---------- */
.tabs {
  background: var(--darkblue);
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 0 8px;
  position: sticky;
  top: 57px;
  z-index: 15;
}
.tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--lightblue);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 12px 14px 9px;
  cursor: pointer;
}
.tab.active {
  color: var(--white);
  border-bottom-color: var(--gold);
}

/* ---------- match cards ---------- */
.daycard {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(26, 55, 97, 0.10);
  margin: 16px 0;
  overflow: hidden;
}
.daycard > h3 {
  background: var(--darkblue);
  color: var(--white);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0;
  padding: 9px 14px;
}
.matchrow {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--lightgray);
}
.matchrow:last-child { border-bottom: none; }
.matchrow.tbd { opacity: 0.55; }
.matchrow.dirty { background: #fdf6e7; }

.team {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 0.92rem;
}
.team.home { justify-content: flex-end; text-align: right; }
.team.away { justify-content: flex-start; }
.team img { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; }
.team span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 96px;
}
.scoreinputs { display: flex; align-items: center; gap: 5px; }
.scoreinputs input {
  width: 42px;
  height: 38px;
  text-align: center;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  border: 2px solid var(--lightblue);
  border-radius: 8px;
  color: var(--darkblue);
  background: var(--white);
}
.scoreinputs input:focus { outline: none; border-color: var(--gold); }
.scoreinputs input:disabled {
  background: var(--lightgray);
  border-color: var(--darkgray);
  color: var(--darkgray);
}
.scoreinputs .dash { color: var(--darkgray); font-weight: 700; }

.result { font-size: 1.05rem; font-weight: 700; color: var(--darkblue); }
.kickoff { font-size: 0.72rem; color: var(--darkgray); }
.meta { font-size: 0.7rem; color: var(--lightblue); font-weight: 600; }

/* badges */
.badge {
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 20px;
  padding: 2px 9px;
  color: var(--white);
  letter-spacing: 0.03em;
}
.badge.pts-exact { background: var(--gold); }
.badge.pts-toto  { background: var(--green); }
.badge.pts-miss  { background: var(--red); }
.badge.live      { background: var(--yellow); animation: pulse 1.4s infinite; }
.badge.nopred    { background: var(--darkgray); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }

.mypred { font-size: 0.72rem; color: var(--darkgray); }

/* ---------- expandable everyone's picks ---------- */
.matchrow.expandable { cursor: pointer; }
.allpicks {
  grid-column: 1 / -1;
  background: var(--lightgray);
  border-radius: 8px;
  margin-top: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
}
.allpicks div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
}

/* ---------- SITREP briefing ---------- */
.sitrep {
  background: var(--white);
  border-left: 5px solid var(--gold);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(26, 55, 97, 0.10);
  padding: 12px 16px;
  margin: 16px 0 4px;
}
.sitrep-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.sitrep-title {
  color: var(--darkblue);
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sitrep-stamp {
  color: var(--red);
  border: 1.5px solid var(--red);
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 2px 7px;
  transform: rotate(-2deg);
  white-space: nowrap;
}
.sitrep p {
  margin: 4px 0;
  font-size: 0.86rem;
  color: var(--text);
}

/* ---------- analyst titles ---------- */
.analyst-title {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--lightblue);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}
.analyst-title.top { color: var(--gold); }
.analyst-title.bottom { color: var(--red); }

/* ---------- tooltips ---------- */
.tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font-size: 0.62rem;
  font-weight: 800;
  cursor: help;
  position: relative;
  vertical-align: middle;
  text-transform: none;
  letter-spacing: 0;
}
.tip::after {
  content: attr(data-tip);
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: -10px;
  width: 215px;
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--darkgray);
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(26, 55, 97, 0.22);
  padding: 8px 10px;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  text-align: left;
  white-space: normal;
  z-index: 50;
}
.tip:hover::after, .tip:focus::after, .tip.open::after { display: block; }

/* ---------- leaderboard ---------- */
/* border-collapse: separate (not collapse) so the tooltip bubble is not
   clipped and the rounded corners can live on the cells themselves */
.lb-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--white); border-radius: 12px; box-shadow: 0 1px 4px rgba(26,55,97,0.10); }
.lb-table thead th:first-child { border-top-left-radius: 12px; }
.lb-table thead th:last-child { border-top-right-radius: 12px; }
.lb-table tbody tr:last-child td:first-child { border-bottom-left-radius: 12px; }
.lb-table tbody tr:last-child td:last-child { border-bottom-right-radius: 12px; }
.lb-table tbody tr:last-child td { border-bottom: none; }
.lb-table th {
  background: var(--darkblue);
  color: var(--white);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 10px;
  text-align: left;
}
.lb-table th.num, .lb-table td.num { text-align: center; }
.lb-table td { padding: 11px 10px; border-bottom: 1px solid var(--lightgray); font-size: 0.92rem; }
.lb-table tbody tr { cursor: pointer; }
.lb-table tbody tr:hover td { background: #f7f4ec; }
.lb-table .rank { color: var(--darkgray); font-weight: 700; width: 30px; }
.lb-table tr.first td { background: #fbf3df; }
.lb-table tr.first .rank { color: var(--gold); }
.lb-table td.pts { font-weight: 800; color: var(--darkblue); }

.lb-detail td { background: var(--lightgray); font-size: 0.82rem; }
.lb-detail-list div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
}
.lb-detail-list .m { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- save bar ---------- */
.savebar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--darkblue);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 8px rgba(0,0,0,0.18);
  z-index: 30;
}
#save-status { color: var(--lightblue); font-size: 0.85rem; }
#save-status.ok { color: var(--gold); }
#save-status.err { color: var(--red); }
.btn-gold {
  background: var(--gold);
  border: none;
  border-radius: 8px;
  color: var(--darkblue);
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 10px 26px;
  cursor: pointer;
}
.btn-gold:disabled { background: var(--darkgray); cursor: default; }

@media (max-width: 480px) {
  .team span { font-size: 0.8rem; }
  .scoreinputs input { width: 38px; height: 36px; }
  .topbar h1 { font-size: 1.02rem; }
  .logo { width: 34px; height: 34px; }
  .logo .ball { font-size: 13px; right: -8px; bottom: -5px; }
  .brand { gap: 10px; }
  .tabs { gap: 0; }
  .tab { font-size: 0.8rem; padding: 12px 9px 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .logo .ball, .badge.live { animation: none; }
}

/* ---------- AI tab ---------- */
.ai-pred-score {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--darkblue);
  opacity: 0.75;
}
.ai-no-pred {
  font-size: 0.7rem;
}
.analyst-title.ai-label { color: var(--lightblue); }
.lb-table tr.ai-row td { background: #f4f7fb; color: var(--darkblue); opacity: 0.85; }
.lb-table tr.ai-row:hover td { background: #eaf0f8; }

/* ---------- scoring page ---------- */
.scoring-body { padding: 14px 16px 20px; }
.scoring-intro { margin: 0 0 14px; font-size: 0.88rem; }

.scoring-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-bottom: 20px;
}
.scoring-table th {
  background: var(--darkblue);
  color: var(--white);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 10px;
  text-align: left;
}
.scoring-table th.num,
.scoring-table td.num { text-align: center; }
.scoring-table td { padding: 8px 10px; border-bottom: 1px solid var(--lightgray); }
.scoring-table tbody tr:last-child td { border-bottom: none; }
.scoring-table tbody tr:hover td { background: #f7f4ec; }
.sc-mult { color: var(--lightblue); font-weight: 700; }
.sc-toto { color: var(--green); font-weight: 700; }
.sc-exact { color: var(--gold); font-weight: 800; }

.scoring-notes { display: flex; flex-direction: column; gap: 10px; }
.scoring-note {
  background: var(--lightgray);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
}
.scoring-note-title {
  font-weight: 700;
  color: var(--darkblue);
  margin-bottom: 3px;
}
.scoring-note-body { color: var(--text); line-height: 1.5; }

/* ---------- scoring examples ---------- */
.ex-section { margin: 20px 0 6px; }
.ex-section-title {
  font-weight: 700;
  color: var(--darkblue);
  font-size: 0.88rem;
  margin-bottom: 10px;
}
.ex-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 540px) { .ex-grid { grid-template-columns: 1fr; } }
.ex-block { background: var(--lightgray); border-radius: 8px; overflow: hidden; }
.ex-header {
  background: var(--darkblue);
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 7px 10px;
}
.ex-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.ex-table th {
  background: rgba(26,55,97,0.07);
  color: var(--darkblue);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 5px 8px;
  text-align: left;
}
.ex-table th.num, .ex-table td.num { text-align: center; }
.ex-table td { padding: 5px 8px; border-bottom: 1px solid rgba(0,0,0,0.05); }
.ex-table tbody tr:last-child td { border-bottom: none; }
.ex-pts { font-weight: 800; }
.ex-pts.ex-exact { color: var(--gold); }
.ex-pts.ex-toto  { color: var(--green); }
.ex-pts.ex-miss  { color: var(--red); }
.ex-why { color: var(--darkgray); font-size: 0.78rem; }

/* ---------- score chart ---------- */
.chart-card h3 { background: var(--darkblue); color: var(--white); font-size: 0.85rem;
  font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; margin: 0; padding: 9px 14px; }
.chart-wrap { padding: 10px 4px 4px; overflow-x: auto; }
.score-chart { display: block; width: 100%; max-width: 560px; margin: 0 auto; }

/* ---------- Human vs AI tab ---------- */
.hvai-totals {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 16px;
}
.hvai-score { text-align: center; }
.hvai-score-label {
  font-size: 0.72rem;
  color: var(--darkgray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.hvai-score-val {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--darkblue);
  line-height: 1.1;
}
.hvai-vs { font-size: 1rem; color: var(--darkgray); font-weight: 700; }
.hvai-day-stats {
  display: flex;
  justify-content: space-around;
  padding: 6px 14px;
  background: var(--lightgray);
  font-size: 0.83rem;
  color: var(--text);
  border-top: 1px solid rgba(0,0,0,0.06);
}
.hvai-day-stats.hvai-ai-leads { border-left: 3px solid var(--lightblue); }
.hvai-day-stats.hvai-human-leads { border-left: 3px solid var(--gold); }
.hvai-commentary {
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.55;
  border-bottom: 1px solid var(--lightgray);
  font-style: italic;
  background: #fafbfd;
}
.hvai-day-subhead {
  padding: 6px 14px;
  font-size: 0.75rem;
  color: var(--lightblue);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(26, 55, 97, 0.04);
  border-bottom: 1px solid var(--lightgray);
}

/* ---------- AI reasoning ---------- */
.ai-expand-hint {
  font-size: 0.65rem;
  color: var(--lightblue);
  letter-spacing: 0.04em;
  margin-top: 3px;
  cursor: pointer;
}
.ai-reasoning {
  background: #f4f7fb;
  border-left: 3px solid var(--lightblue);
  border-radius: 0 0 8px 8px;
  padding: 12px 16px 10px;
  font-size: 0.83rem;
  line-height: 1.6;
  color: var(--text);
}
.ai-reasoning p { margin: 0 0 8px; }
.ai-reasoning p:last-of-type { margin-bottom: 0; }
.ai-joke {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--white);
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--darkblue);
  font-style: italic;
  border: 1px solid var(--lightgray);
}
