.companion-view {
  --comp-card: rgba(255, 255, 255, 0.62);
  --comp-card-solid: #fbf8f2;
  --comp-line: rgba(56, 49, 41, 0.11);
  --comp-soft: rgba(104, 88, 68, 0.075);
  --comp-warm: #a9674f;
  --comp-green: #527c68;
  --comp-gold: #a9864c;
  min-width: 0;
}

.comp-screen {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
}

.comp-head {
  flex-shrink: 0;
}

.comp-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px clamp(18px, 4vw, 52px) 52px;
}

.comp-intro {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 22px;
  align-items: end;
  max-width: 960px;
  margin: 0 auto 18px;
  padding: 22px 24px;
  border: 1px solid var(--comp-line);
  border-radius: 20px;
  background:
    linear-gradient(140deg, rgba(177, 137, 99, 0.13), transparent 58%),
    var(--comp-card);
}

.comp-intro > span {
  color: var(--text-mute);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.66rem;
  letter-spacing: 0.16em;
}

.comp-intro > strong {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  color: var(--comp-warm);
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(2.3rem, 6vw, 4rem);
  font-weight: 500;
  line-height: 1;
}

.comp-intro > p {
  margin-top: 5px;
  color: var(--text);
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(0.96rem, 2vw, 1.15rem);
  line-height: 1.45;
}

.comp-search {
  display: flex;
  align-items: center;
  max-width: 960px;
  height: 44px;
  margin: 0 auto 12px;
  padding: 0 14px;
  border: 1px solid var(--comp-line);
  border-radius: 14px;
  background: var(--comp-card);
}

.comp-search svg {
  width: 19px;
  height: 19px;
  margin-right: 9px;
  color: var(--text-mute);
  stroke-width: 1.7;
}

.comp-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}

.comp-search input::placeholder {
  color: var(--text-mute);
}

.comp-filters {
  display: flex;
  max-width: 960px;
  gap: 7px;
  margin: 0 auto 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.comp-filters::-webkit-scrollbar {
  display: none;
}

.comp-filters button {
  flex-shrink: 0;
  padding: 7px 12px;
  border: 1px solid var(--comp-line);
  border-radius: 999px;
  background: transparent;
  color: var(--text-mute);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.comp-filters button.active {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.comp-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  max-width: 960px;
  gap: 12px;
  margin: 0 auto;
}

.comp-card {
  position: relative;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--comp-line);
  border-radius: 18px;
  background: var(--comp-card);
  color: var(--text);
  text-align: left;
}

button.comp-card {
  width: 100%;
  font: inherit;
  cursor: pointer;
}

button.comp-card:hover {
  transform: translateY(-1px);
  border-color: rgba(87, 70, 52, 0.25);
}

.comp-card-top,
.comp-card-meta,
.desire-metric-head,
.reader-nav,
.reader-chat-head {
  display: flex;
  align-items: center;
}

.comp-card-top {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}

.comp-kicker,
.comp-badge {
  color: var(--text-mute);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.comp-badge {
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--comp-soft);
  letter-spacing: 0.04em;
}

.comp-card h3 {
  margin: 0 0 9px;
  overflow: hidden;
  color: var(--text);
  font-family: Georgia, "Songti SC", serif;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.4;
  text-overflow: ellipsis;
}

.memory-card h3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.diary-card p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.album-card {
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  color: inherit;
  text-align: left;
}

.album-thumb {
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--comp-soft);
}

.album-thumb img,
.album-detail > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.album-card-copy {
  display: grid;
  gap: 4px;
  padding: 11px 12px 13px;
}

.album-card-copy strong {
  font-family: Georgia, "Songti SC", serif;
  font-size: 0.92rem;
}

.album-card-copy span {
  color: var(--text-mute);
  font-size: 0.68rem;
}

.album-detail {
  max-width: 760px;
  margin: 0 auto;
  padding: 22px 18px 50px;
}

.album-detail > img {
  height: auto;
  max-height: 72vh;
  margin-bottom: 22px;
  border-radius: 20px;
  object-fit: contain;
  background: #171513;
}

.album-detail h1 {
  margin: 8px 0 10px;
  font-family: Georgia, "Songti SC", serif;
  font-size: 1.45rem;
}

.album-detail p {
  color: var(--text-mute);
  line-height: 1.7;
}

.comp-card p {
  color: var(--text-mute);
  font-size: 0.8rem;
  line-height: 1.55;
}

.comp-card-meta {
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 14px;
  color: var(--text-mute);
  font-size: 0.66rem;
}

.comp-pin {
  color: var(--comp-warm);
}

.comp-empty,
.comp-loading,
.comp-error {
  grid-column: 1 / -1;
  padding: 42px 20px;
  color: var(--text-mute);
  text-align: center;
  font-size: 0.86rem;
}

.comp-error {
  color: #a65343;
}

/* Memory detail */
.companion-view[data-sub="list"] .comp-detail-screen {
  display: none;
}

.companion-view[data-sub="detail"] .comp-list-screen {
  display: none;
}

.memory-detail-head,
.reader-detail-head {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  min-height: 72px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--comp-line);
}

.memory-detail-head h2,
.reader-detail-head h2 {
  overflow: hidden;
  font-family: Georgia, "Songti SC", serif;
  font-size: 1.05rem;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comp-back,
.comp-delete,
.reader-icon-button {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--comp-line);
  border-radius: 12px;
  background: var(--comp-card);
  color: var(--text);
  cursor: pointer;
}

.comp-back svg,
.comp-delete svg,
.reader-icon-button svg {
  width: 20px;
  height: 20px;
}

.comp-delete {
  justify-self: end;
  border-color: rgba(177, 71, 63, 0.28);
  background: rgba(177, 71, 63, 0.07);
  color: #a84942;
}

.comp-delete:hover {
  border-color: rgba(177, 71, 63, 0.5);
  background: rgba(177, 71, 63, 0.13);
}

.memory-delete-modal .comp-danger-kicker {
  display: block;
  margin-bottom: 8px;
  color: #a84942;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.memory-delete-modal h3 {
  margin-bottom: 8px;
}

