/* Spectator overlay for the living town, styled like an old city-builder: solid
   panels with a dark edge and a hard drop shadow, bevelled buttons, a pixel face
   for labels and numbers, and a plain sans for reading. Night variants follow
   the viewer's data-time. */
:root {
  --w-ui: "Pixelify Sans", "Courier New", monospace;
  --w-text: "IBM Plex Sans", system-ui, sans-serif;
  --w-r: 3px;
  --w-card: #f3e9d2;
  --w-card-solid: #fbf5e6;
  --w-ink: #2b2118;
  --w-ink-soft: #5f4b38;
  --w-ink-faint: #8c765f;
  --w-line: rgba(43, 33, 24, 0.2);
  --w-edge: #2b2118;
  --w-accent: #2f6d8c;
  --w-accent-soft: rgba(47, 109, 140, 0.14);
  --w-gold: #e3b341;
  --w-good: #3f7f3a;
  --w-bad: #b23b2a;
  --w-shadow: 3px 3px 0 rgba(43, 33, 24, 0.85);
  --w-bevel: inset -2px -2px 0 rgba(43, 33, 24, 0.2), inset 2px 2px 0 rgba(255, 255, 255, 0.8);
  --w-sunk: inset 2px 2px 0 rgba(43, 33, 24, 0.25), inset -2px -2px 0 rgba(255, 255, 255, 0.4);
  --w-portrait-bg: #cfe2ec;
  --w-bubble: #fffdf6;
}
[data-time="night"] {
  --w-card: #1f2a40;
  --w-card-solid: #283550;
  --w-ink: #f3e8d2;
  --w-ink-soft: #c3cadb;
  --w-ink-faint: #8e98ae;
  --w-line: rgba(195, 202, 219, 0.2);
  --w-edge: #070b14;
  --w-accent: #7cc0dd;
  --w-accent-soft: rgba(124, 192, 221, 0.16);
  --w-good: #7fc070;
  --w-bad: #ef7a64;
  --w-shadow: 3px 3px 0 #04070d;
  --w-bevel: inset -2px -2px 0 rgba(0, 0, 0, 0.35), inset 2px 2px 0 rgba(255, 255, 255, 0.1);
  --w-sunk: inset 2px 2px 0 rgba(0, 0, 0, 0.35), inset -2px -2px 0 rgba(255, 255, 255, 0.06);
  --w-portrait-bg: #3a4a68;
  --w-bubble: #f7efe0;
}

#world-clock, #world-panel, #world-labels { font-family: var(--w-text); color: var(--w-ink); }
#world-clock[hidden], #world-panel[hidden] { display: none; }

/* --- clock ----------------------------------------------------------------- */
#world-clock {
  position: fixed; z-index: 3; top: max(24px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 18px;
  border: 1px solid var(--w-line); border-radius: var(--w-r); background: var(--w-card);
  box-shadow: var(--w-shadow);
  font-size: 13px; font-weight: 800; letter-spacing: 0.02em; white-space: nowrap; user-select: none;
}
#world-clock .time { font-family: var(--w-ui); font-size: 19px; font-weight: 500; font-variant-numeric: tabular-nums; }
#world-clock .sep { width: 1px; height: 18px; background: var(--w-line); }
#world-clock .soft { color: var(--w-ink-soft); font-weight: 700; }
#world-clock .brain { display: inline-flex; align-items: center; gap: 6px; color: var(--w-ink-soft); font-weight: 700; }
#world-clock .dot { width: 8px; height: 8px; border-radius: 1px; background: var(--w-ink-faint); }
#world-clock .dot.live { background: #6db35c; box-shadow: 0 0 0 3px rgba(109, 179, 92, 0.18); }
#world-clock .relight {
  border: 0; background: var(--w-accent-soft); color: var(--w-ink); font: inherit; font-size: 11px;
  border-radius: var(--w-r); padding: 4px 9px; cursor: pointer;
}

/* --- panel ----------------------------------------------------------------- */
#world-panel {
  position: fixed; z-index: 3; right: max(24px, env(safe-area-inset-right)); top: calc(max(24px, env(safe-area-inset-top)) + 60px);
  width: 344px; max-height: calc(100vh - 112px); display: flex; flex-direction: column;
  border: 1px solid var(--w-line); border-radius: var(--w-r); background: var(--w-card);
  box-shadow: var(--w-shadow);
  overflow: hidden;
}
#world-panel .tabs { display: flex; gap: 4px; padding: 8px 8px 0; border-bottom: 1px solid var(--w-line); }
#world-panel .tabs button {
  flex: 1; border: 0; background: none; color: var(--w-ink-soft); font: 800 12.5px var(--w-text);
  letter-spacing: 0.02em; padding: 9px 6px 11px; cursor: pointer; border-bottom: 2px solid transparent;
}
#world-panel .tabs button[aria-selected="true"] { color: var(--w-ink); border-bottom-color: var(--w-accent); }
#world-panel .tabs button:focus-visible, #world-panel button:focus-visible { outline: 2px solid var(--w-accent); outline-offset: 2px; }
#world-panel .grip { display: none; }
#world-panel .body { overflow-y: auto; overscroll-behavior: contain; padding: 6px 0 10px; }
#world-panel .body::-webkit-scrollbar { width: 8px; }
#world-panel .body::-webkit-scrollbar-thumb { background: var(--w-line); border-radius: var(--w-r); }
#world-panel .empty { padding: 18px; color: var(--w-ink-soft); font-size: 13px; text-align: center; }

