/* Petworld viewer — vaporwave pixel styling, scoped under .pw-root */
.pw-root {
  --pw-pink: #ff4fd8;
  --pw-cyan: #2de2e6;
  --pw-purple: #8a5cff;
  --pw-dark: #120a30;
  --pw-panel: #1a1040;
  --pw-ink: #f4ecff;
  --pw-muted: #a99cd0;
  --pw-font: "Space Mono", ui-monospace, monospace;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 12px;
  height: 100%;
  min-height: 520px;
  padding: 12px;
  box-sizing: border-box;
  background: var(--pw-dark);
  color: var(--pw-ink);
  font-family: var(--pw-font);
  font-size: calc(10px * var(--pw-fs, 1));
  line-height: 1.7;
}
.pw-root *,
.pw-root *::before,
.pw-root *::after {
  box-sizing: border-box;
}
.pw-stage {
  min-width: 0;
  min-height: 0;
}
.pw-viewport {
  position: relative;
  height: 100%;
  min-height: 360px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(45, 226, 230, 0.4);
  box-shadow: 0 0 0 1px rgba(255, 79, 216, 0.18), inset 0 0 40px rgba(138, 92, 255, 0.25), 0 0 30px rgba(255, 79, 216, 0.12);
  background: #0c0624;
}
.pw-canvas-host {
  position: absolute;
  inset: 0;
}
.pw-canvas-host canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
  image-rendering: pixelated;
}

/* HUD */
.pw-hud {
  top: 10px;
  left: 10px;
  max-width: min(70%, 420px);
}
.pw-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: calc(7px * var(--pw-fs, 1));
  background: rgba(18, 10, 48, 0.75);
  color: var(--pw-cyan);
  border: 1px solid rgba(45, 226, 230, 0.5);
}
.pw-badge[data-status="offline"],
.pw-badge[data-status="reconnecting"] {
  color: #ffb36b;
  border-color: rgba(255, 179, 107, 0.6);
}
.pw-controls {
  position: absolute;
  right: 10px;
  bottom: 44px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

/* Buttons & inputs */
.pw-btn {
  font: inherit;
  font-size: calc(8px * var(--pw-fs, 1));
  color: var(--pw-ink);
  background: rgba(26, 16, 64, 0.85);
  border: 1px solid rgba(138, 92, 255, 0.7);
  border-radius: 8px;
  padding: 7px 9px;
  cursor: pointer;
  line-height: 1;
}
.pw-btn:hover {
  border-color: var(--pw-cyan);
  box-shadow: 0 0 10px rgba(45, 226, 230, 0.35);
}
.pw-btn.on {
  background: rgba(255, 79, 216, 0.22);
  border-color: var(--pw-pink);
  color: #fff;
}
.pw-btn.pw-primary {
  background: linear-gradient(90deg, rgba(255, 79, 216, 0.4), rgba(138, 92, 255, 0.4));
  border-color: var(--pw-pink);
}
.pw-input,
.pw-select {
  font: inherit;
  font-size: calc(9px * var(--pw-fs, 1));
  color: var(--pw-ink);
  background: #0e0828;
  border: 1px solid rgba(138, 92, 255, 0.6);
  border-radius: 8px;
  padding: 8px;
  min-width: 0;
}
.pw-input:focus,
.pw-select:focus {
  outline: none;
  border-color: var(--pw-cyan);
}

/* Bubbles */
.pw-bubbles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.pw-bubble {
  position: absolute;
  left: 0;
  top: 0;
  max-width: 230px;
  padding: 7px 9px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  color: #1a1030;
  font-size: calc(8px * var(--pw-fs, 1));
  line-height: 1.6;
  opacity: 0;
  transition: opacity 180ms ease;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35), 0 0 0 2px var(--pw-pink);
  margin-top: -10px;
}
.pw-bubble.on {
  opacity: 1;
}
.pw-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  background: inherit;
  transform: translateX(-50%) rotate(45deg);
}
.pw-bubble-npc {
  max-width: 180px;
  font-size: calc(7px * var(--pw-fs, 1));
  background: rgba(220, 250, 255, 0.92);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 2px var(--pw-cyan);
}
.pw-bubble-npc b {
  color: #6b2fbf;
}
/* speech: both (q137): what the pet heard, under the true line */
.pw-heardline {
  display: block;
  margin-top: 3px;
  padding-top: 3px;
  border-top: 1px dashed rgba(60, 60, 90, 0.35);
  font-style: italic;
  color: #3d4a6b;
}
.pw-bubble-animal {
  background: rgba(255, 248, 220, 0.92);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 2px #d8a23a;
}

