@font-face { font-family: "Lilita"; src: url("/fonts/lilita.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Onest"; src: url("/fonts/onest.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --sky: #8fd3ff; --sky2: #d9f3ff; --coral: #ff6b5a; --coral-dk: #c23626; --sun: #ffd23f;
  --ink: #1d1b3a; --ink2: #4a4770; --mute: #6b6890; --line: #e3e8f7; --blue: #3d8bfd; --wash: #eef4ff;
  --display: "Lilita", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, monospace;
  --gut: 16px; --bar: 72px; --tagw: 500px;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: linear-gradient(#8fd3ff, #d9f3ff 75%); color: var(--ink); font: 400 16px/1.45 var(--body); overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
a { color: inherit; }
button { font: inherit; color: inherit; }
img { display: block; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 12px; }

/* the lobby: a 3D island (src/lobby3d.js) over its own poster; transparent links follow the doors */
.lobby-art { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: #a9dcff; }
.lobby-art #lobby3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .7s ease; }
.lobby-art.is3d #lobby3d { opacity: 1; }
.lobby-art img { width: 100%; height: 100%; object-fit: cover; object-position: 60% 50%; display: block; }
.door-layer { position: absolute; inset: 0; pointer-events: none; }
.art-door { position: absolute; pointer-events: auto; border-radius: 10px; cursor: pointer; }
.art-door:focus-visible { outline: 4px solid #fff; outline-offset: 2px; }
.view { position: relative; z-index: 2; }
body[data-view="room"] .lobby-art, body[data-view="room"] .door-layer { display: none; }
body[data-view="week"] .door-layer, body[data-view="rules"] .door-layer { display: none; }
body[data-view="week"] .lobby-art img, body[data-view="rules"] .lobby-art img, body[data-view="week"] #lobby3d, body[data-view="rules"] #lobby3d { filter: saturate(.8) blur(4px); animation: none; }
body[data-view="lobby"] .doors { display: none; }

/* ---------- plates: PIL toy plastic, 9-sliced. The image's 10px shadow sits outside the box (outset). ---------- */
.plate { border: 0 solid; border-image: url("/img/ui/panel.png") 72 fill / 36px / 10px stretch; padding: 24px; }
.plate-chip { border: 0 solid; border-image: url("/img/ui/chip.png") 28 fill / 14px stretch; }
.btn {
  --plate: url("/img/ui/btn-white.png");
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 60px; padding: 0 26px 6px; border: 0 solid; background: none;
  border-image: var(--plate) 64 fill / 30px / 9px stretch;
  font: 400 23px/1 var(--display); color: var(--ink); text-decoration: none; white-space: nowrap;
  cursor: pointer; user-select: none; transition: transform .08s ease, filter .1s;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.03); }
.btn:active { transform: translateY(2px); }
.btn-coral { --plate: url("/img/ui/btn-coral.png"); color: #fff; }
.btn-yellow { --plate: url("/img/ui/btn-yellow.png"); }
.btn-ink { --plate: url("/img/ui/btn-ink.png"); color: #fff; }
.btn:disabled { opacity: .55; cursor: wait; transform: none; }
.btn img { width: 26px; height: 26px; }
.btn.wide { width: 100%; }
.btn-small {
  display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 14px 3px;
  border: 0 solid; border-image: url("/img/ui/chip.png") 28 fill / 14px stretch; background: none;
  font: 600 14px/1 var(--body); color: var(--ink); cursor: pointer; white-space: nowrap;
}
.btn-small:hover { filter: brightness(1.04); }
.btn-small:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: none; cursor: pointer; border-radius: 12px; flex: none; }
.icon-btn img { width: 30px; height: 30px; transition: transform .1s; }
.icon-btn:hover img { transform: scale(1.1); }

/* ---------- the address pill = navigation ---------- */
.addr {
  position: fixed; z-index: 10; top: 12px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px; height: 56px; padding: 0 8px 4px 20px; white-space: nowrap;
  border: 0 solid; border-image: url("/img/ui/pill.png") 76 fill / 38px / 10px stretch;
  max-width: calc(100% - 2 * var(--gut));
}
.addr-home { font: 400 25px/1 var(--display); text-decoration: none; padding: 6px 2px; color: var(--ink); }
.addr-sep { color: #aab1cc; font: 400 22px/1 var(--display); padding: 0 2px; }
.addr-pages, .addr-room { display: flex; align-items: center; gap: 2px; }
.seg { display: inline-flex; align-items: center; height: 40px; font: 600 16px/1 var(--body); text-decoration: none; padding: 0 15px 2px; color: var(--ink2); border: 0 solid; border-radius: 20px; }
.seg:hover { color: var(--ink); background: rgba(61, 139, 253, .1); }
.seg[aria-current="page"], .seg.seg-on { color: #fff; background: none; border-image: url("/img/ui/seg-on.png") 44 fill / 20px stretch; }
.seg-static { color: var(--mute); padding: 0 2px; }
.seg-static:hover { background: none; color: var(--mute); }
#room-code { font-family: var(--mono); font-weight: 700; letter-spacing: .03em; }

/* ---------- lobby ---------- */
#lobby { min-height: 100vh; min-height: 100dvh; pointer-events: none; }
#lobby > * { pointer-events: auto; }
/* centred in the space the key tag leaves free on the right */
.hero { position: absolute; left: 0; right: calc(var(--tagw) + 20px); margin-inline: auto; bottom: clamp(24px, 6vh, 70px); width: min(720px, calc(100vw - var(--tagw) - 60px)); text-align: center; }
.hero h1 { font: 400 clamp(46px, 5vw, 80px)/.98 var(--display); margin: 0 0 16px; text-wrap: balance; text-shadow: 0 3px 0 rgba(255,255,255,.7), 0 0 24px rgba(255,255,255,.55); }
.lede { font: 500 clamp(17px, 1.3vw, 19px)/1.45 var(--body); margin: 0 auto 22px; max-width: 30em; text-shadow: 0 1px 0 rgba(255,255,255,.8), 0 0 14px rgba(255,255,255,.9); }
/* the headline sits on a cloud of the same world, so it reads over the island at any width */
.hero::before { content: ""; position: absolute; z-index: -1; left: 50%; top: -60px; transform: translateX(-50%); width: 980px; height: 400px;
  background: url("/img/ui/cloud.png") center / contain no-repeat; filter: drop-shadow(0 18px 24px rgba(60, 110, 170, .18)); pointer-events: none; }
.cta { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }
.weekline { display: inline-flex; align-items: center; height: 40px; margin-top: 20px; padding: 0 14px 3px; font: 600 15px/1 var(--body); text-decoration: none;
  border: 0 solid; border-image: url("/img/ui/chip.png") 28 fill / 14px stretch; }
.weekline:hover { text-decoration: underline; }

.doors { position: absolute; right: max(24px, 2.5vw); top: 100px; width: 340px; max-height: calc(100vh - 140px); display: flex; flex-direction: column; }
.doors h2 { font: 400 27px/1 var(--display); margin: 0 0 14px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.doors .count { font: 600 14px/1 var(--body); color: var(--mute); }
.door-list { list-style: none; margin: 0; padding: 0; overflow: auto; display: grid; gap: 8px; }
.door-list a { display: grid; grid-template-columns: 88px 1fr auto; align-items: center; gap: 12px; height: 52px; padding: 0 12px 3px 8px; text-decoration: none;
  border: 0 solid; border-image: url("/img/ui/chip.png") 28 fill / 14px stretch; }
.door-list a:hover, .door-list a.hot { filter: brightness(1.05); }
.door-code { display: grid; place-items: center; height: 34px; font: 700 15px/1 var(--mono); border-radius: 10px; color: var(--ink); }
.door-mode { display: flex; align-items: center; gap: 8px; font: 600 15px/1.2 var(--body); color: var(--ink2); }
.door-mode img { width: 26px; height: 26px; }
.door-n { font: 400 20px/1 var(--display); }
.doors-empty { margin: 2px 0 0; color: var(--ink2); font-size: 15px; }

/* the master key: a hotel key tag; its face is 26.5..94% wide and 9..61% high of the picture */
.keytag { position: absolute; right: 10px; bottom: 6px; width: max(var(--tagw), 500px); aspect-ratio: 1000 / 459;
  background: url("/img/ui/keytag.png") 0 0 / 100% 100% no-repeat; filter: drop-shadow(0 8px 10px rgba(40, 30, 90, .22)); }
.keytag-face { position: absolute; left: 27%; right: 7%; top: 10.5%; height: 49%; display: flex; flex-direction: column; justify-content: space-between; }
.keytag h2 { margin: 0; display: flex; align-items: baseline; gap: 10px; color: #fff; }
.keytag .tick { font: 400 27px/1 var(--display); text-shadow: 0 2px 0 var(--coral-dk); }
.key-sub { font: 600 13px/1 var(--body); white-space: nowrap; }
.ca-row { display: flex; gap: 8px; align-items: center; }
.ca { flex: 1; min-width: 0; height: 34px; display: flex; align-items: center; padding: 0 10px; font: 600 11.5px/1 var(--mono); color: var(--ink);
  white-space: nowrap; overflow-x: auto; user-select: all; border: 0 solid; border-image: url("/img/ui/well.png") 28 fill / 12px stretch; scrollbar-width: none; }
.ca.empty { font: 500 13px/1 var(--body); color: var(--mute); user-select: none; }
.ca-row .btn-small { height: 34px; }
.key-links { display: flex; gap: 8px; }
.kbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 12px 4px; text-decoration: none; cursor: pointer;
  border: 0 solid; border-image: url("/img/ui/btn-white.png") 64 fill / 18px / 5px stretch; font: 400 17px/1 var(--display); color: var(--ink); }
.kbtn img { width: 22px; height: 22px; }
.kbtn.buy { flex: 1; }
.kbtn.xbtn { width: 46px; padding: 0 0 4px; border-image-source: url("/img/ui/btn-ink.png"); }
.kbtn.xbtn img { width: 18px; height: 18px; }
.kbtn:hover { transform: translateY(-1px); }
.kbtn[aria-disabled="true"] { cursor: help; }
.kbtn[aria-disabled="true"] img, .kbtn[aria-disabled="true"] span { opacity: .55; }

/* ---------- room: the world in a frame under the link bar ---------- */
#room { position: fixed; inset: 0; background: var(--ink); }
#room #race { position: absolute; left: 0; top: var(--bar); width: 100%; height: calc(100% - var(--bar)); display: block; touch-action: none; }
#room .race-hud { position: absolute; inset: var(--bar) 0 0 0; }
#room::before { content: ""; position: absolute; inset: 0 0 auto; height: var(--bar); background: linear-gradient(#8fd3ff, #bfe6ff); }
body[data-view="room"] .addr { top: 8px; }
.room-world { position: absolute; z-index: 3; left: 12px; top: 14px; height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 14px 3px 8px; font: 600 15px/1 var(--body); }
.room-world img { width: 30px; height: 30px; }
.room-n { color: var(--mute); padding-left: 10px; border-left: 2px solid var(--line); }
.room-n b { color: var(--ink); font: 400 18px/1 var(--display); margin-right: 3px; }
.room-state { position: absolute; inset: var(--bar) 0 0; display: grid; place-items: center; padding: 24px var(--gut);
  background: linear-gradient(#bfe6ff, #d9f3ff); }
.state-card { width: min(520px, 100%); text-align: center; }
.state-card h1 { font: 400 clamp(30px, 4vw, 42px)/1.05 var(--display); margin: 0 0 12px; }
.state-card p { margin: 0 0 18px; color: var(--ink2); }

.rotate-hint { display: none; }
@media (orientation: portrait) and (max-width: 900px) {
  body[data-world="rpg"] .rotate-hint:not([hidden]) { display: block; position: absolute; z-index: 3; left: 50%; bottom: 18px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px);
    margin: 0; background: var(--ink); color: #fff; font: 600 14px/1.3 var(--body); padding: 10px 14px; border-radius: 12px; text-align: center; }
}

/* ---------- week & rules pages ---------- */
.page { min-height: 100vh; padding: 100px var(--gut) 60px; }
.page-inner { max-width: 860px; margin: 0 auto; }
.page h1 { font: 400 clamp(38px, 5vw, 58px)/1 var(--display); margin: 0 0 18px; }
.page h2 { font: 400 27px/1.1 var(--display); margin: 32px 0 10px; }
.page p { margin: 0 0 12px; max-width: 68ch; }
.week-top { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
.stat { background: var(--wash); border-radius: 16px; padding: 14px 16px; }
.stat span { display: block; font: 600 13px/1.2 var(--body); color: var(--ink2); }
.stat b { font: 400 30px/1.15 var(--display); }
.week-note { color: var(--ink2); font-size: 15px; }
.me { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: var(--wash); border-radius: 16px; padding: 14px 16px; margin: 14px 0 22px; }
.me b { display: block; font: 400 22px/1.1 var(--display); }
.me span { font-size: 14px; color: var(--ink2); }
.me-actions { display: flex; gap: 12px; align-items: center; }
.me .btn { height: 50px; font-size: 19px; padding: 0 20px 5px; }
.tabs { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs button { border: 0; background: var(--wash); height: 42px; padding: 0 16px; border-radius: 14px; font: 600 15px/1 var(--body); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }
.table { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.table li { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; min-height: 42px; padding: 6px 10px; border-radius: 10px; font: 600 15px/1.2 var(--body); }
.table li:nth-child(odd) { background: #f5f8ff; }
.table li > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .rk { font: 400 18px/1 var(--display); color: var(--ink2); text-align: right; }
.table .wl { font: 500 13px/1 var(--mono); color: var(--mute); }
.table .pt { font: 400 20px/1 var(--display); min-width: 3ch; text-align: right; }
.table .x2 { font: 700 11px/1 var(--body); background: var(--sun); padding: 3px 5px; border-radius: 6px; margin-left: 6px; vertical-align: 2px; }
.table .empty, .payouts .empty { grid-template-columns: 1fr; color: var(--ink2); background: none !important; font-weight: 500; }
.payouts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.payouts li { padding: 10px 12px; border-radius: 12px; background: #f5f8ff; font-size: 15px; }
.payouts a { font-family: var(--mono); font-size: 13px; }
.rules code { font: 600 14px/1.3 var(--mono); background: var(--wash); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.modes { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 14px; }
.modes li { display: grid; grid-template-columns: 52px 1fr; gap: 14px; align-items: start; }
.modes img { width: 52px; height: 52px; }
.credits { font-size: 14px; color: var(--ink2); }
.risk { margin-top: 30px !important; font-size: 13px; color: var(--mute); }

/* ---------- dialogs, toast ---------- */
dialog.card { position: fixed; margin: auto; color: var(--ink); background: none; width: min(460px, calc(100% - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
dialog::backdrop { background: rgba(29, 27, 58, .5); }
dialog h2 { font: 400 30px/1.05 var(--display); margin: 0 0 12px; }
dialog p { margin: 0 0 16px; color: var(--ink2); }
.share-link { margin-bottom: 16px; }
.share-link code { display: block; font: 700 16px/1.35 var(--mono); padding: 14px; border-radius: 12px; background: var(--wash); word-break: break-all; user-select: all; }
dialog .cta { margin-bottom: 16px; flex-wrap: nowrap; }
dialog .cta .btn { flex: 1; font-size: 19px; height: 54px; padding: 0 12px 5px; }
.field span { display: block; font-size: 14px; color: var(--ink2); margin-bottom: 8px; }
.field input { width: 100%; font: 600 20px/1 var(--body); padding: 14px; border: 2px solid var(--line); border-radius: 12px; margin-bottom: 16px; color: var(--ink); }
.field input:focus { border-color: var(--blue); outline: none; }
#pick { width: min(720px, calc(100% - 32px)); }
.worlds { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 14px; }
.world { position: relative; display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 10px 10px 16px; border: 0; cursor: pointer; background: var(--wash); border-radius: 18px; transition: transform .1s, box-shadow .1s; }
.world:hover { transform: translateY(-3px); box-shadow: 0 8px 0 #c9d1ea; }
.world img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 12px; margin-bottom: 6px; }
.world b { font: 400 26px/1 var(--display); padding: 0 6px; }
.world span { font-size: 14px; color: var(--ink2); padding: 0 6px; }
.w-state { position: absolute; left: 18px; top: 18px; font: 700 12px/1 var(--body); font-style: normal; padding: 6px 9px; border-radius: 8px; background: #fff; }
.w-state.on { background: #c9f7dd; color: #0e6b3c; }
.w-state.off { background: #fff; color: var(--mute); }
.pick-cancel { display: flex; margin: 0 auto; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--ink); color: #fff; font: 600 15px/1.3 var(--body); padding: 12px 18px; border-radius: 14px; max-width: calc(100% - 32px); }
.nojs { position: relative; z-index: 5; text-align: center; padding: 120px 16px; }

@media (min-width: 1700px) { :root { --tagw: 0px; } }
@media (max-width: 1180px) {
  :root { --tagw: 420px; }
  .hero h1 { font-size: 48px; }
  .keytag { width: 420px !important; }
  .keytag .tick { font-size: 24px; }
  .key-sub { font-size: 11px; white-space: nowrap; }
  .ca { font-size: 10px; }
  .kbtn { font-size: 15px; height: 36px; }
}

/* ---------- phones and tablets: one column; the key tag becomes a plate with the tag as its badge ---------- */
@media (max-width: 900px) {
  :root { --bar: 116px; }
  .addr { top: 10px; padding-left: 16px; }
  .addr-home { font-size: 21px; }
  .seg { padding: 0 10px 2px; font-size: 15px; }
  body[data-view="lobby"] .doors { display: flex; }
  #lobby { padding: calc(100vw * 1672 / 941 * 0.6) var(--gut) 28px; display: flex; flex-direction: column; gap: 22px; pointer-events: none; }
  #lobby > * { position: static; width: auto; }
  .hero { text-align: center; width: auto; }
  .hero::before { display: none; }
  .hero h1 { font-size: clamp(40px, 11vw, 58px); }
  .cta { justify-content: center; }
  .cta .btn { flex: 1 1 150px; font-size: 21px; padding: 0 12px 6px; }
  .weekline { display: flex; justify-content: center; width: fit-content; margin: 18px auto 0; height: auto; min-height: 40px; padding: 8px 14px 10px; text-align: center; line-height: 1.3; }
  .doors { max-height: none; }
  .door-list { max-height: 360px; }
  #lobby > .keytag { position: relative; }
  .keytag { left: auto; bottom: auto; width: 100%; aspect-ratio: auto; background: none; filter: none;
    border: 0 solid; border-image: url("/img/ui/panel.png") 72 fill / 36px / 10px stretch; padding: 20px 18px 22px 76px; }
  .keytag::before { content: ""; position: absolute; left: 6px; top: 14px; width: 64px; height: 64px; background: url("/img/ui/keytag.png") 0 0 / 230px auto no-repeat; }
  .keytag-face { position: static; height: auto; gap: 12px; }
  .keytag h2 { flex-direction: column; align-items: flex-start; gap: 4px; color: var(--ink); }
  .keytag .tick { color: var(--coral); text-shadow: none; font-size: 28px; }
  .key-sub { color: var(--ink2); font-size: 14px; }
  .ca { height: auto; min-height: 40px; white-space: normal; word-break: break-all; font-size: 13px; line-height: 1.3; padding: 8px 10px; }
  .ca.empty { word-break: normal; }
  .kbtn { height: 48px; font-size: 16px; border-image-width: 22px; white-space: nowrap; padding: 0 10px 4px; }
  .kbtn.xbtn { width: 52px; }
  .worlds { grid-template-columns: 1fr; }
  .room-world { top: 70px; left: 50%; transform: translateX(-50%); white-space: nowrap; }
  .week-top { grid-template-columns: 1fr 1fr; }
  .week-top .stat:last-child { grid-column: 1 / -1; }
  .me-actions { width: 100%; justify-content: space-between; }
}
@media (max-width: 400px) {
  .addr-home { font-size: 18px; }
  .seg { padding: 0 7px 2px; font-size: 14px; }
  .addr { gap: 1px; padding-right: 6px; }
  .icon-btn { width: 38px; }
  .table li { grid-template-columns: 28px minmax(0, 1fr) auto; }
  .table .wl { display: none; }
}
@media (max-aspect-ratio: 4/5) {
  .lobby-art { position: absolute; bottom: auto; height: calc(100vw * 1672 / 941); }
  .lobby-art img { animation: none; transform: none; object-position: 50% 50%; }
  .lobby-art::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 18%; background: linear-gradient(rgba(217, 243, 255, 0), #d9f3ff); pointer-events: none; }
  body { background: #d9f3ff; }
}
@media (prefers-reduced-motion: reduce) { .btn, .icon-btn img, .world { transition: none; } .lobby-art img { animation: none; } .lobby-art #lobby3d { transition: none; } }

/* ---------- the race ---------- */
.race-page { margin: 0; overflow: hidden; background: #a9dcff; height: 100vh; height: 100dvh; }
#race { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.race-hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; font-family: var(--body); color: var(--ink); }
.race-hud > * { position: absolute; }
.k-load { inset: 0; display: grid; place-content: center; gap: 14px; background: linear-gradient(#8fd3ff, #d9f3ff); text-align: center; z-index: 9; }
.k-load b { font: 400 34px/1 var(--display); }
.k-load i { display: block; width: 260px; height: 14px; border-radius: 8px; background: rgba(29,27,58,.15); overflow: hidden; }
.k-load i span { display: block; height: 100%; width: 0; background: var(--coral); transition: width .2s; }
.k-place { left: 18px; top: 16px; display: flex; align-items: baseline; gap: 8px; padding: 6px 16px 10px; }
.k-place b { font: 400 54px/1 var(--display); color: var(--coral); text-shadow: 0 3px 0 var(--coral-dk); }
.k-place span { font: 600 15px/1 var(--body); color: var(--ink2); }
.k-lap { right: 18px; top: 16px; display: grid; grid-template-columns: auto auto; column-gap: 10px; align-items: baseline; padding: 10px 16px 13px; }
.k-lap span { font: 600 14px/1 var(--body); color: var(--ink2); }
.k-lap b { font: 400 34px/1 var(--display); }
.k-lap span:last-child { grid-column: 1 / -1; font: 600 16px/1.4 var(--mono); color: var(--ink); }
.k-item { right: 18px; top: 118px; width: 84px; height: 84px; display: grid; place-items: center; }
.k-item img { width: 60px; height: 60px; grid-area: 1 / 1; }
.k-item .k-noitem { opacity: .28; filter: grayscale(1); }
.k-item span { position: absolute; right: 8px; bottom: 6px; font: 700 12px/1 var(--body); color: var(--mute); }
.k-map { left: 18px; bottom: 18px; width: 180px; height: 180px; background: rgba(255,255,255,.55); border-radius: 22px; }
.k-speed { right: 22px; bottom: 20px; text-align: right; color: #fff; text-shadow: 0 2px 0 rgba(29,27,58,.6); }
.k-speed b { font: 400 54px/1 var(--display); }
.k-speed > span { font: 600 15px/1 var(--body); margin-left: 4px; }
.k-charge { display: block; width: 190px; height: 12px; margin-top: 8px; margin-left: auto; border-radius: 7px; background: rgba(29,27,58,.35); overflow: hidden; }
.k-charge span { display: block; height: 100%; width: 0; border-radius: 7px; background: #4cc9ff; }
.k-charge span[data-lvl="2"] { background: #ff9f1c; } .k-charge span[data-lvl="3"] { background: #ff4fd8; }
.k-count { left: 50%; top: 30%; transform: translate(-50%, -50%); font: 400 clamp(90px, 16vw, 200px)/1 var(--display); color: #fff; text-shadow: 0 8px 0 var(--coral-dk), 0 0 40px rgba(29,27,58,.35); }
.k-flash { left: 50%; top: 20%; transform: translateX(-50%); font: 400 clamp(28px, 4vw, 46px)/1 var(--display); color: #fff; text-shadow: 0 4px 0 var(--ink); white-space: nowrap; animation: kpop .35s cubic-bezier(.2,1.6,.4,1); }
@keyframes kpop { from { transform: translateX(-50%) scale(.6); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
.k-keys { left: 50%; bottom: 22px; transform: translateX(-50%); background: rgba(29,27,58,.72); color: #fff; font: 600 14px/1 var(--body); padding: 11px 16px; border-radius: 12px; white-space: nowrap; }
.k-lobby { left: 50%; top: 18px; transform: translateX(-50%); display: grid; justify-items: center; gap: 4px; padding: 12px 22px 15px; text-align: center; }
.k-lobby b { font: 400 30px/1 var(--display); }
.k-lobby span { font: 600 14px/1.3 var(--body); color: var(--ink2); }
.k-results { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100% - 32px)); pointer-events: auto; }
.k-results h2 { font: 400 34px/1 var(--display); margin: 0 0 12px; }
.k-results ol { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 3px; }
.k-results li { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; padding: 7px 10px; border-radius: 10px; font: 600 16px/1.2 var(--body); }
.k-results li.me { background: #fff3c4; }
.k-results li b { font: 400 20px/1 var(--display); color: var(--ink2); }
.k-results li em { font: 600 14px/1.2 var(--mono); font-style: normal; color: var(--ink2); }
.k-results p { font-size: 14px; color: var(--ink2); margin: 0 0 14px; }
.k-touch { inset: auto 0 0 0; height: 46%; pointer-events: none; }
.k-t { position: absolute; pointer-events: auto; touch-action: none; border: 0; border-radius: 50%; background: rgba(255,255,255,.75); box-shadow: 0 6px 0 rgba(29,27,58,.25);
  font: 400 26px/1 var(--display); color: var(--ink); width: 86px; height: 86px; }
.k-t.on { transform: translateY(4px); box-shadow: 0 2px 0 rgba(29,27,58,.25); background: #fff; }
.k-left { left: 18px; bottom: 30px; } .k-right { left: 118px; bottom: 30px; }
.k-drift { right: 18px; bottom: 30px; width: 100px; height: 100px; font-size: 20px; background: rgba(255,107,90,.85); color: #fff; }
.k-use { right: 130px; bottom: 60px; width: 76px; height: 76px; font-size: 16px; }
.k-brake { right: 40px; bottom: 150px; width: 60px; height: 60px; font-size: 18px; }
@media (pointer: coarse) { .k-map { left: auto; right: 14px; top: 210px; bottom: auto; width: 120px; height: 120px; } .k-speed { display: none; } .k-place b { font-size: 42px; } }
.k-mute { left: 18px; top: 96px; height: 36px; padding: 0 12px 3px; border-width: 0; background: none; font: 600 13px/1 var(--body); color: var(--ink); cursor: pointer; pointer-events: auto; }

/* phones upright: a tighter HUD, no minimap, the lobby note under the counters */
@media (pointer: coarse) and (orientation: portrait) {
  .k-place { left: 10px; top: 10px; padding: 4px 12px 7px; } .k-place b { font-size: 32px; }
  .k-lap { right: 10px; top: 10px; padding: 7px 12px 9px; } .k-lap b { font-size: 24px; }
  .k-item { right: 10px; top: 84px; width: 64px; height: 64px; } .k-item img { width: 46px; height: 46px; }
  .k-map { display: none; }
  .k-mute { left: 10px; top: 70px; height: 32px; }
  .k-lobby { top: 118px; width: calc(100% - 24px); padding: 10px 14px 12px; } .k-lobby b { font-size: 22px; }
  .k-flash { top: 30%; }
  .k-t { width: 74px; height: 74px; } .k-right { left: 100px; } .k-drift { width: 88px; height: 88px; }
}
/* phones on their side: the link bar shrinks to one slim row so the track gets the height */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --bar: 56px; }
  body[data-view="room"] .addr { top: 4px; height: 48px; }
  .room-world { display: none; }
  .k-map { width: 110px; height: 110px; }
  .k-touch { height: 60%; }
}