/* residents */
.w-row {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 14px; border: 0; background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.w-row:hover { background: var(--w-accent-soft); }
/* A pixel portrait (icons.js) on a square of sky. */
.w-avatar {
  flex: none; box-sizing: border-box; width: 36px; height: 36px; display: grid; place-items: center; overflow: hidden;
  border: 2px solid var(--w-edge); border-radius: 2px; background: var(--w-portrait-bg); color: var(--w-ink);
}
.w-avatar svg { width: 100%; height: 100%; display: block; }
.w-row .who { min-width: 0; flex: 1; }
.w-row .name { font-weight: 800; font-size: 13.5px; display: flex; gap: 6px; align-items: baseline; }
.w-row .name small { color: var(--w-ink-faint); font-weight: 700; font-size: 11px; }
.w-row .doing { color: var(--w-ink-soft); font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Mood: five pixels, filled from the left. */
.w-mood { display: inline-flex; gap: 2px; flex: none; vertical-align: middle; }
.w-mood i { width: 4px; height: 11px; background: var(--w-line); }
.w-mood.l1 i.on, .w-mood.l2 i.on { background: var(--w-bad); }
.w-mood.l3 i.on { background: var(--w-gold); }
.w-mood.l4 i.on, .w-mood.l5 i.on { background: var(--w-good); }
.w-now .w-mood { margin-right: 4px; }

/* feed */
.w-event { padding: 9px 16px; border-bottom: 1px solid var(--w-line); font-size: 13px; line-height: 1.4; }
.w-event:last-child { border-bottom: 0; }
.w-event .meta { color: var(--w-ink-faint); font-size: 10.5px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 2px; display: flex; gap: 6px; }
.w-event .meta .grok { color: var(--w-accent); }
.w-event.minor { color: var(--w-ink-soft); font-size: 12px; }
.w-event.big { background: var(--w-accent-soft); }
.w-event .lines { margin: 6px 0 2px; padding-left: 10px; border-left: 2px solid var(--w-line); display: grid; gap: 3px; }
.w-event .lines b { font-weight: 800; }
.w-event button.more { border: 0; background: none; color: var(--w-accent); font: 800 11.5px var(--w-text); padding: 2px 0; cursor: pointer; }
.w-link { border: 0; background: none; padding: 0; color: inherit; font: inherit; font-weight: 800; cursor: pointer; text-decoration: underline; text-decoration-color: var(--w-line); text-underline-offset: 2px; }
.w-link:hover { text-decoration-color: var(--w-accent); }
.w-filter { display: flex; gap: 6px; padding: 6px 14px 8px; flex-wrap: wrap; }
.w-chip {
  border: 1px solid var(--w-line); background: none; color: var(--w-ink-soft); border-radius: var(--w-r);
  font: 800 11px var(--w-text); padding: 4px 10px; cursor: pointer;
}
.w-chip[aria-pressed="true"] { background: var(--w-accent-soft); color: var(--w-ink); border-color: transparent; }

/* places */
.w-subhead { padding: 10px 16px 4px; font-size: 10.5px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--w-ink-faint); }
.w-place .count { margin-left: auto; color: var(--w-ink-soft); font-weight: 800; font-size: 12px; }
.w-icon { flex: none; width: 34px; height: 34px; border-radius: var(--w-r); display: grid; place-items: center; background: var(--w-accent-soft); font-size: 17px; }

/* profile & place cards */
.w-card { padding: 4px 16px 6px; }
.w-back { border: 0; background: none; color: var(--w-ink-soft); font: 800 12px var(--w-text); padding: 8px 0; cursor: pointer; }
.w-head { display: flex; gap: 12px; align-items: center; margin: 2px 0 10px; }
.w-head .w-avatar { width: 52px; height: 52px; border-width: 3px; }
.w-head h2 { margin: 0; font-family: var(--w-ui); font-weight: 500; font-size: 23px; line-height: 1.1; }
.w-head p { margin: 3px 0 0; color: var(--w-ink-soft); font-size: 12px; font-weight: 700; }
.w-actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.w-btn {
  border: 1px solid var(--w-line); background: var(--w-card-solid); color: var(--w-ink); border-radius: var(--w-r);
  font: 800 12px var(--w-text); padding: 6px 12px; cursor: pointer;
}
.w-btn[aria-pressed="true"] { background: var(--w-accent); color: var(--w-card-solid); border-color: transparent; }
.w-section { margin: 12px 0 0; }
.w-section h3 { margin: 0 0 5px; font-size: 10.5px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--w-ink-faint); }
.w-section p { margin: 0; font-size: 13px; line-height: 1.45; }
.w-quote { font-family: var(--w-text); font-style: italic; font-size: 14px !important; color: var(--w-ink); }
.w-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.w-tag { background: var(--w-accent-soft); border-radius: var(--w-r); padding: 3px 9px; font-size: 11.5px; font-weight: 700; }
.w-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 12.5px; }
.w-stats b { display: block; font-size: 15px; }
.w-bars { display: grid; gap: 5px; }
.w-bar { display: grid; grid-template-columns: 74px 1fr; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; color: var(--w-ink-soft); }
.w-bar i { display: block; height: 7px; border-radius: var(--w-r); background: var(--w-line); overflow: hidden; }
.w-bar i span { display: block; height: 100%; border-radius: inherit; background: var(--w-good); }
.w-bar i span.low { background: var(--w-bad); }
.w-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: 12.5px; line-height: 1.4; }
.w-list li { display: flex; gap: 8px; align-items: baseline; }
.w-list li small { color: var(--w-ink-faint); font-weight: 800; flex: none; }
.w-rel { display: flex; align-items: center; gap: 8px; }
.w-rel .label { color: var(--w-ink-soft); font-size: 11.5px; font-weight: 800; }
.w-rel .aff { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 800; font-size: 11.5px; }

/* --- labels, bubbles and building chips over the 3D scene ---------------------- */
#world-labels { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.w-label, .w-bubble, .w-chip3d { position: absolute; left: 0; top: 0; will-change: transform; }
.w-label {
  padding: 2px 8px 2px 6px; border-radius: var(--w-r); background: var(--w-card); color: var(--w-ink);
  font-size: 11px; font-weight: 800; white-space: nowrap; box-shadow: var(--w-shadow);
  display: flex; align-items: center; gap: 5px; transform-origin: 50% 100%;
}
.w-label i { width: 8px; height: 8px; border-radius: 1px; }
.w-label.selected { outline: 2px solid var(--w-accent); }
.w-bubble {
  max-width: 230px; padding: 7px 11px; border-radius: var(--w-r); background: var(--w-bubble); color: #3f2f22;
  font-size: 12.5px; font-weight: 600; line-height: 1.35; box-shadow: var(--w-shadow);
  transition: opacity 0.25s ease;
}
.w-bubble::after {
  content: ""; position: absolute; left: 18px; bottom: -7px; border: 7px solid transparent; border-bottom: 0; border-top-color: var(--w-bubble);
}
.w-bubble b { font-weight: 800; }
.w-bubble.typing { font-size: 16px; letter-spacing: 2px; padding: 3px 12px 6px; }
.w-chip3d {
  pointer-events: auto; cursor: pointer; display: flex; align-items: center; gap: 4px;
  padding: 3px 8px 3px 6px; border-radius: var(--w-r); border: 1px solid var(--w-line);
  background: var(--w-card); color: var(--w-ink); font: 800 11px var(--w-text);
  box-shadow: var(--w-shadow);
}
.w-chip3d .dots { display: flex; }
.w-chip3d .dots i { width: 9px; height: 9px; border-radius: 1px; margin-left: -3px; box-shadow: 0 0 0 1.5px var(--w-card-solid); }
.w-chip3d .dots i:first-child { margin-left: 0; }

@media (max-width: 760px) {
  /* Under the wallet bar, which takes the top-left corner on phones. */
  #world-clock { left: max(12px, env(safe-area-inset-left)); transform: none; top: calc(max(16px, env(safe-area-inset-top)) + 54px); gap: 8px; padding: 0 13px; font-size: 12px; }
  #world-clock .time { font-size: 16px; }
  #world-clock .hide-sm { display: none; }
  #world-panel {
    left: 10px; right: 10px; top: auto; bottom: max(10px, env(safe-area-inset-bottom)); width: auto;
    max-height: 48vh; transition: max-height 0.25s ease;
  }
  #world-panel.tall { max-height: 85vh; }
  #world-panel.collapsed { max-height: 64px; }
  #world-panel.dragging { transition: none; }
  /* The handle: a wide strip to drag (world.js dragSheet), with a bar in the middle. */
  #world-panel .grip {
    display: block; position: relative; flex: none; width: 100%; height: 22px; margin: 0; padding: 0; border: 0;
    background: var(--w-card); cursor: grab; touch-action: none;
  }
  #world-panel .grip::after { content: ""; position: absolute; left: 50%; top: 9px; width: 44px; height: 4px; margin-left: -22px; background: var(--w-ink-faint); }
  #world-panel .tabs { touch-action: none; padding-top: 0; }
  #place { display: none !important; }
}
/* --- Privy wallet bar ------------------------------------------------------ */
#privy-root {
  position: fixed; z-index: 4; top: max(24px, env(safe-area-inset-top));
  left: max(24px, env(safe-area-inset-left));
}
.w-privy {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--w-line); border-radius: var(--w-r); background: var(--w-card);
  box-shadow: var(--w-shadow);
  font: 800 12px var(--w-text); color: var(--w-ink);
}
.w-privy-btn {
  appearance: none; border: 1px solid var(--w-line); border-radius: var(--w-r);
  background: var(--w-accent-soft); color: var(--w-ink); font: inherit;
  padding: 6px 12px; cursor: pointer;
}
.w-privy-btn:disabled { opacity: 0.6; cursor: wait; }
.w-privy-btn.ghost { background: transparent; }
/* The wallet address, with a dot for this browser's sign-in (green: signed in) and, when the
   wallet is signed in on more than one device, how many. Click: your sign-ins. */
