.btn {
  display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--foreground);
  font: inherit; font-size: 13px; line-height: 16px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 150ms cubic-bezier(0.22, 1, 0.36, 1), transform 150ms cubic-bezier(0.22, 1, 0.36, 1);
}
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-small { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
.btn-ghost, .btn-quiet { border-color: transparent; background: none; color: var(--muted); }
.btn-ghost:hover, .btn-quiet:hover { background: var(--hover); color: var(--foreground); }

:focus-visible { outline: 3px solid var(--foreground); outline-offset: 2px; }

.gate { min-height: 100vh; display: grid; align-content: center; justify-items: center; gap: 12px; padding: 24px; text-align: center; }
.gate .mark { width: 32px; height: 32px; }
.gate h1 { font-size: 22px; }
.gate-notice { color: var(--warning-ink); max-width: 40ch; min-height: 22px; }

.sheet {
  border: 0; background: var(--card); color: var(--foreground); padding: 0;
  width: min(520px, 100vw); max-width: 100vw; height: 100vh; max-height: 100vh; margin: 0 0 0 auto;
  box-shadow: var(--float);
}
.sheet::backdrop { background: var(--veil); }
.sheet[open] { display: flex; flex-direction: column; }
.sheet-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px 0 24px; min-height: 44px; }
.sheet-message { color: var(--muted); font-size: 13px; }
.sheet-body { overflow-y: auto; padding: 4px 24px 32px; display: grid; gap: 20px; align-content: start; flex: 1; scrollbar-gutter: stable; }
.sheet-body:focus { outline: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sheet-head h2 { font-size: 20px; line-height: 26px; font-weight: 600; letter-spacing: -0.4px; }
.sheet-note { color: var(--muted); }
.sheet-block { display: grid; gap: 8px; justify-items: start; }
.sheet-block > .bets, .sheet-block > .empty, .sheet-block > .facts { justify-self: stretch; }
.sheet-block .bet, .sheet-body > .bets .bet { grid-template-columns: minmax(0, 1fr) auto; padding-left: 0; padding-right: 0; }
.sheet-block .bet-leg, .sheet-body > .bets .bet-leg { grid-column: 1 / -1; }
.sheet-block .bet-profit, .sheet-body > .bets .bet-profit { grid-column: 2; grid-row: 1; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.empty { color: var(--muted); }

.confirm { display: grid; gap: 8px; justify-items: start; }
.confirm p { color: var(--muted); }
.confirm:has(p) { grid-template-columns: auto auto 1fr; }
.confirm:has(p) p { grid-column: 1 / -1; }

.form { display: grid; gap: 16px; }
.form > .btn { justify-self: start; }
.field { display: grid; gap: 6px; }
.field-label { font-size: 13px; font-weight: 500; }
.field-hint { font-size: 12px; line-height: 17px; color: var(--muted); }
.control { height: 32px; padding: 0 10px; border: 1px solid var(--input); border-radius: 6px; background: var(--field); color: var(--foreground); font: inherit; width: 100%; min-width: 0; }
.control:focus-visible { outline-offset: 0; }
.form-message { color: var(--warning-ink); min-height: 22px; }

.steps { display: grid; border: 1px solid var(--border-subtle); border-radius: 10px; overflow: hidden; }
.step { display: flex; justify-content: space-between; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--border-subtle); }
.step:last-child { border-bottom: 0; }
.step-state { font-size: 12px; font-weight: 500; color: var(--muted); }
.step-todo .step-label { color: var(--muted); }
.step-done .step-state { color: var(--success-ink); }
.step-doing .step-state { color: var(--foreground); }
.step-failed .step-state { color: var(--destructive-ink); }

@media (max-width: 760px) {
  .sheet { width: 100vw; }
  .control { height: 40px; font-size: 16px; }
  .btn { height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn, .need-arrow, summary.group-head::before { transition: none; }
  .btn:active { transform: none; }
}