.memory-delete-name {
  overflow: hidden;
  margin: 14px 0 8px;
  padding: 11px 13px;
  border: 1px solid var(--comp-line);
  border-radius: 11px;
  background: var(--comp-soft);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memory-delete-warning {
  color: var(--text-mute);
  font-size: 0.78rem;
  line-height: 1.55;
}

.memory-delete-modal .btn-danger {
  padding: 9px 18px;
  border: 1px solid rgba(115, 34, 29, 0.32);
  border-radius: 10px;
  background: #a84942;
  color: #fff;
  cursor: pointer;
  font-size: 0.88rem;
}

.memory-delete-modal .btn-danger:hover {
  background: #923a34;
}

.memory-delete-modal .btn-danger:disabled {
  cursor: wait;
  opacity: 0.55;
}

html[data-appearance="dark"] .comp-delete {
  border-color: rgba(234, 126, 116, 0.28);
  background: rgba(234, 126, 116, 0.09);
  color: #e58a81;
}

.memory-detail-body {
  width: min(820px, calc(100% - 36px));
  margin: 0 auto;
  padding: 30px 0 60px;
}

.memory-detail-body h1 {
  margin: 10px 0 13px;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(1.55rem, 4vw, 2.35rem);
  font-weight: 600;
  line-height: 1.25;
}

.memory-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 18px 0 24px;
}

.memory-tags span {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--comp-soft);
  color: var(--text-mute);
  font-size: 0.68rem;
}

.memory-content {
  padding: 24px;
  border: 1px solid var(--comp-line);
  border-radius: 18px;
  background: var(--comp-card);
  color: var(--text);
  font-family: Georgia, "Songti SC", serif;
  font-size: 0.96rem;
  line-height: 1.85;
  white-space: pre-wrap;
  word-break: break-word;
}

.diary-detail-body {
  width: min(760px, calc(100% - 36px));
}

.diary-facts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.diary-content {
  padding: clamp(20px, 5vw, 34px);
  font-size: clamp(0.96rem, 2.6vw, 1.05rem);
  line-height: 1.95;
}

.memory-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.memory-fact {
  padding: 13px;
  border-bottom: 1px solid var(--comp-line);
}

.memory-fact span {
  display: block;
  margin-bottom: 5px;
  color: var(--text-mute);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.memory-fact strong {
  font-size: 0.8rem;
  font-weight: 550;
}

/* Room */
.room-scroll {
  padding-top: 14px;
}

.room-page {
  width: min(100%, 1120px);
  margin: 0 auto;
}

.room-statusbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-bottom: 12px;
}

.room-statusbar > div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 12px;
  min-width: 0;
  padding: 14px 17px;
  border: 1px solid var(--comp-line);
  border-radius: 16px;
  background: var(--comp-card);
}

.room-statusbar span,
.room-statusbar small {
  color: var(--text-mute);
  font-size: 0.66rem;
}

