:root {
  --ink: #1d2416;
  --panel: rgba(28, 34, 22, 0.88);
  --panel-line: #0e120a;
  --bevel-hi: rgba(255, 255, 255, 0.22);
  --bevel-lo: rgba(0, 0, 0, 0.45);
  --accent: #f2a62b;
  --accent-ink: #2a1a00;
  --go: #5fbf3b;
  --text: #f4f2e6;
  --muted: #c6c3b2;
  --pixel: 'Pixelify Sans', ui-monospace, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #79b04a; color: var(--text); font: 15px/1.35 system-ui, -apple-system, sans-serif; -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

#map { position: fixed; inset: 0; }
#map canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: none; touch-action: none; outline: none; }

.btn {
  font-family: var(--pixel); font-weight: 700; font-size: 15px; letter-spacing: 0.02em;
  color: var(--text); background: #6b6b6b; border: 2px solid var(--panel-line); border-radius: 0;
  box-shadow: inset 2px 2px 0 var(--bevel-hi), inset -2px -3px 0 var(--bevel-lo);
  padding: 8px 14px; cursor: pointer; text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6);
}
.btn:hover { filter: brightness(1.12); }
.btn:active { box-shadow: inset -2px -2px 0 var(--bevel-hi), inset 2px 3px 0 var(--bevel-lo); }
.btn.primary { background: var(--go); }
.btn:focus-visible, .dropper:focus-visible, input:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* map mode chrome */
.top { position: fixed; top: 0; left: 0; right: 0; display: flex; gap: 12px; align-items: center; padding: max(10px, env(safe-area-inset-top)) 16px 10px; pointer-events: none; z-index: 7; }
.top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-family: var(--pixel); font-size: 22px; font-weight: 700; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.55); white-space: nowrap; }
.brand b { color: var(--accent); margin-left: 4px; }
.logo { width: 26px; height: 26px; background: conic-gradient(#3b6fd8 0 25%, #79b04a 0 50%, #3b6fd8 0 75%, #79b04a 0); border: 2px solid var(--panel-line); box-shadow: inset 2px 2px 0 var(--bevel-hi), inset -2px -2px 0 var(--bevel-lo); }
.search { position: relative; flex: 1; max-width: 420px; }
.search input { width: 100%; padding: 10px 12px; border: 2px solid var(--panel-line); border-radius: 0; background: var(--panel); color: var(--text); font-size: 15px; box-shadow: inset 2px 2px 0 var(--bevel-lo); }
.search input::placeholder { color: var(--muted); }
#results { position: absolute; top: 100%; left: 0; right: 0; margin: 4px 0 0; padding: 0; list-style: none; background: var(--panel); border: 2px solid var(--panel-line); max-height: 50vh; overflow: auto; }
#results li { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
#results li:hover, #results li.on { background: rgba(255, 255, 255, 0.12); }
#results small { color: var(--muted); display: block; }
.online { font-family: var(--pixel); font-weight: 700; background: var(--panel); border: 2px solid var(--panel-line); padding: 8px 12px; white-space: nowrap; }
.online .dot { display: inline-block; width: 10px; height: 10px; background: #59e04a; margin-right: 6px; box-shadow: 0 0 6px #59e04a; vertical-align: 0; }
.online.off .dot, .counts.off .dot { background: #888 !important; box-shadow: none !important; }

.dock { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(34px, calc(env(safe-area-inset-bottom) + 24px)); z-index: 5; display: flex; align-items: center; gap: 12px; flex-direction: row-reverse; }
.dropper { width: 70px; height: 86px; background: var(--panel); border: 2px solid var(--panel-line); box-shadow: inset 2px 2px 0 var(--bevel-hi), inset -2px -3px 0 var(--bevel-lo); display: grid; place-items: center; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.dropper:hover .explorer { transform: translateY(-3px); }
.explorer { width: 38px; height: 57px; shape-rendering: crispEdges; transition: transform 0.15s; filter: drop-shadow(2px 3px 0 rgba(0, 0, 0, 0.45)); }
.dock-tip { margin: 0; background: var(--panel); border: 2px solid var(--panel-line); padding: 8px 12px; font-family: var(--pixel); font-weight: 500; text-align: right; }
.dock-tip small { color: var(--muted); font-family: system-ui, sans-serif; }
.drag-ghost { position: fixed; z-index: 50; width: 46px; height: 69px; pointer-events: none; transform: translate(-50%, -100%); }
.drag-ghost svg { width: 100%; height: 100%; shape-rendering: crispEdges; filter: drop-shadow(3px 6px 0 rgba(0, 0, 0, 0.4)); }
.drag-ghost::after { content: ''; position: absolute; left: 50%; bottom: -8px; width: 26px; height: 8px; margin-left: -13px; background: rgba(0, 0, 0, 0.35); border-radius: 50%; }
body.dragging #map { cursor: copy; }

.resume { position: fixed; left: 50%; top: calc(max(10px, env(safe-area-inset-top)) + 62px); transform: translateX(-50%); z-index: 6; display: flex; }
.resume button { font-family: var(--pixel); font-weight: 700; background: var(--accent); color: var(--accent-ink); border: 2px solid var(--panel-line); box-shadow: inset 2px 2px 0 var(--bevel-hi), inset -2px -3px 0 var(--bevel-lo); padding: 9px 14px; cursor: pointer; }
.resume .x { padding: 9px 12px; background: #c98a20; }

.sheet { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20; width: min(420px, calc(100% - 32px)); background: var(--panel); border: 2px solid var(--panel-line); box-shadow: inset 2px 2px 0 var(--bevel-hi), 0 8px 0 rgba(0, 0, 0, 0.25); padding: 16px; }
.sheet-title { font-family: var(--pixel); font-weight: 700; font-size: 20px; }
.sheet-sub { color: var(--muted); margin: 4px 0 12px; font-size: 14px; }
.sheet-row { display: flex; gap: 10px; }
.sheet-row .btn { flex: 1; padding: 12px; font-size: 17px; }
.sheet-note { margin-top: 10px; font-size: 12px; color: var(--muted); }

.attrib { position: fixed; left: 8px; bottom: max(4px, env(safe-area-inset-bottom)); z-index: 4; font-size: 11px; color: #fff; text-shadow: 0 1px 2px #000; }
.attrib a { color: #fff; }

/* leaderboards: cascade down the left on desktop, a sheet on phones */
.board { position: fixed; left: 16px; top: calc(max(10px, env(safe-area-inset-top)) + 62px); bottom: 70px; z-index: 5; width: 250px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; pointer-events: none; }
.board > * { pointer-events: auto; }
.board section, .board .board-note { background: var(--panel); border: 2px solid var(--panel-line); padding: 9px 12px; }
.board-head { display: none; }
.board-title { font-family: var(--pixel); font-weight: 700; margin-bottom: 4px; }
.board ol { margin: 0; padding-left: 22px; font-size: 13px; }
.board li { margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board li i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border: 1px solid #000; }
.board li span { float: right; color: var(--muted); margin-left: 8px; }
.board li small { color: var(--muted); }
.board .flag { margin-right: 5px; }
.board-note { font-size: 11px; color: var(--muted); }
.board section:empty, .board ol:empty::after { content: 'Nobody yet: be the first'; color: var(--muted); font-size: 12px; }
.trophy { display: none; padding: 8px 11px; }
body.mode-world .board, body.mode-dl .board { display: none !important; }
#land.pulse { background: var(--accent); color: var(--accent-ink); }
@media (max-width: 640px), (max-height: 500px) {
  .trophy { display: inline-block; order: 2; padding: 6px 9px; font-size: 14px; }
  .board { display: none; left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 75vh; z-index: 30; background: var(--panel); border-top: 2px solid var(--panel-line); padding: 12px 16px max(16px, env(safe-area-inset-bottom)); box-shadow: 0 -6px 0 rgba(0, 0, 0, 0.25); }
  .board section, .board .board-note { border: none; padding: 6px 0; background: none; }
  .board-head { display: flex; justify-content: space-between; align-items: center; font: 700 18px var(--pixel); }
  .board-head .x { background: none; border: none; color: var(--text); font-size: 26px; padding: 0 4px; cursor: pointer; }
  body.board-open .board { display: flex !important; }
  body.board-open .dock { display: none; }
}

/* map markers */
.pin { width: 40px; height: 60px; cursor: grab; touch-action: none; }
.pin .pin-fig { width: 100%; height: 100%; transform-origin: 50% 100%; animation: pin-drop 0.45s cubic-bezier(.3, 1.6, .5, 1), pin-wiggle 1.6s ease-in-out 0.6s 3; transition: transform 0.12s; }
.pin svg { width: 100%; height: 100%; shape-rendering: crispEdges; filter: drop-shadow(2px 3px 0 rgba(0, 0, 0, 0.45)); pointer-events: none; }
.pin::after { content: ''; position: absolute; left: 50%; bottom: -5px; width: 22px; height: 7px; margin-left: -11px; background: rgba(0, 0, 0, 0.35); border-radius: 50%; }
.pin.lifted { cursor: grabbing; }
.pin.lifted .pin-fig { transform: translateY(-14px) scale(1.12); animation: none; }
.pin-hint { position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -8px); white-space: nowrap; background: var(--accent); color: var(--accent-ink); font: 700 13px var(--pixel); padding: 5px 9px; border: 2px solid var(--panel-line); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3); pointer-events: none; animation: hint-bob 1.2s ease-in-out infinite; }
.pin-hint::after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--panel-line); }
.pin.dragged .pin-hint { display: none; }
@keyframes pin-wiggle { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(7deg); } 60% { transform: rotate(-4deg); } 80% { transform: rotate(2deg); } }
@keyframes hint-bob { 0%, 100% { transform: translate(-50%, -8px); } 50% { transform: translate(-50%, -13px); } }
@keyframes pin-drop { from { transform: translateY(-60px); opacity: 0; } to { transform: none; opacity: 1; } }
.me-marker { width: 20px; height: 20px; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--panel-line), 0 0 12px var(--accent); }
.maplibregl-popup-content { background: var(--panel); color: var(--text); border: 2px solid var(--panel-line); border-radius: 0; padding: 10px 12px; font-family: var(--pixel); }
.maplibregl-popup-tip { border-top-color: var(--panel-line) !important; border-bottom-color: var(--panel-line) !important; }
.maplibregl-popup-content .btn { margin-top: 8px; width: 100%; }
.maplibregl-popup-close-button { color: var(--text); font-size: 18px; }
.maplibregl-ctrl-attrib { display: none; }

/* world mode */
.hud, .overlay-bar { display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 10; align-items: center; gap: 8px; padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); pointer-events: none; }
.hud > *, .overlay-bar > * { pointer-events: auto; }
.spacer { flex: 1; }
.hudbtn { padding: 7px 11px; font-size: 14px; }
.hudbtn.on { background: var(--accent); color: var(--accent-ink); text-shadow: none; }
.who { font-family: var(--pixel); font-weight: 700; background: var(--panel); border: 2px solid var(--panel-line); padding: 6px 10px; }
.who i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border: 1px solid #000; vertical-align: 0; }
.pill { font-family: var(--pixel); background: var(--panel); border: 2px solid var(--panel-line); padding: 6px 10px; white-space: nowrap; }
body.mode-world .hud { display: flex; }
body.mode-world .top, body.mode-world .dock, body.mode-world .resume, body.mode-world .attrib { display: none; }
body.mode-world #map { display: none; }
body.mode-overlay #map { display: block; z-index: 9; opacity: 0.97; }
body.mode-overlay .hud { display: none; }
body.mode-overlay .overlay-bar { display: flex; }
body.mode-overlay #touch { display: none !important; }


.loading { position: fixed; inset: 0; z-index: 12; display: grid; place-items: center; padding: 16px; pointer-events: none; }
.loading-card { box-sizing: border-box; width: min(340px, 100%); background: var(--panel); border: 2px solid var(--panel-line); padding: 18px 22px; text-align: center; font-family: var(--pixel); font-size: 18px; pointer-events: auto; }
.loading-card small { display: block; font-family: system-ui, sans-serif; font-size: 13px; color: var(--muted); margin-top: 6px; }
.spinner { display: flex; justify-content: center; align-items: flex-end; gap: 6px; height: 34px; margin: 0 auto 12px; }
.spinner i { display: block; width: 14px; height: 14px; background: var(--accent); box-shadow: inset 2px 2px 0 var(--bevel-hi), inset -2px -2px 0 var(--bevel-lo); animation: hop 0.9s ease-in-out infinite; will-change: transform; }
.spinner i:nth-child(2) { animation-delay: 0.15s; background: var(--go); }
.spinner i:nth-child(3) { animation-delay: 0.15s; background: #3b6fd8; }
.spinner i:nth-child(4) { animation-delay: 0s; background: #b07a52; }
@keyframes hop { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-18px); } }
@media (prefers-reduced-motion: reduce) { .spinner i { animation-duration: 2.4s; } }
.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); z-index: 60; background: var(--panel); border: 2px solid var(--panel-line); padding: 9px 14px; font-family: var(--pixel); }
.help { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 10; background: rgba(0, 0, 0, 0.5); padding: 7px 12px; font-size: 13px; }

