:root {
  color-scheme: light;
  font-family: "Instrument Sans", "Segoe UI", sans-serif;
  color: #0a2050;
  background: #edf5fc;
  --line: #d4e3f2;
  --subtle: #415a7c;
}
* { box-sizing: border-box; }
body { margin: 0; }
header { background: #07193f; color: #fff; }
.container { width: min(1200px, calc(100% - 48px)); margin: auto; }
.masthead { display: flex; align-items: center; gap: 12px; height: 66px; font-weight: 650; }
.brand-icon { display: block; flex: none; }
.masthead h1 { font-size: 1rem; margin: 0; }
#connection { margin-left: auto; font-weight: 500; font-size: .83rem; color: #b7e1fb; }
main { padding: 22px 0; }
.race-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
h2 { font-size: 1.2rem; margin: 0; }
p { margin: 7px 0; color: var(--subtle); }
.layout { display: grid; grid-template-columns: 285px minmax(0, 1fr); gap: 17px; align-items: start; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
aside h2, .race-heading { padding: 17px; border-bottom: 1px solid var(--line); }
.meeting { padding: 12px; border-bottom: 1px solid var(--line); }
.meeting:last-child { border: 0; }
#meetings > p { padding: 12px 17px; margin: 0; }
.meeting summary { cursor: pointer; font-size: .92rem; font-weight: 650; padding: 4px 5px; }
.meeting[open] summary { margin-bottom: 5px; }
.race-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; align-items: baseline; }
.tree-race-title { grid-column: 1 / -1; font-size: .78rem; color: var(--subtle); margin-top: 2px; }
.tree-race-result { grid-column: 1 / -1; font-size: .78rem; color: #164178; font-weight: 700; margin-top: 4px; }
.tree-race-status { font-size: .75rem; color: #163965; background: #e2f0fb; padding: 2px 6px; border-radius: 8px; }
button { width: 100%; border: 0; background: transparent; padding: 8px; text-align: left; border-radius: 6px; cursor: pointer; color: inherit; font: inherit; font-size: .85rem; overflow-wrap: anywhere; }
button:hover, button[aria-current="true"] { background: #e1effc; }
button[aria-current="true"] { color: #10346a; font-weight: 700; }
.race-heading h2 { font-size: 1.35rem; font-weight: 750; }
#race-context { margin: 4px 0 0; font-size: .84rem; }
#race-result { background: #e3f0fb; padding: 12px 17px; border-bottom: 1px solid var(--line); }
#race-result ul { display: flex; flex-wrap: wrap; gap: 6px 20px; padding: 0; margin: 7px 0 0; list-style: none; }
#race-result li { font-size: .9rem; }
.result-place { font-weight: 700; margin-right: 6px; }
.status { border-radius: 99px; background: #d9edfb; color: #163965; padding: 5px 9px; white-space: nowrap; font-size: .8rem; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: 13px 17px; border-bottom: 1px solid #e8eef9; min-width: 92px; }
thead th { color: var(--subtle); font-size: .82rem; }
.win-book { display: block; margin-top: 4px; color: #10346a; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inactive-board { background: #fbe3e6; color: #851b28; border-bottom-color: #f2cdd2; }
.inactive-board .win-book { color: inherit; }
.inactive-board-status { display: block; margin-top: 4px; font-size: .78rem; font-weight: 600; }
tbody th { font-weight: 600; min-width: 160px; }
tbody tr:last-child > * { border-bottom: 0; }
.runner-label { display: inline-flex; align-items: center; gap: 8px; }
.runner-silk { display: block; flex: none; object-fit: contain; }
.likely-non-runner > * { border-top: 1px solid #dfc4f3; border-bottom: 1px solid #dfc4f3; }
.likely-non-runner > :not(.inactive-board) { background: #f2e8ff; }
thead th:not(:first-child), tbody td { text-align: center; }
td { font-variant-numeric: tabular-nums; font-weight: 700; }
.price-shortened { --pulse-colour: #b8ddff; --direction-colour: #134e92; }
.price-drifted { --pulse-colour: #ffe2a3; --direction-colour: #75410a; }
.price-shortened, .price-drifted { animation: price-pulse 1250ms ease-out; }
.price-direction { margin-left: 7px; color: var(--direction-colour); font-weight: 700; }
@keyframes price-pulse {
  from { box-shadow: inset 0 0 0 999px var(--pulse-colour); }
  to { box-shadow: inset 0 0 0 999px transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .price-shortened, .price-drifted { animation: none; box-shadow: inset 0 0 0 999px var(--pulse-colour); }
}
.empty { padding: 11px 17px; }
#withdrawals { padding: 0 17px; }
.admin-messages { margin-top: 17px; }
.admin-messages summary { cursor: pointer; padding: 17px; font-weight: 650; }
.admin-content { border-top: 1px solid var(--line); padding: 17px; }
:is(#admin-form, #sql-form) { display: grid; gap: 8px; max-width: 560px; }
#admin-form[hidden] { display: none; }
:is(#admin-form, #sql-form) label { margin-top: 5px; font-size: .86rem; font-weight: 600; }
:is(#admin-form, #sql-form) :is(select, textarea) { font: inherit; color: inherit; border: 1px solid #b6cce7; border-radius: 6px; background: #fafcff; padding: 8px; }
:is(#admin-form, #sql-form) textarea { resize: vertical; }
.admin-action { width: fit-content; margin-top: 7px; background: #d9edfb; color: #163965; font-weight: 650; }
.admin-action:disabled { opacity: .55; cursor: default; }
.admin-preview { padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
#admin-preview-text, #admin-history p { white-space: pre-wrap; overflow-wrap: anywhere; }
#admin-status { min-height: 1.4em; }
#admin-history { padding-left: 22px; font-size: .9rem; }
@media (max-width: 680px) {
  .container { width: calc(100% - 26px); }
  .layout { grid-template-columns: 1fr; }
  th, td { padding-inline: 12px; }
}
