:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, sans-serif;
  background: #0b1313;
  color: #f2f3e9;
  --surface: #131e1d;
  --border: #30403d;
  --accent: #c6efab;
  --muted: #b2c2bb;
  --gutter: clamp(16px, 4vw, 38px);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
p { line-height: 1.55; }

.masthead { border-bottom: 1px solid var(--border); }
.masthead-inner, main { max-width: 1200px; margin-inline: auto; padding-inline: var(--gutter); }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; font-size: 1rem; font-weight: 800; letter-spacing: .15em; }
.brand-mark { display: grid; width: 35px; height: 35px; place-items: center; border: 1px solid #6f8b6a; border-radius: 10px; color: var(--accent); font: italic 700 22px Georgia, serif; letter-spacing: 0; }
.tag { color: var(--muted); font-size: .875rem; }
.tag span { color: var(--accent); padding-inline: 4px; }

main { padding-top: clamp(18px, 4vw, 38px); padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  min-height: clamp(236px, 37vw, 410px);
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid #374943;
  background: #182824 url('/racecourse.webp') center 12% / cover no-repeat;
}
.hero::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, #0a1513ec 0%, #0a1513a6 33%, transparent 76%), linear-gradient(0deg, #0a1513c9 0%, transparent 52%);
  content: '';
}
.hero-copy { padding: clamp(22px, 5vw, 52px); }
.eyebrow { margin: 0 0 9px; color: var(--accent); font-weight: 700; letter-spacing: .16em; font-size: .82rem; }
h1 { margin: 0; font-size: clamp(3rem, 8vw, 6.1rem); line-height: .93; letter-spacing: -.055em; }
h1 em { font-family: Georgia, serif; font-weight: 400; letter-spacing: -.075em; }
.hero-copy > p:last-child { margin: 13px 0 0; max-width: 31ch; color: #e4ebde; }
h2 { font-size: clamp(1.25rem, 3vw, 1.55rem); letter-spacing: -.02em; }

.login-panel, .card, .filters { margin: 23px 0; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); padding: clamp(18px, 3vw, 26px); }
.login-panel { width: min(100%, 470px); margin-inline: auto; }
.login-panel h2 { margin: 0 0 17px; }
form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; min-width: 0; color: var(--muted); font-size: .9rem; }
input, select, button { min-width: 0; min-height: 44px; border: 1px solid #40524b; border-radius: 8px; font: inherit; }
input, select { background: #0d1716; color: #f2f3e9; padding: 9px 10px; width: 100%; font-size: 1rem; }
input[type='date'] { display: block; }
select { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
button { cursor: pointer; padding: 9px 14px; color: #edf2e8; background: #1c2b28; font-weight: 650; transition: background-color 160ms ease, border-color 160ms ease; }
button.primary { margin-top: 3px; color: #172614; background: var(--accent); border-color: var(--accent); }
button:disabled { opacity: .55; cursor: wait; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #f4dca1; outline-offset: 3px; }
@media (hover: hover) {
  button:not(:disabled):hover { background-color: #2f453d; border-color: #6a8b7a; }
  button.primary:not(:disabled):hover { background-color: #def8c8; }
}

.message { margin: 0; color: #cddfd1; }
body:not(.signed-in) .message { width: min(100%, 470px); margin-inline: auto; }
.workspace-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-block: 16px; }
.freshness, .notice, footer, .muted { color: var(--muted); }
.freshness, .notice, footer, .message { font-size: .875rem; }
.freshness { margin: 0; }
.toolbar, .tabs { display: flex; flex-wrap: wrap; gap: 7px; }
.tabs { border-radius: 12px; background: #111c1a; border: 1px solid var(--border); padding: 5px; }
.tabs button { flex: 1 0 auto; border-color: transparent; background: transparent; }
.tabs button[aria-pressed='true'] { background: #263c2b; border-color: #537455; color: var(--accent); }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: 14px; margin-bottom: 10px; }
.notice { margin-top: 0; }
.card h2 { margin-top: 0; }
.card p { color: var(--muted); }
.horse { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 7px 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.hash { font-family: ui-monospace, monospace; overflow-wrap: anywhere; font-size: .875rem; }
footer { margin-top: 40px; line-height: 1.55; }

.view-opening { animation: reveal 260ms cubic-bezier(.22,.61,.36,1) both; }
.busy-panel { position: fixed; z-index: 2; inset: 0; display: grid; place-items: center; padding: var(--gutter); background: #08100dd9; }
.busy-card { display: grid; justify-items: center; width: min(100%, 276px); padding: 23px 18px; border: 1px solid #587562; border-radius: 18px; background: #16231e; box-shadow: 0 22px 75px #03090680; animation: reveal 200ms ease-out both; }
.busy-card canvas { display: block; width: 148px; height: 74px; }
.busy-card p { margin: 9px 0 0; color: #e1efda; font-weight: 650; text-align: center; }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 540px) {
  .hero { min-height: 240px; background-position: 61% 48%; }
  .hero::before { background: linear-gradient(90deg, #0a1513c9 0%, #0a15136b 42%, transparent 84%), linear-gradient(0deg, #0a1513f2 2%, transparent 75%); }
  .hero-copy { padding: 20px 17px; }
  .signed-in .hero { min-height: 176px; }
  .tabs button { font-size: .875rem; padding-inline: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
