:root {
  --sky: #bfe3f2; --sea: #5fb2df; --ink: #1a1a1a; --pill: #1d2433; --yellow: #ffd23f; --blue: #2f6fe0; --orange: #ff8a1f;
  --card: #ffffff; --muted: #6b7280; --r: 22px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--sea); font-family: "Rubik", system-ui, sans-serif; color: var(--ink); -webkit-tap-highlight-color: transparent; }
#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
button, input { font: inherit; }
:focus-visible { outline: 4px solid var(--yellow); outline-offset: 2px; }

#loading { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--sky); transition: opacity .5s; }
#loading.done { opacity: 0; pointer-events: none; }
.ld-title { font-weight: 900; font-size: clamp(26px, 6vw, 44px); color: #fff; -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; }
.ld-msg { font-weight: 700; font-size: 18px; color: var(--pill); min-height: 1.4em; }
.ld-bar { width: min(280px, 70vw); height: 14px; border-radius: 10px; background: #fff; border: 3px solid var(--ink); overflow: hidden; }
.ld-bar i { display: block; height: 100%; width: 0; background: var(--yellow); transition: width .3s; }

#top { position: fixed; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 10; text-align: center; pointer-events: none; width: calc(100% - 24px); }
.brand { display: inline-block; font-weight: 900; font-size: clamp(26px, 6.5vw, 40px); color: var(--yellow); -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 rgba(0,0,0,.25); }
.stats { margin-top: 6px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.stats span { background: var(--pill); color: #fff; border-radius: 30px; padding: 5px 14px 6px; font-weight: 700; font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.stats b { color: var(--yellow); font-weight: 800; }

#panel { position: fixed; z-index: 20; left: 50%; transform: translateX(-50%); bottom: max(12px, env(safe-area-inset-bottom)); width: min(440px, calc(100% - 20px)); max-height: 58vh; overflow: auto;
  background: var(--card); border: 4px solid var(--ink); border-radius: var(--r); box-shadow: 0 14px 34px rgba(0,0,0,.3); padding: 12px 14px 14px; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs button { flex: 1; border: 3px solid var(--ink); background: #f3f4f6; border-radius: 14px; padding: 7px 4px; font-weight: 800; font-size: 14px; cursor: pointer; }
.tabs button.on { background: var(--yellow); }
.q-label { display: block; font-weight: 900; font-size: 24px; margin-bottom: 6px; }
.search { display: flex; align-items: center; border: 3px solid var(--ink); border-radius: 16px; padding: 0 12px; background: #fff; direction: ltr; }
.search .at { font-weight: 900; font-size: 22px; color: var(--muted); }
.search input { flex: 1; border: 0; outline: 0; padding: 11px 6px; font-size: 19px; font-weight: 700; background: transparent; min-width: 0; }
.hint { font-size: 13px; color: var(--muted); margin-top: 5px; }
#results { list-style: none; margin-top: 8px; }
#results li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 12px; cursor: pointer; font-weight: 700; }
#results li:hover, #results li[aria-selected="true"] { background: #fff6d1; }
#results .h { direction: ltr; }
#results .c { color: var(--muted); font-size: 14px; }
.empty { color: var(--muted); padding: 8px 4px; font-size: 15px; }

#card { margin-top: 10px; border: 3px solid var(--ink); border-radius: 18px; padding: 12px 14px; background: #fffdf3; }
#card .who { direction: ltr; text-align: right; font-weight: 900; font-size: 22px; }
#card .addr { font-weight: 800; font-size: 18px; margin-top: 4px; }
#card .meta { color: var(--muted); font-size: 14px; margin-top: 3px; }
#card .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.badge { display: inline-block; border: 3px solid var(--ink); border-radius: 12px; padding: 1px 10px 3px; font-weight: 800; font-size: 14px; }
.badge.founder { background: var(--yellow); }
.badge.garden { background: #b8f0a0; }
.badge.nogarden { background: #eee; }
#card .actions { display: flex; gap: 8px; margin-top: 10px; }
#card .actions a, #card .actions button { flex: 1; text-align: center; text-decoration: none; color: #fff; background: var(--pill); border: 0; border-radius: 14px; padding: 10px 6px; font-weight: 800; font-size: 15px; cursor: pointer; }
#card .actions .dm { background: linear-gradient(135deg, #8a3ab9, #e95950, #fccc63); }

ol { list-style: none; counter-reset: n; }
#cities li, #founders li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 8px; padding: 8px 6px; border-bottom: 2px dashed #e5e7eb; cursor: pointer; font-weight: 700; }
#cities li:hover, #founders li:hover { background: #fff6d1; }
#cities .rk, #founders .rk { font-weight: 900; color: var(--muted); text-align: center; }
#cities .cnt { background: var(--pill); color: var(--yellow); border-radius: 20px; padding: 2px 10px; font-size: 14px; }
#founders .fu { direction: ltr; color: var(--blue); font-size: 14px; }
#fq { width: 100%; border: 3px solid var(--ink); border-radius: 14px; padding: 8px 12px; font-size: 16px; margin-bottom: 6px; }

#labels { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
#labels .lb { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; font-weight: 800; font-size: 13px; color: #fff; background: rgba(29,36,51,.86); border-radius: 12px; padding: 2px 9px 3px; }
#labels .lb b { color: var(--yellow); }
#labels .me { background: var(--yellow); color: var(--ink); border: 3px solid var(--ink); font-size: 16px; padding: 4px 12px 6px; direction: ltr; }

#foot { margin-top: 10px; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); }
#foot a { color: var(--pill); }
@media (max-width: 520px) { .stats span { font-size: 12px; padding: 4px 10px; } }
.gamebtn { display: inline-block; margin-top: 8px; pointer-events: auto; background: #e5263b; color: #fff; text-decoration: none; font-weight: 900; font-size: 15px; border: 3px solid var(--ink); border-radius: 22px; padding: 4px 14px 6px; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
