:root {
  --ground: #F4F4F1; --card: #FFFFFF; --ink: #1B1D1A; --muted: #5D615A; --line: #D9DBD5; --line2: #ECEDE9;
  --field: #B7BAB2; --green: #1F6B3A; --green-dk: #164F2B; --green-lt: #E3EFE6; --navy: #1E3A6E;
  --rust: #7A2E0E; --badge: #C2410C; --warn-bg: #FFF6EC; --warn-line: #E8C9A6; --err: #B42318;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ink); }
body { font-family: 'Source Sans 3', system-ui, sans-serif; color: var(--ink); font-size: 16px; -webkit-text-size-adjust: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--green); }
.shell { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; background: var(--ground); display: flex; flex-direction: column; }
.loading { padding: 48px 24px; color: var(--muted); }

/* header */
.top { background: var(--ink); color: var(--ground); padding: 18px 20px 14px; display: flex; flex-direction: column; gap: 12px; }
.top.admin { background: var(--rust); }
.top-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { min-width: 0; line-height: 1; font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 24px; text-transform: uppercase; letter-spacing: .02em; }
.linkbtn { white-space: nowrap; background: none; border: none; color: #B9D9C3; font-size: 14px; text-decoration: underline; min-height: 44px; padding: 0 4px; }
.top.admin .linkbtn { color: #FFE1CF; }
.tabs { display: flex; gap: 6px; }
.tab { flex: 1; min-height: 40px; border-radius: 6px; background: transparent; color: #D6D8D2; border: 1px solid #4A4D47; font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 4px; }
.tab.on { background: var(--ground); color: var(--ink); border-color: var(--ground); }
.top.admin .tab { color: #FFE1CF; border-color: #A85A38; }
.top.admin .tab.on { background: #fff; color: var(--rust); border-color: #fff; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--badge); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--rust); }

/* hero (sign in) */
.hero { background: var(--ink); color: var(--ground); padding: 48px 24px 28px; display: flex; flex-direction: column; gap: 8px; }
.kicker { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: #B9D9C3; font-weight: 600; }
.hero h1 { margin: 0; font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 44px; line-height: .95; text-transform: uppercase; }
.hero p { margin: 0; color: #D6D8D2; font-size: 15px; }

main { flex: 1; padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding-bottom: 4px; }
h2 { margin: 0; font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 28px; text-transform: uppercase; }
.sub { font-size: 14px; color: var(--muted); }
.progress { font-size: 14px; font-weight: 700; color: var(--green); text-align: right; }
.note { font-size: 13px; color: var(--muted); line-height: 1.45; }

.seg { display: flex; gap: 8px; }
.seg button { flex: 1; min-height: 44px; border-radius: 8px; border: 1px solid var(--field); background: #fff; font-weight: 600; font-size: 15px; }
.seg button.on { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 700; }

form, .stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 15px; }
.field input, .field select { height: 48px; border: 1px solid var(--field); border-radius: 8px; padding: 0 12px; background: #fff; font-size: 16px; width: 100%; }
.pin { font-size: 22px !important; letter-spacing: .4em; }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.primary { min-height: 52px; border-radius: 8px; border: none; background: var(--green); color: #fff; font-weight: 700; font-size: 17px; }
.primary:hover { background: var(--green-dk); }
.dark { min-height: 48px; border-radius: 8px; border: none; background: var(--ink); color: #fff; font-weight: 700; font-size: 16px; }
.ghost { min-height: 44px; border-radius: 8px; border: 1px solid var(--field); background: #fff; font-weight: 600; font-size: 14px; padding: 0 12px; }
.error { color: var(--err); font-size: 14px; font-weight: 600; }
.box { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; font-size: 14px; line-height: 1.45; }

/* game cards */
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.meta { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.code { font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--navy); }
.when { color: var(--muted); text-align: right; }
.label { font-size: 13px; color: var(--muted); margin-top: -6px; }
.picks { display: flex; gap: 8px; }
.pick { flex: 1; min-height: 48px; border-radius: 8px; border: 1px solid var(--field); background: #fff; font-weight: 600; font-size: 16px; padding: 4px 8px; }
.pick.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.pick:disabled { cursor: default; color: #8A8E86; border-color: var(--line); }
.pick.on:disabled { color: #fff; background: #4E7F5D; border-color: #4E7F5D; }
.pick.win { box-shadow: inset 0 0 0 3px #E8A33A; }
.status { font-size: 13px; color: var(--muted); }
.status.ok { color: var(--green); font-weight: 600; }
.status.bad { color: var(--err); font-weight: 700; }
.status button { background: none; border: none; color: var(--err); font-weight: 700; text-decoration: underline; padding: 0; min-height: 0; }

/* ladder */
.sample { font-size: 13px; font-weight: 700; color: #8A4B08; background: #FBEBD4; padding: 3px 8px; border-radius: 4px; }
.table { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tr { display: grid; grid-template-columns: 40px 1fr 70px 70px; padding: 0 12px; min-height: 48px; align-items: center; border-bottom: 1px solid var(--line2); }
.tr:last-child { border-bottom: none; }
.th { min-height: 0; padding: 10px 12px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
.tr .r { text-align: right; font-variant-numeric: tabular-nums; }
.tr.me { background: var(--green-lt); }
.tr.prize { background: #FAFBF8; }
.tr.me.prize { background: var(--green-lt); }
.prizeamt { color: var(--green); font-weight: 700; }
.b { font-weight: 700; } .n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-wrap { overflow-x: auto; }
.gr { display: grid; grid-template-columns: minmax(70px, 1fr) repeat(7, 26px) 34px; column-gap: 3px; padding: 0 8px; min-height: 44px; align-items: center; border-bottom: 1px solid var(--line2); font-size: 15px; min-width: 320px; }
.gr.th { min-height: 0; padding: 10px 8px; font-size: 12px; }
.gr .c { text-align: center; font-variant-numeric: tabular-nums; border-radius: 4px; }
.gr .c.top { background: var(--green-lt); color: var(--green); font-weight: 700; }
.gr .c.none { color: #8A8E86; }
.gr.foot { font-size: 12px; color: var(--muted); background: #FAFBF8; min-height: 36px; }
.gr.me { background: #F1F7F2; }

/* who tipped */
.split { display: flex; justify-content: space-between; font-weight: 700; font-size: 16px; gap: 8px; }
.bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--line2); }
.bar .h { background: var(--green); } .bar .a { background: var(--field); }
.names { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; font-size: 14px; line-height: 1.5; }
.names .t { font-weight: 700; margin-bottom: 2px; } .names .l { color: #3E413B; }

/* admin */
.req { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; justify-content: flex-end; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; flex-wrap: wrap; }
.row .grow { flex: 1 1 100%; min-width: 120px; display: flex; flex-direction: column; }
.row .nm { font-weight: 600; font-size: 16px; }
.small { min-height: 40px; padding: 0 10px; border-radius: 8px; font-size: 14px; font-weight: 600; border: 1px solid var(--field); background: #fff; }
.small.go { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.small.paid { background: var(--green); border-color: var(--green); color: #fff; min-width: 72px; font-weight: 700; }
.small.unpaid { color: var(--rust); border-color: var(--rust); min-width: 72px; font-weight: 700; }
.small.danger { color: var(--err); border-color: #E7B4AE; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.res { display: flex; gap: 6px; flex-wrap: wrap; }
.res .pick { min-height: 44px; font-size: 15px; }
.res .pick.draw { flex: 0 0 auto; padding: 0 12px; }

/* bottom nav */
nav.bottom { position: sticky; bottom: 0; display: flex; border-top: 1px solid var(--line); background: #fff; padding-bottom: env(safe-area-inset-bottom); }
nav.bottom button { flex: 1; min-height: 60px; border: none; background: none; font-weight: 600; font-size: 16px; border-top: 3px solid transparent; }
nav.bottom button.on { color: var(--green); font-weight: 700; border-top-color: var(--green); }

.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; }
.toast.show { opacity: 1; }
@media (min-width: 600px) { body { padding: 0; } .shell { box-shadow: 0 0 0 1px #2C2F2A; } }
