/* Innercircle - mobile-first game UI. Everything sits on top of one canvas. */
:root {
  --bg: #10131c;
  --panel: #181d2b;
  --panel-2: #212839;
  --line: #2e3750;
  --text: #eef1f8;
  --dim: #93a0bd;
  --accent: #f2c744;
  --good: #4ec98a;
  --bad: #ef6a5e;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* our panels use flex/grid, which would otherwise beat the hidden attribute */
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%; height: 100dvh; overflow: hidden;
  background: var(--bg); color: var(--text);
  font: 15px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none; touch-action: none; user-select: none;
  -webkit-user-select: none;
}

/* iOS refuses to focus fields that inherit user-select:none / touch-action:none,
   and zooms the page if the font is under 16px. */
input, textarea, select {
  font: inherit;
  font-size: 16px;
  color: inherit;
  -webkit-user-select: text;
  user-select: text;
  touch-action: manipulation;
}
button { cursor: pointer; border: 0; background: none; }

#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.dim { color: var(--dim); }
.tiny { font-size: 12px; }

.primary {
  width: 100%; padding: 14px; border-radius: 12px; font-weight: 650;
  background: var(--accent); color: #241d00;
}
.primary:active { transform: translateY(1px); }
.ghost { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.round { border-radius: 999px; }

/* ---------- boot screen ---------- */
.screen {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center;
  padding: 20px; padding-top: max(20px, var(--safe-t));
  background: radial-gradient(1200px 700px at 50% -10%, #26304a, #0b0e15 70%);
  overflow: auto; touch-action: auto; -webkit-overflow-scrolling: touch;
  -webkit-user-select: auto; user-select: auto;
}
@media (max-height: 720px) {
  .screen { place-items: start center; }
}
.boot-card {
  width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 24px; box-shadow: 0 30px 80px #0009;
}
.boot-card h1 { margin: 0; font-size: 34px; letter-spacing: -0.02em; }
.boot-card h1 span { color: var(--accent); }
.boot-card .sub { margin: 6px 0 20px; color: var(--dim); }
.bar { height: 6px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
#bootMsg { margin: 10px 0 0; font-size: 13px; }
#kicked { z-index: 45; }
#kicked h1 { color: var(--bad); }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 12px; color: var(--dim); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .08em; }
#nameInput {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line);
}
.looks { display: flex; align-items: center; gap: 10px; }
.look-name { flex: 1; text-align: center; padding: 12px; background: var(--panel-2); border-radius: 12px; border: 1px solid var(--line); }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud button, #hud input, #hud form { pointer-events: auto; }

.topbar {
  position: absolute; top: calc(8px + var(--safe-t)); left: 8px; right: 8px;
  display: flex; gap: 8px; align-items: center;
}
.hud-btns { display: flex; gap: 8px; flex: 0 0 auto; }

#compass {
  position: absolute; left: 10px; top: calc(58px + var(--safe-t));
  width: 64px; height: 64px; pointer-events: none;
  background: #171c29cc; border: 1px solid var(--line); border-radius: 50%;
  backdrop-filter: blur(8px);
}
#compassRose {
  position: absolute; inset: 6px;
  border-radius: 50%;
  transform-origin: 50% 50%;
}
#compassRose span {
  position: absolute; font-size: 11px; font-weight: 800; color: var(--dim);
}
#compassRose .n { top: 0; left: 50%; transform: translateX(-50%); color: var(--accent); }
#compassRose .s { bottom: 0; left: 50%; transform: translateX(-50%); }
#compassRose .e { right: 2px; top: 50%; transform: translateY(-50%); }
#compassRose .w { left: 2px; top: 50%; transform: translateY(-50%); }
#compass::after {
  content: '';
  position: absolute; left: 50%; top: 50%; width: 8px; height: 8px;
  margin: -4px 0 0 -4px; border-radius: 50%; background: var(--accent);
}

