/* The signup fieldsets may shrink below their longest <option> (fieldset defaults to min-width: min-content),
   so the page never scrolls sideways on a phone. */
#signup-form fieldset { min-width: 0; }

/* Bookmaker picker on /signup/ (book-picker.js, markup from signup-src/inject_book_picker.py).
   Tokens from theme.css; rows and motion follow ui.css: 44px+ rows, 8px row corners, 180ms colour,
   220ms enter / 140ms leave on cubic-bezier(.2,0,0,1). */
.bp { --bp-ease: cubic-bezier(0.2, 0, 0, 1); --bp-r: 12px; margin-top: 16px; }
.bp svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* Slot counter */
.bp-head { display: flex; flex-direction: column; gap: 8px; }
.bp-count { margin: 0; color: var(--mint-ink); font: 600 14px/20px var(--font-sans); font-variant-numeric: tabular-nums; }
.bp.is-over .bp-count { color: var(--negative); }
.bp-meter { height: 6px; border-radius: 9999px; background: var(--surface-sunken); overflow: hidden; }
.bp-meter span { display: block; height: 100%; border-radius: inherit; background: var(--mint-ink); transform-origin: left; transform: scaleX(var(--fill, 0)); transition: transform 320ms var(--bp-ease), background-color 180ms var(--bp-ease); }
.bp.is-full .bp-meter span { background: #0b8f63; }
.bp.is-over .bp-meter span { background: var(--negative); }

/* Tray of chosen bookmakers */
.bp-tray { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; min-height: 40px; align-items: center; }
.bp-tray-empty { color: var(--ink-subtle); font-size: 13px; line-height: 20px; display: none; }
.bp-tray.is-empty .bp-tray-empty { display: block; }
.bp-pick { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 4px 0 6px; border: 1px solid var(--mint-line); border-radius: 10px; background: var(--mint-tint); color: var(--ink); font: 500 13px/18px var(--font-sans); animation: bpIn 220ms var(--bp-ease) backwards; }
.bp-pick.is-request { padding-left: 4px; border-style: dashed; border-color: var(--border-strong); background: var(--surface-card); }
.bp-pick.is-leaving { animation: bpOut 140ms var(--bp-ease) forwards; pointer-events: none; }
.bp-pick.is-new { animation: bpIn 220ms var(--bp-ease) backwards, bpGlow 700ms var(--bp-ease) 120ms; }
.bp-pick-logo { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; background: var(--surface-inverse); font-size: 9px; }
.bp-pick-tag { padding: 2px 6px; border-radius: 6px; background: var(--surface-sunken); color: var(--ink-muted); font: 600 11px/14px var(--font-sans); text-transform: uppercase; letter-spacing: .04em; }
.bp-pick-x { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-muted); cursor: pointer; transition: background-color 180ms var(--bp-ease), color 180ms var(--bp-ease); }
.bp-pick-x:hover { background: rgb(11 12 14 / .06); color: var(--ink); }
.bp-pick-x svg { width: 14px; height: 14px; }
@keyframes bpIn { from { opacity: 0; transform: scale(0.92); } }
@keyframes bpOut { to { opacity: 0; transform: scale(0.92); } }
@keyframes bpGlow { 0% { box-shadow: 0 0 0 0 rgb(10 127 88 / .35); } 100% { box-shadow: 0 0 0 8px rgb(10 127 88 / 0); } }

/* Limit banner */
.bp-limit { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 14px; padding: 12px 14px; border: 1px solid var(--mint-line); border-radius: var(--bp-r); background: var(--mint-tint); color: var(--ink-strong); font-size: 13px; line-height: 20px; animation: bpIn 220ms var(--bp-ease) backwards; }
.bp-limit[hidden] { display: none; }
.bp.is-over .bp-limit { border-color: rgb(194 48 48 / .35); background: #fdf0f0; }
.bp-limit.is-nudged { animation: bpShake 360ms var(--bp-ease); }
.bp-limit-text { flex: 1 1 220px; margin: 0; }
.bp-limit button { min-height: 36px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--surface-inverse); color: #fff; font: 600 13px/18px var(--font-sans); cursor: pointer; transition: transform 120ms var(--bp-ease), opacity 180ms var(--bp-ease); }
.bp-limit button:hover { opacity: .88; }
.bp-limit button:active { transform: scale(0.97); }
.bp-limit button[hidden] { display: none; }
@keyframes bpShake { 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-2px); } 80% { transform: translateX(2px); } }