.room-statusbar strong {
  overflow: hidden;
  color: var(--text);
  font-family: Georgia, "Songti SC", serif;
  font-size: 0.96rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-statusbar small {
  grid-column: 2;
}

.room-wallet {
  min-width: 190px !important;
}

.room-wallet strong {
  color: var(--comp-green);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.room-map-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(67, 48, 33, 0.2);
  border-radius: 20px;
  background: #171513;
  box-shadow: 0 14px 40px rgba(54, 36, 24, 0.12);
}

.room-now {
  position: absolute;
  z-index: 9;
  top: 10px;
  left: 10px;
  display: grid;
  max-width: min(48%, 360px);
  gap: 2px;
  padding: 8px 11px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px;
  background: rgba(24, 20, 17, 0.76);
  color: #f7ead1;
  backdrop-filter: blur(8px);
}

.room-now span {
  color: #d9b878;
  font-size: 0.59rem;
}

.room-now strong {
  overflow: hidden;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-actions {
  position: absolute;
  z-index: 12;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
}

.room-actions > button,
.room-menu-head button {
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 11px;
  background: rgba(24, 20, 17, 0.82);
  color: #f7ead1;
  font: 0.66rem ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.room-menu-button {
  font-size: 1rem !important;
}

.room-cart-button {
  position: relative;
  padding-inline: 11px !important;
  font-size: .9rem !important;
}

.room-cart-button i {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  min-width: 17px;
  height: 17px;
  place-items: center;
  padding: 0 4px;
  border: 2px solid #211b17;
  border-radius: 99px;
  background: #e7773e;
  color: #fff;
  font: 600 .49rem ui-monospace, monospace;
}

.room-menu {
  position: absolute;
  top: 48px;
  right: 0;
  display: none;
  width: min(370px, calc(100vw - 32px));
  max-height: min(690px, calc(100dvh - 96px));
  overflow: auto;
  padding: 15px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 17px;
  background: rgba(29, 25, 22, 0.96);
  box-shadow: 0 20px 55px rgba(0,0,0,.36);
  color: #f8ecd7;
  overscroll-behavior: contain;
  backdrop-filter: blur(18px);
}

.room-menu.open {
  display: block;
}

.room-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 13px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.room-menu-head > div {
  display: grid;
  gap: 2px;
}

.room-menu-head span {
  color: rgba(255,255,255,.58);
  font-size: .64rem;
}

.room-menu-head strong {
  color: #a9d09b;
  font: 1rem ui-monospace, monospace;
}

.room-menu-head button {
  min-width: 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 1.1rem;
}

.room-menu section {
  padding: 14px 0 2px;
}

.room-menu h3 {
  margin: 0 0 11px;
  color: rgba(255,255,255,.67);
  font-size: .67rem;
  font-weight: 550;
  letter-spacing: .06em;
}

.room-menu .room-vital > i {
  background: rgba(255,255,255,.13);
}

.room-menu .room-vital > i > em {
  background: #a9c99d;
}

.room-menu .room-vital.warn > i > em {
  background: #d78c70;
}

.room-menu .room-vital b,
.room-menu .room-ledger-row strong,
.room-menu .room-ledger-row small {
  color: rgba(255,255,255,.58);
}

.room-body-entry {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 12px;
  background: rgba(255,255,255,.045);
}

.room-body-entry > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  color: #f8ecd7;
  font-size: .67rem;
  cursor: pointer;
  list-style: none;
}

.room-body-entry > summary::-webkit-details-marker { display: none; }

.room-body-entry > summary::before {
  content: '◇';
  color: #d79aaa;
  font-size: .75rem;
}

.room-body-entry > summary > span { margin-right: auto; font-weight: 600; }
.room-body-entry > summary > b { color: rgba(255,255,255,.53); font-size: .56rem; font-weight: 450; }

.room-body-entry[open] > summary {
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.room-body-content {
  display: grid;
  gap: 7px;
  padding: 10px;
}

.room-body-content h4 {
  margin: 4px 2px 1px;
  color: rgba(255,255,255,.45);
  font-size: .56rem;
  font-weight: 500;
  letter-spacing: .05em;
}

.room-body-item {
  display: grid;
  gap: 5px;
  padding: 9px 10px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 10px;
  background: rgba(0,0,0,.12);
}

.room-body-item > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.room-body-item b { color: rgba(255,255,255,.85); font-size: .63rem; font-weight: 550; }

.room-body-item span {
  flex: none;
  padding: 2px 6px;
  border-radius: 99px;
  background: rgba(184,111,127,.18);
  color: #e3a9b6;
  font-size: .49rem;
}

.room-body-item small {
  color: rgba(255,255,255,.47);
  font-size: .52rem;
  line-height: 1.55;
}

.room-body-item > i {
  display: block;
  height: 4px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255,255,255,.1);
}

.room-body-item > i > em {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #bd765f, #b55f76);
}

.room-body-item.healed span { background: rgba(169,201,157,.16); color: #b8d8ae; }
.room-body-empty { padding: 8px 2px; color: rgba(255,255,255,.4); font-size: .56rem; }

.room-menu .room-ledger-row {
  border-color: rgba(255,255,255,.1);
}

.room-gifts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.room-gift {
  display: grid;
  grid-template-columns: 31px 1fr;
  gap: 2px 7px;
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 11px;
  background: rgba(255,255,255,.06);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.room-gift:active {
  transform: scale(.98);
}

.room-gift:disabled {
  opacity: .55;
}

.room-gift > span {
  grid-row: 1 / 3;
  align-self: center;
  font-size: 1.35rem;
  text-align: center;
}

.room-gift b {
  overflow: hidden;
  font-size: .68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-gift small {
  overflow: hidden;
  color: rgba(255,255,255,.48);
  font-size: .57rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-collection {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.room-collection b,
.room-collection span {
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.6);
  font-size: .56rem;
  font-weight: 450;
}

.room-collection b {
  background: transparent;
  padding-left: 0;
}

.room-menu footer {
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.42);
  font-size: .59rem;
}

.room-map-viewport {
  height: min(64vh, 680px);
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y pinch-zoom;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.25) transparent;
}

.room-map {
  position: relative;
  min-width: 720px;
  aspect-ratio: 1536 / 1027;
  margin: 0 auto;
  transform-origin: top left;
}

.room-background {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  user-select: none;
  -webkit-user-drag: none;
}

.room-actor {
  position: absolute;
  z-index: 5;
  padding: 0;
  border: 0;
  background: transparent;
  transform: translate(-50%, -78%);
  filter: drop-shadow(0 4px 3px rgba(39, 25, 16, 0.24));
  cursor: pointer;
  transition:
    left var(--room-step-duration, .2s) linear,
    top var(--room-step-duration, .2s) linear,
    transform .18s ease;
  -webkit-tap-highlight-color: transparent;
}

.room-actor-sprite {
  display: block;
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  pointer-events: none;
}

.room-actor.owner {
  width: 8.2%;
  min-width: 52px;
  aspect-ratio: 418 / 313;
}

.room-actor.owner .room-actor-sprite {
  background-image: url("assets/room-404-walk-v2.png");
  background-size: 300% 400%;
}

.room-actor.owner.is-action {
  width: 8.8%;
  aspect-ratio: 418 / 380;
}

.room-actor.owner.is-action .room-actor-sprite {
  background-image: url("assets/room-404-actions-v1.png");
  background-size: 300% 200%;
}

.room-actor.owner[data-action="sleep"] {
  width: 10%;
  transform: translate(-50%, -58%);
}

.room-actor.owner[data-action="shower"] {
  width: 8%;
  transform: translate(-50%, -72%);
}

.room-pet {
  --facing-scale: 1;
  width: 5%;
  min-width: 30px;
  aspect-ratio: 2 / 1;
  transform: translate(-50%, -76%);
}

.room-pet .room-actor-sprite {
  background-image: url("assets/room-cats-actions-v1.png");
  background-size: 300% 400%;
}

.room-pet.pipi { width: 5.1%; }
.room-pet.dandan { width: 5%; }
.room-pet.modian { width: 4.3%; }
.room-pet[data-direction="left"] { --facing-scale: -1; }

.room-actor[data-walking="true"] .room-actor-sprite {
  animation: room-walk-bob .38s steps(2, end) infinite;
}

.room-pet .room-actor-sprite {
  transform: scaleX(var(--facing-scale));
}

.room-pet[data-walking="true"] .room-actor-sprite {
  animation-name: room-cat-walk-bob;
}

.room-furniture-occluder {
  position: absolute;
  z-index: 6;
  display: block;
  overflow: hidden;
  pointer-events: none;
  background-image: url("assets/room-concept-v1.png");
  background-repeat: no-repeat;
  image-rendering: pixelated;
}

.room-furniture-occluder.sofa-front {
  left: 51%;
  top: 51.5%;
  width: 17%;
  height: 4.5%;
  background-position: 61.446% 53.927%;
  background-size: 588.235% 2222.222%;
}

.room-actor.owner:not([data-action="tv"]):not([data-action="phone"]),
.room-pet {
  z-index: 7;
}

.room-actor:hover,
.room-actor:focus-visible {
  transform: translate(-50%, -78%) scale(1.08);
  outline: none;
}

@keyframes room-walk-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes room-cat-walk-bob {
  0%, 100% { transform: scaleX(var(--facing-scale)) translateY(0); }
  50% { transform: scaleX(var(--facing-scale)) translateY(-2px); }
}

.room-hotspot {
  position: absolute;
  z-index: 3;
  border: 1px dashed transparent;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}

.room-hotspot:hover,
.room-hotspot:focus-visible {
  border-color: rgba(255, 230, 169, 0.8);
  background: rgba(255, 222, 147, 0.12);
  outline: none;
}

.room-hotspot.bedroom { left: 4%; top: 4%; width: 34%; height: 47%; }
.room-hotspot.living { left: 40%; top: 5%; width: 55%; height: 48%; }
.room-hotspot.bathroom { left: 3%; top: 55%; width: 31%; height: 40%; }
.room-hotspot.kitchen { left: 39%; top: 59%; width: 52%; height: 36%; }
.room-hotspot.desk { left: 77%; top: 6%; width: 19%; height: 26%; }

.room-away {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 48%;
  display: grid;
  gap: 4px;
  min-width: 170px;
  padding: 12px 15px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 236, 190, 0.4);
  border-radius: 12px;
  background: rgba(35, 25, 19, 0.82);
  color: #fff5dd;
  text-align: center;
  backdrop-filter: blur(8px);
}

.room-away span {
  color: #d9b878;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
}

.room-away strong {
  font-size: 0.78rem;
}

.room-map-tools {
  position: absolute;
  z-index: 8;
  top: 56px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px;
  background: rgba(24, 20, 17, 0.76);
  color: #f7ead1;
  backdrop-filter: blur(8px);
}

.room-map-tools button {
  width: 29px;
  height: 29px;
  border: 0;
  border-radius: 8px;
  background: rgba(255,255,255,.1);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.room-map-tools span {
  min-width: 44px;
  font: 0.65rem ui-monospace, monospace;
  text-align: center;
}

.room-map-tip {
  position: absolute;
  z-index: 7;
  left: 12px;
  bottom: 10px;
  margin: 0;
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(24, 20, 17, 0.72);
  color: rgba(255,255,255,.76);
  font-size: 0.65rem;
  pointer-events: none;
}

/* 404 pixel shop */
.room-shop-screen {
  --shop-orange: #ef7136;
  --shop-cream: #fff4d8;
  --shop-ink: #30271f;
  position: fixed;
  z-index: 1100;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  background:
    linear-gradient(rgba(78, 59, 39, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(78, 59, 39, .035) 1px, transparent 1px),
    #f6ead1;
  background-size: 8px 8px;
  color: var(--shop-ink);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
}

.room-shop-screen > header {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 11px;
  min-height: 68px;
  padding: max(10px, env(safe-area-inset-top)) 15px 9px;
  border-bottom: 3px solid var(--shop-ink);
  background: #f9d766;
  box-shadow: 0 4px 0 rgba(65, 48, 32, .13);
}

.room-shop-screen > header button,
.pixel-back {
  min-width: 38px;
  height: 38px;
  border: 2px solid var(--shop-ink);
  border-radius: 4px;
  background: var(--shop-cream);
  color: var(--shop-ink);
  box-shadow: 3px 3px 0 var(--shop-ink);
  font: 700 1rem ui-monospace, monospace;
}

.room-shop-screen > header > div {
  display: grid;
}

.room-shop-screen > header span {
  font-size: .52rem;
  letter-spacing: .14em;
}

.room-shop-screen > header strong {
  font-size: .9rem;
}

.room-shop-screen > header > b {
  padding: 7px 9px;
  border: 2px solid var(--shop-ink);
  background: var(--shop-cream);
  font-size: .68rem;
  box-shadow: 3px 3px 0 var(--shop-ink);
}

.room-shop-screen > main {
  overflow-y: auto;
  padding: 14px 13px calc(18px + env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}

.room-shop-screen > nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  border-top: 3px solid var(--shop-ink);
  background: #fff4d8;
}

.room-shop-screen > nav button {
  position: relative;
  display: grid;
  gap: 2px;
  place-items: center;
  min-height: 47px;
  border: 0;
  background: transparent;
  color: #746453;
  font: .57rem ui-monospace, monospace;
}

.room-shop-screen > nav button.active {
  color: #d95526;
}

.room-shop-screen > nav i {
  font-size: 1.05rem;
  font-style: normal;
}

.room-shop-screen > nav em {
  position: absolute;
  top: 0;
  left: calc(50% + 8px);
  display: grid;
  min-width: 15px;
  height: 15px;
  place-items: center;
  padding: 0 3px;
  border-radius: 20px;
  background: var(--shop-orange);
  color: white;
  font: .47rem ui-monospace, monospace;
}

.pixel-shop-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
  max-width: 760px;
  margin: 0 auto 11px;
}

.pixel-shop-search input,
.pixel-shop-search button {
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 2px solid var(--shop-ink);
  border-radius: 3px;
  outline: 0;
  background: #fffaf0;
  color: var(--shop-ink);
  font: .72rem ui-monospace, monospace;
  box-shadow: 3px 3px 0 var(--shop-ink);
}

.pixel-shop-search button {
  background: var(--shop-orange);
  color: white;
  font-weight: 700;
}

.pixel-shop-categories {
  display: flex;
  max-width: 760px;
  gap: 7px;
  margin: 0 auto 12px;
  padding: 2px 1px 5px;
  overflow-x: auto;
  scrollbar-width: none;
}

.pixel-shop-categories button {
  flex-shrink: 0;
  padding: 6px 10px;
  border: 2px solid var(--shop-ink);
  border-radius: 3px;
  background: #fffaf0;
  color: var(--shop-ink);
  font: .61rem ui-monospace, monospace;
}

.pixel-shop-categories button.active {
  background: #5f8b66;
  color: white;
  box-shadow: 2px 2px 0 var(--shop-ink);
}

.pixel-shop-banner {
  display: grid;
  max-width: 760px;
  min-height: 95px;
  margin: 0 auto 13px;
  padding: 14px 16px;
  border: 3px solid var(--shop-ink);
  background:
    linear-gradient(135deg, transparent 75%, rgba(255,255,255,.22) 75%),
    #e97839;
  background-size: 16px 16px;
  color: white;
  box-shadow: 5px 5px 0 var(--shop-ink);
}

.pixel-shop-banner span {
  font-size: .53rem;
  letter-spacing: .14em;
}

.pixel-shop-banner b {
  font-size: 1rem;
}

.pixel-shop-banner small {
  align-self: end;
  font-size: .58rem;
  opacity: .78;
}

.pixel-product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 760px;
  gap: 10px;
  margin: 0 auto;
}

.pixel-product-card {
  position: relative;
  display: grid;
  min-width: 0;
  padding: 8px;
  border: 2px solid var(--shop-ink);
  border-radius: 3px;
  background: #fffaf0;
  color: var(--shop-ink);
  text-align: left;
  box-shadow: 4px 4px 0 var(--shop-ink);
}

.pixel-product-card:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--shop-ink);
}

.pixel-product-art {
  display: grid;
  aspect-ratio: 1.18;
  place-items: center;
  overflow: hidden;
  border: 2px solid var(--shop-ink);
  background:
    linear-gradient(45deg, #f7d873 25%, transparent 25%, transparent 75%, #f7d873 75%),
    linear-gradient(45deg, #f7d873 25%, #ffeeb0 25%, #ffeeb0 75%, #f7d873 75%);
  background-position: 0 0, 6px 6px;
  background-size: 12px 12px;
  image-rendering: pixelated;
}

.pixel-product-art > span {
  font-size: clamp(2rem, 11vw, 4rem);
  filter: drop-shadow(3px 3px 0 rgba(48,39,31,.22));
}

.pixel-product-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pixel-product-art.large {
  aspect-ratio: 1.45;
}

.pixel-source {
  width: max-content;
  margin: 7px 0 4px;
  padding: 3px 5px;
  background: #5f8b66;
  color: white;
  font-size: .48rem;
}

.pixel-source.taobao {
  background: var(--shop-orange);
}

.pixel-product-card b,
.pixel-product-card small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.pixel-product-card b {
  margin-bottom: 3px;
  font-size: .69rem;
  white-space: nowrap;
}

.pixel-product-card small {
  display: -webkit-box;
  min-height: 2.5em;
  color: #806e5d;
  font-size: .55rem;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.pixel-product-card strong {
  margin-top: 6px;
  color: #d95526;
  font-size: .78rem;
}

.pixel-product-card em {
  position: absolute;
  right: 8px;
  bottom: 8px;
  color: #7b6d5e;
  font-size: .5rem;
  font-style: normal;
}

.pixel-product-detail,
.pixel-cart,
.pixel-confirm,
.pixel-orders,
.pixel-shop-mine {
  width: min(100%, 760px);
  margin: 0 auto;
}

.pixel-back {
  width: auto;
  margin-bottom: 14px;
  padding: 0 10px;
  font-size: .62rem;
}

.pixel-product-detail h2,
.pixel-cart h2,
.pixel-confirm h2,
.pixel-orders h2,
.pixel-shop-mine h2 {
  margin: 9px 0;
  font: 800 1rem ui-monospace, monospace;
}

.pixel-product-detail > strong {
  color: #d95526;
  font-size: 1.25rem;
}

.pixel-product-detail > p {
  margin: 12px 0;
  color: #766555;
  font-size: .68rem;
  line-height: 1.65;
}

.pixel-product-detail dl {
  display: grid;
  margin: 12px 0 92px;
  border: 2px solid var(--shop-ink);
  background: #fffaf0;
}

.pixel-product-detail dl div {
  display: flex;
  justify-content: space-between;
  padding: 9px 10px;
  border-bottom: 1px dashed #9b8d7e;
  font-size: .61rem;
}

.pixel-product-detail dl div:last-child {
  border-bottom: 0;
}

.pixel-product-detail dd {
  margin: 0;
}

.pixel-product-detail dd a {
  margin-left: 8px;
  color: #d95526;
  font-weight: 700;
}

.pixel-detail-actions {
  position: fixed;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 13px calc(10px + env(safe-area-inset-bottom));
  border-top: 3px solid var(--shop-ink);
  background: #fff4d8;
}

.pixel-detail-actions button,
.pixel-cart footer button,
.pixel-confirm footer button,
.pixel-orders footer button,
.pixel-shop-empty button {
  min-height: 42px;
  padding: 0 12px;
  border: 2px solid var(--shop-ink);
  border-radius: 3px;
  background: #f8d867;
  color: var(--shop-ink);
  font: 700 .65rem ui-monospace, monospace;
  box-shadow: 3px 3px 0 var(--shop-ink);
}

.pixel-detail-actions button.primary,
.pixel-cart footer button,
.pixel-confirm footer button {
  background: var(--shop-orange);
  color: white;
}

.pixel-cart h2 small {
  color: #857565;
  font-size: .58rem;
}

.pixel-cart-list {
  display: grid;
  gap: 9px;
}

.pixel-cart-line {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 2px solid var(--shop-ink);
  background: #fffaf0;
  box-shadow: 3px 3px 0 var(--shop-ink);
}

.pixel-cart-line .pixel-product-art {
  width: 74px;
}

.pixel-cart-line > div:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.pixel-cart-line b {
  overflow: hidden;
  font-size: .65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pixel-cart-line small {
  color: #80705f;
  font-size: .5rem;
}

.pixel-cart-line strong {
  color: #d95526;
  font-size: .65rem;
}

.pixel-stepper {
  display: grid !important;
  grid-template-columns: 25px 25px 25px;
  place-items: center;
}

.pixel-stepper button {
  width: 25px;
  height: 25px;
  padding: 0;
  border: 2px solid var(--shop-ink);
  background: #f7d96e;
  color: var(--shop-ink);
}

.pixel-stepper span,
.pixel-cart-line > em {
  font-size: .6rem;
  font-style: normal;
  text-align: center;
}

.pixel-cart > footer,
.pixel-confirm > footer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 15px;
  padding: 10px 13px calc(10px + env(safe-area-inset-bottom));
  border-top: 3px solid var(--shop-ink);
  background: #fff4d8;
  font-size: .65rem;
}

.pixel-cart > footer b,
.pixel-confirm > footer b {
  color: #d95526;
  font-size: .86rem;
}

.pixel-confirm {
  padding-bottom: 80px;
}

.pixel-confirm > section,
.pixel-source-note {
  display: grid;
  gap: 4px;
  margin: 10px 0;
  padding: 12px;
  border: 2px solid var(--shop-ink);
  background: #fffaf0;
  box-shadow: 3px 3px 0 var(--shop-ink);
}

.pixel-confirm > section span {
  color: #826e5a;
  font-size: .52rem;
}

.pixel-confirm > section b {
  font-size: .7rem;
}

.pixel-confirm > section small {
  color: #826e5a;
  font-size: .52rem;
}

.pixel-confirm footer button:disabled {
  background: #a69a8c;
  color: white;
  box-shadow: none;
}

.pixel-orders {
  display: grid;
  gap: 10px;
}

.pixel-orders > article {
  padding: 10px;
  border: 2px solid var(--shop-ink);
  background: #fffaf0;
  box-shadow: 4px 4px 0 var(--shop-ink);
}

.pixel-orders > article > header,
.pixel-orders > article > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 0 8px;
  font-size: .56rem;
}

.pixel-orders > article > header span {
  color: #d95526;
  font-weight: 700;
}

.pixel-orders > article > div {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px dashed #a89987;
}

.pixel-orders .pixel-product-art {
  width: 56px;
}

.pixel-orders > article > div > span {
  display: grid;
  gap: 3px;
}

.pixel-orders > article > div b {
  font-size: .6rem;
}

.pixel-orders > article > div small,
.pixel-orders > article > div strong {
  font-size: .53rem;
}

.pixel-orders footer button {
  min-height: 30px;
  box-shadow: 2px 2px 0 var(--shop-ink);
}

.pixel-shop-mine {
  padding-top: 20px;
  text-align: center;
}

.pixel-shop-avatar {
  display: grid;
  width: 72px;
  height: 72px;
  margin: 0 auto;
  place-items: center;
  border: 3px solid var(--shop-ink);
  background: #f7d869;
  box-shadow: 5px 5px 0 var(--shop-ink);
  font-weight: 900;
}

.pixel-shop-mine > p {
  color: #7c6b5b;
  font-size: .58rem;
}

.pixel-shop-mine > section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 18px 0;
  border: 2px solid var(--shop-ink);
  background: #fffaf0;
}

.pixel-shop-mine > section span {
  display: grid;
  gap: 5px;
  padding: 11px 3px;
  border-right: 1px dashed #988a79;
}

.pixel-shop-mine > section span:last-child {
  border-right: 0;
}

.pixel-shop-mine > section b {
  font-size: .68rem;
}

.pixel-shop-mine > section small {
  color: #7b6a59;
  font-size: .48rem;
}

.pixel-source-note {
  text-align: left;
}

.pixel-source-note b {
  font-size: .65rem;
}

.pixel-source-note p {
  color: #7b6a59;
  font-size: .57rem;
  line-height: 1.65;
}

.pixel-shop-empty {
  grid-column: 1 / -1;
  display: grid;
  gap: 13px;
  place-items: center;
  padding: 45px 15px;
  color: #7b6a59;
  font-size: .67rem;
}

.pixel-shop-empty.tall {
  min-height: 55vh;
}

.room-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.room-panel {
  padding: 18px;
  border: 1px solid var(--comp-line);
  border-radius: 18px;
  background: var(--comp-card);
}

.room-panel h3 {
  margin: 0 0 14px;
  font-family: Georgia, "Songti SC", serif;
  font-size: 1rem;
}

.room-vitals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.room-vital > div {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 0.7rem;
}

.room-vital b {
  color: var(--text-mute);
  font-family: ui-monospace, monospace;
  font-weight: 500;
}

.room-vital > i {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--comp-soft);
}

.room-vital > i > em {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--comp-green);
}

