/* MY WORLD — layout: top bar, parts kit (left, build mode), the 3D view, the side panel (right). */
html, body { height: 100%; }
body.world { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
input.in, textarea.in, select.in { background: rgba(0,0,0,.35); color: var(--text); border: 1px solid var(--gd-edge); border-radius: var(--r-sm); font: inherit; padding: 4px 7px; }
.toasts { position: fixed; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 6px; z-index: 50; }
.toast { background: var(--panel2); border: 1px solid var(--gd-edge); border-left: 3px solid var(--ph); padding: 8px 12px; border-radius: var(--r); max-width: 420px; }
.toast.ok { border-left-color: var(--ok); } .toast.warn { border-left-color: var(--warn); } .toast.bad { border-left-color: var(--bad); }

.w-top { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--gd-edge); background: var(--panel); flex-wrap: wrap; }
.w-modes { display: flex; border: 1px solid rgba(var(--ph-rgb), .45); border-radius: var(--r-sm); overflow: hidden; }
.w-mode { background: transparent; color: var(--ph-dim); border: 0; padding: 4px 12px; cursor: pointer; letter-spacing: .1em; }
.w-mode.on { background: rgba(var(--ph-rgb), .18); color: var(--ph-bright); }
.w-name { width: 15em; }
.w-grid { color: var(--ph-dim); font-size: var(--fs-0); letter-spacing: .1em; display: flex; align-items: center; gap: 5px; }
.w-grid input { width: 4.2em; }
.w-save { color: var(--ph-dim); font-size: var(--fs-0); min-width: 7em; text-align: right; }
.w-save.bad { color: var(--bad); }
.w-count { font-size: var(--fs-0); letter-spacing: .08em; display: flex; gap: 10px; }
.w-count .you { color: #ff4a3d; } .w-count .dec { color: #ffd60a; }

.w-body { flex: 1; display: flex; min-height: 0; }
.w-left { width: 190px; overflow-y: auto; border-right: 1px solid var(--gd-edge); background: var(--panel); padding: 8px; }
body.play .w-left { display: none; }
.w-left h3 { margin: 10px 0 5px; color: var(--ph); font-size: var(--fs-0); letter-spacing: .14em; font-weight: 600; }
.w-left h3:first-child { margin-top: 2px; }
.w-parts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.w-part { background: var(--gd-face); border: 1px solid var(--gd-edge); color: var(--text); border-radius: var(--r-sm); padding: 5px 4px; cursor: pointer; font-size: var(--fs-0); text-align: left; display: flex; gap: 5px; align-items: center; }
.w-part:hover { background: var(--gd-hover); }
.w-part.on { border-color: var(--ph); background: rgba(var(--ph-rgb), .18); color: var(--ph-bright); }
.w-part i { width: 10px; height: 10px; border-radius: 2px; flex: none; font-style: normal; }
.w-tools { display: flex; gap: 4px; margin-bottom: 6px; }
.w-tools .w-part { flex: 1; justify-content: center; }

.w-view { flex: 1; position: relative; min-width: 0; }
.w-view canvas { display: block; width: 100%; height: 100%; outline: none; }
.w-hint { position: absolute; left: 12px; bottom: 54px; color: var(--ph-dim); font-size: var(--fs-0); pointer-events: none; background: rgba(0,0,0,.35); padding: 4px 8px; border-radius: var(--r-sm); }
.w-hint:empty { display: none; }

.w-right { width: 330px; overflow-y: auto; border-left: 1px solid var(--gd-edge); background: var(--panel); padding: 10px 12px; }
.w-right:empty { display: none; }
.w-right h2 { margin: 0 0 4px; font-size: var(--fs-3); color: var(--ph-bright); }
.w-sub { color: var(--ph-dim); font-size: var(--fs-0); margin-bottom: 10px; }
.w-lab { color: var(--ph); font-size: var(--fs-0); letter-spacing: .12em; margin: 12px 0 4px; }
.w-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.w-row > .in { flex: 1; min-width: 0; }
.w-row input[type=color] { width: 42px; height: 28px; padding: 1px; background: none; border: 1px solid var(--gd-edge); }
.w-tie-st { font-size: var(--fs-0); color: var(--ph-dim); }
.w-tie-st b.you { color: #ff4a3d; } .w-tie-st b.dec { color: #ffd60a; }

.w-q { border: 1px solid var(--gd-edge); border-radius: var(--r); padding: 8px 10px; margin-bottom: 8px; background: var(--gd-face); }
.w-q.you { border-left: 3px solid #ff4a3d; } .w-q.decide { border-left: 3px solid #ffd60a; }
.w-q-h { display: flex; gap: 6px; align-items: baseline; font-size: var(--fs-0); color: var(--ph-dim); letter-spacing: .06em; }
.w-q-h .g { font-weight: 700; font-size: var(--fs-3); }
.w-q.you .g { color: #ff4a3d; } .w-q.decide .g { color: #ffd60a; }
.w-q-t { font-weight: 600; margin: 3px 0 5px; color: var(--text); }
.w-q-task { margin: 0 0 6px; }
.w-place { margin: 4px 0 6px; padding: 4px 6px; border-left: 2px solid var(--ph, #58e68c); background: rgba(88, 230, 140, 0.06); }
.w-place .w-row { gap: 6px; align-items: center; }
.w-q-brief { color: var(--ph-dim); font-size: var(--fs-1); margin: 4px 0 6px; max-height: 14em; overflow-y: auto; }
.w-docs { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.w-doc { font-size: var(--fs-0); border: 1px solid var(--gd-edge); border-radius: var(--r-sm); padding: 1px 6px; color: var(--gold); cursor: pointer; background: none; }
.w-doc:hover { background: var(--gd-hover); }
.w-q textarea { width: 100%; margin-top: 6px; }
.w-empty { color: var(--ph-dim); font-size: var(--fs-1); }

.w-tip { position: fixed; pointer-events: none; z-index: 40; background: var(--panel2); border: 1px solid var(--gd-edge); border-radius: var(--r-sm); padding: 4px 8px; font-size: var(--fs-0); max-width: 320px; display: none; }
.w-help { position: fixed; inset: 0; z-index: 45; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; }
.w-help[hidden] { display: none; }
.w-help > div { background: var(--panel); border: 1px solid var(--gd-edge); border-radius: var(--r-lg); padding: 16px 20px; max-width: 560px; }
.w-help table { border-collapse: collapse; } .w-help td { padding: 3px 12px 3px 0; vertical-align: top; } .w-help td:first-child { color: var(--gold); white-space: nowrap; }

.w-builder { position: absolute; left: 12px; right: 12px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.w-builder > * { pointer-events: auto; }
.w-ask { display: flex; gap: 6px; background: rgba(0,0,0,.45); border: 1px solid var(--gd-edge); border-radius: var(--r); padding: 5px; }
.w-ask input { flex: 1; min-width: 0; }
.w-ask.busy { opacity: .7; }
.w-said { align-self: flex-start; max-width: 100%; background: var(--panel2); border: 1px solid var(--gd-edge); border-left: 3px solid var(--ph); border-radius: var(--r); padding: 6px 10px; font-size: var(--fs-1); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.w-said:empty { display: none; }
.w-said.bad { border-left-color: var(--bad); }
.w-said small { color: var(--ph-dim); }
.w-form label { display: flex; gap: 8px; align-items: center; margin: 6px 0; } .w-form label > span { width: 9em; color: var(--ph-dim); } .w-form .in { flex: 1; }

.w-count .auto { color: #4fd1e8; } .w-count .back { color: #58e68c; }
.w-q.running { border-left: 3px solid #4fd1e8; } .w-q.queued { border-left: 3px solid #8fc4d4; } .w-q.back { border-left: 3px solid #58e68c; }
.w-q.running .g { color: #4fd1e8; } .w-q.queued .g { color: #8fc4d4; } .w-q.back .g { color: #58e68c; }

.w-look .w-k { color: var(--ph-dim); font-size: var(--fs-0); min-width: 3.4em; }
.w-skin { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.w-skin.on { border-color: var(--ph-bright); }

.w-find { width: 100%; margin-bottom: 6px; }
.w-worlds { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; min-width: 22em; }
.w-world { text-align: left; background: var(--gd-face); border: 1px solid var(--gd-edge); border-radius: var(--r-sm); color: var(--text); padding: 6px 10px; cursor: pointer; display: flex; flex-direction: column; }
.w-world:hover { background: var(--gd-hover); } .w-world.on { border-color: var(--ph); }
.w-world small { color: var(--ph-dim); }
.w-form input[type=range] { accent-color: var(--ph); }
/* Touch screens: every control at least 44 px (station code standard, rule 10). */
@media (pointer: coarse) {
  .sn-btn, .w-mode, .w-part, .w-world, input.in, select.in { min-height: 44px; }
  .w-skin { width: 44px; height: 44px; }
  .w-left { width: 220px; }
}
/* Narrow screens: the side panels fold over the view instead of squeezing it. */
@media (max-width: 760px) {
  .w-left { position: absolute; z-index: 5; top: 0; bottom: 0; left: 0; max-width: 70vw; }
  .w-right { position: absolute; z-index: 5; top: 0; bottom: 0; right: 0; width: min(330px, 90vw); }
  .w-body { position: relative; }
}
.w-left [hidden] { display: none !important; }

/* Top bar: one row on a desktop (the name box gives way first), wrapping only on narrow screens. */
.w-top { flex-wrap: nowrap; }
.w-name { flex: 0 1 13em; min-width: 6em; width: auto; }
.w-save { min-width: 0; white-space: nowrap; }
.w-top > * { flex-shrink: 0; }
.w-top > .w-name, .w-top > .sn-spacer { flex-shrink: 1; }
.w-parts-tog { display: none; }
@media (max-width: 1180px) { .w-grid > input { width: 3.4em; } .w-top { gap: 6px; } }
@media (max-width: 760px) {
  .w-top { flex-wrap: wrap; }
  .w-parts-tog { display: inline-block; }
  body.build .w-left { display: none; }
  body.build.parts-open .w-left { display: block; }
}
@media (max-width: 760px) { .w-hint { display: none; } }

/* Walk mode (walk.js): cross-hair, touch stick, the parts kit and builder bar step aside. */
.w-cross { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; pointer-events: none; z-index: 3;
  background: linear-gradient(var(--ph), var(--ph)) center/2px 14px no-repeat, linear-gradient(var(--ph), var(--ph)) center/14px 2px no-repeat; opacity: .8; }
.w-cross[hidden] { display: none; }
.w-stick { position: absolute; left: 22px; bottom: 90px; width: 120px; height: 120px; border-radius: 50%; background: rgba(0,0,0,.35); border: 2px solid var(--gd-edge); z-index: 4; touch-action: none; }
.w-stick[hidden] { display: none; }
.w-knob { position: absolute; left: 35px; top: 35px; width: 50px; height: 50px; border-radius: 50%; background: rgba(var(--ph-rgb), .5); }
body.walking .w-left, body.walking .w-builder { display: none !important; }

/* Crew name tags and bubbles: HTML over the 3D view (Three.js CSS2DRenderer). */
.w-labels { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.w-tagbox { display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: none; transform: translateY(-4px); }
.w-tag { font: 600 12px/1 var(--sn-font); padding: 3px 7px; border-radius: 9px; background: rgba(0,0,0,.62); white-space: nowrap; text-shadow: 0 1px 0 #000; }
.w-bub { font: 700 13px/1 var(--sn-font); padding: 4px 8px; border-radius: 10px; background: #f4f1ea; color: #1a1a1a; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.w-bub.asking { background: #5aa9ff; color: #fff; }
.w-bub[hidden] { display: none; }
.w-form label small { margin-left: 4px; }

/* The top bar never changes height (a wrap that comes and goes as the save status or counts change width would move
   the 3D view under the pointer mid-drag). Below ~1500 px it tightens, and if it still doesn't fit it scrolls sideways. */
.w-top { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.w-save { min-width: 8.5em; }
@media (max-width: 1500px) and (min-width: 761px) {
  .w-top { gap: 5px; padding: 6px 8px; }
  .w-top .sn-btn.xs { padding: 3px 6px; letter-spacing: .04em; }
  .w-grid { font-size: 0; gap: 3px; } .w-grid input { font-size: var(--fs-1); }
  .w-name { flex-basis: 9em; }
}
/* The hint line steps aside while a builder reply is showing. */
.w-view:has(.w-said:not(:empty)) .w-hint { display: none; }

/* ---------- quests (quests-view.js): sign-in on the people's address, quests, badges, rewards ---------- */
.w-hh { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hh-coins { font-weight: bold; color: #ffd60a; white-space: nowrap; }
body.people #w-worlds, body.people #w-crew, body.people .w-builder, body.people #w-model { display: none !important; }
body.people-family .w-modes:not(.w-hh .w-modes), body.people-family .w-grid, body.people-family #w-roof, body.people-family #w-undo { display: none !important; }
body.people-family #w-name { pointer-events: none; }
body.hh-locked .w-top, body.hh-locked .w-body { visibility: hidden; }
.hh-gate { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #0b0f0d; z-index: 50; outline: none; }
.hh-card { text-align: center; padding: 24px; max-width: 420px; width: 100%; }
.hh-card h2 { font-size: 1.6em; margin: 0 0 6px; }
.hh-names { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 16px; }
.hh-name { min-width: 140px; min-height: 64px; font-size: 1.3em; font-weight: bold; border: 3px solid; border-radius: 14px; background: transparent; color: inherit; cursor: pointer; }
.hh-pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 10px; justify-content: center; margin: 14px 0; }
.hh-key { height: 64px; font-size: 1.5em; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .06); color: inherit; cursor: pointer; }
.hh-key:active { background: rgba(255, 255, 255, .2); }
.hh-dots { font-size: 1.8em; letter-spacing: 6px; min-height: 1.4em; }
.hh-msg { color: #ff6961; min-height: 1.3em; }
.hh-box { min-width: min(720px, 92vw); max-height: 80vh; overflow: auto; }
.hh-tabs { margin: 6px 0 10px; flex-wrap: wrap; }
.hh-list { display: flex; flex-direction: column; gap: 6px; }
.hh-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 8px; }
.hh-row.hh-wrap { flex-wrap: wrap; }
.hh-row .in { min-width: 0; }
.hh-grow { flex: 1; min-width: 0; }
.hh-sub { opacity: .75; font-size: .92em; }
.hh-ok { color: #58e68c; font-weight: bold; }
.hh-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.hh-badge { padding: 4px 9px; border-radius: 999px; border: 1px solid #ffd60a; color: #ffd60a; font-size: .92em; }
.hh-badge.rank { border-color: #58e68c; color: #58e68c; font-weight: bold; }
.hh-badge.jobs { border-color: #5aa9ff; color: #5aa9ff; }
.hh-record { max-height: 220px; overflow: auto; font-size: .92em; }
.hh-record .pos { color: #58e68c; } .hh-record .neg { color: #ff6961; }
.hh-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin: 6px 0; }
.hh-field { display: flex; flex-direction: column; gap: 3px; }
.w-locked { opacity: .5; }
@media (pointer: coarse) { .hh-row .sn-btn, .w-hh .sn-btn, .w-hh .w-mode { min-height: 44px; } }

/* a DELETE button waiting for its second click (2026-10-26) */
.sn-btn.armed { color: var(--bad, #ff6961); border-color: rgba(255,105,97,.7); }
/* quests and Posts (todo item "Make everyone in COMMAND and set the first quest types and Missions") */
.hh-coins { background: transparent; border: 1px solid rgba(255, 214, 10, .45); border-radius: 6px; padding: 2px 8px; cursor: pointer; font: inherit; }
.hh-name small { display: block; font-size: .6em; font-weight: normal; opacity: .75; margin-top: 2px; }
.hh-photo { max-width: 220px; max-height: 170px; border-radius: 6px; display: block; margin-top: 4px; }
.hh-badge.quests { border-color: #5aa9ff; color: #5aa9ff; }
.w-plot-tag { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: rgba(0, 0, 0, .55); color: #fff; pointer-events: none; white-space: nowrap; }
.hh-quest > .hh-grow { flex: 1 1 100%; }
.hh-pics { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.hh-rem b { min-width: 74px; font-size: .8em; letter-spacing: .08em; }
.hh-rem.late b { color: #ff6961; } .hh-rem.soon b { color: #ffd60a; } .hh-rem.waiting b { color: #5aa9ff; } .hh-rem.open b { color: #58e68c; }
.w-hh .hh-late { border-color: #ff6961; color: #ff6961; }

/* ---------- every screen size, 2026-11-08 (docs/ui-changes.md, "Every app at every size"; ui/e2e/sizes-apps.mts) ---------- */
/* The parts kit never scrolls sideways (it did by ~11 px at 1366 and 1180): two columns that share its width. */
.w-left { overflow-x: hidden; }
.w-parts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.w-part { min-width: 0; overflow: hidden; }
/* Narrow screens (760 px and under): the panels' resize bars are off (panels-init.ts), and panels.ts folds a panel it
   starts on a narrow screen, which hid the parts kit and the side panel for good. Here the fold-over layout rules: the
   parts kit over the view while ☰ PARTS is on, the side panel over it while something is selected (✕ closes it). */
@media (max-width: 760px) {
  .w-left.mcp-off, .w-right.mcp-off { display: block !important; }
  .w-left { width: min(240px, 72vw) !important; }
  .w-right { width: min(330px, 92vw) !important; box-shadow: -6px 0 20px rgba(0, 0, 0, .5); }
  .w-right:empty, body.play .w-left, body.build:not(.parts-open) .w-left, body.walking .w-left { display: none !important; }
  body.build.parts-open .w-left { box-shadow: 6px 0 20px rgba(0, 0, 0, .5); }
  /* the tool bar: one row that scrolls sideways (☰ PARTS and BUILD / PLAY first), so the 3D view keeps the height */
  .w-top { flex-wrap: nowrap; }
}
/* Touch screens: the small tool-bar buttons and the grid boxes about 44 px wide too. */
@media (pointer: coarse) {
  .w-top .sn-btn.xs, .w-builder .sn-btn.xs, .w-right .sn-btn.xs { min-width: 44px; min-height: 44px; }
  .w-grid > input { min-width: 44px; }
  .w-doc { min-height: 40px; }
}
/* A short screen (a phone on its side): the builder's line slims down so the view keeps the height. */
@media (max-height: 520px) {
  .w-top { padding-top: 3px; padding-bottom: 3px; }
  .w-builder { bottom: 6px; }
}
@media (pointer: coarse) { .w-row input[type=color] { width: 48px; height: 44px; } }
/* A tablet on its side (a page 761-1100 px wide): the parts kit and the side panel narrower, so the view keeps ~45%. */
@media (min-width: 761px) and (max-width: 1100px) { .w-left { max-width: 180px; } .w-right { max-width: 280px; } }
@media (pointer: coarse) { .w-hint { bottom: 74px; } }

/* Passkeys (ui/passkeys.ts, 2026-11-18): the sign-in button under the names, and YOUR PASSKEYS. */
.hh-passkey { margin-top: 20px; }
.pk-panel .pk-row { align-items: center; gap: 8px; }
.pk-panel .pk-name { max-width: 16em; }
.pk-panel .pk-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.pk-panel .pk-add .in { flex: 1 1 10em; min-width: 0; }
.pk-panel .pk-add .hh-msg { flex-basis: 100%; }
