/* Roost Riders - page, stage and menus. Logical units: the #ui layer is W x H and scaled to fit by js/main.js. */
:root { --ink: #0f1115; --panel: rgba(14, 16, 21, 0.86); --or: #ff6a1a; --yel: #ffd400; --wh: #f4f1ea; --mute: #9aa3ad; --gr: #4ade80; --red: #ff5a4a;
  --head: Impact, "Arial Black", "Trebuchet MS", sans-serif; --body: "Trebuchet MS", Verdana, Arial, sans-serif; }
html, body { margin: 0; height: 100%; background: #07080a; overflow: hidden; }
body { display: flex; align-items: center; justify-content: center; font-family: var(--body); color: var(--wh); }
#stage { position: relative; overflow: hidden; background: #111; }
#gl, #hud { position: absolute; left: 0; top: 0; display: block; }
#hud { pointer-events: none; touch-action: none; }
#ui { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
#home { display: none; position: fixed; left: 8px; bottom: 6px; z-index: 3; font: bold 12px var(--body); color: var(--or); text-decoration: none;
  background: rgba(10, 11, 14, 0.85); border: 2px solid var(--or); border-radius: 8px; padding: 2px 8px; }
#home:hover { background: var(--or); color: #111; }
noscript { color: #fff; }

/* mobile mode (?m=1) */
html.m, html.m body { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
html.m body { box-sizing: border-box; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
html.m #home { display: none !important; }
html.m * { -webkit-touch-callout: none; }
#mrot { display: none; }
@media (orientation: portrait) { html.m #mrot { display: flex; position: fixed; inset: 0; z-index: 9; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: #0d0e11; color: var(--or); font: bold 22px var(--body); text-align: center; padding: 24px; } }
#mrot svg { width: 96px; height: 96px; animation: mrot 2.4s ease-in-out infinite; }
#mrot small { font-size: 16px; color: var(--wh); font-weight: normal; }
@keyframes mrot { 0%, 25% { transform: rotate(0); } 50%, 75% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }

/* ---------- screens ---------- */
.scr { position: absolute; inset: 0; box-sizing: border-box; padding: 14px 18px; display: flex; flex-direction: column; font-size: 15px; }
.scr.dim, .scr.menu-scr { background: linear-gradient(90deg, rgba(8, 9, 12, 0.82), rgba(8, 9, 12, 0.25) 60%, rgba(8, 9, 12, 0)); }
.scr.dim { background: rgba(8, 9, 12, 0.72); }
.scr:not(.menu-scr):not(.dim):not(.champ-scr):not(.garage-scr) { background: rgba(10, 11, 14, 0.78); }
.scr.champ-scr { background: linear-gradient(0deg, rgba(8, 9, 12, 0.8), rgba(8, 9, 12, 0) 55%); }
h2, h3, h4 { font-family: var(--head); font-weight: normal; letter-spacing: 0.5px; margin: 0; font-style: italic; }
h2 { font-size: 28px; } h3 { font-size: 22px; margin-bottom: 4px; } h4 { font-size: 16px; color: var(--yel); margin: 10px 0 6px; }
p { margin: 6px 0; line-height: 1.3; }
.dim { color: var(--mute); } .small { font-size: 12px; color: var(--mute); } .lead { font-size: 17px; } .note { font-size: 12px; color: var(--mute); text-align: center; }
.tip { font-size: 12px; color: #cfd6e0; font-style: italic; } .warn { color: var(--yel); font-size: 13px; }
b.g, .g { color: var(--gr); } b.y, .gold { color: var(--yel) !important; } b.o { color: #ffb02e; } b.r { color: var(--red); }
.center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; min-height: 0; }
.center.wide { justify-content: flex-start; }
.scroll { overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--or) transparent; touch-action: pan-y; }

.top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.top h2 { flex: 1; text-align: center; font-size: 24px; }
.topr { display: flex; align-items: center; gap: 8px; }
.money { font-family: var(--head); font-size: 20px; color: var(--yel); background: rgba(0, 0, 0, 0.5); padding: 3px 10px; border-radius: 6px; }

/* buttons */
.btn { font-family: var(--head); font-size: 18px; letter-spacing: 0.5px; color: #fff; border: none; cursor: pointer; padding: 8px 18px; min-height: 40px;
  background: linear-gradient(180deg, #ff8a3a, #e24f06); border-radius: 4px; transform: skewX(-10deg); box-shadow: 0 3px 0 #7a2600, 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: transform 0.08s, filter 0.08s; font-style: italic; }
.btn:hover:not(:disabled) { filter: brightness(1.12); transform: skewX(-10deg) translateY(-1px); }
.btn:active:not(:disabled) { transform: skewX(-10deg) translateY(2px); box-shadow: 0 1px 0 #7a2600; }
.btn:disabled { filter: grayscale(0.9) brightness(0.6); cursor: default; }
.btn.alt { background: linear-gradient(180deg, #4a5160, #2c313b); box-shadow: 0 3px 0 #15181d, 0 4px 12px rgba(0, 0, 0, 0.35); }
.btn.ghost { background: rgba(0, 0, 0, 0.45); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35); }
.btn.big { font-size: 24px; padding: 10px 26px; min-height: 50px; }
.btn.small { font-size: 15px; padding: 4px 12px; min-height: 32px; }
.btn.icon { min-width: 40px; padding: 4px 8px; font-style: normal; transform: none; font-family: var(--body); }
.btn.icon:hover { transform: none; }
.btn.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 3px 0 #15181d, 0 0 0 4px rgba(255, 212, 0, 0.6); } }
.btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.chip { font: bold 13px var(--body); color: #dfe4ea; background: rgba(255, 255, 255, 0.08); border: 2px solid rgba(255, 255, 255, 0.18); border-radius: 18px; padding: 5px 12px; cursor: pointer; margin: 2px; min-height: 32px; }
.chip.on { background: var(--or); border-color: #ffb27e; color: #fff; }
.chip:disabled { opacity: 0.6; cursor: default; }

/* title */
.title-wrap { position: relative; flex: 1; display: flex; flex-direction: column; }
.logo { font-family: var(--head); font-style: italic; font-size: 70px; line-height: 0.9; color: #fff; text-shadow: 4px 4px 0 #000, 0 0 30px rgba(255, 106, 26, 0.45); transform: skewX(-6deg); margin: 6px 0 0 6px; }
.logo b { font-weight: normal; color: var(--or); }
.logo small { display: block; font-size: 15px; letter-spacing: 3px; color: var(--yel); text-shadow: 2px 2px 0 #000; margin-top: 6px; font-family: var(--body); font-weight: bold; }
.logo.small { font-size: 40px; }
.menu { display: flex; flex-direction: column; gap: 9px; width: 260px; margin: 18px 0 0 14px; }
.menu .btn { text-align: left; }
.row2 { display: flex; gap: 8px; } .row2 .btn { flex: 1; font-size: 15px; padding: 8px 6px; text-align: center; }
.title-foot { position: absolute; left: 120px; right: 6px; bottom: 6px; display: flex; align-items: center; gap: 14px; font-size: 13px; color: #dfe4ea; }
.title-foot > span:nth-child(2) { flex: 1; text-shadow: 1px 1px 0 #000; }
.hint-new { position: absolute; left: 290px; bottom: 120px; color: var(--yel); font-weight: bold; text-shadow: 2px 2px 0 #000; animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.keys { position: absolute; right: 4px; bottom: 44px; font-size: 12px; color: #cfd6e0; text-shadow: 1px 1px 0 #000; }
.loading h3 { font-size: 30px; margin-top: 14px; }
.spin { width: 38px; height: 38px; border-radius: 50%; border: 5px solid rgba(255, 255, 255, 0.15); border-top-color: var(--or); animation: spin 0.8s linear infinite; margin: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* cards */
.cards { display: grid; gap: 12px; width: 100%; }
.cards.two { grid-template-columns: repeat(2, minmax(0, 300px)); justify-content: center; }
.cards.four { grid-template-columns: repeat(4, 1fr); }
.card { background: var(--panel); border: 2px solid rgba(255, 255, 255, 0.1); border-radius: 10px; padding: 12px; position: relative; text-align: left; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); }
.card.box { text-align: center; padding: 18px 26px; max-width: 560px; }
.card.series { display: flex; flex-direction: column; border-top: 4px solid var(--or); }
.card.series .btns { margin-top: auto; justify-content: flex-start; }
.card.series.locked { opacity: 0.55; border-top-color: #555; }
.card .cls { position: absolute; right: 10px; top: 8px; font-family: var(--head); font-size: 26px; color: rgba(255, 255, 255, 0.18); font-style: italic; }
.card .status { color: var(--yel); font-weight: bold; font-size: 13px; }
.card .best { font-size: 12px; color: var(--mute); }
.bikecard h3 { color: var(--or); }
.stat { display: flex; align-items: center; gap: 8px; font-size: 12px; margin: 3px 0; } .stat span { width: 66px; color: var(--mute); }
.bar { flex: 1; height: 8px; background: rgba(255, 255, 255, 0.1); border-radius: 4px; overflow: hidden; display: block; } .bar i { display: block; height: 100%; border-radius: 4px; }
.pausebox { display: flex; flex-direction: column; gap: 9px; min-width: 300px; } .pausebox h2 { margin-bottom: 6px; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl td { padding: 4px 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.07); white-space: nowrap; }
.tbl td.nm { width: 99%; white-space: normal; } .tbl td.r { text-align: right; } .tbl td.pos { font-family: var(--head); font-size: 17px; color: var(--yel); width: 24px; }
.tbl td.pts { color: var(--gr); }
.tbl tr.me td { background: rgba(255, 106, 26, 0.28); font-weight: bold; }
.tblwrap { width: min(680px, 100%); background: var(--panel); border-radius: 10px; padding: 6px 10px; text-align: left; flex: 0 1 auto; }
.nat { font-size: 10px; color: var(--mute); border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 3px; padding: 0 3px; margin-left: 4px; vertical-align: middle; }

/* layouts */
.cols3 { display: grid; grid-template-columns: 1.1fr 1fr 0.8fr; gap: 14px; flex: 1; min-height: 0; }
.cols2 { display: flex; gap: 14px; flex: 1; min-height: 0; }
.col { background: var(--panel); border-radius: 10px; padding: 12px; min-height: 0; display: flex; flex-direction: column; }
.col.grow { flex: 1; } .col.side { width: 300px; align-items: center; gap: 8px; text-align: center; }
.col.actions { gap: 4px; align-items: stretch; text-align: center; justify-content: center; }
.trk { font-size: 28px; color: var(--or); }
.tags span { display: inline-block; font-size: 12px; background: rgba(255, 255, 255, 0.1); border-radius: 4px; padding: 2px 7px; margin: 0 4px 4px 0; }
.tags span.wet { background: #2f5d8a; }
.mapbox { display: flex; justify-content: center; align-items: center; background: rgba(0, 0, 0, 0.35); border-radius: 8px; padding: 4px; }
.chips { display: flex; flex-wrap: wrap; }
.placebig { font-family: var(--head); font-style: italic; font-size: 64px; line-height: 1; text-shadow: 3px 3px 0 #000; }
.moneybox { width: 100%; background: rgba(0, 0, 0, 0.35); border-radius: 8px; padding: 8px 10px; box-sizing: border-box; }
.ml { display: flex; justify-content: space-between; font-size: 14px; padding: 2px 0; } .ml.total { border-top: 1px solid rgba(255, 255, 255, 0.2); margin-top: 4px; padding-top: 5px; font-size: 16px; color: var(--yel); }
.gates { display: flex; gap: 6px; justify-content: center; margin: 14px 0 6px; }
.gate { width: 62px; height: 92px; border-radius: 6px 6px 2px 2px; border: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: linear-gradient(180deg, #e8ecf1, #9aa3ad); color: #111; font-family: var(--head); box-shadow: 0 4px 0 #444; }
.gate b { font-size: 26px; font-weight: normal; } .gate small { font: bold 10px var(--body); color: #333; text-transform: uppercase; }
.gate:hover:not(:disabled) { background: linear-gradient(180deg, #fff, var(--or)); }
.gate.taken { background: #3a3f48; color: #aab; cursor: default; box-shadow: 0 4px 0 #222; } .gate.taken small { color: #889; }
.podium-tap { position: absolute; inset: 0; cursor: pointer; } .pt-msg { position: absolute; bottom: 18px; width: 100%; text-align: center; font: bold 15px var(--body); text-shadow: 2px 2px 0 #000; animation: bob 1.2s infinite; }
.champ { flex: 1; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 10px; }
.champ h2 { font-size: 34px; }

/* garage */
.garage { display: grid; grid-template-columns: 250px 1fr 330px; gap: 12px; flex: 1; min-height: 0; }
.glist { background: var(--panel); border-radius: 10px; padding: 6px; }
.glabel { font: bold 11px var(--body); color: var(--yel); margin: 8px 4px 4px; letter-spacing: 1px; }
.bikerow { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: none; border-radius: 6px; background: transparent; color: #e8ecf1; font: 14px var(--body); cursor: pointer; text-align: left; min-height: 34px; }
.bikerow:hover { background: rgba(255, 255, 255, 0.08); } .bikerow.on { background: rgba(255, 106, 26, 0.35); }
.bikerow .nm { flex: 1; } .bikerow .r { font-size: 11px; color: var(--mute); }
.sw { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(255, 255, 255, 0.4); flex: none; }
.gpanel { background: var(--panel); border-radius: 10px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.gbody { padding: 10px 12px; flex: 1; }
.tabs { display: flex; } .tab { flex: 1; font: 16px var(--head); font-style: italic; color: #cfd6e0; background: rgba(0, 0, 0, 0.35); border: none; padding: 9px 4px; cursor: pointer; min-height: 38px; }
.tab.on { background: var(--or); color: #fff; }
.htabs { margin-bottom: 8px; border-radius: 8px; overflow: hidden; }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0; }
.specs div { background: rgba(0, 0, 0, 0.35); border-radius: 6px; padding: 5px 8px; } .specs b { display: block; font-family: var(--head); font-size: 20px; font-weight: normal; color: var(--yel); } .specs span { font-size: 11px; color: var(--mute); }
.upg { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.upg > div:first-child { flex: 1; } .upg small { display: block; font-size: 11px; color: var(--mute); }
.pips { display: flex; gap: 3px; } .pips i { width: 12px; height: 16px; background: rgba(255, 255, 255, 0.12); transform: skewX(-12deg); } .pips i.on { background: var(--or); }
.maxed { font: 15px var(--head); color: var(--gr); padding: 0 8px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.25); cursor: pointer; padding: 0; }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--or); }
.numrow { display: flex; align-items: center; gap: 16px; } .numrow b { font: 30px var(--head); }

/* setup */
.tracks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0; }
.trackbtn { border: 2px solid rgba(255, 255, 255, 0.14); background: rgba(0, 0, 0, 0.35); border-radius: 8px; color: #fff; padding: 8px; cursor: pointer; text-align: left; min-height: 54px; }
.trackbtn b { display: block; font: 15px var(--head); font-style: italic; font-weight: normal; } .trackbtn small { font-size: 11px; color: var(--mute); }
.trackbtn.on { border-color: var(--or); background: rgba(255, 106, 26, 0.3); } .trackbtn:disabled { opacity: 0.45; cursor: default; }
.optrow { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; margin: 4px 0; } .optrow > span { width: 70px; font-size: 13px; color: var(--mute); }

/* settings, how to play */
.settings { width: min(640px, 100%); margin: 0 auto; background: var(--panel); border-radius: 10px; padding: 6px 16px 12px; }
.set { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
.set small { display: block; font-size: 11px; color: var(--mute); }
.set input[type=range] { width: 200px; accent-color: var(--or); }
.howto { background: var(--panel); border-radius: 10px; padding: 8px 16px; flex: 1; }
.hgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; } .hgrid ul, .hgrid ol { padding-left: 18px; margin: 4px 0; } .hgrid li { margin: 4px 0; line-height: 1.3; font-size: 14px; }
.diag { width: 100%; max-width: 320px; background: rgba(0, 0, 0, 0.35); border-radius: 8px; }

/* phones: bigger targets and text */
html.m .scr { padding: 8px 12px; font-size: 16px; }
html.m .btn { min-height: 52px; font-size: 19px; }
html.m .btn.big { min-height: 56px; font-size: 23px; }
html.m .btn.small { min-height: 52px; min-width: 54px; font-size: 17px; }
html.m .btn.icon { min-width: 52px; }
html.m .chip { min-height: 52px; min-width: 52px; font-size: 15px; padding: 6px 14px; }
html.m .tab { min-height: 52px; }
html.m .swatch { width: 52px; height: 52px; }
html.m .bikerow { min-height: 52px; font-size: 15px; }
html.m .trackbtn { min-height: 56px; }
html.m .logo { font-size: 54px; } html.m .logo small { font-size: 13px; }
html.m .menu { width: 440px; gap: 7px; margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; }
html.m .menu .btn { min-height: 52px; padding: 4px 16px; }
html.m .menu .btn.big { min-height: 54px; grid-column: 1 / -1; }
html.m .menu .row2 { display: contents; }
html.m .row2 .btn { min-height: 52px; font-size: 19px; text-align: left; padding: 4px 16px; }
html.m .pausebox .row2 .btn { text-align: center; }
html.m .set input[type=range] { height: 52px; }
html.m .title-foot { bottom: 2px; }
html.m .hint-new { left: 22px; bottom: 52px; }
html.m .top { margin-bottom: 6px; } html.m .top h2 { font-size: 21px; }
html.m .garage { grid-template-columns: 220px 1fr 320px; gap: 8px; }
html.m .cards.four { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
html.m .cols3 { grid-template-columns: 1fr 1fr 0.85fr; gap: 8px; }
html.m .col { padding: 8px; }
html.m .tbl { font-size: 14px; } html.m .tbl td { padding: 3px 5px; }
html.m .gates { align-self: stretch; } /* full row width: 12 gates stay >= 44 px */
html.m .gate { width: auto; flex: 1 1 0; max-width: 64px; min-width: 44px; height: 88px; }
html.m .lead { font-size: 16px; }
html.m .tracks { gap: 6px; }
html.m .optrow > span { width: 62px; }
html.m .title-foot { left: 6px; }
.facts { font-size: 13px; color: #dfe4ea; }