.room-vital.warn > i > em {
  background: #ba6d56;
}

.room-ledger {
  display: grid;
  gap: 2px;
}

.room-ledger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--comp-line);
}

.room-ledger-row:last-child {
  border-bottom: 0;
}

.room-ledger-row > span {
  display: grid;
  gap: 2px;
}

.room-ledger-row b {
  font-size: 0.73rem;
  font-weight: 550;
}

.room-ledger-row small {
  color: var(--text-mute);
  font-size: 0.61rem;
}

.room-ledger-row strong {
  color: var(--text-mute);
  font: 0.7rem ui-monospace, monospace;
}

.room-ledger-row.income strong {
  color: var(--comp-green);
}

.room-ledger-row.expense strong {
  color: var(--comp-warm);
}

.room-ledger-row.gift strong {
  color: #d5ae69;
}

.room-empty {
  padding: 28px 10px;
}

body.room-fullscreen-body {
  overflow: hidden;
}

#roomView.room-immersive {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: block !important;
  width: 100vw;
  height: 100dvh;
  background: #171513;
}

#roomView.room-immersive .comp-screen,
#roomView.room-immersive .room-scroll,
#roomView.room-immersive .room-page,
#roomView.room-immersive .room-map-card {
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
}

#roomView.room-immersive .comp-head {
  display: none;
}

