/* XMillion — white, clean, phone-first */
:root {
  --bg: #ffffff;
  --ink: #141a2e;
  --muted: #687089;
  --line: #e7e9f0;
  --soft: #f6f7fb;
  --brand: #1f3fae;
  --brand-ink: #ffffff;
  --gold: #f4b400;
  --green: #12a150;
  --green-soft: #e3f6eb;
  --orange: #f07c12;
  --orange-soft: #fff1e3;
  --red: #d33a3a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 26, 46, .05), 0 4px 16px rgba(20, 26, 46, .05);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: .95rem; margin-top: 1rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }
code, .code { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--soft); padding: 2px 6px; border-radius: 6px; letter-spacing: .08em; font-weight: 600; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 18px; padding-bottom: 40px; min-height: 60vh; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.xsmall { font-size: .75rem; margin: .5rem 0 0; }
.center { text-align: center; }
.right { text-align: right; }
.neg { color: var(--red); font-weight: 600; }

/* Top bar */
.topbar { border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 10; }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 58px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--ink); letter-spacing: -.02em; }
.logo:hover { text-decoration: none; }
.logo-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--gold); color: var(--ink); font-weight: 900; }
.nav { display: flex; align-items: center; gap: 14px; font-size: .92rem; overflow-x: auto; white-space: nowrap; }
.nav a { color: var(--ink); }
.nav .btn { color: var(--brand-ink); }

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--brand); color: var(--brand-ink); border: 1px solid var(--brand); padding: 11px 18px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-sm { padding: 6px 12px; font-size: .86rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-ghost { background: #fff; color: var(--brand); border-color: var(--line); }
.btn-warn { background: #fff; color: var(--orange); border-color: #f6d2ae; }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn.disabled { opacity: .45; pointer-events: none; }
.icon-btn { border: 0; background: transparent; color: var(--muted); font-size: 1rem; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--soft); color: var(--red); }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.row-btns form { margin: 0; }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: .92rem; }
.form small { font-weight: 400; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #d6d9e3; border-radius: 10px; padding: 11px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(31, 63, 174, .25); border-color: var(--brand); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
.check { display: flex !important; grid-template-columns: none; align-items: center; gap: 8px; font-weight: 500 !important; }
.input-prefix { display: flex; align-items: center; border: 1px solid #d6d9e3; border-radius: 10px; padding-left: 12px; background: #fff; }
.input-prefix input { border: 0; outline: 0; }
.code-input { text-transform: uppercase; letter-spacing: .2em; font-size: 1.3rem; text-align: center; font-family: ui-monospace, Menlo, monospace; }
.grid2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
fieldset.modes { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
fieldset.modes legend { font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.mode { display: flex !important; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; font-weight: 500 !important; }
.mode span { display: grid; gap: 2px; }
.mode small { color: var(--muted); }
.mode:has(input:checked) { border-color: var(--brand); background: #f4f6fd; }

/* Cards */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.narrow { max-width: 440px; margin: 20px auto; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.card.danger { border-color: #f3c9c9; }
.big-icon { font-size: 2.6rem; }

.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-size: .94rem; background: var(--green-soft); color: #0b6b37; border: 1px solid #c4ebd4; }
.flash-err { background: #fdeaea; color: #962727; border-color: #f6caca; }
.flash-warn { background: var(--orange-soft); color: #8a4507; border-color: #f8d6b4; }
.flash-debug { background: #eef1ff; color: #1f3fae; border-color: #cfd8ff; word-break: break-all; }

/* Lists */
.list { display: grid; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); color: inherit; }
.list-row:first-child { border-top: 0; }
a.list-row:hover { text-decoration: none; background: var(--soft); }
.list-main { display: grid; gap: 4px; }
.chev { font-size: 1.5rem; color: var(--muted); }
.tag { display: inline-block; font-size: .7rem; font-weight: 700; background: #fff4cf; color: #7a5800; padding: 1px 7px; border-radius: 99px; vertical-align: middle; }

/* Balls */
.ball { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; font-weight: 700; font-size: 1rem; background: #fff; border: 2px solid #cdd2df; color: var(--ink); position: relative; flex: none; font-variant-numeric: tabular-nums; }
.ball.sm { width: 30px; height: 30px; font-size: .82rem; border-width: 1.5px; }
.ball.xs { width: 22px; height: 22px; font-size: .68rem; border-width: 1.5px; }
.ball.win { background: var(--brand); border-color: var(--brand); color: #fff; }
.ball.bonus { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.ball.hit { background: var(--green); border-color: var(--green); color: #fff; }
.ball.hit-bonus { border-color: var(--gold); background: #fff7dc; }
.ball.open { border-color: var(--orange); color: var(--orange); background: var(--orange-soft); }
.ball.mine { background: var(--brand); border-color: var(--brand); color: #fff; }
.ball.taken { border-color: #9aa3bb; }
.ball.taken i { position: absolute; top: -6px; right: -7px; background: var(--ink); color: #fff; font-style: normal; font-size: .55rem; border-radius: 99px; min-width: 13px; height: 13px; display: grid; place-items: center; }
.ball.hot { border-color: #f08a5d; background: #fff1ea; }
.ball.cold { border-color: #7aa6e8; background: #eef4ff; }
.ball.src-g { border-color: var(--brand); }
.ball.src-l { background: var(--ink); border-color: var(--ink); color: #fff; }
.ball.src-r { border-style: dashed; color: var(--muted); }
.balls, .balls-sm, .balls-lg, .balls-wrap { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.balls-lg .ball { width: 46px; height: 46px; font-size: 1.15rem; }
.plus { color: var(--muted); font-weight: 700; }
.encore { font-family: ui-monospace, Menlo, monospace; letter-spacing: .12em; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); margin: 8px 0; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
p.legend { justify-content: center; }

/* Avatars & players */
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; background: var(--soft); }
.avatar-lg { width: 84px; height: 84px; font-size: 2rem; }
.avatar-ini { display: inline-grid; place-items: center; font-weight: 700; }
.avatar-open { display: inline-grid; place-items: center; background: var(--orange-soft); color: var(--orange); font-weight: 800; border: 2px dashed var(--orange); }
.players { display: grid; }
.player { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.player:first-child { border-top: 0; }
.player-main { flex: 1; min-width: 0; display: grid; gap: 5px; }
.player-name { font-weight: 600; }
.open-spot { background: linear-gradient(90deg, var(--orange-soft), transparent 70%); border-radius: 10px; padding-left: 8px; }
.paid-form { margin: 0; }
.paid-btn { border: 1.5px solid #d6d9e3; background: #fff; color: var(--muted); border-radius: 99px; padding: 7px 13px; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.paid-btn.is-paid { background: var(--green); border-color: var(--green); color: #fff; }
details.more summary { cursor: pointer; color: var(--brand); font-size: .85rem; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: " ▾"; }
.more-in { display: grid; gap: 6px; padding-top: 8px; font-size: .9rem; }
.add-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.inline-check { margin: 0; }
.hits { display: grid; text-align: center; min-width: 48px; }
.hits strong { font-size: 1.3rem; }

/* Group pages */
.pool-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.pool-title { margin: 0; font-size: 1.4rem; }
.pool-switch { font-weight: 700; font-size: 1.1rem; width: auto; max-width: 70%; }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a { padding: 10px 12px; color: var(--muted); font-weight: 600; font-size: .93rem; border-bottom: 2.5px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.week-row { display: flex; justify-content: space-between; gap: 12px; }
.budget { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); color: var(--muted); }
.weeknav { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 14px; }
.draw-block { border-top: 1px solid var(--line); padding-top: 4px; }
.draw-block:first-of-type { border-top: 0; }
.ticket-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; }
.ticket-line form { margin: 0; }
.match { font-weight: 700; color: var(--muted); white-space: nowrap; }
.match-good { color: var(--green); }
.photos { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0; }
.photo { position: relative; display: block; }
.photo img { width: 110px; height: 80px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.photo form { position: absolute; top: 2px; right: 2px; margin: 0; }
.photo .icon-btn { background: rgba(255, 255, 255, .9); }
.photo-add { margin: 0; }
.official { display: grid; gap: 8px; padding: 12px; background: var(--soft); border-radius: 12px; }
.official-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .92rem; }
.share { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--green-soft); color: #0b6b37; font-size: .95rem; }

/* Profile + picker */
.profile-form { display: flex; gap: 16px; align-items: center; }
.profile-fields { flex: 1; display: grid; gap: 8px; }
.profile-fields label { display: grid; gap: 4px; font-weight: 600; font-size: .9rem; }
.avatar-pick { position: relative; cursor: pointer; display: block; }
.avatar-edit { position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: .7rem; padding: 2px 8px; border-radius: 99px; }
.now-playing { display: grid; gap: 6px; padding: 10px 0; }
.grid52 { display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; margin: 12px 0; }
@media (min-width: 600px) { .grid52 { grid-template-columns: repeat(13, 1fr); } }
.cell { position: relative; aspect-ratio: 1; cursor: pointer; }
.cell input { position: absolute; opacity: 0; pointer-events: none; }
.cell span { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; border: 2px solid #d6d9e3; font-weight: 700; font-size: .95rem; background: #fff; transition: transform .08s; font-variant-numeric: tabular-nums; }
.cell.taken span { border-color: #9aa3bb; background: var(--soft); }
.cell.open span { border-color: var(--orange); color: var(--orange); background: var(--orange-soft); }
.cell input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; transform: scale(1.06); }
.cell input:focus-visible + span { outline: 3px solid rgba(31, 63, 174, .35); }
.cell .cnt { position: absolute; top: -4px; right: -4px; background: var(--ink); color: #fff; font-style: normal; font-size: .62rem; font-weight: 700; min-width: 17px; height: 17px; border-radius: 99px; display: grid; place-items: center; padding: 0 4px; pointer-events: none; }
.picker-bar { position: sticky; bottom: 0; background: #fff; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.pick-status { font-weight: 600; }

/* Home */
.hero { display: grid; gap: 18px; grid-template-columns: 1.2fr 1fr; align-items: center; padding: 16px 0 22px; }
.hero h1 { font-size: 2.1rem; margin-bottom: .3em; }
.hero p { color: var(--muted); font-size: 1.05rem; margin-top: 0; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } .hero h1 { font-size: 1.7rem; } }
.next-draws { display: grid; gap: 10px; }
.next-draw { border-radius: var(--radius); padding: 14px 16px; color: #fff; }
.next-max { background: linear-gradient(135deg, #1f3fae, #3a5fd8); }
.next-649 { background: linear-gradient(135deg, #0f7a46, #19a35f); }
.nd-game { font-weight: 700; opacity: .9; font-size: .9rem; }
.nd-jack { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.nd-date { font-size: .85rem; opacity: .9; }
.res { display: grid; gap: 8px; }
.res-head { display: flex; justify-content: space-between; gap: 8px; }
.seg { display: inline-flex; background: var(--soft); border-radius: 10px; padding: 3px; gap: 2px; margin-bottom: 12px; max-width: 100%; }
.seg-scroll { overflow-x: auto; display: flex; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font: inherit; font-size: .86rem; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.gen-out { display: grid; gap: 8px; min-height: 48px; margin-bottom: 10px; }
.gen-out .ball { animation: pop .25s ease-out both; }
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.spin-wheel { width: 110px; height: 110px; margin: 6px auto 14px; border-radius: 50%; display: grid; place-items: center; font-size: 2.6rem; font-weight: 800; color: var(--ink); background: conic-gradient(var(--gold) 0 25%, #ffe08a 0 50%, var(--gold) 0 75%, #ffe08a 0); box-shadow: inset 0 0 0 10px #fff, 0 2px 10px rgba(0, 0, 0, .08); }
.spin-wheel.spinning { animation: wob .12s linear infinite; }
@keyframes wob { 50% { transform: rotate(8deg); } }
.stat-block { display: grid; gap: 6px; margin-bottom: 12px; }
.stat-row { display: flex; align-items: center; gap: 10px; }
.stat-lbl { width: 62px; font-size: .82rem; color: var(--muted); flex: none; }
.w-now { display: flex; align-items: center; gap: 12px; }
.w-icon { font-size: 2.4rem; }
.w-temp { font-size: 2.2rem; font-weight: 800; }
.w-days { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; text-align: center; font-size: .82rem; }
.w-days div { background: var(--soft); border-radius: 10px; padding: 6px 2px; }
blockquote { margin: 0; font-size: 1.05rem; }
blockquote footer { color: var(--muted); font-size: .9rem; margin-top: 6px; }
.news { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.news a { color: var(--ink); font-weight: 600; }
.news .meta { color: var(--muted); font-size: .78rem; }
.scores { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.game { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: .9rem; }
.game .team { display: flex; justify-content: space-between; }
.game .team.win { font-weight: 700; }
.game .st { color: var(--muted); font-size: .76rem; margin-top: 4px; }
.game .st.live { color: var(--red); font-weight: 700; }
.cta { display: flex; justify-content: space-between; align-items: center; gap: 16px; background: linear-gradient(135deg, #fffaf0, #fff); border-color: #f5e3b3; }
.cta p { margin: 0; color: var(--muted); }
@media (max-width: 620px) { .cta { flex-direction: column; align-items: stretch; } }
.skeleton { height: 64px; border-radius: 10px; background: linear-gradient(90deg, var(--soft), #eceef5, var(--soft)); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }
.ad { margin: 16px 0; min-height: 90px; }

/* Footer */
.footer { border-top: 1px solid var(--line); background: var(--soft); padding: 22px 0 30px; font-size: .88rem; }
.footer-in { display: grid; gap: 10px; }
.footer-note { color: var(--muted); font-size: .8rem; }

/* Phone tweaks */
.legend .ball.taken { margin-right: 5px; }
.row-btns label select { width: auto; padding: 6px 8px; }
.row-btns label { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 480px) {
  .topbar-in { gap: 8px; }
  .logo { font-size: 1.05rem; }
  .logo-mark { width: 28px; height: 28px; }
  .nav { gap: 10px; font-size: .84rem; }
  .hide-sm { display: none; }
  .ball { width: 36px; height: 36px; font-size: .92rem; }
  .ticket-line .ball, .official .ball { width: 31px; height: 31px; font-size: .85rem; }
  .ticket-line .balls, .official .balls { gap: 4px; }
  .match { font-size: .85rem; }
  .weeknav .btn { padding: 6px 9px; }
}

/* ===== v2: phone fit, menu, home rows, paste box ===== */
html, body { max-width: 100%; overflow-x: hidden; }
@supports (overflow-x: clip) { html, body { overflow-x: clip; } }
img, svg, video { max-width: 100%; }
.card, .player-main, .list-main, .res, .row > * { min-width: 0; }
.flash, .news a, .code, pre { overflow-wrap: anywhere; }
.mt { margin-top: 14px; }

/* Inputs at 16px so iPhone Safari never zooms in */
input, select, textarea { font-size: 16px; }
.inline-select { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--muted); }
.inline-select select { width: auto; padding: 7px 10px; font-size: 16px; }

/* Top bar + menu button */
.topbar-in { position: relative; }
.menu-btn { display: none; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 0; cursor: pointer; flex-direction: column; justify-content: center; align-items: center; gap: 4px; }
.menu-btn span { display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .15s, opacity .15s; }
.menu-open .menu-btn span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-open .menu-btn span:nth-child(2) { opacity: 0; }
.menu-open .menu-btn span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
@media (max-width: 680px) {
  .menu-btn { display: inline-flex; }
  .nav { display: none; position: absolute; top: 58px; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 10px 20px rgba(20,26,46,.08); flex-direction: column; align-items: stretch; gap: 0; padding: 6px 16px 12px; overflow: visible; white-space: normal; font-size: 1rem; }
  .menu-open .nav { display: flex; }
  .nav a { padding: 12px 4px; border-top: 1px solid var(--line); }
  .nav a:first-child { border-top: 0; }
  .nav a.btn { margin-top: 8px; padding: 12px; color: #fff; }
}

/* Home rows: every box in a row is the same height */
.row { display: grid; gap: 16px; margin-bottom: 16px; align-items: stretch; }
.row > .card { margin: 0; }
.row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row.inner { margin: 0; gap: 22px; }
@media (max-width: 900px) { .row-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .row-3 > :last-child:nth-child(odd) { grid-column: 1 / -1; } }
@media (max-width: 640px) { .row-2, .row-3 { grid-template-columns: minmax(0, 1fr); } .row-3 > :last-child:nth-child(odd) { grid-column: auto; } }
.home .card { margin-bottom: 16px; }
.home .row > .card { margin-bottom: 0; }
.center-card { display: flex; flex-direction: column; }
.center-card .spin-wheel { margin-top: auto; }
.center-card #spin-msg { margin-bottom: auto; }
.res { display: grid; gap: 10px; align-content: start; }
.res-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); }
.res-meta strong { color: var(--ink); }
.paste-open { justify-self: start; }

/* Balls shrink to fit one line */
.balls.nowrap { flex-wrap: nowrap; gap: clamp(3px, 1vw, 6px); }
.balls.nowrap .ball { width: clamp(28px, 8.4vw, 40px); height: clamp(28px, 8.4vw, 40px); font-size: clamp(.78rem, 2.6vw, 1rem); }
.gen-out .balls { flex-wrap: nowrap; gap: 4px; }
.gen-out .ball { width: 32px; height: 32px; font-size: .85rem; border-width: 0; }
@media (max-width: 360px) { .gen-out .ball { width: 28px; height: 28px; font-size: .78rem; } }
@media (min-width: 641px) and (max-width: 1060px) { .gen-out .ball { width: 28px; height: 28px; font-size: .78rem; } .gen-out .balls { gap: 3px; } }

/* Scores strip stays inside its box */
.seg-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.seg-scroll::-webkit-scrollbar { display: none; }
.scores { grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }

/* Paste box */
.paste-box { display: grid; gap: 12px; padding: 14px; margin-top: 4px; border: 1px dashed #c9d1ea; border-radius: 12px; background: #fafbff; }
.paste-box label { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; }
.paste-box small { font-weight: 400; }
.paste-preview { display: grid; gap: 8px; min-height: 0; }
.paste-preview:empty { display: none; }
.paste-msg:empty { display: none; }
.paste-msg { padding: 8px 10px; border-radius: 8px; background: #fdeaea; color: #962727; }
.paste-msg.good { background: var(--green-soft); color: #0b6b37; }
.paste-box .seg { margin-bottom: 0; }
.log { background: var(--soft); border-radius: 10px; padding: 10px 12px; font-size: .8rem; white-space: pre-wrap; margin: 10px 0 0; }

/* Player code */
.my-code { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.code-lg { font-size: 1.15rem; padding: 4px 10px; }

/* Smaller phones */
@media (max-width: 480px) {
  .main { padding-top: 14px; }
  .card { padding: 15px; border-radius: 12px; }
  .hero { padding-top: 6px; }
  .hero h1 { font-size: 1.55rem; }
  .nd-jack { font-size: 1.6rem; }
  .profile-form { gap: 12px; }
  .avatar-lg { width: 70px; height: 70px; }
  .grid52 { gap: 6px; }
  .cell span { font-size: .88rem; }
  .ticket-line .balls, .official .balls { flex-wrap: nowrap; }
  .ticket-line .ball, .official .ball { width: clamp(26px, 8vw, 31px); height: clamp(26px, 8vw, 31px); font-size: .8rem; }
  .pool-switch { max-width: 62%; font-size: 1rem; }
  .weeknav { gap: 4px; }
  .weeknav .center { font-size: .9rem; }
  .player { gap: 10px; }
  .paid-btn { padding: 7px 10px; }
}
.paste-box, .paste-box * { min-width: 0; }
.paste-box input[type=date] { width: 100%; }
.ticket-line { flex-wrap: wrap; row-gap: 4px; }
@media (max-width: 360px) {
  .balls.nowrap { gap: 2px; }
  .balls.nowrap .ball { width: 26px; height: 26px; font-size: .74rem; }
  .balls.nowrap .plus { font-size: .8rem; }
}
.picker-bar { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.footer { padding-bottom: calc(30px + env(safe-area-inset-bottom)); }

/* ===== v4: new home page ===== */
/* Results halves never overlap (your fix) */
.res { grid-template-columns: minmax(0, 1fr); }
.res .balls.nowrap { flex-wrap: wrap; }

.countdown-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin: -4px 0 14px; padding: 8px 12px; background: var(--soft); border-radius: 10px; font-size: .86rem; color: var(--muted); }
.cd-item strong { color: var(--ink); }
.cd-max strong::before, .cd-649 strong::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--brand); }
.cd-649 strong::before { background: #12a150; }
.hero-simple { display: block; text-align: center; padding: 18px 0 22px; }
.hero-simple p { max-width: 520px; margin: 0 auto 14px; }
.hero-simple .row-btns { justify-content: center; }

/* Lucky spin */
.spin-intro { margin-top: 0; }
.spin-layout { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 700px) { .spin-layout { grid-template-columns: minmax(0, 1fr); } }
.spin-main { display: grid; justify-items: center; gap: 8px; text-align: center; }
.spin-big { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; font-size: 3.6rem; font-weight: 800; letter-spacing: -.02em; color: #fff; background: radial-gradient(circle at 35% 30%, #5576e6, var(--brand) 60%, #142b80); box-shadow: 0 10px 24px rgba(31, 63, 174, .25); font-variant-numeric: tabular-nums; }
.spin-big.is-mine { background: radial-gradient(circle at 35% 30%, #3fd07f, var(--green) 60%, #0b6b37); box-shadow: 0 10px 24px rgba(18, 161, 80, .3); }
.spin-big.pop { animation: spinpop .35s ease-out; }
@keyframes spinpop { 0% { transform: scale(.82) rotate(-12deg); } 70% { transform: scale(1.06) rotate(3deg); } 100% { transform: scale(1); } }
.spin-count { color: var(--muted); font-size: .92rem; }
.spin-count span { color: var(--ink); font-weight: 800; font-size: 1.15rem; }
.spin-btns { justify-content: center; }
.btn-lg { padding: 13px 34px; font-size: 1.1rem; border-radius: 12px; }
.spin-pick-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.mini52 { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 4px; }
@media (max-width: 480px) { .mini52 { grid-template-columns: repeat(9, minmax(0, 1fr)); } }
.mini { border: 1px solid #d6d9e3; background: #fff; border-radius: 7px; padding: 6px 0; font: inherit; font-size: .78rem; font-weight: 700; color: var(--ink); cursor: pointer; font-variant-numeric: tabular-nums; }
.mini.on { background: var(--green); border-color: var(--green); color: #fff; }
.mine-list, .rep-list { display: grid; gap: 6px; }
.mine-list { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.mine-row, .rep-row { display: flex; align-items: center; gap: 8px; font-size: .88rem; }
.rep-row { padding: 6px 0; border-top: 1px solid var(--line); }
.rep-row:first-child { border-top: 0; }
.linkish { border: 0; background: none; color: var(--brand); padding: 6px 0; cursor: pointer; font: inherit; }

/* Generators */
.gen-card .gen-out { min-height: 48px; align-content: start; }
.gen-card { display: flex; flex-direction: column; }
.gen-card .row-btns { margin-top: auto; }
.gen-out .balls.nowrap .ball { width: clamp(26px, 8vw, 36px); height: clamp(26px, 8vw, 36px); font-size: clamp(.74rem, 2.4vw, .9rem); }

/* Group / example */
.group-card h3 { margin-top: 14px; }
.tag-example { background: #eef1ff; color: var(--brand); }
.is-example { border-style: dashed; border-color: #c9d1ea; }
.group-switch { width: auto; max-width: 60%; padding: 6px 10px; }
.players-head { margin-top: 10px; margin-bottom: 0; }
.players-head h3 { margin: 0; }
.seg-sm { margin: 0; }
.seg-sm button { padding: 5px 10px; font-size: .8rem; }
.players-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); column-gap: 18px; }
.players-grid .player:nth-child(-n+4) { border-top: 0; }
@media (max-width: 520px) { .players-grid .player:nth-child(n+2) { border-top: 1px solid var(--line); } }
.share.small { margin-top: 4px; }

/* How it works */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 700px) { .steps { grid-template-columns: minmax(0, 1fr); } }
.steps li { display: flex; gap: 12px; align-items: flex-start; }
.steps p { margin: 4px 0 0; }
.step-n { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--gold); color: var(--ink); font-weight: 800; display: grid; place-items: center; }

/* Odds, split, birthday */
.odds-big { font-size: 1.7rem; font-weight: 800; color: var(--brand); letter-spacing: -.01em; line-height: 1.2; }
.form.compact { gap: 10px; }
.split-out { margin-top: 12px; min-height: 48px; }
.split-big { font-size: 1.6rem; font-weight: 800; color: var(--green); }
.bday-dates { display: grid; gap: 8px; margin-bottom: 10px; }
#bday .seg { margin-bottom: 10px; }

/* Results entry (leaders) */
.howto { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.enter-results { border-top: 1px dashed var(--line); padding-top: 8px; }
.enter-results p { margin: 0 0 8px; }
.leader-tools { margin-top: 10px; }
.inline-jackpot { display: flex; gap: 6px; align-items: center; margin: 0; flex: 1; min-width: 220px; }
.inline-jackpot input { padding: 7px 10px; }
.inline-msg { color: var(--red); }
/* v5: spin list stays a fixed size; scroll inside it */
.scroll-box { max-height: 300px; overflow-y: auto; overscroll-behavior: contain; padding-right: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; }
.mine-list { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
#split-go { margin-top: 12px; }
#spin-pick-status .btn-sm { padding: 4px 12px; }

/* v6: support footer + player ideas */
.support-box { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px 28px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 8px; }
@media (max-width: 700px) { .support-box { grid-template-columns: minmax(0, 1fr); } }
.support-text p { margin: 4px 0 0; color: var(--muted); }
.support-actions { display: grid; gap: 10px; }
.donate-line { display: grid; gap: 2px; }
.donate-email { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.autism-link { display: block; padding: 9px 12px; border-radius: 10px; background: #eef4ff; color: #1d4ed8; }
.autism-link:hover { text-decoration: none; background: #e2ecff; }
.ideas .idea h3 { margin-top: 0; }
.quick-spin { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.spin-big.spin-sm { width: 76px; height: 76px; font-size: 1.9rem; }
#pb-out { min-height: 40px; margin-bottom: 8px; }
.legend .ball.xs { flex: none; }
/* v7: birthday numbers with reasons */
.bday-label { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; margin-bottom: 10px; }
.bday-result { display: flex; flex-wrap: wrap; gap: 10px 12px; margin: 6px 0 10px; }
.bday-item { display: grid; justify-items: center; gap: 3px; width: 64px; text-align: center; line-height: 1.2; }
.bday-line { margin-top: 4px; }

/* v8: compact spin — ball, buttons and your 7 numbers fit on one phone screen */
.spin-stage { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 6px 0 14px; }
.spin-controls { display: grid; gap: 8px; min-width: 150px; }
.spin-controls .spin-count { text-align: center; }
.spin-big { width: 130px; height: 130px; font-size: 3.1rem; flex: none; }
@media (max-width: 480px) {
  .spin-stage { gap: 14px; }
  .spin-big { width: 112px; height: 112px; font-size: 2.7rem; }
  .spin-controls { min-width: 0; flex: 1; max-width: 190px; }
  .spin-controls .btn-lg { padding: 12px 10px; }
}
.my7 { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; background: var(--soft); }
.my7-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.my7-slots { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.slot { display: grid; justify-items: center; gap: 3px; }
.slot .ball.sm { width: 34px; height: 34px; font-size: .85rem; background: #fff; }
.slot .ball.sm.hit { background: var(--green); }
.slot-n { font-size: .78rem; font-weight: 700; color: var(--muted); }
.slot.got .slot-n { color: var(--green); }
.slot.just .ball { animation: spinpop .45s ease-out; box-shadow: 0 0 0 4px rgba(18, 161, 80, .25); }
.slot.empty { width: 34px; height: 34px; justify-self: center; border: 1.5px dashed #b7bfd6; border-radius: 50%; background: #fff; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; }
@media (max-width: 360px) { .slot .ball.sm, .slot.empty { width: 30px; height: 30px; font-size: .78rem; } }
.rep-head { display: flex; justify-content: space-between; align-items: baseline; }
.rep-head h3 { margin: 6px 0 6px; }
#spin-repeats.scroll-box { max-height: 220px; }
.spin-card .spin-btns { margin-top: 10px; }

/* Chooser sheet: bottom sheet on phones, centered box on bigger screens */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none !important; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(20, 26, 46, .45); }
.sheet-panel { position: relative; width: 100%; max-width: 560px; background: #fff; border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px rgba(0, 0, 0, .15); animation: sheetup .2s ease-out; max-height: 85vh; overflow: auto; }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet-panel { border-radius: 16px; } }
@keyframes sheetup { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.sheet-btns { justify-content: flex-end; margin-top: 12px; }
.sheet .mini52 { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 520px) { .sheet .mini52 { grid-template-columns: repeat(10, minmax(0, 1fr)); } }
.sheet .mini { padding: 9px 0; font-size: .9rem; }
body.sheet-open { overflow: hidden; }
