/* Home screen v2 ("music app" style): hero photo, track-outline covers, driver photos */
#tab-home {
  --h-card: #ffffff;
  --h-ink: #111317;
  --h-ink-2: #5d6470;
  --h-ink-3: #9aa1ab;
  --h-line: #e7e9ee;
  --h-red: #e10600;
  --h-dark-card: #111317;
  --h-radius: 20px;
}
[data-theme="dark"] #tab-home {
  --h-card: #17191d;
  --h-ink: #f2f3f5;
  --h-ink-2: #a6acb6;
  --h-ink-3: #6f7680;
  --h-line: #262a31;
  --h-dark-card: #e10600;
}
#tab-home .h2 { font-family: Manrope, Inter, system-ui, sans-serif; color: var(--h-ink); padding-bottom: 8px; }
#tab-home .h2 .num { font-variant-numeric: tabular-nums; font-family: "JetBrains Mono", ui-monospace, monospace; }
#tab-home .h2 button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* Hero: real track photo */
#tab-home .h2-hero { border-radius: 26px; overflow: hidden; position: relative; min-height: 236px; margin-top: 4px;
  background: #1c1f24 center/cover no-repeat; color: #fff; display: flex; flex-direction: column; justify-content: flex-end; cursor: pointer; }
#tab-home .h2-hero::before { content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.05) 0%, rgba(0,0,0,.15) 35%, rgba(0,0,0,.78) 100%); }
#tab-home .h2-hero > * { position: relative; }
#tab-home .h2-hero .h2-track-bg { position: absolute; right: -10px; top: 20px; width: 70%; opacity: .25; }
#tab-home .h2-hero .h2-track-bg path { fill: none; stroke: #fff; stroke-width: 2.5; stroke-linejoin: round; }
#tab-home .h2-hero-top { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; justify-content: space-between; align-items: center; }
#tab-home .h2-pill { background: rgba(255,255,255,.18); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-radius: 999px; padding: 6px 11px; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
#tab-home .h2-pill.red { background: var(--h-red); }
#tab-home .h2-hero-body { padding: 18px; }
#tab-home .h2-hero-name { font-size: 26px; font-weight: 800; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
#tab-home .h2-hero-name img { width: 30px; height: 20px; border-radius: 4px; object-fit: cover; box-shadow: 0 0 0 1px rgba(255,255,255,.3); }
#tab-home .h2-hero-meta { font-size: 13px; opacity: .85; margin-top: 2px; font-weight: 600; }
#tab-home .h2-count { display: flex; gap: 16px; margin-top: 14px; }
#tab-home .h2-count b { font-size: 30px; font-weight: 700; display: block; line-height: 1; }
#tab-home .h2-count span { font-size: 11px; opacity: .75; font-weight: 600; }

/* Weekend sessions strip */
#tab-home .h2-sessions { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 2px; scrollbar-width: none; }
#tab-home .h2-sessions::-webkit-scrollbar { display: none; }
#tab-home .h2-ses { flex: 0 0 auto; background: var(--h-card); border-radius: 14px; padding: 9px 12px; min-width: 86px; border: 1px solid var(--h-line); }
#tab-home .h2-ses.next { border-color: var(--h-red); box-shadow: inset 0 0 0 1px var(--h-red); }
#tab-home .h2-ses.done { opacity: .55; }
#tab-home .h2-ses .n { font-size: 11px; color: var(--h-ink-3); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
#tab-home .h2-ses.next .n { color: var(--h-red); }
#tab-home .h2-ses .t { font-size: 14px; font-weight: 700; margin-top: 2px; }
#tab-home .h2-ses .d { font-size: 11px; color: var(--h-ink-2); font-weight: 600; }

/* Quick links to the other sections */
#tab-home .h2-quick { display: flex; gap: 8px; margin-top: 14px; }
#tab-home .h2-quick button { flex: 1; background: var(--h-card); border: 1px solid var(--h-line); border-radius: 14px; padding: 11px 8px;
  font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 6px; }
