/* the globe: full screen, the planet in the middle, small solid panels around it. */
:root { --ink: #f2f2f6; --muted: #a1a6b8; --panel: #0e1019; --line: rgba(255,255,255,.1); --violet: 167, 139, 250; --ease: cubic-bezier(.2,.8,.2,1); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { font-family: 'Inter', system-ui, sans-serif; color: var(--ink); -webkit-font-smoothing: antialiased; touch-action: none;
       background: radial-gradient(900px 700px at 50% 45%, rgba(91, 33, 182, .22), transparent 65%), #05060b; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid rgba(var(--violet), .9); outline-offset: 2px; border-radius: 10px; }
#stars { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; }
#globe { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 1; cursor: grab; }
#globe.dragging { cursor: grabbing; }
#globe.pointing { cursor: pointer; }

/* name tags and bubbles over the 3D scene */
.labels { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
.tag { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); white-space: nowrap; font-size: 12px; font-weight: 600;
       padding: 3px 8px; border-radius: 999px; background: rgba(10, 11, 20, .82); border: 1px solid var(--line); will-change: transform; }
.tag.me { border-color: rgba(var(--violet), .7); color: #e4dcff; }
.tag.npc { border-color: rgba(251, 191, 36, .6); color: #fde68a; }
.tag .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #6ee7b7; margin-right: 5px; vertical-align: 1px; }
.bubble { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); max-width: 180px; font-size: 12px; line-height: 1.35; padding: 6px 10px;
          border-radius: 12px 12px 12px 3px; background: #f7f5ff; color: #1a1530; box-shadow: 0 6px 16px rgba(0,0,0,.35); will-change: transform; }
.bubble.emo { font-size: 20px; padding: 2px 8px; background: transparent; box-shadow: none; animation: rise 1.2s ease-out infinite; }
@keyframes rise { 0% { opacity: 0; translate: 0 6px; } 30% { opacity: 1; } 100% { opacity: 0; translate: 0 -18px; } }

/* top bar */
.w-top { position: fixed; top: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 14px 16px; pointer-events: none; }
.w-top > * { pointer-events: auto; }
.w-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 12px; background: rgba(14, 16, 25, .9);
         border: 1px solid var(--line); font-size: 14px; font-weight: 600; transition: transform .2s var(--ease), border-color .2s; }
.w-btn:hover { border-color: rgba(var(--violet), .5); transform: translateY(-1px); }
.w-btn.icon { width: 40px; padding: 0; justify-content: center; }
.w-btn.primary { background: linear-gradient(140deg, #7c3aed, #db2777); border-color: transparent; color: #fff; box-shadow: 0 10px 24px -10px rgba(219, 39, 119, .8); }
.w-title { display: flex; flex-direction: column; line-height: 1.2; margin-right: auto; text-shadow: 0 2px 10px rgba(0,0,0,.6); }
.w-title b { font-size: 17px; letter-spacing: -.01em; }
.w-title small { font-size: 12px; color: var(--muted); }
.w-title small::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #6ee7b7; margin-right: 6px; vertical-align: 1px; }
#music[aria-pressed="true"] { color: #c4b5fd; }
#music[aria-pressed="false"] { color: var(--muted); }
.w-me { display: flex; gap: 8px; align-items: center; }
.w-me .who { display: flex; align-items: center; gap: 8px; }
.w-me canvas { width: 26px; height: 26px; }

.w-hint { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 4; margin: 0; padding: 7px 14px; border-radius: 999px; font-size: 12px; color: var(--muted);
          background: rgba(10, 11, 20, .7); border: 1px solid var(--line); white-space: nowrap; pointer-events: none; transition: opacity .6s; }
.w-hint.gone { opacity: 0; }

/* emotes */
.w-emotes { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: 4px; padding: 6px;
            border-radius: 18px; background: rgba(14, 16, 25, .92); border: 1px solid var(--line); box-shadow: 0 16px 40px -16px rgba(0,0,0,.8); }
.w-emotes button { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 22px; transition: transform .2s var(--ease), background .2s; }
.w-emotes button:hover { background: rgba(255,255,255,.07); transform: translateY(-2px); }
.w-emotes button:active { transform: scale(.92); }
.w-emotes #follow { font-size: 16px; color: var(--muted); }
.w-emotes #follow[aria-pressed="true"] { color: #c4b5fd; background: rgba(var(--violet), .16); }
.w-emotes .sep { width: 1px; height: 26px; background: var(--line); margin: 0 4px; }

/* the character card */
.w-card { position: fixed; right: 16px; top: 76px; z-index: 6; width: min(300px, calc(100vw - 32px)); padding: 16px; border-radius: 20px; background: var(--panel);
          border: 1px solid var(--line); box-shadow: 0 30px 60px -24px rgba(0,0,0,.9); animation: pop .25s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.w-card .row { display: flex; align-items: center; gap: 12px; }
.w-card canvas { width: 64px; height: 64px; border-radius: 14px; background: radial-gradient(circle at 50% 70%, rgba(95, 184, 107, .35), rgba(255,255,255,.03)); flex: none; }
.w-card h3 { margin: 0; font-size: 17px; }
.w-card .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.w-card .status { margin: 12px 0 0; padding: 9px 12px; border-radius: 12px; background: rgba(255,255,255,.04); font-size: 14px; }
.w-card .acts { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.w-card .x { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%; color: var(--muted); display: grid; place-items: center; }
.w-card .x:hover { background: rgba(255,255,255,.07); color: #fff; }
@media (max-width: 560px) { .w-card { top: auto; bottom: 92px; right: 16px; } }

/* modal: creator, sign in, recovery */
.w-modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; }
.w-dim { position: absolute; inset: 0; background: rgba(3, 4, 9, .7); animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }
.w-sheet { position: relative; width: min(760px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; border-radius: 24px; background: var(--panel);
           border: 1px solid rgba(255,255,255,.14); box-shadow: 0 40px 90px -30px rgba(0,0,0,.95); animation: pop .3s var(--ease); }
.w-sheet.small { width: min(400px, 100%); }
.w-sheet header { display: flex; align-items: center; gap: 12px; padding: 18px 20px 6px; }
.w-sheet header h2 { margin: 0; font-size: 19px; flex: 1; }
.w-sheet .close { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); background: rgba(255,255,255,.05); }
.steps { display: flex; gap: 6px; padding: 0 20px 6px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: rgba(255,255,255,.1); }
.steps i.on { background: linear-gradient(90deg, #8b5cf6, #ec4899); }
.w-btn.ghost { background: rgba(255,255,255,.04); }

/* the top bar on a phone: keep every button on one line */
.w-btn { white-space: nowrap; }
.w-title { min-width: 0; }
.w-title small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 440px) {
  .w-top { gap: 6px; padding: 12px; }
  .w-top .w-btn { padding: 0 11px; }
  .w-top .w-btn.icon { padding: 0; width: 38px; }
  .w-me .long { display: none; }
}

/* the creator */
.w-sheet.creator-sheet { width: min(940px, 100%); display: flex; flex-direction: column; overflow: hidden; height: min(680px, calc(100dvh - 32px)); }
.creator { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(260px, 38%) 1fr; gap: 18px; padding: 10px 20px 14px; }
.stage { position: relative; border-radius: 22px; border: 1px solid var(--line); min-height: 0; overflow: hidden;
         background: radial-gradient(circle at 50% 78%, rgba(95, 184, 107, .32), rgba(139, 92, 246, .14) 55%, rgba(255,255,255,.02)); }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage-tools { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 8px; }
.stage-hint { position: absolute; left: 12px; bottom: 14px; font-size: 11px; color: var(--muted); pointer-events: none; }
.side { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(255,255,255,.04); border: 1px solid var(--line); flex: none; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; border-radius: 10px; font-size: 12px; font-weight: 600;
       color: var(--muted); transition: background .2s, color .2s; }
.tab i { font-size: 15px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { background: rgba(var(--violet), .2); color: #fff; box-shadow: inset 0 0 0 1px rgba(var(--violet), .55); }
.opts { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding: 14px 2px 4px; overscroll-behavior: contain; }
.opt h4 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.thumb { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px 7px; border-radius: 14px; background: rgba(255,255,255,.035);
         border: 1px solid var(--line); font-size: 11.5px; color: #c8ccd8; transition: border-color .15s, background .15s, transform .15s var(--ease); }
.thumb canvas { width: 62px; height: 62px; }
.thumb:hover { border-color: rgba(var(--violet), .5); transform: translateY(-1px); }
.thumb[aria-pressed="true"] { background: rgba(var(--violet), .18); border-color: rgba(var(--violet), .85); color: #fff; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; background: var(--c); box-shadow: inset 0 -3px 6px rgba(0,0,0,.25), 0 0 0 1px rgba(255,255,255,.12);
          transition: transform .15s var(--ease), box-shadow .15s; }
.swatch:hover { transform: scale(1.1); }
.swatch[aria-pressed="true"] { box-shadow: inset 0 -3px 6px rgba(0,0,0,.25), 0 0 0 2px #0e1019, 0 0 0 4px #fff; transform: scale(1.06); }
.ask { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left; padding: 12px 14px;
       border-radius: 16px; border: 1px dashed rgba(var(--violet), .55); background: rgba(var(--violet), .07); }
.ask i { grid-row: span 2; font-size: 18px; color: #c4b5fd; }
.ask span { font-size: 12px; color: var(--muted); }
.ask b { font-size: 14px; }
.ask:hover { background: rgba(var(--violet), .13); }
.small { font-size: 12px; }
@media (max-width: 680px) {
  .w-sheet.creator-sheet { height: calc(100dvh - 24px); }
  .w-modal { padding: 12px; }
  .creator { grid-template-columns: 1fr; grid-template-rows: 200px 1fr; padding: 6px 14px 10px; gap: 10px; }
  .tab span { font-size: 11px; }
  .thumbs { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
  .thumb canvas { width: 54px; height: 54px; }
  .creator-sheet .foot { padding: 0 14px 14px; flex-wrap: wrap; }
  .creator-sheet .foot .err { order: -1; flex-basis: 100%; }
}

/* request an item: a small form over the sheet */
.w-req { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px; background: rgba(5, 6, 11, .72); animation: fade .2s; }
.w-req-box { width: min(400px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: 20px; background: #12141f;
             border: 1px solid rgba(255,255,255,.14); box-shadow: 0 30px 70px -20px rgba(0,0,0,.9); animation: pop .25s var(--ease); }
.w-req-head { display: flex; align-items: center; }
.w-req-head h3 { margin: 0; flex: 1; font-size: 17px; }
.w-req-box .muted { margin: 0; font-size: 13px; line-height: 1.45; }
.w-req-box .close { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); background: rgba(255,255,255,.05); }
.w-req-box .w-btn.primary { justify-content: center; }
.w-sheet { position: relative; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: #c8ccd8; }
.field input, .field textarea { font: inherit; resize: vertical; font-size: 15px; font-weight: 400; color: var(--ink); background: #151826; border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; }
.field input:focus, .field textarea:focus { outline: none; border-color: rgba(var(--violet), .7); }
.field small { font-weight: 400; color: var(--muted); }
.foot { display: flex; align-items: center; gap: 10px; padding: 0 20px 20px; }
.foot .grow { flex: 1; }
.err { color: #fda4af; font-size: 13px; margin: 0; }
.muted { color: var(--muted); }
.pad { padding: 8px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.code { font: 600 22px ui-monospace, 'SFMono-Regular', Menlo, monospace; letter-spacing: .06em; text-align: center; padding: 16px; border-radius: 14px;
        background: #151826; border: 1px dashed rgba(var(--violet), .6); color: #e4dcff; user-select: all; }
.linkish { color: #c4b5fd; text-decoration: underline; font-size: 13px; }

.w-toast { position: fixed; top: 16px; left: 50%; z-index: 30; transform: translate(-50%, -80px); opacity: 0; padding: 10px 18px; border-radius: 999px; font-size: 14px;
           background: #171a29; border: 1px solid rgba(255,255,255,.14); transition: transform .35s var(--ease), opacity .35s; pointer-events: none; }
.w-toast.show { transform: translate(-50%, 0); opacity: 1; }
.w-noscript { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; }

/* Hetu's chat sits above the world */
.tw-bubble { z-index: 15; }
.tw-panel { z-index: 16; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- the revamp: sky, people list, stick, place cards ---- */
.sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0; --sky-top: #58b4ff; --sky-hor: #bfe6ff;
       background: linear-gradient(to bottom, var(--sky-top) 0%, var(--sky-hor) 78%, var(--sky-hor) 100%); }
#globe { touch-action: none; }
.tag { font-size: 11.5px; padding: 2px 8px; background: rgba(10, 11, 20, .72); backdrop-filter: blur(4px); }
#people-btn { gap: 7px; padding: 0 12px; }
#people-btn span { font-variant-numeric: tabular-nums; }

.w-people { position: fixed; left: 16px; top: 76px; z-index: 6; width: min(280px, calc(100vw - 32px)); max-height: min(460px, calc(100dvh - 190px));
            display: flex; flex-direction: column; border-radius: 20px; background: var(--panel); border: 1px solid var(--line);
            box-shadow: 0 30px 60px -24px rgba(0,0,0,.9); animation: pop .25s var(--ease); overflow: hidden; }
.w-people header { display: flex; align-items: center; padding: 12px 10px 8px 16px; }
.w-people header b { flex: 1; font-size: 15px; }
.w-people .x { width: 30px; height: 30px; border-radius: 50%; color: var(--muted); display: grid; place-items: center; }
.w-people .x:hover { background: rgba(255,255,255,.07); color: #fff; }
.w-people ul { list-style: none; margin: 0; padding: 0 6px 8px; overflow-y: auto; overscroll-behavior: contain; }
.w-people li button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; text-align: left; }
.w-people li button:hover { background: rgba(255,255,255,.06); }
.w-people .sw { width: 26px; height: 26px; border-radius: 50%; flex: none; box-shadow: inset 0 -3px 6px rgba(0,0,0,.3), 0 0 0 1px rgba(255,255,255,.14); }
.w-people .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.w-people .txt b { font-size: 13.5px; font-weight: 600; }
.w-people .txt small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-people .dot { width: 7px; height: 7px; border-radius: 50%; background: #6ee7b7; flex: none; }


.w-stick { position: fixed; left: 22px; bottom: 26px; z-index: 5; width: 112px; height: 112px; border-radius: 50%; display: none; place-items: center;
           background: rgba(14, 16, 25, .55); border: 1px solid rgba(255,255,255,.16); touch-action: none; backdrop-filter: blur(6px); }
.w-stick i { width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,.85); box-shadow: 0 6px 16px rgba(0,0,0,.35); transition: transform .08s; }
@media (pointer: coarse) { body.signed-in .w-stick { display: grid; } }

.w-card .badge { width: 64px; height: 64px; border-radius: 14px; flex: none; display: grid; place-items: center; font-size: 26px; color: #fde68a;
                 background: radial-gradient(circle at 50% 70%, rgba(250, 204, 21, .25), rgba(255,255,255,.03)); }
.w-card .status.plain { font-size: 13.5px; line-height: 1.5; color: #d6d9e4; }
.w-card .acts a.w-btn { text-decoration: none; }

@media (max-width: 560px) {
  .w-people { top: auto; bottom: 92px; left: 12px; right: 12px; width: auto; max-height: 50dvh; }
  #people-btn { padding: 0 10px; }
}
@media (max-width: 560px) and (pointer: coarse) {
  body.signed-in .w-emotes { left: auto; right: 16px; transform: none; bottom: 92px; flex-direction: column; padding: 5px; }
  body.signed-in .w-emotes button { width: 42px; height: 42px; font-size: 19px; }
  body.signed-in .w-emotes .sep { width: 26px; height: 1px; margin: 3px 0; }
}

.w-title { padding: 4px 12px 5px; border-radius: 12px; background: rgba(10, 11, 20, .55); backdrop-filter: blur(6px); margin-right: auto; }
.w-top { align-items: center; }

.w-title b { white-space: nowrap; }
@media (max-width: 480px) {
  .w-title small { display: none; }
  .w-title { padding: 6px 10px; }
  .w-title b { font-size: 15px; }
  .w-hint { white-space: normal; width: max-content; max-width: calc(100vw - 32px); text-align: center; top: 74px; bottom: auto; }
  body:not(.signed-in) #home { display: none; }
}
@media (max-width: 360px) { .w-title { display: none; } .w-top > .w-btn:first-child { margin-right: auto; } }
