/* Tezpur University 3D — interface
   Look: dark forest-green glass panels over the 3D world, warm off-white text,
   gamosa red as the one accent (the red-on-white border of the Assamese gamosa). */
:root {
  --ink: #10201b;
  --glass: rgba(14, 30, 25, 0.66);
  --glass-strong: rgba(12, 26, 22, 0.86);
  --line: rgba(246, 241, 231, 0.14);
  --paper: #f6f1e7;
  --muted: #b8c4bb;
  --red: #d23a2f;
  --gold: #f2b84b;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Figtree", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --pad: max(16px, env(safe-area-inset-left, 0px));
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: #1a2b25; color: var(--paper); font-family: var(--body); -webkit-tap-highlight-color: transparent; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.mono { font-family: var(--mono); }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid rgba(246,241,231,.3); background: rgba(246,241,231,.08); }

/* ---------- intro card ---------- */
#intro { position: fixed; inset: 0; display: flex; align-items: center; padding: 24px var(--pad); z-index: 20;
  background: radial-gradient(120% 90% at 0% 50%, rgba(10,22,18,.82), rgba(10,22,18,.25) 60%, rgba(10,22,18,0)); transition: opacity .8s ease, visibility .8s; }
body.loading #intro { background: #12241e; }
body.playing #intro { opacity: 0; visibility: hidden; pointer-events: none; }
.card { position: relative; width: min(470px, 100%); padding: 34px 30px 28px; background: var(--glass); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.35); overflow: hidden; animation: rise .9s cubic-bezier(.2,.8,.2,1) both; }
@keyframes rise { from { transform: translateY(18px); opacity: 0; } }
.gamosa { position: absolute; left: 0; right: 0; top: 0; height: 12px;
  background:
    repeating-linear-gradient(90deg, var(--red) 0 10px, transparent 10px 14px, var(--red) 14px 18px, transparent 18px 26px) 0 4px / 100% 4px no-repeat,
    linear-gradient(var(--red), var(--red)) 0 0 / 100% 2px no-repeat,
    linear-gradient(var(--red), var(--red)) 0 10px / 100% 2px no-repeat,
    var(--paper); }
.eyebrow { margin: 6px 0 10px; font: 500 12px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
h1 { margin: 0; font: 800 clamp(40px, 8vw, 62px)/0.92 var(--display); letter-spacing: -0.02em; text-wrap: balance; }
h1 span { display: inline-block; font-size: .42em; vertical-align: top; margin-top: .3em; padding: 3px 9px; border-radius: 8px; background: var(--red); letter-spacing: 0; }
.lede { margin: 16px 0 22px; color: var(--muted); font-size: 15px; line-height: 1.55; max-width: 38ch; }
.loader .bar { height: 6px; border-radius: 6px; background: rgba(246,241,231,.12); overflow: hidden; }
.loader i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--red), var(--gold)); transition: width .35s ease; }
#loadStep { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.ready { display: none; }
body.title .loader { display: none; }
body.title .ready, body.playing .ready { display: block; animation: rise .6s ease both; }
#stats { margin: 0 0 16px; font-size: 12px; color: var(--muted); }
.pick { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; font-size: 13px; color: var(--muted); }
.pick span { margin-right: 4px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(246,241,231,.25); background: var(--c); padding: 0; transition: transform .2s; }
.swatch[aria-pressed="true"] { border-color: var(--paper); transform: scale(1.15); box-shadow: 0 0 0 3px rgba(242,184,75,.35); }
.cta { display: inline-flex; align-items: center; gap: 12px; padding: 14px 22px; border: 0; border-radius: 12px; background: var(--paper); color: var(--ink);
  font: 700 17px var(--display); box-shadow: 0 10px 30px rgba(0,0,0,.25); transition: transform .2s, box-shadow .2s; }