#tab-home .h2-quick svg { width: 16px; height: 16px; color: var(--h-red); }

/* Section header */
#tab-home .h2-sec { display: flex; justify-content: space-between; align-items: center; padding: 26px 4px 12px; }
#tab-home .h2-sec h2 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; color: var(--h-ink); }
#tab-home .h2-sec h2 svg { width: 20px; height: 20px; color: var(--h-red); flex: 0 0 auto; }
#tab-home .h2-sec button { color: var(--h-ink-3); font-size: 14px; font-weight: 700; }

/* Upcoming rounds: track-outline covers */
#tab-home .h2-rail { display: flex; gap: 12px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scroll-padding: 0 16px;
  scroll-snap-type: x mandatory; scrollbar-width: none; }
#tab-home .h2-rail::-webkit-scrollbar { display: none; }
#tab-home .h2-round { flex: 0 0 148px; scroll-snap-align: start; }
#tab-home .h2-cover { height: 148px; border-radius: 20px; background: var(--h-card); border: 1px solid var(--h-line); position: relative;
  overflow: hidden; display: flex; align-items: center; justify-content: center; }
#tab-home .h2-cover svg { width: 82%; height: auto; }
#tab-home .h2-cover path { fill: none; stroke: var(--h-ink); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
#tab-home .h2-cover .r { position: absolute; top: 10px; left: 12px; font-size: 12px; font-weight: 700; color: var(--h-ink-3); }
#tab-home .h2-cover .f { position: absolute; top: 10px; right: 10px; width: 24px; height: 16px; border-radius: 3px; object-fit: cover; }
#tab-home .h2-round.first .h2-cover { background: var(--h-dark-card); border-color: var(--h-dark-card); }
#tab-home .h2-round.first .h2-cover path { stroke: #fff; }
#tab-home .h2-round.first .h2-cover .r { color: rgba(255,255,255,.6); }
#tab-home .h2-round .nm { font-size: 15px; font-weight: 700; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tab-home .h2-round .dt { font-size: 13px; color: var(--h-ink-2); font-weight: 600; }

/* Podium with driver photos */
#tab-home .h2-podium { background: var(--h-card); border-radius: var(--h-radius); padding: 16px 12px 0; display: grid;
  grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 6px; border: 1px solid var(--h-line); overflow: hidden; cursor: pointer; }
#tab-home .h2-pd { text-align: center; min-width: 0; }
#tab-home .h2-pd .ph { height: 104px; display: flex; align-items: flex-end; justify-content: center; border-radius: 16px 16px 0 0; position: relative; overflow: hidden; }
#tab-home .h2-pd.p1 .ph { height: 128px; }
#tab-home .h2-pd .ph img { height: 100%; width: auto; position: relative; }
#tab-home .h2-pd .ph::before { content: ""; position: absolute; inset: 0; background: var(--tc); opacity: .18; }
#tab-home .h2-pd .bar { height: 5px; background: var(--tc); }
#tab-home .h2-pd .pos { font-size: 12px; font-weight: 800; color: var(--h-ink-3); }
#tab-home .h2-pd .who { font-size: 14px; font-weight: 800; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tab-home .h2-pd .gap { font-size: 12px; color: var(--h-ink-2); padding-bottom: 8px; }

/* Standings with avatars */
#tab-home .h2-list { background: var(--h-card); border-radius: var(--h-radius); border: 1px solid var(--h-line); overflow: hidden; cursor: pointer; }
#tab-home .h2-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
#tab-home .h2-item + .h2-item { border-top: 1px solid var(--h-line); }
#tab-home .h2-item .p { width: 18px; font-size: 14px; font-weight: 700; color: var(--h-ink-3); text-align: center; }
#tab-home .h2-ava { width: 44px; height: 44px; border-radius: 14px; overflow: hidden; position: relative; flex: 0 0 auto;
  display: flex; align-items: flex-end; justify-content: center; }