#mapPanel {
  position: absolute;
  right: 10px;
  top: calc(58px + var(--safe-t));
  width: min(188px, 36vw);
  pointer-events: auto;
  background: #121820e6;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 28px #0007;
  backdrop-filter: blur(10px);
  overflow: hidden;
  z-index: 12;
}
#mapPanel.expanded {
  width: min(300px, 72vw);
}
.map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px 4px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--dim);
  text-transform: uppercase;
}
.map-head #mapToggle {
  width: 26px;
  height: 26px;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  background: #1c2433;
  border: 1px solid var(--line);
  color: #e8edf7;
}
#minimap {
  display: block;
  width: 100%;
  height: auto;
  cursor: pointer;
  border-radius: 0;
  box-shadow: none;
}
#mapLegend {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height .22s ease, opacity .18s ease, padding .18s ease;
  padding: 0 10px;
}
#mapPanel.expanded #mapLegend {
  max-height: 220px;
  opacity: 1;
  padding: 6px 10px 10px;
  overflow: auto;
}
.map-sec { margin-top: 6px; }
.map-sec b {
  display: block;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 4px;
}
.map-sec ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 3px;
}
.map-sec li {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 2px 8px;
  align-items: center;
  font-size: 12px;
  color: #e8edf7;
  line-height: 1.2;
}
.map-sec li em {
  grid-column: 2;
  font-style: normal;
  font-size: 10px;
  color: var(--dim);
}
.map-sec li i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.map-sec li i.road {
  border-radius: 2px;
  background: #8b93a7;
  height: 3px;
  width: 10px;
}

.pill {
  background: #171c29d9; border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 13px; backdrop-filter: blur(8px); font-size: 13px; white-space: nowrap;
}
.pill.wallet { min-width: 0; overflow: hidden; }
.pill.wallet b { color: var(--accent); }
.pill.wallet span { margin-left: 8px; font-size: 11px; }
.pill.place { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }
.pill.icon { position: relative; font-size: 16px; padding: 7px 12px; }
.spacer { flex: 1; }
.badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; padding: 0 4px;
  background: var(--accent); color: #241d00; border-radius: 99px;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}

#toasts { position: absolute; top: calc(56px + var(--safe-t)); left: 0; right: 0; display: grid; gap: 6px; justify-items: center; }
.toast {
  background: #171c29e6; border: 1px solid var(--line); border-left: 3px solid var(--accent);
  padding: 9px 14px; border-radius: 10px; font-size: 13px; max-width: 88vw;
  animation: pop .25s ease-out;
}
.toast.good { border-left-color: var(--good); }
.toast.bad { border-left-color: var(--bad); }
@keyframes pop { from { opacity: 0; transform: translateY(-8px); } }

#prompt {
  position: absolute; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%);
  background: #171c29e6; border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px 8px 8px; display: flex; align-items: center; gap: 10px; font-size: 14px;
}
#prompt b {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px;
  background: var(--accent); color: #241d00; font-size: 13px;
}

#chatLog {
  position: absolute; left: 10px; bottom: calc(190px + var(--safe-b));
  width: min(60vw, 380px); display: grid; gap: 3px; font-size: 13px;
}
#chatLog div { background: #0d1017b0; padding: 4px 9px; border-radius: 8px; width: fit-content; max-width: 100%; }
#chatLog .sys { color: var(--dim); font-style: italic; }
#chatLog b { color: var(--accent); font-weight: 600; }
#chatLog .npc b { color: #7ec8c0; }

#chatForm {
  position: absolute; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b));
  display: flex; gap: 8px;
}
#chatInput { flex: 1; padding: 12px 14px; border-radius: 12px; background: #171c29e6; border: 1px solid var(--line); }
#chatForm button { padding: 0 18px; border-radius: 12px; background: var(--accent); color: #241d00; font-weight: 600; }

/* ---------- touch controls ---------- */
#stick {
  position: absolute; left: 22px; bottom: calc(28px + var(--safe-b));
  width: 120px; height: 120px; border-radius: 50%;
  background: #ffffff10; border: 1px solid #ffffff20; pointer-events: auto;
  display: grid; place-items: center; touch-action: none; z-index: 2;
}
#stickNub { width: 52px; height: 52px; border-radius: 50%; background: #ffffff33; border: 1px solid #ffffff40; }
#btnAction {
  position: absolute; right: 26px; bottom: calc(46px + var(--safe-b));
  width: 84px; height: 84px; font-size: 15px; font-weight: 700;
  background: #f2c744e0; color: #241d00; border: 3px solid #ffffff30;
}
#btnAction:active { transform: scale(.94); }
body.no-touch #stick, body.no-touch #btnAction { display: none; }

