/* ================= RAT RACE — interface =================
   Dark charcoal panels floating over a bright cream world. Candle green is
   "go / money in", cheese gold is currency and highlights, red is loss. */
:root {
  --ink: #0E1014;
  --panel: #15171C;
  --panel2: #1D2026;
  --panel3: #262A32;
  --line: #2F343D;
  --text: #F4EFE6;
  --muted: #9AA1AC;
  --green: #3DF58A;
  --green-d: #1FB865;
  --cheese: #FFC83D;
  --cheese-d: #E09A12;
  --red: #FF5A5F;
  --cyan: #5CE1E6;
  --pink: #FF9FB2;
  --purple: #A98BFF;
  --pix: 'Silkscreen', 'Courier New', monospace;
  --ui: 'Space Grotesk', system-ui, sans-serif;
  --num: 'JetBrains Mono', ui-monospace, monospace;
  --r: 10px;
  --dock-h: 74px;
  --panel-w: 400px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: #121418; color: var(--text); font-family: var(--ui); overflow: hidden;
  -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--cheese); outline-offset: 2px; }
#app { position: fixed; inset: 0; }
#world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---------------- chunky button family ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 14px; border-radius: 8px; border: 2px solid var(--ink);
  font-family: var(--num); font-weight: 800; font-size: 12px; letter-spacing: .04em;
  background: var(--panel3); color: var(--text);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.08), 0 3px 0 var(--ink);
  transition: transform .06s, filter .12s; white-space: nowrap; }
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 2px 0 rgba(255,255,255,.08), 0 1px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.go { background: var(--green); color: #07130C; box-shadow: inset 0 2px 0 rgba(255,255,255,.45), 0 3px 0 #0B5E31; }
.btn.gold { background: var(--cheese); color: #2A1B05; box-shadow: inset 0 2px 0 rgba(255,255,255,.45), 0 3px 0 #8A5B08; }
.btn.bad { background: var(--red); color: #fff; box-shadow: inset 0 2px 0 rgba(255,255,255,.3), 0 3px 0 #7A1F22; }
.btn.cyan { background: var(--cyan); color: #06282A; box-shadow: inset 0 2px 0 rgba(255,255,255,.4), 0 3px 0 #1D7A7E; }
.btn.ghosty { background: transparent; border-color: var(--line); box-shadow: none; color: var(--muted); }
.btn.wide { width: 100%; }
.btn.sm { padding: 6px 9px; font-size: 11px; }

/* ---------------- HUD ---------------- */
#hud { position: absolute; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 12px 8px; pointer-events: none; }
#hud > * { pointer-events: auto; }
.avatar { position: relative; width: 56px; height: 56px; flex: none; border-radius: 14px;
  background: linear-gradient(180deg, #2A2E36, #17191E); border: 2px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,.08); overflow: visible; }
.avatar canvas { width: 56px; height: 56px; display: block; border-radius: 12px; }
.avatar .lvl { position: absolute; right: -8px; bottom: -8px; min-width: 26px; height: 26px; padding: 0 6px;
  border-radius: 13px; display: grid; place-items: center; background: var(--cheese); color: #2A1B05;
  border: 2px solid var(--ink); font-family: var(--num); font-weight: 800; font-size: 12px; }
.avatar .dot { position: absolute; left: -5px; top: -5px; width: 14px; height: 14px; border-radius: 50%; background: var(--red); border: 2px solid var(--ink); display: none; }
.avatar .dot.on { display: block; animation: pulse 1.6s infinite; }
.stats { flex: 1; min-width: 0; max-width: 520px; display: flex; flex-direction: column; gap: 6px; }
.xpbar { position: relative; height: 16px; border-radius: 8px; background: var(--panel); border: 2px solid var(--ink); overflow: hidden; }
.xpbar i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #7A5CFF, #B08BFF); transition: width .4s; }
.xpbar span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--num); font-size: 10px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000; }
.pills { display: flex; gap: 6px; flex-wrap: nowrap; }
.pill { display: flex; align-items: center; gap: 5px; padding: 4px 10px 4px 7px; border-radius: 999px;
  background: var(--panel); border: 2px solid var(--ink); box-shadow: 0 2px 0 var(--ink); min-width: 0; }
.pill.rc { cursor: pointer; }
.pill .ico { font-size: 13px; line-height: 1; }
.pill b { font-family: var(--num); font-size: 13px; font-weight: 800; white-space: nowrap; }
.pill.cash b { color: var(--green); }
.pill.rc b, .pill.rc .ico { color: var(--cyan); }
.pill.rate b { color: var(--cheese); font-size: 11px; }
.hud-right { margin-left: auto; display: flex; gap: 6px; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; background: var(--panel); border: 2px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink); font-size: 17px; display: grid; place-items: center; }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.bump { animation: bump .35s; }
@keyframes bump { 40% { transform: scale(1.15); } }

/* ---------------- dock ---------------- */
.dock { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(10px, env(safe-area-inset-bottom)); z-index: 20;
  display: flex; gap: 8px; padding: 8px; border-radius: 18px; background: rgba(21,23,28,.92);
  border: 2px solid var(--ink); box-shadow: 0 6px 24px rgba(0,0,0,.35); backdrop-filter: blur(8px); }
.dock button { position: relative; width: 62px; height: 56px; border-radius: 12px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; background: var(--panel3); border: 2px solid var(--ink);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.06), 0 3px 0 var(--ink); transition: transform .06s; }
.dock button .ic { font-size: 20px; line-height: 1; }
.dock button .lb { font-family: var(--pix); font-size: 10px; color: var(--muted); }
.dock button:active { transform: translateY(2px); }
.dock button.on { background: var(--cheese); }
.dock button.on .lb { color: #2A1B05; }
/* with a panel open, sit in the space left of it and shrink to fit */
body.panel-open .dock { left: calc((100% - var(--panel-w)) / 2); max-width: calc(100% - var(--panel-w) - 16px); gap: 5px; padding: 6px; }
body.panel-open .dock button { flex: 0 1 62px; min-width: 0; }
.dock .arrange { background: var(--panel2); }
.dock .arrange.on { background: var(--cyan); }
.dock .arrange.on .lb { color: #06282A; }
.badge { position: absolute; top: -8px; right: -8px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  display: grid; place-items: center; background: var(--red); color: #fff; border: 2px solid var(--ink);
  font-family: var(--num); font-size: 10px; font-weight: 800; animation: pulse 1.8s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.hilite { animation: hilite 1.2s infinite !important; z-index: 3; }
@keyframes hilite { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,200,61,.9), 0 3px 0 var(--ink); } 50% { box-shadow: 0 0 0 7px rgba(255,200,61,0), 0 3px 0 var(--ink); } }

/* ---------------- view controls ---------------- */
.viewctl { position: absolute; right: 12px; bottom: calc(var(--dock-h) + 30px); z-index: 14; display: flex; flex-direction: column; gap: 5px; }
.viewctl button { width: 36px; height: 34px; border-radius: 9px; background: rgba(21,23,28,.86); border: 2px solid var(--ink);
  font-family: var(--num); font-weight: 800; font-size: 16px; }
body.panel-open .viewctl { right: calc(var(--panel-w) + 12px); }

/* ---------------- panel ---------------- */
.panel { position: absolute; top: 0; right: 0; bottom: 0; width: var(--panel-w); z-index: 30; display: flex; flex-direction: column;
  background: var(--panel); border-left: 2px solid var(--ink); box-shadow: -10px 0 40px rgba(0,0,0,.35);
  transform: translateX(105%); transition: transform .26s cubic-bezier(.3,1,.5,1); }
body.panel-open .panel { transform: none; }
.phead { display: flex; align-items: center; gap: 10px; padding: max(14px, env(safe-area-inset-top)) 14px 12px; background: var(--panel2); border-bottom: 2px solid var(--ink); }
#ptitle { font-family: var(--pix); font-size: 18px; letter-spacing: .02em; }
.xbtn { margin-left: auto; width: 36px; height: 36px; border-radius: 9px; background: var(--panel3); border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); font-weight: 800; }
.psub { display: flex; gap: 6px; padding: 8px 12px; border-bottom: 2px solid var(--ink); background: var(--panel2); overflow-x: auto; scrollbar-width: none; }
.psub:empty { display: none; }
/* four or more tabs (SHOP: room / style / garage / garden) share the row equally */
.psub.many { gap: 5px; padding: 8px 10px; }
.psub.many button { flex: 1 1 0; min-width: 0; padding: 6px 4px; font-size: 11px; white-space: nowrap; overflow: visible; }
.psub button { position: relative; flex: none; padding: 7px 12px; border-radius: 8px; font-family: var(--pix); font-size: 12px; color: var(--muted);
  background: var(--panel3); border: 2px solid var(--ink); }
.psub button.on { background: var(--text); color: var(--ink); }
.psub button.lock { opacity: .5; }
.psub .badge { top: -7px; right: -7px; min-width: 16px; height: 16px; font-size: 9px; }

/* small tick toggle in a shop category's header (UNLOCKED ONLY) */
.chk { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 5px 8px; border-radius: 8px;
  font-family: var(--pix); font-size: 10px; color: var(--muted); background: var(--panel3); border: 2px solid var(--ink); cursor: pointer; }
.chk i { width: 12px; height: 12px; border-radius: 3px; border: 2px solid var(--muted); display: inline-grid; place-items: center;
  font-style: normal; font-size: 9px; line-height: 1; }
.chk.on { color: var(--text); }
.chk.on i { background: var(--green); border-color: var(--green); color: var(--ink); }
.chk.on i::after { content: '✓'; font-weight: 700; }
.pbody { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* cards */
.card { background: var(--panel2); border: 2px solid var(--ink); border-radius: var(--r); padding: 12px; box-shadow: 0 3px 0 var(--ink); }
.card.flat { box-shadow: none; }
.card.green { border-color: var(--green-d); background: linear-gradient(180deg, #16301F, #122219); }
.card.red { border-color: #8A2E31; background: linear-gradient(180deg, #34181A, #221213); }
.card.gold { border-color: var(--cheese-d); }
.card h3 { font-family: var(--pix); font-size: 14px; font-weight: 400; margin-bottom: 6px; }
.sec { font-family: var(--pix); font-size: 11px; color: var(--muted); letter-spacing: .04em; margin: 6px 2px -2px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-family: var(--num); font-weight: 800; }
.g { color: var(--green); } .r { color: var(--red); } .y { color: var(--cheese); } .c { color: var(--cyan); }
.tag { display: inline-block; padding: 2px 7px; border-radius: 6px; font-family: var(--num); font-size: 10px; font-weight: 800; border: 2px solid var(--ink); }
.prog { height: 10px; border-radius: 5px; background: var(--ink); overflow: hidden; border: 1px solid var(--line); }
.prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--cheese-d), var(--cheese)); transition: width .25s linear; }
.prog.g i { background: linear-gradient(90deg, var(--green-d), var(--green)); }
.note { font-size: 12px; line-height: 1.5; color: var(--muted); }
.note b { color: var(--text); }

/* trade */
/* trade modes: DAY TRADE · LONG · ALPHA side by side */
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mode { position: relative; min-width: 0; padding: 9px 8px; border-radius: 10px; border: 2px solid var(--ink); background: var(--panel3); text-align: left; box-shadow: 0 3px 0 var(--ink); }
.mode b { display: block; font-family: var(--pix); font-size: 11px; line-height: 1.25; }
.mode small { font-family: var(--num); font-size: 11px; color: var(--muted); }
.mode.on { background: var(--text); color: var(--ink); }
.mode.on small { color: #555; }
.mode:disabled { opacity: .45; }
.coinrow { display: flex; align-items: center; gap: 10px; }
.coinico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-family: var(--pix); font-size: 11px; color: #fff; border: 2px solid var(--ink); flex: none; }
.spark { flex: 1; min-width: 60px; height: 30px; }
.risks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.risk { padding: 10px 4px; border-radius: 10px; border: 2px solid var(--ink); background: var(--panel3); text-align: center; box-shadow: 0 3px 0 var(--ink); }
.risk b { display: block; font-family: var(--pix); font-size: 12px; }
.risk .odds { font-family: var(--num); font-size: 18px; font-weight: 800; margin: 2px 0; }
.risk small { font-family: var(--num); font-size: 11px; color: var(--green); }

/* shop grid */
.cats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cat { position: relative; aspect-ratio: 1; border-radius: 12px; border: 2px solid var(--ink); background: var(--panel3);
  box-shadow: 0 3px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,.05); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.cat .ic { font-size: 26px; }
.cat .lb { font-family: var(--pix); font-size: 11px; }
.cat .ct { font-family: var(--num); font-size: 10px; color: var(--muted); }
.cat:active { transform: translateY(2px); }
.cat.wide { grid-column: 1 / -1; aspect-ratio: auto; flex-direction: row; padding: 12px; gap: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.item { position: relative; display: flex; flex-direction: column; border-radius: 12px; border: 2px solid var(--ink); background: var(--panel2);
  box-shadow: 0 3px 0 var(--ink); overflow: hidden; text-align: left; }
.item .thumb { height: 104px; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 70%, #EFE9DF, #D8D0C2 75%); border-bottom: 2px solid var(--ink); }
.item .thumb img { max-width: 92%; max-height: 96px; image-rendering: auto; }
.item .meta { padding: 8px 9px 9px; display: flex; flex-direction: column; gap: 6px; }
.item .nm { font-weight: 700; font-size: 13px; line-height: 1.15; min-height: 2.3em; }
.item .btn { width: 100%; }
.item.locked .thumb img { filter: grayscale(1) brightness(.55); }
.item .corner { position: absolute; top: 6px; left: 6px; }
.item .new { position: absolute; top: 6px; right: 6px; background: var(--red); color: #fff; }
.item .own { background: var(--green); color: #07130C; }

/* list rows */
.lrow { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; border: 2px solid var(--ink); background: var(--panel2); }
.lrow .ic { width: 42px; height: 42px; border-radius: 10px; background: var(--panel3); display: grid; place-items: center; font-size: 20px; flex: none; border: 2px solid var(--ink); }
.lrow .ic img { max-width: 38px; max-height: 38px; }
.lrow .tx { flex: 1; min-width: 0; }
.lrow .tx b { display: block; font-size: 13px; }
.lrow .tx small { font-family: var(--num); font-size: 11px; color: var(--muted); }

/* rat preview */
.ratstage { height: 190px; border-radius: 12px; border: 2px solid var(--ink); background: radial-gradient(ellipse at 50% 80%, #EFE9DF, #D0C7B8 80%); display: grid; place-items: center; }
.ratstage canvas { height: 176px; }
.swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.colors { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; margin-top: 8px; }
.sw { aspect-ratio: 1; border-radius: 7px; border: 2px solid var(--ink); box-shadow: inset 0 2px 0 rgba(255,255,255,.25); }
.sw.on { outline: 3px solid var(--text); outline-offset: 1px; }
.namein { flex: 1; min-width: 0; padding: 9px 11px; border-radius: 8px; border: 2px solid var(--ink); background: var(--panel3);
  color: var(--text); font-family: var(--num); font-weight: 700; font-size: 14px; user-select: text; -webkit-user-select: text; }
.namein:focus { outline: 2px solid var(--cheese); }
label.row { cursor: pointer; }
label.row input { width: 16px; height: 16px; accent-color: var(--green); }

/* stats table */
.stat { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: 13px; }
.stat span:nth-child(2), .stat span:nth-child(3) { font-family: var(--num); font-weight: 700; text-align: right; }

/* ---------------- alpha call card ----------------
   A compact ticket parked top-left under the HUD, out of the room's way.
   --c is the group's colour; --t (0-1) is the time left, drawn as a ring
   round the caller's icon. */
.callcard { position: absolute; top: 80px; left: 12px; width: 236px; z-index: 18; display: none;
  background: var(--panel); border: 2px solid var(--ink); border-left: 4px solid var(--c, var(--cheese)); border-radius: 14px;
  padding: 10px 10px 10px 9px; box-shadow: 0 8px 22px rgba(0,0,0,.4); }
.callcard.on { display: block; animation: ccin .35s cubic-bezier(.3,1.4,.6,1); }
@keyframes ccin { from { opacity: 0; transform: translateX(-24px); } }
.cc-top { display: flex; align-items: center; gap: 9px; }
.cc-ring { --t: 1; flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--c, var(--cheese)) calc(var(--t) * 360deg), var(--panel3) 0); }
.cc-ring > i { width: 30px; height: 30px; border-radius: 50%; background: var(--panel2); display: grid; place-items: center; font-style: normal; font-size: 16px; }
.cc-tt { flex: 1; min-width: 0; line-height: 1.15; }
.cc-tt b { display: block; font-family: var(--pix); font-size: 11px; font-weight: 400; color: var(--c, var(--cheese)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-tt small { font-family: var(--num); font-size: 11px; color: var(--muted); }
.cc-x { flex: none; align-self: flex-start; width: 22px; height: 22px; border-radius: 6px; color: var(--muted); font-size: 12px; line-height: 1; background: var(--panel3); border: 2px solid var(--ink); }
.cc-x:hover { color: var(--text); }
.cc-line { margin: 8px 0 6px; font-size: 12px; font-style: italic; line-height: 1.35; color: #C9CED6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-odds { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.cc-odds b { font-family: var(--num); font-size: 15px; }
.cc-odds span:last-child b { font-size: 12px; color: var(--text); }
.callcard .btn { width: 100%; }

/* ---------------- game master ---------------- */
.gm { position: absolute; left: 12px; bottom: calc(var(--dock-h) + 26px); z-index: 19; display: flex; align-items: flex-end; gap: 6px;
  max-width: min(420px, calc(100% - 70px)); transform: translateY(20px); opacity: 0; pointer-events: none; transition: transform .35s cubic-bezier(.3,1.5,.6,1), opacity .2s; flex-direction: row-reverse; }
.gm.in { transform: none; opacity: 1; pointer-events: auto; cursor: pointer; }
.gm img { width: 70px; height: 70px; flex: none; image-rendering: auto; filter: drop-shadow(0 4px 6px rgba(0,0,0,.4)); }
.gm .bubble { position: relative; background: var(--text); color: #16181C; border: 2px solid var(--ink); border-radius: 14px; padding: 10px 12px 8px; box-shadow: 0 4px 0 var(--ink); }
.gm .bubble b { display: block; font-family: var(--pix); font-size: 11px; color: #6A6F78; margin-bottom: 3px; font-weight: 400; }
.gm .bubble p { font-size: 14px; font-weight: 600; line-height: 1.35; }
.gm .bubble small { display: block; margin-top: 4px; font-family: var(--num); font-size: 10px; color: #8A8F98; text-align: right; }
.gm.talk img { animation: talk .3s infinite; }
@keyframes talk { 50% { transform: translateY(-3px) rotate(2deg); } }
.gm .bubble::after { content: ''; position: absolute; left: -10px; bottom: 16px; border: 8px solid transparent; border-right-color: var(--ink); border-left: 0; }

/* ---------------- arrange / place bar ---------------- */
.editbar { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--dock-h) + 26px); z-index: 22; display: none; align-items: center; gap: 8px;
  padding: 8px; border-radius: 14px; background: var(--panel); border: 2px solid var(--ink); box-shadow: 0 8px 24px rgba(0,0,0,.4); max-width: calc(100% - 20px); flex-wrap: wrap; justify-content: center; }
.editbar.on { display: flex; }
.editbar .lbl { font-family: var(--pix); font-size: 12px; padding: 0 6px; }
.editbar .why { font-family: var(--num); font-size: 11px; color: var(--red); }
body.panel-open .editbar { left: calc((100% - var(--panel-w)) / 2); }

/* ---------------- toasts, modal, boot ---------------- */
#toasts { position: absolute; top: 132px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { padding: 7px 12px; border-radius: 10px; background: var(--panel); border: 2px solid var(--ink); font-size: 13px; font-weight: 600;
  box-shadow: 0 4px 0 var(--ink); animation: tin .25s ease-out, tout .3s ease-in 2.6s forwards; max-width: 90vw; text-align: center; }
.toast.good { background: var(--green); color: #07130C; }
.toast.bad { background: var(--red); color: #fff; }
.toast.gold { background: var(--cheese); color: #2A1B05; }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } }
@keyframes tout { to { opacity: 0; transform: translateY(-8px); } }
.modal { position: absolute; inset: 0; z-index: 80; display: none; place-items: center; background: rgba(10,11,14,.6); backdrop-filter: blur(3px); padding: 16px; }
.modal.on { display: grid; }
.modal .box { width: min(420px, 100%); max-height: 88vh; overflow-y: auto; background: var(--panel); border: 2px solid var(--ink); border-radius: 16px; padding: 18px; box-shadow: 0 6px 0 var(--ink), 0 20px 60px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 12px; animation: pop .25s cubic-bezier(.3,1.5,.6,1); }
.modal h2 { font-family: var(--pix); font-weight: 400; font-size: 22px; }
.modal .big { font-family: var(--num); font-size: 28px; font-weight: 800; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }
.boot { position: absolute; inset: 0; z-index: 100; display: grid; place-content: center; text-align: center; background: #121418; transition: opacity .4s; }
.boot.gone { opacity: 0; pointer-events: none; }
.bootlogo { font-family: var(--pix); font-size: 44px; color: var(--cheese); text-shadow: 0 4px 0 #6B4A08; }
.bootsub { font-family: var(--num); font-size: 12px; color: var(--muted); margin-top: 10px; }
.levelup .big { color: var(--cheese); font-family: var(--pix); font-size: 40px; font-weight: 400; }
.unlocks { display: flex; flex-wrap: wrap; gap: 6px; }
.unlocks img { width: 54px; height: 54px; background: #E8E1D3; border-radius: 8px; border: 2px solid var(--ink); padding: 2px; }

/* ---------------- guided tour coach ---------------- */
.coach { position: absolute; top: 86px; left: 50%; transform: translateX(-50%); z-index: 45; width: min(440px, calc(100% - 20px));
  display: none; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 14px;
  background: var(--text); color: #16181C; border: 2px solid var(--ink); box-shadow: 0 5px 0 var(--ink), 0 12px 30px rgba(0,0,0,.35); }
.coach.on { display: flex; }
.coach.pop { animation: pop .25s cubic-bezier(.3,1.5,.6,1); }
.coach .cface { width: 46px; height: 46px; flex: none; }
.coach .cbody { flex: 1; min-width: 0; }
.coach .ctop { display: flex; justify-content: space-between; align-items: center; }
.coach .ctop b { font-family: var(--pix); font-size: 10px; color: #6A6F78; font-weight: 400; }
.coach .cstep { font-family: var(--num); font-size: 10px; font-weight: 700; color: #8A8F98; }
.coach .ctext { font-size: 14px; font-weight: 600; line-height: 1.35; margin: 2px 0 6px; }
.coach .cbtns { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.coach .cskip { font-family: var(--num); font-size: 11px; color: #8A8F98; text-decoration: underline; }
body.panel-open .coach { left: calc((100% - var(--panel-w)) / 2); }
body.coaching #toasts { top: 200px; }
body.coaching .gm { display: none; }
.coach-hi { position: relative; z-index: 5; animation: coachhi 1.1s ease-in-out infinite !important; }
@keyframes coachhi { 0%, 100% { box-shadow: 0 0 0 3px #FFC83D, 0 0 0 3px rgba(255,200,61,.8); } 50% { box-shadow: 0 0 0 3px #FFC83D, 0 0 0 11px rgba(255,200,61,0); } }

/* ---------------- phones ---------------- */
@media (max-width: 760px) {
  :root { --dock-h: 64px; --panel-w: 100%; }
  #hud { gap: 8px; padding: max(8px, env(safe-area-inset-top)) 8px 6px; }
  .avatar, .avatar canvas { width: 48px; height: 48px; }
  .pill { padding: 3px 8px 3px 6px; }
  .pill b { font-size: 12px; }
  .pill.rate { display: none; }
  .icon-btn { width: 36px; height: 36px; font-size: 15px; }
  .dock { gap: 5px; padding: 6px; border-radius: 16px; width: calc(100% - 16px); justify-content: space-between; }
  body.panel-open .dock { left: 50%; max-width: none; }
  .dock button, body.panel-open .dock button { width: auto; flex: 1; height: 52px; }
  .dock button .ic { font-size: 18px; }
  .dock button .lb { font-size: 9px; }
  .panel { top: auto; height: 64%; width: 100%; border-left: 0; border-top: 2px solid var(--ink); border-radius: 18px 18px 0 0; transform: translateY(105%); }
  body.panel-open .panel { transform: none; }
  body.panel-open .viewctl { display: none; }
  body.panel-open .editbar { left: 50%; }
  .editbar { bottom: calc(var(--dock-h) + 22px); }
  body.panel-open .editbar { bottom: calc(64% + 10px); }
  .gm { bottom: calc(var(--dock-h) + 22px); left: 8px; }
  body.panel-open .gm { bottom: calc(64% + 10px); }
  .gm img { width: 56px; height: 56px; }
  .gm .bubble p { font-size: 13px; }
  .viewctl { bottom: calc(var(--dock-h) + 24px); right: 8px; }
  .item .thumb { height: 90px; }
  /* phones: the room sits at the top, so the call parks just above the dock, short and full width */
  .callcard { top: auto; left: 8px; right: 8px; width: auto; bottom: calc(var(--dock-h) + 22px); }
  .callcard .cc-line { display: none; }
  .cc-odds { margin-top: 8px; }
  body.panel-open .callcard { bottom: calc(64% + 10px); }
  body.calling:not(.panel-open) .viewctl, body.calling:not(.panel-open) .gm { bottom: calc(var(--dock-h) + 32px + var(--call-h, 120px)); }
  #toasts { top: 110px; }
  .coach { top: 70px; }
  body.panel-open .coach { left: 50%; }
  body.coaching #toasts { top: 190px; }
  .coach .ctext { font-size: 13px; }
  .coach .cface { width: 38px; height: 38px; }
  .toast { font-size: 12px; }
}

/* ---------------- voxel icons (js/art/icons.js) ---------------- */
.vx { display: inline-block; width: 1.35em; height: 1.35em; background: center / contain no-repeat; vertical-align: -0.32em; flex: none; }
.dock button .ic .vx { width: 28px; height: 28px; vertical-align: 0; display: block; }
.cat .ic .vx { width: 34px; height: 34px; vertical-align: 0; display: block; margin: 0 auto; }
.lrow .ic .vx { width: 30px; height: 30px; vertical-align: 0; display: block; }
.cc-ring .vx { width: 1.6em; height: 1.6em; vertical-align: 0; }
.pill .ico .vx { width: 17px; height: 17px; vertical-align: -3px; }
.icon-btn .vx { width: 24px; height: 24px; vertical-align: 0; display: block; }
.viewctl .emo .vx { width: 24px; height: 24px; vertical-align: 0; display: block; margin: 0 auto; }

/* ---------------- emote wheel ---------------- */
.viewctl button.emo { height: 36px; border-radius: 50%; font-size: 18px; background: var(--panel2); border-color: var(--ink); box-shadow: 0 0 0 2px rgba(255,200,61,.55); margin-bottom: 4px; }
.emowheel { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; background: rgba(8,10,14,.45);
  opacity: 0; pointer-events: none; transition: opacity .15s; touch-action: none; user-select: none; -webkit-user-select: none; }
.emowheel.open { opacity: 1; pointer-events: auto; }
.ew-wheel { position: relative; width: min(360px, 88vw, 70vh); aspect-ratio: 1; transform: scale(.86); transition: transform .2s cubic-bezier(.3,1.4,.5,1); }
.emowheel.open .ew-wheel { transform: none; }
.ew-wheel svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 10px 30px rgba(0,0,0,.5)); }
.ew-rim { fill: none; stroke: var(--cheese-d); stroke-width: 1.2; opacity: .8; }
.ew-rim.in { stroke: var(--cheese); stroke-width: 2; opacity: 1; }
.ew-s { cursor: pointer; }
.ew-s path { fill: rgba(21,23,28,.94); stroke: var(--ink); stroke-width: 1.6; transition: fill .1s; }
.ew-s.wait path { fill: rgba(24,34,40,.94); }
.ew-s.on path { fill: var(--cheese); }
.ew-ico { font-size: 22px; text-anchor: middle; dominant-baseline: central; transition: transform .1s; transform-box: fill-box; transform-origin: center; }
.ew-s.on .ew-ico { transform: scale(1.18); }
.ew-lb { font-family: var(--pix); font-size: 6px; fill: var(--muted); text-anchor: middle; dominant-baseline: central; letter-spacing: .02em; }
.ew-s.wait .ew-lb { fill: var(--cyan); }
.ew-s.on .ew-lb { fill: #2A1B05; }
.ew-center { position: absolute; left: 50%; top: 50%; width: 41%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; pointer-events: none;
  background: radial-gradient(circle at 50% 38%, #3A3F4A, var(--panel) 72%); border: 3px solid var(--ink); }
.ew-center img { width: 70%; height: 64%; object-fit: contain; image-rendering: auto; margin-top: -4px; }
.ew-center b { font-family: var(--pix); font-size: 11px; color: var(--text); line-height: 1.1; }
.ew-center i { font-style: normal; font-size: 9px; color: var(--cyan); min-height: 11px; line-height: 1.1; }

/* ================= FLOATING LAYOUT (body.lay-float) =================
   The panel is a card floating over the room instead of a docked sidebar /
   sheet, and opening it never moves the camera. The classic layout above is
   untouched: remove the class (⚙ Settings → Panel layout, or CFG.LAYOUT) to
   go back to it. */
body.lay-float { --card-w: clamp(330px, 34vw, 400px); }
body.lay-float .panel { top: 76px; right: 12px; bottom: calc(var(--dock-h) + 24px); width: var(--card-w);
  border: 2px solid var(--ink); border-radius: 18px; overflow: hidden; box-shadow: 0 16px 44px rgba(0,0,0,.45);
  transform: translateX(calc(100% + 30px)); }
body.lay-float.panel-open .panel { transform: none; }
body.lay-float .phead { padding-top: 12px; }
body.lay-float.panel-open .dock { left: 50%; max-width: none; gap: 8px; padding: 8px; }
body.lay-float.panel-open .dock button { flex: 0 0 auto; }
body.lay-float.panel-open .viewctl { right: calc(var(--card-w) + 26px); }
body.lay-float.panel-open .coach { left: calc((100% - var(--card-w) - 24px) / 2); }
/* the MOVE bar stays centred over the dock and sits above the card if a narrow window makes them meet */
body.lay-float.panel-open .editbar { left: 50%; z-index: 31; }

@media (max-width: 760px) {
  body.lay-float .panel { top: auto; left: 8px; right: 8px; width: auto; height: 46%; bottom: calc(var(--dock-h) + 16px);
    border-top: 2px solid var(--ink); transform: translateY(calc(100% + var(--dock-h) + 40px)); }
  body.lay-float.panel-open .panel { transform: none; }
  body.lay-float.panel-open .dock { gap: 5px; padding: 6px; }
  body.lay-float.panel-open .dock button { flex: 1; }
  body.lay-float.panel-open .editbar, body.lay-float.panel-open .coach { left: 50%; }
  body.lay-float.panel-open .editbar, body.lay-float.panel-open .gm, body.lay-float.panel-open .callcard { bottom: calc(46% + var(--dock-h) + 26px); }
}

/* ---------------- settings: music + volume ---------------- */
.stepper { display: flex; align-items: center; gap: 6px; flex: none; }
.stepper span { min-width: 118px; text-align: center; font-family: var(--pix); font-size: 11px; white-space: nowrap; }
.stepper .btn { min-width: 34px; padding-left: 0; padding-right: 0; }
.lrow.vol .tx { flex: 0 0 auto; width: 118px; }
.lrow.vol input[type=range] { flex: 1; min-width: 0; accent-color: var(--cheese); height: 22px; }
.lrow.vol .pct { width: 38px; text-align: right; font-family: var(--num); font-size: 12px; color: var(--muted); }
@media (max-width: 420px) { .stepper span { min-width: 96px; font-size: 10px; } .lrow.vol .tx { width: 92px; } }

/* ---------------- log in / sign up (js/ui/account.js) ---------------- */
.acct { position: absolute; inset: 0; z-index: 110; display: grid; place-items: center; padding: 16px; background: #121418; overflow-y: auto; }
.acct-box { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; text-align: center; }
.acct-box .bootlogo { margin-bottom: 4px; }
.acct-title { font-family: var(--pix); font-weight: 400; font-size: 18px; text-align: center; margin-bottom: 2px; }
.acct-switch { text-align: center; font-size: 13px; color: var(--muted); margin-top: 2px; }
.acct-switch button { color: var(--cheese); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; padding: 2px 2px; }
#acctForm { display: flex; flex-direction: column; gap: 10px; text-align: left; background: var(--panel); border: 2px solid var(--ink); border-radius: 16px; padding: 16px; box-shadow: 0 6px 0 var(--ink); }
#acctForm label { display: flex; flex-direction: column; gap: 5px; font-family: var(--num); font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--muted); text-transform: uppercase; }
#acctForm input[type=text], #acctForm input:not([type]), #acctForm input[type=password] { font: 600 15px var(--ui); padding: 10px 12px; border-radius: 10px; border: 2px solid var(--ink); background: #0E1014; color: #F4EFE6; text-transform: none; letter-spacing: 0; }
#acctForm input:focus { outline: 2px solid var(--cheese); outline-offset: 1px; }
.acct-hint { color: var(--muted); font-size: 11px; line-height: 1.4; }
.acct-terms { background: #0E1014; border: 2px solid var(--ink); border-radius: 10px; padding: 10px 12px; font-size: 12px; line-height: 1.45; color: #D9D4CB; }
.acct-terms b { color: var(--cheese); font-family: var(--num); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.acct-terms p { margin-top: 6px; }
#acctForm label.acct-check { flex-direction: row; align-items: center; gap: 10px; text-transform: none; letter-spacing: 0; font: 600 13px var(--ui); color: #F4EFE6; cursor: pointer; }
.acct-check input { width: 20px; height: 20px; accent-color: var(--cheese); flex: none; }
.acct-err { color: #FF7A7E; font-size: 13px; font-weight: 600; min-height: 1em; }
.acct-err:empty { display: none; }
#acctTs:empty { display: none; }
#acctForm input { user-select: text; -webkit-user-select: text; }
