:root {
  /* Dark theme by default; green retained as the brand motif/accent. */
  --green: #17a06d;
  --green-dark: #0f7d54;
  --bg: #0e1411;
  --card: #19211c;
  --surface-2: #243029;
  --ink: #eaf0ec;
  --muted: #97a69d;
  --line: #2c3831;
  --accent: #e8b500;
  --accent-soft: #14301f;   /* soft green tint for subtle fills on dark */
  --soon-bg: #3a3320;
  --soon-ink: #e8c766;
  --switch-off: #3a473f;
  --on-green: #ffffff;      /* text/knobs sitting on green */
  --danger: #e5524b;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

/* Header — "Kit Panels" (build 2026-06-15m) */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: calc(56px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  background: var(--green-dark);
  border-bottom: 3px solid var(--accent);
}
/* faint vertical kit panels behind a dark-green scrim */
.app-header::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background: repeating-linear-gradient(90deg,
    #a3173b 0 34px, #14306b 34px 68px, #0f7d54 68px 102px, #e8b500 102px 136px, #ffffff 136px 170px);
}
.app-header::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, rgba(8, 40, 28, .80), rgba(8, 40, 28, .55));
}
.app-header > * { position: relative; z-index: 2; }

.brand { display: flex; align-items: center; gap: 11px; }
.brand-logo { width: 38px; height: 38px; flex: 0 0 auto; display: block; }
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: .2px; }
/* Avatar profile entry point — rendered as a football */
.avatar-btn {
  width: 36px; height: 36px; flex: 0 0 auto; padding: 0; overflow: hidden;
  border-radius: 50%; border: none; background: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.avatar-btn svg { width: 100%; height: 100%; display: block; }

/* View area */
.view { flex: 1; padding: 16px; padding-bottom: 88px; max-width: 720px; width: 100%; margin: 0 auto; }
.page-title { font-size: 22px; font-weight: 800; margin: 4px 0 14px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 22px 0 8px; font-weight: 700; }

/* Cards */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; }
.card h3 { margin: 0 0 6px; font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* Forms */
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; }
input, select {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 16px; background: var(--surface-2); color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--green); border-color: var(--green); }

/* Typeahead combobox: a text input with a filtered, tappable dropdown panel.
   Type to narrow the squad list; works reliably on mobile (unlike <datalist>). */
.combo { position: relative; }
.combo-panel {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  max-height: 240px; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--surface-2); border: 1.5px solid var(--green); border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
}
.combo-opt { padding: 12px 14px; font-size: 16px; color: var(--ink); border-bottom: 1px solid var(--line); }
.combo-opt:last-child { border-bottom: none; }
.combo-opt:active { background: var(--green); color: var(--on-green); }

/* Buttons */
button { font-family: inherit; cursor: pointer; }
.btn {
  border: none; background: var(--green); color: var(--on-green); font-weight: 700;
  padding: 13px 16px; border-radius: 12px; font-size: 16px; width: 100%;
}
.btn:active { background: var(--green-dark); }
.btn.secondary { background: var(--surface-2); color: var(--ink); border: 1.5px solid var(--green); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); }
.btn.small { width: auto; padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }

/* Pills / chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px;
  border-radius: 999px; background: var(--surface-2); font-size: 13px; font-weight: 600; border: none; color: var(--ink);
}
.chip.on { background: var(--green); color: var(--on-green); }
.chip.soon { background: var(--soon-bg); color: var(--soon-ink); }
.toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.toggle:last-child { border-bottom: none; }
.switch { width: 46px; height: 28px; border-radius: 999px; background: var(--switch-off); position: relative; border: none; flex: 0 0 auto; }
.switch.on { background: var(--green); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on::after { left: 21px; }

/* Lists */
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 8px;
}
.list-item .grow { flex: 1; min-width: 0; }
.list-item .grow .name { font-weight: 700; }
.list-item .grow .sub { font-size: 13px; color: var(--muted); }
.star { font-size: 18px; background: none; border: none; padding: 4px; }