/* ---------- bottom sheets (shop, binder, card detail) ---------- */
.sheet {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  max-height: 88vh; max-height: 88dvh; display: flex; flex-direction: column;
  background: var(--panel); border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0; box-shadow: 0 -20px 60px #0009;
  padding-bottom: var(--safe-b); animation: rise .22s ease-out;
  overflow: hidden;
  touch-action: auto; -webkit-user-select: auto; user-select: auto;
}
@keyframes rise { from { transform: translateY(100%); } }
@media (min-width: 860px) {
  .sheet { left: auto; right: 16px; bottom: 16px; top: 16px; width: 440px; border-radius: 18px; max-height: none; }
  #detail { right: 476px; width: 380px; }
}
@media (max-width: 859px) { #detail { z-index: 31; } }

.sheet header { display: flex; align-items: flex-start; gap: 10px; padding: 16px 16px 10px; }
.sheet header h2 { margin: 0; font-size: 19px; }
.sheet header p { margin: 2px 0 0; }
.sheet header button {
  margin-left: auto; width: 34px; height: 34px;
  display: grid; place-items: center;
  color: var(--text); font-size: 18px; font-weight: 700; line-height: 1;
  background: #2a3348; border: 1px solid #5a6788;
}
.sheet header button:hover,
.sheet header button:focus-visible { background: #36425c; border-color: var(--accent); color: #fff; }

#panelTabs { display: flex; gap: 6px; padding: 0 16px 10px; }
#panelTabs button {
  padding: 7px 13px; border-radius: 999px; font-size: 13px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--dim);
}
#panelTabs button.on { background: var(--accent); color: #241d00; border-color: transparent; font-weight: 600; }

#panelTools { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 10px; }
#panelTools .tools-row { display: flex; gap: 8px; min-width: 0; }
#panelTools .tools-row[hidden] { display: none; }
#panelTools input, #panelTools select {
  padding: 10px 12px; border-radius: 10px; background: var(--panel-2);
  border: 1px solid var(--line); min-width: 0;
}
#panelTools input { flex: 1; }
#panelTools select { flex: 0 0 auto; max-width: 42%; }
#binderGames button, #binderCats button {
  flex: 1; padding: 7px 13px; border-radius: 999px; font-size: 13px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--dim);
}
#binderGames button.on, #binderCats button.on {
  background: var(--accent); color: #241d00; border-color: transparent; font-weight: 600;
}

#panelBody, #detail {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
}
#panelBody { padding: 0 16px 16px; }

