:root {
  --bg: #0b0f17;
  --panel: #131a26;
  --panel-2: #1b2433;
  --text: #e8edf5;
  --muted: #8a97ad;
  --accent: #ffd23f;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.hidden { display: none !important; }

.logo {
  margin: 0;
  font-size: 48px;
  font-weight: 900;
  letter-spacing: 2px;
  font-style: italic;
}
.logo span { color: var(--accent); margin-left: 6px; }
.logo.small { font-size: 26px; }
/* The logo image (logo.svg): as wide as about 9.6 letters of the old text logo, never wider than its box */
.logo img { display: block; width: 100%; max-width: 9.6em; height: auto; margin: 0 auto; }
.logo.small img { margin: 0; }

/* Drawn icons: <i class="ic ic-gear"> is a mask in the text colour. js/render/icons.js defines --ic
   for each ic-* class (an emoji or symbol glyph would look different per font and platform). */
.ic {
  --ic: linear-gradient(transparent, transparent);
  display: inline-block; flex: none; width: 1.1em; height: 1.1em; vertical-align: -0.2em; background: currentColor;
  -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat;
}

.btn, button {
  display: inline-block;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #1a1400;
  font: inherit;
  font-weight: 800;
  padding: 12px 20px;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s, background 0.15s;
}
.btn:hover, button:hover:not(:disabled) { filter: brightness(1.1); }
.btn:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input:not([type="checkbox"]):not([type="radio"]) {
  font: inherit;
  font-size: 22px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 2px solid #2c3850;
  background: #0e1420;
  color: var(--text);
  width: 100%;
}

/* ---------- home screen (index.html, home.js) ---------- */
.home main {
  /* Centred both ways in the window; taller than the window (Settings, a short screen), it grows
     and the page scrolls instead of clipping. Top and bottom keep clear of the account chip and the
     globe / Quit buttons. */
  max-width: 1100px; margin: 0 auto; padding: 68px 24px 72px; box-sizing: border-box;
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center;
}
.home .logo { text-align: center; line-height: 0; }
.home .logo img { width: min(575px, 88vw); max-width: none; height: auto; } /* 25% over the 460 px it was */
.home .tag { color: var(--muted); font-size: 18px; text-align: center; margin: 14px 0 0; }
.home svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.home .view { margin-top: 36px; }
#menuView { display: flex; flex-direction: column; gap: 18px; }
/* The menu: three tiles (A2 on the design canvas), joining as a remote host in a bar underneath */
.home-menu { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.hm {
  display: flex; flex-direction: column; justify-content: space-between; gap: 18px; min-height: 280px;
  text-align: left; text-decoration: none; font-weight: 400;
  background: var(--panel); color: var(--text); border: 2px solid transparent; border-radius: 20px; padding: 30px;
}
.hm:hover:not(:disabled) { border-color: #2c3850; background: var(--panel-2); filter: none; }
.hm:focus-visible { outline: none; border-color: var(--accent); }
.hm svg { width: 60px; height: 60px; flex: none; color: var(--accent); stroke-width: 1.8; }
.hm span { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hm b { font-size: 24px; font-weight: 800; }
.hm small { color: var(--muted); font-size: 15px; line-height: 1.4; }
.hm.main { background: var(--accent); color: #1a1400; }
.hm.main svg { color: #1a1400; }
.hm.main b { font-size: 28px; }
.hm.main small { color: #4d3f00; }
.hm.main:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); border-color: transparent; }
.hm.main:focus-visible { border-color: #fff; }
.remotebar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; background: var(--panel); border-radius: 20px; padding: 18px 28px; }
.remotebar > svg { width: 40px; height: 40px; flex: none; color: var(--accent); stroke-width: 1.8; }
.rb-words { display: flex; flex-direction: column; gap: 2px; flex: 1 1 260px; min-width: 0; }
.rb-words b { font-size: 20px; }
.rb-words small { font-size: 14px; color: var(--muted); }
.remotebar input:not([type]) { width: 220px; font-size: 17px; padding: 12px 14px; }
body.desktop .remotebar input:not([type]) { width: 280px; }
.remotebar button { padding: 14px 24px; }
.remotebar button.alt { background: var(--panel-2); color: var(--text); border: 1px solid #2c3850; }
.remotebar .msg { flex-basis: 100%; min-height: 0; }
.remotebar .msg:empty { display: none; }
/* By device (body.phone / body.pc, set by home.js): phones get the join box, PCs the remote bar */
#joinBox, #remoteForm.remotebar { display: none; }
body.phone #joinBox { display: flex; }
body.pc #remoteForm.remotebar { display: flex; }
/* The small override link under each ("Not on a phone?" / "On a phone?"): quiet, and not in the app */
.remotebar .sublink { flex-basis: 100%; text-align: center; }
body.desktop .sublink { display: none; }
.joinbox { background: var(--panel); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.joinbox h2 { margin: 0; font-size: 20px; }
.joinbox p { margin: 0; color: var(--muted); font-size: 14px; }
.joinbox input { text-transform: uppercase; letter-spacing: 6px; text-align: center; }
/* The demo's itch.io box (js/ui/upsell.js). The button is itch.io's white logo on their red, as their
   press kit gives it (public/brand/): never stretched or recoloured. */
.itchbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: none;
  background: #fa5c5c; color: #fff; border-radius: 10px; padding: 11px 16px; text-decoration: none; font-weight: 800; font-size: 14px;
}
.itchbtn:hover { filter: brightness(1.08); }
.itchbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.itchbtn img { display: block; width: auto; height: 24px; }
.itchbtn .logo-mark { height: 26px; }
.itchbtn span { white-space: nowrap; }
.itchbtn.both .logo-mark { display: none; }
.upsell { display: flex; align-items: center; gap: 18px; text-align: left; }
.upsell .words { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.upsell .words > span { color: var(--text); font-size: 15px; line-height: 1.4; }
.upsell .words small { color: var(--muted); font-size: 13px; font-weight: 700; }
.upsell .words small a { color: var(--accent); text-decoration: none; }
.upsell .words small a:hover { text-decoration: underline; }
/* Home: a quiet bar as wide as the tiles, no outline (the tiles have none) */
.upsell.bar { background: var(--panel); border-radius: 20px; padding: 16px 28px; }
/* The account chip, top right, and its pop-up (sign in / sign out) */
.acct { position: absolute; top: 14px; right: 16px; z-index: 6; }
.who {
  display: flex; align-items: center; gap: 8px; max-width: 60vw;
  color: var(--text); font: inherit; font-weight: 700; font-size: 14px;
  background: var(--panel); border: 1px solid #2c3850; border-radius: 999px; padding: 6px 10px 6px 8px;
}
.who:hover, .who[aria-expanded="true"] { border-color: var(--accent); filter: none; }
.who svg { width: 22px; height: 22px; flex: none; color: var(--accent); }
.who .chev { width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
.who[aria-expanded="true"] .chev { transform: rotate(180deg); }
.who.out { background: var(--accent); color: #1a1400; border-color: var(--accent); }
.who.out svg, .who.out .chev { color: #1a1400; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop {
  position: absolute; background: var(--panel); border: 1px solid #2c3850; border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55); animation: popin .12s ease-out;
}
@keyframes popin { from { opacity: 0; transform: translateY(-4px); } }
.accountpop { right: 0; top: calc(100% + 8px); width: min(340px, calc(100vw - 32px)); padding: 18px; display: flex; flex-direction: column; gap: 12px; box-sizing: border-box; }
.accountpop h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); }
.accountpop .hint:empty, .accountpop .msg:empty { display: none; }
.accountpop .acts { display: flex; flex-direction: column; gap: 8px; }
.accountpop .acts button { width: 100%; padding: 11px 14px; font-size: 14px; }
.accountpop .acts button.alt { background: var(--panel-2); color: var(--text); border: 1px solid #2c3850; }
.viewhead { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.viewhead h2 { margin: 0; font-size: 24px; }
.back { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--panel); color: var(--text); flex: none; }
.back:hover, .back:focus-visible { background: var(--panel-2); color: var(--accent); outline: none; }
.back svg { width: 22px; height: 22px; }
.home .card { padding: 20px; }
.home .card h3 { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.home .card h3 svg { width: 26px; height: 26px; flex: none; }
.home .card.main { outline: 2px solid var(--accent); }
.home .card .grow { flex: 1; }
.home .card button.alt, .home .acts button.alt { background: var(--panel-2); color: var(--text); border: 1px solid #2c3850; }
.home .pill { font-size: 12px; font-weight: 700; background: var(--accent); color: #111; border-radius: 99px; padding: 2px 9px; margin-left: auto; }
.home .msg { min-height: 1.4em; font-size: 14px; color: var(--muted); }
.home .msg.err { color: #ff6b5b; }
.home .hint { color: var(--muted); font-size: 13px; margin: 0; }
.signedline { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.signedline .dot { width: 9px; height: 9px; border-radius: 50%; background: #4cd07d; box-shadow: 0 0 6px #4cd07d; flex: none; }
.home .inline { display: flex; gap: 10px; flex-wrap: wrap; }
.home .inline input { flex: 1; min-width: 160px; width: auto; }
#settingsView { width: 100%; max-width: 640px; margin-inline: auto; } /* centred under the logo */
/* The language picker (.globepick), bottom right of the home screen: a globe button and a list above it */
.globepick { position: fixed; right: 16px; bottom: 16px; z-index: 5; }
#langBtn {
  display: flex; align-items: center; gap: 8px; font: inherit; font-size: 14px; font-weight: 700;
  background: var(--panel); color: var(--text); border: 1px solid #2c3850; border-radius: 999px; padding: 8px 12px 8px 10px;
}
#langBtn:hover, #langBtn[aria-expanded="true"] { border-color: var(--accent); filter: none; }
#langBtn svg { width: 22px; height: 22px; flex: none; color: var(--accent); }
#langBtn .chev { width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
#langBtn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.langlist { right: 0; bottom: calc(100% + 8px); min-width: 210px; list-style: none; margin: 0; padding: 6px; animation-name: popup; }
@keyframes popup { from { opacity: 0; transform: translateY(4px); } }
.langlist li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 15px; }
.langlist li:hover, .langlist li:focus { background: var(--panel-2); outline: none; }
.langlist li:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.langlist .check { width: 18px; height: 18px; flex: none; visibility: hidden; color: var(--accent); stroke-width: 2.5; }
.langlist li[aria-selected="true"] { color: var(--accent); }
.langlist li[aria-selected="true"] .check { visibility: visible; }
.langlist small { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--muted); border: 1px solid #2c3850; border-radius: 6px; padding: 1px 6px; }
#remoteTarget { text-transform: uppercase; }
body.desktop #remoteTarget { text-transform: none; }
.settings { gap: 22px; }
.settings .acts { display: flex; flex-wrap: wrap; gap: 8px; }
.settings .acts button { padding: 9px 14px; font-size: 14px; }
.spin { width: 16px; height: 16px; border: 3px solid var(--panel-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; vertical-align: -3px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 640px) {
  .home main { padding-top: 64px; padding-bottom: 76px; }
  .home-menu { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .hm { flex-direction: row; align-items: center; justify-content: flex-start; min-height: 0; padding: 14px 16px; gap: 14px; border-radius: 16px; }
  .hm svg { width: 34px; height: 34px; }
  .hm b, .hm.main b { font-size: 18px; }
  .hm small { font-size: 13px; }
  .remotebar { padding: 16px; }
  .upsell.bar { padding: 14px 16px; gap: 14px; border-radius: 16px; }
  .upsell.bar .words > span { font-size: 14px; }
  .itchbtn.both { padding: 9px 10px; }
  .itchbtn.both .logo-full { display: none; }
  .itchbtn.both .logo-mark { display: block; }
  .remotebar input:not([type]), body.desktop .remotebar input:not([type]) { flex: 1; width: auto; min-width: 0; }
  .pm-row:not(.pm-toggle) { flex-wrap: wrap; }
  .pm-row select, .pm-slider { max-width: none; width: 100%; }
}
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 32px; }
.card {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--panel); border-radius: 16px; padding: 24px;
  color: inherit; text-decoration: none;
}
.card h2 { margin: 0; }
.card p { margin: 0; color: var(--muted); flex: 1; }
.card input { text-transform: uppercase; letter-spacing: 6px; text-align: center; }
a.card:hover { outline: 2px solid var(--accent); }

/* ---------- host ---------- */
.host { overflow: hidden; }
#app { display: grid; grid-template-columns: 1fr 300px; height: 100vh; }
#stage { position: relative; min-width: 0; min-height: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

#lobby {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: rgba(11, 15, 23, 0.82);
  text-align: center;
}
#lobby .qr { width: min(46vh, 420px); background: #fff; padding: 12px; border-radius: 16px; margin-top: 16px; }
#lobby .big { font-size: 34px; font-weight: 800; margin: 12px 0 0; }
#lobby .url { color: var(--muted); font-size: 20px; margin: 0; word-break: break-all; }
#lobby .hint { color: var(--muted); font-size: 20px; margin: 0; }
#lobby .code { color: var(--accent); letter-spacing: 4px; }

#side {
  background: var(--panel);
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px; min-height: 0; overflow-y: auto; /* fallback only: the layout is sized to fit */
}
#side > * { flex: none; }
/* QR on the left, room code on the right. The QR is the one flexible piece: it grows on
   tall screens and shrinks on short ones so the rest of the sidebar always fits. */
.join {
  background: var(--panel-2); border-radius: 14px; padding: 10px;
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
}
.join .qr {
  grid-row: 1 / 3; width: clamp(88px, 100vh - 660px, 150px); height: auto;
  background: #fff; border-radius: 8px; padding: 6px; display: block;
}
/* The sidebar QR is a button: click it for the full-screen one (#qrDlg) */
.qrbtn { grid-row: 1 / 3; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 8px; }
.qrbtn:hover .qr, .qrbtn:focus-visible .qr { outline: 3px solid var(--accent); outline-offset: 2px; }
.qrdlg {
  width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; border: 0; padding: 24px; box-sizing: border-box;
  background: rgba(11, 15, 23, 0.96); color: var(--text); text-align: center; cursor: zoom-out;
}
.qrdlg[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.qrdlg::backdrop { background: rgba(5, 8, 14, 0.8); }
.qrdlg .qr { width: min(54vh, 86vw); height: auto; background: #fff; padding: 16px; border-radius: 20px; }
.qrdlg p { margin: 0; }
.qrdlg .big { font-size: clamp(22px, 4vh, 40px); font-weight: 800; margin-top: 10px; }
.qrdlg .code { color: var(--accent); font-size: clamp(48px, 13vh, 140px); font-weight: 900; letter-spacing: 0.15em; line-height: 1; }
.qrdlg .url { color: var(--muted); font-size: clamp(16px, 2.6vh, 26px); word-break: break-all; }
.qrdlg .hint { color: var(--muted); font-size: clamp(14px, 2.2vh, 20px); }
body.has-edition .join .qr { width: clamp(88px, 100vh - 710px, 150px); }
/* Edition strip under the logo: demo limits + unlock links, or who unlocked the full game */
#edition {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; color: var(--muted);
  background: var(--panel-2); border-radius: 10px; padding: 7px 10px;
}
#edition .what { flex-basis: 100%; color: var(--text); font-weight: 700; }
#edition a { color: var(--accent); font-weight: 700; text-decoration: none; }
#edition a:hover { text-decoration: underline; }
#edition .signin { color: var(--muted); font-weight: 600; }
#edition button { padding: 2px 10px; font-size: 12px; }
#edition.demo { display: block; padding: 9px 10px; }
.upsell.side { gap: 10px; }
.upsell.side .itchbtn { padding: 7px 8px; border-radius: 8px; }
.upsell.side .itchbtn img { height: 20px; }
.upsell.side .words > span { font-size: 12px; line-height: 1.35; }
.upsell.side .words small { font-size: 12px; }
/* Desktop app: online / LAN dot in the strip, and the notice over the stage */
#edition .netdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--muted); }
#edition .netdot.on { background: #4cd07d; box-shadow: 0 0 6px #4cd07d; }
#desktopNote { position: absolute; inset: 0; display: grid; place-items: center; background: #0b0f17cc; z-index: 20; }
#desktopNote .card { max-width: 30rem; margin: 16px; padding: 24px; border-radius: 16px; background: var(--panel); box-shadow: 0 8px 30px #0008; }
#desktopNote h2 { margin: 0 0 8px; }
#desktopNote p { margin: 0 0 18px; color: var(--muted); }
#desktopNote .row { display: flex; gap: 10px; flex-wrap: wrap; }
.join .room { align-self: end; font-size: 14px; color: var(--muted); display: flex; flex-direction: column; }
.join .code { color: var(--accent); font-size: 26px; letter-spacing: 3px; }
.join .url { align-self: start; margin-top: 4px; font-size: 11px; color: var(--muted); word-break: break-all; }

/* Manage players button + popup */
.duo { display: flex; gap: 8px; flex: none; }
#manage, #settings {
  display: flex; align-items: center; justify-content: center; gap: 8px; flex: 1;
  font-size: 14px; padding: 10px 12px; background: var(--panel-2); color: var(--text); border: 1px solid #2c3850;
}
#manage { justify-content: space-between; }
#fullscreen {
  flex: none; width: 42px; padding: 0; font-size: 18px; display: grid; place-items: center;
  background: var(--panel-2); color: var(--text); border: 1px solid #2c3850;
}
#manage:hover, #settings:hover, #fullscreen:hover { background: #24304a; filter: none; }
/* Reset / End are hidden during setup: drop the empty row so it takes no space */
#foot .row:not(:has(button:not(.hidden))) { display: none; }
#manage b { background: var(--accent); color: #1a1400; border-radius: 999px; min-width: 26px; padding: 2px 8px; font-size: 13px; }
.dlg {
  width: min(560px, calc(100vw - 32px)); max-height: min(80vh, 760px); padding: 0;
  background: var(--panel); color: var(--text); border: 1px solid #2c3850; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
#settingsDlg { width: min(420px, calc(100vw - 32px)); }
.dlg[open] { display: flex; flex-direction: column; }
.dlg::backdrop { background: rgba(5, 8, 14, 0.6); }
.dlg header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; }
.dlg h2 { margin: 0; font-size: 18px; }
.dlg h2 span { color: var(--muted); font-weight: 600; font-size: 14px; }
.dlg header button { font-size: 14px; padding: 6px 10px; background: var(--panel-2); color: var(--text); border: 1px solid #2c3850; }
.dlgbody { padding: 4px 16px 18px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
#board { list-style: none; margin: 0; padding: 0 16px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
#board li {
  display: grid; grid-template-columns: 14px 1fr auto auto; align-items: center; column-gap: 10px;
  background: var(--panel-2); border-radius: 10px; padding: 8px 12px;
}
#board .swatch { width: 14px; height: 14px; border-radius: 4px; }
#board .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#board .score { font-size: 22px; font-weight: 900; }
#board .kick { font-size: 12px; padding: 6px 10px; background: transparent; color: #ff9a9a; border: 1px solid #5a2a33; }
#board .kick:hover { background: #3a1c22; filter: none; }
#board .meta { grid-column: 2 / 5; display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
#board .bottag { grid-column: 2 / 5; font-size: 12px; font-style: italic; color: var(--muted); }
#board .bottag:empty { display: none; }
#board .botopts { grid-column: 2 / 5; display: flex; gap: 6px; margin-top: 6px; }
#board .botopts select { flex: 1 1 0; min-width: 0; padding: 5px 26px 5px 8px; font-size: 12px; }
#board .hearts { color: #ff5d6c; display: flex; align-items: center; gap: 2px; }
#board .hearts .ic-boom { color: #ffb02e; }
#board .name .ic-crown { color: #ffd23f; }
#board .off { opacity: 0.45; }
#board .badge { font-size: 10px; padding: 1px 6px; border-radius: 6px; background: #2a3549; }
#board .badge.p2p { background: #1f4d2f; color: #8ff0a4; }
#board .empty { color: var(--muted); background: none; display: block; text-align: center; padding: 20px; }

#foot { display: flex; flex-direction: column; gap: 10px; font-size: 12px; color: var(--muted); }
#foot .row { display: flex; gap: 6px; flex-wrap: wrap; }
/* Secondary buttons */
#foot button, #menu button {
  font-size: 12px; padding: 7px 12px; border-radius: 8px;
  background: var(--panel-2); color: var(--text); border: 1px solid #2c3850;
}
#foot button:hover, #menu button:hover { background: #24304a; filter: none; }
#foot #end { color: #ff9a9a; border-color: #5a2a33; }
.aibots { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.aibots span { flex: 1; font-weight: 700; }
.aibots b { min-width: 22px; text-align: center; font-size: 16px; }
#foot .aibots button { width: 32px; padding: 4px 0; font-size: 16px; font-weight: 900; }
.aiskill { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text); font-size: 13px; font-weight: 700; }
.aiskill select { flex: 0 0 120px; width: 120px; padding: 6px 28px 6px 10px; }
.skillslider input[type="range"] { flex: 1; min-width: 0; margin: 0; accent-color: var(--accent); cursor: pointer; }
.skillslider output { flex: 0 0 56px; color: var(--accent); text-align: right; }
/* Settings popup: tight rows, label left, control right. */
.dlgbody.compact { gap: 10px; padding-bottom: 14px; }
.dlgbody.compact .toggle { align-items: center; justify-content: space-between; }
.dlgbody.compact .toggle small { margin-top: 1px; }
.dlgbody.compact hr { width: 100%; margin: 2px 0; border: 0; border-top: 1px solid #2c3850; }
#board .badge.ai { background: #3b2a5c; color: #d8c4ff; }
#board .badge.pad { background: #4d3a1f; color: #ffd28f; }
#board .badge.remote { background: #1f3d5c; color: #9fd0ff; }
#board li.remotehost { display: flex; justify-content: space-between; align-items: center; color: #9fd0ff; }
#board li.remotehost button { font-size: 12px; padding: 6px 10px; background: transparent; color: #ff9a9a; border: 1px solid #5a2a33; }
.modepick { display: flex; flex-direction: column; gap: 4px; }

/* Toggle switch */
.toggle { display: flex; gap: 10px; align-items: flex-start; color: var(--text); cursor: pointer; line-height: 1.3; }
.toggle b { display: block; font-size: 13px; }
.toggle small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.switch {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none;
  width: 36px; height: 20px; border-radius: 999px;
  background: #2c3850; position: relative; cursor: pointer; transition: background 0.15s;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--text); transition: transform 0.15s, background 0.15s;
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); background: #1a1400; }

/* Powerup on/off chips in Settings */
.pusection { color: var(--text); line-height: 1.3; }
.pusection b { display: block; font-size: 13px; }
.pusection small { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.pufreq { margin-top: 8px; font-size: 12px; }
.pufreq output { flex-basis: 64px; }
.putoggles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.puchip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px;
  border-radius: 999px; border: 1px solid #2c3850; background: var(--panel-2);
  color: var(--muted); font-size: 12px; cursor: pointer; user-select: none;
  transition: color 0.15s, border-color 0.15s;
}
.puchip input {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none; cursor: pointer;
  width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--c);
}
.puchip input:checked { background: var(--c); }
.puchip:has(input:checked) { color: var(--text); border-color: var(--c); }
.puchip:has(input:not(:checked)) { text-decoration: line-through; }
.puchip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Checkboxes */
.modechecks input {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none;
  width: 18px; height: 18px; border-radius: 5px; border: 2px solid #3a4660; background: #0e1420;
  display: grid; place-items: center; cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.modechecks input:checked { background: var(--accent); border-color: var(--accent); }
.modechecks input:checked::after {
  content: ''; width: 4px; height: 9px; margin-top: -2px;
  border: solid #1a1400; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* Dropdowns */
select {
  appearance: none; -webkit-appearance: none; width: 100%;
  font: inherit; font-size: 13px; padding: 8px 30px 8px 10px; border-radius: 8px;
  background-color: #0e1420; color: var(--text); border: 1px solid #2c3850; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23ffd23f' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
select option { background: #131a26; color: var(--text); }

/* Setup panel */
.panel { background: var(--panel-2); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.panel h2 { margin: 0; font-size: 16px; }
.panel .hint { margin: 0; font-size: 12px; color: var(--muted); }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; background: #0e1420; border-radius: 10px; padding: 3px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 7px 0; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.seg input:checked + span { background: var(--accent); color: #1a1400; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.seg .locked span, .modechecks .locked { opacity: 0.45; cursor: not-allowed; }
/* Full-game-only kinds and modes in the demo: a drawn padlock (an emoji would differ per platform) */
.seg .locked span::before, .modechecks .locked::before {
  content: ''; display: inline-block; width: 9px; height: 11px; margin-right: 5px; vertical-align: -1px;
  background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 12'%3E%3Cpath d='M2.2 5.5V3.6a2.8 2.8 0 0 1 5.6 0v1.9' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3Crect y='5' width='10' height='7' rx='1.6'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 12'%3E%3Cpath d='M2.2 5.5V3.6a2.8 2.8 0 0 1 5.6 0v1.9' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3Crect y='5' width='10' height='7' rx='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.modechecks .locked input { display: none; }
.lockline { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.lockline::before {
  content: ''; display: inline-block; width: 9px; height: 11px; margin-right: 6px; vertical-align: -1px;
  background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 12'%3E%3Cpath d='M2.2 5.5V3.6a2.8 2.8 0 0 1 5.6 0v1.9' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3Crect y='5' width='10' height='7' rx='1.6'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 12'%3E%3Cpath d='M2.2 5.5V3.6a2.8 2.8 0 0 1 5.6 0v1.9' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3Crect y='5' width='10' height='7' rx='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.lockline a { color: var(--accent); font-weight: 700; text-decoration: none; }
.lockline a:hover { text-decoration: underline; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
#roundsField { flex-direction: row; align-items: center; justify-content: space-between; }
#roundsField select { width: 90px; padding-top: 6px; padding-bottom: 6px; }
/* Game modes: compact wrapping chips instead of a tall checklist */
.modechecks { display: flex; flex-wrap: wrap; gap: 4px; }
.modechecks label {
  display: flex; gap: 5px; align-items: center; color: var(--muted); font-size: 11.5px; line-height: 1.2; cursor: pointer;
  padding: 3px 8px 3px 5px; border-radius: 999px; border: 1px solid #2c3850; background: #0e1420; white-space: nowrap;
}
.modechecks label:has(input:checked) { color: var(--text); border-color: #5a4c1a; }
.modechecks label input { width: 14px; height: 14px; border-radius: 4px; }
.modechecks label input:checked::after { width: 3px; height: 7px; }
#start { width: 100%; }
#start:disabled { opacity: 0.4; cursor: not-allowed; }

/* Match / Game: arena takes the whole screen */
body.immersive #app { grid-template-columns: 1fr; }
body.immersive #side { display: none; }
#menu {
  position: absolute; top: 21px; right: 12px; display: flex; gap: 8px;
  opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
#menu.show { opacity: 1; pointer-events: auto; }

@media (max-aspect-ratio: 1/1) {
  #app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  #side { max-height: 40vh; flex-direction: row; flex-wrap: wrap; }
  #side .logo { display: none; }
  .join { width: 260px; }
}

/* ---------- controller ---------- */
.play {
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}
#joinform {
  max-width: 420px; margin: 0 auto; padding: 32px 16px;
  display: flex; flex-direction: column; gap: 14px;
  touch-action: manipulation;
}
#joinform label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-weight: 600; }
#joinform #room { text-transform: uppercase; letter-spacing: 6px; }
#joinform .btn { font-size: 22px; padding: 16px; }
#joinform .err { color: #ff7b7b; min-height: 1.2em; margin: 0; }
/* The game ended / out of reach (play.js ended(), remote/client.js remoteEnded()) */
.endcard { background: var(--panel); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 14px; text-align: left; }
.endcard svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.endcard .tagline { justify-self: start;
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  background: var(--panel-2); border: 1px solid #2c3850; color: var(--muted); border-radius: 999px; padding: 4px 12px 4px 8px; font-size: 13px; font-weight: 700;
}
.endcard .tagline svg { width: 18px; height: 18px; color: var(--accent); }
.endcard h2 { margin: 0; font-size: 24px; }
.endcard > p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.45; }
.endjoin { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid #2c3850; padding-top: 14px; }
.endjoin p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.coderow { display: flex; gap: 10px; }
.coderow input:not([type]) { flex: 1; min-width: 0; width: auto; text-transform: uppercase; letter-spacing: 6px; text-align: center; font-size: 22px; }
.coderow .btn { padding: 12px 22px; }
/* Home on the left edge (under the code box), itch.io on the right (under its button), one height */
.endcard .more { display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.endcard .more > * { height: 44px; justify-content: center; box-sizing: border-box; }
.ghostbtn {
  display: inline-flex; align-items: center; gap: 8px; background: var(--panel-2); color: var(--text); border: 1px solid #2c3850;
  border-radius: 10px; padding: 10px 14px; font: inherit; font-weight: 700; font-size: 14px; text-decoration: none; cursor: pointer;
}
.ghostbtn:hover { background: #24304a; filter: none; }
.ghostbtn svg { width: 18px; height: 18px; color: var(--accent); }
.endcard .more .itchbtn { padding: 0 14px; font-size: 14px; border: 1px solid transparent; }
.endcard .more .itchbtn img { height: 22px; }
.endcard .more .ghostbtn { padding: 0 14px; }
.upsell.incard { background: var(--panel-2); border-radius: 12px; padding: 10px 12px; gap: 12px; }
.upsell.incard .itchbtn { padding: 8px 10px; }
/* Phone: the card in place of the join form */
#ended { max-width: 420px; margin: 0 auto; padding: 26px 16px 32px; display: flex; flex-direction: column; gap: 18px; }
#ended .logo { text-align: center; }
#ended .logo img { width: 200px; }
#ended:not([data-as="full"]) #endUpsell, #ended:not([data-as="full"]) #endRetry { display: none; }
#ended[data-as="full"] .endjoin, #ended[data-as="full"] .more { display: none; }
/* A phone is too narrow for both side by side: stacked, as wide as the code row */
#ended .more { flex-direction: column; }
#ended .more > * { width: 100%; }
/* ...or, while the big screen might still come back, a sheet over the pad (which keeps retrying) */
#ended.sheet {
  position: fixed; inset: 0; z-index: 30; max-width: none; margin: 0; overflow-y: auto;
  background: rgba(11, 15, 23, 0.88); justify-content: center; align-items: center; padding: 12px;
}
#ended.sheet .logo { display: none; }
#ended.sheet .endcard { width: 100%; max-width: 420px; }
#ended.sheet #endText::before {
  content: ''; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px;
  border: 2px solid #2c3850; border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite;
}
/* A phone held sideways: every state gets the sheet's layout, one card filling the screen in two
   columns (the controller page can't scroll, so a tall card would be cut off). Left: what happened
   and Home / itch.io; right: join another game, or (demo full) the itch.io box and Try again. */
@media (orientation: landscape) and (max-height: 500px) {
  #ended {
    position: fixed; inset: 0; z-index: 30; max-width: none; margin: 0; overflow-y: auto;
    justify-content: center; align-items: center; padding: 12px;
  }
  #ended .logo { display: none; }
  /* The divider: one line down the middle of the card, between the columns */
  #ended .endcard, #ended.sheet .endcard {
    width: 100%; max-width: 680px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 44px; row-gap: 10px; align-content: start; padding: 16px 18px;
    background: linear-gradient(#2c3850, #2c3850) center / 1px calc(100% - 32px) no-repeat, var(--panel);
  }
  #ended .endcard > * { grid-column: 1; }
  #ended .endjoin, #ended #endUpsell, #ended #endRetry { grid-column: 2; }
  #ended .endjoin { grid-row: 1 / span 5; border-top: 0; padding-top: 0; }
  /* Demo full: the itch.io box beside the room and title, Try again beside the text */
  #ended #endUpsell { grid-row: 1 / span 2; align-self: center; }
  #ended #endRetry { grid-row: 3; align-self: start; }
  #ended h2 { font-size: 20px; }
}
#pad { position: fixed; inset: 0; }
#pad canvas { width: 100%; height: 100%; display: block; touch-action: none; }
#fsbtn {
  position: absolute; top: 30px; left: 10px;
  font-size: 13px; padding: 8px 12px; border-radius: 10px;
  background: rgba(19, 26, 38, 0.85); color: var(--text); border: 1px solid #2c3850;
  touch-action: manipulation;
}
/* Emote (talk bubble) buttons, bottom centre between the sticks */
#emotes {
  position: absolute; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; gap: 6px; padding: 5px; border-radius: 999px;
  background: rgba(19, 26, 38, 0.75); border: 1px solid #2c3850;
}
#emotes button {
  width: 42px; height: 42px; padding: 0; border-radius: 50%;
  background: #1b2433; font-size: 24px; line-height: 42px; text-align: center;
  touch-action: manipulation;
}
#emotes button:active { background: #2c3850; }
#emotes button.pop { animation: emote-pop 0.35s ease-out; }
@keyframes emote-pop { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
/* Two-step confirm buttons (first click arms them) */
#foot #end.armed, #menu #menuEnd.armed { background: #c0392b; color: #fff; border-color: #c0392b; }

/* ---------- tank customization (controller) ---------- */
#czbtn {
  position: absolute; top: 34px; right: 10px;
  font-size: 15px; padding: 9px 14px; border-radius: 999px;
  touch-action: manipulation; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  animation: cz-nudge 2.4s ease-in-out infinite;
}
@keyframes cz-nudge { 0%, 80%, 100% { transform: scale(1); } 88% { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { #czbtn { animation: none; } }
#custom {
  position: fixed; inset: 0; z-index: 10; background: var(--bg);
  display: flex; gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}
#custom.hidden { display: none; }
.cz-stage { position: relative; flex: 1 1 50%; min-width: 0; min-height: 0; border-radius: 16px; background: var(--panel); overflow: hidden; }
#czc { width: 100%; height: 100%; display: block; touch-action: none; }
.cz-side { flex: 1 1 50%; min-width: 0; overflow-y: auto; touch-action: pan-y; display: flex; flex-direction: column; gap: 8px; padding-right: 2px; }
.cz-side header { display: flex; align-items: center; justify-content: space-between; gap: 8px; position: sticky; top: 0; background: var(--bg); padding-bottom: 4px; z-index: 1; }
.cz-side header b { font-size: 18px; margin-right: auto; }
.cz-side header button { padding: 8px 18px; touch-action: manipulation; }
.cz-side header .cz-ghost { background: var(--panel-2); color: var(--text); padding: 8px 12px; }
.cz-side h3 { margin: 4px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.cz-swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.cz-swatches button {
  aspect-ratio: 1; padding: 0; border-radius: 50%; border: 3px solid transparent; position: relative; touch-action: manipulation; min-width: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.cz-swatches button.on { border-color: #fff; box-shadow: 0 0 0 2px var(--bg) inset; }
.cz-swatches button.taken { opacity: 0.25; }
.cz-swatches button.taken::after {
  content: ''; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; background: #000;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5.5 5.5l13 13M18.5 5.5l-13 13' stroke='%23000' stroke-width='2.8' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5.5 5.5l13 13M18.5 5.5l-13 13' stroke='%23000' stroke-width='2.8' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.cz-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cz-chips button { padding: 7px 12px; font-size: 13px; background: var(--panel-2); color: var(--text); border: 2px solid transparent; touch-action: manipulation; }
.cz-chips button.on { border-color: var(--accent); }
@media (orientation: portrait) {
  #custom { flex-direction: column; }
  .cz-stage { flex: 0 0 38%; }
  .cz-side { flex: 1 1 auto; }
}
#toast {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 20;
  background: var(--accent); color: #1a1400; font-weight: 800; font-size: 18px;
  padding: 14px 22px; border-radius: 14px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); text-align: center;
  pointer-events: none;
}

/* Remote hosts: the approval prompt on the main host, and the join screen on the remote. */
.approve-row { display: flex; gap: 10px; }
.approve-row button { flex: 1; }
button.ghost { background: transparent; color: var(--text); border: 1px solid #2c3850; }
#remoteJoin {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; background: var(--bg); text-align: center; padding: 16px; z-index: 5;
}
#remoteJoin .big { font-size: 34px; font-weight: 800; margin: 0; }
#remoteJoin .hint { color: var(--muted); font-size: 20px; margin: 0; max-width: 640px; }
#remoteJoin .code { color: var(--accent); letter-spacing: 4px; }
#remoteForm { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; justify-content: center; }
#remoteForm input { font-size: 20px; padding: 12px 14px; border-radius: 10px; border: 1px solid #2c3850; background: var(--panel-2); color: var(--text); }
#remoteForm .btn { font-size: 20px; padding: 12px 20px; }
#remoteJoin.hidden { display: none; }
#remoteJoin.ended > :not(.logo):not(#remoteEnded) { display: none; }
#remoteEnded { width: min(520px, 100%); padding: 28px; gap: 16px; }
#remoteEnded h2 { font-size: 30px; }
#remoteEnded > p { font-size: 17px; }
#remoteEnded .endjoin b { font-size: 17px; }
/* Home and itch.io: equal halves across the bottom of the card */
#remoteEnded .more > * { flex: 1 1 0; min-width: 0; }
/* A remote host only shows the game: no setup, settings, bots or kicking. */
body.remote #setup, body.remote #settings, body.remote #liveMode, body.remote #reset, body.remote #end,
body.remote #menuEnd, body.remote .aibots, body.remote #board button, body.remote #board select { display: none !important; }

/* ---------- home button (ui/gohome.js), top right on every host screen ---------- */
/* Centred on the sidebar logo (16 px padding, logo 49-51 px tall) and on the right edge of the
   sidebar's boxes. The game menu (#menu) sits beside it at the same height. */
.homebtn {
  position: fixed; top: 21px; right: 16px; z-index: 30; width: 40px; height: 40px; padding: 0;
  display: grid; place-items: center; border-radius: 12px;
  background: rgba(27, 36, 51, 0.85); color: var(--text); border: 1px solid #2c3850;
}
.homebtn:hover { background: #24304a; filter: none; color: var(--accent); }
.homebtn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#side .logo.small { padding-right: 44px; }
#menu { right: 66px; height: 40px; align-items: center; } /* centred on the home button */
body.howto #lobby, body.howto #menu { display: none !important; }

/* ---------- device settings (ui/prefs-menu.js): home screen and the host's Settings ---------- */
.pm { display: flex; flex-direction: column; gap: 18px; }
.pm-section { display: flex; flex-direction: column; gap: 10px; }
.pm-section h3, .pm-title { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); }
.pm-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; cursor: pointer; }
.pm-words { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pm-words b { font-weight: 700; }
.pm-words small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.pm-row select { flex: none; max-width: 52%; }
.pm-slider { display: flex; align-items: center; gap: 10px; flex: none; width: min(230px, 52%); }
.pm-slider input { flex: 1; min-width: 0; accent-color: var(--accent); }
.pm-slider output { width: 44px; text-align: right; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
#settingsDlg .pm-title + .hint { margin: -10px 0 0; }
.home .settings .pm-section h3 { display: block; font-size: 13px; }
#settingsDlg .pm-words b { font-size: 13px; }
#settingsDlg .pm-words small { font-size: 11px; }
#settingsDlg .pm { gap: 14px; }

/* Scrollbars in the game's colours. The home screen keeps room for one at all times, so opening
   Settings (the only long view) doesn't shift the page sideways. */
* { scrollbar-width: thin; scrollbar-color: #2c3850 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2c3850; border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a4a68; }
html:has(body.home) { scrollbar-gutter: stable; }
/* Max players: a number box and a switch (off = no limit) */
.pm-cap { display: flex; align-items: center; gap: 12px; flex: none; }
.pm-cap input[type="number"] {
  width: 84px; font: inherit; font-size: 16px; font-weight: 700; text-align: center; padding: 7px 8px; letter-spacing: 0; text-transform: none;
  border-radius: 10px; border: 2px solid #2c3850; background: #0e1420; color: var(--text);
}
.pm-cap input[type="number"]:focus { outline: none; border-color: var(--accent); }
.pm-cap input[type="number"]:disabled { opacity: .4; }
/* ---------- language picker (start page, phone join form) ---------- */
.langpick { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 28px auto 0; color: var(--muted); font-size: 14px; }
.langpick select { width: auto; flex: none; padding: 6px 32px 6px 10px; font-size: 14px; }

/* Quit (desktop app only), bottom left of the home screen, and its confirm */
#quitBtn {
  position: fixed; left: 16px; bottom: 16px; z-index: 5; display: flex; align-items: center; gap: 8px;
  font: inherit; font-size: 14px; font-weight: 700; padding: 8px 14px 8px 10px; border-radius: 999px;
  background: var(--panel); color: var(--text); border: 1px solid #2c3850;
}
#quitBtn:hover { border-color: #ff6b5b; color: #ff9a9a; filter: none; }
#quitBtn svg { width: 20px; height: 20px; flex: none; }
#quitDlg { width: min(400px, calc(100vw - 32px)); }
#quitDlg .dlgbody { padding-top: 0; }
#quitYes { background: #ff6b5b; color: #1a0503; }

/* ---- Embedded remote view (host?remote=CODE&view) ---- */
/* Only the game canvas, full window (render/core.js sizes the canvas from its own box on every frame,
   so a resize just works). The one thing shown over it is a small status line while waiting. */
body.view { background: var(--bg); overflow: hidden; }
body.view #app { display: block; height: 100%; }
body.view #stage { position: absolute; inset: 0; }
body.view #side, body.view .homebtn, body.view #lobby, body.view #menu, body.view dialog, body.view #toast,
body.view #remoteJoin > :not(#remoteStatus), body.view #quitBtn { display: none !important; }
body.view #remoteJoin {
  inset: auto; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(10, 14, 22, 0.75);
  border-radius: 14px; padding: 10px 18px; max-width: calc(100% - 32px); pointer-events: none;
}
body.view #remoteJoin.hidden { display: none !important; }
body.view #remoteStatus { font-size: 16px; }
body.view #remoteStatus:empty { display: none; }

/* ---------- controller: where to play from, remote play (play.js "join mode") ---------- */
.sublink { align-self: center; color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; opacity: 0.8; touch-action: manipulation; }
.sublink:hover { color: var(--text); opacity: 1; }
#where { max-width: 420px; margin: 0 auto; padding: 26px 16px 32px; display: flex; flex-direction: column; gap: 18px; touch-action: manipulation; }
#where .logo { text-align: center; }
#where .logo img { width: 200px; }
.whereBtns { display: flex; gap: 12px; }
.whereBtns .btn { flex: 1; font-size: 26px; padding: 18px 12px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.whereArt { width: 72px; height: 60px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.alt { background: var(--panel-2); color: var(--text); border: 1px solid #2c3850; }
@media (orientation: landscape) and (max-height: 500px) {
  #where { position: fixed; inset: 0; z-index: 30; max-width: none; margin: 0; overflow-y: auto; justify-content: center; align-items: center; padding: 12px; }
  #where .logo { display: none; }
  #where .endcard { width: 100%; max-width: 520px; padding: 16px 18px; gap: 10px; }
  .whereBtns .btn { padding: 10px 12px; font-size: 22px; flex-direction: row; justify-content: center; gap: 14px; }
  .whereArt { width: 52px; height: 44px; }
}
/* Remote play: the game (an iframe of the remote screen) sits behind the transparent pad canvas */
#remoteview { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; z-index: -1; pointer-events: none; display: none; background: #0b0f17; }
#pad.remote #remoteview { display: block; }
#pad.remote #padc { background: transparent; }
#rotate {
  position: fixed; inset: 0; z-index: 25; background: rgba(11, 15, 23, 0.94); text-align: center; padding: 24px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; touch-action: manipulation;
}
#rotate.hidden { display: none; }
#rotate svg { width: 96px; height: 96px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#rotate h2 { margin: 0; font-size: 24px; }
#rotate p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.45; max-width: 320px; }
#rotate .btn { font-size: 18px; padding: 14px 22px; }

/* Remote play: the game is behind the pad, so the pad's own buttons stay out of the way
   until touched. */
#pad.remote #emotes,
#pad.remote #fsbtn,
#pad.remote #czbtn { opacity: 0.45; transition: opacity 0.15s; }
#pad.remote #emotes:active,
#pad.remote #fsbtn:active,
#pad.remote #czbtn:active,
#pad.remote #emotes:focus-within { opacity: 1; }
#pad.remote #emotes.away, #pad.remote #czbtn.away { opacity: 0; pointer-events: none; } /* both sticks held (play.js draw) */
/* Customize stays in the right margin, small, so it never covers the arena */
#pad.remote #czbtn { top: 10px; right: 8px; max-width: 21vw; font-size: 12px; padding: 6px 10px; animation: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
