:root {
  --ground: #F4F5F7; --card: #FFFFFF; --ink: #11151B; --body: #3A414C; --muted: #5B6472;
  --line: #E3E6EB; --field: #C9CED6; --accent: #0A6B94; --accent-dark: #07506F; --accent-soft: #E6F2F7;
  --down: #B4470A; --warn-bg: #FFF4E5; --warn-ink: #6B2E05;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); }
body { font-family: Manrope, system-ui, -apple-system, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); } a:hover { color: var(--accent-dark); }
button, input { font-family: inherit; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
[hidden] { display: none !important; }

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.screen { flex: 1; padding: 20px 24px 28px; display: flex; flex-direction: column; gap: 16px; }
.app.has-nav .screen { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }

.logo-bar { padding: calc(env(safe-area-inset-top) + 14px) 24px 10px; background: rgba(255,255,255,0.96); }
.logo { display: flex; align-items: center; gap: 0.3em; margin: 0; font-size: 22px; line-height: 1; letter-spacing: -0.035em; text-decoration: none; color: var(--ink); }
.logo-mark { height: 1.13em; width: auto; flex-shrink: 0; }
.logo-word b { font-weight: 800; color: var(--ink); }
.logo-word span { font-weight: 500; color: var(--accent); }
.logo-lg { font-size: 38px; padding: 8px 0 4px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); display: flex; align-items: center; justify-content: center; }