/* Sticker grid */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.team-tile {
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 14px;
  text-align: center; border: none; position: relative;
}
.team-tile.locked { opacity: .55; }
.team-tile .kit { font-size: 30px; }
.team-tile .kit-coloured {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 50%; font-size: 13px; font-weight: 800;
  letter-spacing: .5px; margin: 0 auto;
}
.team-tile .tname { font-weight: 700; font-size: 14px; margin-top: 6px; }
.team-tile .tcount { font-size: 12px; color: var(--muted); }
.badge-soon { position: absolute; top: 8px; right: 8px; font-size: 10px; background: var(--soon-bg); color: var(--soon-ink); padding: 2px 6px; border-radius: 6px; font-weight: 700; }

.number-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; }
.num {
  aspect-ratio: 1; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; background: var(--surface-2); color: var(--muted); font-size: 16px; position: relative;
}
.num.filled { background: var(--green); color: var(--on-green); }
.num .who { position: absolute; bottom: 3px; left: 0; right: 0; font-size: 8px; font-weight: 600; opacity: .9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 3px; }

/* Tally bars */
.tally-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tally-row .tl-name { width: 130px; font-size: 14px; font-weight: 600; flex: 0 0 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { flex: 1; height: 22px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--green); }
.tally-row .tl-num { width: 32px; text-align: right; font-weight: 700; }

/* Tabbar */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom); z-index: 10;
}
.tab {
  flex: 1; border: none; background: none; padding: 6px 0 8px; font-size: 11px; font-weight: 600;
  color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-height: 44px;
}
.tab .tab-icon {
  font-size: 18px; width: 46px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: 999px; transition: background .15s;
}
.tab.active { color: var(--green); }
.tab.active .tab-icon { background: var(--accent-soft); }

