.screen-corners{position:absolute;inset:0 0 auto;z-index:9;display:flex;justify-content:space-between;align-items:center;padding:14px 18px;pointer-events:none}
.screen-corners button{pointer-events:auto;background:#12080a29;border:1px solid #f53d3b33;border-radius:2px;color:#f53d3bcc;font-family:"IBM Plex Mono",monospace;font-size:10px;font-weight:500;letter-spacing:1px;padding:6px 10px;transition:border-color .2s,color .2s}
.screen-corners button:hover{border-color:#f53d3b80;color:#ff655ccc}
.grok-credit{display:inline-flex;align-items:center;gap:8px;font:400 9px/1 "IBM Plex Mono",monospace;letter-spacing:.1px;color:#fff;opacity:.5;white-space:nowrap}
.grok-credit>span{position:relative;top:2px}
.grok-credit img{display:block;width:64px;height:25px;object-fit:contain}
#leaderboard-dialog{font-family:"IBM Plex Mono",monospace;width:min(620px,94vw);max-height:88svh;padding:30px;background:#090d10;color:#edf0e8;border:1px solid #697674;border-radius:4px;box-shadow:0 24px 100px #000c}
#leaderboard-dialog::backdrop{background:#020406cc;backdrop-filter:blur(5px)}
.board-heading{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-bottom:10px}
.board-heading h2{font:500 25px/1.2 "IBM Plex Mono",monospace;letter-spacing:1.5px;margin:0}
#leaderboard-close{background:none;border:0;color:#a9b7b6;font:25px "IBM Plex Mono",monospace;padding:6px}
.board-caption{font:11px/1.5 'IBM Plex Mono',monospace;color:#93a7a5;margin:0 0 20px}
.board-table-wrap{max-height:40svh;overflow:auto}
#leaderboard-dialog table{border-collapse:collapse;width:100%;font:12px/1.4 'IBM Plex Mono',monospace;white-space:nowrap}
#leaderboard-dialog th{text-align:left;font-weight:400;font-size:9px;letter-spacing:1px;color:#92a5a2;padding:10px 7px;border-bottom:1px solid #3a4847}
#leaderboard-dialog td{padding:12px 7px;border-bottom:1px solid #202c2b}
#leaderboard-dialog th:nth-child(n+3),#leaderboard-dialog td:nth-child(n+3){text-align:right}
#leaderboard-dialog .your-score{color:#9fe7e6;background:#142323}
#leaderboard-empty{padding:25px 0;text-align:center;color:#a7bbb6;font-size:12px}
#score-entry{border-top:1px solid #354541;margin-top:22px;padding-top:20px}
#score-entry label{display:block;font:500 12px/1.5 "IBM Plex Mono",monospace;letter-spacing:.7px;margin-bottom:9px}
#leaderboard-run{display:block;color:#9fe7e6;font-size:11px;margin-bottom:13px}
.score-inputs{display:flex;gap:10px}
#player-name{min-width:0;flex:1;border:1px solid #687a75;background:#111a1c;color:#fff;font:16px 'IBM Plex Mono',monospace;border-radius:2px;padding:11px 12px}
#score-submit{border:1px solid #f8f2df;background:#f8f2df;color:#0c1112;font:500 12px/1.4 "IBM Plex Mono",monospace;letter-spacing:.6px;padding:9px 15px;white-space:nowrap}
#score-submit:disabled{opacity:.5;cursor:wait}
.board-bottom{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:18px}
#leaderboard-status{color:#b2c8c2;font-size:11px;line-height:1.5;min-height:17px;margin:0}
#leaderboard-refresh{background:none;border:0;color:#9fe7e6;text-decoration:underline;font:12px 'IBM Plex Mono',monospace;padding:8px 0}
@media(max-width:600px){.screen-corners{padding:7px 9px}.screen-corners button{font-size:9px;letter-spacing:.6px;padding:4px 6px}.grok-credit{font-size:8px;letter-spacing:0;gap:6px}.grok-credit img{width:52px;height:auto}.title-tagline{top:15%;font-size:1.8cqw;line-height:1.25}#leaderboard-dialog{padding:20px 14px}.board-heading h2{font-size:21px}#leaderboard-dialog table{font-size:10px}#leaderboard-dialog th{font-size:8px;padding:8px 4px}#leaderboard-dialog td{padding:10px 4px}.score-inputs{gap:6px}#score-submit{font-size:11px;padding:9px}}

/* Continue the title screen's red horizon and perspective floor inside the board. */
#leaderboard-dialog{width:min(720px,94vw);padding:36px;container-type:inline-size;isolation:isolate;background:#080a0d;border:1px solid #86413e;box-shadow:0 24px 100px #000e,0 0 50px #ff3c3215;overflow:auto}
#leaderboard-dialog::backdrop{background:#030407d9;backdrop-filter:blur(6px)}
#leaderboard-atmosphere{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:-1;background:radial-gradient(ellipse at 50% 69%,#391019 0%,#0e0e15 48%,#07080c 82%)}
#leaderboard-atmosphere .title-grid{top:52%;opacity:.7;height:150%}
#leaderboard-atmosphere .title-horizon{top:52%;height:1px;opacity:.7}
#leaderboard-atmosphere::after{content:'';position:absolute;inset:0;background:repeating-linear-gradient(0deg,#0002 0 1px,transparent 1px 3px);box-shadow:inset 0 0 65px #0006}
.board-content{position:relative;min-height:340px;display:flex;flex-direction:column}
.board-heading h2{color:#f8f2df;text-shadow:0 0 22px #ff3c3240}
.board-caption{color:#9fe7e6}
#leaderboard-close{color:#c2c2bd}
#leaderboard-close:hover{color:#fff}
.board-table-wrap{background:#07090dd9;border:1px solid #ff6a5733;border-top:2px solid #ff3c32;box-shadow:0 -4px 20px #ff3c3215;border-radius:2px}
#leaderboard-dialog th{color:#e8bdb6;background:#100d12;border-bottom-color:#73322f;padding:13px 10px}
#leaderboard-dialog td{border-bottom-color:#ff705020;padding:13px 10px}
#leaderboard-dialog tbody tr:last-child td{border-bottom:0}
#leaderboard-dialog .your-score{color:#f8f2df;background:#ff3c321c;box-shadow:inset 2px 0 #ff5749}
#leaderboard-empty{margin:0;padding:34px 12px;color:#e0d9d5;text-shadow:0 2px 8px #000}
#score-entry{border-top-color:#ff614044;background:#080a0de8;padding:20px;margin-top:24px}
#score-entry label{color:#f8f2df}
#player-name{background:#0b0d13;border-color:#77524e}
#player-name:focus-visible{outline:1px solid #9fe7e6;outline-offset:3px}
#score-submit{background:transparent;color:#f8f2df;border-color:#f8f2df}
#score-submit:hover{background:#f8f2df;color:#0c1112}
.board-bottom{margin-top:auto;padding-top:26px}
#leaderboard-status{color:#d1d9d7;text-shadow:0 2px 8px #000}
#leaderboard-refresh{color:#9fe7e6;text-underline-offset:4px}
@media(max-width:600px){#leaderboard-dialog{padding:24px 16px}.board-content{min-height:310px}.board-table-wrap{max-height:35svh}#leaderboard-dialog th,#leaderboard-dialog td{padding:11px 5px}#score-entry{padding:16px 10px}.board-heading h2{font-size:20px}.board-bottom{gap:12px}#leaderboard-status{font-size:10px}}

/* Two ordered top-ten columns per page; names stay readable at arcade distance. */
#leaderboard-dialog{width:min(1000px,94vw);padding:26px 30px}
.board-caption{margin-bottom:14px}
.board-table-wrap{max-height:57svh;scrollbar-color:#83413a #090b10;scrollbar-width:thin}
.board-columns{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px;padding:0 12px}
.board-columns table{table-layout:fixed;align-self:start}
#leaderboard-dialog th{position:sticky;top:0;z-index:1;padding:10px 7px}
#leaderboard-dialog td{padding:8px 7px;vertical-align:middle}
#leaderboard-dialog th:first-child{width:36px}
#leaderboard-dialog th:last-child{width:112px}
.board-driver{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}
.board-driver-detail{display:block;font-size:9px;line-height:1.6;color:#97aaa9;margin-top:2px}
#leaderboard-dialog .your-score .board-driver{color:#9fe7e6}
.board-pagination{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 18px;border-top:1px solid #ff705033;background:#0b0a10;font-size:10px;color:#a8bfbd}
.board-pagination div{display:flex;gap:8px}
.board-pagination button{font:11px "IBM Plex Mono",monospace;color:#f8f2df;border:1px solid #79504b;background:#100f15;padding:7px 10px}
.board-pagination button:hover:not(:disabled){border-color:#9fe7e6}
.board-pagination button:disabled{opacity:.3;cursor:default}
#score-entry{padding:14px 18px;margin-top:16px}
.board-bottom{padding-top:12px}
@media(max-width:700px){
 #leaderboard-dialog{padding:20px 16px}
 .board-columns{grid-template-columns:1fr;gap:0;padding:0 7px}
 .board-columns table+table thead{display:none}
 .board-table-wrap{max-height:55svh}
 #leaderboard-dialog td{padding:9px 5px}
 #leaderboard-dialog th:first-child{width:30px}
 #leaderboard-dialog th:last-child{width:92px}
 .board-pagination{padding:10px 8px;flex-wrap:wrap}
}
/* Keep ten rows visible per column on a typical laptop screen. */
@media(min-width:701px){
 #leaderboard-dialog .board-columns td{padding:3px 7px;line-height:14px}
 .board-driver-detail{font-size:8px;line-height:11px;margin-top:1px}
 .board-table-wrap{max-height:60svh}
}
.board-pagination{position:sticky;bottom:0;z-index:2}

/* Bring name entry above the standings when arriving from the result screen. */
#leaderboard-dialog.score-entry-first .board-heading{order:0}
#leaderboard-dialog.score-entry-first .board-caption{order:1}
#leaderboard-dialog.score-entry-first #score-entry{order:2;margin:0 0 18px;padding:14px 0 0}
#leaderboard-dialog.score-entry-first .board-table-wrap{order:3}
#leaderboard-dialog.score-entry-first #leaderboard-empty{order:4}
#leaderboard-dialog.score-entry-first .board-bottom{order:5}

/* One line per driver; colgroups preserve alignment in the second mobile table. */
#leaderboard-dialog th:first-child,#leaderboard-dialog th:last-child{width:auto}
.board-col-rank{width:36px}.board-col-lap{width:40px}.board-col-distance{width:100px}
#leaderboard-dialog .board-lap{color:#ff675b}
#leaderboard-dialog .board-columns td{padding:8px 7px;line-height:16px}
@media(max-width:700px){
 .board-col-rank{width:28px}.board-col-lap{width:30px}.board-col-distance{width:78px}
 #leaderboard-dialog .board-columns td{padding:5px 5px;line-height:17px}
 #leaderboard-dialog th{letter-spacing:.5px}
}
