/* Website layer (served pages only): '/' = fullscreen multiplayer, '/build' = builder with Submit, '/tracks' = list. */
.site-only,.site-play-only,.site-build-only{display:none!important}
body.site .site-only{display:flex!important}
body.site-play .site-play-only{display:flex!important}
body.site-build .site-build-only:not(.hidden){display:inline-flex!important}
body.site-build:not([data-mode=build]) .site-build-only{display:none!important}

/* ---- the site header: the same on every page (Play, Build, Tracks, time trial): brand, Play / Build / Tracks tabs,
   the page's own info, then the rider chip at the right.  56 px, white, a line underneath. */
.brand-name{white-space:nowrap}
body.site .topbar,.tk-top,.site-bar{height:56px;padding:0 16px;gap:12px;background:#fff;border-bottom:1px solid var(--line)}
body.site .brand-mark,.site-bar .brand-mark{width:32px;height:32px;font-size:13px}
.site-nav{display:flex;gap:4px;align-items:center;margin-left:10px;margin-right:auto}
.site-bar .site-nav{margin-right:0}
.tk-top .me-chip{margin-left:auto}
body.site-build .pill,body.site-build #settingsBtn{display:none!important}
.me-chip{font-size:12px}
body.site .topbar .button{padding:0 11px;font-size:12px;height:32px;display:inline-flex;align-items:center}
body.site .topbar .button kbd{height:18px;min-width:20px}
body.site .top-actions{gap:8px}
.site-nav a.cur-tracks{background:transparent;color:#4b5967}
.site-nav a{padding:7px 12px;border-radius:8px;color:#4b5967;font-weight:800;font-size:12px;text-decoration:none;letter-spacing:.02em}
.site-nav a:hover{background:#f1f4f7;color:#26323d}
body.site-build .site-nav a.cur-build,body.site-play:not(.site-trial) .site-nav a.cur-play,body.site-trial .site-nav a.cur-tracks,body.site-tracks .site-nav a.cur-tracks{background:#fff1e6;color:#c2510a}

/* ---------------- fullscreen play page ---------------- */
body.site-play .topbar,body.site-play .rail,body.site-play .footer,body.site-play .stage-badge,body.site-play #startOverlay{display:none!important}
body.site-play .workspace{display:block!important;position:relative;height:100vh}
body.site-play .stage-wrap{position:absolute;inset:0}
body.site-play .info-panel{display:block!important;position:absolute;right:12px;top:68px;width:240px;max-height:calc(100vh - 120px);overflow-y:auto;padding:10px 12px;background:rgba(255,255,255,.88);border:1px solid #e2e7ec;border-radius:12px;box-shadow:0 4px 18px rgba(31,45,61,.08);z-index:3}
body.site-play .info-panel>:not(#playersPanel){display:none!important}
body.site-play #playersPanel .panel-rule{display:none}
body.site-play .player-list{max-height:none}
body.site-play .stage-tools{top:auto;bottom:10px;right:12px;z-index:3}
body.site-play .fps-counter{top:68px;left:12px}
/* race pages, under the top bar: row 1 = messages (and slow motion), row 2 = the race box (time, goals, restarts,
   time left).  Messages use the race box's look, with a coloured dot for the kind of message. */
body.site-play .race-hud{top:66px}
body.site-play .vote-skip{top:98px}
body.site-play.touch-on .vote-skip{top:calc(var(--hdr) + 6px);left:8px;padding:6px 9px;font-size:11px}
body.site-play.hud-on .msgbox#toast{top:110px}
body.site .msgbox{top:66px;height:auto;min-width:0;line-height:1.2;padding:8px 14px 8px 12px;display:none;align-items:center;gap:8px;border-radius:9px;background:rgba(255,255,255,.94)!important;border:1px solid #dce2e8;box-shadow:0 3px 12px rgba(38,52,66,.08);font:700 13px/1.2 Inter,ui-sans-serif,system-ui,sans-serif;color:#26323d;max-width:calc(100% - 540px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body.site .msgbox.visible{display:flex}
body.site .msgbox::before{content:"";width:9px;height:9px;border-radius:50%;flex:none;background:#e6b422}
body.site .msgbox[data-tone=good]::before{background:#2fb344}
body.site .msgbox[data-tone=bad]::before{background:#dc4f36}
body.site .msgbox[data-tone=grey]::before,body.site .msgbox.slowbox::before{background:#8a96a2}
body.site-play .msgbox#toast.below{top:66px}
body.site-play .msgbox.slowbox{top:110px}
body.site-play #raceSlow{color:#6a8dd8}
@media(max-width:900px){body.site .msgbox{max-width:calc(100% - 24px)}}
/* build page: the message sits at the top of the canvas, between the TRACK EDITOR badge and the zoom box; slow motion under it */
body.site-build .msgbox{top:14px;max-width:calc(100% - 560px)}
body.site-build .msgbox.slowbox{top:14px}
body.site-build .msgbox#toast.below{top:52px}
body.site-play #lobbyCard{left:50%;right:auto;top:120px;transform:translateX(-50%);width:min(420px,calc(100% - 300px));text-align:center}
body.site-play #lobbyCard h2{font-size:20px}

.site-bar{position:absolute;left:0;right:0;top:0;align-items:center;background:rgba(255,255,255,.95)!important;backdrop-filter:blur(6px);z-index:4;font-size:12px;color:#4b5967}
.site-logo{display:flex;text-decoration:none}.site-logo .brand-mark{width:30px;height:30px;font-size:12px}
.me-chip{display:flex;align-items:center;gap:7px;padding:5px 10px;border-radius:20px;background:#f4f6f8;font-weight:800;color:#26323d;white-space:nowrap}
.me-chip i{width:11px;height:11px;border-radius:50%;background:var(--me,#999);box-shadow:0 0 0 2px #fff}
.site-sep{width:1px;height:20px;background:#e2e7ec}
.site-track{font-weight:800;color:#26323d;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.site-track small{font-weight:600;color:#8a96a2;margin-left:6px}
.site-lobby{font-size:10px;font-weight:850;letter-spacing:.12em;color:#8a96a2;white-space:nowrap}
.site-grow{flex:1}
.sub-vehs-row{align-items:flex-start}.sub-vehs{display:flex;flex-wrap:wrap;gap:4px 12px;max-width:340px;justify-content:flex-end}.sub-vehs label{display:flex;align-items:center;gap:5px;font-size:12px;font-weight:700;color:#4b5967;white-space:nowrap}.sub-vehs label.own{opacity:.55}
.site-veh{font:inherit;font-size:12px;font-weight:800;color:#26323d;padding:5px 8px;border:1px solid #e2e7ec;border-radius:8px;background:#fff;cursor:pointer}
.site-link{padding:6px 10px;border-radius:8px;text-decoration:none;color:#4b5967;font-weight:800;white-space:nowrap}
.site-link:hover{background:#f1f4f7;color:#26323d}
.site-btn{display:inline-flex;align-items:center;justify-content:center;padding:0;width:32px;height:32px;border:1px solid #e2e7ec;border-radius:8px;background:#fff;color:#4b5967;font-size:15px;line-height:1}
.site-btn:hover{background:#f1f4f7}
.site-help{position:absolute;left:12px;bottom:10px;padding:5px 10px;border-radius:8px;background:rgba(255,255,255,.82);font-size:11px;color:#6e7c89;z-index:2;pointer-events:none}
body.site .topbar .button{white-space:nowrap}
@media(max-width:1100px){body.site .brand>span:nth-child(2),.site-lobby,body.site .topbar .button kbd{display:none!important}}
@media(max-width:800px){.site-link,.site-lobby,.site-help,.site-bar .me-chip{display:none!important}body.site-play .info-panel{width:180px}body.site-play #lobbyCard{width:calc(100% - 24px);top:150px}}

/* ---------------- tracks page ---------------- */
body.site-tracks{overflow:auto;background:var(--bg)}
.tk-top{display:flex;align-items:center;position:sticky;top:0;z-index:2}
.tk-main{max-width:1100px;margin:0 auto;padding:26px 20px 60px}
.tk-head{display:flex;align-items:flex-end;gap:16px;margin-bottom:16px;flex-wrap:wrap}
.tk-head h1{margin:0;font-size:28px}
.tk-head p{margin:4px 0 0;color:#6e7c89;font-size:13px}
.tk-search{margin-left:auto;padding:9px 12px;border:1px solid #d8dee5;border-radius:9px;font:inherit;font-size:13px;min-width:240px;background:#fff}
.tk-table{width:100%;border-collapse:separate;border-spacing:0;background:#fff;border:1px solid var(--line);border-radius:12px;overflow:hidden;font-size:13px}
.tk-table th{text-align:left;font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:#8a96a2;font-weight:850;padding:11px 14px;border-bottom:1px solid var(--line);background:#fafbfc;cursor:pointer;user-select:none;white-space:nowrap}
.tk-table th.num,.tk-table td.num{text-align:right;font-variant-numeric:tabular-nums}
.tk-table td{padding:11px 14px;border-bottom:1px solid #f0f2f4;color:#4b5967;vertical-align:middle}
.tk-table tr:last-child td{border-bottom:none}
.tk-table tbody tr:hover td{background:#fbfcfd}
.tk-name{font-weight:800;color:#26323d}
.tk-open{padding:6px 10px;border:1px solid #d8dee5;border-radius:7px;color:#4b5967;text-decoration:none;font-weight:800;font-size:12px;white-space:nowrap}
.tk-open:hover{background:#f1f4f7}
.tk-empty{padding:40px;text-align:center;color:#8a96a2;background:#fff;border:1px dashed #d8dee5;border-radius:12px}
.tk-stats{display:flex;gap:10px;margin:0 0 16px;flex-wrap:wrap}
.tk-stat{background:#fff;border:1px solid var(--line);border-radius:10px;padding:10px 14px;font-size:12px;color:#6e7c89}.tk-stat b{display:block;font-size:20px;color:#26323d}
@media(max-width:700px){.tk-hide-sm{display:none}}

/* build page: always the editor (the rider rides while you build), so no editor / ride switch and no private rooms */
body.site-build #modeBtn,body.site-build #mpBtn{display:none!important}
.tk-row{cursor:pointer}.tk-row.open td{background:#fbfcfd}
.tk-play{background:#dc4f36;border-color:#dc4f36;color:#fff}.tk-play:hover{background:#c4432c;color:#fff}
.tk-del{margin-left:6px;padding:6px 10px;border:1px solid #e7b7ad;border-radius:7px;background:#fff5f3;color:#b3321c;font-weight:800;font-size:12px;cursor:pointer;white-space:nowrap}.tk-del:hover{background:#fdeae6;border-color:#d98b7b}
.tk-detail td{background:#fbfcfd;padding:4px 18px 14px}
.tk-times{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:4px 18px}
.tk-times li{display:grid;grid-template-columns:30px 12px 1fr auto auto auto;gap:8px;align-items:center;padding:5px 8px;border-radius:7px;font-size:12px;color:#4b5967}
.tk-times li:nth-child(-n+3){background:#fff7ec}
.tk-times li i{width:10px;height:10px;border-radius:50%}
.tk-times li b{color:#8a96a2;font-variant-numeric:tabular-nums}.tk-times li:first-child b{color:#c58a00}
.tk-times li em{font-style:normal;font-weight:800;color:#26323d;font-variant-numeric:tabular-nums}
.tk-times li small{color:#9aa4af;font-size:10.5px}
.tk-times-empty{padding:10px;color:#8a96a2;font-size:12px}
.tk-veh{margin-left:6px;padding:1px 5px;border-radius:5px;background:#eef2f5;color:#6e7c89;font-size:10px;font-weight:800}
.tk-times .tk-pts{color:#8a63d2;text-decoration:none;font-weight:800;font-variant-numeric:tabular-nums}

/* ---------------- phones and tablets ---------------- */
/* player list: hideable (the header stays, with the count and the ▾ / ▸ button) */
.players-head-r{display:flex;align-items:center;gap:6px}
.players-toggle{width:22px;height:22px;padding:0;border:1px solid #e2e7ec;border-radius:6px;background:#fff;color:#4b5967;font-size:11px;line-height:1}
.players-toggle:hover{background:#f1f4f7}
body.players-hidden #playerList{display:none}
body.players-hidden.site-play .info-panel{width:auto;min-width:130px}
/* settings: the controls list */
.ctl-grid{display:grid;grid-template-columns:auto 1fr auto 1fr;gap:6px 10px;align-items:center;font-size:12px;color:#4b5967;margin:4px 0 8px}
.ctl-grid kbd{justify-self:start}.ctl-keys{display:flex;gap:3px}.ctl-grid .ctl-wide{grid-column:span 3}
.code-dialog{max-height:calc(100vh - 24px);overflow:auto}
/* touch controls */
.touch-pad{display:none;position:absolute;inset:0;pointer-events:none;z-index:5}
body.site-play.touch-on .touch-pad{display:block}
.tp-btn{position:absolute;pointer-events:auto;width:78px;height:78px;padding:0;border-radius:50%;background:rgba(255,255,255,.9);border:3px solid #26323d;box-shadow:0 4px 0 rgba(38,50,61,.35);display:grid;place-items:center;color:#26323d;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}
.tp-btn svg{width:36px;height:36px}
.tp-btn.down{transform:translateY(3px);box-shadow:0 1px 0 rgba(38,50,61,.35);background:#ffe9dc;color:#c2510a;border-color:#c2510a}
.tp-btn.tp-mid{width:62px;height:62px}.tp-btn.tp-mid svg{width:32px;height:32px}
.tp-btn.tp-small{width:46px;height:46px;border-width:2px}.tp-btn.tp-small svg{width:20px;height:20px}
/* left edge: ↑ above ↓.  bottom right: ← then →, with turn round (Z) above →.  bottom centre: the two restarts. */
/* (hard against the screen edges, ignoring the notch's safe-area insets: in landscape iOS reports them on both
   sides for the full height, which pushed the controls far into the screen) */
.touch-pad{--tpe:10px}
#tpUp{left:var(--tpe);bottom:112px}
#tpDown{left:var(--tpe);bottom:20px}
#tpLeft{right:calc(var(--tpe) + 94px);bottom:20px}
#tpRight{right:var(--tpe);bottom:20px}
#tpZ{right:calc(var(--tpe) + 8px);bottom:112px}
#tpStart{left:calc(50% - 52px);bottom:20px}
#tpCp{left:calc(50% + 6px);bottom:20px}
@media(max-height:420px){
  .tp-btn{width:64px;height:64px}.tp-btn svg{width:30px;height:30px}.tp-btn.tp-mid{width:52px;height:52px}.tp-btn.tp-small{width:40px;height:40px}
  #tpUp{bottom:92px}#tpDown{bottom:16px}#tpLeft{right:calc(var(--tpe) + 76px);bottom:16px}#tpRight{bottom:16px}#tpZ{right:calc(var(--tpe) + 6px);bottom:92px}
  #tpStart{left:calc(50% - 46px);bottom:16px}#tpCp{left:calc(50% + 6px);bottom:16px}
}
/* with touch controls: the zoom box and the FPS counter move out of the way, the canvas never scrolls / zooms the page */
body.site-play.touch-on .stage-tools{bottom:auto;top:66px;right:auto;left:12px}
body.site-play.touch-on .fps-counter{display:none}
body.site-play.touch-on canvas{touch-action:none}
body.touch-on{overscroll-behavior:none}
/* short screens (a phone on its side): a slimmer header, everything under it moves up */
@media(max-height:520px){
  body.site .topbar,.site-bar{height:44px}
  body.site .brand-mark,.site-bar .brand-mark{width:28px;height:28px;font-size:11px}
  .site-bar .brand>span:nth-child(2),.site-bar .site-sep{display:none!important}
  body.site-play .msgbox{top:50px}body.site-play .race-hud{top:50px}body.site-play .vote-skip{top:98px}body.site-play .msgbox.slowbox,body.site-play.hud-on .msgbox#toast{top:90px}
  body.site-play .info-panel{top:52px;max-height:calc(100vh - 70px)}
  body.site-play.touch-on .stage-tools{top:52px}
  body.site-play #lobbyCard{top:96px}
}
/* "turn your phone sideways": covers the game while a touch device is held upright */
.rotate-note{display:none}
@media(orientation:portrait){
  body.site-play.touch-on .rotate-note{display:flex;position:fixed;inset:0;z-index:50;align-items:center;justify-content:center;background:#f8fafb;text-align:center;color:#26323d}
  body.site-play.touch-on .rotate-note>div{display:flex;flex-direction:column;align-items:center;gap:10px;padding:24px}
  body.site-play.touch-on .rotate-note svg{width:84px;height:84px;color:#dc4f36;animation:rr-tilt 2.4s ease-in-out infinite}
  body.site-play.touch-on .rotate-note b{font-size:20px}
  body.site-play.touch-on .rotate-note span{font-size:13px;color:#6e7c89}
}
@keyframes rr-tilt{0%,30%{transform:rotate(0)}55%,85%{transform:rotate(-90deg)}100%{transform:rotate(0)}}

/* ---------------- phones (touch controls on): slimmer header, player count in it, zoom in Settings ---------------- */
body:not(.touch-on) .touch-only{display:none!important}
body.site-play.touch-on{--hdr:42px}                         /* the header, 25% lower than on a PC (56 px) */
@media(max-height:520px){body.site-play.touch-on{--hdr:33px}}  /* (and than the 44 px short-screen header) */
body.site-play.touch-on .site-bar{height:var(--hdr);padding:0 10px;gap:8px;font-size:11px}
body.site-play.touch-on .site-bar .brand-mark{width:calc(var(--hdr) - 12px);height:calc(var(--hdr) - 12px);font-size:10px;border-radius:7px}
body.site-play.touch-on .site-bar .brand>span:nth-child(2),body.site-play.touch-on .site-bar .site-sep,body.site-play.touch-on .site-lobby{display:none!important}
body.site-play.touch-on .site-nav{margin-left:2px;gap:2px}
body.site-play.touch-on .site-nav a{padding:4px 8px;font-size:11px}
body.site-play.touch-on .site-btn,body.site-play.touch-on .site-players{height:calc(var(--hdr) - 10px);font-size:12px}
body.site-play.touch-on .site-btn{width:calc(var(--hdr) - 10px)}
body.site-play.touch-on .me-chip{padding:3px 8px;font-size:11px}
body.site-play.touch-on .site-veh{padding:2px 6px;font-size:11px}
.site-players{display:inline-flex;align-items:center;gap:5px;padding:0 9px;border:1px solid #e2e7ec;border-radius:8px;background:#fff;color:#4b5967;font:inherit;font-weight:800}
.site-players svg{width:15px;height:15px}.site-players i{font-style:normal;font-size:10px;color:#8a96a2}
/* everything under the header follows its height */
body.site-play.touch-on .race-hud{top:calc(var(--hdr) + 7px)}
body.site-play.touch-on .msgbox,body.site-play.touch-on .msgbox#toast.below{top:calc(var(--hdr) + 7px)}
body.site-play.touch-on.hud-on .msgbox#toast,body.site-play.touch-on .msgbox.slowbox{top:calc(var(--hdr) + 46px)}
body.site-play.touch-on #lobbyCard{top:calc(var(--hdr) + 50px)}
/* the player list drops down from the header button; its own header (and count) is in the bar */
body.site-play.touch-on .info-panel{top:calc(var(--hdr) + 6px);right:8px;width:210px;max-height:calc(100vh - var(--hdr) - 110px)}
body.site-play.touch-on #playersPanel .ghost-count-row{display:none}
body.site-play.touch-on.players-hidden .info-panel{display:none!important}
/* zoom is in Settings on phones */
body.site-play.touch-on .stage-tools{display:none!important}
/* restarts: on the left, to the right of ↓ */
body.site-play.touch-on #tpStart{left:calc(var(--tpe) + 92px);bottom:36px}
body.site-play.touch-on #tpCp{left:calc(var(--tpe) + 148px);bottom:36px}
@media(max-height:420px){
  body.site-play.touch-on #tpStart{left:calc(var(--tpe) + 76px);bottom:28px}
  body.site-play.touch-on #tpCp{left:calc(var(--tpe) + 124px);bottom:28px}
}
.tk-tabs{display:flex;flex-wrap:wrap;gap:4px;margin:2px 0 8px}
.tk-tab{padding:4px 10px;border:1px solid #e2e7ec;border-radius:14px;background:#fff;color:#4b5967;font:inherit;font-size:11px;font-weight:800;cursor:pointer}
.tk-tab.on{background:#fff1e6;border-color:#f3c7a6;color:#c2510a}
/* the vehicle wheel (public lobbies, tracks with several vehicles) */
.spin-card{position:absolute;left:50%;top:120px;transform:translateX(-50%);z-index:6;width:300px;padding:16px 18px 18px;background:rgba(255,255,255,.97);border:1px solid #dce2e8;border-radius:16px;box-shadow:0 10px 40px rgba(31,45,61,.18);display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center}
.spin-wheel-wrap{position:relative;width:230px;height:230px}
.spin-wheel{width:230px;height:230px;display:block}
.spin-wheel #spinRot{transform-origin:0 0}
.spin-wheel text{font:800 10px Inter,system-ui,sans-serif;fill:#26323d}.spin-wheel text.free{font-size:15px}
.spin-pointer{position:absolute;left:50%;top:-10px;width:30px;height:24px;transform:translateX(-50%);z-index:2;fill:#dc4f36;filter:drop-shadow(0 2px 2px rgba(0,0,0,.25))}
.spin-card b{font-size:17px;color:#26323d}.spin-card small{font-size:12px;color:#6e7c89}
.spin-card.revealed b{color:#c2510a}
body.site-play.touch-on .spin-card{top:calc(var(--hdr) + 8px);transform:translateX(-50%) scale(.82);transform-origin:top center}
/* full screen help (iPhone: Add to Home Screen) - the same look as the "Turn your phone sideways" cover */
.fs-help{position:fixed;inset:0;z-index:9997;display:flex;background:#f8fafb;text-align:center;color:#26323d;overflow:auto;font-family:Inter,ui-sans-serif,system-ui,sans-serif;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}
.fs-help[hidden]{display:none}
.fs-help>div{margin:auto;display:flex;flex-direction:column;align-items:center;gap:10px;padding:24px 56px;max-width:760px}
.fs-help-hero{width:84px;height:84px;flex:none;color:#dc4f36;animation:rr-fs-pop 2.4s ease-in-out infinite}
@keyframes rr-fs-pop{0%,100%{transform:translateY(0) scale(1)}45%{transform:translateY(-4px) scale(1.06)}60%{transform:translateY(0) scale(1)}}
.fs-help b{font-size:20px;line-height:1.25}
.fs-help>div>span{font-size:13px;color:#6e7c89;max-width:480px;line-height:1.5}
.fs-steps{display:flex;gap:8px;list-style:none;margin:6px 0 2px;padding:0;flex-wrap:wrap;justify-content:center}
.fs-steps li{display:flex;align-items:center;gap:10px;width:206px;padding:9px 11px;border:1px solid #e2e7ec;border-radius:12px;background:#fff;text-align:left}
.fs-steps p{margin:0;font-size:12.5px;line-height:1.35;color:#4b5967}
.fs-steps strong{color:#26323d}.fs-steps small{display:block;color:#8a96a2;font-size:11px;margin-top:1px}
.fs-steps em{font:800 11px Inter,sans-serif;font-style:normal;color:#c2510a;margin-right:5px}
.fs-steps i{flex:none;display:flex;align-items:center;justify-content:center;width:38px;height:38px;border-radius:10px;background:#fff1e6;color:#dc4f36}
.fs-steps i svg{width:22px;height:22px}
.fs-steps i.app{background:none}.fs-steps i.app img{width:38px;height:38px;border-radius:9px;box-shadow:0 2px 6px rgba(31,45,61,.18)}
.fs-help-ok{margin-top:4px;min-width:140px}
.fs-help-x{position:fixed;top:calc(10px + env(safe-area-inset-top));right:calc(12px + env(safe-area-inset-right));width:36px;height:36px;border:1px solid #dce2e8;border-radius:50%;background:#fff;color:#6e7c89;font-size:22px;line-height:1;cursor:pointer}
@media (max-height:440px){.fs-help>div{gap:7px;padding:12px 56px}.fs-help-hero{width:48px;height:48px}.fs-help b{font-size:17px}.fs-help>div>span{font-size:12px}.fs-steps{margin:2px 0 0}.fs-steps li{padding:7px 10px}.fs-help-ok{padding-top:8px;padding-bottom:8px}}
@media (max-width:760px) and (orientation:landscape){.fs-help>div{padding-left:52px;padding-right:52px}.fs-steps{flex-wrap:nowrap;width:100%}.fs-steps li{width:auto;flex:1 1 0;min-width:0;gap:8px;padding:7px 8px}.fs-steps p{font-size:11.5px}.fs-steps i,.fs-steps i.app img{width:32px;height:32px}.fs-steps i svg{width:19px;height:19px}}
/* portrait (e.g. opened from the rotate screen, or the phone turned while it's open): the steps stack in one column */
@media (orientation:portrait){.fs-help>div{padding:28px 22px}.fs-help b{font-size:19px}.fs-steps{flex-direction:column;flex-wrap:nowrap;width:100%;max-width:340px}.fs-steps li{width:auto}}
.rotate-fs-link{display:inline-flex;align-items:center;gap:8px;margin-top:14px;padding:10px 14px;border:1px solid #f0c9a6;border-radius:12px;background:#fff6ef;color:#c2510a;font:700 13px Inter,ui-sans-serif,system-ui,sans-serif;cursor:pointer}
.rotate-fs-link svg,body.site-play.touch-on .rotate-note .rotate-fs-link svg{width:20px;height:20px;flex:none;color:inherit;animation:none}
/* opened from the home screen: keep the header clear of the notch / rounded corners */
@media (display-mode: standalone), (display-mode: fullscreen){.site-bar{padding-left:calc(16px + env(safe-area-inset-left));padding-right:calc(16px + env(safe-area-inset-right))}}

/* ---- Tracks page: grid view (preview pictures) */
.tk-views{display:inline-flex;border:1px solid #d8dee5;border-radius:9px;overflow:hidden;background:#fff}
.tk-views button{border:0;background:none;padding:8px 12px;font:800 12px Inter,ui-sans-serif,system-ui,sans-serif;color:#6e7c89;cursor:pointer}
.tk-views button+button{border-left:1px solid #e8ecf0}
.tk-views button.on{background:#fff6ef;color:#c2510a}
.tk-sort{padding:9px 10px;border:1px solid #d8dee5;border-radius:9px;font:inherit;font-size:13px;background:#fff;color:#26323d}
.tk-sort[hidden]{display:none}
.tk-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:14px}
.tk-card{display:flex;flex-direction:column;background:#fff;border:1px solid var(--line);border-radius:12px;overflow:hidden;transition:box-shadow .15s,transform .15s}
.tk-card:hover{box-shadow:0 8px 24px rgba(31,45,61,.12);transform:translateY(-1px)}
.tk-thumb{position:relative;display:block;width:100%;padding:0;border:0;cursor:pointer;aspect-ratio:16/9;background:#f8fafb;border-bottom:1px solid #eef1f4;overflow:hidden}
.tk-thumb img{display:block;width:100%;height:100%;object-fit:contain}
.tk-thumb.noimg img{visibility:hidden}
.tk-thumb.noimg::after{content:'No preview';position:absolute;inset:0;display:grid;place-items:center;color:#9aa4af;font-size:12px;font-weight:700}
.tk-thumb-play{position:absolute;right:10px;bottom:10px;padding:6px 11px;border-radius:999px;background:rgba(38,50,61,.88);color:#fff;font:800 12px Inter,sans-serif;box-shadow:0 3px 10px rgba(31,45,61,.25);opacity:0;transform:translateY(4px);transition:opacity .15s,transform .15s}
.tk-card:hover .tk-thumb-play,.tk-thumb:focus-visible .tk-thumb-play{opacity:1;transform:none}
.tk-card-body{padding:11px 13px 12px;display:flex;flex-direction:column;gap:5px;flex:1}
.tk-card-name{margin:0;font-size:15px;color:#1c2530;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tk-card-by{font-size:12px;color:#7c8894}.tk-card-by a{color:#c2510a;font-weight:800;text-decoration:none}.tk-card-by a:hover{text-decoration:underline}
.tk-card-meta{display:flex;flex-wrap:wrap;gap:4px 12px;font-size:12px;color:#4b5967;font-variant-numeric:tabular-nums}
.tk-card-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:auto;padding-top:6px}
.tk-card-actions .tk-open{cursor:pointer;background:#fff;font-family:inherit}
.tk-card-actions .tk-play{background:#dc4f36}
.tk-card-actions .tk-del{margin-left:auto}
.tk-card-times{border-top:1px solid #eef1f4;padding:12px 13px}
@media(max-width:560px){.tk-grid{grid-template-columns:1fr 1fr;gap:10px}.tk-card-body{padding:9px 10px}.tk-card-name{font-size:13px}.tk-card-meta{font-size:11px;gap:2px 8px}.tk-views button{padding:8px 9px}}

/* ---- scrolling pages (Tracks, profiles, admin, password reset) on phones held sideways: keep the header and the
   content clear of the notch / Dynamic Island and the rounded corners (the pages use viewport-fit=cover, so in
   landscape they otherwise run underneath them), and use a shorter header on short screens */
.tk-top{padding-left:max(16px, env(safe-area-inset-left));padding-right:max(16px, env(safe-area-inset-right));padding-top:env(safe-area-inset-top);height:calc(56px + env(safe-area-inset-top));box-sizing:border-box}
.tk-main{padding-left:max(20px, env(safe-area-inset-left));padding-right:max(20px, env(safe-area-inset-right));padding-bottom:calc(60px + env(safe-area-inset-bottom))}
@media (max-height:520px){
  .tk-top{height:calc(44px + env(safe-area-inset-top))}
  .tk-main{padding-top:14px}
  .tk-head{margin-bottom:10px;gap:10px}
  .tk-head h1{font-size:22px}
  .tk-head p{display:none}
  .tk-stats{margin-bottom:10px;gap:6px}
  .tk-stat{padding:5px 10px!important;font-size:11px!important}.tk-stat b{font-size:15px!important;display:inline!important;margin-right:5px}
  .tk-grid{grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px}
  .tk-card-body{padding:8px 10px}.tk-card-name{font-size:13px}.tk-card-meta{font-size:11px;gap:2px 8px}
}

/* ---- Tracks page: details panel over the page (grid view) */
.tk-modal{position:fixed;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;padding:max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));background:rgba(28,37,48,0);transition:background .2s ease}
.tk-modal[hidden]{display:none}
.tk-modal.on{background:rgba(28,37,48,.5)}
.tk-modal-card{position:relative;width:min(760px,100%);max-height:100%;overflow:auto;background:#fff;border-radius:16px;box-shadow:0 24px 70px rgba(15,22,30,.35);display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);opacity:0;transform:translateY(10px) scale(.98);transition:opacity .2s ease,transform .2s ease}
.tk-modal.on .tk-modal-card{opacity:1;transform:none}
.tk-modal-thumb{display:block;aspect-ratio:16/9;background:#f8fafb;border-bottom:1px solid #eef1f4;border-right:1px solid #eef1f4}
.tk-modal-thumb img{display:block;width:100%;height:100%;object-fit:contain}
.tk-modal-thumb.noimg img{visibility:hidden}
.tk-modal-info{padding:18px 20px 16px;display:flex;flex-direction:column;gap:6px;border-bottom:1px solid #eef1f4;min-width:0}
.tk-modal-info .tk-card-name{font-size:20px;white-space:normal;margin:0 30px 0 0}
.tk-modal-info .tk-card-actions{margin-top:auto;padding-top:10px}
.tk-modal-times{grid-column:1/-1;padding:14px 18px 18px}
.tk-modal-h{font-size:10px;letter-spacing:.12em;font-weight:850;color:#8a96a2;margin:0 0 8px 2px}
.tk-modal-x{position:absolute;top:10px;right:10px;z-index:1;width:34px;height:34px;border-radius:50%;border:1px solid #dce2e8;background:rgba(255,255,255,.95);color:#4b5967;font-size:22px;line-height:1;cursor:pointer}
.tk-modal-x:hover{color:#26323d;border-color:#c3ccd4}
body.tk-noscroll{overflow:hidden!important}
@media(max-width:640px){.tk-modal-card{grid-template-columns:1fr}.tk-modal-thumb{border-right:0}.tk-modal-info{padding:14px 16px}.tk-modal-info .tk-card-name{font-size:17px}}
@media(prefers-reduced-motion:reduce){.tk-modal,.tk-modal-card{transition:none}}

/* ---- narrow phones (portrait): the scrolling pages' header must fit the screen - it was wider, which made the browser
   zoom the whole page out (and pushed panels like the track details off the side) */
@media (max-width:600px){
  .tk-top{gap:8px}
  .tk-top .site-nav{gap:0}
  .tk-top .site-nav a{padding-left:8px;padding-right:8px}
  .tk-top .suggest-btn .sb-text{display:none}
  .tk-top .suggest-btn{padding-left:9px;padding-right:9px}
  .tk-top .brand > span:not(.brand-mark){display:none}
  .tk-top .rr-auth-name{max-width:84px;overflow:hidden;text-overflow:ellipsis}
  .tk-top .auth-slot{gap:5px}
  .tk-top{overflow-x:auto;scrollbar-width:none}.tk-top::-webkit-scrollbar{display:none}   /* (whatever is left over scrolls inside the header, never widens the page) */
  .tk-top > *{flex-shrink:0}
}
@media (max-width:420px){
  .tk-top .beta-tag{display:none}
  .tk-top .rr-auth-name{max-width:64px}
  .tk-top .rr-auth-admin{padding:3px 6px;font-size:10px}
  .tk-top .site-nav a{padding-left:6px;padding-right:6px;font-size:13px}
}

/* no double-tap zoom (iPhone): taps are plain taps everywhere; elements that set their own touch-action keep it */
*,*::before,*::after{touch-action:manipulation}