.cta b { color: var(--red); transition: transform .2s; }
.cta:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(0,0,0,.32); }
.cta:hover b { transform: translateX(4px); }
.keys { margin: 16px 0 0; font-size: 11px; color: var(--muted); letter-spacing: .02em; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; opacity: 0; transition: opacity .8s ease .2s; }
body.playing:not(.flying) #hud { opacity: 1; }
#hud > * { pointer-events: auto; }
.where { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); left: var(--pad); display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px 12px 14px; max-width: min(360px, calc(100vw - 210px)); background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 14px; }
.where .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); margin-top: 5px; box-shadow: 0 0 0 4px rgba(210,58,47,.25); animation: pulse 2s infinite; flex: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(210,58,47,0); } }
.where small { display: block; font: 500 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.where strong { font: 700 17px/1.2 var(--display); }
.where em { font: 500 12px var(--mono); font-style: normal; color: var(--gold); margin-left: 6px; }
.where p { margin: 4px 0 0; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
body.indoors .where small::after { content: " · indoors"; }
body.indoors .where p, body.indoors .mapwrap, body.indoors #btnMap, body.indoors #btnSpawn, body.indoors #btnTime { display: none; }

.mapwrap { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); width: 170px; height: 170px; border-radius: 50%;
  border: 3px solid rgba(246,241,231,.85); box-shadow: 0 10px 30px rgba(0,0,0,.35); overflow: hidden; background: #2a3d33; }
#minimap { width: 100%; height: 100%; display: block; }

.tools { position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); top: calc(196px + env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.tools button { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 13px; font-weight: 600; transition: background .2s; }
.tools button:hover { background: var(--glass-strong); }
.tools svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.help { position: absolute; left: var(--pad); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-wrap: wrap; gap: 14px; padding: 10px 14px; font-size: 11px; color: var(--muted);
  background: var(--glass); border: 1px solid var(--line); border-radius: 12px; transition: opacity 1s ease 6s; }
body.moved .help { opacity: 0; pointer-events: none; }

#prompt { position: absolute; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 12px; padding: 12px 20px 12px 12px; border: 0; border-radius: 14px; background: var(--paper); color: var(--ink); font: 700 16px var(--display);
  box-shadow: 0 14px 40px rgba(0,0,0,.35); transition: opacity .25s, transform .25s; max-width: calc(100vw - 32px); }
#prompt kbd { background: var(--red); color: #fff; border: 0; font-size: 13px; padding: 4px 9px; }
#prompt.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

#toast { position: fixed; left: 50%; top: calc(18px + env(safe-area-inset-top, 0px)); transform: translate(-50%, -20px); opacity: 0; z-index: 30; padding: 12px 20px; border-radius: 40px;
  background: var(--glass-strong); border: 1px solid var(--line); font: 500 15px var(--display); transition: opacity .4s, transform .4s; pointer-events: none; white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; }
#toast b { color: var(--gold); font-weight: 700; margin-right: 6px; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#fader { position: fixed; inset: 0; background: #0b1512; opacity: 0; pointer-events: none; z-index: 40; transition: opacity .4s ease; }
#fader.on { opacity: 1; }

/* ---------- big map ---------- */
#mapPanel { position: fixed; inset: 0; z-index: 25; background: #1a2b25; opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s; }
body.mapopen #mapPanel { opacity: 1; visibility: visible; }
#bigmap { position: absolute; inset: 64px 0 0; width: 100%; height: calc(100% - 64px); cursor: crosshair; }
.maphead { position: absolute; top: 0; left: 0; right: 0; height: 64px; display: flex; align-items: center; gap: 16px; padding: 0 var(--pad); padding-top: env(safe-area-inset-top, 0px); border-bottom: 1px solid var(--line); }
.maphead strong { font: 700 20px var(--display); }
.maphead span { font-size: 12px; color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.maphead button { border: 1px solid var(--line); background: var(--glass); border-radius: 10px; padding: 8px 12px; font-weight: 600; }

/* ---------- touch controls ---------- */
#joy, .touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  #joy { display: block; position: absolute; left: max(24px, env(safe-area-inset-left, 0px)); bottom: calc(28px + env(safe-area-inset-bottom, 0px)); width: 130px; height: 130px; border-radius: 50%;
    background: rgba(14,30,25,.35); border: 2px solid rgba(246,241,231,.35); touch-action: none; }
  #knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: rgba(246,241,231,.9); box-shadow: 0 4px 14px rgba(0,0,0,.3); }
  .touch { display: flex; flex-direction: column; gap: 10px; position: absolute; right: max(20px, env(safe-area-inset-right, 0px)); bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
  .touch button { width: 64px; height: 64px; border-radius: 50%; border: 2px solid rgba(246,241,231,.35); background: var(--glass); font: 700 13px var(--display); touch-action: none; }
  .touch button.on { background: var(--red); }
  .help { display: none; }
  .mapwrap { width: 120px; height: 120px; }
  .tools { top: calc(146px + env(safe-area-inset-top, 0px)); }
  .tools span { display: none; }
  .where { max-width: calc(100vw - 160px); }
  #prompt { bottom: calc(180px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 560px) {
  .card { padding: 30px 20px 22px; }
  .where p { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- walking speed ---------- */
.speedbar { position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 6px 14px; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 14px; }
.speedbar > span { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
#speedSeg { display: flex; gap: 2px; background: rgba(0,0,0,.2); border-radius: 10px; padding: 3px; }
#speedSeg button { border: 0; background: transparent; padding: 6px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); display: flex; gap: 6px; align-items: center; }
#speedSeg button kbd { font-size: 10px; padding: 0 4px; }
#speedSeg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); }
#speedSeg button[aria-pressed="true"] kbd { border-color: rgba(16,32,27,.3); background: rgba(16,32,27,.08); }
#speedVal { font-style: normal; font-size: 12px; color: var(--gold); min-width: 58px; text-align: right; font-variant-numeric: tabular-nums; }
#btnSpeed { display: none; }

/* ---------- landing picker ---------- */
#landPanel { position: fixed; inset: 0; z-index: 35; display: flex; align-items: center; justify-content: center; padding: 20px var(--pad);
  background: rgba(8,18,15,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
body.picking #landPanel { opacity: 1; visibility: visible; }
.lp { position: relative; width: min(760px, 100%); max-height: min(720px, 100%); display: flex; flex-direction: column; background: var(--glass-strong); border: 1px solid var(--line);
  border-radius: 18px; overflow: hidden; box-shadow: 0 30px 90px rgba(0,0,0,.45); transform: translateY(14px); transition: transform .35s cubic-bezier(.2,.8,.2,1); }
body.picking .lp { transform: none; }
.lp header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 26px 24px 8px; }
.lp h2 { margin: 0; font: 800 clamp(24px, 4vw, 32px)/1.05 var(--display); letter-spacing: -.01em; text-wrap: balance; }
.lp .eyebrow { margin: 0 0 6px; }
#landClose { border: 1px solid var(--line); background: transparent; border-radius: 10px; width: 38px; height: 38px; font-size: 16px; flex: none; }
.lptools { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 24px 14px; border-bottom: 1px solid var(--line); }
#landSearch { flex: 1 1 240px; min-width: 0; height: 42px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: rgba(246,241,231,.07); color: var(--paper); font: 500 15px var(--body); }
#landSearch:focus { outline: 2px solid var(--gold); outline-offset: 0; }
.chip { height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: rgba(246,241,231,.07); font-weight: 600; }
#landRandom { background: var(--red); border-color: var(--red); color: #fff; }
.chip:hover { background: rgba(246,241,231,.14); }
#landRandom:hover { filter: brightness(1.08); background: var(--red); }
#landList { overflow-y: auto; padding: 6px 24px 24px; overscroll-behavior: contain; }
#landList h3 { margin: 18px 0 8px; font: 500 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.landgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.place { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 12px; text-align: left; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(246,241,231,.05); font-size: 14px; font-weight: 600; line-height: 1.25; transition: background .15s, border-color .15s, transform .15s; }
.place:hover { background: rgba(246,241,231,.12); border-color: rgba(242,184,75,.6); transform: translateY(-1px); }
.place .pin { width: 10px; height: 10px; flex: none; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--red); box-shadow: 0 0 0 3px rgba(210,58,47,.25); }
.empty { color: var(--muted); padding: 20px 0; }

/* ---------- map confirm ---------- */
#confirm { position: absolute; z-index: 2; width: 210px; padding: 14px; border-radius: 14px; background: var(--paper); color: var(--ink); box-shadow: 0 18px 50px rgba(0,0,0,.45);
  opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity .2s, transform .2s; }
#confirm.show { opacity: 1; transform: none; pointer-events: auto; }
#confirm p { margin: 0 0 12px; font: 500 13px/1.35 var(--body); color: #4a5a52; }
#confirm strong { display: block; margin-top: 2px; font: 700 17px/1.2 var(--display); color: var(--ink); }
#confirm small { color: #6a756f; }
#confirm .row { display: flex; gap: 8px; }
#confirm button { flex: 1; height: 38px; border-radius: 10px; border: 1px solid rgba(16,32,27,.2); background: transparent; color: var(--ink); font-weight: 700; }
#confirm button.go { background: var(--red); border-color: var(--red); color: #fff; }

@media (hover: none) and (pointer: coarse) {
  .speedbar { display: none; }
  #btnSpeed { display: flex; }
}
@media (max-width: 560px) {
  .speedbar { left: var(--pad); right: auto; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
  .lp header { padding: 22px 16px 6px; } .lptools { padding: 8px 16px 12px; } #landList { padding: 4px 16px 20px; }
}

#speedVal.boost { color: #ff8a5c; text-shadow: 0 0 12px rgba(255,120,60,.6); }

/* ---------- name + avatar choice ---------- */
.who { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: end; margin-bottom: 14px; }
.who label { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
#playerName { min-width: 0; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(246,241,231,.08); color: var(--paper); font: 500 15px var(--body); }
#playerName:focus { outline: 2px solid var(--gold); outline-offset: 0; }
#genderSeg { display: flex; gap: 2px; background: rgba(0,0,0,.25); border-radius: 10px; padding: 3px; height: 42px; }
#genderSeg button { border: 0; background: transparent; border-radius: 8px; padding: 0 14px; font-weight: 600; color: var(--muted); }
#genderSeg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); }

/* ---------- music card UI ---------- */
#songPanel { position: fixed; inset: 0; z-index: 36; display: flex; align-items: center; justify-content: center; padding: 20px var(--pad);
  background: rgba(8,18,15,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
body.songs #songPanel { opacity: 1; visibility: visible; }
body.songs .sp { transform: none; }
.sp { width: min(520px, 100%); }
#songClose { border: 1px solid var(--line); background: transparent; border-radius: 10px; width: 38px; height: 38px; font-size: 16px; flex: none; }
.sp-note { margin: 0; padding: 0 24px 12px; color: var(--muted); font-size: 14px; border-bottom: 1px solid var(--line); }
#songList { padding: 14px 24px 24px; display: grid; gap: 8px; overflow-y: auto; }
.song { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(246,241,231,.05); text-align: left; font-weight: 600; }
.song:hover { border-color: rgba(242,184,75,.6); background: rgba(246,241,231,.12); }
.song .num { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(135deg, var(--gold), var(--red)); font: 700 13px var(--mono); }
.song .t { flex: 1; min-width: 0; }
.song .go { font-size: 12px; color: var(--gold); letter-spacing: .08em; text-transform: uppercase; }
#musicBar { position: absolute; left: 50%; top: calc(14px + env(safe-area-inset-top, 0px)); transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 12px; max-width: min(460px, calc(100vw - 32px));
  background: linear-gradient(120deg, rgba(178,32,28,.92), rgba(224,137,46,.92)); border-radius: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.3); transition: opacity .3s, transform .3s; }
#musicBar.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#musicBar .note { font: 700 24px Georgia, serif; animation: bob 1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-3px) rotate(-8deg); } }
#musicBar div { min-width: 0; } #musicBar small { display: block; font-size: 10px; opacity: .85; letter-spacing: .06em; }
#musicBar strong { display: block; font: 700 15px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#musicBar em { font-style: normal; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
#musicStop { border: 0; border-radius: 10px; padding: 8px 12px; background: rgba(0,0,0,.25); color: #fff; font-weight: 700; }
.online { position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); top: calc(190px + env(safe-area-inset-top, 0px)); font-size: 11px; color: var(--muted); padding: 3px 8px; background: var(--glass); border-radius: 8px; }
.tools { top: calc(214px + env(safe-area-inset-top, 0px)) !important; }
@media (hover: none) and (pointer: coarse) { .online { top: calc(138px + env(safe-area-inset-top, 0px)); } .tools { top: calc(162px + env(safe-area-inset-top, 0px)) !important; } }
@media (max-width: 720px) { #musicBar { top: auto; bottom: calc(150px + env(safe-area-inset-bottom, 0px)); } }

/* ---------- Bamboo the thief ---------- */
#bambooBar { position: absolute; left: 50%; top: calc(14px + env(safe-area-inset-top, 0px)); transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 12px; padding: 9px 16px 9px 10px; max-width: min(520px, calc(100vw - 420px)); min-width: 260px;
  background: rgba(20, 12, 12, .86); border: 1px solid rgba(224, 38, 43, .55); border-radius: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.35); transition: opacity .3s, transform .3s; }
#bambooBar.show { opacity: 1; transform: translate(-50%, 0); }
#bambooBar .mask { width: 34px; height: 34px; flex: none; border-radius: 50%; background: radial-gradient(circle at 50% 38%, #c98d64 0 40%, transparent 41%), linear-gradient(#1b1b1b 0 42%, #2b2d30 42% 58%, #1b1b1b 58%); border: 2px solid #e0262b; animation: pulse2 1.6s infinite; }
#bambooBar.waiting .mask { animation: none; opacity: .6; border-color: var(--muted); }
@keyframes pulse2 { 50% { box-shadow: 0 0 0 6px rgba(224,38,43,0); } 0% { box-shadow: 0 0 0 0 rgba(224,38,43,.5); } }
#bambooBar div { min-width: 0; }
#bambooBar strong { display: block; font: 700 14px/1.25 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#bambooBar small { display: block; font: 500 11px var(--mono); color: #ffb3a8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
#musicBar { top: calc(74px + env(safe-area-inset-top, 0px)); }
#bambooFlash { position: fixed; left: 50%; top: 32%; transform: translate(-50%, -50%) scale(.9); z-index: 31; opacity: 0; pointer-events: none; text-align: center;
  padding: 18px 28px; border-radius: 18px; background: rgba(20,12,12,.88); border: 2px solid #e0262b; transition: opacity .35s, transform .35s; max-width: calc(100vw - 32px); }
#bambooFlash.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#bambooFlash strong { display: block; font: 800 clamp(22px, 4vw, 34px)/1.1 var(--display); color: #fff; }
#bambooFlash span { display: block; margin-top: 6px; font-size: 14px; color: #ffcfc8; max-width: 46ch; }
#prompt.hot { background: #e0262b; color: #fff; animation: shake .5s infinite; }
#prompt.hot kbd { background: #fff; color: #e0262b; }
@keyframes shake { 25% { transform: translate(-51%, 0); } 75% { transform: translate(-49%, 0); } }
#lbPanel { position: fixed; inset: 0; z-index: 36; display: flex; align-items: center; justify-content: center; padding: 20px var(--pad);
  background: rgba(8,18,15,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
body.board #lbPanel { opacity: 1; visibility: visible; }
body.board .lbp { transform: none; }
.lbp { width: min(520px, 100%); }
#lbClose { border: 1px solid var(--line); background: transparent; border-radius: 10px; width: 38px; height: 38px; font-size: 16px; flex: none; }
#lbList { padding: 10px 24px 24px; display: grid; gap: 6px; overflow-y: auto; }
.lbrow { display: grid; grid-template-columns: 32px 1fr auto auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(246,241,231,.05); border: 1px solid var(--line); }
.lbrow .rank { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: rgba(246,241,231,.12); font: 700 13px var(--mono); }
.lbrow.top1 .rank { background: #e8b931; color: #3a2a00; } .lbrow.top2 .rank { background: #c9ced3; color: #222; } .lbrow.top3 .rank { background: #c47a45; color: #fff; }
.lbrow .nm { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbrow .mono { font-size: 11px; color: var(--muted); }
.lbrow strong { font: 800 18px var(--display); color: var(--gold); font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { #bambooBar { top: auto; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); max-width: calc(100vw - 32px); } .lbrow .mono { display: none; } .lbrow { grid-template-columns: 32px 1fr auto; } }

/* ---------- phones: nothing overlaps ---------- */
@media (hover: none) and (pointer: coarse) {
  .mapwrap { width: 104px; height: 104px; }
  .online { display: none; }
  .tools { top: calc(126px + env(safe-area-inset-top, 0px)) !important; flex-direction: row; gap: 6px; }
  .tools button { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 12px; }
  .where { max-width: calc(100vw - 150px); padding: 9px 12px 9px 10px; }
  .where strong { font-size: 14px; }
  #bambooBar { top: calc(176px + env(safe-area-inset-top, 0px)); bottom: auto; left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px));
    transform: translateY(-10px); max-width: none; min-width: 0; }
  #bambooBar.show { transform: none; }
  #musicBar { top: calc(236px + env(safe-area-inset-top, 0px)); bottom: auto; }
  /* thumb buttons in an arc, bottom right */
  .touch { display: block; width: 176px; height: 164px; right: max(14px, env(safe-area-inset-right, 0px)); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); flex-direction: initial; }
  .touch button { position: absolute; width: 58px; height: 58px; font-size: 12px; }
  #mJump { right: 0; bottom: 0; width: 74px; height: 74px; font-size: 14px; }
  #mAct { right: 86px; bottom: 4px; }
  #mSprint { right: 14px; bottom: 90px; }
  #joy { width: 120px; height: 120px; left: max(18px, env(safe-area-inset-left, 0px)); bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
  #prompt { bottom: calc(196px + env(safe-area-inset-bottom, 0px)); font-size: 14px; padding: 10px 16px 10px 10px; }
}
/* phones held sideways: short screen */
@media (hover: none) and (pointer: coarse) and (max-height: 500px) {
  .mapwrap { width: 92px; height: 92px; }
  .tools { top: calc(14px + env(safe-area-inset-top, 0px)) !important; right: calc(max(16px, env(safe-area-inset-right, 0px)) + 100px); }
  #bambooBar { top: calc(62px + env(safe-area-inset-top, 0px)); left: 50%; right: auto; transform: translateX(-50%); width: min(420px, calc(100vw - 340px)); }
  #bambooBar.show { transform: translateX(-50%); }
  #musicBar { top: calc(118px + env(safe-area-inset-top, 0px)); }
  .where { max-width: 210px; }
  .where p { display: none; }
  #prompt { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .touch { height: 150px; }
}