/* ---------- card rows ---------- */
.row {
  display: flex; gap: 13px; align-items: center; padding: 11px;
  border-radius: 12px; background: var(--panel-2); margin-bottom: 10px; cursor: pointer;
}
.row:active { background: #29314699; }
.thumb {
  width: 50px; height: 70px; flex: 0 0 50px; border-radius: 6px; object-fit: cover;
  background: linear-gradient(160deg, #2b3450, #1a2033); border: 1px solid var(--line);
}
.row .meta { flex: 1; min-width: 0; }
.row .nm { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub2 { font-size: 14px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .price { text-align: right; flex: 0 0 auto; }
.row .price b { display: block; font-size: 17px; }
.chg { font-size: 14px; font-weight: 600; }
.chg.up { color: var(--good); } .chg.down { color: var(--bad); } .chg.flat { color: var(--dim); }

.cond {
  display: inline-block; padding: 1px 6px; border-radius: 5px; font-size: 10.5px;
  font-weight: 700; background: #ffffff14; color: var(--dim); margin-right: 5px;
}
.cond.NM { background: #4ec98a26; color: #7fdcae; }
.cond.EX { background: #f2c74426; color: #f0d178; }
.cond.GD, .cond.LP, .cond.PL { background: #ef6a5e22; color: #f3968c; }

.empty { text-align: center; color: var(--dim); padding: 34px 10px; font-size: 14px; }

/* ---------- card detail ---------- */
#detail .d-wrap { padding: 0 16px 18px; }
#detail .hero { display: flex; gap: 14px; padding: 4px 16px 14px; }
#detail .hero img {
  width: 116px; height: 162px; flex: 0 0 116px; border-radius: 8px; object-fit: cover;
  background: linear-gradient(160deg, #2b3450, #1a2033); border: 1px solid var(--line);
}
#detail h3 { margin: 0 0 4px; font-size: 17px; line-height: 1.25; }
#detail .big { font-size: 26px; font-weight: 700; color: var(--accent); margin: 8px 0 2px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin: 4px 0 14px; }
.stats div { background: var(--panel-2); border-radius: 10px; padding: 8px; text-align: center; }
.stats span { display: block; font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }
.stats b { font-size: 13.5px; }

.chart { width: 100%; height: 110px; display: block; background: var(--panel-2); border-radius: 12px; margin-bottom: 6px; }
.chart-note { font-size: 11px; color: var(--dim); margin: 0 0 14px; }

.trade { display: grid; gap: 9px; }
.trade .line { display: flex; align-items: center; gap: 9px; }
.trade .line > span { flex: 1; font-size: 13px; color: var(--dim); }
.qty { display: flex; align-items: center; gap: 0; background: var(--panel-2); border-radius: 10px; border: 1px solid var(--line); }
.qty button { width: 34px; height: 36px; font-size: 17px; color: var(--dim); }
.qty b { min-width: 26px; text-align: center; font-size: 14px; }
.act {
  padding: 11px 16px; border-radius: 11px; font-weight: 650; font-size: 14px;
  background: var(--accent); color: #241d00; min-width: 128px;
}
.act.sell { background: var(--good); color: #06291a; }
.act[disabled] { background: var(--panel-2); color: var(--dim); }
.cond-pick { display: flex; gap: 5px; flex-wrap: wrap; }
.cond-pick button { padding: 6px 10px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; color: var(--dim); }
.cond-pick button.on { border-color: var(--accent); color: var(--text); }

.link { display: inline-block; margin-top: 12px; font-size: 12.5px; color: var(--dim); text-decoration: underline; }

/* Player name tags drawn over the 3D scene. */
.tag {
  position: absolute; transform: translate(-50%, -100%); z-index: 5;
  background: #0d1017c0; padding: 2px 8px; border-radius: 99px;
  font-size: 12px; white-space: nowrap; pointer-events: none;
}
#tags { position: fixed; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }

/* ---------- auth form ---------- */
.seg { display: flex; gap: 6px; background: var(--panel-2); padding: 4px; border-radius: 12px; margin-bottom: 18px; }
.seg button { flex: 1; padding: 9px; border-radius: 9px; font-size: 14px; color: var(--dim); }
.seg button.on { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 4px #0006; }
.field input[type="password"], .field input[type="text"], #authName {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line);
}
.err { background: #ef6a5e1f; border: 1px solid #ef6a5e44; color: #f3968c;
       padding: 9px 12px; border-radius: 10px; font-size: 13px; margin: 0 0 14px; }

/* ---------- emotes ---------- */
#emotes {
  position: absolute; right: 26px; bottom: calc(140px + var(--safe-b));
  display: grid; gap: 6px;
}
#emotes button {
  width: 46px; height: 46px; border-radius: 50%; font-size: 20px;
  background: #171c29e0; border: 1px solid var(--line); pointer-events: auto;
}
#btnEmote {
  position: absolute; right: 34px; bottom: calc(142px + var(--safe-b));
  width: 52px; height: 52px; font-size: 20px;
  background: #171c29d9; border: 1px solid var(--line);
}

/* ---------- grading, market, mail rows ---------- */
.note { background: var(--panel-2); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; font-size: 13px; }
.note b { color: var(--accent); }
.slab {
  display: inline-block; padding: 2px 7px; border-radius: 5px; font-size: 10.5px; font-weight: 800;
  background: linear-gradient(135deg, #6a5cf3, #b06ef3); color: #fff; margin-right: 5px;
  letter-spacing: .03em;
}
.slab.hi { background: linear-gradient(135deg, #f2b33c, #f2704a); color: #241d00; }

.timer { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600; }

.msg { background: var(--panel-2); border-radius: 12px; padding: 11px 13px; margin-bottom: 8px; }
.msg.unread { border-left: 3px solid var(--accent); }
.msg.sent { opacity: .68; }
.msg .who { font-size: 12px; color: var(--accent); font-weight: 600; margin-bottom: 3px; }
.msg .when { font-size: 11px; color: var(--dim); float: right; font-weight: 400; }
.msg p { margin: 0; font-size: 13.5px; word-break: break-word; }

.compose { display: grid; gap: 8px; margin-bottom: 14px; }
.compose input, .compose textarea, .compose select {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line); resize: vertical;
}
.compose textarea { min-height: 64px; font-family: inherit; }

.lb { display: flex; align-items: center; gap: 10px; padding: 9px 12px;
      background: var(--panel-2); border-radius: 11px; margin-bottom: 7px; }
.lb .rank { width: 24px; font-weight: 700; color: var(--dim); text-align: right; }
.lb .who { flex: 1; font-size: 13.5px; }
.lb .dot { width: 7px; height: 7px; border-radius: 50%; background: #46506b; }
.lb .dot.on { background: var(--good); }
.tinybtn { padding: 5px 10px; font-size: 12px; border-radius: 8px; white-space: nowrap; }

/* ---------- trade window ---------- */
#trade { z-index: 32; }
@media (min-width: 860px) { #trade { right: 16px; width: 440px; } }
.tradeside { background: var(--panel-2); border-radius: 12px; padding: 11px; margin-bottom: 10px; }
.tradeside h4 { margin: 0 0 8px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.tradeside h4 .lock { font-size: 11px; padding: 2px 7px; border-radius: 99px; background: #ffffff14; color: var(--dim); }
.tradeside h4 .lock.on { background: #4ec98a26; color: #7fdcae; }
.tradeside .mini { display: flex; gap: 6px; flex-wrap: wrap; }
.tradeside .mini span { font-size: 11.5px; background: #ffffff10; padding: 3px 7px; border-radius: 6px; }
.tradeside .cash { color: var(--accent); font-weight: 600; font-size: 13px; margin-top: 7px; }

.pulls { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 10px 0 4px; }
.pulls figure { margin: 0; text-align: center; }
.pulls img { width: 100%; aspect-ratio: 63/88; object-fit: cover; border-radius: 5px;
             background: linear-gradient(160deg, #2b3450, #1a2033); border: 1px solid var(--line); }
.pulls figcaption { font-size: 10px; color: var(--dim); margin-top: 3px; }
.pulls .t-SR figcaption, .pulls .t-UR figcaption, .pulls .t-CH figcaption { color: var(--accent); font-weight: 700; }

/* ---------- grading odds bars ---------- */
.odds { display: flex; align-items: flex-end; gap: 4px; height: 46px; margin: 4px 0 2px; }
.odds > div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; justify-content: flex-end; }
.odds i { display: block; width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; }
.odds span { font-size: 9.5px; color: var(--dim); }

.priceIn { width: 96px; padding: 9px 10px; border-radius: 10px;
           background: var(--panel-2); border: 1px solid var(--line); text-align: right; }

.dotmark { display: inline-block; width: 7px; height: 7px; border-radius: 50%;
           background: var(--good); vertical-align: middle; margin-left: 5px; }

#panelTabs { overflow-x: auto; scrollbar-width: none; }
#panelTabs::-webkit-scrollbar { display: none; }
#panelTabs button { flex: 0 0 auto; }

#btnTrade {
  position: absolute; right: 122px; bottom: calc(64px + var(--safe-b));
  width: 56px; height: 56px; font-size: 22px;
  background: #4ec98ae6; border: 3px solid #ffffff30; color: #06291a;
}
#btnTrade:active { transform: scale(.94); }

/* Keep the top-bar buttons clear of the docked side panels on wide screens. */
@media (min-width: 860px) {
  body.sheet-open .topbar { right: 472px; }
  body.sheet-open #btnAction, body.sheet-open #btnEmote,
  body.sheet-open #btnTrade, body.sheet-open #emotes { right: auto; left: 50%; }
  body.sheet-open #btnAction { margin-left: -42px; }
  body.sheet-open #btnEmote { margin-left: 60px; }
  body.sheet-open #btnTrade { margin-left: -160px; }
}
.topbar { transition: right .2s; }

/* The sheet is a flex column: only the list should stretch, everything else
   keeps its natural height instead of being squashed under it. */
.sheet header, #panelTabs, #panelTools { flex: 0 0 auto; }
#panelBody { flex: 1 1 auto; min-height: 0; }
#panelTabs { align-items: center; min-height: 44px; }

/* ---------- phone HUD ---------- */
body.touch {
  font-size: 19px;
}
body.touch .pill {
  font-size: 18px; padding: 12px 17px;
}
body.touch .pill.wallet b { font-size: 22px; }
body.touch .pill.wallet span { display: none; }
body.touch .pill.place { font-size: 17px; max-width: 41vw; }
body.touch .pill.icon {
  width: clamp(48px, 14.4vw, 55px); height: clamp(48px, 14.4vw, 55px); padding: 0;
  display: grid; place-items: center; font-size: clamp(23px, 7vw, 26px);
}
body.touch .badge { font-size: 14px; min-width: 24px; line-height: 24px; }
body.touch #compass {
  width: clamp(62px, 19vw, 79px); height: clamp(62px, 19vw, 79px);
  top: calc(77px + var(--safe-t));
}
body.touch #compassRose span { font-size: 16px; }
body.touch #mapPanel {
  top: calc(77px + var(--safe-t));
  width: min(222px, 53vw);
}
body.touch #mapPanel.expanded {
  width: min(396px, 96vw);
}
body.touch .map-head { font-size: 13px; padding: 8px 10px 5px 14px; }
body.touch .map-head #mapToggle { width: 31px; height: 31px; font-size: 19px; }
body.touch .map-sec li { font-size: 14px; }
body.touch .map-sec li em { font-size: 12px; }
body.touch #toasts { top: calc(178px + var(--safe-t)); }
body.touch .toast { font-size: 18px; padding: 14px 19px; }
body.touch #chatLog {
  /* Above the left stick, not under the map. */
  top: auto;
  bottom: calc(clamp(125px, 36vw, 163px) + 31px + var(--safe-b));
  left: 14px;
  right: auto;
  width: min(67vw, 312px);
  font-size: 17px;
  max-height: 26vh;
  overflow: hidden;
}
body.touch #chatLog div { padding: 5px 11px; }
body.touch.chat-open #chatLog {
  bottom: calc(278px + var(--safe-b));
}
/* Expanded, the map takes most of the width and there is no room left for chat. */
#mapPanel.expanded ~ #chatLog { display: none; }
body.touch #prompt {
  bottom: calc(226px + var(--safe-b));
  font-size: 19px;
  padding: 12px 22px 12px 12px;
  max-width: 86vw;
}
body.touch #prompt b { width: 41px; height: 41px; font-size: 14px; }
body.touch #stick {
  width: clamp(125px, 36vw, 163px); height: clamp(125px, 36vw, 163px);
  left: 19px;
  bottom: calc(22px + var(--safe-b));
}
/* Proportional, so it tracks the stick at every size - and controls.js derives
   STICK_R from stick.clientWidth * 0.43, so the nub and the input radius agree. */
body.touch #stickNub { width: 43%; height: 43%; }
body.touch #btnAction {
  width: clamp(82px, 24vw, 106px); height: clamp(82px, 24vw, 106px);
  font-size: clamp(17px, 5vw, 20px);
  right: 22px;
  bottom: calc(34px + var(--safe-b));
}
body.touch #btnEmote {
  width: clamp(53px, 15vw, 65px); height: clamp(53px, 15vw, 65px);
  font-size: clamp(24px, 7.2vw, 29px);
  right: 34px;
  /* Rides above #btnAction, so its offset shrinks with that button. */
  bottom: calc(clamp(125px, 35vw, 151px) + var(--safe-b));
}
body.touch #emotes {
  right: 24px;
  bottom: calc(clamp(187px, 53vw, 228px) + var(--safe-b));
}
body.touch #emotes button {
  width: clamp(53px, 15vw, 60px); height: clamp(53px, 15vw, 60px);
  font-size: clamp(24px, 7.2vw, 29px);
}
body.touch #btnTrade {
  width: clamp(58px, 17vw, 72px); height: clamp(58px, 17vw, 72px);
  font-size: clamp(25px, 7.8vw, 31px);
  right: 151px;
  bottom: calc(50px + var(--safe-b));
}
body.touch #chatForm {
  left: 14px; right: 14px;
  bottom: calc(214px + var(--safe-b));
}
body.touch #chatInput { padding: 14px 17px; }
body.touch #chatForm button { padding: 0 22px; }
body.touch.chat-open #stick { opacity: 0.35; }
body.touch .sheet header h2 { font-size: 26px; }
body.touch .sheet header button { width: 53px; height: 53px; font-size: 22px; }
body.touch #panelTabs button {
  padding: 13px 19px; font-size: 18px; min-height: 53px;
}
body.touch #panelBody { padding: 0 19px 22px; }
body.touch #binderGames button,
body.touch #binderCats button { padding: 10px 16px; font-size: 16px; }
body.touch .row { padding: 20px; margin-bottom: 12px; gap: 16px; }
body.touch .row .nm { font-size: 26px; }
body.touch .row .sub2 { font-size: 17px; }
body.touch .row .price b { font-size: 20px; }
body.touch .chg { font-size: 17px; }
body.touch .cond { font-size: 16px; padding: 2px 8px; }
body.touch .thumb { width: 84px; height: 114px; flex: 0 0 84px; flex-basis: 84px; }
body.touch .empty { font-size: 17px; padding: 41px 12px; }
body.touch .act { padding: 17px 22px; font-size: 19px; min-height: 58px; }
body.touch .tag { font-size: 17px; padding: 5px 12px; }
body.touch #bootHint { font-size: 17px; }
body.touch .boot-card h1 { font-size: 48px; }
body.no-touch #compass { top: calc(52px + var(--safe-t)); }

