/* App shell: top bar, bottom tab bar, view transitions. */
#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px 14px; background: var(--brand); color: var(--on-brand); }
.topbar .home { display: flex; align-items: center; gap: 10px; text-decoration: none; min-height: 44px; min-width: 0; flex: 1; }
.topbar .crest { width: 36px; height: 36px; }
.topbar .title { font: 800 var(--fs-4)/1 var(--display); text-transform: uppercase; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { font-size: var(--fs-1); opacity: .75; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.topbar .btn { background: color-mix(in srgb, var(--on-brand) 14%, transparent); color: var(--on-brand); border-color: transparent; min-height: 44px; padding: 0 12px; font-size: var(--fs-2); }
.topbar .btn.install { background: var(--accent); color: var(--on-accent); }
#view { flex: 1; animation: view-in .22s ease; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); }
.tabbar a, .tabbar button { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; min-height: 52px; font-size: var(--fs-1); font-weight: 700; color: var(--ink-2); text-decoration: none; background: none; border: 0; cursor: pointer; border-radius: 12px; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tabbar [aria-current="page"] { color: var(--ink); }
.tabbar [aria-current="page"] svg { stroke-width: 2.4; }
.tabbar .main-tab span.ico { width: 46px; height: 46px; margin-top: -18px; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; box-shadow: 0 6px 16px rgb(0 0 0 / .25); border: 3px solid var(--surface); }
@media (min-width: 900px) {
  .tabbar { position: sticky; top: 60px; bottom: auto; order: -1; border-top: 0; border-bottom: 1px solid var(--line); grid-auto-columns: max-content; justify-content: center; gap: 6px; padding: 4px; }
  .topbar { order: -2; }
  .tabbar a, .tabbar button { grid-auto-flow: column; align-items: center; gap: 8px; padding: 6px 14px; min-height: 40px; font-size: var(--fs-2); }
  .tabbar .main-tab span.ico { width: auto; height: auto; margin: 0; background: none; color: inherit; box-shadow: none; border: 0; }
  .page { padding-bottom: 40px; }
}
body.immersive .tabbar, body.immersive .topbar { display: none; }
.demo-strip { font-size: var(--fs-1); text-align: center; padding: 5px 10px; background: var(--surface-2); color: var(--ink-2); }

/* Shared football components */
.fx { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); text-decoration: none; }
.fx:first-child { border-top: 0; }
.fx .side { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 650; }
.fx .side.away { flex-direction: row-reverse; text-align: right; }
.fx .side span.n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx .crest { width: 26px; height: 26px; }
.fx .mid { text-align: center; min-width: 64px; }
.fx .score { font: 800 var(--fs-5)/1 var(--display); font-variant-numeric: tabular-nums; }
.fx .when { font: 700 var(--fs-4)/1 var(--display); }
.fx .meta { grid-column: 1 / -1; font-size: var(--fs-1); color: var(--ink-2); text-align: center; margin-top: -4px; }
.form-dots { display: inline-flex; gap: 3px; }
.form-dots i { width: 16px; height: 16px; border-radius: 4px; font: 700 var(--fs-1)/16px var(--font); text-align: center; color: #fff; font-style: normal; }
.form-dots .W { background: var(--good); } .form-dots .D { background: #8a8f98; } .form-dots .L { background: var(--bad); }
.zone-up td:first-child { box-shadow: inset 3px 0 0 var(--good); } .zone-po td:first-child { box-shadow: inset 3px 0 0 var(--info); } .zone-down td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.club-card { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
.club-card .crest { width: 54px; height: 54px; }
.club-card .swatch { height: 6px; border-radius: 99px; margin-top: 8px; }
.hero .crest.big { width: 92px; height: 92px; filter: drop-shadow(0 6px 14px rgb(0 0 0 / .35)); }
.hero h1 { text-wrap: balance; }
.hero .pitch-lines { position: absolute; inset: 0; opacity: .1; pointer-events: none; background:
  radial-gradient(circle at 85% 50%, transparent 58px, currentColor 59px, currentColor 61px, transparent 62px),
  linear-gradient(90deg, transparent calc(85% - 1px), currentColor calc(85% - 1px), currentColor calc(85% + 1px), transparent calc(85% + 1px)); }
.cta-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.next-match { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; text-align: center; }
.next-match .crest { width: 64px; height: 64px; margin: 0 auto 6px; }
.next-match .vs { font: 800 var(--fs-6)/1 var(--display); }
.sponsor-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.board { flex: none; padding: 9px 16px; border-radius: 6px; font: 800 var(--fs-4)/1.1 var(--display); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; border-bottom: 4px solid rgb(0 0 0 / .25); text-decoration: none; }
.level { border-left: 4px solid var(--brand); padding-left: 14px; }
.more-list a, .more-list button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 4px; background: none; border: 0; border-top: 1px solid var(--line); text-align: left; text-decoration: none; cursor: pointer; font-weight: 650; min-height: 52px; }
.more-list > :first-child { border-top: 0; }
.more-list .d { display: block; font-weight: 400; font-size: var(--fs-1); color: var(--ink-2); }
.topbar .title, .topbar .sub { display: block; }
.card.club-card { display: grid; }
.fx .side span.n { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.15; font-size: var(--fs-2); }
.qr-card { display: flex; gap: 14px; align-items: center; }
.qr-card .qr { flex: none; width: 112px; border-radius: 10px; overflow: hidden; background: #fff; padding: 4px; }
.qr-card.big .qr { width: min(46vw, 200px); }
.qr-card .qr svg { display: block; width: 100%; height: auto; }
.qr-link { overflow-wrap: anywhere; color: var(--ink-2); user-select: all; }
.topbar .home > span:last-child { min-width: 0; }
.next-match .crest { display: block; }
body.immersive .demo-strip { display: none; }
.pyr-div > summary { cursor: pointer; list-style: none; } .pyr-div > summary::-webkit-details-marker { display: none; }
.pyr-div[open] > summary { border-bottom: 1px solid var(--line); }
.cov-bar { display: inline-block; width: 54px; height: 6px; border-radius: 99px; background: var(--surface-2); vertical-align: middle; margin-right: 6px; overflow: hidden; } .cov-bar i { display: block; height: 100%; background: var(--good); }
.feed-line { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.feed-line:first-child { border-top: 0; } .feed-line .t { font: 800 var(--fs-4) var(--display); min-width: 2.2em; }

/* Short screens (small phones): tighter heroes so the main action is in the first screen. */
@media (max-height: 700px) {
  .hero { padding: 16px; }
  .hero h1, .mg-start-top h1 { font-size: var(--fs-5); }
  .hero .crest.big { width: 64px; height: 64px; }
  .mg-start { gap: 10px; margin-top: 8px; }
  .mg-start-top .crest { width: 56px !important; height: 56px !important; }
}
/* Phone held sideways: a real landscape layout. The top bar scrolls away, the tab bar is one
   compact row, and fixed chrome stays well under a quarter of the height (standards 4.0.0 §2.5). */
@media (orientation: landscape) and (max-height: 500px) {
  .topbar { position: static; padding-top: calc(4px + env(safe-area-inset-top)); padding-bottom: 4px; padding-left: calc(14px + env(safe-area-inset-left)); padding-right: calc(12px + env(safe-area-inset-right)); }
  .demo-strip { padding: 2px 10px; }
  .tabbar { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .tabbar a, .tabbar button { display: flex; justify-content: center; align-items: center; gap: 8px; min-height: 44px; padding: 2px 8px; }
  .tabbar svg { width: 20px; height: 20px; }
  .tabbar .main-tab span.ico { width: auto; height: auto; margin: 0; background: none; color: inherit; box-shadow: none; border: 0; }
  .hero { padding: 14px 16px; }
  .hero h1, .mg-start-top h1 { font-size: var(--fs-5); }
  .hero .crest.big { width: 56px; height: 56px; }
}

/* Main-action bar: fixed above the tab bar, padded for safe areas. */
.action-bar { position: fixed; left: 0; right: 0; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 25; padding: 8px max(16px, env(safe-area-inset-left)) 8px max(16px, env(safe-area-inset-right)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.action-bar { display: grid; justify-items: center; }
.action-bar .btn { width: 100%; max-width: 560px; box-shadow: var(--shadow); }
.has-action-bar { padding-bottom: 80px; }
@media (orientation: landscape) and (max-height: 500px) { .action-bar { bottom: calc(54px + env(safe-area-inset-bottom)); padding-top: 4px; padding-bottom: 4px; } }
@media (min-width: 900px) { .action-bar { bottom: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); } }

/* Phones (independent review 27 Nov): the club name gets the header, "All clubs" lives in More;
   league tables show #, club, P, GD and Pts, with W/D/L and form from wider screens up. */
@media (max-width: 480px) { .topbar .all-clubs { display: none; } .table .wide { display: none; } }
.card.flush.table-wrap, .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 480px) {
  .table th, .table td { padding-left: 6px; padding-right: 6px; }
  .table td:not(.num) { white-space: normal; }
  .table td .row { align-items: center; }
}
.table.sticky-first th:first-child, .table.sticky-first td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
.source-credit { order: 99; }