.w-privy-addr {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 0; border-radius: var(--w-r);
  background: transparent; color: inherit; font: inherit; letter-spacing: 0.02em; cursor: pointer;
}
.w-privy-addr:hover { background: var(--w-accent-soft); }
.w-privy-addr:focus-visible { outline: 2px solid var(--w-accent); outline-offset: 2px; }
.w-privy-dot { width: 8px; height: 8px; border-radius: 1px; background: var(--w-ink-faint); }
.w-privy-addr.on .w-privy-dot { background: #6db35c; box-shadow: 0 0 0 3px rgba(109, 179, 92, 0.18); }
.w-privy-count { min-width: 17px; padding: 0 5px; border-radius: var(--w-r); background: var(--w-accent); color: var(--w-card-solid); font-size: 10.5px; line-height: 17px; text-align: center; }
/* Your sign-ins (account.js). */
.w-sess-list { list-style: none; margin: 8px 0 14px; padding: 0; display: grid; gap: 8px; }
.w-sess { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--w-line); border-radius: var(--w-r); }
.w-sess.current { border-color: var(--w-accent); background: var(--w-accent-soft); }
.w-sess-icon { font-size: 20px; text-align: center; }
.w-sess b { display: block; font-size: 14px; }
.w-sess small { color: var(--w-ink-soft); font-size: 12px; font-weight: 700; }
.w-sess b .w-sess-here { margin-left: 8px; padding: 1px 7px; border-radius: var(--w-r); background: var(--w-accent); color: var(--w-card-solid); font-size: 10.5px; }
.w-sess-addr { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.92em; }
/* Phones: open Soltown inside a wallet app (WalletBar.jsx). */
.w-privy-menu {
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 5; display: grid; gap: 8px; width: min(280px, calc(100vw - 24px)); padding: 12px;
  border: 2px solid var(--w-edge); border-radius: var(--w-r); background: var(--w-card-solid); box-shadow: var(--w-shadow);
  font: 500 13px var(--w-text); color: var(--w-ink);
}
.w-privy-menu p { margin: 0 0 2px; color: var(--w-ink-soft); line-height: 1.4; }
.w-privy-menu .w-privy-btn { display: block; padding: 10px 12px; text-align: center; text-decoration: none; font: 500 14px var(--w-ui); }
.w-privy-link { border: 0; background: none; padding: 4px; color: var(--w-ink-soft); font: 500 13px var(--w-text); text-decoration: underline; cursor: pointer; }
.w-privy-note { color: var(--w-ink-soft); font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  #privy-root { top: max(16px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); }
  .w-privy-note, .w-privy-addr-text { display: none; }
}

/* --- capture mode: nothing but the town ---------------------------------------- */
.w-capturing #world-panel, .w-capturing #world-clock, .w-capturing #world-nav, .w-capturing #world-labels,
.w-capturing #privy-root, .w-capturing #place, .w-capturing #time-toggle, .w-capturing #world-toast { display: none !important; }