#tab-home .h2-ava::before { content: ""; position: absolute; inset: 0; background: var(--tc); opacity: .22; }
#tab-home .h2-ava img { width: 120%; position: relative; margin-bottom: -6px; }
#tab-home .h2-item .nm { flex: 1; min-width: 0; }
#tab-home .h2-item .nm b { display: block; font-size: 15px; font-weight: 700; }
#tab-home .h2-item .nm span { font-size: 12px; color: var(--h-ink-2); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
#tab-home .h2-item .nm i { width: 8px; height: 8px; border-radius: 50%; background: var(--tc); display: inline-block; }
#tab-home .h2-item .pts { font-size: 16px; font-weight: 700; }
#tab-home .h2-item .pts small { font-size: 11px; color: var(--h-ink-3); font-weight: 600; margin-left: 2px; }

#tab-home .h2-empty { color: var(--h-ink-3); font-size: 14px; padding: 18px; text-align: center; }
#tab-home .h2-skel { background: var(--h-line); border-radius: 14px; }

/* Rails: cards are clickable, mouse can drag */
#tab-home .h2-round { cursor: pointer; }
#tab-home .h2-rail, #tab-home .h2-sessions { cursor: grab; user-select: none; -webkit-user-select: none; }
#tab-home .h2-rail img, #tab-home .h2-rail svg { pointer-events: none; -webkit-user-drag: none; }
#tab-home .h2-round:active .h2-cover { transform: scale(0.97); }
#tab-home .h2-cover { transition: transform .15s ease; }

/* Circuit bottom sheet (lives on <body>, so it needs its own tokens) */
.h2-sheet-wrap {
  --h-card: #ffffff; --h-bg: #f3f4f6; --h-ink: #111317; --h-ink-2: #5d6470; --h-ink-3: #9aa1ab;
  --h-line: #e7e9ee; --h-red: #e10600;
  position: fixed; inset: 0; z-index: 3000; font-family: Manrope, Inter, system-ui, sans-serif; color: var(--h-ink);
}
[data-theme="dark"] .h2-sheet-wrap {
  --h-card: #17191d; --h-bg: #0e0f12; --h-ink: #f2f3f5; --h-ink-2: #a6acb6; --h-ink-3: #6f7680; --h-line: #262a31;
}
.h2-sheet-wrap .num { font-variant-numeric: tabular-nums; font-family: "JetBrains Mono", ui-monospace, monospace; }
.h2-sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); opacity: 0; transition: opacity .25s ease; }
.h2-sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto; max-height: 90vh; overflow-y: auto;
  background: var(--h-bg); border-radius: 26px 26px 0 0; padding: 10px 16px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .25s cubic-bezier(.2,.8,.2,1); }