/* Popular chips */
.bp-label { margin: 20px 0 8px; color: var(--ink-muted); font: 600 12px/16px var(--font-sans); text-transform: uppercase; letter-spacing: .06em; }
.bp-popular { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; min-height: 44px; }
.bp-chip { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 10px 0 8px; border: 1px solid var(--border-mid); border-radius: var(--bp-r); background: var(--surface-card); color: var(--ink); font: 500 14px/18px var(--font-sans); text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: background-color 180ms var(--bp-ease), border-color 180ms var(--bp-ease), box-shadow 180ms var(--bp-ease), transform 120ms var(--bp-ease); }
.bp-chip > span:not(.bp-chip-icon) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-chip:hover { border-color: var(--mint-ink); box-shadow: 0 0 0 3px rgb(10 127 88 / .10); }
.bp-chip:active { transform: scale(0.97); }
.bp-chip.is-on { border-color: var(--mint-ink); background: var(--mint-tint); }
.bp-chip-logo { flex: none; width: 28px; height: 28px; border-radius: 7px; object-fit: cover; background: var(--surface-inverse); font-size: 10px; }
.bp-chip-icon { position: relative; display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 9999px; background: var(--surface-sunken); color: var(--ink-muted); transition: background-color 180ms var(--bp-ease), color 180ms var(--bp-ease); }
.bp-chip-icon svg { position: absolute; width: 13px; height: 13px; transition: opacity 160ms var(--bp-ease), transform 220ms var(--bp-ease); }
.bp-chip .i-check { opacity: 0; transform: scale(0.4) rotate(-45deg); }
.bp-chip.is-on .bp-chip-icon { background: var(--mint-ink); color: #fff; }
.bp-chip.is-on .i-plus { opacity: 0; transform: scale(0.4) rotate(90deg); }
.bp-chip.is-on .i-check { opacity: 1; transform: none; }
.bp.is-full .bp-chip:not(.is-on), .bp.is-full .bp-row:not(.is-on) { opacity: .5; }

/* Search and filters */
.bp-tools { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 8px; }
.bp-search { position: relative; grid-column: 1 / -1; display: block; }
.bp-search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--ink-subtle); pointer-events: none; }
.bp-search input { width: 100%; height: 50px; padding: 0 14px 0 42px; border: 1px solid var(--border-strong); border-radius: var(--bp-r); background: var(--surface-card); color: var(--ink); font: 500 16px/24px var(--font-sans); }
.bp-search input::placeholder { color: var(--ink-subtle); }
.bp-search input:focus-visible { outline: 2px solid var(--mint-ink); outline-offset: 1px; border-color: var(--mint-ink); }
.bp-search input::-webkit-search-cancel-button { cursor: pointer; }
.bp-country { min-width: 0; font-size: 14px; }
.bp-country select { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--bp-r); background: var(--surface-card); color: var(--ink); font: 500 14px/20px var(--font-sans); }
.bp-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid var(--border-mid); border-radius: var(--bp-r); background: var(--surface-card); color: var(--ink); font: 500 14px/20px var(--font-sans); white-space: nowrap; cursor: pointer; transition: border-color 180ms var(--bp-ease), background-color 180ms var(--bp-ease); }
.bp-toggle:has(input:checked) { border-color: var(--mint-ink); background: var(--mint-tint); }
.bp-toggle input { width: 16px; height: 16px; margin: 0; }

