@font-face {
  font-family: "Bungee";
  src: url("../assets/fonts/bungee.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg: #0d1210;
  --panel: rgba(12, 18, 15, 0.84);
  --ink: #f2efe6;
  --muted: #a9b3a6;
  --slime: #7dff5a;
  --cheese: #ffcc33;
  --gold: #ffd75e;
  --red: #e5322b;
  --title: "Bungee", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  touch-action: none; user-select: none; -webkit-user-select: none; overscroll-behavior: none;
}
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* screens */
.screen {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: safe center;
  gap: 12px; padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom)); text-align: center;
  background: radial-gradient(ellipse at center, rgba(13, 18, 16, 0.55), rgba(13, 18, 16, 0.92));
}
.screen.scroll { overflow-y: auto; touch-action: pan-y; }
.logo {
  margin: 0; font-family: var(--title); font-weight: 400; font-size: clamp(64px, 14vw, 132px); line-height: 0.9;
  letter-spacing: 4px; color: var(--slime);
  text-shadow: 0 0 26px rgba(125, 255, 90, 0.5), 0 6px 0 #1e3a14;
}
.tag { margin: 0; font-size: clamp(16px, 3.6vw, 24px); letter-spacing: 8px; text-transform: uppercase; color: var(--cheese); }
h2 { margin: 0; font-family: var(--title); font-weight: 400; letter-spacing: 2px; font-size: clamp(44px, 9vw, 72px); color: var(--cheese); }
.small { margin: 0; color: var(--muted); font-size: 15px; max-width: 540px; }
.error { color: #ff8a7a !important; }

.bar { width: min(320px, 80vw); height: 10px; border-radius: 6px; background: #1f2a24; overflow: hidden; }
#load-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--slime), var(--cheese)); transition: width 0.2s; }

.btn {
  border: 0; border-radius: 999px; padding: 14px 44px; font-size: 22px; font-weight: 900; letter-spacing: 2px;
  color: #10200b; background: linear-gradient(180deg, #a8ff6a, #57d63a); cursor: pointer;
  box-shadow: 0 6px 0 #2c6b1f, 0 10px 24px rgba(0, 0, 0, 0.45); font-family: inherit;
}
.btn:active { transform: translateY(3px); box-shadow: 0 3px 0 #2c6b1f; }
.btn:disabled { opacity: 0.6; }
.btn-small { padding: 10px 24px; font-size: 17px; }
.btn-alt { background: linear-gradient(180deg, #ffe07a, #f0b31d); box-shadow: 0 6px 0 #8a5d00, 0 10px 24px rgba(0, 0, 0, 0.45); color: #2a1c00; }
.btn-alt:active { box-shadow: 0 3px 0 #8a5d00; }
.link { background: none; border: 0; color: var(--muted); font-size: 15px; text-decoration: underline; cursor: pointer; font-family: inherit; }
.icon {
  width: 40px; height: 40px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.35); color: var(--ink); font-weight: 900; cursor: pointer;
}
.row-btns { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; align-items: center; }

/* menu: top and bottom panels, the 3D crew shows through the middle */
.menu { justify-content: space-between; overflow-y: auto; touch-action: pan-y; background: none; pointer-events: none; gap: 0; padding: 0; }
.menu-top, .menu-bottom { pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; padding-left: 16px; padding-right: 16px; }
.menu-top { position: relative; padding-top: max(18px, env(safe-area-inset-top)); background: linear-gradient(rgba(13, 18, 16, 0.85), rgba(13, 18, 16, 0)); padding-bottom: 20px; }
.menu-stage { flex: 1 1 0; min-height: 0; }
.menu-bottom { padding-top: 22px; background: linear-gradient(rgba(13, 18, 16, 0), rgba(13, 18, 16, 0.88) 60px); }
.perk { margin: 0; font-size: 16px; color: var(--ink); min-height: 1.3em; }
.perk b { color: var(--cheese); }

/* roster */
.roster { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 760px; }
.card {
  width: 112px; padding: 6px 6px 8px; border-radius: 14px; cursor: pointer; font-family: inherit;
  background: var(--panel); border: 2px solid #26332c; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: transform 0.12s, border-color 0.12s;
}
.card img { height: 64px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6)); }
.card b { font-size: 17px; }
.card small { color: var(--muted); font-size: 11px; line-height: 1.2; min-height: 2.4em; }
.card.on { border-color: var(--cheese); transform: translateY(-4px); box-shadow: 0 0 18px rgba(255, 204, 51, 0.35); }
.card .boss { font-size: 10px; color: #10200b; background: var(--cheese); border-radius: 6px; padding: 1px 6px; font-weight: 900; }

/* controls and missions, inside the menu sheets */
.k {
  display: inline-block; min-width: 24px; padding: 0 6px; margin-right: 3px; border-radius: 6px; text-align: center;
  background: #202b25; border: 1px solid #3c4b42; border-bottom-width: 3px; color: var(--ink); font-weight: 700;
  font-size: 13px; line-height: 20px;
}
.k.wide { min-width: 48px; }
.gp {
  display: inline-block; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; text-align: center;
  font-style: normal; font-weight: 900; font-size: 13px; line-height: 24px; color: #fff; margin-right: 2px;
}
.gp.a { background: #3fae3a; } .gp.b { background: #d8392f; } .gp.x { background: #2f6fd8; } .gp.y { background: #e0b114; color: #222; }
.gp.dir { background: #2a3530; border: 1px solid #45554b; font-weight: 700; }
.pad-status { font-size: 12px !important; }
.pad-status.on { color: var(--slime) !important; }
.pad-hint { margin: 0; color: var(--muted); font-size: 15px; }
/* Controller buttons shown on the menu control they work */
.roster-row { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.roster-row > .roster { min-width: 0; }
.roster-row > .gp { flex: none; margin: 0; }
#diff > .gp { align-self: center; margin: 0 4px 0 3px; font-size: 11px; letter-spacing: -1px; }
#play > .gp { vertical-align: 3px; margin-right: 10px; }
.nav-btn > .gp { margin: 0 0 0 2px; }


/* cheese icon */
.wedge {
  display: inline-block; width: 16px; height: 13px; vertical-align: -1px;
  background: var(--cheese); clip-path: polygon(0 100%, 100% 100%, 100% 0); border-radius: 2px;
}
.wedge.gold { background: linear-gradient(135deg, #fff1a8, #ffbf1a); box-shadow: 0 0 8px var(--gold); }

/* HUD */
#hud {
  position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start;
  padding: max(12px, env(safe-area-inset-top)) 16px 0; pointer-events: none;
}
#hud button { pointer-events: auto; }
.hud-left, .hud-right { display: flex; flex-direction: column; gap: 4px; }
.hud-right { align-items: flex-end; flex-direction: row; gap: 12px; }
.score { font-size: 34px; font-weight: 900; text-shadow: 0 2px 6px #000; display: flex; align-items: center; gap: 8px; }
.mult { font-size: 16px; background: var(--cheese); color: #241800; border-radius: 8px; padding: 1px 8px; text-shadow: none; }
.cheese { font-size: 20px; font-weight: 700; color: var(--cheese); text-shadow: 0 2px 6px #000; display: flex; gap: 6px; align-items: center; }
.best { font-size: 14px; color: var(--muted); padding-top: 12px; text-shadow: 0 2px 4px #000; }
.best span { color: var(--ink); font-weight: 700; }
.lives { display: flex; gap: 4px; margin-top: 2px; }
.lives img { width: 30px; height: 34px; object-fit: contain; filter: drop-shadow(0 2px 3px #000); transition: filter 0.3s, opacity 0.3s; }
.lives img.out { filter: grayscale(1) brightness(0.45); opacity: 0.6; }
.lives img.lead { border-bottom: 3px solid var(--cheese); border-radius: 2px; }
.board .mode { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: #26332c; color: var(--muted); }
.board .mode.easy { color: #8fe08a; }
.board .mode.hard { color: #ff9a7a; }
.powers { position: absolute; left: 50%; top: max(14px, env(safe-area-inset-top)); transform: translateX(-50%); display: flex; gap: 8px; }
.chip {
  display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.15); font-weight: 700; font-size: 14px;
}
.chip img { width: 26px; height: 26px; }
.chip .t { min-width: 2ch; }

/* level progress, bottom of the screen while running */
.prog {
  position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(78vw, 420px); display: flex; align-items: center; gap: 10px; pointer-events: none;
  font-weight: 800; font-size: 13px; text-shadow: 0 2px 4px #000; opacity: 0; transition: opacity 0.3s;
}
#hud:not(.hidden) ~ .prog { opacity: 1; }
.prog-name { white-space: nowrap; color: var(--ink); }
.prog-goal { color: var(--slime); letter-spacing: 1px; }
.prog-bar { position: relative; flex: 1; height: 10px; border-radius: 6px; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.2); }
#prog-fill { height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, #3fae3a, #b9ff5a); }
#prog-rat { position: absolute; top: 50%; left: 0; width: 26px; height: 30px; object-fit: contain; transform: translate(-50%, -60%); filter: drop-shadow(0 2px 3px #000); }

/* end-of-level banner and the fade between scenes */
.banner {
  position: fixed; top: 14%; left: 50%; transform: translate(-50%, -20px) scale(0.7); opacity: 0; pointer-events: none;
  text-align: center; width: 94vw; transition: transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1), opacity 0.25s;
}
.banner.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.banner h2 { font-size: clamp(42px, 10vw, 86px); color: var(--cheese); text-shadow: 0 0 22px rgba(255, 215, 94, 0.7), 0 5px 0 #5a3a00; }
.banner p { margin: 6px 0 0; font-size: clamp(18px, 4.4vw, 28px); font-weight: 900; color: var(--ink); text-shadow: 0 2px 6px #000; }
.fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity 0.35s; z-index: 5; }
.fade.on { opacity: 1; }
.r-level { margin: 4px 0 0; font-weight: 800; color: var(--slime); }

.toast {
  position: fixed; top: 24%; left: 50%; transform: translate(-50%, -50%) scale(0.6); opacity: 0;
  font-size: clamp(24px, 5.5vw, 42px); font-weight: 900; color: var(--gold); text-align: center; width: 92vw;
  text-shadow: 0 0 18px rgba(255, 215, 94, 0.8), 0 4px 0 #6b4a00; pointer-events: none;
  transition: transform 0.25s, opacity 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.hint {
  position: fixed; bottom: 18%; left: 50%; transform: translateX(-50%); opacity: 0; pointer-events: none;
  padding: 12px 22px; border-radius: 16px; background: rgba(0, 0, 0, 0.7); border: 2px solid var(--slime);
  font-size: clamp(20px, 4.6vw, 32px); font-weight: 900; color: var(--ink); text-align: center; transition: opacity 0.2s;
}
.hint.show { opacity: 1; }

/* results */
.results { display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr)); gap: 10px; }
.results div { background: var(--panel); border: 1px solid #26332c; border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; }
.results span { color: var(--muted); font-size: 13px; }
.results b { font-size: 26px; }
.done-list { list-style: none; margin: 0; padding: 0; color: var(--slime); font-weight: 700; }
.done-list li::before { content: "Mission complete: "; color: var(--gold); }
.share-links { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.share-links a { color: var(--cheese); font-weight: 700; }

/* scoreboard */
.save { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.save input {
  width: min(260px, 70vw); padding: 12px 16px; border-radius: 999px; border: 2px solid #3a4a40;
  background: #101814; color: var(--ink); font-size: 17px; font-family: inherit; outline: none;
  user-select: text; -webkit-user-select: text;
}
.save input:focus { border-color: var(--cheese); }
.tabs { display: flex; gap: 6px; }
.tab { border: 1px solid #3a4a40; background: #101814; color: var(--muted); padding: 8px 18px; border-radius: 999px; font-size: 15px; cursor: pointer; font-family: inherit; }
.tab.on { background: var(--cheese); color: #241800; border-color: var(--cheese); font-weight: 700; }
.board {
  list-style: none; margin: 0; padding: 0; width: min(440px, 92vw); max-height: 44vh; overflow-y: auto; flex-shrink: 0;
  background: var(--panel); border: 1px solid #26332c; border-radius: 14px; counter-reset: rank; touch-action: pan-y;
}
.board li {
  display: grid; grid-template-columns: 34px 30px 1fr auto auto auto; gap: 8px; align-items: center;
  padding: 7px 12px; border-bottom: 1px solid #1f2a24; text-align: left; counter-increment: rank;
}
.board li::before { content: counter(rank); color: var(--muted); font-weight: 700; text-align: right; }
.board li:nth-child(1)::before { color: var(--gold); }
.board li img { width: 26px; height: 30px; object-fit: contain; }
.board li .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board li b { color: var(--cheese); }
.board li.me { background: rgba(255, 204, 51, 0.14); }
.board li.empty { display: block; text-align: center; color: var(--muted); }
.board li.empty::before { content: none; }
.badge {
  display: inline-block; font-size: 10px; font-weight: 900; letter-spacing: 1px; padding: 1px 5px; border-radius: 5px;
  color: #241800; background: linear-gradient(135deg, #fff1a8, #ffbf1a);
}
.board .badge-slot { min-width: 34px; text-align: right; }
.holder-box { max-width: 460px; display: flex; flex-direction: column; align-items: center; gap: 8px; }

/* music on/off switch */
.music-toggle { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--ink); cursor: pointer; }
/* phones: the switch sits on its own row above the title instead of over it */
@media (max-width: 760px) {
}
.switch, .toggle {
  position: relative; width: 58px; height: 32px; border-radius: 999px; border: 2px solid #3a4a40; padding: 0;
  background: #2a332e; cursor: pointer; transition: background 0.2s, border-color 0.2s;
}
.switch .knob, .toggle .knob {
  position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #c9cfc7;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); transition: transform 0.2s, background 0.2s;
}
.switch[aria-checked="true"], .toggle[aria-checked="true"] { background: #3fae3a; border-color: #57d63a; }
.switch[aria-checked="true"] .knob, .toggle[aria-checked="true"] .knob { transform: translateX(26px); background: #fff; }
.switch:focus-visible, .toggle:focus-visible { outline: 3px solid var(--cheese); outline-offset: 2px; }

/* install pop-up */
.pop {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(5, 8, 6, 0.72); backdrop-filter: blur(3px);
}
.pop-card {
  width: min(420px, 100%); max-height: 92vh; overflow-y: auto; touch-action: pan-y;
  background: #121a15; border: 2px solid var(--slime); border-radius: 20px; padding: 20px 18px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  box-shadow: 0 0 40px rgba(125, 255, 90, 0.25);
}
.pop-icon { width: 72px; height: 72px; border-radius: 18px; }
.pop-card h3 { margin: 0; font-family: var(--title); font-weight: 400; font-size: 32px; color: var(--slime); letter-spacing: 1px; }
.pop-os { width: 100%; background: var(--panel); border: 1px solid #26332c; border-radius: 14px; padding: 10px 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pop-os h4 { margin: 0; font-size: 13px; letter-spacing: 3px; text-transform: uppercase; color: var(--cheese); }
.steps { margin: 0; padding-left: 20px; text-align: left; color: var(--ink); font-size: 15px; line-height: 1.5; align-self: stretch; }
.share-ico {
  display: inline-block; width: 14px; height: 16px; vertical-align: -2px; border: 2px solid var(--ink); border-top: 0;
  border-radius: 0 0 3px 3px; position: relative; margin: 0 2px;
}
.share-ico::before { content: ""; position: absolute; left: 4px; top: -7px; width: 2px; height: 12px; background: var(--ink); }
.share-ico::after { content: ""; position: absolute; left: 1px; top: -8px; width: 6px; height: 6px; border-left: 2px solid var(--ink); border-top: 2px solid var(--ink); transform: rotate(45deg); }

@media (max-width: 560px) {
  .card { width: 84px; }
  .card img { height: 52px; }
  .card small { display: none; }
  .btn { padding: 12px 36px; font-size: 20px; }
}

/* cheese shop */
.bank-line { font-size: 22px; margin: 4px 0; display: flex; align-items: center; gap: 8px; justify-content: center; }
.bank-line b { color: var(--cheese); font-family: var(--title); font-size: 26px; }
.shop-note { max-width: 520px; text-align: center; margin: 0 auto 14px; }
.shop-list { list-style: none; margin: 0 auto 18px; padding: 0; width: min(560px, 100%); display: grid; gap: 10px; }
.shop-list li { display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: center; background: var(--panel); border: 2px solid #26332c; border-radius: 14px; padding: 10px 12px; }
.shop-list li.sel { border-color: var(--cheese); }
.shop-list img { width: 54px; height: 54px; }
.shop-list h4 { margin: 0; font-size: 17px; }
.shop-list .what { margin: 2px 0 6px; font-size: 13px; color: var(--muted); }
.shop-list .pips { display: flex; gap: 4px; }
.shop-list .pips i { width: 18px; height: 8px; border-radius: 4px; background: #2c3a31; }
.shop-list .pips i.on { background: var(--cheese); }
.shop-list .buy { min-width: 110px; padding: 10px 14px; font-size: 15px; }
.shop-list .buy .wedge { width: 12px; height: 10px; margin-right: 4px; }
.shop-list .maxed { color: var(--slime); font-weight: 700; letter-spacing: 2px; font-size: 13px; text-align: center; min-width: 110px; }
.r-bank { color: var(--cheese); font-weight: 700; margin: 4px 0; }
@media (max-width: 480px) {
  .shop-list li { grid-template-columns: 42px 1fr; }
  .shop-list img { width: 42px; height: 42px; }
  .shop-list .buy, .shop-list .maxed { grid-column: 1 / -1; width: 100%; }
}
#shop { background: rgba(8, 12, 10, 0.86); }
.shop-list li > div { text-align: left; }
.shop-list .buy .wedge { background: #6b4700; box-shadow: none; }

/* boss health */
.prog.boss #prog-fill { background: linear-gradient(90deg, #ff3b2f, #ff8a1f); }
.prog.boss #prog-rat { display: none; }
.prog.boss .prog-name { color: #ff8a6a; }
.prog.boss .prog-goal { visibility: hidden; }

/* the Fat Cat's speech bubble */
.speech {
  position: fixed; z-index: 6; transform: translate(-50%, -100%) scale(0.6); opacity: 0; pointer-events: none;
  width: max-content; max-width: min(320px, 80vw); padding: 10px 16px; border-radius: 18px; background: #fff; color: #1a1014;
  font-family: "Bangers", var(--title); font-size: 24px; letter-spacing: 1px; text-align: center; line-height: 1.15;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); transition: opacity 0.18s, transform 0.18s;
}
.speech::after { content: ""; position: absolute; left: calc(50% + var(--tail, 0px)); bottom: -14px; transform: translateX(-50%); border: 10px solid transparent; border-top: 16px solid #fff; border-bottom: 0; }
.speech.show { opacity: 1; transform: translate(-50%, -100%) scale(1); }
@font-face {
  font-family: "Bangers";
  src: url("../assets/fonts/bangers.woff2") format("woff2");
  font-display: swap;
}

/* the villain's card beside the crew */
.card.villain { border-color: #7a2a24; background: rgba(40, 12, 10, 0.86); }
.card .boss.bad { background: #e5322b; color: #fff; }

/* main menu: a status bar, the crew, one clear button, then one tidy row of everything else */
.sprite { position: absolute; width: 0; height: 0; }
.menu-bar { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 18px; right: 18px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.status { display: flex; gap: 22px; text-align: left; }
.stat { margin: 0; display: flex; flex-direction: column; gap: 1px; min-width: 96px; }
.stat small { color: var(--muted); font-size: 13px; }
.stat b { color: var(--gold); font-size: 17px; font-variant-numeric: tabular-nums; }
.rank-bar { display: block; height: 4px; margin-top: 5px; border-radius: 4px; background: rgba(255, 255, 255, 0.16); overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: var(--slime); }

#diff { gap: 0; padding: 3px; background: rgba(8, 14, 11, 0.86); border: 1px solid #2d3b33; border-radius: 12px; }
#diff .tab { border: 0; background: none; border-radius: 9px; padding: 7px 22px; font-weight: 700; }
#diff .tab:hover { color: var(--ink); }
#diff .tab.on { background: var(--cheese); color: #241800; }

.menu-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 8px 0 max(14px, env(safe-area-inset-bottom)); }
.nav-btn { display: inline-flex; align-items: center; gap: 9px; height: 44px; padding: 0 16px; border-radius: 12px; cursor: pointer; font: 700 15px "Trebuchet MS", "Segoe UI", system-ui, sans-serif; color: var(--ink); background: rgba(16, 24, 20, 0.92); border: 1px solid #2d3b33; transition: border-color 0.12s, background 0.12s; }
.nav-btn:hover { border-color: var(--slime); background: #18251d; }
.nav-btn:focus-visible, .sheet-x:focus-visible, #diff .tab:focus-visible, .card:focus-visible { outline: 3px solid var(--cheese); outline-offset: 2px; }
.nav-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--slime); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-btn .wedge { width: 18px; height: 14px; }
.nav-btn .bank { color: var(--gold); font-variant-numeric: tabular-nums; }

/* the sheets that open from that row */
.sheet { pointer-events: auto; width: min(460px, calc(100vw - 28px)); max-height: calc(100vh - 28px); overflow-y: auto; padding: 20px 22px 22px; border-radius: 18px; border: 1px solid #34453a; background: #111a15; color: var(--ink); text-align: left; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65); user-select: text; -webkit-user-select: text; }
.sheet-wide { width: min(720px, calc(100vw - 28px)); }
.sheet::backdrop { background: rgba(4, 8, 6, 0.72); }
.sheet header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.sheet h2 { margin: 0; font: 400 26px var(--title); color: var(--slime); }
.sheet-x { flex: none; width: 38px; height: 38px; border-radius: 10px; border: 1px solid #34453a; background: none; color: var(--ink); font-size: 24px; line-height: 1; cursor: pointer; }
.sheet-x:hover { border-color: var(--slime); }
.sheet-lead { margin: 0 0 14px; color: var(--muted); font-size: 16px; line-height: 1.45; }
.sheet-note { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.sheet .pad-status { margin: 6px 0 0; color: var(--muted); font-size: 14px !important; }
.sheet .missions li { font-size: 16px; padding: 10px 0 10px 28px; border-top: 1px solid #243229; }
.sheet .missions li::before { left: 3px; top: 13px; width: 14px; height: 14px; border-radius: 4px; }
.rules { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 9px; font-size: 15px; line-height: 1.35; }
.rules li { display: flex; align-items: center; gap: 12px; }
.rules li > :first-child { flex: none; }
.rule-mark { width: 18px; height: 18px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 900; font-size: 13px; line-height: 18px; text-align: center; }
.controls { width: 100%; border-collapse: collapse; font-size: 14px; }
.controls th, .controls td { padding: 8px 10px 8px 0; border-top: 1px solid #243229; text-align: left; vertical-align: middle; font-weight: 400; }
.controls thead th { border-top: 0; color: var(--muted); font-size: 13px; padding-top: 0; }
.controls tbody th { color: var(--ink); font-weight: 700; white-space: nowrap; }
@media (pointer: coarse) { .c-keys { display: none; } }
@media (pointer: fine) { .c-touch { display: none; } }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-top: 1px solid #243229; font-size: 16px; font-weight: 700; }
.set-row:first-of-type { border-top: 0; }
.set-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; font-weight: 400; }
.set-install { display: block; width: 100%; margin-top: 10px; }

@media (max-width: 760px) {
  .menu-bar { position: static; margin: max(8px, env(safe-area-inset-top)) 0 4px; width: 100%; }
  .status { gap: 14px; }
  .stat { min-width: 0; }
  .stat small { font-size: 12px; }
  .stat b { font-size: 14px; }
  .nav-btn { height: 40px; padding: 0 11px; font-size: 13px; gap: 6px; }
  .nav-btn svg { width: 17px; height: 17px; }
  .sheet { padding: 16px; }
  .sheet h2 { font-size: 22px; }
  .controls { font-size: 13px; }
}

/* difficulty, RUN! and the note share one row; RUN! never leaves the screen */
.go-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; width: 100%; max-width: 900px; }
.go-row #diff { justify-self: end; }
.go-row #diff-note { justify-self: start; text-align: left; }
#play { position: sticky; bottom: 10px; z-index: 2; }
/* messages during a run stay up high, clear of the crew; on the menu they sit below the title */
.toast { top: clamp(56px, 15vh, 124px); width: max-content; max-width: 92vw; padding: 8px 20px; border-radius: 14px; background: rgba(10, 16, 13, 0.78); font-size: clamp(17px, 2.6vw, 26px); text-shadow: none; }
@media (max-width: 760px) { .toast { top: 154px; } .hint { top: 196px; } }
@media (max-height: 440px) { .toast { top: 36px; max-width: 52vw; font-size: 15px; padding: 5px 14px; } .hint { top: 72px; font-size: 15px; } }
body:has(#menu:not(.hidden)) .toast { top: 31%; }
.hint { bottom: auto; top: clamp(92px, 23vh, 190px); width: max-content; max-width: 92vw; padding: 8px 18px; font-size: clamp(17px, 3vw, 24px); }

/* phones: one row of cards, stacked controls, a tab bar */
@media (max-width: 760px) {
  .roster { flex-wrap: nowrap; gap: 5px; width: 100%; max-width: none; }
  .card { flex: 1 1 0; min-width: 0; width: auto; padding: 5px 1px 6px; border-radius: 10px; }
  .card img { height: 42px; max-width: 100%; }
  .card b { font-size: 12px; white-space: nowrap; }
  .card small, .card .boss { display: none; }
  .card.on { transform: none; }
  .perk { font-size: 14px; }
  .go-row { display: contents; }
  .go-row #diff, .go-row #diff-note { justify-self: auto; text-align: center; }
  .go-row #diff-note { order: 0; font-size: 13px; margin-top: -6px; }
  .nav-btn { position: relative; }
  .nav-btn > .gp { position: absolute; top: -6px; right: -3px; min-width: 18px; height: 18px; padding: 0 4px; line-height: 18px; font-size: 11px; }
  #play { order: 1; }
  .menu-nav { order: 2; flex-wrap: nowrap; width: 100%; gap: 5px; margin-top: 2px; }
  .nav-btn { flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; height: 52px; padding: 0 1px; gap: 3px; font-size: 11px; white-space: nowrap; border-radius: 10px; }
  .nav-btn svg { width: 18px; height: 18px; }
  .nav-btn .bank { display: none; }
  .menu-bottom { gap: 8px; padding-left: 10px; padding-right: 10px; }
}

/* short screens, landscape phones most of all */
@media (max-height: 640px) {
  .logo { font-size: clamp(40px, 9vh, 72px); }
  .tag { font-size: 13px; letter-spacing: 5px; }
  .menu-top { padding-bottom: 4px; gap: 3px; }
  .menu-bottom { padding-top: 6px; gap: 6px; }
  .card img { height: 36px; }
  .card small, .card .boss { display: none; }
  .perk, #diff-note { display: none; }
  #diff .tab { padding: 5px 14px; }
  .btn { padding: 8px 30px; font-size: 18px; }
  .nav-btn { height: 38px; }
  .menu-nav { margin: 0 0 6px; }
}
@media (max-height: 640px) and (max-width: 760px) {
  .nav-btn { height: 44px; }
}
@media (max-height: 440px) {
  .tag { display: none; }
  .logo { font-size: 32px; }
  .menu-top { padding-top: 8px; }
  .menu-bar { position: absolute; top: 6px; left: 12px; right: 12px; margin: 0; }
  .roster { width: auto; max-width: 640px; }
  .card { flex: 0 0 88px; flex-direction: row; justify-content: center; gap: 4px; padding: 3px 4px; }
  .card b { font-size: 13px; white-space: nowrap; }
  .card img { height: 28px; }
  .go-row { display: grid; }
  .go-row #diff { justify-self: end; }
  .go-row #diff-note { display: none; }
  .nav-btn { flex-direction: row; height: 34px; gap: 5px; font-size: 12px; }
}

/* signed-in player or guest */
.acct { align-self: center; margin: 0 auto 0 14px; padding: 7px 14px; border: 1px solid var(--line, rgba(255, 255, 255, 0.35)); border-radius: 999px; background: rgba(10, 16, 13, 0.6); color: var(--ink); font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap; }
.acct:hover { background: rgba(10, 16, 13, 0.85); }
.keep { display: inline-block; margin: 2px 0 10px; color: var(--gold); font-weight: 700; }
@media (max-width: 760px) {
  .acct { margin-left: 8px; padding: 5px 10px; font-size: 13px; }
  .menu-bar .music-toggle > span { display: none; }
  .menu-bar .music-toggle::before { content: "\266A"; font-size: 18px; }
}
.over-links { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; }
a.link { display: inline-block; }