#roomView.room-immersive .room-map-viewport {
  width: 100%;
  height: 100dvh;
  min-height: 0;
}

#roomView.room-immersive .room-now {
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
}

#roomView.room-immersive .room-actions {
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
}

#roomView.room-immersive .room-map-tip {
  left: max(12px, env(safe-area-inset-left));
  bottom: max(10px, env(safe-area-inset-bottom));
}

/* Desire */
.desire-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  width: min(100%, 1000px);
  gap: 14px;
  margin: 0 auto;
}

.desire-hero {
  grid-column: 1 / -1;
  padding: 25px;
  border: 1px solid var(--comp-line);
  border-radius: 22px;
  background:
    radial-gradient(circle at 88% 18%, rgba(169, 103, 79, 0.17), transparent 26%),
    var(--comp-card);
}

.desire-hero .comp-kicker {
  color: var(--comp-warm);
}

.desire-hero h2 {
  margin: 9px 0 8px;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(1.55rem, 4vw, 2.4rem);
  font-weight: 500;
}

.desire-hero > p {
  max-width: 720px;
  color: var(--text-mute);
  font-size: 0.9rem;
  line-height: 1.6;
}

.desire-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.desire-summary span {
  padding: 7px 10px;
  border: 1px solid var(--comp-line);
  border-radius: 999px;
  font-size: 0.7rem;
}

