:root {
  --cream: #fffaf0;
  --cream-2: #f3ecd9;
  --ink: #3f4a3c;
  --ink-soft: #7d8873;
  --leaf: #6f9f5b;
  --leaf-soft: #e6f0dc;
  --shadow: 0 6px 22px rgba(60, 80, 40, .18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #a4d07a;
  color: var(--ink);
  font-family: "Baloo 2", "Nunito", "Segoe UI Rounded", "Segoe UI", system-ui, sans-serif;
  font-weight: 500;
  -webkit-user-select: none;
  user-select: none;
}

#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; }
#world.dragging { cursor: grabbing; }
#world.pointing { cursor: pointer; }

svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button { font: inherit; color: inherit; cursor: pointer; }

.panel, .pill, .round { background: var(--cream); box-shadow: var(--shadow); }
.panel { border-radius: 24px; }
.pill { border-radius: 999px; }

.stats { position: fixed; top: 18px; left: 18px; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 7px 18px; font-size: 14px; color: var(--ink-soft); }
.stats b { font-size: 17px; color: var(--ink); }
.stats i { width: 1px; height: 18px; background: var(--cream-2); }

.controls { position: fixed; top: 18px; right: 18px; z-index: 5; display: flex; gap: 10px; }
.round { width: 42px; height: 42px; border: 0; border-radius: 50%; display: grid; place-items: center; transition: transform .1s; }
.round:active { transform: scale(.94); }
#btnMusic .on { display: none; }
#btnMusic[aria-pressed="true"] .on { display: inline; }
#btnMusic[aria-pressed="true"] .off { display: none; }

.tooltip { position: fixed; z-index: 6; pointer-events: none; transform: translate(-50%, calc(-100% - 14px)); display: flex; flex-direction: column; align-items: center; padding: 6px 14px 7px; border-radius: 16px; background: var(--cream); box-shadow: var(--shadow); line-height: 1.2; white-space: nowrap; }
.tooltip b { font-size: 15px; }
.tooltip span { font-size: 12px; color: var(--ink-soft); }
.tooltip small { font-size: 11px; color: var(--leaf); }

.profile { position: fixed; top: 18px; left: 18px; z-index: 8; width: 268px; max-height: calc(100% - 36px); overflow: auto; padding: 22px 20px 20px; -webkit-user-select: text; user-select: text; }
.close { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; font-size: 22px; line-height: 1; color: var(--ink-soft); }
.close:hover { background: var(--cream-2); }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--ink-soft); }
.identity { display: flex; align-items: center; gap: 12px; margin: 12px 0 10px; }
.identity canvas { width: 68px; height: 68px; flex: none; border-radius: 18px; background: var(--leaf-soft); }
.identity h2 { margin: 0; font-size: 20px; line-height: 1.15; word-break: break-all; }
.identity a { font-size: 13px; color: var(--ink-soft); text-decoration: underline; text-decoration-color: #c9d2bd; text-underline-offset: 3px; word-break: break-all; }
.identity a:hover { color: var(--leaf); }
.activity { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding-bottom: 12px; border-bottom: 1px solid var(--cream-2); font-size: 13px; color: var(--ink-soft); }
.activity i { width: 6px; height: 6px; border-radius: 50%; background: var(--leaf); flex: none; }
.goal { margin-bottom: 12px; padding: 10px 12px; border: 1px solid #d5e3c8; border-radius: 16px; background: var(--leaf-soft); font-size: 13px; }
.goal summary { cursor: pointer; list-style: none; display: flex; flex-direction: column; position: relative; padding-right: 18px; }
.goal summary::-webkit-details-marker { display: none; }
.goal summary::after { content: "⌄"; position: absolute; right: 0; top: 6px; color: var(--ink-soft); }
.goal[open] summary::after { content: "⌃"; }
.goal summary small { font-size: 11px; color: var(--ink-soft); }
.goal summary span { font-size: 14px; font-weight: 700; }
.goal ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.45; }
.request { margin-top: 10px; padding: 10px; border-radius: 12px; background: var(--cream); }
.request p { margin: 4px 0 0; line-height: 1.45; }
.profile dl { margin: 0 0 14px; font-size: 13px; }
.profile dl div { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; }
.profile dt { color: var(--ink-soft); }
.profile dd { margin: 0; text-align: right; }
.follow { padding: 7px 18px; border: 1px solid #d5e3c8; border-radius: 999px; background: var(--leaf-soft); font-weight: 700; font-size: 14px; }
.follow[aria-pressed="true"] { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.link { padding: 0; border: 0; background: none; font-size: inherit; text-align: right; text-decoration: underline; text-decoration-color: #c9d2bd; text-underline-offset: 3px; word-break: break-all; }
.link:hover:not(:disabled) { color: var(--leaf); }
.link:disabled { text-decoration: none; cursor: default; }
.btitle { margin: 10px 0 8px; font-size: 21px; line-height: 1.2; }
#bBar { width: 100%; height: 6px; margin: 0 0 12px; border: 0; border-radius: 4px; overflow: hidden; appearance: none; -webkit-appearance: none; background: var(--cream-2); }
#bBar::-webkit-progress-bar { background: var(--cream-2); }
#bBar::-webkit-progress-value { background: var(--leaf); border-radius: 4px; }
#bBar::-moz-progress-bar { background: var(--leaf); }
.members { margin: 0 0 10px; padding: 0; list-style: none; font-size: 13px; }
.members li { display: flex; flex-direction: column; padding: 7px 0; border-top: 1px solid var(--cream-2); }
.members button { padding: 0; border: 0; background: none; font-weight: 700; text-align: left; text-decoration: underline; text-decoration-color: #c9d2bd; text-underline-offset: 3px; }
.members span { color: var(--ink-soft); }
.note { margin: 0 0 6px; font-size: 12px; color: var(--ink-soft); }
.emptyworld { position: fixed; z-index: 4; left: 50%; top: 42%; transform: translate(-50%, -50%); padding: 10px 22px; font-size: 15px; text-align: center; }
.rare { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 999px; background: #fde9a8; font-size: 11px; font-weight: 700; }

.search { position: fixed; z-index: 7; left: 50%; bottom: 22px; transform: translateX(-50%); width: min(392px, calc(100% - 32px)); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.searchbar { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 16px; color: var(--ink-soft); }
.searchbar input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-size: 16px; color: var(--ink); -webkit-user-select: text; user-select: text; }
.searchbar input::-webkit-search-cancel-button { display: none; }
.searchbar kbd { padding: 0 7px; border: 1px solid var(--cream-2); border-radius: 6px; font: inherit; font-size: 12px; }
.results { width: 100%; padding: 14px 10px 8px; }
.results .head { padding: 0 8px 6px; font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--ink-soft); }
.results button { display: flex; flex-direction: column; width: 100%; padding: 6px 10px; border: 0; border-radius: 12px; background: none; text-align: left; line-height: 1.2; }
.results button:hover, .results button.active { background: var(--leaf-soft); }
.results button b { font-size: 15px; }
.results button span { font-size: 12px; color: var(--ink-soft); }
.results .empty { padding: 4px 10px 8px; font-size: 14px; color: var(--ink-soft); }
.following { display: flex; align-items: center; gap: 8px; padding: 5px 8px 5px 14px; font-size: 14px; }
.following i { width: 8px; height: 8px; border-radius: 50%; background: var(--leaf); }
.following button { width: 24px; height: 24px; border: 0; border-radius: 50%; background: var(--cream-2); line-height: 1; }

.demo { position: fixed; z-index: 4; left: 18px; bottom: 22px; padding: 4px 14px; font-size: 12px; color: var(--ink-soft); }

.loading { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: #b9dc9a; transition: opacity .5s; }
.loading.done { opacity: 0; pointer-events: none; }
.loading h1 { margin: 8px 0 0; font-size: 34px; }
.loading p { margin: 0; color: var(--ink-soft); }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .6); border-top-color: var(--leaf); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

[hidden] { display: none !important; }

@media (max-width: 640px) {
  .profile { left: 10px; right: 10px; top: 10px; width: auto; max-height: 62%; }
  .demo { display: none; }
  .searchbar kbd { display: none; }
}
