:root {
  color-scheme: dark;
  --bg: #151c1a; --panel: #1e2925; --paper: #faf4e7; --muted: #b7c1b8;
  --gold: #ddb375; --line: #405046; --ink: #142119;
  font-family: 'Segoe UI', Arial, sans-serif; font-size: 17px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--paper); }
header { padding: 1.3rem max(5vw, 1rem); display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); gap: 1rem; flex-wrap: wrap; }
.brand { display: inline-flex; gap: .35em; align-items: center; min-height: 44px; font-weight: 800; letter-spacing: .1em; color: var(--paper); text-decoration: none; font-size: 1.1rem; }
.brand span { color: var(--gold); }
.eyebrow { letter-spacing: .15em; font-weight: 600; font-size: .71rem; color: var(--gold); line-height: 1.6; }
main { max-width: 1400px; margin: auto; padding: 2.7rem max(5vw, 1rem) 0; }
.intro { margin-bottom: 3.5rem; }
.intro > p:not(.eyebrow) { max-width: 580px; color: var(--muted); line-height: 1.7; }
h1, h2, h3 { font-family: Georgia, serif; font-weight: 400; }
h1 { font-size: clamp(2.8rem, 6vw, 5rem); line-height: 1.04; margin: .8rem 0 1.2rem; }
h1 em { color: var(--gold); }
h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); margin: .45rem 0 1rem; line-height: 1.15; }
h3 { font-size: 1.9rem; line-height: 1.2; margin: .5rem 0 1rem; }
p { line-height: 1.6; }
a { color: var(--gold); text-underline-offset: .2em; }
section[id] { scroll-margin-top: 1rem; }
.lounge-nav { display: flex; flex-wrap: wrap; gap: .25rem; min-width: 0; margin-left: auto; }
.lounge-nav a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .5rem .65rem; border: 1px solid transparent; border-radius: .25rem; color: var(--muted); font-size: .8rem; text-decoration: none; white-space: nowrap; }
.lounge-nav a[aria-current=page] { background: var(--panel); border-color: var(--line); color: var(--gold); }
.lounge-nav a:hover { color: var(--paper); border-color: var(--gold); }
button:hover:enabled { border-color: var(--gold); }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; margin-bottom: 1.2rem; }
.section-heading > * { min-width: 0; }
.section-heading > p { max-width: 360px; font-size: .85rem; color: var(--muted); }
.competition-grid, .driver-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); padding: 1.7rem; border-radius: .4rem; min-width: 0; }
.board { border-top: 3px solid var(--gold); }
.all-time { border-top-color: #8d9e88; }
.board > .eyebrow { margin-top: 0; }
.board-controls { min-height: 125px; padding-bottom: .35rem; }
.board-controls label { max-width: 255px; margin: .65rem 0 .45rem; }
.board-controls p { margin: .4rem 0; }
.record-note { padding-top: .8rem; color: var(--gold); }
button, input, select { font: inherit; font-size: 1rem; min-height: 48px; border-radius: .25rem; }
button { cursor: pointer; border: 1px solid var(--line); background: transparent; color: var(--paper); padding: .65rem 1rem; }
button.active { background: var(--paper); color: var(--ink); }
button:disabled { opacity: .6; cursor: wait; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
label { display: block; font-size: .88rem; color: var(--muted); margin: 1rem 0; }
input, select { display: block; min-width: 0; width: 100%; max-width: 100%; margin-top: .45rem; border: 1px solid #778276; background: #141e19; color: var(--paper); padding: .6rem .7rem; }
input::placeholder { color: #9aa99e; opacity: 1; }
input[type=month] { min-height: 48px; }
.field-note { display: block; font-size: .78rem; line-height: 1.5; margin-top: .4rem; }
.check { display: flex; gap: .7rem; align-items: flex-start; line-height: 1.6; min-height: 44px; padding: .6rem 0; cursor: pointer; }
.check input { width: 22px; min-height: 22px; height: 22px; flex-shrink: 0; margin: 2px 0 0; accent-color: var(--gold); }
.primary { background: var(--gold); color: var(--ink); font-weight: 700; border: 0; width: 100%; margin-top: .5rem; }
.secondary { margin-top: 1rem; }
.small, .board-footnote { font-size: .8rem; color: var(--muted); line-height: 1.65; }
.board-footnote { max-width: 900px; margin: 1rem 0 0; }
.notice { padding: .8rem 1rem; border-left: 3px solid var(--gold); background: #34362a; }
table { border-collapse: collapse; width: 100%; table-layout: fixed; margin-top: 1rem; }
.place-col { width: 2rem; }
.time-col { width: 6.1rem; }
th { text-align: left; text-transform: uppercase; letter-spacing: .08em; font-size: .65rem; color: var(--muted); padding: .7rem 0; border-bottom: 1px solid var(--line); }
td { padding: .85rem .3rem .85rem 0; border-bottom: 1px solid var(--line); vertical-align: top; font-size: .9rem; }
td:last-child, th:last-child { padding-right: 0; text-align: right; font-variant-numeric: tabular-nums; }
.lap-time { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; white-space: nowrap; font-size: .87rem; }
.rank { color: var(--muted); font-variant-numeric: tabular-nums; }
.driver-alias { display: block; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.car-label { display: block; font-size: .76rem; line-height: 1.45; color: var(--muted); margin-top: .2rem; overflow-wrap: anywhere; }
tbody tr:first-child .rank, tbody tr:first-child .lap-time { color: var(--gold); }
.empty { padding: 1.7rem 0; margin: 0; font-family: Georgia, serif; font-size: 1.4rem; line-height: 1.5; color: var(--paper); }
.empty p { font-family: 'Segoe UI', Arial, sans-serif; font-size: .85rem; color: var(--muted); margin: .7rem 0 0; }
.board-status { margin-bottom: 0; }
.retry { margin-top: .7rem; font-size: .85rem; }
.drivers-section { margin: 3.5rem 0; }
.community-summary { display: flex; align-items: center; gap: 2rem; padding: .25rem 0 1.4rem; }
.community-summary > p { margin: 0; }
.community-summary strong { color: var(--gold); font-family: Georgia, serif; font-size: 2.5rem; font-weight: 400; line-height: 1.2; font-variant-numeric: tabular-nums; }
.community-summary span { display: block; font-size: .8rem; color: var(--muted); }
.driver-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.driver-card { padding: 1.25rem; border: 1px solid var(--line); background: var(--panel); border-radius: .4rem; min-width: 0; }
.driver-card h3 { font: 600 1.05rem 'Segoe UI', Arial, sans-serif; margin: 0 0 .6rem; color: var(--paper); overflow-wrap: anywhere; }
.driver-dates { font-size: .75rem; color: var(--muted); line-height: 1.6; margin: 0 0 1rem; }
.driver-dates span { display: block; }
.driver-pb { padding: .85rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.driver-pb .eyebrow { margin: 0 0 .4rem; font-size: .62rem; }
.pb-line { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: baseline; justify-content: space-between; }
.pb-line strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; font-weight: 500; color: var(--gold); }
.pb-rank { color: var(--muted); font-size: .74rem; }
.driver-stats { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; margin: 1rem 0 0; }
.driver-stats div { min-width: 0; }
.driver-stats dt { font-size: .69rem; color: var(--muted); line-height: 1.5; }
.driver-stats dd { font-size: 1.2rem; font-variant-numeric: tabular-nums; margin: .25rem 0 0; overflow-wrap: anywhere; }
.stat-note { margin: 1rem 0 0; font-size: .75rem; color: var(--muted); }
.stat-note summary { min-height: 44px; padding: .7rem 0; cursor: pointer; }
.stat-note p { margin: .25rem 0 0; }
.profile-panel { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1fr); gap: 3rem; margin-top: 3.5rem; padding: 2.2rem; }
.profile-intro > p { max-width: 350px; color: var(--muted); }
.profile-intro > .eyebrow { color: var(--gold); }
.profile-content { min-width: 0; }
.tabs { display: flex; gap: .5rem; margin: .4rem 0 1.5rem; }
.tabs button { flex: 1; padding: .65rem .5rem; font-size: .88rem; }
.profile-code { display: block; font-size: 1.6rem; letter-spacing: .12em; font-family: monospace; overflow-wrap: anywhere; color: var(--gold); }
#welcome, #profile-message, #public-name { overflow-wrap: anywhere; }
#profile-message { margin-bottom: 0; color: var(--gold); min-height: 1.5em; }
.visibility-settings { margin-top: 1.5rem; padding: .5rem 0 1.25rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
#privacy-note a { display: inline-flex; align-items: center; min-height: 44px; }
.local-footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.5rem 0; color: var(--muted); font-size: .75rem; letter-spacing: .05em; flex-wrap: wrap; }
.local-footer a { display: inline-flex; align-items: center; min-height: 44px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.display main { max-width: 2560px; padding: 1.5rem 3vw 0; }
.display-title { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.display h1 { font-size: clamp(2.5rem, 3.5vw, 4.8rem); }
.display-title h1 { margin-bottom: 0; }
.clock { font-size: 2rem; color: var(--gold); font-variant-numeric: tabular-nums; }
.display-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, .65fr); gap: 1.25rem; align-items: start; }
.display h2 { font-size: clamp(1.8rem, 2vw, 2.8rem); }
.display #commentary { font-family: Georgia, serif; font-size: clamp(1.4rem, 1.5vw, 2rem); line-height: 1.4; }
.display-tip { margin: 1rem 0; font-size: 1rem; color: var(--gold); }
.display-tip span { margin-left: 1rem; color: var(--muted); }
.station { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem 1rem; border-top: 1px solid var(--line); padding: 1rem 0; font-size: .85rem; overflow-wrap: anywhere; }
.station strong { font-weight: 500; color: var(--gold); }
@media (min-width: 1900px) {
  .display td { font-size: 1.1rem; padding-top: .65rem; padding-bottom: .65rem; }
  .display .car-label { font-size: .85rem; }
  .display .time-col { width: 7rem; }
}
@media (max-width: 1100px) {
  .lounge-nav { flex-basis: 100%; order: 1; margin-left: 0; }
  .driver-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .display-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .activity-panel { grid-column: 1 / -1; }
  .display-title { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 760px) {
  :root { font-size: 16px; }
  header { padding: .65rem 1rem; gap: .4rem 1rem; }
  header > .eyebrow { font-size: .62rem; }
  main { padding-top: 1.6rem; }
  .intro { margin-bottom: 2.5rem; }
  .intro > .eyebrow { font-size: .61rem; }
  .lounge-nav { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); padding-top: .35rem; border-top: 1px solid var(--line); }
  .lounge-nav a { grid-column: span 2; padding: .5rem .3rem; }
  .lounge-nav a:nth-last-child(-n+2) { grid-column: span 3; }
  .section-heading { flex-direction: column; align-items: flex-start; gap: 0; }
  .section-heading h2 { margin-bottom: .4rem; }
  .section-heading > p { margin-top: .35rem; }
  .competition-grid, .display-columns, .profile-panel { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 1.1rem; }
  .board-controls { min-height: 0; }
  .board-controls label { max-width: none; }
  .place-col { width: 1.6rem; }
  .time-col { width: 5.8rem; }
  .profile-panel { gap: 1rem; margin-top: 2.5rem; }
  .profile-intro > p { max-width: none; }
  .profile-intro h2 br { display: none; }
  .drivers-section { margin: 2.5rem 0; }
  .driver-grid { grid-template-columns: minmax(0, 1fr); }
  .driver-card { padding: 1.1rem; }
  .community-summary { gap: 1.2rem; align-items: flex-start; }
  .community-summary strong { font-size: 2.1rem; }
  .community-summary .small { font-size: .74rem; }
  .display main { padding-left: 1rem; padding-right: 1rem; }
  .display .clock { font-size: 1.25rem; }
  .display-tip span { display: block; margin-left: 0; margin-top: .3rem; }
}
@media (min-width: 1600px) {
  .display header { padding: .6rem 3vw; }
  .display main { padding-top: .8rem; }
  .display h1 { font-size: 3.2rem; }
  .display .panel { padding: 1.2rem; }
  .display h2 { font-size: 2rem; }
  .display td { font-size: 1rem; padding-top: .3rem; padding-bottom: .3rem; }
  .display .car-label { font-size: .76rem; }
  .display .board-status { font-size: .72rem; }
}
/* Separate Lounge pages: public directory remains a real, scrollable table. */
.home-intro { max-width: 900px; padding: clamp(1rem, 5vh, 4rem) 0; }
.home-intro > p:not(.eyebrow) { max-width: 660px; }
.page-heading { margin-bottom: 2.5rem; }
.page-heading > p:not(.eyebrow) { color: var(--muted); max-width: 650px; }
.page-heading h1 { font-size: clamp(2.8rem, 5vw, 4.5rem); }
.directory-summary { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 1rem 0; }
.directory-summary p { margin: .25rem 0; }
#driver-counts { color: var(--gold); font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid var(--line); border-radius: .4rem; background: var(--panel); }
.table-scroll:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.directory-table { min-width: 1090px; margin: 0; }
.directory-table caption { text-align: left; padding: .9rem 1rem; color: var(--muted); font-size: .8rem; }
.directory-table .name-col { width: 190px; }
.directory-table .date-col { width: 145px; }
.directory-table .best-col { width: 230px; }
.directory-table .rank-col { width: 110px; }
.directory-table .laps-col { width: 115px; }
.directory-table .driving-col { width: 155px; }
.directory-table td, .directory-table th { padding: .85rem 1rem; line-height: 1.55; }
.directory-table tbody th { font-size: .9rem; letter-spacing: 0; text-transform: none; font-weight: 600; vertical-align: top; }
.directory-table tbody th a { display: inline-flex; align-items: center; min-height: 44px; overflow-wrap: anywhere; }
.directory-table .numeric { text-align: right; font-variant-numeric: tabular-nums; }
.directory-table tbody tr:hover { background: #28352e; }
.text-link { display: inline-flex; align-items: center; min-height: 44px; margin: .5rem 0; }
.button-row { display: flex; flex-wrap: wrap; gap: .6rem; margin: .75rem 0; }
fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
.profile-panel { margin-top: 0; }
.profile-intro h1 { font-size: clamp(2.5rem, 4vw, 4rem); overflow-wrap: anywhere; }
.profile-settings { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.profile-settings h3 { font-size: 1.55rem; }
#age { max-width: 160px; }
#photo-file { padding: .5rem; font-size: 1rem; }
#photo-file::file-selector-button { min-height: 44px; font: inherit; color: var(--paper); background: var(--panel); border: 1px solid var(--line); border-radius: .25rem; margin-right: .5rem; padding: .4rem; }
.avatar { position: relative; display: inline-flex; flex: 0 0 128px; width: 128px; height: 128px; overflow: hidden; align-items: center; justify-content: center; border: 1px solid var(--gold); border-radius: .5rem; background: #354538; vertical-align: middle; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.initials { font: 2.5rem Georgia, serif; color: var(--gold); }
.driver-heading { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 1.5rem; }
.driver-heading > div { min-width: 0; }
.driver-heading h1 { font-size: clamp(2.3rem, 4vw, 4rem); overflow-wrap: anywhere; }
.public-driver { max-width: 920px; margin: .75rem 0 2rem; }
.public-driver .driver-stats { max-width: 600px; }
.public-driver .driver-stats dt { font-size: .85rem; }
.public-driver .driver-stats dd { font-size: 1.8rem; }
.public-driver .driver-pb { padding: 1.25rem 0; }
.public-driver .pb-line strong { font-size: 2rem; }
.public-driver .driver-dates { font-size: .85rem; }
.unavailable-panel h1 { font-size: clamp(2rem, 4vw, 3rem); }
@media (max-width: 760px) {
  .profile-panel { margin-top: 0; }
  .driver-heading { align-items: flex-start; flex-direction: column; gap: .7rem; }
  .driver-heading h1 { margin-top: .5rem; }
  .profile-settings .button-row button { flex: 1 1 auto; }
}