/* big text (root.pw-bigtext): bubbles scale with --bt (set per bubble by app.js placeBubble from the tile size) */
.pw-bigtext .pw-bubble { font-size: var(--bt, 20px); line-height: 1.25; font-weight: 700; padding: .45em .6em; border-radius: .6em; max-width: 92%; white-space: normal; overflow-wrap: anywhere; margin-top: calc(var(--bt, 20px) * -.4); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35), 0 0 0 calc(var(--bt, 20px) * .12) var(--pw-pink); }
.pw-bigtext .pw-bubble-npc { font-size: var(--bt, 20px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 calc(var(--bt, 20px) * .12) var(--pw-cyan); }
.pw-bigtext .pw-bubble-animal { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 calc(var(--bt, 20px) * .12) #d8a23a; }
.pw-bigtext .pw-bubble::after { bottom: calc(var(--bt, 20px) * -.28); width: calc(var(--bt, 20px) * .55); height: calc(var(--bt, 20px) * .55); }
.pw-bigtext .pw-bubbles { z-index: 4; } /* above the big status card and feed (z 3), below the tile menus (5) */
.pw-bigtext .pw-heardline { margin-top: .2em; padding-top: .2em; }

/* Thought ticker */
.pw-ticker {
  left: 10px;
  right: 10px;
  bottom: 10px;
}

/* Loading */
.pw-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 14px;
  text-align: center;
  background: radial-gradient(circle at 50% 40%, #2a1660, #120a30 70%);
  transition: opacity 500ms ease;
  z-index: 8; /* over the tile layer and its cards (they are built while the overlay waits for the pets) */
}
.pw-loading.done {
  opacity: 0;
  pointer-events: none;
}
.pw-loading-title {
  color: var(--pw-pink);
  font-size: calc(12px * var(--pw-fs, 1));
  text-shadow: 0 0 12px rgba(255, 79, 216, 0.7);
}
.pw-loading-bar {
  width: min(320px, 70vw);
  height: 10px;
  margin: 0 auto;
  border: 1px solid var(--pw-cyan);
  border-radius: 6px;
  overflow: hidden;
}
.pw-loading-bar i {
  display: block;
  height: 100%;
  width: 6%;
  background: linear-gradient(90deg, var(--pw-pink), var(--pw-cyan));
  transition: width 200ms ease;
}
.pw-loading-msg {
  color: var(--pw-muted);
  font-size: calc(8px * var(--pw-fs, 1));
}

.pw-slownote {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 9;
  padding: 4px 10px;
  border-radius: 10px;
  background: rgba(18, 10, 48, 0.78);
  color: var(--pw-muted);
  font-size: calc(9px * var(--pw-fs, 1));
  pointer-events: none;
}
.pw-slownote:empty { display: none; }

/* Panel */
.pw-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: 14px;
  background: var(--pw-panel);
  border: 1px solid rgba(138, 92, 255, 0.45);
  overflow: hidden;
}
.pw-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid rgba(138, 92, 255, 0.35);
}
.pw-tab {
  font: inherit;
  font-size: calc(8px * var(--pw-fs, 1));
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--pw-muted);
  cursor: pointer;
}
.pw-tab.on {
  color: #fff;
  border-color: var(--pw-pink);
  background: rgba(255, 79, 216, 0.15);
}
.pw-panes {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 10px 12px 16px;
}
.pw-pane h3 {
  font-size: calc(10px * var(--pw-fs, 1));
  margin: 6px 0;
  color: var(--pw-cyan);
  line-height: 1.6;
}
.pw-pane h4 {
  font-size: calc(8px * var(--pw-fs, 1));
  margin: 14px 0 6px;
  color: var(--pw-pink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pw-pane p,
.pw-pane li {
  font-size: calc(9px * var(--pw-fs, 1));
}
.pw-pane ul {
  margin: 4px 0;
  padding-left: 16px;
}
.pw-muted {
  color: var(--pw-muted);
}
.pw-small {
  font-size: calc(7px * var(--pw-fs, 1)) !important;
}
.pw-center {
  text-align: center;
}
.pw-tag {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 3px 6px;
  border-radius: 6px;
  font-size: calc(7px * var(--pw-fs, 1));
  background: rgba(138, 92, 255, 0.22);
  border: 1px solid rgba(138, 92, 255, 0.4);
}
/* a little rendered picture of an item, before its name (viewer/itemart.js fills in the image) */
.pw-ico {
  display: inline-block;
  width: 1.7em;
  height: 1.7em;
  margin: -0.45em 0.25em -0.45em 0;
  vertical-align: middle;
  background: center / contain no-repeat;
  font-style: normal;
}
.pw-tag .pw-ico { margin-left: -2px; }
.pw-tag.like {
  border-color: rgba(255, 79, 216, 0.6);
}
.pw-tag.dislike {
  border-color: rgba(255, 179, 107, 0.6);
  color: #ffd2a8;
}

/* Chat */
.pw-chatlog {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 46vh;
  min-height: 160px;
  overflow: auto;
  padding: 4px 2px 8px;
}
.pw-line {
  max-width: 88%;
  padding: 7px 9px;
  border-radius: 10px;
  font-size: calc(9px * var(--pw-fs, 1));
  background: rgba(45, 226, 230, 0.12);
  border: 1px solid rgba(45, 226, 230, 0.3);
  align-self: flex-start;
}
.pw-line b {
  display: block;
  font-size: calc(7px * var(--pw-fs, 1));
  color: var(--pw-cyan);
  margin-bottom: 2px;
}
.pw-line.me {
  align-self: flex-end;
  background: rgba(255, 79, 216, 0.14);
  border-color: rgba(255, 79, 216, 0.35);
}
.pw-line.me b {
  color: var(--pw-pink);
}
.pw-line.care {
  background: rgba(138, 92, 255, 0.16);
  border-color: rgba(138, 92, 255, 0.45);
}
.pw-line.care b {
  color: #c9b2ff;
}
.pw-actlist {
  list-style: none;
  padding: 0 !important;
  margin: 6px 0 0 !important;
}
.pw-actlist li {
  font-size: calc(7px * var(--pw-fs, 1)) !important;
}
.pw-actlist .ok {
  color: #8dffb5;
}
.pw-actlist .bad {
  color: #ffb36b;
}
.pw-chatform {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.pw-chatform .pw-input {
  flex: 1;
}
.pw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.pw-group {
  display: inline-flex;
  gap: 4px;
  min-width: 0;
}
.pw-group .pw-select {
  max-width: 150px;
}
.pw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.pw-chip {
  font: inherit;
  font-size: calc(7px * var(--pw-fs, 1));
  padding: 6px 8px;
  border-radius: 999px;
  color: var(--pw-ink);
  background: rgba(138, 92, 255, 0.18);
  border: 1px solid rgba(138, 92, 255, 0.5);
  cursor: pointer;
}
.pw-chip:hover {
  border-color: var(--pw-cyan);
}
.pw-chip.on {
  background: rgba(45, 226, 230, 0.28);
  border-color: var(--pw-cyan);
}
.pw-mfilter {
  align-items: center;
  margin: 0 0 8px;
}
.pw-mmore {
  margin-top: 8px;
}

/* Log */
.pw-loghead {
  display: flex;
  justify-content: space-between;
  font-size: calc(7px * var(--pw-fs, 1));
  color: var(--pw-muted);
  margin-bottom: 6px;
}
.pw-entry {
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 10px;
  background: rgba(14, 8, 40, 0.7);
  border: 1px solid rgba(138, 92, 255, 0.3);
  border-left: 3px solid var(--pw-purple);
  transition: box-shadow 300ms ease;
}
.pw-entry.kind-finding,
.pw-entry.kind-revision {
  border-left-color: var(--pw-cyan);
}
.pw-entry.kind-philosophy,
.pw-entry.kind-reflection,
.pw-entry.kind-dream {
  border-left-color: var(--pw-pink);
}
.pw-entry.kind-question,
.pw-entry.kind-hypothesis {
  border-left-color: #ffe680;
}
.pw-entry.pw-flash {
  box-shadow: 0 0 0 2px var(--pw-cyan), 0 0 18px rgba(45, 226, 230, 0.5);
}
.pw-entry header {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: calc(7px * var(--pw-fs, 1));
  color: var(--pw-muted);
}
.pw-entry-id {
  color: var(--pw-pink);
}
.pw-kind {
  text-transform: uppercase;
}
.pw-entry time {
  margin-left: auto;
}
.pw-body p {
  margin: 6px 0;
  line-height: 1.8;
}
.pw-body h4 {
  margin-top: 10px;
}
.pw-entry footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
  font-size: calc(7px * var(--pw-fs, 1));
  color: var(--pw-muted);
}
.pw-cite {
  color: var(--pw-cyan);
  text-decoration: none;
  border-bottom: 1px dashed rgba(45, 226, 230, 0.6);
}
.pw-embed {
  display: inline-block;
  vertical-align: top;
  margin: 6px 6px 2px 0;
}
.pw-older {
  width: 100%;
  margin-top: 6px;
}

/* Media */
.pw-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.pw-mtile {
  position: relative;
  display: block;
  width: 168px;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(45, 226, 230, 0.45);
  background: #0c0624;
  cursor: pointer;
  font: inherit;
  color: var(--pw-ink);
  text-align: left;
}
.pw-mtile.big {
  width: 100%;
}
.pw-mtile img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  image-rendering: pixelated;
  background: #1c1145;
}
.pw-art-tile { display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 10; padding: 8px; box-sizing: border-box; overflow: hidden; background: #1c1145; }
.pw-art-tile .pw-art-poem { font-size: 0.8em; max-height: none; overflow: hidden; }
.pw-art-moves { margin: 0; font-size: 0.8em; color: var(--pw-muted); text-align: center; }
.pw-art-big { max-width: 100%; height: auto; image-rendering: auto; }
/* a music work (q467): a staff of its notes, its form, its first words, a play mark */
.pw-art-tile:has(> .pw-song-tile) { grid-template-columns: minmax(0, 1fr); place-items: stretch; }
.pw-song-tile { min-width: 0; position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; gap: 2px; text-align: left; font-size: 0.75em; }
.pw-song-play { position: absolute; right: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--pw-accent, #ffb347); color: #1c1145; font-size: 12px; cursor: pointer; z-index: 1; }
.pw-song-play.on, .pw-song-bigplay.on { background: #7fe0a0; }
.pw-song-form { color: var(--pw-muted); }
.pw-song-v2 { color: #b9a3ff; font-size: 0.9em; }
.pw-song-staff { position: relative; flex: 1; min-height: 28px; background: repeating-linear-gradient(to top, transparent 0 9px, rgba(255,255,255,0.08) 9px 10px); }
.pw-song-staff i { position: absolute; border-radius: 50%; background: #ffd27f; transform: translate(-50%, 50%); }
.pw-song-words { font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pw-song-view { padding: 8px 0; }
.pw-song-lyrics { font-size: 1.1em; line-height: 1.6; }
.pw-song-lyrics span.on { color: #1c1145; background: #ffd27f; border-radius: 3px; }
.pw-mbadge {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 5px;
  border-radius: 6px;
  background: rgba(18, 10, 48, 0.8);
  font-size: calc(8px * var(--pw-fs, 1));
  color: var(--pw-pink);
}
.pw-mcap {
  display: block;
  padding: 5px 6px;
  font-size: calc(7px * var(--pw-fs, 1));
  line-height: 1.5;
}
/* what became of a ground drawing, in its words (arts A4): beside the original, never on it */
.pw-mfate {
  display: block;
  padding: 0 6px 5px;
  font-size: calc(7px * var(--pw-fs, 1));
  line-height: 1.5;
  font-style: italic;
  opacity: 0.75;
}
.pw-asnow { margin: 6px 0; }
.pw-audio-tile {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  aspect-ratio: 16 / 10;
  padding: 12px;
  background: linear-gradient(180deg, #1c1145, #2a1660);
}
.pw-audio-tile span {
  margin-right: 8px;
  color: var(--pw-pink);
  font-size: calc(18px * var(--pw-fs, 1));
}
.pw-audio-tile i {
  display: block;
  width: 6px;
  background: var(--pw-cyan);
  animation: pw-eq 1.1s ease-in-out infinite alternate;
}
.pw-audio-tile i:nth-child(2) { height: 40%; animation-delay: -0.2s; }
.pw-audio-tile i:nth-child(3) { height: 70%; animation-delay: -0.5s; }
.pw-audio-tile i:nth-child(4) { height: 30%; animation-delay: -0.8s; }
.pw-audio-tile i:nth-child(5) { height: 55%; animation-delay: -0.3s; }
.pw-audio-tile i:nth-child(6) { height: 45%; animation-delay: -0.6s; }
@keyframes pw-eq {
  to {
    transform: scaleY(0.4);
  }
}

/* Modal */
.pw-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(8, 4, 24, 0.78);
}
.pw-modal[hidden] {
  display: none;
}
.pw-modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 14px;
  border-radius: 14px;
  background: var(--pw-panel);
  border: 1px solid var(--pw-pink);
  box-shadow: 0 0 40px rgba(255, 79, 216, 0.3);
}
.pw-modal-close {
  float: right;
}
.pw-modal-card h3 {
  color: var(--pw-cyan);
  font-size: calc(10px * var(--pw-fs, 1));
}
.pw-mview {
  clear: both;
  padding-top: 8px;
}
.pw-photo,
.pw-wave {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  image-rendering: pixelated;
  border: 1px solid rgba(45, 226, 230, 0.45);
  background: #0c0624;
}

/* Mind */
.pw-mood-line {
  font-size: calc(9px * var(--pw-fs, 1));
}
.pw-mood-line b {
  color: var(--pw-pink);
}
.pw-queue {
  margin: 4px 0 10px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}
.pw-queue h4 {
  margin-top: 0;
}
.pw-queue h5 {
  margin: 8px 0 4px;
  font-size: 0.8em;
  color: var(--pw-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pw-q-now {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.pw-q-now b {
  color: var(--pw-cyan);
}
.pw-q-dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 0.35em;
  border-radius: 50%;
  background: var(--pw-pink);
  box-shadow: 0 0 6px var(--pw-pink);
  animation: pw-q-pulse 1.6s ease-in-out infinite;
}
@keyframes pw-q-pulse {
  50% { opacity: 0.35; }
}
.pw-queue em {
  display: block;
  font-style: normal;
  font-size: 0.82em;
  color: var(--pw-muted);
}
.pw-q-next {
  margin: 0;
  padding-left: 1.6em;
}
.pw-q-next li {
  margin: 0 0 5px;
  overflow-wrap: anywhere;
}
.pw-q-next li::marker {
  color: var(--pw-purple);
}
.pw-now {
  color: var(--pw-cyan);
}
.pw-bar,
.pw-axis {
  display: grid;
  grid-template-columns: calc(90px * var(--pw-fs, 1)) 1fr calc(34px * var(--pw-fs, 1));
  gap: 8px;
  align-items: center;
  font-size: calc(7px * var(--pw-fs, 1));
  margin: 4px 0;
}
.pw-bar i,
.pw-axis i {
  position: relative;
  display: block;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.pw-bar b {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--pw-pink), var(--pw-cyan));
}
.pw-axis b {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--pw-purple);
}
.pw-axis u {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.4);
}
.pw-bar span { overflow-wrap: anywhere; }
.pw-bar em,
.pw-axis em {
  font-style: normal;
  text-align: right;
  color: var(--pw-muted);
}
.pw-stats,
.pw-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: calc(8px * var(--pw-fs, 1));
}
.pw-stats b,
.pw-skills b {
  color: var(--pw-cyan);
}
.pw-stats b.cold {
  color: #8fc7ff;
}
.pw-stats b.hot {
  color: #ff8f6b;
}
.pw-wants {
  list-style: none;
  padding: 0 !important;
}
.pw-wants li {
  position: relative;
  padding: 4px 6px;
  margin: 3px 0;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}
.pw-wants li i {
  position: absolute;
  inset: 0 auto 0 0;
  background: rgba(255, 79, 216, 0.16);
  z-index: 0;
}
/* Can't yet: what it wanted and couldn't, in its words, and the closest way there (shared/base/requires.js) */
.pw-blocked {
  list-style: none;
  padding: 0 !important;
}
.pw-blocked li {
  padding: 4px 6px;
  margin: 3px 0;
  border-radius: 6px;
  background: rgba(255, 176, 79, 0.08);
  border-left: 2px solid rgba(255, 176, 79, 0.5);
}
/* the Heart section: feelings and why, wonderings, yearnings */
.pw-heart {
  list-style: none;
  padding: 0 !important;
  margin: 2px 0 6px;
}
.pw-heart li {
  padding: 3px 6px;
  margin: 2px 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  overflow-wrap: anywhere;
}
.pw-heart-ico {
  display: inline-block;
  width: 1.4em;
  color: var(--pw-pink);
  text-align: center;
}
.pw-heart .pw-dots {
  float: right;
  margin-left: 6px;
  color: var(--pw-pink);
  letter-spacing: 1px;
  opacity: 0.8;
}
.pw-heart .pw-grow .pw-dots { float: none; white-space: nowrap; overflow-wrap: normal; margin: 0 6px 0 0; }
.pw-heart .pw-why {
  display: block;
  padding-left: 1.4em;
}
.pw-code {
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  background: #0b0620;
  border: 1px solid rgba(45, 226, 230, 0.35);
  color: #b6fff9;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: calc(11px * var(--pw-fs, 1));
  line-height: 1.5;
  white-space: pre-wrap;
  overflow: auto;
}

/* Research, friends */
.pw-topic,
.pw-friend {
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 10px;
  background: rgba(14, 8, 40, 0.7);
  border: 1px solid rgba(138, 92, 255, 0.3);
}
.pw-q li::marker {
  content: "? ";
  color: #ffe680;
}

/* Map */
.pw-mapwrap {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(45, 226, 230, 0.45);
}
.pw-map {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
  image-rendering: pixelated;
}
.pw-maptools {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

/* Remote (read-only) */
.pw-remote .pw-badge {
  color: var(--pw-pink);
  border-color: rgba(255, 79, 216, 0.6);
}

/* Phones & narrow screens */
@media (max-width: 900px) {
  .pw-hud {
    max-width: 76%;
  }
  .pw-controls {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 60%;
  }
}

.pw-style {
  font-size: calc(8px * var(--pw-fs, 1));
  padding: 6px;
  background: rgba(26, 16, 64, 0.9);
}
.pw-mapwx {
  font-size: calc(7px * var(--pw-fs, 1));
  padding: 4px;
  max-width: 120px;
}
.pw-maplegend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: calc(7px * var(--pw-fs, 1));
  color: var(--pw-muted);
  min-height: 12px;
}
.pw-maplegend i {
  display: block;
  flex: 1;
  min-width: 80px;
  height: 8px;
  border-radius: 4px;
}
.pw-maplegend em {
  flex-basis: 100%;
  font-style: normal;
}

/* Talk log */
.pw-convolog {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 62vh;
  overflow: auto;
  padding: 2px 2px 10px;
}
.pw-scene {
  align-self: center;
  margin: 10px 0 2px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: calc(7px * var(--pw-fs, 1));
  color: var(--pw-muted);
  background: rgba(138, 92, 255, 0.15);
}
.pw-cline {
  max-width: 86%;
  padding: 6px 9px;
  border-radius: 10px;
  font-size: calc(9px * var(--pw-fs, 1));
  line-height: 1.6;
}
.pw-cline b {
  display: block;
  font-size: calc(7px * var(--pw-fs, 1));
  margin-bottom: 2px;
}
.pw-cline.pet {
  align-self: flex-start;
  background: rgba(255, 79, 216, 0.14);
  border: 1px solid rgba(255, 79, 216, 0.4);
}
.pw-cline.pet b {
  color: var(--pw-pink);
}
.pw-cline.other {
  align-self: flex-end;
  background: rgba(45, 226, 230, 0.1);
  border: 1px solid rgba(45, 226, 230, 0.35);
}
.pw-cline.other b {
  color: var(--pw-cyan);
}

/* ---- tidy panel: even tab grid ---- */
.pw-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  flex-wrap: initial;
  gap: 4px;
  padding: 8px;
}
.pw-remote .pw-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.pw-tab {
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 7px 4px;
  border: 1px solid rgba(138, 92, 255, 0.25);
}

/* ---- map: toolbar, framed canvas, compact legend ---- */
.pw-maptools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}
.pw-maptools .pw-btn {
  white-space: nowrap;
}
.pw-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: calc(7px * var(--pw-fs, 1));
  color: var(--pw-muted);
  white-space: nowrap;
}
.pw-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.pw-switch-track {
  position: relative;
  width: 28px;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(138, 92, 255, 0.6);
  transition: background 150ms ease;
}
.pw-switch-knob {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--pw-muted);
  transition: transform 150ms ease, background 150ms ease;
}
.pw-switch input:checked + .pw-switch-track {
  background: rgba(255, 79, 216, 0.35);
}
.pw-switch input:checked + .pw-switch-track .pw-switch-knob {
  transform: translateX(14px);
  background: #fff;
}
.pw-wxpick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: calc(7px * var(--pw-fs, 1));
  color: var(--pw-muted);
  white-space: nowrap;
}
.pw-mapwx {
  max-width: none;
  padding: 5px 6px;
}
.pw-mapwrap {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(45, 226, 230, 0.35);
  box-shadow: 0 0 0 1px rgba(255, 79, 216, 0.12), 0 6px 18px rgba(0, 0, 0, 0.35);
  background: #0c0624;
  line-height: 0;
}
.pw-maplegend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-top: 8px;
  font-size: calc(7px * var(--pw-fs, 1));
  color: var(--pw-muted);
}
.pw-maplegend i {
  flex: 1 1 80px;
  max-width: 160px;
  height: 7px;
}
.pw-maplegend b.sw {
  display: inline-block;
  width: 14px;
  height: 7px;
  border-radius: 3px;
  margin-left: 4px;
}
.pw-maplegend b.sw:first-child {
  margin-left: 0;
}
.pw-maplegend em {
  flex-basis: auto;
  margin-left: auto;
}
.pw-mapnote {
  margin: 6px 0 0;
  font-size: calc(7px * var(--pw-fs, 1)) !important;
  color: var(--pw-muted);
  opacity: 0.8;
}
.pw-font {
  font-size: calc(8px * var(--pw-fs, 1));
  padding: 6px;
  background: rgba(26, 16, 64, 0.9);
  max-width: 130px;
}
@media (max-width: 900px) {
  .pw-wxpick {
    margin-left: 0;
  }
}
.pw-mapzoom {
  display: inline-flex;
  gap: 4px;
}
.pw-mapzoom .pw-btn {
  min-width: 26px;
  padding: 6px 7px;
}
.pw-maptoggles {
  gap: 10px 14px;
}
.pw-map {
  cursor: grab;
  touch-action: none;
  image-rendering: auto;
}
.pw-map:active {
  cursor: grabbing;
}

