/* App-shell styles: mobile-first, one-handed reach, 44px targets everywhere. */
.app-body { padding-bottom: calc(4.5rem + env(safe-area-inset-bottom)); background: var(--paper); }
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1rem; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--paper); z-index: 20;
}
.icon-btn {
  position: relative; background: none; border: 1px solid var(--line); color: var(--ink);
  border-radius: 12px; min-width: 44px; min-height: 44px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.notif-dot {
  position: absolute; top: 8px; right: 8px; width: 9px; height: 9px;
  background: var(--accent); border-radius: 50%;
}
.app-view { max-width: 38rem; margin: 0 auto; padding: 1.25rem 1rem 2rem; min-height: 60vh; }
.app-view:focus { outline: none; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.view-enter { animation: view-in .22s ease both; }
.app-noscript { max-width: 38rem; margin: 2rem auto; padding: 0 1rem; }

/* Bottom tab bar — thumb territory */
.tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-bar a {
  display: flex; flex-direction: column; align-items: center; gap: .15rem;
  padding: .55rem 0 .5rem; min-height: 56px; text-decoration: none;
  color: var(--muted); font-size: .72rem; font-weight: 600;
}
.tab-bar a svg { width: 24px; height: 24px; }
.tab-bar a[aria-current="page"] { color: var(--brand-deep); }
.tab-scan svg { background: var(--brand-deep); color: #fff; border-radius: 10px; padding: 3px; box-sizing: content-box; }
.tab-scan[aria-current="page"] svg { background: var(--brand); }

/* Cards & lists */
.t-card {
  display: block; width: 100%; text-align: left; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem;
  margin-bottom: .8rem; text-decoration: none; color: var(--ink); cursor: pointer;
  transition: transform .12s ease, border-color .15s ease, box-shadow .15s ease;
}
.t-card:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-1px); }
.t-card:active { transform: translateY(0) scale(.99); }
.t-row { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; }
.t-game { font-weight: 700; }
.t-date { color: var(--muted); font-size: .9rem; }
.t-nums { font-family: var(--font-display); font-size: 1.05rem; margin-top: .3rem; overflow-wrap: anywhere; }
.t-nums .sp { color: var(--brand-deep); font-weight: 700; }

/* Status badges: color + text + shape (never color alone) */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font: 600 .78rem var(--font-body); border-radius: 999px; padding: .2rem .7rem;
  border: 1.5px solid transparent;
}
.badge::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.badge-pending { color: #6B5B17; background: #FBF3D2; border-color: #E5D58A; }
.badge-checked { color: #44504A; background: #EDEEEA; border-color: #CFD4CC; }
.badge-winner { color: #0A5C44; background: #DCF0E6; border-color: #9CCDB7; }
.badge-expired { color: #6E6E6E; background: #F0EEE9; border-color: #D8D4CB; }
.badge-needs_review { color: #8A3E08; background: #FDEAD7; border-color: #ECBE92; }

.filter-bar { display: flex; gap: .5rem; flex-wrap: wrap; margin: .75rem 0 1.1rem; }
.chip {
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: .45rem 1rem; min-height: 40px; font: 500 .9rem var(--font-body); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* Empty states: every one an invitation */
.empty {
  text-align: center; padding: 2.5rem 1.5rem; border: 2px dashed var(--line);
  border-radius: var(--radius); margin: 1.5rem 0; background: var(--surface);
}
.empty svg { margin-bottom: .75rem; }
.empty h2 { margin: 0 0 .35rem; font-size: 1.25rem; }
.empty p { color: var(--muted); margin-bottom: 1.1rem; }

/* Forms */
.f-field { display: grid; gap: .3rem; margin-bottom: 1rem; }
.f-field label { font-weight: 600; font-size: .92rem; }
.f-field input, .f-field select, .f-field textarea {
  font: inherit; padding: .7rem .8rem; border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; min-height: 44px; width: 100%; color: var(--ink);
}
.f-error { color: var(--danger); font-size: .9rem; margin: .25rem 0 0; }
.f-hint { color: var(--muted); font-size: .85rem; }
.btn-block { width: 100%; }
.btn-google {
  background: #FFFFFF; color: #1F1F1F; border: 1.5px solid var(--line);
  margin: .9rem 0 .2rem;
}
.btn-google:hover { background: #F7F7F7; color: #1F1F1F; }
.auth-divider {
  display: flex; align-items: center; gap: .8rem; margin: 1.1rem 0;
  color: var(--muted); font-size: .85rem;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: .7rem; font: 600 .95rem var(--font-body); cursor: pointer; min-height: 44px; color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* Scan flow */
.scan-drop {
  border: 2.5px dashed var(--brand); border-radius: var(--radius); background: var(--brand-tint);
  padding: 2.5rem 1.25rem; text-align: center; cursor: pointer; width: 100%;
}
.scan-drop:hover { background: #DFEDE5; }
.scan-preview { max-width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.line-edit { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-bottom: .6rem; }
.line-edit input {
  width: 3.4rem; min-height: 44px; text-align: center; font: 600 1.05rem var(--font-body);
  border: 1.5px solid var(--line); border-radius: 10px; color: var(--ink);
}
.line-edit input.sp-input { border-color: var(--brand-deep); background: var(--brand-tint); }
.line-label { font-weight: 700; width: 1.4rem; }
.confidence-low { border-left: 4px solid var(--accent); padding-left: .75rem; }

/* Loading: intentional, not an afterthought */
.loading { display: grid; place-items: center; gap: .9rem; padding: 3rem 1rem; text-align: center; color: var(--muted); }
.spinner { width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand-deep); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { border-radius: var(--radius); background: linear-gradient(100deg, #EFECE5 40%, #F7F4EE 50%, #EFECE5 60%); background-size: 200% 100%; animation: shimmer 1.4s infinite; height: 5.2rem; margin-bottom: .8rem; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- THE WIN MOMENT ------------------------------------------------------ */
.win-overlay {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 38, 28, .92); padding: 1.25rem;
}
.win-card {
  background: var(--paper); border-radius: 20px; max-width: 24rem; width: 100%;
  padding: 2.25rem 1.75rem 1.75rem; text-align: center; position: relative; overflow: hidden;
}
.win-kicker { color: var(--brand-deep); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: .75rem; margin: 0; }
.win-amount { font-family: var(--font-display); font-size: clamp(2.6rem, 11vw, 3.6rem); margin: .35rem 0 .2rem; color: var(--ink); font-weight: 700; }
.win-sub { color: var(--muted); margin-bottom: 1.4rem; }
.win-actions { display: grid; gap: .6rem; }
.win-verify { font-size: .82rem; color: var(--muted); margin-top: 1rem; }
#confetti-canvas { position: absolute; inset: 0; pointer-events: none; }

/* Share card preview */
.share-preview { width: 100%; border-radius: 12px; border: 1px solid var(--line); }

/* Matched-number balls — the "show your work" moment competitors don't have.
   Match state is shown by fill + ring + a check glyph, never color alone. */
.mini-balls { display: flex; flex-wrap: wrap; gap: .45rem; list-style: none; padding: 0; margin: .4rem 0 .9rem; }
.mini-ball {
  width: 2.55rem; height: 2.55rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--line); background: var(--surface);
  font: 700 1rem var(--font-display); color: var(--ink); position: relative;
}
.mini-ball.hit { border-color: var(--brand); background: var(--brand-tint); }
.mini-ball.hit::after {
  content: "✓"; position: absolute; top: -7px; right: -5px;
  width: 1.05rem; height: 1.05rem; border-radius: 50%;
  background: var(--brand-deep); color: var(--paper);
  font: 700 .68rem var(--font-body); display: flex; align-items: center; justify-content: center;
}
.mini-ball.sp { border-style: dashed; }
.mini-ball.sp.hit { border-style: solid; background: var(--accent-soft); border-color: var(--accent); }
.mini-ball.sp.hit::after { background: var(--accent); color: #fff; }
.line-result { font-size: .85rem; color: var(--muted); margin: -0.5rem 0 1rem; }
.line-result strong { color: var(--brand-deep); }

/* Live countdown chips */
.countdown { font-variant-numeric: tabular-nums; color: var(--brand-deep); font-weight: 700; }

/* Win-card extras */
.win-mute {
  position: absolute; top: .7rem; right: .7rem; z-index: 2;
  background: none; border: 1px solid var(--line); border-radius: 10px;
  min-width: 40px; min-height: 40px; cursor: pointer; color: var(--muted);
}
.win-upsell { font-size: .88rem; color: var(--muted); margin-top: .9rem; }
.win-upsell a { color: var(--brand-deep); font-weight: 600; }

/* Stat blocks (tracker) */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin: 1rem 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.stat b { display: block; font: 700 1.5rem var(--font-display); }
.stat span { color: var(--muted); font-size: .85rem; }
.stat-net-pos b { color: var(--brand-deep); }
.stat-net-neg b { color: var(--ink); }

/* Notifications drawer */
.notif-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 1rem; }
.notif-item { padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
.notif-item:last-child { border-bottom: 0; }
.notif-item h3 { margin: 0 0 .2rem; font-size: .98rem; font-family: var(--font-body); }
.notif-item p { margin: 0; color: var(--muted); font-size: .9rem; }

/* Banner ad slot — free tier results pages only, one, tasteful */
.ad-slot {
  border: 1px dashed var(--line); border-radius: 10px; padding: .8rem 1rem;
  font-size: .85rem; color: var(--muted); margin: 1.25rem 0; text-align: center;
}
.ad-slot a { color: var(--brand-deep); }

.list-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .8rem; }
.upgrade-note {
  background: var(--brand-tint); border: 1px solid #BCD9CB; border-radius: var(--radius);
  padding: 1rem 1.2rem; margin: 1rem 0;
}
@media (min-width: 700px) {
  .app-view { max-width: 44rem; }
}
