/* Two layouts from one stylesheet, chosen per device (html[data-layout]):
   phone   = one column, big targets, sticky action bar at the thumb, agenda as a list
   desktop = step list on the left, form in the middle, live summary on the right */
:root {
  --bg: #f5f2ec; --card: #ffffff; --ink: #1d232a; --muted: #5d6670; --line: #d9d4ca;
  --brand: #0d4a6b; --brand-ink: #ffffff; --accent: #c8553d; --ok: #1f6f43; --warn: #8a5a00;
  --err: #b42318; --err-bg: #fdecea; --focus: #f2a900; --chip: #e8eef2;
  --radius: 12px; --tap: 48px; --warn-bg: #fff4d6; --warn-ink: #5c4300;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #12161a; --card: #1b2127; --ink: #e9edf1; --muted: #a3adb7; --line: #313a43;
    --brand: #5fb0dc; --brand-ink: #0b1a24; --accent: #f08a70; --ok: #5cc48a; --warn: #e3b25a;
    --err: #ff8a80; --err-bg: #3a1d1b; --chip: #24303a; --warn-bg: #3b3018; --warn-ink: #f0d79a; color-scheme: dark;
  }
}
:root[data-theme=dark] {
    --bg: #12161a; --card: #1b2127; --ink: #e9edf1; --muted: #a3adb7; --line: #313a43;
    --brand: #5fb0dc; --brand-ink: #0b1a24; --accent: #f08a70; --ok: #5cc48a; --warn: #e3b25a;
    --err: #ff8a80; --err-bg: #3a1d1b; --chip: #24303a; --warn-bg: #3b3018; --warn-ink: #f0d79a; color-scheme: dark;
  }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }
p { margin: .25rem 0 .75rem; }
a { color: var(--brand); }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; z-index: 9; background: var(--card); padding: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px;
  background: var(--brand); color: var(--brand-ink); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--brand); }
.brand { font-weight: 700; display: flex; gap: 8px; align-items: center; min-width: 0; }
.brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save { font-size: .85rem; opacity: .9; white-space: nowrap; }

.shell { max-width: 640px; margin: 0 auto; padding: 0 16px; }
main { padding: 16px 0 120px; outline: none; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-bottom: 12px; }
.progress div { height: 100%; background: var(--brand); width: 0; transition: width .3s; }
.stepLabel { font-size: .85rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.steps, .summary { display: none; }

/* ---- form controls ---- */
.field { margin: 0 0 18px; }
.field > label, .field > .label { display: block; font-weight: 600; margin-bottom: 6px; }
.hint { display: block; font-size: .875rem; color: var(--muted); margin: -2px 0 6px; font-weight: 400; }
input[type=text], input[type=email], input[type=tel], input[type=search], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; font: inherit; color: var(--ink);
  background: var(--card); border: 1.5px solid var(--line); border-radius: 10px; }
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
[aria-invalid=true] { border-color: var(--err) !important; background: var(--err-bg) !important; }
.msg { color: var(--err); font-size: .9rem; font-weight: 600; margin-top: 4px; }
.msg:empty { display: none; }
.row { display: grid; gap: 0 12px; grid-template-columns: minmax(0, 1fr); }
.choices { display: grid; gap: 8px; }
.choice { display: flex; gap: 12px; align-items: center; min-height: var(--tap); padding: 10px 14px; background: var(--card);
  border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; }
