:root { --bg: #0f1318; --panel: #181e26; --line: #2a333f; --ink: #e9edf2; --mute: #94a0ae; --gold: #e0a43a; --paper: #f7f4ec; --pink: #1c1c1c; --link: #1a55a8; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; min-height: 100svh; touch-action: manipulation; }
.hidden { display: none !important; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
.btn { background: var(--gold); color: #1b1305; border: 0; border-radius: 10px; padding: 14px 22px; font-weight: 700; font-size: 18px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); font-weight: 600; }
.btn.wide { display: block; width: 100%; }
.link { background: none; border: 0; color: var(--mute); text-decoration: underline; padding: 8px; font-size: 15px; }

/* ---- menu and setup ---- */
.top { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; color: var(--mute); font-size: 15px; }
.top a { color: var(--mute); text-decoration: none; }
.col { max-width: 560px; margin: 0 auto; padding: 8px 18px 40px; }
.logo { text-align: center; margin: 5vh 0 4vh; }
.logo h1 { font-size: clamp(44px, 11vw, 76px); letter-spacing: .01em; line-height: 1; }
.logo h1 i { font-style: normal; color: var(--gold); }
.logo p { color: var(--mute); margin: 12px 0 0; }
.mode { display: flex; align-items: center; gap: 16px; width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin: 12px 0; }
.mode:hover { border-color: var(--gold); }
.mode b { display: block; font-size: 20px; }
.mode span { color: var(--mute); font-size: 15px; }
.mode em { font-style: normal; font-size: 28px; width: 40px; text-align: center; color: var(--gold); font-family: Georgia, serif; }
.how { color: var(--mute); font-size: 15px; margin-top: 26px; }
.how b { color: var(--ink); }
.fine { color: #6f7b89; font-size: 13px; margin-top: 22px; }
.fine a { color: inherit; }
.chips { display: flex; gap: 8px; margin: 14px 0; }
.chips button { flex: 1; padding: 11px 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--mute); font-weight: 600; }
.chips button.on { border-color: var(--gold); color: var(--gold); }
.lbl { color: var(--mute); font-size: 13px; letter-spacing: .12em; font-weight: 700; }
.vs { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 14px 0 18px; }
.art { display: flex; gap: 14px; align-items: center; background: var(--paper); color: var(--pink); border-radius: 12px; padding: 14px; min-height: 96px; }
.art img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; background: #ddd; }
.art small { display: block; font-size: 12px; letter-spacing: .12em; font-weight: 700; color: #7a6a45; }
.art b { display: block; font: 600 22px/1.2 Georgia, serif; }
.art span { display: block; font-size: 14px; color: #555; }
.art.goal { outline: 3px solid var(--gold); }
.arrow { text-align: center; color: var(--gold); font-size: 22px; line-height: 1; }
.beat { background: var(--panel); border: 1px solid var(--gold); border-radius: 12px; padding: 12px 16px; margin: 12px 0; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
input.text { width: 100%; padding: 14px; font: inherit; font-size: 20px; border-radius: 10px; border: 1px solid var(--line); background: #0b0e12; color: var(--ink); margin: 8px 0 12px; }
input.code { text-align: center; letter-spacing: .3em; text-transform: uppercase; font-size: 34px; font-weight: 700; }
.stale { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #3a1d14; color: #ffd9c9; border-top: 1px solid #7a3a26; padding: 10px 14px; padding-bottom: max(10px, env(safe-area-inset-bottom)); font-size: 15px; text-align: center; }
.stale a { color: #fff; margin-left: 8px; }
.links { text-align: center; margin-top: 18px; }
.tip { color: var(--mute); font-size: 15px; text-align: center; margin: 10px 0 0; }
.msg { text-align: center; color: var(--mute); margin-top: 24vh; font-size: 20px; padding: 0 20px; }

/* ---- results ---- */
.res h2 { font-size: 34px; margin: 4vh 0 4px; text-align: center; }
.res .sub { text-align: center; color: var(--mute); margin-bottom: 16px; }
.big2 { display: flex; gap: 12px; margin: 14px 0; }
.big2 div { flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-align: center; }
.big2 b { display: block; font-size: 34px; font-variant-numeric: tabular-nums; }
.big2 span { color: var(--mute); font-size: 14px; }
.chain { list-style: none; margin: 14px 0; padding: 0; counter-reset: c -1; }
.chain li { padding: 8px 0 8px 40px; position: relative; border-left: 2px solid var(--line); margin-left: 14px; counter-increment: c; }
.chain li::before { content: counter(c); position: absolute; left: -13px; top: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--panel); border: 2px solid var(--line); font-size: 12px; text-align: center; line-height: 21px; color: var(--mute); }
.chain li:last-child { color: var(--gold); font-weight: 700; }
.stand { list-style: none; margin: 14px 0; padding: 0; }
.stand li { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 8px 0; }
.stand li.win { border-color: var(--gold); }
.stand li.me { background: #222b36; }
.stand .pl { width: 34px; font: 700 22px Georgia, serif; color: var(--gold); text-align: center; flex: none; }
.stand .who { flex: 1; min-width: 0; }
.stand .who b { display: block; }
.stand .who span { display: block; color: var(--mute); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stand .n { text-align: right; font-variant-numeric: tabular-nums; flex: none; }
.stand .n b { display: block; font-size: 20px; }
.stand .n span { color: var(--mute); font-size: 12px; }
.stand .who span.tag, .tag { display: inline-block; font-size: 11px; letter-spacing: .08em; font-weight: 700; color: var(--gold); border: 1px solid var(--gold); border-radius: 5px; padding: 0 5px; margin-left: 6px; vertical-align: 2px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 8px; }

/* ---- the race view ---- */
.wr-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: stretch; gap: 4px; background: #11161c; border-bottom: 1px solid var(--line); padding: 6px 8px; padding-top: max(6px, env(safe-area-inset-top)); }
.wr-back, .wr-quit { width: 46px; border: 0; background: none; color: var(--ink); padding: 2px 0; text-align: center; }
.wr-back b, .wr-quit b { display: block; font-size: 19px; line-height: 1.3; font-weight: 700; }
.wr-back b { font-size: 30px; line-height: .82; }
.wr-back span, .wr-quit span { display: block; font-size: 11px; color: var(--mute); }
.wr-quit b { color: var(--mute); }
.wr-back:disabled { opacity: .3; }
.wr-goal { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 2px 6px; }
.wr-goal span { display: block; font-size: 11px; letter-spacing: .14em; font-weight: 700; color: var(--mute); }
.wr-goal b { display: block; color: var(--gold); font: 600 19px/1.2 Georgia, serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wr-stat { text-align: center; min-width: 46px; padding: 2px 4px; }
.wr-stat b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.wr-stat span { display: block; font-size: 11px; color: var(--mute); }
.wr-ask .btn.ghost { color: #8a2b1c; border-color: #cfc8b6; margin-top: 10px; }
.wr-others { display: flex; gap: 14px; overflow-x: auto; white-space: nowrap; background: #151b22; border-bottom: 1px solid var(--line); padding: 6px 12px; font-size: 13px; color: var(--mute); position: sticky; top: 57px; z-index: 4; }
.wr-others i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.wr-others b { color: var(--ink); }
.wr-load { position: fixed; left: 0; top: 0; height: 3px; width: 0; background: var(--gold); z-index: 9; }
.loading .wr-load { width: 85%; transition: width 2.5s ease-out; }
.loading .wr-body { opacity: .45; }
.wr-page { background: var(--paper); color: var(--pink); max-width: 880px; margin: 0 auto; padding: 18px 16px 60px; min-height: 100svh; overflow-wrap: break-word; }
@media (min-width: 900px) { .wr-page { margin: 18px auto; border-radius: 6px; padding: 30px 44px 70px; } }
.wr-title { font-size: 32px; line-height: 1.15; padding-bottom: 8px; border-bottom: 1px solid #cfc8b6; margin-bottom: 12px; }
.wr-foot { clear: both; margin-top: 40px; padding-top: 12px; border-top: 1px solid #cfc8b6; color: #7b7566; font-size: 13px; }
.wr-toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: #11161c; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; z-index: 9; font-size: 15px; width: max-content; max-width: 90vw; }
.wr-sheet { position: fixed; inset: 0; background: rgba(6, 8, 11, .8); z-index: 20; display: flex; align-items: center; justify-content: center; padding: 18px; }
.wr-card { background: var(--paper); color: var(--pink); border-radius: 14px; padding: 20px; max-width: 460px; width: 100%; max-height: 86svh; overflow: auto; }
.wr-card img { float: right; width: 110px; border-radius: 8px; margin: 0 0 8px 12px; }
.wr-card h2 { font-size: 28px; }
.wr-lbl { font-size: 12px; letter-spacing: .14em; font-weight: 700; color: #7a6a45; }
.wr-desc { color: #555; margin: 4px 0 10px; }
.wr-ext { font-size: 15px; margin: 0 0 16px; }
.wr-card .btn { clear: both; display: block; width: 100%; }
.wr-err { color: #8a2b1c; }

.wr-body { font-size: 17px; line-height: 1.62; }
.wr-body::after { content: ""; display: block; clear: both; }
.wr-body p { margin: 0 0 .9em; }
.wr-body a.wl { color: var(--link); text-decoration: none; }
.wr-body a.wl:hover { text-decoration: underline; }
.wr-body a.wl.hit { background: #ffe6a8; border-radius: 3px; }
.wr-body h2 { font-size: 25px; border-bottom: 1px solid #cfc8b6; margin: 1.3em 0 .5em; padding-bottom: 3px; clear: none; }
.wr-body h3 { font-size: 20px; margin: 1.1em 0 .4em; font-family: inherit; font-weight: 700; }
.wr-body h4, .wr-body h5 { font-size: 17px; margin: 1em 0 .3em; }
.wr-body img { max-width: 100%; height: auto; vertical-align: middle; }
.wr-body ul, .wr-body ol { padding-left: 1.5em; margin: 0 0 .9em; }
.wr-body li { margin-bottom: .25em; }
.wr-body dl { margin: 0 0 .9em; } .wr-body dd { margin-left: 1.4em; } .wr-body dt { font-weight: 700; }
.wr-body blockquote { margin: 0 0 .9em; padding: 2px 16px; border-left: 3px solid #cfc8b6; color: #333; }
.wr-body .hatnote, .wr-body .dablink { font-style: italic; color: #5d5747; font-size: 15px; margin: 0 0 .8em; padding-left: 12px; border-left: 3px solid #ddd6c4; }
.wr-body figure, .wr-body .thumb, .wr-body .tmulti { float: right; clear: right; margin: 4px 0 14px 18px; max-width: 270px; background: #efeadd; border: 1px solid #ddd6c4; padding: 5px; border-radius: 3px; text-align: center; }
.wr-body figure[typeof~="mw:File"], .wr-body figure[typeof~="mw:File/Frameless"] { background: none; border: 0; padding: 0; }
.wr-body figcaption, .wr-body .thumbcaption { font-size: 13.5px; line-height: 1.4; color: #4c4739; padding: 5px 3px 2px; text-align: left; }
.wr-body .mw-halign-left, .wr-body .tleft { float: left; clear: left; margin: 4px 18px 14px 0; }
.wr-body .mw-halign-center, .wr-body .tnone, .wr-body .center { float: none; margin-left: auto; margin-right: auto; text-align: center; }
.wr-body .tw { overflow-x: auto; margin: 0 0 1em; max-width: 100%; }
.wr-body .tw.box { float: right; clear: right; width: 300px; margin: 4px 0 14px 18px; }
.wr-body table { border-collapse: collapse; font-size: 14.5px; line-height: 1.4; background: #fbf9f3; }
.wr-body .tw.box table { width: 100%; }
.wr-body th, .wr-body td { border: 1px solid #d9d2c0; padding: 5px 8px; vertical-align: top; text-align: left; }
.wr-body th { background: #ebe5d5; }
.wr-body caption, .wr-body .infobox-title, .wr-body .infobox-above { font-weight: 700; font-size: 16px; padding: 6px; text-align: center; }
.wr-body .infobox-image, .wr-body .infobox-full-data, .wr-body .infobox-header, .wr-body .infobox-subheader { text-align: center; }
.wr-body .infobox td, .wr-body .infobox th, .wr-body .sidebar td, .wr-body .sidebar th { border-left: 0; border-right: 0; }
.wr-body .hlist ul, .wr-body .hlist ol, .wr-body .hlist dl { display: inline; padding: 0; margin: 0; }
.wr-body .hlist li, .wr-body .hlist dd { display: inline; margin: 0; }
.wr-body .hlist li:not(:last-child)::after, .wr-body .hlist dd:not(:last-child)::after { content: " \00b7 "; font-weight: 700; }
.wr-body .plainlist ul { list-style: none; padding: 0; margin: 0; }
.wr-body ul.gallery { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; clear: both; }
.wr-body li.gallerybox { width: 160px; font-size: 13.5px; }
.wr-body .gallerybox div { width: auto !important; }
.wr-body sup, .wr-body sub { font-size: .75em; line-height: 0; }
.wr-body .mwe-math-fallback-image-inline, .wr-body .mwe-math-fallback-image-display { max-width: 100%; }
.wr-body .div-col { column-width: 18em; }
.wr-body .quotebox, .wr-body .side-box { float: right; clear: right; width: 260px; margin: 4px 0 14px 18px; background: #efeadd; border: 1px solid #ddd6c4; padding: 10px; font-size: 15px; }
.wr-body .locmap, .wr-body .switcher-container { position: relative; }
.wr-body .locmap .od, .wr-body .timeline-wrapper .od { display: none; }
@media (max-width: 640px) {
  .wr-body figure, .wr-body .thumb, .wr-body .tmulti, .wr-body .mw-halign-left, .wr-body .tleft, .wr-body .tw.box, .wr-body .quotebox { float: none; margin: 6px auto 14px; max-width: 100%; }
  .wr-body .tw.box { width: 100%; }
  .wr-body figure { display: table; }
  .wr-title { font-size: 28px; }
}

/* ---- big-screen lobby and scoreboard ---- */
.tv { height: 100svh; display: flex; flex-direction: column; padding: 2.4vh 3vw; overflow: hidden; }
.tvhead { display: flex; align-items: center; gap: 2vw; flex: none; }
.tvhead .route { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 1.2vw; font: 600 clamp(22px, 3.2vw, 54px)/1.15 Georgia, serif; }
.tvhead .route span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvhead .route em { font-style: normal; color: var(--mute); font-size: .7em; flex: none; }
.tvhead .route .to { color: var(--gold); }
.tvhead .clock { font: 700 clamp(26px, 3.6vw, 60px)/1 -apple-system, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums; }
.board { flex: 1; display: flex; flex-direction: column; gap: .8vh; margin-top: 2vh; min-height: 0; }
.board .r { flex: 1; max-height: 11vh; min-height: 0; display: flex; align-items: center; gap: 1.4vw; background: var(--panel); border: 1px solid var(--line); border-radius: 1.2vh; padding: 0 1.6vw; overflow: hidden; }
.board .r.off { opacity: .45; }
.board .r.fin { border-color: var(--gold); }
.board .sw { width: 1.6vh; height: 60%; border-radius: 1vh; flex: none; }
.board .nm { width: 15vw; font-weight: 700; font-size: clamp(16px, 2vw, 34px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.board .tr { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: .7vw; color: var(--mute); font-size: clamp(13px, 1.35vw, 24px); white-space: nowrap; overflow: hidden; }
.board .tr span { overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
.board .tr span.cur { color: var(--ink); font: 600 clamp(16px, 1.9vw, 32px) Georgia, serif; flex: 0 0 auto; max-width: 60%; }
.board .tr i { font-style: normal; opacity: .5; flex: none; }
.board .ck { width: 9vw; display: flex; align-items: baseline; justify-content: flex-end; gap: .5vw; flex: none; font-variant-numeric: tabular-nums; }
.board .ck b { font-size: clamp(20px, 2.6vw, 44px); }
.board .ck span { font-size: clamp(10px, 1vw, 16px); color: var(--mute); }
.tvfoot { flex: none; display: flex; align-items: center; justify-content: space-between; color: var(--mute); margin-top: 1.4vh; font-size: clamp(13px, 1.2vw, 20px); }
.lobby { flex: 1; display: grid; grid-template-columns: minmax(260px, 34vw) 1fr; gap: 4vw; align-items: center; min-height: 0; }
.join { text-align: center; }
.join .qr { background: #fff; border-radius: 14px; padding: 12px; width: min(30vw, 46vh); margin: 0 auto; }
.join .qr svg { display: block; width: 100%; height: auto; }
.join .code { font: 700 clamp(40px, 6vw, 96px)/1 -apple-system, "Segoe UI", sans-serif; letter-spacing: .18em; margin-top: 2vh; color: var(--gold); }
.join p { color: var(--mute); margin: 1vh 0 0; font-size: clamp(14px, 1.4vw, 22px); }
.who h2 { font-size: clamp(30px, 4.4vw, 70px); }
.who .names { display: grid; grid-template-columns: 1fr 1fr; gap: 1vh 1.4vw; margin: 3vh 0; font-size: clamp(18px, 2.2vw, 36px); min-height: 20vh; align-content: start; }
.who .names div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .names .none { color: var(--mute); grid-column: 1 / -1; }
.who .chips { max-width: 520px; }
.count { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 0; }
.count .num { font: 700 16vh/1 Georgia, serif; color: var(--gold); }
.count .vs { grid-template-columns: 1fr auto 1fr; align-items: center; width: min(1100px, 90vw); gap: 2vw; }
.count .art { text-align: left; }
.count .art b { font-size: clamp(22px, 2.6vw, 40px); }
.count .art img { width: 12vh; height: 12vh; }
.podium { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 38vw) 1fr; gap: 3vw; margin-top: 2vh; }
.podium .champ { background: var(--panel); border: 2px solid var(--gold); border-radius: 2vh; padding: 3vh 2.4vw; overflow: hidden; display: flex; flex-direction: column; }
.podium .champ small { color: var(--gold); letter-spacing: .2em; font-weight: 700; font-size: clamp(13px, 1.3vw, 22px); }
.podium .champ h2 { font-size: clamp(30px, 4.2vw, 72px); line-height: 1.05; margin: .6vh 0 1vh; overflow-wrap: anywhere; }
.podium .champ .st { font-size: clamp(18px, 2vw, 34px); }
.podium .champ ol { margin: 2vh 0 0; padding-left: 1.4em; color: var(--mute); font-size: clamp(14px, 1.5vw, 24px); overflow: hidden; flex: 1; min-height: 0; column-width: 14vw; }
.podium .champ ol li:last-child { color: var(--gold); }
.podium .board { margin-top: 0; }
@media (max-width: 760px) {
  .tv { height: auto; min-height: 100svh; overflow: visible; }
  .lobby, .podium { grid-template-columns: 1fr; }
  .join .qr { width: min(60vw, 260px); }
  .board .r { min-height: 56px; }
  .board .nm { width: 30vw; } .board .ck { width: 20vw; }
  .count .vs { grid-template-columns: 1fr; }
}