/* People: compact one-line friends above the conversation log */
.pw-people {
  margin-bottom: 8px;
}
.pw-people .pw-friend {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin-bottom: 4px;
}
.pw-friend-head {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
  overflow: hidden;
}
.pw-friend-head b {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pw-friend-bars {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 6px;
  align-items: center;
  font-size: 0.78em;
  color: var(--pw-muted);
}
.pw-friend-bars i {
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.pw-friend-bars i b {
  display: block;
  height: 100%;
  background: var(--pw-pink);
}
.pw-friend-bars i + span + i b {
  background: var(--pw-cyan);
}
.pw-program summary {
  cursor: pointer;
  color: var(--pw-muted);
  font-size: 0.85em;
  margin: 2px 0 6px;
}

/* Pet tab: what it looks like */
.pw-looks {
  margin: 4px 0 10px;
}
.pw-look-body {
  margin: 0 0 6px;
  line-height: 1.45;
}
.pw-look-row {
  margin: 0 0 4px;
  line-height: 1.4;
}
.pw-sense {
  margin: 0 0 3px;
  line-height: 1.4;
  font-size: 0.92em;
}
.pw-sense > span:first-child {
  display: inline-block;
  min-width: 4.2em;
  font-size: 0.85em;
}
.pw-look-row span {
  display: inline-block;
  min-width: 6.5em;
  margin-right: 6px;
  color: var(--pw-muted);
  font-size: 0.85em;
}

/* badges (achievement patches); "pw-medal" so they don't pick up the live-status .pw-badge styles */
.pw-psec { display: flex; flex-wrap: wrap; gap: 0 14px; margin: 0 0 2px; }
.pw-pgroup { display: flex; flex-direction: column; }
.pw-pglabel { font-size: 11px; line-height: 14px; color: var(--pw-muted, #a99bd0); }
.pw-pgrid { display: flex; flex-wrap: wrap; }
.pw-pcell { flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px; background: none; display: grid; place-items: center; cursor: pointer; color: inherit; font: inherit; }
.pw-pcell.on { background: rgba(255, 255, 255, 0.12); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35); }
.pw-pcell .pw-pdisc { width: 32px; height: 32px; }
.pw-pcell .pw-pdisc-i { font-size: 16px; }
.pw-pcell .pw-pdisc-new { top: -1px; right: -1px; }
.pw-pdetail { margin: 2px 0 4px; }
.pw-pdetail:empty { display: none; }
.pw-plink { color: #8fd3ff; text-decoration: underline dotted; display: inline-block; padding: 13px 0; margin: -13px 0; } /* a 44 px tap height without growing the line */
.pw-plink:hover { color: #c4ecff; }
.pw-hl .pw-plink, .pw-recap-lines .pw-plink, .pw-recap-hl .pw-plink { display: inline; padding: 0; margin: 0; }
.pw-plink .pw-pdisc { display: inline-grid; vertical-align: middle; width: 16px; height: 16px; margin-right: 2px; }
.pw-hl-ic .pw-pdisc, .pw-wiki-list .pw-pdisc { display: inline-grid; width: 20px; height: 20px; vertical-align: middle; }

/* research wiki */
.pw-wiki-bar { display: grid; grid-template-columns: auto auto 1fr; gap: 6px; margin-bottom: 10px; position: sticky; top: 0; z-index: 1; background: inherit; }
.pw-wiki-search { min-width: 0; font: inherit; padding: 4px 8px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(0, 0, 0, 0.25); color: inherit; }
.pw-wiki-crumb { font-size: 0.85em; opacity: 0.8; margin: 0 0 4px; }
.pw-wiki-title { margin: 0 0 6px; }
.pw-wiki-lead { margin: 0 0 8px; }
.pw-wiki-lines, .pw-wiki-list { margin: 0 0 8px; padding-left: 1.1em; }
.pw-wiki-lines li, .pw-wiki-list li { margin: 2px 0; }
.pw-wl { color: #8fd3ff; text-decoration: none; border-bottom: 1px dotted currentColor; }
.pw-wl:hover { color: #c4ecff; }
.pw-wiki-here { font-size: 0.9em; }

/* problems the pet is working on */
.pw-problem { margin: 0 0 6px; padding: 4px 8px; border-left: 3px solid #ff9b5e; background: rgba(255, 155, 94, 0.08); }
.pw-problem p { margin: 2px 0 0; }

/* Pet tab: collapsible sections */
.pw-fold { margin: 0 0 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.pw-fold > summary { cursor: pointer; list-style: none; padding: 6px 0; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--pw-accent, #ff6ec7); font-size: 0.9em; }
.pw-fold > summary::-webkit-details-marker { display: none; }
.pw-fold > summary::before { content: "▸ "; opacity: 0.7; }
.pw-fold[open] > summary::before { content: "▾ "; }
.pw-fold > summary span { text-transform: none; letter-spacing: 0; font-weight: 400; }
.pw-space { font-style: normal; opacity: 0.6; font-size: 0.85em; margin-left: 2px; }
.pw-space::before { content: "· "; }

/* Log tab: the raw stream */
/* pinned flush to the panel's bottom edge (over its padding), solid so no log lines show around it */
.pw-raw-bar { position: sticky; bottom: -16px; z-index: 1; display: flex; justify-content: flex-end; margin: 8px -12px -16px; padding: 8px 12px 12px; background: var(--pw-panel, #1a1040); border-top: 1px solid rgba(255, 255, 255, 0.1); }
.pw-rawpane:not([hidden]) { display: flex; flex-direction: column; min-height: 100%; }
.pw-rawpane > .pw-raw { flex: 1; }
.pw-raw-bar label { display: flex; align-items: center; gap: 6px; font-size: 0.85em; }
.pw-raw { font-size: 0.85em; line-height: 1.45; }
.pw-raw-line { display: grid; grid-template-columns: auto 1.4em 1fr; gap: 6px; padding: 2px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.pw-raw-time { opacity: 0.55; }
.pw-raw-text i { opacity: 0.55; font-style: normal; }
.pw-raw-line.t-start .pw-raw-text { color: #8fd3ff; }
.pw-raw-line.t-done .pw-raw-text { color: #9ff0b8; }
.pw-raw-line.t-problem .pw-raw-text { color: #ffb37a; }
.pw-raw-line.t-feel .pw-raw-text { color: #e7b6ff; }

/* ---- side panel: one dropdown menu, hide/show, resizable ---- */
.pw-root {
  grid-template-columns: minmax(0, 1fr) 8px var(--pw-side, 380px);
  column-gap: 4px;
}
.pw-resizer {
  cursor: col-resize;
  border-radius: 4px;
  background: linear-gradient(90deg, transparent 3px, rgba(138, 92, 255, 0.35) 3px, rgba(138, 92, 255, 0.35) 5px, transparent 5px);
  touch-action: none;
}
.pw-resizer:hover, .pw-resizing .pw-resizer { background: linear-gradient(90deg, transparent 2px, #ff6ec7 2px, #ff6ec7 6px, transparent 6px); }
.pw-resizing { cursor: col-resize; user-select: none; }
.pw-resizing iframe, .pw-resizing canvas { pointer-events: none; }
.pw-tabs, .pw-remote .pw-tabs {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 6px;
  padding: 8px;
}
.pw-menu { flex: 1; min-width: 0; font: inherit; font-size: 1.05em; padding: 6px 8px; }
.pw-hide-side { flex: none; }
.pw-show-side { position: absolute; top: 44px; right: 10px; z-index: 5; display: none; }
.pw-side-hidden { grid-template-columns: minmax(0, 1fr) 0 0; column-gap: 0; }
.pw-side-hidden .pw-panel, .pw-side-hidden .pw-resizer { display: none; }
.pw-side-hidden .pw-show-side { display: inline-block; }

/* zoom in / reset / zoom out on one row */
.pw-zoomrow { display: flex; gap: 6px; }
.pw-zoomrow .pw-btn { min-width: 30px; text-align: center; }
.pw-tag.in-use { border-color: #ff6ec7; box-shadow: 0 0 0 1px #ff6ec7 inset; }

/* goals: the one it's on, and stuck ones */
.pw-goal.working { border-left: 3px solid #ff6ec7; padding-left: 6px; }
.pw-goal.stuck .pw-goal-next { color: #ffb37a; }
.pw-goal-next { margin: 0 0 6px; opacity: 0.9; }

/* face close-up inset (the picture is drawn into the canvas; this is its frame) */
/* rounded corners (8px, the same radius viewer.js clips the picture to); dressed to match the render style */
.pw-inset { position: absolute; z-index: 3; box-sizing: border-box; border-radius: 8px; cursor: grab; touch-action: none; }
.pw-inset.dragging { cursor: grabbing; }
/* full screen: the world fills the window (or the screen) */
.pw-root.pw-max { position: fixed !important; inset: 0 !important; width: 100vw !important; height: 100vh !important; height: 100dvh !important; min-height: 0 !important; max-width: none !important; margin: 0 !important; border-radius: 0 !important; z-index: 2147483000; }
/* full screen on a computer keeps the ☰ panel button (hide UI hides it, as usual) */
/* pixel: a chunky two-tone pixel frame */
.pw-inset[data-style="pixel"] { border: 4px solid #ff6ec7; outline: 3px solid #1a0f3d; box-shadow: 4px 4px 0 0 #1a0f3d; image-rendering: pixelated; }
/* dither heavy: a checkered dither border */
.pw-inset[data-style="heavy"] { border: 5px solid transparent; border-image: repeating-conic-gradient(#ff6ec7 0 25%, #2b174f 0 50%) 0 / 5px / 0 round; outline: 1px solid #1a0f3d; }
/* watercolor: no hard line, just a soft painted edge fading into paper */
.pw-inset[data-style="watercolor"] { border: 3px solid rgba(250, 244, 232, 0.9); box-shadow: inset 0 0 14px 7px rgba(250, 244, 232, 0.85), 0 2px 10px rgba(60, 40, 30, 0.25); }
.pw-inset[data-suppressed="1"] { display: none !important; }
/* clean screen: only the world */
.pw-unclean { display: none; position: absolute; right: 10px; bottom: 10px; z-index: 6; opacity: 0.35; }
.pw-unclean:hover { opacity: 1; }
/* the status card, the feed (and the face inset) follow their own on/off buttons, not hide UI */
.pw-hud-off .pw-hud, .pw-ticker-off .pw-ticker { display: none !important; }
.pw-clean .pw-ticker { right: 52px; } /* leave room for the 👁 button */
.pw-env-off .pw-badge { display: none !important; }
.pw-clean .pw-controls, .pw-clean .pw-bubbles, .pw-clean .pw-show-side, .pw-clean .pw-npcbubbles { display: none !important; }
.pw-clean .pw-unclean { display: block; }

/* Pet tab: five group folders, each holding its sections */
.pw-petgroup { margin: 0 0 6px; border: 1px solid rgba(138, 92, 255, 0.35); border-radius: 8px; background: rgba(255, 255, 255, 0.025); }
.pw-petgroup > summary { cursor: pointer; list-style: none; padding: 8px 10px; font-weight: 700; font-size: 1.05em; color: #f4ecff; }
.pw-petgroup > summary::-webkit-details-marker { display: none; }
.pw-petgroup > summary::before { content: "▸ "; opacity: 0.7; }
.pw-petgroup[open] > summary::before { content: "▾ "; }
.pw-petgroup > .pw-fold { margin: 0 10px 4px; }
.pw-petgroup > .pw-fold > summary { font-size: 0.85em; }
.pw-petgroup > .pw-flat { border-bottom: none; }

/* phones: the world on top, the menu and its pages underneath, each scrolling in its own space.
   The root is 100% of its parent (not 100dvh: the page's own bar sits above #app, so dvh ran past the bottom of the screen and
   pushed the panel's lower part off it); the bottom padding clears the home bar. Map tab: the panel takes nearly the whole height. */
@media (max-width: 900px) {
  .pw-root, .pw-root.pw-side-hidden { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 40fr) minmax(0, 60fr); height: 100%; max-height: 100dvh; min-height: 0; row-gap: 6px; padding: 6px 6px max(6px, env(safe-area-inset-bottom)); }
  .pw-root:has(.pw-pane[data-pane="map"]:not([hidden])) { grid-template-rows: minmax(0, 14fr) minmax(0, 86fr); }
  .pw-root .pw-stage, .pw-root .pw-viewport { height: 100%; min-height: 0; }
  .pw-root.pw-side-hidden .pw-panel { display: flex; }
  .pw-root .pw-panel { min-height: 0; min-width: 0; }
  .pw-root .pw-hide-side, .pw-root .pw-show-side, .pw-root .pw-resizer { display: none !important; }
  .pw-root .pw-tabs { display: flex; padding: 4px 6px; }
  .pw-root .pw-menu { flex: 1; font-size: 16px; padding: 4px 8px; } /* 16px: iOS won't zoom the page when it opens */
  .pw-root .pw-panes { padding: 8px 10px max(14px, env(safe-area-inset-bottom)); overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .pw-pane img, .pw-pane canvas, .pw-pane svg, .pw-pane video, .pw-pane pre, .pw-pane table { max-width: 100%; }
  .pw-pane pre { overflow-x: auto; }
  .pw-pane .pw-input, .pw-pane .pw-select { min-width: 0; }
  .pw-pane .pw-group { flex-wrap: wrap; }
  .pw-pane .pw-group .pw-select { max-width: 100%; }
  .pw-pane .pw-convolog { max-height: none; overflow: visible; } /* the pane scrolls; no second scroller inside it */
  .pw-pane .pw-maptools { gap: 6px; margin-bottom: 6px; }
  .pw-pane .pw-maptoggles { gap: 6px 10px; }
  .pw-pane .pw-mapwrap { touch-action: none; margin: 0 auto; width: 100%; }
  .pw-root.pw-max, .pw-root.pw-max:has(.pw-pane[data-pane="map"]:not([hidden])) { grid-template-rows: minmax(0, 1fr) 0; } /* q432: the map tab's 14/86 split must not beat full screen */
  .pw-root.pw-max .pw-panel { display: none; }
  /* ☰ panel in full screen / full page: the panel as a sheet over the world (a bottom sheet in portrait, a right-hand sheet in landscape) */
  .pw-sheet-back { display: none; }
  .pw-root.pw-max.pw-max-panel .pw-sheet-back { display: block; position: absolute; inset: 0; z-index: 2147482990; background: rgba(8, 4, 24, 0.5); }
  .pw-root.pw-max.pw-max-panel .pw-panel { display: flex; position: absolute; z-index: 2147482991; left: 0; right: 0; bottom: 0; top: 18%; max-height: none; border-radius: 14px 14px 0 0; padding-bottom: env(safe-area-inset-bottom, 0); box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.55); }
  .pw-root.pw-max.pw-max-panel .pw-hide-side { display: inline-block !important; }
  .pw-root.pw-max.pw-max-panel .pw-hide-side::before { content: "✕ "; }
  .pw-root.pw-max.pw-max-panel .pw-show-side { display: none !important; }
}
@media (max-width: 900px) and (orientation: landscape) {
  /* a phone on its side: the world on the left, the panel on the right, so neither is squeezed to a strip */
  .pw-root, .pw-root.pw-side-hidden { grid-template-columns: minmax(0, 1fr) min(330px, 46vw); grid-template-rows: minmax(0, 1fr); column-gap: 6px; padding: 6px max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); }
  .pw-root:has(.pw-pane[data-pane="map"]:not([hidden])) { grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr) min(380px, 58vw); }
  .pw-pane .pw-mapwrap { width: min(100%, 52vh); } /* the square map fits the short screen next to its toolbar */
  .pw-root.pw-max, .pw-root.pw-max.pw-side-hidden, .pw-root.pw-max:has(.pw-pane[data-pane="map"]:not([hidden])), .pw-root.pw-side-hidden:has(.pw-pane[data-pane="map"]:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) and (orientation: landscape) {
  .pw-root.pw-max.pw-max-panel .pw-panel { left: auto; top: 0; width: min(440px, 72vw); border-radius: 14px 0 0 14px; padding-bottom: 0; box-shadow: -8px 0 30px rgba(0, 0, 0, 0.55); }
}

/* wide enough for the panel beside the world (q294): a dual-screen handheld's top screen, a small tablet, a phone on its side.
   Decided by width and shape, never by device: at least 640px wide and landscape. The desktop side-by-side layout holds (world on the left, panel docked on the right),
   in full screen / full page too, with the panel's hide button back. Narrower or portrait screens keep the overlay sheet / stacked layout above. */
@media (min-width: 640px) and (max-width: 900px) and (orientation: landscape) {
  .pw-root, .pw-root.pw-max { grid-template-columns: minmax(0, 1fr) min(330px, 46vw); grid-template-rows: minmax(0, 1fr); column-gap: 6px; padding: 6px max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); }
  .pw-root:has(.pw-pane[data-pane="map"]:not([hidden])), .pw-root.pw-max:has(.pw-pane[data-pane="map"]:not([hidden])) { grid-template-columns: minmax(0, 1fr) min(380px, 52vw); }
  .pw-root.pw-side-hidden, .pw-root.pw-max.pw-side-hidden, .pw-root.pw-side-hidden:has(.pw-pane[data-pane="map"]:not([hidden])) { grid-template-columns: minmax(0, 1fr); column-gap: 0; }
  .pw-root.pw-max .pw-panel, .pw-root.pw-max.pw-max-panel .pw-panel { display: flex; position: static; z-index: auto; width: auto; max-height: none; border-radius: inherit; box-shadow: none; padding-bottom: 0; }
  .pw-root.pw-side-hidden .pw-panel, .pw-root.pw-max.pw-side-hidden .pw-panel { display: none; }
  .pw-root.pw-max.pw-max-panel .pw-sheet-back { display: none; }
  .pw-root .pw-hide-side { display: inline-block !important; }
  .pw-root .pw-hide-side::before, .pw-root.pw-max.pw-max-panel .pw-hide-side::before { content: ""; }
  .pw-root.pw-side-hidden .pw-show-side, .pw-root.pw-max.pw-max-panel.pw-side-hidden .pw-show-side { display: inline-block !important; }
  .pw-root.pw-clean .pw-show-side { display: none !important; }
}

/* when loading fails: a readable message and a retry button */
.pw-loading-msg { max-width: min(420px, 86%); margin: 0 auto; line-height: 1.6; }
.pw-loading-msg .pw-retry { margin-top: 12px; font-size: calc(10px * var(--pw-fs, 1)); }

/* ---- Today: the daily recap card ---- */
.pw-recap { margin: 2px 0 12px; padding: 10px; border: 1px solid rgba(255, 79, 216, 0.45); border-radius: 12px; background: linear-gradient(160deg, rgba(255, 79, 216, 0.1), rgba(45, 226, 230, 0.06) 60%, rgba(18, 10, 48, 0)); box-shadow: 0 0 18px rgba(255, 79, 216, 0.12); }
.pw-recap-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pw-recap-head .pw-btn { flex: none; min-width: 32px; min-height: 32px; font-size: 1.3em; line-height: 1; padding: 2px 8px; }
.pw-recap-head .pw-btn:disabled { opacity: 0.3; cursor: default; }
.pw-recap-title { flex: 1; min-width: 0; text-align: center; }
.pw-pane .pw-recap-title h3 { margin: 0; font-size: 1.15em; color: var(--pw-ink); }
.pw-recap-title .pw-muted { font-size: 0.85em; }
.pw-recap-photo .pw-embed, .pw-recap-photo .pw-mtile { display: block; width: 100%; }
.pw-recap-nophoto { display: grid; place-items: center; min-height: 48px; padding: 8px; border: 1px dashed rgba(169, 156, 208, 0.4); border-radius: 8px; color: var(--pw-muted); font-size: 0.9em; }
.pw-recap-quote { margin: 10px 2px 8px; padding: 2px 0 2px 10px; border-left: 3px solid var(--pw-cyan); color: #e9dcff; font-style: italic; }
.pw-recap-mood { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.pw-recap-mood > span:nth-child(2) { color: var(--pw-muted); }
.pw-recap-mood em { font-style: normal; color: var(--pw-pink); }
.pw-spark { flex: 1; min-width: 80px; max-width: 220px; height: 30px; overflow: visible; }
.pw-spark-mid { stroke: rgba(169, 156, 208, 0.25); stroke-dasharray: 2 3; stroke-width: 1; }
.pw-spark-area { fill: rgba(255, 79, 216, 0.16); stroke: none; }
.pw-spark-line { fill: none; stroke: var(--pw-pink); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.pw-spark-dot { fill: var(--pw-cyan); }
.pw-pane .pw-recap-lines { list-style: none; margin: 6px 0; padding: 0; }
.pw-pane .pw-recap-lines li { display: flex; gap: 8px; margin: 3px 0; }
.pw-recap-ic { flex: none; width: 1.4em; text-align: center; }
.pw-recap-lines b { color: #fff; font-weight: 700; }
.pw-recap-hl { margin: 6px 0; color: #ffe680; font-size: 0.9em; }
.pw-recap-quiet { margin: 6px 0; }
.pw-recap-replay { display: block; width: 100%; margin-top: 8px; min-height: 34px; }
.pw-recap-replay:disabled { opacity: 0.45; cursor: default; }

/* highlights list */
.pw-hl-head { margin-top: 4px; }
.pw-pane .pw-hl-list { list-style: none; margin: 0; padding: 0; }
.pw-pane .pw-hl { display: flex; gap: 8px; margin: 0 0 6px; padding: 6px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(138, 92, 255, 0.25); }
.pw-pane .pw-hl.big { border-color: rgba(255, 230, 128, 0.5); background: rgba(255, 230, 128, 0.06); }
.pw-pane .pw-hl.big > div > b { font-size: 1.05em; }
.pw-hl-star { color: #ffe680; }
.pw-hl-ic { flex: none; font-size: 1.3em; line-height: 1.3; }
.pw-hl > div { min-width: 0; flex: 1; }
.pw-hl time { display: block; font-size: 0.8em; color: var(--pw-muted); }
.pw-pane .pw-hl p { margin: 2px 0 4px; }
.pw-hl .pw-mtile { width: 140px; }

/* highlight banner over the world */

/* the day replayed on a map that opens inside the Today card */
.pw-recap.mapopen .pw-recap-replay { display: none; }
.pw-recap-mapx { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows 360ms ease, opacity 260ms ease; }
.pw-recap-mapx.open { grid-template-rows: 1fr; opacity: 1; }
.pw-recap-mapin { min-height: 0; overflow: hidden; }
.pw-recap-mapx .pw-recap-map { padding: 0 0 2px; }
.pw-replaybar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 8px 0; }
.pw-replaybar .pw-btn { min-width: 34px; min-height: 30px; text-align: center; }
.pw-rp-scrub { flex: 1 1 90px; min-width: 90px; accent-color: #ff4fd8; }
.pw-rp-time { min-width: 5.2em; color: var(--pw-cyan); font-variant-numeric: tabular-nums; }
.pw-rp-wx { min-width: 4.2em; color: var(--pw-muted, #b9b3d8); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pw-rp-wx:empty { display: none; }
.pw-rp-day { flex: 0 1 9.5em; min-width: 0; }
.pw-rp-day[hidden] { display: none; }
.pw-rp-close { margin-left: auto; font-size: 1.2em; line-height: 1; }

/* names on hover: a small label by the pointer with what the pet calls the thing there */
.pw-hoverlabel { position: absolute; left: 0; top: 0; z-index: 8; display: flex; flex-direction: column; max-width: 240px; padding: 4px 9px; border-radius: 8px; background: rgba(18, 10, 48, 0.88); border: 1px solid rgba(45, 226, 230, 0.55); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); color: var(--pw-ink, #fff); font-size: 0.85em; line-height: 1.25; pointer-events: none; white-space: nowrap; }
.pw-hoverlabel[hidden] { display: none; }
.pw-hoverlabel-text { font-weight: bold; overflow: hidden; text-overflow: ellipsis; }
.pw-hoverlabel-sub { font-size: 0.82em; color: var(--pw-muted, #b9b3d6); overflow: hidden; text-overflow: ellipsis; }
.pw-hoverlabel-sub[hidden] { display: none; }
.pw-hovernames .pw-canvas-host canvas { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

@media (max-width: 900px) {
  .pw-recap { padding: 8px; }
  .pw-recap-head .pw-btn { min-width: 40px; min-height: 40px; }
  .pw-replaybar .pw-btn, .pw-rp-day { min-height: 38px; min-width: 40px; }
  .pw-replaybar { gap: 6px; }
  .pw-rp-day { flex-basis: 7em; }
  .pw-rp-scrub { flex-basis: 100%; order: 5; height: 28px; }
}


/* character: formative moments, skill trees, wits (Pet tab, Mind group) */
.pw-formed { list-style: none; padding: 0; margin: 4px 0 8px; }
.pw-formed li { padding: 4px 0; border-bottom: 1px solid rgba(127,127,127,0.15); }
.pw-formed .pw-why, .pw-skilltree .pw-why { display: block; }
.pw-more > summary, .pw-skilltree > summary { cursor: pointer; padding: 4px 0; }
.pw-skilltree { border-bottom: 1px solid rgba(127,127,127,0.15); }
.pw-skilltree ul { list-style: none; padding: 0 0 6px 8px; margin: 0; }
.pw-skilltree li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 3px 0; }
.pw-tech { flex: 1 1 8em; min-width: 0; }
.pw-tier { letter-spacing: 1px; font-size: 0.8em; color: #c9a227; white-space: nowrap; }
.pw-next { display: inline-block; width: 48px; height: 5px; border-radius: 3px; background: rgba(127,127,127,0.2); overflow: hidden; }
.pw-next b { display: block; height: 100%; background: #c9a227; }
.pw-wits { list-style: none; padding: 0; margin: 4px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 10px; font-size: 0.9em; }
.pw-value p { margin: -2px 0 4px; }
/* the mind loop (Pet tab → Mind): focus, choices and reasons, self-model, growth */
.pw-mindloop h5 { margin: 0.5em 0 0.2em; }
.pw-mindloop .pw-mind-opts li { display: block; }
.pw-mindloop .pw-mind-opts .pw-why { display: block; }
.pw-mindloop ul.pw-small { margin: 0.2em 0 0.4em; padding-left: 1.2em; }
.pw-mindloop .pw-heart .pw-why { display: block; }

/* History tab (viewer/history.js): Today / Days / Growing up / World */
.pw-hist-nav { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 8px; padding: 4px 0; background: var(--pw-panel); }
.pw-hist-tab { flex: 1 1 auto; min-height: 30px; }
.pw-hist-tab.on { border-color: var(--pw-pink); color: #fff; box-shadow: 0 0 10px rgba(255, 79, 216, 0.25); }
.pw-hist-pet { flex: 0 1 9em; }
.pw-hist-pet[hidden], .pw-hist-sec[hidden] { display: none; }
.pw-hdays { display: flex; flex-direction: column; gap: 8px; }
.pw-hday { content-visibility: auto; contain-intrinsic-size: auto 230px; padding: 8px; border-radius: 12px; border: 1px solid rgba(138, 92, 255, 0.35); background: rgba(255, 255, 255, 0.03); cursor: pointer; }
.pw-hday:hover, .pw-hday:focus-visible { border-color: rgba(255, 79, 216, 0.6); outline: none; }
.pw-hday.open { cursor: default; border-color: rgba(255, 79, 216, 0.7); background: linear-gradient(160deg, rgba(255, 79, 216, 0.08), rgba(45, 226, 230, 0.05) 60%, rgba(18, 10, 48, 0)); content-visibility: visible; }
.pw-hday header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.pw-hday header b { color: var(--pw-pink); }
.pw-hday-ms { margin-left: auto; letter-spacing: 1px; }
.pw-hday-pics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pw-hday-portrait { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; }
.pw-hday-portrait svg, .pw-hday-big svg, .pw-hcmp-pics svg, .pw-hlapse-stage svg { display: block; width: 100%; height: auto; }
.pw-hday-png { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.pw-hday-map { display: block; width: 100%; aspect-ratio: 1; border-radius: 10px; background: #0c0624; }
.pw-hday-nomap, .pw-hist-noportrait { display: grid; place-items: center; aspect-ratio: 1; padding: 8px; border-radius: 10px; border: 1px dashed rgba(169, 156, 208, 0.4); color: var(--pw-muted); text-align: center; font-size: 0.9em; }
.pw-hist-noportrait { font-size: 2em; }
.pw-hday-old { opacity: 0.75; cursor: default; }
.pw-hday-sum p { margin: 6px 0 2px; }
.pw-hday-mslist { color: #ffe680; font-size: 0.9em; }
.pw-hday-big { display: flex; gap: 8px; margin: 8px 0; }
.pw-hday-big figure { flex: 1; margin: 0; text-align: center; }
.pw-hday-big img { display: block; width: 100%; border-radius: 10px; }
.pw-hday-bigmap { display: block; width: 100%; aspect-ratio: 1; margin: 6px 0; border-radius: 10px; }
.pw-hday-replay, .pw-hdays-more { display: block; width: 100%; min-height: 34px; margin-top: 6px; }
.pw-hlapse-stage { max-width: min(260px, 70%); margin: 0 auto; }
.pw-hlapse-label { text-align: center; margin: 4px 0; min-height: 1.4em; }
.pw-hlapse-bar { display: flex; align-items: center; gap: 8px; }
.pw-hlapse-bar input[type="range"] { width: 100%; accent-color: #ff4fd8; }
.pw-hlapse-track { position: relative; flex: 1; padding-bottom: 20px; }
.pw-hlapse-ticks { position: absolute; left: 8px; right: 8px; bottom: 0; height: 18px; }
.pw-hlapse-tick { position: absolute; transform: translateX(-50%); padding: 0; border: 0; background: none; font-size: 12px; line-height: 1; cursor: pointer; }
.pw-hcompare { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pw-hcompare select { width: 100%; }
.pw-hcmp-pics { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; }
.pw-hcmp-pics figure { flex: 1 1 0; min-width: 0; max-width: 200px; margin: 0; text-align: center; }
.pw-hcmp-pics figcaption { font-size: 0.85em; }
.pw-hcmp-arrow { flex: none; }
.pw-hl-pets { margin-left: 2px; }
.pw-hcmp-arrow { color: var(--pw-pink); font-size: 1.4em; }
.pw-hcmp-diff { grid-column: 1 / -1; margin: 4px 0; padding-left: 18px; }
.pw-hworld-map { display: block; width: 100%; max-width: 420px; aspect-ratio: 1; margin: 0 auto; border-radius: 12px; }
.pw-hworld .pw-hlapse-bar { max-width: 420px; margin: 0 auto; }
.pw-portrait { max-width: 320px; border-radius: 12px; }
@media (max-width: 900px) {
  .pw-hist-tab { min-height: 38px; }
  .pw-hday-pics { gap: 6px; }
  .pw-hlapse-bar .pw-btn { min-width: 40px; min-height: 40px; }
}

/* ---------- Caretaker tab (carepanel.js) ---------- */
.pw-carehead { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; margin-bottom: 6px; }
.pw-carehead .pw-carethread { max-width: 42%; flex: none; }
.pw-caretext { white-space: pre-wrap; }
.pw-line .pw-mode { display: inline; font-size: 0.85em; color: var(--pw-muted); margin-left: 6px; }
.pw-didrow { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.pw-did { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 999px; font-size: calc(7px * var(--pw-fs, 1)); color: #8dffb5; background: rgba(141, 255, 181, 0.1); border: 1px solid rgba(141, 255, 181, 0.35); }
.pw-undo { font: inherit; font-size: 0.95em; padding: 0 5px; border-radius: 999px; border: 1px solid rgba(255, 179, 107, 0.6); background: transparent; color: #ffb36b; cursor: pointer; }
.pw-undo:disabled { opacity: 0.6; cursor: default; }
.pw-thinking span { color: #c9b2ff; }
.pw-dots { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; }
.pw-dots em { width: 4px; height: 4px; border-radius: 50%; background: #c9b2ff; animation: pw-dot 1.2s infinite ease-in-out; }
.pw-dots em:nth-child(2) { animation-delay: 0.2s; }
.pw-dots em:nth-child(3) { animation-delay: 0.4s; }
@keyframes pw-dot { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .pw-dots em { animation: none; opacity: 0.7; } }
.pw-caresec { margin-top: 10px; border-top: 1px solid rgba(169, 156, 208, 0.25); padding-top: 6px; }
.pw-caresec summary { cursor: pointer; font-size: calc(8px * var(--pw-fs, 1)); color: #c9b2ff; }
.pw-reporttext { white-space: pre-wrap; font-family: inherit; font-size: calc(8px * var(--pw-fs, 1)); line-height: 1.6; max-height: 40vh; overflow: auto; margin: 6px 0; }
.pw-carelogx { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 4px; }
.pw-carelogx li { font-size: calc(8px * var(--pw-fs, 1)); line-height: 1.5; }
.pw-carelogx li.undone { opacity: 0.55; text-decoration: line-through; }
.pw-carelogx .pw-when { color: var(--pw-muted); margin-right: 4px; }
.pw-carelogx .pw-to { color: var(--pw-cyan); }
/* Knowledge & arts (viewer/gallery.js) */
section.pw-know, section.pw-gallery { display: block; }
.pw-know h5 { margin: 10px 0 2px; font-size: 0.85em; text-transform: lowercase; opacity: 0.8; }
.pw-know-ico { display: inline-block; width: 1.2em; text-align: center; opacity: 0.8; }
.pw-know-recent { margin: 2px 0 4px; padding-left: 18px; }
.pw-know-recent li { margin: 2px 0; }
.pw-art-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-top: 6px; }
.pw-art { margin: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pw-art-frame { display: flex; align-items: center; justify-content: center; min-height: 80px; padding: 5px; border-radius: 6px; background: #8a6440; box-shadow: inset 0 0 0 3px #a87f55, 0 1px 3px rgba(0,0,0,0.25); }
.pw-art-sculpture .pw-art-frame, .pw-art-glaze .pw-art-frame, .pw-art-melody .pw-art-frame, .pw-art-poem .pw-art-frame, .pw-art-story .pw-art-frame, .pw-art-dance .pw-art-frame { background: rgba(127,127,127,0.12); box-shadow: none; }
.pw-art-frame img { display: block; max-width: 100%; height: auto; border-radius: 2px; }
.pw-art figcaption { display: flex; flex-direction: column; gap: 2px; font-size: 0.85em; line-height: 1.25; overflow-wrap: anywhere; }
.pw-art-poem { margin: 0; font-style: italic; font-size: 0.8em; line-height: 1.35; max-height: 7.5em; overflow: auto; }
.pw-art-play { font-size: 0.85em; }

/* extras.js: status card / ticker toggles, and the names-mode research icon */
.pw-hud-off .pw-hud, .pw-ticker-off .pw-ticker { display: none !important; }
.pw-hoverlabel-wiki { position: absolute; right: -7px; top: -9px; font-size: 11px; line-height: 1; padding: 2px; border-radius: 50%; background: rgba(18, 10, 48, 0.95); }
.pw-hoverlabel-wiki[hidden] { display: none; }

.pw-sum-closeall { display: none; } /* phones only (R4): shown in the 900 px block below */
/* Pet tab on phones: roomier tap targets on the folds, tighter indents so lines get the width */
@media (max-width: 900px) {
  .pw-petgroup > summary { padding: 11px 10px; }
  .pw-petgroup > .pw-fold { margin: 0 6px 4px; }
  .pw-petgroup > .pw-fold > summary { padding: 10px 0; }
  .pw-more > summary { padding: 8px 0; }
  .pw-pane .pw-look-row { flex-wrap: wrap; }
  /* q534 (R5): 44 px tap targets on a phone. Folds, buttons, selects, links. Desktop is not in this block. */
  .pw-root .pw-menu, .pw-pane .pw-select { min-height: 44px; }
  .pw-pane button { min-height: 44px; box-sizing: border-box; }
  .pw-pane .pw-btn, .pw-pane .pw-mapzoom .pw-btn, .pw-pane .pw-maptools .pw-btn { min-height: 44px; min-width: 44px; }
  .pw-pane .pw-cite { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; box-sizing: border-box; padding: 0 4px; }
  .pw-pane summary, .pw-pane .pw-fold > summary, .pw-pane .pw-petgroup > summary { min-height: 44px; box-sizing: border-box; }
  /* q533 (R4): the open group header stays pinned while its sections scroll; "close all" ends the summary card */
  .pw-petgroup[open] > summary { position: sticky; top: -8px; z-index: 3; background: #1a1040; border-radius: 8px 8px 0 0; border-bottom: 1px solid rgba(138, 92, 255, 0.35); }
  .pw-summary .pw-sum-closeall { display: block; width: 100%; margin-top: 2px; }
  .pw-pane .pw-to-wiki, .pw-pane .pw-raw-chip { display: inline-flex; align-items: center; min-height: 44px; box-sizing: border-box; }
}

/* all-pets Log: pet chips and per-row pet tags */
.pw-raw-chips{display:flex;flex-wrap:wrap;gap:4px;padding:4px 0 6px}
.pw-raw-chip{display:inline-flex;align-items:center;gap:5px;padding:3px 8px}
.pw-raw-chip.on{border-color:var(--pw-pink);color:var(--pw-pink)}
.pw-raw-dot{display:inline-block;width:8px;height:8px;border-radius:50%;flex:none}
.pw-raw-pet{display:inline-flex;align-items:center;gap:4px;margin-right:6px;font-size:.9em;opacity:.9;white-space:nowrap}
.pw-raw-line{align-items:center}.pw-raw-line.has-pet{grid-template-columns:auto 1.4em 1fr auto}.pw-raw-line .pw-raw-pet{justify-self:end;margin-right:0;margin-left:6px}
/* names: the owner's true-name overlay is italic with a small 'true' badge */
.pw-hoverlabel-true { font-size: 0.9em; color: #ffe7a3; overflow: hidden; text-overflow: ellipsis; }
.pw-hoverlabel-true[hidden] { display: none; }
.pw-hoverlabel-true i, .pw-hoverlabel-text i { font-style: italic; }
.pw-hoverlabel-true b, .pw-hoverbadge { margin-left: 5px; padding: 0 4px; border-radius: 6px; font-size: 0.7em; font-weight: normal; color: #1a1040; background: #ffd45c; }

/* History for "all pets": colour dots and chips, one card a pet side by side (stacked when narrow) */
.pw-pdot { display: inline-block; width: 0.7em; height: 0.7em; border-radius: 50%; margin-right: 0.35em; vertical-align: baseline; box-shadow: 0 0 6px currentColor; }
.pw-pchip { display: inline-flex; align-items: center; padding: 1px 8px 1px 6px; border: 1px solid var(--pc, #888); border-radius: 999px; font-size: 0.85em; line-height: 1.5; }
.pw-recap-nav { display: flex; align-items: center; gap: 8px; margin: 2px 0 8px; }
.pw-recap-nav .pw-btn { flex: none; min-width: 32px; min-height: 32px; font-size: 1.3em; line-height: 1; padding: 2px 8px; }
.pw-recap-nav .pw-recap-title { flex: 1 1 auto; min-width: 0; }
.pw-recap-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15em), 1fr)); gap: 8px; align-items: start; }
.pw-recap-pet { margin: 0; border-color: var(--pc, rgba(255, 79, 216, 0.45)); min-width: 0; }
.pw-hday-all { display: block; }
.pw-hall-item { border-top: 1px solid rgba(255, 255, 255, 0.08); padding: 4px 0; border-left: 3px solid var(--pc, transparent); padding-left: 6px; }
.pw-hall-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; width: 100%; text-align: left; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 2px 0; }
.pw-hall-stage, .pw-hcmp-all { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.pw-hall-fig { margin: 0; flex: 1 1 8em; max-width: 14em; text-align: center; border-bottom: 2px solid var(--pc, transparent); }
.pw-hcompare .pw-hcmp-all { grid-column: 1 / -1; min-width: 0; }
.pw-hall-cmp { flex: 1 1 100%; min-width: 0; padding: 4px 0 4px 6px; border-left: 3px solid var(--pc, transparent); }
.pw-hall-bar { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.pw-hall-bar i { flex: 1 1 auto; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.pw-hall-bar i b { display: block; height: 100%; background: var(--pc, #fff); }
.pw-pnamed { white-space: nowrap; }

/* page-level 2D/3D selector (viewer/index.html) */
.pw-viewsel{display:flex;gap:12px;align-items:center;justify-content:space-between;padding:6px 12px;font:12px "Space Mono",monospace;color:#cfc8f0;background:#120a30}
.pw-viewsel[hidden]{display:none}
.pw-viewsel select{font:inherit;color:inherit;background:#241a52;border:1px solid #4a3d8f;border-radius:4px;padding:2px 6px}

.pw-narr-entry { margin: 0 0 14px; padding: 0 0 10px 10px; border-left: 3px solid var(--pw-pink); }
.pw-narr-entry header { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.pw-narr-entry h4 { margin: 0 0 4px; }
.pw-narr-entry p { margin: 4px 0; line-height: 1.5; font-style: italic; }
/* History > Town board (townboard.js): the townsfolk's notes, replies indented under them */
.pw-board-thread { margin: 0 0 10px; padding: 6px 8px; border-left: 3px solid var(--pw-pink); background: rgba(255, 255, 255, 0.03); border-radius: 4px; }
.pw-board-post { margin: 0; overflow-wrap: anywhere; }
.pw-board-reply { margin: 4px 0 0 18px; font-size: 0.95em; }
.pw-board-head { font-size: 0.9em; }
.pw-board-ic { margin-right: 4px; }
.pw-board-text { margin: 2px 0 0; line-height: 1.45; }

/* full-page mode (?full=1): the world fills the screen, clear of the notch and home bar, with a small link back to the embedding site */
.pw-root.pw-fullpage { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left) !important; background: #120a30; }
.pw-fullback, .pw-fullbanner { position: fixed; z-index: 2147483001; font: 600 10px/1 "Space Mono", monospace; color: #fff; background: rgba(18, 10, 48, 0.72); border: 1px solid rgba(138, 92, 255, 0.6); border-radius: 12px; padding: 6px 10px; text-decoration: none; }
.pw-fullback { left: 50%; transform: translateX(-50%); bottom: max(8px, env(safe-area-inset-bottom)); opacity: 0.65; }
.pw-fullbanner { left: 50%; transform: translateX(-50%); bottom: max(14px, env(safe-area-inset-bottom)); font-size: 13px; padding: 12px 18px; background: rgba(255, 79, 216, 0.85); }
.pw-backbtn { text-decoration: none; display: inline-flex; align-items: center; }

/* the view menu in a few folding sections (viewer/viewmenu.js): a header per section, two columns of controls under it */
.pw-controls .pw-vm-sec { display: flex; flex-direction: column; gap: 4px; align-self: stretch; }
.pw-controls .pw-vm-head { text-align: left; width: 100%; background: rgba(18, 10, 48, 0.9); border-color: rgba(138, 92, 255, 0.45); text-transform: lowercase; }
.pw-controls .pw-vm-sec.open > .pw-vm-head { border-color: var(--pw-cyan, #2de2e6); }
.pw-controls .pw-vm-body { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.pw-controls .pw-vm-body[hidden] { display: none !important; }
.pw-controls .pw-vm-body > .pw-select, .pw-controls .pw-vm-body > .pw-vm-seg { grid-column: 1 / -1; }
.pw-controls .pw-vm-body > .pw-btn, .pw-controls .pw-vm-body > .pw-select { min-width: 0; width: 100%; }
.pw-controls .pw-vm-seg { display: flex; align-items: stretch; gap: 3px; }
.pw-controls .pw-vm-seglab { flex: 0 0 34px; display: flex; align-items: center; font-size: calc(8px * var(--pw-fs, 1)); color: var(--pw-ink); opacity: 0.8; }
.pw-controls .pw-vm-segbtn { flex: 1 1 0; min-width: 0; padding: 0 4px; }
.pw-controls .pw-vm-segbtn.on { background: rgba(138, 92, 255, 0.55); border-color: var(--pw-cyan, #2de2e6); }
@media (max-width: 600px) {
  .pw-controls .pw-vm-body { grid-template-columns: 1fr 1fr; }
}

/* the Pi-offline card (q273): over the world while the live feed is down; the badge and menus stay on top */
.pw-offline { position: absolute; inset: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: center; padding: 56px 16px 16px; background: rgba(18, 10, 48, 0.82); backdrop-filter: blur(6px); overflow: auto; }
.pw-offline[hidden] { display: none; }
.pw-off-card { margin: 0; width: min(260px, 100%); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px; border-radius: 14px; background: rgba(18, 10, 48, 0.7); border: 1px solid color-mix(in srgb, var(--pc, #8ab) 55%, transparent); text-align: center; }
.pw-off-img { width: min(180px, 60vw); aspect-ratio: 1; object-fit: contain; border-radius: 12px; background: rgba(255, 255, 255, 0.05); }
.pw-off-blank { display: flex; align-items: center; justify-content: center; font-size: 40px; color: var(--pw-muted); }
.pw-off-card figcaption { display: flex; flex-direction: column; gap: 4px; font-size: calc(9px * var(--pw-fs, 1)); }
.pw-off-card b { font-size: calc(12px * var(--pw-fs, 1)); }
.pw-off-ago { color: var(--pw-muted); }
.pw-off-line { color: #ffd9a8; }
.pw-offline[data-n="3"] .pw-off-img, .pw-offline[data-n="4"] .pw-off-img { width: min(120px, 40vw); }
.pw-hflip { margin: 10px 0; }
.pw-hflip > summary { cursor: pointer; }
.pw-hflip-stage { aspect-ratio: 1; max-width: min(100%, 280px, 38vh); margin: 6px auto; border-radius: 10px; overflow: hidden; background: rgba(255,255,255,0.05); }
.pw-hflip-img { display: block; width: 100%; height: 100%; object-fit: contain; }
.pw-hflip-label, .pw-hflip-line { text-align: center; min-height: 1.3em; }
.pw-hflip .pw-hlapse-bar { display: flex; gap: 8px; align-items: center; }
.pw-hflip-scrub { flex: 1; min-width: 0; }
/* full screen + Hide UI (owner 23:3xZ): no frame at all: the world runs edge to edge (no border, glow, rounded corners or outer padding) */
.pw-root.pw-max.pw-clean { padding: 0 !important; column-gap: 0 !important; }
.pw-root.pw-max.pw-clean .pw-viewport { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; }

/* Pet tab summary card (petsummary.js, R2): five lines and four big link buttons, always open */
.pw-summary {
  font-size: calc(8px * var(--pw-fs, 1));
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 4px;
}
.pw-summary .pw-sum-who { font-size: calc(9px * var(--pw-fs, 1)); }
.pw-summary .pw-sum-mood { color: var(--pw-cyan); }
.pw-summary .pw-sum-wish { font-size: calc(7px * var(--pw-fs, 1)); color: var(--pw-muted); }
.pw-summary .pw-sum-why,
.pw-summary .pw-sum-age { color: var(--pw-muted); }
.pw-summary .pw-sum-agep { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 8px; }
.pw-summary .pw-sum-patches { position: relative; display: flex; gap: 3px; margin: -5px 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.pw-summary .pw-sum-patches::after { content: ""; position: absolute; inset: -12px -8px; } /* a 44 px hit area, no added height */
/* the patch disc (extras.js patchDisc): patch color inside a thread ring; sewn = stitched ring, box = half strength with a dashed ring */
.pw-pdisc { position: relative; flex: none; width: 20px; height: 20px; box-sizing: border-box; border-radius: 50%; display: grid; place-items: center; border: 2px solid #c98a4b; background: var(--pd, #8080cc); }
.pw-pdisc.pw-ring-silver { border-color: #d6dbe4; }
.pw-pdisc.pw-ring-gold { border-color: #f2c14e; }
.pw-pdisc-i { font-size: 10px; line-height: 1; }
.pw-pdisc-sewn::after { content: ""; position: absolute; inset: 1px; border-radius: 50%; border: 1px dashed rgba(255, 255, 255, 0.85); pointer-events: none; }
.pw-pdisc-box { opacity: 0.5; border-style: dashed; }
.pw-pdisc-new { position: absolute; top: -2px; right: -2px; width: 6px; height: 6px; border-radius: 50%; background: var(--pw-pink, #ff5fa8); box-shadow: 0 0 0 1px #0c0624; } /* still: no pulse, no count */
.pw-summary .pw-sum-sick { color: #ff8f8f; }
.pw-summary .pw-sum-needs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pw-summary .pw-sum-need { display: grid; gap: 2px; font-size: calc(7px * var(--pw-fs, 1)); color: var(--pw-muted); }
.pw-summary .pw-sum-need i { display: block; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; position: relative; }
.pw-summary .pw-sum-need b { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--pw-pink), var(--pw-cyan)); }
.pw-summary .pw-sum-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-top: 2px; }
.pw-summary .pw-sum-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 40px; padding: 4px 6px; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(45, 226, 230, 0.45); background: #0c0624; color: inherit; font: inherit;
}
.pw-summary .pw-sum-btn small { color: var(--pw-muted); font-size: calc(7px * var(--pw-fs, 1)); }

/* Pet tab, "all pets" compare view (viewer/petcompare.js) */
.pw-compare .pw-cmp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.pw-compare .pw-cmp-card { display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--pc, #888); border-left-width: 4px; background: #0c0624; }
.pw-compare .pw-cmp-card:hover { background: #140a34; }
.pw-compare .pw-cmp-head { margin-bottom: 4px; font-weight: 700; }
.pw-compare .pw-cmp-row { display: grid; grid-template-columns: 52px 1fr; gap: 6px; padding: 3px 0; border-top: 1px solid rgba(255, 255, 255, 0.06); min-height: 22px; align-items: start; }
.pw-compare .pw-cmp-k { color: var(--pw-muted); font-size: 0.8em; }
.pw-compare .pw-cmp-v { min-width: 0; overflow-wrap: anywhere; }
.pw-compare .pw-cmp-needs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pw-compare .pw-sum-need { display: grid; gap: 2px; font-size: calc(7px * var(--pw-fs, 1)); color: var(--pw-muted); }
.pw-compare .pw-sum-need i { display: block; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; position: relative; }
.pw-compare .pw-sum-need b { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--pw-pink), var(--pw-cyan)); }
.pw-compare .pw-sum-sick { color: #ff8f8f; }
/* Workshop card (workshop.js, A5): step dots and parts with a fit dot */
.pw-wssteps { margin: 2px 0; }
.pw-wsdot { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 50%; border: 1px solid currentColor; opacity: 0.5; vertical-align: middle; }
.pw-wsdot.done { background: currentColor; opacity: 0.9; }
.pw-wsdot.now { opacity: 1; box-shadow: 0 0 0 2px rgba(120, 160, 220, 0.5); }
.pw-fit { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; border: 1px solid #888; background: transparent; vertical-align: middle; }
.pw-fit-snug { background: #5fae4c; border-color: #5fae4c; }
.pw-fit-tight { background: #e0b84a; border-color: #e0b84a; }
.pw-fit-loose { background: #d8873a; border-color: #d8873a; }
.pw-fit-wrong { background: #c0524a; border-color: #c0524a; }
