/* Events scorecard. Manrope throughout; --accent is set per page from the event or activity colour. */
:root {
  --bg: #F6F5F2;
  --card: #FFFFFF;
  --ink: #1B1B1F;
  --muted: #5F6368;
  --line: #E4E2DD;
  --soft: color-mix(in srgb, var(--accent) 9%, #FFFFFF);
  --good: #1E7B3A;
  --bad: #B3261E;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 20, 30, .06), 0 4px 14px rgba(20, 20, 30, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px; line-height: 1.5;
}
a { color: var(--accent-ink); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; margin-top: 1.4em; }
p { margin: 0 0 .8em; }
.wrap { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 18px; padding-bottom: 40px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.hint { display: block; color: var(--muted); font-size: .82rem; font-weight: 500; margin-top: 4px; }

/* The family mnemonic, recoloured with the page colour */
.mnemonic {
  display: inline-block; width: 34px; height: 34px; flex: none;
  background: var(--accent);
  -webkit-mask: url('brand/mnemonic.svg') center / contain no-repeat;
  mask: url('brand/mnemonic.svg') center / contain no-repeat;
}
.mnemonic.sm { width: 20px; height: 20px; }
.mnemonic.xl { width: 64px; height: 64px; display: block; margin: 0 auto 12px; }

/* Top bar */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; min-width: 0; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav > a, .menu > summary { padding: 8px 10px; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .95rem; cursor: pointer; }
.topnav > a:hover, .menu > summary:hover { background: var(--soft); }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: ' ▾'; font-size: .8em; color: var(--muted); }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); min-width: 190px; padding: 6px; z-index: 20; }
.menu-pop a { display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 600; }
.menu-pop a:hover { background: var(--soft); }