.desire-panel {
  padding: 20px;
  border: 1px solid var(--comp-line);
  border-radius: 20px;
  background: var(--comp-card);
}

.desire-panel h3 {
  margin: 0 0 16px;
  font-family: Georgia, "Songti SC", serif;
  font-size: 1rem;
}

.desire-fold > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.desire-fold > summary::-webkit-details-marker {
  display: none;
}

.desire-fold > summary h3 {
  margin: 0;
}

.desire-fold > summary > span {
  color: var(--text-mute);
  font-size: 0.66rem;
}

.desire-fold > summary::after {
  content: "展开";
  padding: 4px 8px;
  border: 1px solid var(--comp-line);
  border-radius: 999px;
  color: var(--comp-warm);
  font-size: 0.62rem;
}

.desire-fold[open] > summary {
  margin-bottom: 16px;
}

.desire-fold[open] > summary::after {
  content: "收起";
}

.desire-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px 18px;
}

.desire-metric-head {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  font-size: 0.73rem;
}

.desire-metric-head span:last-child {
  color: var(--text-mute);
  font-family: ui-monospace, monospace;
  font-size: 0.65rem;
}

.desire-bar {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--comp-soft);
}

.desire-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--comp-warm);
}

.desire-metric.fatigue .desire-bar i {
  background: var(--comp-gold);
}

.thought-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.thought-item {
  padding: 14px 0;
  border-top: 1px solid var(--comp-line);
}