/* ---------- convention hall floor plan ---------- */
#hallGate { z-index: 42; }
.hall-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; font-size: 11px; color: var(--dim); }
.hall-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.hall-plan { position: relative; }
.hall-plan-n {
  display: block; text-align: center; font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--dim); margin-bottom: 4px;
}
.hall-plan-room {
  position: relative;
  aspect-ratio: 31 / 27;
  background:
    radial-gradient(120% 80% at 50% 100%, #3a2a22 0%, transparent 42%),
    #243044;
  border: 7px solid #4a556e;
  border-bottom-color: #4a556e;
  box-shadow: inset 0 0 0 2px #1a2233;
  overflow: hidden;
}
.hall-plan-aisle {
  position: absolute; left: 50%; top: 8%; bottom: 14%;
  width: 11%; transform: translateX(-50%);
  background: #6e3a38;
  opacity: .55;
  pointer-events: none;
}
.hall-plan-door {
  position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 55%);
  width: 22%; padding: 3px 0 2px;
  text-align: center; font-size: 9px; letter-spacing: .14em; text-transform: uppercase;
  color: #e8d8b0; background: var(--panel); border: 2px solid #4a556e;
  z-index: 2;
}
.hall-plan-spot {
  position: absolute; width: 15.2%; height: 13.5%;
  transform: translate(-50%, -50%);
  border: 1px solid #1a2233; color: #241d00; font-weight: 700;
  font-size: 10px; line-height: 1.15; text-align: center;
  background: var(--spot); padding: 3px 2px 2px; z-index: 1;
}
.hall-plan-spot small { display: block; font-weight: 500; font-size: 8px; opacity: .85; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hall-plan-spot.taken { filter: saturate(.35) brightness(.85); color: var(--text); }
.hall-plan-spot.mine { outline: 2px solid var(--accent); outline-offset: 1px; filter: none; }
.hall-plan-spot:disabled { cursor: default; }