#touch { display: none; }
body.mode-world #touch.touch { display: block; }
#touch .zone { position: fixed; top: 0; bottom: 0; left: 0; right: 0; touch-action: none; z-index: 8; }
/* the stick rests bottom-left, always visible; a thumb anywhere on the left half picks it up */
#touch .stick { display: block; position: fixed; left: max(22px, env(safe-area-inset-left)); bottom: max(30px, calc(env(safe-area-inset-bottom) + 18px)); width: 120px; height: 120px; border-radius: 50%; background: rgba(0, 0, 0, 0.22); border: 3px solid rgba(255, 255, 255, 0.55); pointer-events: none; z-index: 9; transition: opacity 0.2s; }
#touch .stick::after { content: 'MOVE'; position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; text-align: center; font: 700 11px var(--pixel); color: rgba(255, 255, 255, 0.8); text-shadow: 0 1px 2px #000; }
#touch .stick.active { background: rgba(255, 255, 255, 0.16); }
#touch .stick.active::after { display: none; }
#touch .knob { position: absolute; left: 33px; top: 33px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255, 255, 255, 0.75); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); }
#touch .look-hint { position: fixed; right: 110px; bottom: 60%; z-index: 9; pointer-events: none; font: 700 12px var(--pixel); color: rgba(255, 255, 255, 0.85); text-shadow: 0 1px 2px #000; text-align: center; transition: opacity 0.6s; }
#touch.looked .look-hint { opacity: 0; }
#touch .btns { position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: max(26px, calc(env(safe-area-inset-bottom) + 14px)); display: grid; grid-template-columns: repeat(2, 64px); grid-template-areas: "up fly" "down sprint" ". jump"; gap: 10px; z-index: 9; }
#touch .b-up { grid-area: up; } #touch .b-fly { grid-area: fly; } #touch .b-down { grid-area: down; } #touch .b-sprint { grid-area: sprint; } #touch .b-jump { grid-area: jump; }
#touch button { width: 64px; height: 64px; border: 2px solid var(--panel-line); background: rgba(70, 70, 70, 0.72); color: #fff; font: 700 14px var(--pixel); touch-action: none; box-shadow: inset 2px 2px 0 var(--bevel-hi), inset -2px -3px 0 var(--bevel-lo); -webkit-user-select: none; user-select: none; }
#touch button.on { background: var(--accent); color: var(--accent-ink); }
#touch .b-jump { width: 64px; height: 64px; background: rgba(95, 191, 59, 0.8); }
#touch .fly-only { visibility: hidden; }
#touch.flying .fly-only { visibility: visible; }
@media (orientation: landscape) and (max-height: 500px) {
  #touch .btns { grid-template-columns: repeat(3, 54px); grid-template-areas: "up fly sprint" "down . jump"; gap: 8px; }
  #touch button { width: 54px; height: 54px; font-size: 12px; }
  #touch .stick { width: 104px; height: 104px; }
  #touch .knob { left: 27px; top: 27px; width: 44px; height: 44px; }
}
@media (pointer: coarse) { .desk-only { display: none !important; } }
@media (max-width: 640px), (max-height: 500px) {
  .top { flex-wrap: wrap; gap: 8px; }
  .brand { font-size: 18px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .online { margin-left: auto; padding: 6px 9px; font-size: 13px; }
  .dock-tip { display: none; }
  .resume { top: calc(max(10px, env(safe-area-inset-top)) + 104px); }
  .who { display: none; }
}

/* downloads */
.dlbtn { padding: 8px 12px; white-space: nowrap; }
body.mode-dl .dock, body.mode-dl .resume, body.mode-dl .sheet, body.mode-dl .board { display: none !important; }
.dlpanel { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20; width: min(440px, calc(100% - 32px)); background: var(--panel); border: 2px solid var(--panel-line); box-shadow: inset 2px 2px 0 var(--bevel-hi), 0 8px 0 rgba(0, 0, 0, 0.25); padding: 16px; }
.dl-row { display: flex; gap: 8px; margin-bottom: 10px; }
.chip { flex: 1; font-family: var(--pixel); font-weight: 700; color: var(--text); background: #4a4a4a; border: 2px solid var(--panel-line); box-shadow: inset 2px 2px 0 var(--bevel-hi), inset -2px -3px 0 var(--bevel-lo); padding: 7px 6px; cursor: pointer; }
.chip small { display: block; font-family: system-ui, sans-serif; font-weight: 400; font-size: 11px; color: var(--muted); }
.chip.on { background: var(--accent); color: var(--accent-ink); }
.chip.on small { color: #4a3000; }
.dl-status { margin-top: 10px; font-size: 14px; }
.dl-status a.btn { display: block; text-align: center; text-decoration: none; margin-top: 8px; padding: 12px; font-size: 17px; }
.dl-status .err { color: #ffb4a8; }
.bar { height: 10px; background: #2a2a2a; border: 2px solid var(--panel-line); margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 30%; background: var(--go); animation: barmove 1.4s linear infinite; }
@keyframes barmove { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
@media (max-width: 640px), (max-height: 500px) { .dlbtn { order: 2; padding: 6px 9px; font-size: 13px; } }

/* mini map in the world */
.minimap { display: none; position: fixed; left: max(12px, env(safe-area-inset-left)); top: calc(max(10px, env(safe-area-inset-top)) + 52px); width: 200px; height: 200px; z-index: 10; border: 3px solid var(--panel-line); box-shadow: inset 0 0 0 2px var(--bevel-hi), 0 4px 0 rgba(0, 0, 0, 0.3); background: #79b04a; cursor: pointer; overflow: hidden; }
body.mode-world:not(.mode-overlay) .minimap.on { display: block; }
#minimap { position: absolute; inset: 0; }
#minimap canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
.me-arrow { position: absolute; left: 50%; top: 50%; width: 0; height: 0; margin: -11px 0 0 -8px; border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 18px solid var(--accent); filter: drop-shadow(0 0 1px #000) drop-shadow(0 0 1px #000); pointer-events: none; z-index: 2; }
@media (pointer: coarse) { .minimap { width: 118px; height: 118px; } }

.res-dot { display: inline-block; width: 11px; height: 11px; margin-right: 7px; border: 1px solid #000; vertical-align: -1px; }
#results li.res-player b { color: var(--accent); }
#results li.res-player { font-family: var(--pixel); }
#results li.res-player small { font-family: system-ui, sans-serif; }
#results li.res-none { color: var(--muted); cursor: default; }

@media (pointer: coarse) {
  .hud { gap: 6px; }
  .hudbtn { padding: 8px 10px; font-size: 13px; }
  .pill { padding: 6px 8px; font-size: 12px; }
  body.mode-world .hud .pill#nearby { display: none; }
  .minimap { top: calc(max(10px, env(safe-area-inset-top)) + 54px); }
}

/* pass + plan picker */
.passpill { cursor: pointer; color: var(--text); font-weight: 700; }
.passpill.preview { background: #8a5a12; }
.passpill.low { background: #b3261e; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { filter: brightness(1.3); } }
.paywall { position: fixed; inset: 0; z-index: 40; background: rgba(10, 14, 6, 0.72); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.pw-box { position: relative; width: min(920px, 100%); background: var(--panel); border: 3px solid var(--panel-line); box-shadow: inset 2px 2px 0 var(--bevel-hi), 0 10px 0 rgba(0, 0, 0, 0.3); padding: 22px; }
.pw-box h2 { margin: 0; font: 700 28px var(--pixel); }
.pw-sub { margin: 6px 0 16px; color: var(--muted); }
.pw-x { position: absolute; right: 10px; top: 6px; background: none; border: none; color: var(--text); font-size: 30px; cursor: pointer; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.plan { position: relative; background: rgba(255, 255, 255, 0.05); border: 2px solid var(--panel-line); padding: 14px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.plan.best { border-color: var(--accent); background: rgba(242, 166, 43, 0.1); }
.plan.focus { outline: 3px solid #fff; }
.plan-tag { position: absolute; top: -12px; background: var(--accent); color: var(--accent-ink); font: 700 12px var(--pixel); padding: 3px 8px; border: 2px solid var(--panel-line); }
.pw-fig { width: 120px; height: 150px; image-rendering: pixelated; }
.plan-name { font: 700 20px var(--pixel); margin-top: 4px; }
.plan-price { font: 700 30px var(--pixel); color: var(--accent); }
.plan-price small { font-size: 14px; color: var(--muted); }
.plan ul { list-style: none; padding: 0; margin: 10px 0 14px; font-size: 14px; flex: 1; }
.plan li { margin: 4px 0; }
.plan li::before { content: '▪ '; color: var(--go); }
.plan .btn { width: 100%; padding: 12px; font-size: 16px; }
.pw-foot { margin: 14px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
@media (max-width: 760px) {
  .paywall { place-items: start center; padding: 10px; }
  .pw-box { padding: 16px 14px; }
  .pw-box h2 { font-size: 22px; padding-right: 30px; }
  .plans { grid-template-columns: 1fr; gap: 10px; }
  .plan { display: grid; grid-template-columns: 74px 1fr; grid-template-areas: "fig name" "fig price" "list list" "go go"; text-align: left; align-items: center; column-gap: 12px; padding: 12px; }
  .plan .pw-fig { grid-area: fig; width: 74px; height: 92px; }
  .plan-name { grid-area: name; margin: 0; } .plan-price { grid-area: price; font-size: 24px; }
  .plan ul { grid-area: list; margin: 8px 0; } .plan .btn { grid-area: go; }
  .plan-tag { top: -10px; right: 10px; }
}

#land.upsell { background: var(--accent); color: var(--accent-ink); cursor: pointer; }

/* account */
.acctbtn { padding: 8px 11px; }
.ac-box { width: min(560px, 100%); }
.ac-head { display: flex; gap: 16px; align-items: center; margin-bottom: 8px; }
.ac-head .pw-fig { width: 84px; height: 105px; }
.ac-kicker { color: var(--muted); font-size: 13px; }
.ac-head h2 { display: flex; align-items: center; gap: 8px; }
.ac-head h2 i { width: 14px; height: 14px; border: 2px solid #000; display: inline-block; }
.ac-outfit { color: var(--muted); font-size: 14px; margin-top: 2px; }
.ac-sec { border-top: 2px solid rgba(255, 255, 255, 0.08); padding: 12px 0; }
.ac-label { font: 700 13px var(--pixel); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.ac-plan { font: 700 22px var(--pixel); }
.ac-status { margin: 2px 0 10px; color: var(--text); }
.ac-status.warn { color: #ffcf7a; }
.ac-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ac-row input { flex: 1 1 140px; min-width: 0; padding: 9px 10px; border: 2px solid var(--panel-line); background: rgba(0, 0, 0, 0.3); color: var(--text); font-size: 15px; }
.ac-row .btn[disabled], .ac-row input[disabled] { opacity: 0.5; cursor: not-allowed; }
.ac-confirm { margin-top: 10px; background: rgba(179, 38, 30, 0.18); border: 2px solid #b3261e; padding: 10px 12px; }
.ac-confirm p { margin: 0 0 8px; }
.btn.danger { background: #b3261e; }
.ac-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ac-big { font: 700 26px var(--pixel); color: var(--accent); }
.ac-grid small, .ac-note { color: var(--muted); font-size: 12px; display: block; margin-top: 4px; }
.ac-toggle { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; cursor: pointer; }
.ac-toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.ac-toggle small { color: var(--muted); }
#who { cursor: pointer; }
@media (max-width: 640px), (max-height: 500px) { .acctbtn { order: 2; padding: 6px 9px; font-size: 14px; } .ac-head h2 { font-size: 20px; } }

.counts { display: flex; gap: 6px; }
.online.viewing .dot { background: #4aa8ff; box-shadow: 0 0 6px #4aa8ff; }
@media (max-width: 640px), (max-height: 500px) { .counts { margin-left: auto; gap: 4px; } .counts .online { margin-left: 0; } }

/* in-world map overlay bar + mini map controls */
.overlay-bar { gap: 8px; }
.overlay-bar .btn { padding: 9px 13px; }
.overlay-bar .ov-hint { font-family: var(--pixel); background: var(--panel); border: 2px solid var(--panel-line); padding: 7px 10px; }
@media (max-width: 640px), (max-height: 500px) { .overlay-bar .ov-hint { display: none; } }
.mm-x { position: absolute; right: 2px; top: 2px; z-index: 3; width: 26px; height: 26px; border: 2px solid var(--panel-line); background: rgba(28, 34, 22, 0.85); color: #fff; font: 700 16px/1 var(--pixel); cursor: pointer; padding: 0; }
.mm-open { position: absolute; left: 4px; bottom: 2px; z-index: 3; color: #fff; font: 700 16px var(--pixel); text-shadow: 0 1px 2px #000; pointer-events: none; }
.mm-show { display: none; position: fixed; left: max(12px, env(safe-area-inset-left)); top: calc(max(10px, env(safe-area-inset-top)) + 54px); z-index: 10; padding: 6px 9px; }
body.mode-world:not(.mode-overlay).mm-off .mm-show { display: block; }
body.mm-off .minimap { display: none !important; }

.swatches { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; margin: 4px 0 8px; }
.sw { aspect-ratio: 1; border: 2px solid var(--panel-line); box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.25), inset -2px -2px 0 rgba(0, 0, 0, 0.3); cursor: pointer; padding: 0; min-width: 0; }
.sw.on { outline: 3px solid #fff; outline-offset: 1px; }
.ac-custom { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); cursor: pointer; }
.ac-custom input { width: 40px; height: 28px; border: 2px solid var(--panel-line); padding: 0; background: none; cursor: pointer; }
@media (max-width: 640px), (max-height: 500px) { .swatches { grid-template-columns: repeat(8, 1fr); } }

/* compact screens (phones, portrait or landscape): nothing overlaps, nothing runs off */
@media (max-width: 640px), (max-height: 500px) {
  .resume { left: 12px; right: 12px; transform: none; justify-content: center; }
  .resume button { padding: 8px 12px; font-size: 13px; }
  body.board-open .resume, body.sheet-open .resume, body.mode-dl .resume { display: none !important; }
  body.board-open .maplibregl-ctrl-bottom-left, body.sheet-open .maplibregl-ctrl-bottom-left, body.mode-dl .maplibregl-ctrl-bottom-left { display: none; }
  body.sheet-open .dock, body.board-open .attrib, body.sheet-open .attrib, body.mode-dl .attrib { display: none; }
  .hud { flex-wrap: nowrap; gap: 5px; padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
  .hud .lbl { display: none; }
  .hudbtn { padding: 7px 9px; font-size: 14px; flex: none; }
  .hud .pill { padding: 6px 7px; font-size: 12px; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .hud .spacer { min-width: 0; }
  .sheet, .dlpanel { bottom: max(12px, env(safe-area-inset-bottom)); }
  .sheet .sheet-row .btn { padding: 10px; font-size: 16px; }
  .overlay-bar .btn { padding: 8px 10px; font-size: 14px; }
}
@media (max-width: 360px) {
  .brand span:last-child { font-size: 16px; }
  .counts .online { font-size: 11px; padding: 5px 6px; }
  .acctbtn, .trophy, .dlbtn { padding: 5px 7px; font-size: 12px; }
  .hud #land { display: none; }
}
@media (max-height: 500px) {
  .top { padding-top: max(6px, env(safe-area-inset-top)); }
  .search { order: 0; flex-basis: auto; max-width: 300px; }
  .minimap { width: 100px; height: 100px; top: calc(max(6px, env(safe-area-inset-top)) + 46px); }
  .dlpanel, .sheet { max-height: calc(100vh - 70px); overflow-y: auto; }
  .board { max-height: calc(100vh - 96px); }
}

.pw-box { min-width: 0; max-width: 100%; }
.ac-head { min-width: 0; } .ac-head > div { min-width: 0; } .ac-head h2 span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* phones pinch to zoom; keep the credits on one short line clear of the dock */
@media (pointer: coarse) { .maplibregl-ctrl-bottom-left { display: none; } }
@media (max-width: 640px), (max-height: 500px) {
  .attrib { right: 110px; font-size: 10px; line-height: 1.3; }
  .attrib .long { display: none; }
}

/* your avatar on the map */
.avatar-img { display: block; image-rendering: pixelated; pointer-events: none; }
.dropper .avatar-img { width: 44px; height: 66px; filter: drop-shadow(2px 3px 0 rgba(0, 0, 0, 0.45)); transition: transform 0.15s; }
.dropper:hover .avatar-img { transform: translateY(-3px); }
.pin .pin-fig .avatar-img, .drag-ghost .avatar-img { width: 100%; height: 100%; filter: drop-shadow(2px 3px 0 rgba(0, 0, 0, 0.45)); }

.ac-code { font: 700 30px var(--pixel); letter-spacing: 0.18em; color: var(--accent); margin: 6px 0 8px; }
.ac-share { margin-top: 8px; }
#ac-link { font-size: 13px; }

.pw-agree { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 14px; background: rgba(0, 0, 0, 0.25); border: 2px solid var(--panel-line); padding: 10px 12px; font-size: 13px; line-height: 1.45; color: var(--text); cursor: pointer; }
.pw-agree input { width: 20px; height: 20px; flex: none; margin-top: 1px; accent-color: var(--go); }
.pw-agree.need { outline: 2px solid #ffb4a8; outline-offset: 4px; }
.plans.locked .plan-go:not([disabled]) { opacity: 0.55; }
.pw-agree a { color: var(--accent); }

/* ===== phones (portrait or landscape): the lobby header, chips, sheets and modals ===== */
.pw-x, .ac-box .pw-x { z-index: 3; }
.ac-note a, .pw-sub a { color: var(--accent); }
body.mode-world:not(.playing) #touch { display: none !important; }
@media (max-width: 640px), (max-height: 500px) {
  .top {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; grid-template-areas: "brand dl board acct" "search search counts counts";
    gap: 8px; align-items: center; padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left));
  }
  .brand { grid-area: brand; font-size: 18px; min-width: 0; overflow: hidden; }
  .brand > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .logo { width: 22px; height: 22px; flex: none; }
  .top .lbl { display: none; }
  #b-dl { grid-area: dl; } #b-board { grid-area: board; } #b-account { grid-area: acct; }
  #b-dl, #b-board, #b-account { order: 0; width: 40px; height: 38px; padding: 0; font-size: 17px; display: grid; place-items: center; }
  .search { grid-area: search; order: 0; max-width: none; min-width: 0; }
  .search input { padding: 9px 10px; font-size: 16px; } /* 16px: iOS does not zoom the page on focus */
  .counts { grid-area: counts; margin: 0; gap: 4px; }
  .counts .online { padding: 8px 8px; font-size: 13px; }
  .counts .online .dot { margin-right: 4px; }
  #results { left: 0; right: -110px; }
  .resume { top: auto !important; bottom: max(44px, calc(env(safe-area-inset-bottom) + 34px)); left: max(10px, env(safe-area-inset-left)); right: 96px; transform: none; justify-content: flex-start; }
  .resume button { font-size: 13px; padding: 8px 10px; }
  .dock { bottom: max(30px, calc(env(safe-area-inset-bottom) + 22px)); right: max(10px, env(safe-area-inset-right)); }
  .dropper { width: 62px; height: 78px; }
  .attrib { left: max(8px, env(safe-area-inset-left)); right: 90px; bottom: max(6px, env(safe-area-inset-bottom)); }
  /* modals: full-screen sheets, close button always reachable */
  .paywall { padding: 0; place-items: stretch; }
  .pw-box { width: 100%; min-height: 100%; border: none; box-shadow: none; padding: calc(max(14px, env(safe-area-inset-top)) + 36px) 14px max(24px, env(safe-area-inset-bottom)); }
  .pw-x { position: fixed; top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); width: 40px; height: 40px; background: rgba(14, 18, 10, 0.92); border: 2px solid var(--panel-line); font-size: 24px; line-height: 1; display: grid; place-items: center; padding: 0; }
  .pw-box h2 { font-size: 21px; padding-right: 44px; }
  #joinbox .pw-box, #namebox .pw-box { min-height: 0; margin: auto 0 0; border-top: 2px solid var(--panel-line); }
  #joinbox, #namebox { place-items: end stretch; }
  .ac-head { gap: 12px; }
  .ac-row input { font-size: 16px; }
  .sheet, .dlpanel { left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); width: auto; transform: none; }
}
@media (max-width: 380px) {
  .brand-a { display: none; }
  .counts .online { padding: 7px 6px; font-size: 12px; }
}
@media (max-height: 500px) {
  .top { grid-template-columns: auto minmax(0, 1fr) auto auto auto auto; grid-template-areas: "brand search counts dl board acct"; }
  .search { max-width: none; }
  .brand-a { display: none; }
}

@media (max-width: 640px) {
  /* two-line brand: a small "Map2Minecraft" over "Explorer" */
  .brand > span { display: flex; flex-direction: column; line-height: 1; }
  .brand-a { font-size: 10px; letter-spacing: 0.04em; color: var(--muted); display: block !important; margin-bottom: 2px; }
  .brand b { margin-left: 0; font-size: 19px; }
}
@media (max-width: 640px), (max-height: 500px) {
  #results { left: 0; right: auto; width: calc(100vw - 2 * max(10px, env(safe-area-inset-left))); }
}
@media (max-height: 500px) { #results { left: 0; right: 0; width: auto; } }

/* the waiting line */
.online.waiting .dot { background: #f2a62b; box-shadow: 0 0 6px #f2a62b; }
.lobby-box { text-align: center; }
.lobby-pos { font: 700 64px/1 var(--pixel); color: var(--accent); margin: 6px 0 2px; }
.lobby-pos small { display: block; font-size: 15px; color: var(--muted); margin-top: 4px; }
.lobby-total { font-family: var(--pixel); margin: 8px 0 10px; }
@media (max-width: 640px), (max-height: 500px) { #lobby .pw-box { min-height: 0; margin: auto 0; } #lobby { place-items: center stretch; } }

/* loading: a veil over everything with one centred card; nothing else on screen until you can move */
.loading { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh; margin: 0; padding: 16px; box-sizing: border-box; z-index: 25; display: flex; align-items: center; justify-content: center; background: rgba(12, 18, 8, 0.55); pointer-events: auto; }
.loading-card { flex: none; width: min(360px, 100%); margin: 0; padding: 22px 22px 18px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.loading-card > * { width: 100%; text-align: center; }
.loader { width: 36px !important; height: 36px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 0 auto 14px; animation: pulse 1s ease-in-out infinite; }
.loader i { display: block; background: var(--accent); box-shadow: inset 2px 2px 0 var(--bevel-hi), inset -2px -2px 0 var(--bevel-lo); }
.loader i:nth-child(2) { background: var(--go); } .loader i:nth-child(3) { background: #3b6fd8; } .loader i:nth-child(4) { background: #b07a52; }
@keyframes pulse { 0%, 100% { transform: scale(0.82) rotate(0deg); } 50% { transform: scale(1.12) rotate(90deg); } }
.loadbar { height: 10px; background: #20261a; border: 2px solid var(--panel-line); margin: 12px 0 2px; overflow: hidden; }
.loadbar i { display: block; height: 100%; width: 6%; background: var(--go); transition: width 0.4s ease; }
body.mode-world:not(.playing) .hud, body.mode-world:not(.playing) .minimap, body.mode-world:not(.playing) .mm-show, body.mode-world:not(.playing) .help { display: none !important; }

@media (max-width: 640px), (max-height: 500px) { #dupbox .pw-box { min-height: 0; margin: auto 0; } #dupbox { place-items: center stretch; } }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