.thought-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.thought-item p {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-family: Georgia, "Songti SC", serif;
  font-size: 0.84rem;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.thought-item span {
  display: block;
  margin-top: 6px;
  color: var(--text-mute);
  font-size: 0.62rem;
}

.desire-feeling {
  grid-column: 1 / -1;
}

.desire-feeling blockquote {
  color: var(--text);
  font-family: Georgia, "Songti SC", serif;
  font-size: 1rem;
  line-height: 1.65;
}

.desire-feeling-primary {
  background:
    radial-gradient(circle at 12% 18%, rgba(169, 103, 79, 0.12), transparent 34%),
    var(--comp-card);
}

/* Reading room */
.comp-upload-button {
  position: relative;
  cursor: pointer;
}

.comp-upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.reading-intro {
  background:
    linear-gradient(145deg, rgba(82, 124, 104, 0.14), transparent 58%),
    var(--comp-card);
}

.reading-intro > strong {
  color: var(--comp-green);
}

.reading-book-card {
  min-height: 170px;
}

.reading-book-card::after {
  content: "";
  position: absolute;
  top: 17px;
  right: 17px;
  width: 38px;
  height: 48px;
  border: 1px solid var(--comp-line);
  border-radius: 4px 9px 9px 4px;
  background: linear-gradient(90deg, rgba(82, 124, 104, 0.18), transparent);
  transform: rotate(3deg);
}

.reading-book-card h3 {
  max-width: calc(100% - 52px);
  font-size: 1.16rem;
}

#readingView[data-sub="library"] .reading-reader-screen {
  display: none;
}

#readingView[data-sub="reader"] .reading-library-screen {
  display: none;
}

.reading-reader-screen {
  overflow: hidden;
}

.reader-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  flex: 1;
  min-height: 0;
}

.reader-page-column {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
}

.reader-page-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 34px clamp(24px, 7vw, 84px) 50px;
}

.reader-chapter {
  width: min(100%, 720px);
  margin: 0 auto;
}

.reader-chapter-kicker {
  margin-bottom: 10px;
  color: var(--text-mute);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.reader-chapter h3 {
  margin-bottom: 28px;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(1.25rem, 3vw, 1.8rem);
  font-weight: 500;
}

.reader-prose {
  color: var(--text);
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(1rem, 2.2vw, 1.13rem);
  line-height: 2;
}

.reader-prose p {
  margin: 0 0 1em;
  text-indent: 2em;
}

.reader-nav {
  justify-content: center;
  gap: 12px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--comp-line);
  background: var(--bg);
}

.reader-nav button {
  min-width: 82px;
  padding: 9px 14px;
  border: 1px solid var(--comp-line);
  border-radius: 12px;
  background: var(--comp-card);
  color: var(--text);
  font: inherit;
  font-size: 0.76rem;
  cursor: pointer;
}

.reader-nav button:disabled {
  opacity: 0.35;
}

.reader-nav span {
  min-width: 72px;
  color: var(--text-mute);
  font-size: 0.72rem;
  text-align: center;
}

.reader-chat {
  display: flex;
  min-height: 0;
  flex-direction: column;
  border-left: 1px solid var(--comp-line);
  background: rgba(255, 255, 255, 0.18);
}

.reader-chat-head {
  justify-content: space-between;
  padding: 17px;
  border-bottom: 1px solid var(--comp-line);
}

.reader-chat-head strong {
  font-family: Georgia, serif;
  font-size: 0.9rem;
}

.reader-chat-head span {
  color: var(--text-mute);
  font-size: 0.62rem;
}

.reader-chat-messages {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 16px;
}

.reader-message {
  max-width: 90%;
}

.reader-message.user {
  align-self: flex-end;
}

.reader-message-bubble {
  padding: 10px 12px;
  border: 1px solid var(--comp-line);
  border-radius: 14px 14px 14px 4px;
  background: var(--comp-card);
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.reader-message.user .reader-message-bubble {
  border-radius: 14px 14px 4px 14px;
  background: rgba(169, 103, 79, 0.12);
}

.reader-message-meta {
  margin-top: 4px;
  color: var(--text-mute);
  font-size: 0.56rem;
}

.reader-message.user .reader-message-meta {
  text-align: right;
}

.reader-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--comp-line);
}

.reader-chat-form input {
  min-width: 0;
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--comp-line);
  border-radius: 12px;
  outline: none;
  background: var(--comp-card);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
}

.reader-chat-form button {
  width: 40px;
  border: 0;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
}

.reader-toc-select {
  min-width: 0;
  max-width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-mute);
  font: inherit;
  font-size: 0.68rem;
  text-overflow: ellipsis;
}

/* Theme integration */
body.companion .companion-view {
  --comp-warm: #d87845;
  --comp-green: #538775;
}

html[data-appearance="dark"] .companion-view {
  --comp-card: rgba(255, 255, 255, 0.045);
  --comp-card-solid: #1c1b1a;
  --comp-line: rgba(255, 255, 255, 0.1);
  --comp-soft: rgba(255, 255, 255, 0.07);
  --comp-warm: #c9876d;
  --comp-green: #76a58e;
  --comp-gold: #c3a56a;
}

html[data-appearance="dark"] .comp-filters button.active,
html[data-appearance="dark"] .reader-chat-form button {
  background: #e7dfd3;
  color: #171615;
}

body[data-current-view="memory"] .m-topbar,
body[data-current-view="moments"] .m-topbar,
body[data-current-view="room"] .m-topbar,
body[data-current-view="desire"] .m-topbar,
body[data-current-view="reading"] .m-topbar {
  display: none !important;
}

@media (max-width: 820px) {
  .desire-layout,
  .room-info-grid,
  .reader-body {
    grid-template-columns: 1fr;
  }

  .reader-chat {
    min-height: 340px;
    border-top: 1px solid var(--comp-line);
    border-left: 0;
  }

  .reading-reader-screen {
    overflow-y: auto;
  }

  .reader-body {
    display: block;
    overflow: visible;
  }

  .reader-page-column {
    min-height: calc(var(--apph, 100vh) - 72px);
  }

  .reader-page-scroll {
    min-height: 56vh;
    overflow: visible;
  }

  .reader-chat {
    height: 48vh;
  }
}

/* Moments */
.moments-scroll {
  padding-top: 16px;
}

.moment-composer,
.moment-card,
.moments-empty {
  width: min(100%, 720px);
  margin-inline: auto;
  border: 1px solid var(--comp-line);
  background: var(--comp-card);
  box-shadow: 0 10px 34px rgba(54, 44, 34, 0.035);
}

.moment-composer {
  margin-bottom: 16px;
  padding: 16px 17px 12px;
  border-radius: 20px;
}