/* Full list */
.bp-results { margin: 14px 0 6px; color: var(--ink-subtle); font: 500 12px/16px var(--font-sans); font-variant-numeric: tabular-nums; }
.bp-list { position: relative; display: flex; flex-direction: column; max-height: min(420px, 62vh); padding: 4px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--border); border-radius: var(--bp-r); background: var(--surface-card); scroll-padding: 34px 0 4px; }
.bp-list:focus-visible { outline: 2px solid var(--mint-ink); outline-offset: 2px; }
.bp:not(.is-ready) .bp-list { min-height: 220px; background: linear-gradient(90deg, var(--surface-sunken) 0, var(--surface-card) 40%, var(--surface-sunken) 80%) 0 0 / 300% 100%; animation: bpLoad 1.2s linear infinite; }
.bp.is-failed .bp-list { animation: none; background: var(--surface-sunken); }
@keyframes bpLoad { to { background-position: -300% 0; } }
.bp-group[hidden], .bp-row[hidden] { display: none; }
.bp-list.is-searching .bp-group:not([hidden]) { display: contents; }
.bp-list.is-searching .bp-letter { display: none; }
.bp-letter { position: sticky; top: -4px; z-index: 1; margin: 0 -4px; padding: 8px 16px 6px; background: rgb(255 255 255 / .94); color: var(--ink-subtle); font: 650 11px/14px var(--font-mono); letter-spacing: .08em; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.bp-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 12px; border-radius: 8px; color: var(--ink); cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; transition: background-color 140ms var(--bp-ease), opacity 180ms var(--bp-ease); }
.bp-row:hover, .bp-row.is-active { background: rgba(32, 35, 43, 0.045); }
.bp-list:focus-visible .bp-row.is-active, .bp-search:focus-within ~ * .bp-row.is-active { box-shadow: inset 0 0 0 2px var(--mint-line); }
.bp-row.is-on { background: var(--mint-tint); }
.bp-row.is-on:hover, .bp-row.is-on.is-active { background: #d6f7ea; }
.bp-check { display: grid; place-items: center; flex: none; width: 20px; height: 20px; border: 1.5px solid var(--border-strong); border-radius: 6px; background: var(--surface-card); color: #fff; transition: background-color 160ms var(--bp-ease), border-color 160ms var(--bp-ease); }
.bp-check svg { width: 14px; height: 14px; stroke-width: 2.8; stroke-dasharray: 22; stroke-dashoffset: 22; transition: stroke-dashoffset 220ms var(--bp-ease); }
.bp-row.is-on .bp-check { border-color: var(--mint-ink); background: var(--mint-ink); }
.bp-row.is-on .bp-check svg { stroke-dashoffset: 0; }
.bp-logo { flex: none; width: 32px; height: 32px; border-radius: 8px; object-fit: cover; background: var(--surface-inverse); font-size: 11px; }
.bp-mono { display: grid; place-items: center; font-family: var(--font-mono); font-weight: 650; letter-spacing: .3px; }
.tone-0 { background: #e3fbf2; color: #0a7f58; }
.tone-1 { background: #eaf0fd; color: #2257d6; }
.tone-2 { background: #fdf0e6; color: #a33c08; }
.tone-3 { background: #eef2f0; color: #3d4743; }
.tone-4 { background: #f3ecfb; color: #6b3fa0; }
.tone-5 { background: #fbeaec; color: #a8283a; }
.bp-text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.bp-name { overflow: hidden; font: 550 14px/20px var(--font-sans); text-overflow: ellipsis; white-space: nowrap; }
.bp-name mark { border-radius: 3px; background: #c9f5e3; color: inherit; }
.bp-where { overflow: hidden; color: var(--ink-subtle); font-size: 12px; line-height: 16px; text-overflow: ellipsis; white-space: nowrap; }
.bp-live { flex: none; padding: 2px 8px; border-radius: 9999px; background: var(--surface-sunken); color: var(--mint-ink); font: 600 11px/16px var(--font-sans); }
.bp-live.is-off { color: var(--ink-subtle); font-weight: 500; }

/* No match */
.bp-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 8px; padding: 16px; border: 1px dashed var(--border-strong); border-radius: var(--bp-r); color: var(--ink-body); font-size: 14px; line-height: 20px; }
.bp-empty[hidden] { display: none; }
.bp-empty-text { margin: 0; }
.bp-empty button { min-height: 40px; padding: 0 14px; border: 1px solid var(--mint-ink); border-radius: 10px; background: var(--mint-tint); color: var(--ink); font: 600 13px/18px var(--font-sans); cursor: pointer; }
.bp-empty button[hidden] { display: none; }

@media (max-width: 560px) {
  .bp-popular { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bp-chip { position: relative; gap: 8px; min-height: 48px; padding: 0 8px; font-size: 13px; }
  /* The +/check badge sits on the logo's corner so the name keeps its width. */
  .bp-chip-icon { position: absolute; left: 26px; top: 26px; width: 16px; height: 16px; box-shadow: 0 0 0 2px var(--surface-card); }
  .bp-chip.is-on .bp-chip-icon { box-shadow: 0 0 0 2px var(--mint-tint); }
  .bp-chip-icon svg { width: 10px; height: 10px; }
  .bp-row { gap: 10px; padding: 6px 8px; }
  .bp-list { max-height: 60vh; }
}
@media (prefers-reduced-motion: reduce) {
  .bp *, .bp *::before, .bp *::after { animation: none !important; transition-duration: 1ms !important; }
}