/* Misc */
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 96px;
  background: var(--surface-2); color: var(--ink); padding: 11px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; opacity: 0; transition: opacity .2s, bottom .2s; z-index: 30; pointer-events: none;
}
.toast.show { opacity: 1; bottom: 104px; }
.award { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.award:last-child { border-bottom: none; }
.award .medal { font-size: 22px; }
.seg { display: flex; gap: 6px; background: var(--surface-2); padding: 4px; border-radius: 12px; margin-bottom: 14px; }
.seg button { flex: 1; border: none; background: none; padding: 9px; border-radius: 9px; font-weight: 700; color: var(--muted); }
.seg button.active { background: var(--green); color: var(--on-green); box-shadow: var(--shadow); }

.build-stamp { text-align: center; font-size: 11px; color: var(--muted); padding: 0 16px 78px; }

/* ---- P0 build 2026-06-08: Lattice feedback ---- */

/* Hero / intro (first visit) */
.hero {
  background: linear-gradient(160deg, #0b6e4f 0%, #075e43 60%, #053f2e 100%);
  color: #fff; border-radius: 18px; padding: 30px 22px; text-align: center;
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.hero .hero-mark { font-size: 46px; line-height: 1; }
.hero h1 { font-size: 26px; font-weight: 800; margin: 12px 0 6px; letter-spacing: .3px; }
.hero p { margin: 0 auto 18px; max-width: 30ch; opacity: .92; font-size: 15px; }
.hero .btn { background: var(--accent); color: #16241d; }
.hero .hero-dismiss { background: none; border: none; color: rgba(255,255,255,.85); font-size: 13px; margin-top: 12px; text-decoration: underline; }

/* Primary/secondary CTA hierarchy */
.btn.link {
  background: none; color: var(--green); border: none; width: auto; padding: 10px;
  font-size: 15px; text-decoration: underline; display: block; margin: 6px auto 0;
}

/* Disclosure (Add context) */
.disclosure { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-top: 8px; }
.disclosure > summary {
  list-style: none; cursor: pointer; padding: 13px 14px; font-weight: 700; color: var(--green);
  display: flex; align-items: center; gap: 8px;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before { content: "＋"; font-weight: 800; }
.disclosure[open] > summary::before { content: "－"; }
.disclosure .disclosure-body { padding: 0 14px 8px; }

/* Two-up row (Country/Team at desktop) */
.field-pair { display: grid; grid-template-columns: 1fr; gap: 0; }
@media (min-width: 560px) {
  .field-pair { grid-template-columns: 1fr 1fr; gap: 12px; }
}

/* Team picker + live home-shirt kit badge */
.team-row { display: flex; align-items: center; gap: 8px; }
.team-row select { flex: 1; min-width: 0; }
.kit-badge { flex: 0 0 auto; line-height: 0; }
.kit-badge svg { width: 34px; height: 34px; display: block; }
.kit-badge.sm svg { width: 24px; height: 24px; }
.confirm-card .ok-line .kit-badge { display: inline-flex; }

/* Tighter form rhythm */
.card.compact label { margin: 9px 0 4px; }
.card.compact label:first-child { margin-top: 0; }

/* Sticker Book progress */
.progress { height: 7px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 7px; }
.progress > span { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.crest-row { display: flex; gap: 4px; margin-top: 8px; flex-wrap: nowrap; overflow: hidden; }
.crest {
  min-width: 22px; height: 22px; padding: 0 5px; border-radius: 6px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 800;
  letter-spacing: .3px; background: var(--green); color: #fff;
}
.crest.locked { background: var(--surface-2); color: var(--muted); }
.crest.more { background: none; color: var(--muted); font-size: 11px; width: auto; }

/* Coming soon section + rows */
.soon-section-toggle {
  width: 100%; text-align: left; background: none; border: none; color: var(--muted);
  font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .6px;
  padding: 16px 2px 8px; display: flex; align-items: center; gap: 8px;
}
.list-item.soon-row { opacity: .58; }

/* Example/preview season card */
.preview-card {
  border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 14px;
  background: var(--surface-2); margin-top: 14px;
}
.preview-card .pc-label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; margin-bottom: 8px; }

/* Inline option descriptors (Seasons education) */
.descriptor { font-size: 13px; color: var(--muted); margin: 2px 0 0; }
.lead { font-size: 15px; color: var(--ink); margin: -6px 0 16px; }
.info-chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--green);
  padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 700;
}

/* Success confirmation with deep links */
.confirm-card {
  background: var(--accent-soft); border: 1px solid var(--green-dark); border-radius: 12px; padding: 14px; margin-bottom: 12px;
}
.confirm-card .ok-line { font-weight: 800; color: var(--green); display: flex; align-items: center; gap: 8px; }
.confirm-card .links { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.confirm-card .links button { flex: 1; min-width: 130px; }

/* Profile sheet (bottom sheet modal) */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--card); width: 100%; max-width: 720px; border-radius: 18px 18px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.2);
}
.sheet .sheet-grip { width: 40px; height: 4px; border-radius: 999px; background: var(--line); margin: -6px auto 14px; }
.sheet h2 { margin: 0 0 4px; font-size: 20px; }
.sheet .stat-row { display: flex; gap: 12px; margin: 16px 0; }
.sheet .stat-box { flex: 1; background: var(--bg); border-radius: 12px; padding: 12px; text-align: center; }
.sheet .stat-box .n { font-size: 22px; font-weight: 800; color: var(--green); }
.sheet .stat-box .l { font-size: 12px; color: var(--muted); }

@media (min-width: 560px) {
  .sheet { border-radius: 18px; margin-bottom: 40px; }
  .sheet-backdrop { align-items: center; }
}

/* ---- P0 build 2026-06-08b: roster / number completion ---- */
.num-player-list { max-height: 50vh; overflow-y: auto; margin: 8px 0 14px; }
.num-player {
  display: flex; align-items: center; gap: 10px; padding: 10px 4px;
  border-bottom: 1px solid var(--line); font-size: 15px; color: var(--muted);
}
.num-player:last-child { border-bottom: none; }
.num-player .np-mark { width: 18px; text-align: center; font-weight: 800; color: var(--switch-off); }
.num-player.got { color: var(--ink); }
.num-player.got .np-mark { color: var(--green); }
.num-player.got .np-name { font-weight: 600; }
/* number cell with % needs a touch more room for two-digit n + % */
.num .who { font-size: 9px; }