.choice input { width: 22px; height: 22px; flex: none; accent-color: var(--brand); margin: 0; }
.choice:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.choice.disabled { opacity: .55; cursor: not-allowed; }
.choice .why { display: block; font-size: .85rem; color: var(--warn); }
.inline-choices { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-choices .choice { flex: 1 1 140px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 10px 20px;
  font: inherit; font-weight: 700; border-radius: 10px; border: 1.5px solid var(--brand); background: var(--card); color: var(--brand); cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.pay { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.link { border: 0; background: none; padding: 0 4px; min-height: 0; text-decoration: underline; font-weight: 600; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.notice { border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; background: var(--chip); }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }
.errorbox { border: 2px solid var(--err); background: var(--err-bg); border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; }
.errorbox h2 { margin: 0 0 6px; font-size: 1rem; color: var(--err); }
.errorbox ul { margin: 0; padding-left: 20px; }
.errorbox a { color: var(--ink); font-weight: 600; }

/* games picker */
.gamesCard { display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.gamesCard[aria-pressed=true] { border-color: var(--brand); box-shadow: inset 0 0 0 2px var(--brand); }
.gamesCard[disabled] { cursor: not-allowed; opacity: .6; }
.tag { display: inline-block; font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--chip); }
.tag.open { background: #d8f0e1; color: #11502e; }

/* sports */
.counters { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.counter { font-size: .9rem; font-weight: 700; background: var(--chip); border-radius: 99px; padding: 4px 12px; }
.counter.full { background: var(--accent); color: #fff; }
.sportList { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 16px; }
.sportBtn { min-height: var(--tap); text-align: left; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card);
  font: inherit; color: inherit; cursor: pointer; }
.sportBtn small { display: block; color: var(--muted); font-size: .8rem; }
.sportBtn[aria-expanded=true] { border-color: var(--brand); }
.sportBtn.has { background: var(--chip); border-color: var(--brand); }
.eventPanel { border-left: 4px solid var(--brand); padding-left: 12px; margin: 4px 0 20px; }
.eventPanel h2 { margin-top: 0; }
.ageTag { font-size: .8rem; font-weight: 700; color: var(--ok); white-space: nowrap; }
.eventName { flex: 1; min-width: 0; }
.partner { margin: -2px 0 10px 34px; }

/* agenda */
.agenda { list-style: none; padding: 0; margin: 0; }
.agenda li { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.agenda .when { font-weight: 700; font-size: .9rem; }
.agenda .x { margin-left: auto; }
.empty { color: var(--muted); font-style: italic; }

/* documents */
.docSlot { margin-bottom: 20px; }
.docBtns { display: flex; gap: 8px; flex-wrap: wrap; }
.docList { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.docList li { display: flex; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.docList img, .docList .pdf { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; background: var(--chip); display: grid; place-items: center; font-size: .75rem; font-weight: 700; }
.docList .fn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* review */
.review dl { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 4px 12px; margin: 0; }
.review dt { color: var(--muted); } .review dd { margin: 0; overflow-wrap: anywhere; }
.review .head { display: flex; justify-content: space-between; align-items: baseline; }
.review .head h2 { margin: 0 0 8px; }
.price { width: 100%; border-collapse: collapse; } .price td { padding: 6px 0; border-top: 1px solid var(--line); }
.price td:last-child { text-align: right; font-variant-numeric: tabular-nums; } .price tr:last-child td { font-weight: 800; }

/* sticky action bar (phone) */
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; gap: 10px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 12px #0001; }
.actionbar:empty { display: none; }
.actionbar .btn { flex: 1; } .actionbar .btn.back { flex: 0 0 auto; }
.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; max-width: 640px; margin: 0 auto; padding: 0 16px 110px; font-size: .8rem; color: var(--muted); }
.layoutSwitch button { font: inherit; background: none; border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; color: var(--muted); cursor: pointer; }
.layoutSwitch button[aria-pressed=true] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.loading { color: var(--muted); }
.result { text-align: center; padding-top: 24px; } .result .big { font-size: 3rem; }
.ref { font-family: ui-monospace, monospace; font-size: 1.3rem; font-weight: 800; letter-spacing: .05em; }

/* ===================== DESKTOP LAYOUT ===================== */
html[data-layout=desktop] body { font-size: 16px; }
html[data-layout=desktop] { --tap: 44px; }
html[data-layout=desktop] .shell { max-width: 1240px; display: grid; grid-template-columns: 220px minmax(0, 1fr) 320px; gap: 32px; padding: 24px 24px 0; }
html[data-layout=desktop] main { padding: 0 0 48px; }
html[data-layout=desktop] .progress { display: none; }
html[data-layout=desktop] .row.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
html[data-layout=desktop] .row.three { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); }
html[data-layout=desktop] .steps { display: block; position: sticky; top: 80px; align-self: start; }
html[data-layout=desktop] .steps ol { list-style: none; margin: 0; padding: 0; counter-reset: s; }
html[data-layout=desktop] .steps li { counter-increment: s; }
html[data-layout=desktop] .steps a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 600; }
html[data-layout=desktop] .steps a::before { content: counter(s); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); font-size: .8rem; flex: none; }
html[data-layout=desktop] .steps a.done::before { content: "✓"; background: var(--ok); border-color: var(--ok); color: #fff; }
html[data-layout=desktop] .steps a.bad::before { content: "!"; background: var(--err); border-color: var(--err); color: #fff; }
html[data-layout=desktop] .steps a[aria-current=step] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px #0001; }
html[data-layout=desktop] .steps a[aria-current=step]::before { border-color: var(--brand); color: var(--brand); }
html[data-layout=desktop] .summary { display: block; position: sticky; top: 80px; align-self: start; max-height: calc(100vh - 100px); overflow: auto; }
html[data-layout=desktop] .summary .card h2 { margin-top: 0; font-size: 1rem; }
html[data-layout=desktop] .actionbar { position: static; box-shadow: none; background: none; border: 0; padding: 24px 0 0; justify-content: space-between; }
html[data-layout=desktop] .actionbar .btn { flex: 0 0 auto; min-width: 160px; }
html[data-layout=desktop] .foot { max-width: 1240px; padding: 24px; }
html[data-layout=desktop] .sportList { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* desktop week grid replaces the phone list */
.cal { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 2px; font-size: .72rem; margin-top: 8px; }
.cal .d { text-align: center; color: var(--muted); font-weight: 700; }
.cal .bar { grid-row: auto; background: var(--brand); color: var(--brand-ink); border-radius: 4px; padding: 2px 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal .bar.clash { background: var(--err); color: #fff; }
.phoneOnly { } html[data-layout=desktop] .phoneOnly { display: none; }
.deskOnly { display: none; } html[data-layout=desktop] .deskOnly { display: block; }
html[data-layout=desktop] .actionbar { grid-column: 2; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* address helpers and post-payment send */
.placePick { margin: -6px 0 14px; display: grid; gap: 6px; }
.chipBtn { font: inherit; min-height: 40px; padding: 6px 14px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.chipBtn[aria-pressed=true] { border-color: var(--brand); background: var(--chip); }
.sendExtras { display: grid; gap: 8px; margin: 8px 0 24px; }
.msg.ok { color: var(--ok); }
#lookupMsg:not(:empty) { margin: -8px 0 14px; color: var(--ok); }

/* street suggestions */
.suggest { list-style: none; margin: 4px 0 0; padding: 4px; background: var(--card); border: 1.5px solid var(--brand); border-radius: 10px; box-shadow: 0 6px 18px #0002; }
.suggest button { display: block; width: 100%; text-align: left; font: inherit; color: var(--ink); background: none; border: 0; border-radius: 6px; min-height: var(--tap); padding: 8px 10px; cursor: pointer; }
.suggest li.active button, .suggest button:hover { background: var(--chip); }
.suggest { scroll-margin-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