.moment-composer-top,
.moment-author {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.moment-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 13px;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  color: #fff;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}

.moment-avatar.has-image {
  color: transparent;
  text-shadow: none;
}

.moment-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.moment-avatar-input {
  display: none;
}

.moment-avatar.user {
  background: linear-gradient(145deg, #ba806b, #8f594b);
}

.moment-avatar.assistant {
  background: linear-gradient(145deg, #6d8c7b, #456657);
  font-size: 0.68rem;
}

.moment-composer textarea {
  width: 100%;
  min-height: 60px;
  padding: 6px 2px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.96rem;
  line-height: 1.6;
}

.moment-composer textarea::placeholder,
.moment-comment-form input::placeholder {
  color: var(--text-mute);
}

.moment-composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 9px;
  padding-top: 10px;
  border-top: 1px solid var(--comp-line);
}

.moment-photo-button,
.moment-submit,
.moment-like,
.moment-comment-toggle,
.moment-comment-form button {
  border: 0;
  background: transparent;
  color: var(--text-mute);
  font: inherit;
  cursor: pointer;
}

.moment-photo-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
}

.moment-photo-button svg,
.moment-like svg,
.moment-comment-toggle svg {
  width: 18px;
  height: 18px;
}

.moment-photo-button input {
  display: none;
}

.moment-submit {
  min-width: 62px;
  padding: 7px 17px;
  border-radius: 999px;
  background: var(--comp-green);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 650;
}

.moment-submit:disabled {
  cursor: default;
  opacity: .42;
}

.moment-image-preview {
  padding-left: 49px;
}

.moment-preview-frame {
  position: relative;
  width: min(210px, 70vw);
  margin-top: 8px;
}

.moment-preview-frame img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 13px;
}

.moment-preview-frame button {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(20,20,20,.68);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
}

.moments-feed {
  display: grid;
  gap: 13px;
}

.moment-card {
  padding: 17px;
  border-radius: 20px;
}

.moment-author {
  align-items: center;
}

.moment-author > div:last-child {
  display: grid;
  gap: 2px;
}

.moment-author strong {
  color: var(--text);
  font-size: 0.9rem;
}

.moment-author span {
  color: var(--text-mute);
  font-size: 0.72rem;
}

.moment-content {
  margin: 13px 2px 12px 49px;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.68;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.moment-image {
  display: block;
  min-width: min(260px, 100%);
  min-height: 150px;
  max-width: min(520px, calc(100% - 49px));
  margin: 12px 0 13px 49px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 15px;
  background: var(--comp-soft);
  cursor: zoom-in;
}

.moment-image img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  opacity: 0;
  transition: opacity .18s ease;
}

.moment-image.loaded {
  min-height: 0;
}

.moment-image.loaded img {
  opacity: 1;
}

.moment-actions {
  display: flex;
  min-height: 29px;
  align-items: center;
  gap: 13px;
  margin-left: 49px;
  padding-top: 3px;
}

.moment-like,
.moment-comment-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
  font-size: 0.78rem;
}

.moment-like.active {
  color: #b85e62;
}

.moment-comment-toggle {
  margin-left: auto;
}

.moment-reaction {
  flex: 1;
  color: var(--text-mute);
  font-size: 0.75rem;
}

.moment-reaction.active {
  color: #b85e62;
}

.moment-comments {
  display: grid;
  gap: 7px;
  margin: 10px 0 0 49px;
  padding: 11px 12px;
  border-radius: 13px;
  background: var(--comp-soft);
}

.moment-comment {
  color: var(--text);
  font-size: 0.79rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.moment-comment-name {
  margin-right: 5px;
  color: var(--comp-green);
  font-weight: 700;
}

.moment-comment.user .moment-comment-name {
  color: var(--comp-warm);
}

.moment-comment-pending {
  margin-left: 7px;
  color: var(--text-mute);
  font-size: 0.68rem;
}

.moment-comment-form {
  display: flex;
  gap: 8px;
  margin: 10px 0 0 49px;
}

.moment-comment-form input {
  min-width: 0;
  flex: 1;
  padding: 8px 11px;
  border: 1px solid var(--comp-line);
  border-radius: 11px;
  outline: 0;
  background: var(--comp-soft);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
}

.moment-comment-form input:focus {
  border-color: color-mix(in srgb, var(--comp-green) 50%, transparent);
}

.moment-comment-form button {
  padding: 0 4px;
  color: var(--comp-green);
  font-size: 0.78rem;
  font-weight: 650;
}

.moments-empty {
  padding: 48px 24px;
  border-radius: 20px;
}

@media (max-width: 720px) {
  .comp-scroll {
    padding: 12px 14px calc(34px + env(safe-area-inset-bottom, 0px));
  }

  .comp-card-list {
    grid-template-columns: 1fr;
  }

  .comp-intro {
    padding: 18px;
    border-radius: 17px;
  }

  .comp-intro > strong {
    font-size: 2.45rem;
  }

  .memory-facts {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .memory-detail-body {
    width: calc(100% - 28px);
    padding-top: 18px;
  }

  .memory-content {
    padding: 18px;
  }

  .desire-layout {
    gap: 10px;
  }

  .desire-hero,
  .desire-panel {
    padding: 18px;
    border-radius: 17px;
  }

  .desire-metrics {
    grid-template-columns: 1fr;
  }

  .room-scroll {
    padding-inline: 9px;
  }

  .room-statusbar {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .room-statusbar > div {
    display: block;
    min-width: 0 !important;
    padding: 11px 12px;
  }

  .room-statusbar span,
  .room-statusbar strong,
  .room-statusbar small {
    display: block;
  }

  .room-statusbar strong {
    margin: 3px 0;
    font-size: 0.82rem;
  }

  .room-map-card {
    border-radius: 15px;
  }

  .room-map-viewport {
    height: 55vh;
    min-height: 410px;
  }

  .room-map {
    min-width: 760px;
  }

  .room-map-tip {
    max-width: calc(100% - 120px);
  }

  .room-panel {
    padding: 16px;
    border-radius: 16px;
  }

  .room-vitals {
    grid-template-columns: 1fr 1fr;
  }

  .reader-page-scroll {
    padding: 26px 22px 40px;
  }

  .reader-detail-head,
  .memory-detail-head {
    padding-top: calc(env(safe-area-inset-top, 0px) + 8px);
  }

  .moments-scroll {
    padding-inline: 11px;
  }

  .moment-composer,
  .moment-card {
    border-radius: 17px;
  }

  .moment-card {
    padding: 15px;
  }

  .moment-content,
  .moment-image,
  .moment-actions,
  .moment-comments,
  .moment-comment-form {
    margin-left: 0;
  }

  .moment-image {
    max-width: 100%;
  }

  .moment-image-preview {
    padding-left: 0;
  }
}