h1 { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; }
h1.hero { font-size: 32px; line-height: 1.12; }
h2 { margin: 0; font-size: 16px; font-weight: 800; }
p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--body); }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.small { font-size: 13px; line-height: 1.45; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 8px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.divider { height: 1px; background: var(--line); }
.banner { background: var(--ink); color: #FFFFFF; border-radius: 14px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; font-size: 14px; line-height: 1.4; }
.note { background: var(--accent-soft); border-radius: 14px; padding: 14px 16px; font-size: 13px; line-height: 1.5; display: flex; flex-direction: column; gap: 6px; }
.note b.title { font-size: 14px; color: var(--accent-dark); }
.warn { background: var(--warn-bg); color: var(--warn-ink); border-radius: 14px; padding: 14px 16px; display: flex; gap: 12px; font-size: 13px; line-height: 1.5; }
.error { background: #FDECEC; color: #8F1D1D; border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.45; }
.ok { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--accent); }

.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: flex; gap: 12px; font-size: 14px; line-height: 1.45; }
.steps .n { font-weight: 800; color: var(--accent); width: 14px; flex-shrink: 0; }
.dot { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; background: var(--ink); color: #FFFFFF; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

.progress { display: flex; flex-direction: column; gap: 12px; }
.progress-top { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--muted); }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar > div { height: 100%; border-radius: 3px; background: var(--accent); }

label.field-label { font-size: 14px; font-weight: 700; }
.input { height: 48px; padding: 0 14px; border: 1px solid var(--field); border-radius: 12px; background: #FFFFFF; font-size: 16px; color: var(--ink); width: 100%; }
.input:focus, .btn:focus-visible, .chip:focus-visible, .switch:focus-visible, .filepick:focus-within { outline: 3px solid rgba(10,107,148,0.35); outline-offset: 2px; }
.input.code { font-family: 'JetBrains Mono', monospace; letter-spacing: 0.3em; font-size: 22px; text-align: center; }
.filepick { min-height: 56px; padding: 10px 14px; border: 1.5px dashed #9AA3AF; border-radius: 12px; background: #FFFFFF; display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--body); cursor: pointer; }
.filepick input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.btn { min-height: 52px; border-radius: 14px; border: none; background: var(--accent); color: #FFFFFF; font-size: 16px; font-weight: 700; text-decoration: none; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; padding: 0 18px; width: 100%; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.dark { background: var(--ink); }
.btn.outline { background: #FFFFFF; color: var(--accent); border: 1.5px solid var(--accent); min-height: 44px; font-size: 14px; width: auto; }
.btn.danger { background: #FFFFFF; color: var(--down); border: 1.5px solid var(--down); min-height: 48px; font-size: 15px; }
.linkbtn { background: none; border: none; color: var(--accent); font-size: 15px; font-weight: 600; cursor: pointer; padding: 10px; }
.push { margin-top: auto; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 40px; padding: 0 16px; border-radius: 20px; border: 1.5px solid var(--field); background: #FFFFFF; color: var(--body); font-size: 14px; font-weight: 700; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.chip.add { border-style: dashed; border-color: #9AA3AF; background: transparent; color: var(--accent); }
.row { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.row .grow { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.switch { width: 52px; height: 32px; flex-shrink: 0; border: none; border-radius: 16px; background: var(--field); padding: 3px; display: flex; justify-content: flex-start; cursor: pointer; }
.switch span { width: 26px; height: 26px; border-radius: 50%; background: #FFFFFF; }
.switch[aria-checked="true"] { background: var(--accent); justify-content: flex-end; }

.combo-top { display: flex; justify-content: space-between; gap: 10px; }
.combo-name { font-size: 15px; font-weight: 700; }
.combo-value { font-family: 'JetBrains Mono', monospace; font-size: 18px; font-weight: 600; text-align: right; }
.meter { position: relative; height: 34px; }
.meter .track { position: absolute; left: 0; right: 0; top: 6px; height: 10px; border-radius: 5px; background: var(--line); }
.meter .fill { position: absolute; left: 0; top: 6px; height: 10px; border-radius: 5px; background: var(--accent); }
.meter .tick { position: absolute; top: 2px; width: 2px; height: 18px; background: #9AA3AF; }
.meter .tick.buyin { background: var(--down); }
.meter .tick-label { position: absolute; top: 22px; transform: translateX(-50%); font-size: 11px; font-weight: 600; color: var(--muted); }
.combo-foot { display: flex; justify-content: space-between; font-size: 13px; color: var(--body); }
.status { font-size: 13px; font-weight: 600; color: var(--accent-dark); background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; }
.status.lost { color: #6B2E05; background: var(--warn-bg); }
.legs { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 1px; background: var(--line); border-radius: 10px; overflow: hidden; }
.leg { background: #FFFFFF; display: flex; align-items: center; gap: 8px; padding: 9px 12px; font-size: 14px; }
.leg-mark { width: 14px; flex-shrink: 0; font-weight: 800; color: var(--accent); text-align: center; }
.leg.lost .leg-mark, .leg.lost .leg-right { color: var(--down); }
.leg-name { flex: 1; min-width: 0; }
.leg-right { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.leg.won { color: var(--muted); }
details.combo { display: block; }   /* Safari won't open a <details> laid out as flex */
.combo-summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 44px; }
.combo-summary::-webkit-details-marker { display: none; }
.combo-summary:focus-visible { outline: 3px solid rgba(10,107,148,0.35); outline-offset: 4px; border-radius: 8px; }
.chev { flex-shrink: 0; color: var(--muted); transition: transform 0.15s; }
details.combo[open] .chev { transform: rotate(180deg); }
.pill { flex-shrink: 0; font-size: 12px; font-weight: 700; color: var(--accent-dark); background: var(--accent-soft); border-radius: 10px; padding: 3px 8px; }
.pill.lost { color: var(--warn-ink); background: var(--warn-bg); }
details.won summary { font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; padding: 4px 0; min-height: 32px; display: flex; align-items: center; }
details.won .legs { margin-top: 6px; }
.alerts { display: flex; flex-direction: column; gap: 1px; background: var(--line); border-radius: 12px; overflow: hidden; }
.alerts div { background: #FFFFFF; padding: 12px 14px; display: flex; justify-content: space-between; gap: 10px; font-size: 13px; line-height: 1.4; }
.alerts time { color: var(--muted); flex-shrink: 0; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }
.live-dot.off { background: var(--down); }

/* Menu sits at the top and sticks there while scrolling. A menu pinned to the bottom gets covered by
   iPhone Safari's floating address/tab bar. */
nav.tabs { position: sticky; top: 0; z-index: 10; padding: env(safe-area-inset-top) 12px 0; background: rgba(255,255,255,0.96);
           -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
           display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }   /* 3 tabs, or 4 with Invite */
nav.tabs a { height: 52px; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 6px; font-size: 14px; font-weight: 600;
             color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; }
nav.tabs a svg { width: 20px; height: 20px; flex-shrink: 0; }
@media (max-width: 380px) { nav.tabs a { flex-direction: column; gap: 2px; font-size: 12px; } }
.person { display: flex; align-items: center; gap: 10px; min-height: 56px; }
.person .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.person .who { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.person .btn.danger { width: auto; min-height: 40px; padding: 0 12px; font-size: 13px; }
nav.tabs a[aria-current="page"] { color: var(--accent); font-weight: 700; border-bottom-color: var(--accent); }

dl.defs { margin: 0; display: flex; flex-direction: column; gap: 10px; }
dl.defs dt { font-size: 14px; font-weight: 700; }
dl.defs dd { margin: 2px 0 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; }
.check svg { flex-shrink: 0; margin-top: 2px; }