.h2-sheet-wrap.open .h2-sheet-backdrop { opacity: 1; }
.h2-sheet-wrap.open .h2-sheet { transform: translateY(0); }
.h2-sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--h-line); margin: 0 auto 10px; }
.h2-sheet-close { position: absolute; z-index: 2; top: 12px; right: 14px; width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: var(--h-card); color: var(--h-ink-2); font-size: 14px; cursor: pointer; }
.h2-sheet-loading { padding: 48px 0; text-align: center; color: var(--h-ink-3); font-weight: 600; }
.h2-sheet-head { display: flex; align-items: center; gap: 12px; padding: 6px 4px 14px; }
.h2-sheet-head img { width: 40px; height: 27px; border-radius: 5px; object-fit: cover; box-shadow: 0 0 0 1px var(--h-line); }
.h2-sheet-title { font-size: 26px; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.h2-sheet-sub { font-size: 13px; color: var(--h-ink-2); font-weight: 600; margin-top: 2px; }
.h2-sheet-track { background: #111317; border-radius: 22px; padding: 18px 16px 14px; color: #fff; }
.h2-sheet-track svg { width: 100%; height: auto; display: block; }
.h2-sheet-track path { fill: none; stroke: #fff; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.h2-sheet-circuit { margin-top: 10px; }
.h2-sheet-circuit b { display: block; font-size: 15px; font-weight: 700; }
.h2-sheet-circuit span { font-size: 12px; color: #9aa1ab; font-weight: 600; }
.h2-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.h2-fact { background: var(--h-card); border: 1px solid var(--h-line); border-radius: 16px; padding: 12px; }
.h2-fact.wide { grid-column: 1 / -1; }
.h2-fact span { display: block; font-size: 12px; color: var(--h-ink-3); font-weight: 700; }
.h2-fact b { display: block; font-size: 20px; font-weight: 700; margin-top: 4px; }
.h2-fact em { display: block; font-style: normal; font-size: 13px; color: var(--h-ink-2); font-weight: 600; margin-top: 2px; }
.h2-sheet-sec { font-size: 18px; font-weight: 800; margin: 20px 4px 10px; }
.h2-sched { background: var(--h-card); border: 1px solid var(--h-line); border-radius: 18px; overflow: hidden; }
.h2-sched-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; font-size: 14px; font-weight: 700; }
.h2-sched-row + .h2-sched-row { border-top: 1px solid var(--h-line); }
.h2-sched-row .d { flex: 1; color: var(--h-ink-2); font-weight: 600; font-size: 13px; text-align: right; }
.h2-sched-row.done { opacity: .45; }

/* Driver sheet */
#tab-home .h2-pd, #tab-home .h2-item { cursor: pointer; }
#tab-home .h2-item:active { background: var(--h-line); }
.h2-drv-hero { position: relative; height: 230px; border-radius: 24px; overflow: hidden; margin-top: 4px;
  background: linear-gradient(160deg, var(--tc) 0%, color-mix(in srgb, var(--tc) 55%, #000) 100%); color: #fff; }
.h2-drv-hero img { position: absolute; right: -6px; bottom: 0; height: 100%; width: auto; }
.h2-drv-num { position: absolute; left: 14px; top: 2px; font-size: 120px; font-weight: 700; line-height: 1; opacity: .18; }
.h2-drv-name { position: absolute; left: 16px; bottom: 16px; right: 45%; }
.h2-drv-name span { display: block; font-size: 15px; font-weight: 600; opacity: .9; }
.h2-drv-name b { display: block; font-size: 30px; font-weight: 800; letter-spacing: -.01em; line-height: 1.05; }
.h2-drv-name em { display: block; font-style: normal; font-size: 12px; font-weight: 600; opacity: .85; margin-top: 6px; }
.h2-drv-season { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.h2-drv-season > div { background: var(--h-card); border: 1px solid var(--h-line); border-radius: 18px; padding: 14px; }
.h2-drv-season span { display: block; font-size: 12px; color: var(--h-ink-3); font-weight: 700; }
.h2-drv-season b { display: block; font-size: 34px; font-weight: 700; margin-top: 2px; }
.h2-facts.h2-facts-3 { grid-template-columns: repeat(3, 1fr); }
.h2-facts-3 .h2-fact b { font-size: 18px; }
.h2-form { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.h2-form::-webkit-scrollbar { display: none; }
.h2-form-chip { flex: 1 1 0; min-width: 50px; background: var(--h-card); border: 1px solid var(--h-line); border-radius: 14px; padding: 10px 4px; text-align: center; }
.h2-form-chip b { display: block; font-size: 15px; font-weight: 700; }
.h2-form-chip span { display: block; font-size: 10px; color: var(--h-ink-3); font-weight: 600; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h2-form-chip.win { background: #f5b800; border-color: #f5b800; color: #2b2100; }
.h2-form-chip.win span { color: #5c4700; }
.h2-form-chip.pod { border-color: var(--h-ink); }
.h2-form-chip.out b { color: var(--h-red); }