/* --- purchase toast ------------------------------------------------------------ */
#world-toast {
  position: fixed; z-index: 12; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; max-width: min(560px, calc(100vw - 24px)); padding: 10px 12px 10px 16px;
  border: 1px solid var(--w-line); border-radius: var(--w-r); background: var(--w-card-solid); color: var(--w-ink);
  box-shadow: var(--w-shadow); font: 700 13px var(--w-text);
}
#world-toast[hidden] { display: none; }
#world-toast a { color: var(--w-accent); font-weight: 800; }
#world-toast button { border: 0; background: var(--w-accent-soft); color: var(--w-ink); width: 26px; height: 26px; border-radius: 1px; cursor: pointer; flex: none; }
.w-toast-dot { width: 10px; height: 10px; border-radius: 1px; background: #e2a84b; flex: none; animation: w-pulse 1.2s ease-in-out infinite; }
.w-toast-dot.done { background: #6db35c; animation: none; }
.w-toast-dot.error { background: var(--w-bad); animation: none; }
@keyframes w-pulse { 50% { opacity: 0.35; } }
a.w-btn { text-decoration: none; display: inline-block; }

/* --- marketplace -------------------------------------------------------------- */
.w-tier { display: inline-block; padding: 3px 10px; border-radius: var(--w-r); color: #fffaef; font-size: 11.5px; font-weight: 800; letter-spacing: 0.03em; }
.w-mk-rank { position: absolute; left: 10px; bottom: 10px; padding: 3px 9px; border-radius: var(--w-r); color: #fffaef; font-size: 10.5px; font-weight: 800; letter-spacing: 0.03em; box-shadow: var(--w-shadow); }
.w-chip-tier[aria-pressed="true"] { background: var(--tier); color: #fffaef; }
.w-chip-tier { border-color: var(--tier); }
.w-mk-sep { width: 1px; height: 20px; background: var(--w-line); margin: 0 4px; }
/* Docs and Marketplace, side by side at the top (bottom left on phones). */
#world-nav { position: fixed; z-index: 3; top: max(24px, env(safe-area-inset-top)); right: calc(max(24px, env(safe-area-inset-right)) + 112px); display: flex; gap: 8px; }
#world-market, #world-docs {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 17px; text-decoration: none;
  border: 1px solid var(--w-line); border-radius: var(--w-r); background: var(--w-card); color: var(--w-ink);
  box-shadow: var(--w-shadow);
  font: 800 12px var(--w-text); letter-spacing: 0.02em; cursor: pointer;
}
#world-market:hover, #world-docs:hover { box-shadow: var(--w-shadow); }
#world-market:focus-visible, #world-docs:focus-visible { outline: 2px solid var(--w-accent); outline-offset: 3px; }
/* Between phone and wide screens the top row gets tight: first a compact clock and wallet bar,
   then icon-only buttons, so the centred clock never runs under them. */
@media (min-width: 761px) and (max-width: 1320px) {
  #world-clock .hide-sm, .w-privy-addr-text { display: none; }
}
@media (min-width: 761px) and (max-width: 1120px) {
  #world-nav .w-nav-label { display: none; }
  #world-market, #world-docs { justify-content: center; width: 44px; padding: 0; }
}
.w-mk-backdrop {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 24px;
  background: rgba(40, 30, 20, 0.35);
  font-family: var(--w-text); color: var(--w-ink); animation: w-mk-fade 0.18s ease;
}
@keyframes w-mk-fade { from { opacity: 0; } }
.w-mk {
  width: min(1080px, 100%); max-height: min(86vh, 900px); display: flex; flex-direction: column;
  background: var(--w-card-solid); border: 1px solid var(--w-line); border-radius: var(--w-r); box-shadow: var(--w-shadow);
  overflow: hidden;
}
.w-mk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px 22px 8px; }
.w-mk-head h2 { margin: 0; font-family: var(--w-ui); font-weight: 500; font-size: 30px; line-height: 1.1; }
.w-mk-summary { margin: 4px 0 0; color: var(--w-ink-soft); font-size: 12.5px; font-weight: 700; }
.w-mk-close { border: 0; background: var(--w-accent-soft); color: var(--w-ink); width: 38px; height: 38px; border-radius: 1px; font-size: 22px; line-height: 1; cursor: pointer; flex: none; }
.w-mk-controls { padding: 6px 22px 4px; display: grid; gap: 8px; }
.w-mk-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.w-mk-row input[type=search] {
  flex: 1 1 260px; min-width: 0; height: 38px; padding: 0 14px; border-radius: var(--w-r); border: 1px solid var(--w-line);
  background: var(--w-card); color: var(--w-ink); font: 700 13px var(--w-text);
}
.w-mk-select { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; color: var(--w-ink-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.w-mk-select select { height: 38px; border-radius: var(--w-r); border: 1px solid var(--w-line); background: var(--w-card); color: var(--w-ink); font: 800 12.5px var(--w-text); padding: 0 10px; text-transform: none; letter-spacing: 0; }
.w-mk-seg { display: inline-flex; border: 1px solid var(--w-line); border-radius: var(--w-r); padding: 3px; background: var(--w-card); }
.w-mk-seg button { border: 0; background: none; color: var(--w-ink-soft); font: 800 12px var(--w-text); padding: 6px 12px; border-radius: var(--w-r); cursor: pointer; }
.w-mk-seg button[aria-pressed="true"] { background: var(--w-accent); color: var(--w-card-solid); }
.w-mk-count, .w-mk-note { margin: 4px 22px; font-size: 12px; font-weight: 700; color: var(--w-ink-soft); }
.w-mk-note { color: var(--w-ink); background: var(--w-accent-soft); border-radius: var(--w-r); padding: 8px 12px; }
.w-mk-grid {
  overflow-y: auto; overscroll-behavior: contain; padding: 8px 22px 12px; flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); grid-auto-rows: max-content; align-content: start; gap: 14px;
}
.w-mk-card {
  display: flex; flex-direction: column; border: 1px solid var(--w-line); border-radius: var(--w-r); overflow: hidden;
  background: var(--w-card); cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.w-mk-card:hover, .w-mk-card:focus-visible { transform: translateY(-2px); box-shadow: var(--w-shadow); outline: none; }
.w-mk-media { position: relative; }
.w-mk-thumb { display: block; width: 100%; height: auto; }
.w-mk-photo { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--w-accent-soft); }
.w-mk-thumb .ground { fill: #e7efd9; }
.w-mk-thumb .ground.lake { fill: #e3eedc; }
.w-mk-thumb .water { fill: #a9cfe3; }
.w-mk-thumb .lot { fill: #e9d8bf; stroke: #a77844; stroke-width: 1.5; stroke-linejoin: round; }
.w-mk-thumb .lot.shop { fill: #e7c3b4; stroke: #b5553c; }
[data-time="night"] .w-mk-thumb .ground { fill: #2b3a4f; }
[data-time="night"] .w-mk-thumb .water { fill: #3d5f7d; }
[data-time="night"] .w-mk-thumb .lot { fill: #5a4c3d; stroke: #f4d8a5; }
.w-mk-badge {
  position: absolute; left: 10px; top: 10px; padding: 3px 9px; border-radius: var(--w-r); font-size: 10.5px; font-weight: 800;
  letter-spacing: 0.04em; text-transform: uppercase; background: var(--w-card-solid); color: var(--w-ink); box-shadow: var(--w-shadow);
}
.w-mk-badge.listed, .w-mk-badge.visitor-listed { background: #e2a84b; color: #3f2f22; }
.w-mk-badge.owned { background: var(--w-ink-soft); color: var(--w-card-solid); }
.w-mk-body { padding: 10px 12px 12px; display: grid; gap: 6px; }
.w-mk-body h3 { margin: 0; font-family: var(--w-ui); font-weight: 500; font-size: 17px; line-height: 1.2; }
.w-mk-meta { margin: 0; color: var(--w-ink-soft); font-size: 11.5px; font-weight: 700; }
.w-mk-price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.w-mk-price b { font-size: 19px; font-weight: 800; }
.w-mk-price small { color: var(--w-ink-soft); font-size: 11.5px; font-weight: 700; }
.w-mk-buy { justify-self: start; }
.w-mk-buy:disabled { opacity: 0.6; cursor: not-allowed; }
.w-mk-more { margin: 4px auto 18px; }
@media (max-width: 760px) {
  #world-nav { top: auto; right: auto; left: max(12px, env(safe-area-inset-left)); bottom: calc(max(10px, env(safe-area-inset-bottom)) + 60px); }
  .w-mk-backdrop { padding: 0; align-items: end; }
  .w-mk { max-height: 92vh; border-radius: var(--w-r) var(--w-r) 0 0; }
  .w-mk-head h2 { font-size: 24px; }
  .w-mk-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; padding: 8px 12px 12px; }
}

@media (prefers-reduced-motion: reduce) { #world-panel { transition: none; } .w-bubble { transition: none; } .w-mk-backdrop { animation: none; } .w-mk-card { transition: none; } }

/* --- joining: sign in, username, character (account.js) ------------------- */
.w-acct-backdrop { z-index: 12; }
.w-acct, .w-acct * { box-sizing: border-box; }
.w-acct {
  width: min(820px, 100%); max-height: min(90vh, 760px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--w-card-solid); border: 1px solid var(--w-line); border-radius: var(--w-r); box-shadow: var(--w-shadow);
  padding: 20px 22px 22px;
}
.w-acct:has(.w-acct-lede) { width: min(440px, 100%); }
.w-acct-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 8px; }
.w-acct-head h2 { margin: 0; font-family: var(--w-ui); font-weight: 500; font-size: 28px; line-height: 1.1; }
.w-acct-lede { margin: 4px 0 6px; font-size: 14px; font-weight: 700; line-height: 1.45; }
.w-acct-small { margin: 0 0 16px; color: var(--w-ink-soft); font-size: 12.5px; font-weight: 700; }
.w-acct-go {
  border: 0; border-radius: var(--w-r); padding: 11px 22px; background: var(--w-accent); color: var(--w-card-solid);
  font: 800 14px var(--w-text); cursor: pointer;
}
.w-acct-go:disabled { opacity: 0.6; cursor: wait; }
.w-acct-go:focus-visible, .w-acct-char:focus-visible, .w-acct-swatch:focus-visible, .w-acct-link:focus-visible { outline: 2px solid var(--w-accent); outline-offset: 3px; }
.w-acct-status { min-height: 1.2em; margin: 10px 0 0; font-size: 12.5px; font-weight: 700; color: var(--w-bad); }
.w-acct-grid { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 22px; align-items: start; }
.w-acct-stage { display: grid; gap: 6px; justify-items: center; position: sticky; top: 0; }
.w-acct-stage small { color: var(--w-ink-faint); font-size: 11px; font-weight: 700; }
.w-acct-canvas {
  width: 100%; aspect-ratio: 3 / 4; border-radius: var(--w-r); cursor: grab; touch-action: none;
  background: repeating-conic-gradient(var(--w-accent-soft) 0 25%, transparent 0 50%) 0 0 / 8px 8px, var(--w-card);
}
.w-acct-canvas:active { cursor: grabbing; }
.w-acct-form { display: grid; gap: 8px; align-content: start; min-width: 0; }
.w-acct-label { display: grid; gap: 6px; font-size: 10.5px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--w-ink-faint); margin-top: 6px; }
.w-acct-name {
  display: flex; align-items: center; gap: 2px; height: 42px; padding: 0 14px; border-radius: var(--w-r); border: 1px solid var(--w-line);
  background: var(--w-card); color: var(--w-ink-soft); font: 800 15px var(--w-text); text-transform: none; letter-spacing: 0;
}
.w-acct-name:focus-within { border-color: var(--w-accent); }
.w-acct-name input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--w-ink); font: inherit; }
.w-acct-hint { font-size: 12px; font-weight: 700; color: var(--w-ink-soft); }
.w-acct-hint.ok { color: var(--w-good); }
.w-acct-hint.bad { color: var(--w-bad); }
.w-acct-chars { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.w-acct-char {
  display: grid; justify-items: center; gap: 6px; padding: 10px 6px; border-radius: var(--w-r); border: 1px solid var(--w-line);
  background: var(--w-card); color: var(--w-ink); font: 800 12px var(--w-text); cursor: pointer;
}
.w-acct-char.on { border-color: var(--w-accent); box-shadow: inset 0 0 0 1px var(--w-accent); background: var(--w-accent-soft); }
.w-acct-char img { width: 52px; height: 52px; border-radius: 1px; object-fit: cover; }
.w-acct-initial { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 1px; background: var(--w-accent-soft); font-size: 24px; }
.w-acct-slots { display: grid; gap: 8px; margin-top: 4px; }
.w-acct-slot { display: grid; grid-template-columns: 76px 1fr; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; }
.w-acct-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.w-acct-swatch {
  width: 26px; height: 26px; border-radius: 1px; border: 1px solid rgba(0, 0, 0, 0.18); cursor: pointer; padding: 0;
}
.w-acct-swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--w-card-solid), 0 0 0 4px var(--w-accent); }
.w-acct-swatch.original { background: conic-gradient(#d9573b, #e2a84b, #6f7f5a, #4e6f9e, #7a4e8c, #d9573b) !important; }
.w-acct-actions { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.w-acct-link { border: 0; background: none; color: var(--w-ink-soft); font: 800 12.5px var(--w-text); text-decoration: underline; cursor: pointer; }
.w-acct-toast {
  position: fixed; z-index: 13; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  padding: 10px 18px; border-radius: var(--w-r); background: var(--w-card-solid); color: var(--w-ink); border: 1px solid var(--w-line);
  box-shadow: var(--w-shadow); font: 800 13px var(--w-text);
}
@media (max-width: 760px) {
  .w-acct-backdrop { padding: 0; align-items: end; }
  .w-acct { border-radius: var(--w-r) var(--w-r) 0 0; max-height: 94vh; padding: 16px; }
  .w-acct-grid { grid-template-columns: 1fr; gap: 12px; }
  .w-acct-stage { position: static; }
  .w-acct-canvas { width: min(220px, 60vw); }
}

/* --- your character: name tags and the control bar (visitors.js) ----------- */
.w-label-visitor { background: var(--w-ink); color: var(--w-card-solid); }
.w-label-visitor.me { background: var(--w-accent); color: var(--w-card-solid); outline: 2px solid var(--w-card-solid); }
.w-me {
  position: fixed; z-index: 4; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 16px; max-width: calc(100vw - 32px);
  border: 1px solid var(--w-line); border-radius: var(--w-r); background: var(--w-card); box-shadow: var(--w-shadow);
  font-family: var(--w-text); color: var(--w-ink);
}
.w-me-who { display: grid; min-width: 0; max-width: 300px; margin-right: 6px; line-height: 1.2; }
.w-me-who b { display: flex; align-items: center; font-size: 13px; font-weight: 800; white-space: nowrap; }
.w-me-who small { font-size: 11px; font-weight: 700; color: var(--w-ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-me-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 13px; border-radius: var(--w-r);
  border: 1px solid var(--w-line); background: var(--w-card-solid); color: var(--w-ink);
  font: 800 12px var(--w-text); white-space: nowrap; cursor: pointer;
}
.w-me-btn:hover { box-shadow: var(--w-shadow); }
.w-me-btn:focus-visible, .w-me-dest:focus-visible { outline: 2px solid var(--w-accent); outline-offset: 2px; }
.w-me-btn.on { background: var(--w-accent); color: var(--w-card-solid); border-color: transparent; }
.w-me-btn:disabled { opacity: 0.6; cursor: wait; }
.w-me-menu {
  position: fixed; z-index: 5; left: 50%; bottom: calc(max(24px, env(safe-area-inset-bottom)) + 60px); transform: translateX(-50%);
  width: min(320px, calc(100vw - 32px)); max-height: min(60vh, 460px); overflow-y: auto; overscroll-behavior: contain;
  padding: 6px; border: 1px solid var(--w-line); border-radius: var(--w-r); background: var(--w-card-solid); box-shadow: var(--w-shadow);
  font-family: var(--w-text);
}
.w-me-menu hr { border: 0; border-top: 1px solid var(--w-line); margin: 4px 8px; }
.w-me-dest {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--w-r);
  background: none; color: var(--w-ink); font: 700 13px var(--w-text); text-align: left; cursor: pointer;
}
.w-me-dest:hover { background: var(--w-accent-soft); }
.w-me-dest span { width: 22px; text-align: center; }
.w-rig { width: min(420px, 100%); }
.w-rig-steps { list-style: none; margin: 4px 0 12px; padding: 0; display: grid; gap: 8px; font-size: 14px; font-weight: 800; }
.w-rig-steps li { display: flex; align-items: center; gap: 10px; }
.w-rig-steps li::before { content: ""; flex: none; width: 10px; height: 10px; border: 2px solid var(--w-edge); background: var(--w-card); }
.w-rig-steps li.busy::before { background: var(--w-gold); animation: w-pulse 0.8s steps(2) infinite; }
.w-rig-steps li.done::before { background: var(--w-good); }
.w-rig-steps li.failed { color: var(--w-bad); }
.w-rig-steps li.failed::before { background: var(--w-bad); }
@media (max-width: 760px) {
  /* Third row on phones: the wallet bar, then the clock, then your character. */
  .w-me { top: calc(max(16px, env(safe-area-inset-top)) + 108px); bottom: auto; padding: 5px 5px 5px 12px; gap: 4px; }
  .w-me-who { max-width: 120px; }
  .w-me-money small { display: none; }
  .w-me-btn { padding: 0 10px; height: 36px; }
  .w-me-btn > span:not(.w-ico) { display: none; }
  .w-me-menu { top: calc(max(16px, env(safe-area-inset-top)) + 160px); bottom: auto; max-height: calc(100vh - 230px); }
}

/* --- the pin over your own character (visitors.js) ------------------------- */
.w-beacon {
  position: fixed; z-index: 2; left: 0; top: 0; display: flex; align-items: center; gap: 7px; max-width: 70vw; /* under the panels */
  padding: 4px 11px 4px 6px; border: 2px solid #fffaef; border-radius: var(--w-r); background: var(--w-accent); color: #fffaef;
  font: 800 12px var(--w-text); white-space: nowrap; cursor: pointer; will-change: transform;
  box-shadow: var(--w-shadow);
}
[data-time="night"] .w-beacon { background: #c98a3c; }
.w-beacon-name { overflow: hidden; text-overflow: ellipsis; }
.w-beacon-dot { position: relative; flex: none; width: 10px; height: 10px; border-radius: 1px; background: #fffaef; }
.w-beacon-dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 1px; border: 2px solid #fffaef;
  animation: w-beacon-pulse 1.6s ease-out infinite;
}
@keyframes w-beacon-pulse { from { transform: scale(0.55); opacity: 0.95; } to { transform: scale(2.1); opacity: 0; } }
/* A tail pointing down at the character while it is on screen. */
.w-beacon::after {
  content: ""; position: absolute; left: 50%; bottom: -8px; width: 10px; height: 10px; margin-left: -5px;
  background: var(--w-accent); border-right: 2px solid #fffaef; border-bottom: 2px solid #fffaef; transform: rotate(45deg);
}
[data-time="night"] .w-beacon::after { background: #c98a3c; }
.w-beacon.edge::after, .w-beacon.inside::after { display: none; }
.w-beacon-arrow { display: none; }
.w-beacon.edge .w-beacon-arrow {
  display: block; flex: none; width: 0; height: 0; margin-left: 2px;
  border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 9px solid #fffaef;
  transform: rotate(var(--a, 0rad));
}
.w-beacon:focus-visible { outline: 2px solid var(--w-ink); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .w-beacon-dot::after { animation: none; opacity: 0.5; transform: scale(1.4); } }

/* --- the jobs board (visitors.js) ------------------------------------------- */
.w-jobs-window { width: min(560px, 100%); }
.w-jobs { display: grid; gap: 8px; margin-top: 6px; }
.w-job {
  display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 10px 12px;
  border: 1px solid var(--w-line); border-radius: var(--w-r); background: var(--w-card); color: var(--w-ink);
  font: 700 13px var(--w-text); text-align: left; cursor: pointer;
}
.w-job:hover:not(:disabled) { box-shadow: var(--w-shadow); }
.w-job:focus-visible { outline: 2px solid var(--w-accent); outline-offset: 2px; }
.w-job:disabled { opacity: 0.5; cursor: not-allowed; }
.w-job.current { border-color: var(--w-accent); box-shadow: inset 0 0 0 1px var(--w-accent); background: var(--w-accent-soft); }
.w-job-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 1px; background: var(--w-accent-soft); font-size: 18px; }
.w-job-text, .w-job-pay { display: grid; line-height: 1.25; min-width: 0; }
.w-job-text b { font-size: 14px; font-weight: 800; text-transform: capitalize; }
.w-job-text small, .w-job-pay small { color: var(--w-ink-soft); font-size: 11.5px; }
.w-job-pay { text-align: right; }
.w-job-pay b { font-size: 14px; font-weight: 800; }
.w-me-money {
  margin-left: 8px; padding: 2px 8px; border: 0; border-radius: var(--w-r); background: var(--w-accent-soft); color: var(--w-ink);
  font: 800 11px var(--w-text); white-space: nowrap; cursor: pointer;
}
.w-me-money small { color: var(--w-good); font-size: 10.5px; font-weight: 800; }
.w-me-money:hover, .w-me-money.on { background: var(--w-accent); color: var(--w-card-solid); }
.w-me-money:hover small, .w-me-money.on small { color: var(--w-card-solid); }
.w-me-money:focus-visible { outline: 2px solid var(--w-accent); outline-offset: 2px; }
/* "+$15": money coming in floats up from the balance. */
.w-gain {
  position: fixed; z-index: 6; transform: translate(-50%, -100%); pointer-events: none;
  padding: 2px 9px; border-radius: var(--w-r); background: var(--w-good); color: #fffaef; font: 800 12px var(--w-text);
  box-shadow: var(--w-shadow); animation: w-gain 1.8s ease-out forwards;
}
@keyframes w-gain {
  0% { opacity: 0; transform: translate(-50%, -60%); }
  15% { opacity: 1; transform: translate(-50%, -110%); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -260%); }
}
/* Your money: balance, today, all time, the last payments. */
.w-earn-menu { width: min(360px, calc(100vw - 32px)); padding: 12px 14px; color: var(--w-ink); }
.w-earn-head { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.w-earn-head > div { padding: 8px 10px; border-radius: var(--w-r); background: var(--w-accent-soft); }
.w-earn-head small { display: block; color: var(--w-ink-soft); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.w-earn-head b { font: 600 22px/1.15 var(--w-ui); }
.w-earn-menu h4 { margin: 12px 0 4px; color: var(--w-ink-soft); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.w-earn-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 13px; font-weight: 700; }
.w-earn-row b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.w-earn-line span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-earn-line small { display: inline-block; min-width: 44px; color: var(--w-ink-faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.w-earn-menu .in { color: var(--w-good); }
.w-earn-menu .out { color: var(--w-bad); }
.w-earn-note { margin: 4px 0; color: var(--w-ink-soft); font-size: 12.5px; font-weight: 700; }
.w-earn-fine { margin: 12px 0 0; color: var(--w-ink-faint); font-size: 11.5px; font-weight: 700; }
.w-do { margin-left: 8px; padding: 3px 10px; font-size: 11px; }
.w-crime { border-color: rgba(181, 85, 60, 0.45); color: var(--w-bad); }
.w-crime:disabled { opacity: 0.55; cursor: not-allowed; }
.w-fire {
  position: absolute; left: 0; top: 0; padding: 3px 9px; border-radius: var(--w-r); background: #3a1d12; color: #ffd9a8;
  font: 800 11px var(--w-text); white-space: nowrap; box-shadow: 0 0 14px rgba(255, 120, 40, 0.75); will-change: transform;
  animation: w-fire-glow 1.4s ease-in-out infinite alternate;
}
@keyframes w-fire-glow { from { box-shadow: 0 0 8px rgba(255, 120, 40, 0.5); } to { box-shadow: 0 0 20px rgba(255, 90, 20, 0.95); } }
.w-burnt p { margin: 0; padding: 8px 12px; border-radius: var(--w-r); background: rgba(181, 85, 60, 0.12); color: var(--w-bad); font-weight: 800; }
@media (prefers-reduced-motion: reduce) { .w-fire { animation: none; } }

/* --- crime list (bar) and the right-click menu (visitors.js) ---------------- */
.w-crime-menu { width: min(420px, calc(100vw - 32px)); padding: 8px; }
.w-crime-head { display: grid; gap: 2px; padding: 4px 8px 8px; border-bottom: 1px solid var(--w-line); margin-bottom: 4px; }
.w-crime-head b { font-size: 14px; }
.w-crime-head small { color: var(--w-ink-soft); font-size: 11.5px; font-weight: 700; }
.w-crime-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--w-r); }
.w-crime-row:hover { background: var(--w-accent-soft); }
.w-crime-what { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.w-crime-what b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-crime-what small { color: var(--w-ink-soft); font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-crime-do { display: flex; gap: 4px; flex: none; }
.w-crime-do .w-btn { padding: 5px 9px; }
.w-crime-empty { margin: 8px; color: var(--w-ink-soft); font-size: 12.5px; font-weight: 700; }
.w-me-crime.on { background: var(--w-bad); color: #fffaef; }
.w-ctx {
  position: fixed; z-index: 14; display: grid; gap: 4px; min-width: 200px; max-width: 280px; padding: 8px;
  border: 1px solid var(--w-line); border-radius: var(--w-r); background: var(--w-card-solid); color: var(--w-ink);
  box-shadow: var(--w-shadow); font-family: var(--w-text);
}
.w-ctx-title { padding: 2px 6px 4px; font-size: 13px; }
.w-ctx small { padding: 0 6px 4px; color: var(--w-ink-soft); font-size: 11px; font-weight: 700; }
.w-ctx .w-btn { width: 100%; text-align: left; border-radius: var(--w-r); padding: 7px 10px; }
.w-ctx .w-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- place card: picture, actions, numbers (world.js placeView) ------------ */
.w-place { padding-top: 0; }
.w-hero { position: relative; margin: 2px -4px 12px; border-radius: var(--w-r); overflow: hidden; aspect-ratio: 16 / 10; background: var(--w-accent-soft); }
.w-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.w-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,0) 45%, rgba(20,12,4,0.78) 100%); pointer-events: none; }
.w-hero.plain { aspect-ratio: auto; min-height: 120px; background: repeating-conic-gradient(var(--w-accent-soft) 0 25%, transparent 0 50%) 0 0 / 8px 8px, var(--w-card); }
.w-hero.plain::after { background: linear-gradient(180deg, rgba(0,0,0,0) 30%, rgba(20,12,4,0.55) 100%); }
.w-hero-icon { position: absolute; right: 14px; top: 10px; font-size: 54px; opacity: 0.9; }
.w-hero-badges { position: absolute; z-index: 1; left: 10px; top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.w-hero-badges .w-tier { box-shadow: var(--w-shadow); }
.w-pill { padding: 3px 9px; border-radius: var(--w-r); font-size: 11px; font-weight: 800; background: rgba(255, 250, 239, 0.92); color: #3f2f22; box-shadow: var(--w-shadow); }
.w-pill.sale { background: #e2a84b; }
.w-pill.market { background: #e46b9a; color: #fff; }
.w-pill.fire { background: #3a1d12; color: #ffd9a8; }
.w-hero-title { position: absolute; z-index: 1; left: 14px; right: 14px; bottom: 12px; color: #fffaef; }
.w-hero-title h2 { margin: 0; font-family: var(--w-ui); font-weight: 600; font-size: 25px; line-height: 1.05; text-shadow: 0 2px 10px rgba(0,0,0,0.45); }
.w-hero-title p { margin: 4px 0 0; font-size: 12px; font-weight: 800; opacity: 0.92; }
.w-cta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.w-cta .w-btn { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 38px; padding: 6px 10px; border-radius: var(--w-r);
  font-size: 12.5px; text-align: center; white-space: normal; line-height: 1.15; text-decoration: none; }
.w-cta .w-btn.primary { grid-column: 1 / -1; min-height: 44px; background: var(--w-accent); color: var(--w-card-solid); border-color: transparent; font-size: 14px; }
.w-cta .w-btn.primary:disabled { opacity: 0.6; }
.w-cta .w-crime { background: rgba(181, 85, 60, 0.08); }
.w-cta .w-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.w-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px; margin-bottom: 4px; }
.w-kpi { display: grid; gap: 1px; padding: 9px 10px; border-radius: var(--w-r); background: var(--w-accent-soft); min-width: 0; }
.w-kpi b { font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-kpi b .w-link { font: inherit; }
.w-kpi span { color: var(--w-ink-soft); font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
.w-kpi.warn { background: rgba(181, 85, 60, 0.12); }
.w-kpi.warn b { color: var(--w-bad); }
.w-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.w-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 10px 3px 3px; border-radius: var(--w-r); background: var(--w-accent-soft); font-size: 12px; font-weight: 700; }
.w-chip small { color: var(--w-ink-soft); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.w-chip .w-link { font-weight: 800; }
.w-avatar.visitor { width: 20px; height: 20px; font-size: 11px; background: var(--w-ink); color: var(--w-card-solid); }
.w-dos { display: grid; gap: 4px; }
.w-do-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px 6px 10px; border-radius: var(--w-r); background: var(--w-accent-soft); font-size: 12.5px; font-weight: 700; }
.w-do-row span { flex: 1; }
.w-do-row small { color: var(--w-ink-soft); font-weight: 800; }
.w-do-row .w-do { margin-left: 0; }
.w-muted { margin: 8px 0 0; color: var(--w-ink-soft); font-size: 12px; font-weight: 700; }
.w-more { margin-top: 12px; border-top: 1px solid var(--w-line); padding-top: 8px; }
.w-more summary { cursor: pointer; color: var(--w-ink-soft); font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; list-style: none; }
.w-more summary::-webkit-details-marker { display: none; }
.w-more summary::after { content: " ▾"; }
.w-more[open] summary::after { content: " ▴"; }
.w-more .w-tags { margin-top: 8px; }
.w-tag.soft { background: none; border: 1px solid var(--w-line); }

/* --- the frame: one look for every panel, button and label ------------------- */
/* Panels: solid, a dark edge and a hard drop shadow (no glass, no blur). */
#world-clock, #world-panel, .w-privy, .w-me, .w-me-menu, .w-mk, .w-acct, .w-ctx, #world-toast, .w-acct-toast, #loading .status {
  border: 2px solid var(--w-edge); border-radius: var(--w-r); background: var(--w-card); box-shadow: var(--w-shadow);
}
.w-mk, .w-acct { box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.45); }
.w-mk-backdrop { background: rgba(28, 20, 12, 0.45); }

/* The pixel face: anything that is a label, a number or a button. Body text stays plain. */
#world-clock, .w-privy, #world-market, #world-docs, #time-toggle, #world-panel .tabs button, .w-btn, .w-me-btn, .w-me-money,
.w-chip3d, .w-label, .w-beacon, .w-subhead, .w-section h3, .w-event .meta, .w-kpi b, .w-kpi span, .w-head h2, .w-hero-title h2,
.w-mk-head h2, .w-acct-head h2, .w-mk-body h3, .w-mk-price b, .w-earn-head b, .w-earn-head small, .w-earn-menu h4, .w-tier, .w-pill,
.w-mk-badge, .w-mk-rank, .w-acct-go, .w-job-pay b, .w-crime-head b, .w-gain, .w-fire, .w-mk-close, .w-back, .w-more summary,
.w-mk-seg button, .w-acct-label, .w-mk-select, .w-privy-count, .w-sess-here, #loading .what, .w-acct-link, .w-chip-tier, .w-filter .w-chip {
  font-family: var(--w-ui); font-weight: 500; letter-spacing: 0.02em;
}
.w-subhead, .w-section h3, .w-event .meta, .w-kpi span, .w-earn-head small, .w-earn-menu h4, .w-acct-label, .w-mk-select, .w-more summary {
  font-size: 12px; letter-spacing: 0.06em;
}
.w-head h2, .w-hero-title h2, .w-mk-head h2, .w-acct-head h2 { font-weight: 600; letter-spacing: 0.01em; }
#world-clock .time { font-family: var(--w-ui); font-size: 20px; font-weight: 600; }
#world-clock .relight { font-family: var(--w-ui); border-radius: var(--w-r); }
.w-row .name, .w-earn-row, .w-job-text b, .w-sess b { font-family: var(--w-text); font-weight: 600; }

/* Buttons: raised, and pressed in when clicked. */
.w-btn, .w-me-btn, #world-market, #world-docs, #time-toggle, .w-acct-go, .w-mk-close, .w-privy-btn, #world-toast button {
  border: 2px solid var(--w-edge); border-radius: var(--w-r); background: var(--w-card-solid); color: var(--w-ink);
  box-shadow: var(--w-bevel); cursor: pointer;
}
#world-market, #world-docs, #time-toggle { box-shadow: var(--w-bevel), var(--w-shadow); }
.w-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 6px 11px; }
.w-ctx .w-btn { justify-content: flex-start; }
.w-btn:hover:not(:disabled), .w-me-btn:hover:not(:disabled), .w-acct-go:hover:not(:disabled) { background: var(--w-card); }
#world-market:hover, #world-docs:hover, #time-toggle:hover { background: var(--w-card); box-shadow: var(--w-bevel), var(--w-shadow); }
.w-btn:active:not(:disabled), .w-me-btn:active:not(:disabled), #world-market:active, #world-docs:active, #time-toggle:active,
.w-acct-go:active:not(:disabled), .w-mk-close:active { box-shadow: var(--w-sunk); transform: translate(1px, 1px); }
.w-btn[aria-pressed="true"], .w-me-btn.on, .w-cta .w-btn.primary, .w-acct-go, .w-mk-seg button[aria-pressed="true"] {
  background: var(--w-accent); color: var(--w-card-solid); border-color: var(--w-edge);
}
.w-cta .w-btn.primary:hover:not(:disabled), .w-acct-go:hover:not(:disabled), .w-me-btn.on:hover:not(:disabled) { background: var(--w-accent); filter: brightness(1.08); }
.w-me-crime.on, .w-me-crime.on:hover:not(:disabled) { background: var(--w-bad); }
.w-crime { color: var(--w-bad); }
.w-cta .w-crime { background: var(--w-card-solid); }
.w-acct-go { font-size: 15px; padding: 10px 20px; }
.w-me-btn { font-size: 13px; height: 36px; }
.w-mk-close { display: grid; place-items: center; width: 34px; height: 34px; font-size: 20px; }
:is(.w-btn, .w-me-btn, .w-acct-go, .w-mk-close, #world-market, #world-docs, #time-toggle, .w-me-money, .w-privy-addr, .w-job, .w-mk-card):focus-visible {
  outline: 2px dashed var(--w-accent); outline-offset: 3px;
}
#time-toggle svg { stroke-linecap: square; stroke-linejoin: miter; stroke-width: 2; }
#world-toast button { width: 26px; height: 26px; padding: 0; }

/* Icons. */
.w-ico { display: inline-flex; flex: none; line-height: 0; }
.w-ico svg { display: block; }
.w-icon { color: var(--w-ink); background: var(--w-accent-soft); border: 2px solid var(--w-line); border-radius: var(--w-r); }
.w-job-icon { color: var(--w-ink); border-radius: var(--w-r); }
.w-hero-icon { color: var(--w-ink); opacity: 0.8; line-height: 0; }
.w-sess-icon { display: grid; place-items: center; color: var(--w-ink-soft); }
.w-acct-initial { border-radius: var(--w-r); color: var(--w-ink); }
.w-acct-char img { border-radius: var(--w-r); }
.w-me-dest > span:first-child, .w-me-dest > .w-ico { width: 22px; justify-content: center; color: var(--w-ink-soft); }
.w-index { display: inline-flex; align-items: center; gap: 5px; }
.w-earn-row span { display: inline-flex; align-items: center; gap: 7px; }
.w-earn-row .w-ico { color: var(--w-ink-soft); }
.w-crime-head b { display: inline-flex; align-items: center; gap: 7px; font-size: 15px; }
.w-event-text { display: flex; gap: 9px; align-items: flex-start; }
.w-event-text > .w-ico { margin-top: 4px; color: var(--w-ink-faint); }
.w-event.big .w-event-text > .w-ico { color: var(--w-accent); }

/* Tabs: a raised folder tab for the one that is open. */
#world-panel .tabs { gap: 2px; padding: 8px 8px 0; border-bottom: 2px solid var(--w-edge); background: var(--w-card); }
#world-panel .tabs button {
  font-size: 13px; font-weight: 500; padding: 8px 6px 7px; border: 2px solid transparent; border-bottom: 0;
  border-radius: var(--w-r) var(--w-r) 0 0; margin-bottom: -2px;
}
#world-panel .tabs button[aria-selected="true"] { background: var(--w-card-solid); border-color: var(--w-edge); padding-bottom: 9px; }
#world-panel .body { background: var(--w-card-solid); }
#world-panel .body::-webkit-scrollbar { width: 10px; }
#world-panel .body::-webkit-scrollbar-thumb { background: var(--w-ink-faint); border-radius: 0; border: 2px solid var(--w-card-solid); }
.w-event { border-bottom: 1px dashed var(--w-line); }
.w-chip3d, .w-label { border: 2px solid var(--w-edge); border-radius: 2px; box-shadow: 2px 2px 0 rgba(43, 33, 24, 0.55); font-size: 12px; }
.w-label { padding: 1px 7px 1px 5px; }
.w-label-visitor.me { outline: 0; }
.w-chips .w-chip { padding: 2px 9px 2px 2px; border: 1px solid var(--w-line); border-radius: var(--w-r); }
.w-tag { border-radius: 2px; border: 1px solid var(--w-line); }
.w-kpi { border: 2px solid var(--w-line); background: var(--w-card); }
.w-kpi b { font-size: 17px; }
.w-do-row { background: var(--w-card); border: 1px solid var(--w-line); }
.w-bar i { height: 8px; border-radius: 0; }
.w-bar i span { border-radius: 0; }
.w-earn-head > div { border: 2px solid var(--w-line); background: var(--w-card); }

/* Speech bubbles: a boxed caption with a stepped tail. */
.w-bubble { border: 2px solid var(--w-edge); border-radius: var(--w-r); box-shadow: 3px 3px 0 rgba(43, 33, 24, 0.5); font-weight: 500; }
.w-bubble::before { content: ""; position: absolute; left: 16px; bottom: -10px; border: 9px solid transparent; border-bottom: 0; border-top-color: var(--w-edge); }
.w-bubble::after { left: 18px; bottom: -6px; }
.w-bubble.typing { font-family: var(--w-ui); }

/* Pills and badges: flat stamps. */
.w-tier, .w-mk-rank, .w-pill, .w-mk-badge { border-radius: 2px; border: 2px solid rgba(0, 0, 0, 0.55); box-shadow: none; font-size: 12px; }
.w-hero-badges .w-tier { box-shadow: none; }
.w-hero { border: 2px solid var(--w-edge); }
/* No photo: a blue title card with a dither, the place's icon in the corner. */
.w-hero.plain { background: repeating-conic-gradient(rgba(0, 0, 0, 0.1) 0 25%, transparent 0 50%) 0 0 / 8px 8px, #2f6d8c; }
.w-hero.plain::after { background: none; }
.w-hero.plain .w-hero-icon { color: #fbf5e6; opacity: 0.9; }
.w-hero.plain .w-hero-title h2 { text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35); }
.w-hero::after { background: linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(15,10,4,0.82) 100%); }
.w-mk-card { border: 2px solid var(--w-edge); box-shadow: 3px 3px 0 rgba(43, 33, 24, 0.35); }
.w-mk-card:hover, .w-mk-card:focus-visible { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 rgba(43, 33, 24, 0.45); }
.w-mk-note { border: 2px solid var(--w-line); }
.w-job { border: 2px solid var(--w-edge); box-shadow: var(--w-bevel); background: var(--w-card-solid); }
.w-job:hover:not(:disabled) { box-shadow: var(--w-bevel); background: var(--w-card); }
.w-job.current { border-color: var(--w-edge); box-shadow: inset 0 0 0 2px var(--w-accent); }
.w-sess { border: 2px solid var(--w-line); }
.w-sess.current { border-color: var(--w-edge); }

/* Inputs: sunk into the panel. */
.w-mk-row input[type=search], .w-mk-select select, .w-acct-name, .w-mk-seg {
  border: 2px solid var(--w-edge); background: var(--w-card-solid); box-shadow: var(--w-sunk);
}
.w-acct-char { border: 2px solid var(--w-line); }
.w-acct-char.on { border-color: var(--w-edge); box-shadow: inset 0 0 0 2px var(--w-accent); }
.w-acct-swatch { border: 2px solid var(--w-edge); border-radius: 2px; }
.w-acct-swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--w-card-solid), 0 0 0 4px var(--w-edge); }

/* The status dots, the money tag, the toast. */
#world-clock .dot.live, .w-privy-addr.on .w-privy-dot { background: #5fbf4a; box-shadow: none; }
#world-clock .dot, .w-privy-dot, .w-toast-dot { border: 1px solid var(--w-edge); }
.w-me-money { border-radius: 2px; border: 1px solid var(--w-line); font-size: 13px; }
.w-me-money small { font-family: var(--w-ui); }
.w-gain { border: 2px solid var(--w-edge); box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4); animation-timing-function: steps(10); }
.w-beacon { border-color: var(--w-edge); box-shadow: 3px 3px 0 rgba(43, 33, 24, 0.6); }
.w-beacon-dot::after { animation-timing-function: steps(5); }
.w-beacon::after { border-color: var(--w-edge); }
#world-toast { font-family: var(--w-text); font-weight: 600; }

/* --- the page around the town (index.html, shared with the plain miniature) --- */
/* The name in the corner: a plaque, not a wash of colour. */
#place {
  left: max(24px, env(safe-area-inset-left)); bottom: max(24px, env(safe-area-inset-bottom));
  padding: 12px 16px; max-width: min(460px, calc(100vw - 48px)); box-sizing: border-box;
  border: 2px solid var(--w-edge); border-radius: var(--w-r); background: var(--w-card); box-shadow: var(--w-shadow);
  color: var(--w-ink); text-shadow: none;
}
#place .name { display: flex; align-items: center; gap: 12px; font-family: var(--w-ui); font-variation-settings: normal; font-weight: 600; font-size: 40px; letter-spacing: 0.01em; }
/* The logo (world/brand.mjs): 16 pixels drawn at 3x. */
.w-logo { flex: none; width: 48px; height: 48px; image-rendering: pixelated; }
#place .region { font-family: var(--w-text); font-style: normal; font-weight: 500; font-size: 15px; color: var(--w-ink-soft); margin: 4px 0 0; }
#place .rule { width: 100%; height: 0; margin: 10px 0 8px; border-top: 2px dashed var(--w-line); background: none; }
#place .how { font-family: var(--w-text); font-size: 12px; font-weight: 500; color: var(--w-ink-soft); margin: 0; }
#place .how b { font-weight: 700; color: var(--w-ink); }
[data-time="night"] #place { background: var(--w-card); color: var(--w-ink); text-shadow: none; }
[data-time="night"] #place .region, [data-time="night"] #place .how { color: var(--w-ink-soft); }
[data-time="night"] #place .how b { color: var(--w-ink); }

#time-toggle { font-size: 13px; }
[data-time="night"] #time-toggle { color: var(--w-ink); background: var(--w-card-solid); border-color: var(--w-edge); box-shadow: var(--w-bevel), var(--w-shadow); }

/* Loading: a chunky segmented bar. */
#loading { color: var(--w-ink); }
#loading .status { padding: 18px 20px; gap: 12px; }
#loading .track { height: 16px; border: 2px solid var(--w-edge); border-radius: 0; background: var(--w-card-solid); box-shadow: var(--w-sunk); }
#loading .bar { border-radius: 0; background: repeating-linear-gradient(90deg, var(--w-accent) 0 8px, transparent 8px 10px); }
#loading .what { font-size: 13px; }
#loading .retry { border: 2px solid var(--w-edge); border-radius: var(--w-r); background: var(--w-card-solid); box-shadow: var(--w-bevel); }
[data-time="night"] #loading .status { background: var(--w-card); border-color: var(--w-edge); box-shadow: var(--w-shadow); }
[data-time="night"] #loading .track { border-color: var(--w-edge); background: var(--w-card-solid); }

@media (max-width: 760px) {
  .w-mk, .w-acct { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  .w-btn:active, .w-me-btn:active, #world-market:active, #world-docs:active, #time-toggle:active { transform: none; }
}