/* Hero band in the page colour */
.hero { background: var(--soft); border-bottom: 4px solid var(--accent); }
.hero-in { display: flex; align-items: center; gap: 16px; padding-top: 20px; padding-bottom: 20px; flex-wrap: wrap; }
.hero h1 { margin: 0; color: var(--accent-ink); }
.hero-text { flex: 1 1 260px; min-width: 0; }
.hero-sub { margin: 4px 0 0; color: var(--muted); font-weight: 500; }
.kicker { font-size: .85rem; font-weight: 700; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kicker a { color: var(--accent-ink); }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.event-logo { width: 64px; height: 64px; flex: none; object-fit: contain; display: inline-block; }
.event-logo.tinted, .card-logo.tinted, .tv-logo.tinted {
  background: var(--accent);
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
}
.logo-preview { margin-bottom: 8px; }

/* Cards and layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.narrow { max-width: 440px; margin: 24px auto; }
.card.empty { text-align: center; color: var(--muted); }
.card.notice { border-color: var(--accent); background: var(--soft); }
.page-head { margin-bottom: 14px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; padding-bottom: 2px; }
.tabs a { padding: 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 700; font-size: .9rem; white-space: nowrap; }
.grid-2, .grid-3 { display: grid; gap: 12px; }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr 1fr; }
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.inline-form label { flex: 1 1 160px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.btn-row.center { justify-content: center; }
.list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }

/* Forms */
label { display: flex; flex-direction: column; gap: 5px; font-weight: 700; font-size: .9rem; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-weight: 700; font-size: .9rem; }
input, select, textarea {
  font: inherit; font-weight: 500; color: var(--ink); background: #fff;
  border: 1px solid #CFCCC5; border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); flex: none; margin: 0; }
input[type=color] { padding: 4px; width: 56px; height: 44px; }
input[type=file] { padding: 8px; }
textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 600; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.num-sm { max-width: 110px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 0; }
legend { font-weight: 800; padding: 0 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch.is-on { box-shadow: 0 0 0 2px var(--ink); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 700; font-size: .95rem; text-decoration: none; cursor: pointer;
  min-height: 44px; padding: 8px 16px; border-radius: 10px;
  background: #fff; color: var(--ink); border: 1px solid #CFCCC5;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, #fff); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn-quiet:hover { background: var(--soft); border-color: transparent; color: var(--ink); }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 4px 10px; font-size: .85rem; }
.btn-big {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font: inherit; font-weight: 800; font-size: 1.15rem; cursor: pointer;
  min-height: 72px; padding: 10px 14px; border-radius: 14px; border: 0; width: 100%;
  background: var(--accent); color: var(--on-accent);
}
.btn-big small { font-size: .85rem; font-weight: 700; opacity: .9; }
.btn-big small.given { font-weight: 600; font-size: .78rem; }
.btn-big:active { transform: scale(.98); }
.btn-big:disabled { opacity: .4; cursor: default; }
/* Correct is solid in the team's colour; Wrong is outlined, so neither is mistaken for a team colour. */
.btn-correct { background: var(--team, var(--good)); color: var(--on-team, #fff); }
.btn-correct::before { content: '✓ '; }
.btn-wrong { background: #fff; color: var(--bad); border: 2px solid color-mix(in srgb, var(--bad) 55%, #fff); }
.btn-wrong::before { content: '✗ '; }
.btn-big.btn-correct::before, .btn-big.btn-wrong::before { content: none; }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

/* Messages and chips */
.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-weight: 600; }
.flash-ok { background: #E7F4EA; color: #14532D; }
.flash-err { background: #FCE8E6; color: #8C1D18; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; background: #EFEDE8; color: var(--ink); font-size: .76rem; font-weight: 700; vertical-align: middle; }
.chip-setup { background: #EFEDE8; color: #4A4A4A; }
.chip-live { background: #FFF3D6; color: #7A4B00; }
.chip-done { background: #E2F3E6; color: #14532D; }
.chip-off { background: #FCE8E6; color: #8C1D18; }
.chip-moved { background: var(--soft); color: var(--accent-ink); margin-left: 6px; }
code.pw { font-family: ui-monospace, Consolas, monospace; font-size: 1rem; background: #fff; border: 1px solid var(--line); padding: 2px 8px; border-radius: 6px; user-select: all; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -4px 12px; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot th { color: var(--ink); font-size: .95rem; border-bottom: 0; }
.table tr.is-empty td { color: var(--muted); }
.people-table select { min-width: 130px; }
.people-table tr.role-admin td:first-child, .people-table tr.role-helper td:first-child { font-weight: 800; }

/* Expandable rows */
.row-item { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.row-item > summary { list-style: none; cursor: pointer; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.row-item > summary::-webkit-details-marker { display: none; }
.row-item[open] > summary { border-bottom: 1px solid var(--line); background: var(--soft); border-radius: 12px 12px 0 0; }
.row-item.is-off { opacity: .6; }
.row-main { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-sub { color: var(--muted); font-size: .86rem; }
.row-body { padding: 14px; }
details.sub > summary { cursor: pointer; font-weight: 700; margin: 8px 0; }

/* Event list */
.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 18px; }
.event-card { display: flex; gap: 14px; align-items: center; padding: 16px; background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--accent); border-radius: var(--radius); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.event-card:hover { border-color: var(--accent); }
.event-card-text { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.card-logo { width: 48px; height: 48px; flex: none; object-fit: contain; }

/* Teams */
.team-edit { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 10px; border: 1px solid var(--line); border-left: 6px solid var(--team); border-radius: 12px; }
.team-edit .inline-form { flex: 1 1 300px; }
.team-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--team, #9CA3AF); flex: none; }
.team-edit .team-dot { align-self: center; }
.team-ink { color: var(--team-ink, var(--ink)); }
.add-row { margin-top: 6px; }

/* Activity rows (setup and event scorecard) */
.act-row, .act-line { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; flex-wrap: wrap; }
.act-line { text-decoration: none; color: var(--ink); }
.act-line:hover { border-color: var(--a); }
.act-bar { width: 6px; align-self: stretch; border-radius: 4px; background: var(--a); flex: none; }
.act-main { flex: 1 1 200px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.act-list { display: flex; flex-direction: column; gap: 8px; }
.act-pts { display: flex; gap: 6px; }
.act-pts .pt { min-width: 58px; text-align: center; padding: 6px 8px; border-radius: 10px; background: color-mix(in srgb, var(--team) 12%, #fff); color: var(--team-ink); font-weight: 800; font-variant-numeric: tabular-nums; }
.act-legend { margin-top: 10px; }

/* Totals */
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 8px; }
.total-card { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--radius); background: var(--team); color: var(--on-team); box-shadow: var(--shadow); position: relative; }
.total-card.is-lead { outline: 3px solid var(--accent); outline-offset: 2px; }
.total-name { font-weight: 800; font-size: .95rem; }
.total-num { font-size: 2.3rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.totals.big .total-num { font-size: 3rem; }
.total-sub { font-size: .8rem; font-weight: 600; opacity: .9; }
.lead-tag { display: inline-block; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; background: rgba(255, 255, 255, .25); padding: 2px 8px; border-radius: 999px; margin-left: 4px; }
.facts { margin: 0; padding-left: 18px; }
.facts li { margin-bottom: 4px; }

/* Scoring */
.round-nav { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 10px; margin: 6px 0 4px; scrollbar-width: thin; }
.round-chip { flex: none; padding: 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 700; font-size: .9rem; white-space: nowrap; }
.round-chip.has-scores { border-color: color-mix(in srgb, var(--accent) 45%, #fff); }
.round-chip.is-on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.score-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.score-head h2 { margin: 0; }
.mini-totals { display: flex; gap: 8px; flex-wrap: wrap; }
.mini-totals span { padding: 4px 10px; border-radius: 999px; background: color-mix(in srgb, var(--team) 12%, #fff); color: var(--team-ink); font-weight: 700; font-size: .88rem; }
.q-state { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; justify-content: center; text-align: center; padding: 12px; margin-bottom: 12px; border-radius: 12px; background: var(--soft); }
.q-num { font-size: 1.4rem; font-weight: 800; }
.q-what { font-weight: 600; }
.q-worth { font-weight: 800; color: var(--accent-ink); }
.team-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.team-panel { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 14px; border: 2px solid color-mix(in srgb, var(--team) 30%, #fff); background: color-mix(in srgb, var(--team) 6%, #fff); }
.team-panel.is-turn { border-color: var(--team); box-shadow: 0 0 0 3px color-mix(in srgb, var(--team) 25%, transparent); }
.panel-name { font-weight: 800; color: var(--team-ink); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.turn { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; background: var(--team); color: var(--on-team); padding: 2px 8px; border-radius: 999px; }
.pick { display: flex; flex-direction: column; gap: 10px; }
.pick-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pick-group.big .pick-chip span { min-height: 60px; font-size: 1.05rem; }
.pick-team { width: 100%; font-weight: 800; font-size: .82rem; color: var(--team-ink, var(--muted)); text-transform: uppercase; letter-spacing: .04em; }
.pick-chip { flex-direction: row; font-weight: 700; cursor: pointer; }
.pick-chip input { position: absolute; opacity: 0; pointer-events: none; }
.pick-chip span { display: inline-flex; align-items: center; min-height: 46px; padding: 8px 16px; border-radius: 999px; border: 2px solid color-mix(in srgb, var(--team, var(--accent)) 35%, #fff); background: #fff; }
.pick-chip input:checked + span { background: var(--team, var(--accent)); color: var(--on-team, var(--on-accent)); border-color: var(--team, var(--accent)); }
.pick-chip input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.sheet-rows { display: flex; flex-direction: column; gap: 8px; }
.sheet-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px 10px; border: 1px solid var(--line); border-left: 5px solid var(--team, var(--line)); border-radius: 12px; }
.sheet-name { flex: 1 1 140px; display: flex; align-items: center; gap: 8px; font-weight: 700; }
.sheet-name small { font-weight: 600; margin-left: auto; }
.sheet-input { width: 110px; text-align: right; font-weight: 800; font-size: 1.1rem; }
.sheet-input.is-winner { background: #E7F4EA; }
.quick { display: flex; gap: 4px; }
.won-pick { flex-direction: row; align-items: center; gap: 6px; font-size: .85rem; }
.judge { display: flex; flex-direction: column; gap: 8px; }
.log { display: flex; flex-direction: column; }
.log-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.log-row:last-child { border-bottom: 0; }
.log-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.log-pts { font-weight: 800; font-variant-numeric: tabular-nums; }

/* Sign-in */
.auth-card { text-align: left; }
.auth-card h1 { text-align: center; }

/* Footer */
.foot { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 24px 16px 40px; color: var(--muted); font-size: .85rem; font-weight: 600; }

/* TV view */
body.tv { background: #111114; color: #fff; min-height: 100vh; }
body.tv .main { max-width: none; padding: 3vh 4vw; }
.tv-head { display: flex; align-items: center; gap: 2vw; margin-bottom: 3vh; }
.tv-head h1 { font-size: clamp(1.6rem, 4vw, 3.4rem); margin: 0; flex: 1; color: #fff; }
.tv-logo { width: clamp(48px, 7vw, 110px); height: clamp(48px, 7vw, 110px); object-fit: contain; }
.tv-mark { width: clamp(36px, 4vw, 64px); height: clamp(36px, 4vw, 64px); }
.tv-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 2vw; margin-bottom: 3vh; }
.tv-team { background: var(--team); color: var(--on-team); border-radius: 24px; padding: 3vh 2vw; display: flex; flex-direction: column; align-items: center; gap: 1vh; }
.tv-team.is-lead { outline: 6px solid var(--accent); outline-offset: 4px; }
.tv-team-name { font-size: clamp(1.4rem, 3vw, 2.6rem); font-weight: 800; }
.tv-team-num { font-size: clamp(3.5rem, 11vw, 9rem); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.tv-now { background: #1E1E24; border-left: 8px solid var(--accent); border-radius: 16px; padding: 2vh 2vw; margin-bottom: 3vh; display: flex; flex-wrap: wrap; gap: 1vh 3vw; align-items: center; justify-content: space-between; }
.tv-label { font-size: clamp(1rem, 2vw, 1.8rem); font-weight: 800; }
.tv-now-scores { display: flex; gap: 2vw; font-size: clamp(1rem, 2vw, 1.8rem); font-weight: 700; }
.tv-now-scores span { color: color-mix(in srgb, var(--team) 40%, #fff); }
.tv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.2vh 1.5vw; }
.tv-act { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 1.4vh 1.2vw; border-radius: 14px; background: #1E1E24; border-left: 6px solid var(--a); }
.tv-act-name { font-weight: 700; font-size: clamp(.9rem, 1.4vw, 1.3rem); }
.tv-act-pts { display: flex; gap: 10px; font-weight: 800; font-size: clamp(1rem, 1.6vw, 1.5rem); font-variant-numeric: tabular-nums; }
.tv-act-pts span { min-width: 3.2ch; text-align: right; color: color-mix(in srgb, var(--team) 45%, #fff); }

@media (max-width: 560px) {
  h1 { font-size: 1.4rem; }
  .event-logo { width: 48px; height: 48px; }
  .total-num { font-size: 1.9rem; }
  .totals.big .total-num { font-size: 2.4rem; }
  .act-pts .pt { min-width: 48px; }
  .topnav > a { padding: 8px 6px; }
  .brand-name { display: none; }
  .menu > summary { white-space: nowrap; padding: 8px 6px; }
  .team-panel { padding: 8px; }
  .btn-big { font-size: 1.05rem; min-height: 68px; padding: 8px; }
  .panel-name { flex-direction: column; align-items: flex-start; gap: 2px; }
}
