:root {
  color-scheme: light;
  --app-height: 100dvh;
  --viewport-offset-top: 0px;
  --ink: #24303f;
  --muted: #6a7484;
  --line: #d8e0e8;
  --paper: #fffdf8;
  --surface: #f7fbff;
  --blue: #5b8def;
  --coral: #f0736a;
  --green: #55a878;
  --gold: #d99b2b;
  --rose: #e985a5;
  --shadow: 0 12px 30px rgba(42, 55, 73, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  height: var(--app-height);
  overflow: hidden;
  overscroll-behavior: none;
  background:
    linear-gradient(180deg, rgba(246, 250, 255, 0.96), rgba(255, 249, 241, 0.96)),
    repeating-linear-gradient(90deg, rgba(91, 141, 239, 0.08) 0 1px, transparent 1px 26px);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

button,
textarea,
select,
input,
[contenteditable] {
  font: inherit;
}

textarea,
input,
[contenteditable] {
  -webkit-user-select: text;
  user-select: text;
}

button {
  touch-action: manipulation;
}

.app-loading {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  background:
    linear-gradient(180deg, rgba(248, 252, 255, 0.98), rgba(255, 247, 235, 0.98));
  color: #344154;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.app-loading.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-loading img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  filter: drop-shadow(0 10px 16px rgba(42, 55, 73, 0.14));
  animation: loading-breathe 1.2s ease-in-out infinite;
}

.app-loading strong {
  font-size: 18px;
}

.app-loading span {
  color: var(--muted);
  font-size: 13px;
}

.app-shell {
  position: relative;
  isolation: isolate;
  width: min(480px, 100%);
  height: 100vh;
  height: 100dvh;
  height: var(--app-height);
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-shell::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: -32px;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.35), rgba(255, 249, 241, 0.28)),
    var(--active-room-image),
    linear-gradient(180deg, #dff2ff 0%, #f7fbff 54%, #e8f2e3 54%, #f5efd7 100%);
  background-position: center;
  background-size: cover;
  filter: blur(22px) saturate(1.08);
  transform: scale(1.04);
}

.hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  min-height: var(--app-height);
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}

.login-card {
  width: min(420px, 100%);
  padding: 22px 18px 18px;
  border: 1px solid rgba(216, 224, 232, 0.92);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
}

.login-logo {
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 auto 10px;
  object-fit: contain;
}

.login-copy {
  margin: 10px 0 18px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

.login-card label {
  display: block;
  margin-top: 12px;
}

.login-card .primary-action {
  margin-top: 16px;
}

.login-error {
  min-height: 20px;
  margin-top: 10px;
  color: #b2473d;
  font-size: 13px;
}

.top-area {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-area > .title-row {
  position: absolute;
  z-index: 8;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  justify-content: stretch;
  padding: max(14px, env(safe-area-inset-top)) 14px 10px;
  color: #1d2a39;
  text-shadow: 0 2px 10px rgba(255, 255, 255, 0.78);
}

.top-area > .title-row .top-actions {
  justify-self: end;
}

.top-area::before {
  content: "";
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  top: 0;
  height: calc(env(safe-area-inset-top) + 112px);
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(250, 253, 255, 0.88), rgba(250, 253, 255, 0.42) 64%, rgba(250, 253, 255, 0));
}

.top-area > .title-row > div:first-child {
  min-width: 0;
}

.top-area > .title-row h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.feature-page-open .top-area {
  pointer-events: none;
  opacity: 0;
}

.lower-area {
  position: fixed;
  z-index: 80;
  left: 50%;
  top: var(--viewport-offset-top);
  width: min(480px, 100%);
  height: 100vh;
  height: 100dvh;
  height: var(--app-height);
  padding: max(12px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 100%);
  transition: transform 0.24s ease, opacity 0.18s ease;
  isolation: isolate;
  overflow: hidden;
  background:
    linear-gradient(180deg, #f6faff, #fff9f1),
    repeating-linear-gradient(90deg, rgba(91, 141, 239, 0.07) 0 1px, transparent 1px 26px);
}

.lower-area.open {
  pointer-events: auto;
  opacity: 1;
  transform: translate(-50%, 0);
}

.lower-area.swipe-tracking {
  transition: none;
  transform: translate(calc(-50% + var(--swipe-x, 0px)), 0);
  opacity: var(--swipe-opacity, 1);
}

.lower-area.swipe-dismissing {
  pointer-events: none;
  transition: transform 0.18s ease, opacity 0.18s ease;
  transform: translate(calc(-50% + 100%), 0);
  opacity: 0;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 0 2px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.lower-area[data-page="shop"],
.lower-area[data-page="inventory"],
.lower-area[data-page="companion"],
.lower-area[data-page="gallery"],
.lower-area[data-page="system"] {
  background-color: #fffaf2;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.lower-area[data-page="shop"] {
  background-image:
    linear-gradient(180deg, rgba(246, 250, 255, 0.72), rgba(255, 253, 248, 0.52) 30%, rgba(255, 253, 248, 0.72)),
    url("./assets/backgrounds/pages/shop_page.webp");
}

.lower-area[data-page="inventory"] {
  background-image:
    linear-gradient(180deg, rgba(246, 250, 255, 0.72), rgba(255, 253, 248, 0.5) 30%, rgba(255, 253, 248, 0.7)),
    url("./assets/backgrounds/pages/inventory_page.webp");
}

.lower-area.inventory-use-active::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at var(--use-x, 50%) var(--use-y, 42%), rgba(255, 232, 146, 0.34), transparent 34%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.22), transparent 58%);
  animation: inventory-page-glow var(--inventory-use-duration, 2s) ease-in-out both;
}

.lower-area[data-page="companion"] {
  padding: max(8px, env(safe-area-inset-top)) 0 max(0px, env(safe-area-inset-bottom));
  background-color: #ededed;
  background-image:
    linear-gradient(180deg, rgba(237, 237, 237, 0.72), rgba(237, 237, 237, 0.52) 44%, rgba(237, 237, 237, 0.76)),
    url("./assets/backgrounds/pages/companion_page.webp");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.lower-area[data-page="system"] {
  background-image:
    linear-gradient(180deg, rgba(255, 252, 244, 0.72), rgba(247, 253, 255, 0.42) 40%, rgba(255, 250, 242, 0.72)),
    url("./assets/backgrounds/pages/system_page.webp");
}

.lower-area[data-page="gallery"] {
  background-image:
    linear-gradient(180deg, rgba(255, 252, 244, 0.68), rgba(247, 253, 255, 0.44) 40%, rgba(255, 250, 242, 0.72)),
    url("./assets/backgrounds/pages/gallery_page.webp");
}

.lower-area[data-page="shop"] .drawer-head,
.lower-area[data-page="inventory"] .drawer-head,
.lower-area[data-page="companion"] .drawer-head,
.lower-area[data-page="gallery"] .drawer-head,
.lower-area[data-page="system"] .drawer-head {
  position: relative;
  min-height: 46px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(247, 247, 247, 0.92);
  justify-content: center;
  backdrop-filter: blur(10px);
}

.lower-area[data-page="shop"] .drawer-head strong,
.lower-area[data-page="inventory"] .drawer-head strong,
.lower-area[data-page="companion"] .drawer-head strong,
.lower-area[data-page="gallery"] .drawer-head strong {
  position: absolute;
  left: 50%;
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #111;
  box-shadow: none;
  text-shadow: none;
  transform: translateX(-50%);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0;
}

.lower-area[data-page="system"] .drawer-head strong {
  position: absolute;
  left: 50%;
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #111;
  box-shadow: none;
  text-shadow: none;
  transform: translateX(-50%);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0;
}

.lower-area[data-page="shop"] .drawer-meta,
.lower-area[data-page="inventory"] .drawer-meta,
.lower-area[data-page="companion"] .drawer-meta,
.lower-area[data-page="gallery"] .drawer-meta,
.lower-area[data-page="system"] .drawer-meta {
  display: none;
}

.lower-area[data-page="shop"] .drawer-close,
.lower-area[data-page="inventory"] .drawer-close,
.lower-area[data-page="companion"] .drawer-close,
.lower-area[data-page="gallery"] .drawer-close {
  position: absolute;
  left: 6px;
  top: 50%;
  width: 34px;
  height: 34px;
  margin: 0;
  border-radius: 6px;
  background: transparent;
  color: #111;
  box-shadow: none;
  transform: translateY(-50%);
  font-size: 0;
  font-weight: 400;
}

.lower-area[data-page="system"] .drawer-close {
  position: absolute;
  left: 6px;
  top: 50%;
  width: 34px;
  height: 34px;
  margin: 0;
  border-radius: 6px;
  background: transparent;
  color: #111;
  box-shadow: none;
  transform: translateY(-50%);
  font-size: 0;
  font-weight: 400;
}

.lower-area[data-page="shop"] .drawer-close::before,
.lower-area[data-page="inventory"] .drawer-close::before,
.lower-area[data-page="companion"] .drawer-close::before,
.lower-area[data-page="gallery"] .drawer-close::before {
  content: "";
  width: 12px;
  height: 12px;
  border-left: 2px solid #111;
  border-bottom: 2px solid #111;
  transform: rotate(45deg);
}

.lower-area[data-page="system"] .drawer-close::before {
  content: "";
  width: 12px;
  height: 12px;
  border-left: 2px solid #111;
  border-bottom: 2px solid #111;
  transform: rotate(45deg);
}

.drawer-head strong {
  font-size: 14px;
  line-height: 1;
}

.drawer-meta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 27px;
  margin-left: auto;
  padding: 0 9px;
  border: 1px solid rgba(216, 224, 232, 0.7);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: #24303f;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 6px 14px rgba(42, 55, 73, 0.08);
  backdrop-filter: blur(8px);
}

.drawer-meta img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.drawer-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 241, 218, 0.8));
  color: #6f4a2d;
  cursor: pointer;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(42, 55, 73, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.drawer-meta:not(.hidden) + .drawer-close {
  margin-left: 0;
}

.lower-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 0 16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.lower-scroll::-webkit-scrollbar {
  display: none;
}

.page-stack {
  margin-top: 0;
}

.app-page {
  display: none;
}

.app-page.active {
  display: block;
}

.app-page .panel:first-child {
  margin-top: 0;
}

.title-row,
.section-head,
.meter-label,
.form-row,
.tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
}

h3 {
  margin-bottom: 8px;
  font-size: 14px;
}

.icon-button,
.primary-action,
.item-card,
.stage-action,
.tab,
.room-switch,
.ghost-button {
  border: 0;
  cursor: pointer;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.session-chip,
.ghost-button {
  height: 34px;
  border-radius: 999px;
  white-space: nowrap;
}

.session-chip {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  background: #eaf3ee;
  color: #2f684a;
  font-size: 13px;
  font-weight: 700;
}

.ghost-button {
  padding: 0 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
  font-size: 13px;
}

.pet-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  --room-extension-height: clamp(96px, 14dvh, 136px);
  --room-clear-height: calc(100% - var(--room-extension-height));
  --room-clear-top: var(--room-extension-height);
  --pet-left: 50%;
  --pet-bottom: clamp(76px, 12dvh, 104px);
  --pet-scale: 1.05;
  --pet-shadow-scale: 1;
  background:
    linear-gradient(180deg, #dff2ff 0%, #f7fbff 54%, #e8f2e3 54%, #f5efd7 100%);
  box-shadow: none;
}

.pet-stage::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: -24px;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.16), rgba(255, 249, 241, 0.12)),
    var(--active-room-image),
    linear-gradient(180deg, #dff2ff 0%, #f7fbff 54%, #e8f2e3 54%, #f5efd7 100%);
  background-position: center;
  background-size: cover;
  filter: blur(18px) saturate(1.06);
  transform: scale(1.03);
}

.room-bg {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(0deg, rgba(210, 178, 116, 0.22) 0 1px, transparent 1px 26px),
    linear-gradient(90deg, rgba(210, 178, 116, 0.16) 0 1px, transparent 1px 26px),
    radial-gradient(circle at 78% 24%, rgba(240, 115, 106, 0.2) 0 36px, transparent 37px);
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: auto var(--room-clear-height);
}

.room-actions {
  position: absolute;
  z-index: 7;
  left: 10px;
  bottom: 10px;
  width: 38px;
  height: 38px;
}

.stage-action-list {
  position: absolute;
  left: 0;
  bottom: 44px;
  display: grid;
  grid-template-columns: 37px;
  gap: 2px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.94);
  transform-origin: left bottom;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.room-actions.expanded .stage-action-list {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.room-choice-bar {
  position: absolute;
  left: 43px;
  bottom: 54px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid rgba(216, 224, 232, 0.92);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 10px 22px rgba(42, 55, 73, 0.14);
  transform: translateX(-8px) scale(0.96);
  transform-origin: left center;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.room-choice-bar:not(.hidden) {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.room-choice-bar button {
  min-width: 42px;
  height: 29px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #334154;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.room-choice-bar button.active {
  background: #24303f;
  color: #fff;
}

.stage-action {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  padding: 2px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}

.stage-action.active {
  background: transparent;
  filter: drop-shadow(0 0 5px rgba(255, 215, 92, 0.95));
}

.stage-action img {
  display: block;
  width: 33px;
  height: 33px;
  object-fit: contain;
  filter: drop-shadow(0 3px 5px rgba(42, 55, 73, 0.26));
  pointer-events: none;
}

.stage-menu-toggle {
  position: absolute;
  left: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(36, 48, 63, 0.86);
  box-shadow: 0 7px 16px rgba(42, 55, 73, 0.2);
  cursor: pointer;
}

.stage-menu-toggle span,
.stage-menu-toggle span::before,
.stage-menu-toggle span::after {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
  content: "";
}

.stage-menu-toggle span {
  position: relative;
}

.stage-menu-toggle span::before,
.stage-menu-toggle span::after {
  position: absolute;
  left: 0;
}

.stage-menu-toggle span::before {
  top: -8px;
}

.stage-menu-toggle span::after {
  top: 8px;
}

.room-actions.expanded .stage-menu-toggle {
  background: rgba(255, 253, 248, 0.9);
}

.room-actions.expanded .stage-menu-toggle span,
.room-actions.expanded .stage-menu-toggle span::before,
.room-actions.expanded .stage-menu-toggle span::after {
  background: #24303f;
}

.pet-hud {
  position: absolute;
  z-index: 6;
  top: max(calc(env(safe-area-inset-top) + 82px), calc(var(--room-clear-top) + 10px));
  right: 8px;
  left: 8px;
  width: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  overflow: visible;
}

.pet-hud span {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 2px;
  min-width: 0;
  height: 24px;
  padding: 2px 4px;
  border-radius: 999px;
  border: 1px solid rgba(36, 48, 63, 0.1);
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
  box-shadow: 0 5px 14px rgba(42, 55, 73, 0.1);
  backdrop-filter: blur(10px);
}

.pet-hud .hud-stat {
  cursor: pointer;
  user-select: none;
}

.pet-hud .hud-stat:focus-visible {
  outline: 2px solid rgba(91, 141, 239, 0.65);
  outline-offset: 2px;
}

.hud-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  font-style: normal;
}

.intimacy-icon {
  background-image: url("./assets/icons/hud/intimacy.png");
}

.heart-icon {
  background-image: url("./assets/icons/hud/heart.png");
}

.hunger-icon {
  background-image: url("./assets/icons/hud/hunger.png");
}

.clean-icon {
  background-image: url("./assets/icons/hud/cleanliness.png");
}

.mood-icon {
  background-image: url("./assets/icons/hud/mood.png");
}

.energy-icon {
  background-image: url("./assets/icons/hud/energy.png");
}

.miss-icon {
  background-image: url("./assets/icons/hud/missing.png");
}

.pet-hud strong {
  color: var(--ink);
  font-size: 11px;
}

.pet-hud .hud-miss {
  background: rgba(255, 244, 230, 0.95);
  color: #9a5c19;
}

.pet-avatar {
  position: absolute;
  z-index: 2;
  left: var(--pet-left);
  bottom: var(--pet-bottom);
  width: 192px;
  height: 208px;
  transform: translateX(-50%) scale(var(--pet-scale));
  transform-origin: center bottom;
  background-image: url("./assets/pets/xiaoyuanzi/base/spritesheet-v20260922164033.png");
  background-image: image-set(
    url("./assets/pets/xiaoyuanzi/base/spritesheet-v20260922164033.webp") type("image/webp"),
    url("./assets/pets/xiaoyuanzi/base/spritesheet-v20260922164033.png") type("image/png")
  );
  background-repeat: no-repeat;
  background-size: 1920px 4368px;
  background-position-x: 0;
  background-position-y: calc(var(--sprite-track, 0) * -208px);
  image-rendering: auto;
  animation: sprite-loop var(--sprite-duration, 1.1s) steps(var(--sprite-steps, 7)) infinite;
  transition: left 0.42s ease, bottom 0.42s ease, transform 0.42s ease;
}

.pet-ground-shadow {
  position: absolute;
  z-index: 1;
  left: var(--pet-left);
  bottom: calc(var(--pet-bottom) - 4px);
  width: 96px;
  height: 20px;
  transform: translateX(-50%) scale(var(--pet-shadow-scale));
  border-radius: 50%;
  background: rgba(46, 40, 34, 0.16);
  filter: blur(5px);
  pointer-events: none;
  transition: left 0.42s ease, bottom 0.42s ease, transform 0.42s ease;
}

.pet-avatar.upset {
  filter: saturate(0.9);
}

.pet-avatar.happy {
  animation-name: sprite-loop, sprite-pop;
  animation-duration: var(--sprite-duration, 1.1s), var(--sprite-pop-duration, 0.9s);
  animation-timing-function: steps(var(--sprite-steps, 7)), ease-in-out;
  animation-iteration-count: infinite, 1;
}

.pet-avatar.static-avatar {
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  animation: none;
}

.pet-avatar.item-interaction-avatar {
  width: var(--interaction-width, var(--interaction-size, 214px));
  height: var(--interaction-height, var(--interaction-size, 214px));
  background-repeat: no-repeat;
  background-position: 0 0;
  background-position-y: 0;
  background-size: var(--interaction-sheet-width, 1284px) var(--interaction-cell-height, 214px);
  animation: sprite-loop var(--sprite-duration, 1.35s) steps(var(--sprite-steps, 5)) infinite;
}

.pet-avatar.activity-zone-avatar {
  bottom: clamp(70px, 11dvh, 96px);
  z-index: 3;
}

.pet-ground-shadow.hidden {
  display: none;
}

.speech {
  position: absolute;
  z-index: 4;
  left: 60px;
  right: 10px;
  bottom: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid rgba(36, 48, 63, 0.12);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.9);
  color: #334154;
  line-height: 1.38;
  font-size: 14px;
  box-shadow: 0 8px 20px rgba(42, 55, 73, 0.1);
}

.speech--linked {
  cursor: pointer;
}

.speech--linked::after {
  content: "";
  position: absolute;
  right: 10px;
  top: -6px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(7, 193, 96, 0.82);
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.12);
}

.speech button {
  min-width: 54px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.speech.dismissed {
  display: none;
}

.scene-unlock-overlay {
  position: fixed;
  z-index: 140;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  background: rgba(19, 24, 33, 0.36);
  backdrop-filter: blur(7px);
}

.scene-unlock-card {
  position: relative;
  width: min(360px, 92vw);
  padding: 16px 14px 14px;
  border: 1px solid rgba(255, 241, 194, 0.76);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 16%, rgba(255, 236, 161, 0.82), rgba(255, 250, 234, 0.92) 44%, rgba(246, 251, 255, 0.94)),
    rgba(255, 253, 248, 0.96);
  box-shadow: 0 22px 58px rgba(35, 39, 50, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  overflow: hidden;
  animation: scene-unlock-pop 0.42s cubic-bezier(0.2, 0.86, 0.28, 1.12) both;
}

.scene-unlock-close {
  position: absolute;
  z-index: 3;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: rgba(38, 54, 75, 0.72);
  font-size: 20px;
  line-height: 1;
}

.scene-unlock-effect {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scene-unlock-effect span,
.scene-unlock-effect i,
.scene-unlock-effect b {
  position: absolute;
  left: 50%;
  top: 42%;
  display: block;
  border-radius: 999px;
  content: "";
  pointer-events: none;
}

.scene-unlock-effect span {
  width: 180px;
  height: 180px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 228, 126, 0.84), rgba(255, 228, 126, 0) 66%);
  animation: scene-unlock-pulse 2.8s ease-out infinite;
}

.scene-unlock-effect i {
  width: 310px;
  height: 310px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 230, 151, 0.62);
  box-shadow: 0 0 28px rgba(255, 217, 111, 0.34);
  animation: scene-unlock-ring 3.2s ease-in-out infinite;
}

.scene-unlock-effect b {
  width: 86%;
  height: 1px;
  transform: translate(-50%, -50%) rotate(-12deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.86), transparent);
  animation: scene-unlock-sweep 2.6s ease-in-out infinite;
}

.scene-unlock-preview {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 8 / 5;
  border: 2px solid rgba(255, 244, 196, 0.96);
  border-radius: 14px;
  background-color: #eef3f7;
  background-position: center;
  background-size: cover;
  box-shadow: 0 14px 30px rgba(144, 96, 42, 0.2);
  overflow: hidden;
}

.scene-unlock-preview.fragment-preview {
  width: min(188px, 56vw);
  aspect-ratio: 1;
  margin: 0 auto;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  background-size: contain;
  box-shadow: none;
}

.scene-unlock-preview::after {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, transparent 0 36%, rgba(255, 255, 255, 0.48) 48%, transparent 62%),
    radial-gradient(circle at 50% 50%, transparent, rgba(255, 235, 166, 0.18));
  animation: scene-unlock-preview-shine 3s ease-in-out infinite;
  content: "";
}

.scene-unlock-preview.fragment-preview::after {
  inset: 8%;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 234, 142, 0.3), transparent 58%),
    linear-gradient(115deg, transparent 0 38%, rgba(255, 255, 255, 0.48) 50%, transparent 62%);
}

.scene-unlock-card.fragment-notice {
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 235, 156, 0.74), rgba(255, 251, 239, 0.94) 46%, rgba(243, 248, 252, 0.96)),
    rgba(255, 253, 248, 0.96);
}

.scene-unlock-card.fragment-notice .scene-unlock-effect b {
  display: none;
}

.scene-unlock-copy {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 4px;
  margin-top: 12px;
  text-align: center;
}

.scene-unlock-copy span {
  color: #b0711c;
  font-size: 12px;
  font-weight: 900;
}

.scene-unlock-copy strong {
  color: #26364b;
  font-size: 22px;
  letter-spacing: 0;
}

.scene-unlock-copy p {
  min-height: 34px;
  margin: 0 auto;
  color: #5b6574;
  font-size: 13px;
  line-height: 1.35;
}

.scene-unlock-actions {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 9px;
  margin-top: 13px;
}

.scene-unlock-actions button {
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #415064;
  font-size: 14px;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 8px 16px rgba(42, 55, 73, 0.1);
}

.scene-unlock-actions button:last-child {
  background: linear-gradient(180deg, #ffe58f, #f3b553);
  color: #603b11;
}

.float-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.float-delta {
  position: absolute;
  left: 50%;
  top: 50%;
  padding: 5px 9px;
  max-width: 76px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 14px rgba(42, 55, 73, 0.14);
  color: #2f684a;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  animation: float-rise 2.8s cubic-bezier(0.18, 0.72, 0.22, 1) forwards;
}

.float-delta.negative {
  color: #b2473d;
}

.hud-name-bubble {
  position: absolute;
  z-index: 8;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(36, 48, 63, 0.9);
  box-shadow: 0 8px 18px rgba(42, 55, 73, 0.18);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
  transform: translate(-50%, 4px);
  animation: hud-name-pop 1.05s ease-out forwards;
}

.feedback-box,
.inventory-item,
.profile-item {
  border: 1px solid rgba(216, 224, 232, 0.9);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.panel {
  margin-top: 14px;
  padding: 15px;
  border: 1px solid rgba(216, 224, 232, 0.92);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.9);
  box-shadow: 0 8px 24px rgba(42, 55, 73, 0.08);
}

#shopPage > .care-panel,
#inventoryPage > .care-panel,
.game-page > .panel {
  margin-top: 0;
  padding: 10px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#shopPage.active,
#inventoryPage.active {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}

#shopPage > .care-panel,
#inventoryPage > .care-panel {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.lower-area[data-page="shop"] .lower-scroll,
.lower-area[data-page="inventory"] .lower-scroll,
.lower-area[data-page="companion"] .lower-scroll,
.lower-area[data-page="gallery"] .lower-scroll,
.lower-area[data-page="system"] .lower-scroll {
  display: flex;
  flex-direction: column;
  padding-top: 0;
}

.lower-area[data-page="companion"] .lower-scroll {
  padding: 0;
}

.lower-area[data-page="companion"] .page-stack {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  height: 100%;
}

.lower-area[data-page="shop"] .page-stack,
.lower-area[data-page="inventory"] .page-stack,
.lower-area[data-page="gallery"] .page-stack {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  height: 100%;
}

.gallery-game-page {
  display: none;
}

.gallery-game-page.active {
  display: flex;
  min-height: 0;
}

.lower-area[data-page="system"] .page-stack {
  flex: 0 0 auto;
}

.lower-area[data-page="shop"] .change-panel,
.lower-area[data-page="inventory"] .change-panel,
.lower-area[data-page="gallery"] .change-panel,
.lower-area[data-page="system"] .change-panel {
  display: none;
}

.lower-area[data-page="companion"] .change-panel {
  display: none;
}

.section-head {
  margin-bottom: 12px;
}

.section-head span,
#scoreChip,
#dayTypeChip {
  color: var(--muted);
  font-size: 12px;
}

textarea,
select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
}

textarea {
  display: block;
  resize: vertical;
  min-height: 118px;
  padding: 12px;
  line-height: 1.55;
}

.companion-game-page {
  display: none;
  gap: 10px;
}

.companion-game-page.active {
  display: grid;
  grid-template-rows: auto minmax(82px, auto);
}

.companion-card,
.companion-tags-card,
.system-panel {
  border: 1px solid rgba(128, 145, 166, 0.24);
  border-radius: 12px;
  background:
    linear-gradient(180deg, #fffef9, #fff8ea);
  box-shadow: 0 10px 22px rgba(42, 55, 73, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.companion-card {
  padding: 13px 12px 12px;
}

.companion-tags-card {
  padding: 11px 12px 12px;
  background:
    linear-gradient(180deg, #f8fbff, #fffefa);
}

.companion-card textarea {
  min-height: 138px;
  border: 1px solid rgba(214, 187, 136, 0.68);
  border-radius: 10px;
  background:
    linear-gradient(180deg, #fffefa, #fff7df);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.companion-card .section-head,
.companion-tags-card .section-head,
.system-panel .tabs {
  margin-bottom: 9px;
}

.companion-card .section-head h2,
.companion-tags-card .section-head h2 {
  font-size: 16px;
}

.companion-card .section-head span,
.companion-tags-card .section-head span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  font-weight: 800;
}

.form-row {
  align-items: stretch;
  margin: 12px 0;
}

label {
  flex: 1;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

select {
  height: 40px;
  padding: 0 10px;
}

input {
  height: 44px;
  padding: 0 12px;
}

.primary-action {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  margin-top: 10px;
}

.entry-actions {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.entry-actions .primary-action {
  margin-top: 0;
}

.companion-card .entry-actions .primary-action {
  border: 1px solid rgba(214, 158, 63, 0.34);
  background:
    linear-gradient(180deg, #ffe7a8, #f4bc68);
  color: #5b3d1f;
  box-shadow: 0 10px 18px rgba(166, 105, 36, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.voice-action {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 247, 225, 0.84));
  color: #8a5b11;
  box-shadow: 0 8px 18px rgba(166, 105, 36, 0.12);
  cursor: pointer;
}

.voice-action svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.voice-action.listening {
  background: #ffe9e6;
  color: #b2473d;
  animation: voice-pulse 1s ease-in-out infinite;
}

.voice-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  animation: none;
}

.voice-status {
  min-height: 16px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.companion-game-page.active {
  flex: 1 1 auto;
  display: block;
  min-height: 0;
}

.companion-chat {
  display: grid;
  grid-template-rows: 39px auto auto minmax(0, 1fr) auto auto;
  gap: 0;
  height: 100%;
  min-height: 0;
}

.chat-filter-bar {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: #f7f7f7;
  overflow-x: auto;
  scrollbar-width: none;
}

.chat-filter-bar::-webkit-scrollbar {
  display: none;
}

.chat-filter {
  flex: 0 0 auto;
  position: relative;
  height: 38px;
  padding: 0 1px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #6b6b6b;
  font-size: 14px;
  font-weight: 500;
  box-shadow: none;
  backdrop-filter: none;
}

.chat-filter.active {
  border-color: transparent;
  background: transparent;
  color: #07c160;
}

.chat-filter.active::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 0;
  height: 2px;
  border-radius: 999px;
  background: #07c160;
}

.daily-wish-card {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  margin: 7px 10px 2px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 209, 117, 0.55);
  border-radius: 8px;
  background: rgba(255, 252, 238, 0.9);
  box-shadow: 0 5px 12px rgba(194, 142, 51, 0.1);
  color: #3b3428;
  text-align: left;
}

.daily-wish-card.completed {
  border-color: rgba(96, 175, 119, 0.42);
  background: rgba(242, 255, 245, 0.88);
}

.daily-wish-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.96), transparent 34%),
    linear-gradient(135deg, #ffd978, #f39d62);
  box-shadow: inset 0 -3px 0 rgba(126, 83, 20, 0.12), 0 4px 8px rgba(185, 118, 32, 0.16);
}

.daily-wish-card.completed .daily-wish-mark {
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.96), transparent 34%),
    linear-gradient(135deg, #8de1a5, #55a878);
}

.daily-wish-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.daily-wish-copy strong {
  overflow: hidden;
  color: #5a4a2c;
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daily-wish-card.completed .daily-wish-copy strong {
  color: #2f684a;
}

.daily-wish-copy em {
  overflow: hidden;
  color: #665f56;
  font-size: 12px;
  font-style: normal;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daily-wish-reward {
  color: #a06d1d;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.daily-wish-card.completed .daily-wish-reward {
  color: #2f684a;
}

.wish-composer-panel {
  display: grid;
  gap: 5px;
  margin: 5px 10px 3px;
}

.wish-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 7px;
  align-items: center;
}

.wish-input-row input {
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: #202124;
  font-size: 16px;
  line-height: 32px;
  outline: none;
}

.wish-input-row input:focus {
  border-color: rgba(7, 193, 96, 0.45);
  box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.08);
}

.wish-input-row button {
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: #07c160;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.wish-input-row button:disabled {
  opacity: 0.56;
}

.wish-overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid rgba(7, 193, 96, 0.16);
  border-radius: 8px;
  background: rgba(245, 255, 250, 0.82);
  color: #3f3a34;
  text-align: left;
}

.wish-overview span {
  flex: 0 0 auto;
  color: #147244;
  font-size: 11px;
  font-weight: 800;
}

.wish-overview strong {
  overflow: hidden;
  color: #635d55;
  font-size: 11px;
  font-weight: 600;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wish-board {
  display: grid;
  gap: 7px;
  max-height: 178px;
  overflow-y: auto;
  scrollbar-width: none;
}

.wish-board--gallery {
  max-height: none;
  overflow: visible;
}

.wish-board::-webkit-scrollbar {
  display: none;
}

.wish-section {
  display: grid;
  gap: 5px;
}

.wish-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1px;
  color: #6a6258;
  font-size: 11px;
  line-height: 1.2;
}

.wish-section-head strong {
  color: #3f3a34;
  font-size: 11px;
}

.wish-section-head span {
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
  text-align: center;
}

.wish-list {
  display: grid;
  gap: 5px;
  min-height: 0;
}

.wish-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 7px;
  width: 100%;
  min-height: 54px;
  padding: 7px 8px;
  border: 1px solid rgba(255, 209, 117, 0.42);
  border-radius: 8px;
  background: rgba(255, 252, 238, 0.88);
  color: #3f3a34;
  text-align: left;
}

.wish-card--incoming {
  border-color: rgba(7, 193, 96, 0.34);
  background: rgba(239, 255, 247, 0.92);
}

.wish-card.fulfilled {
  border-color: rgba(96, 175, 119, 0.28);
  background: rgba(241, 255, 245, 0.82);
}

.wish-card.rejected {
  border-color: rgba(191, 106, 97, 0.24);
  background: rgba(255, 245, 244, 0.84);
}

.wish-card-badge {
  grid-row: 1 / 4;
  align-self: start;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(7, 193, 96, 0.12);
  color: #147244;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.wish-card:not(.wish-card--incoming) .wish-card-badge {
  background: rgba(255, 209, 117, 0.26);
  color: #8b6421;
}

.wish-card.rejected .wish-card-badge {
  background: rgba(191, 106, 97, 0.14);
  color: #9b453f;
}

.wish-card strong,
.wish-card p,
.wish-card-meta {
  min-width: 0;
}

.wish-card strong {
  overflow: hidden;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wish-card p {
  margin: 0;
  overflow: hidden;
  color: #635d55;
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wish-card-meta {
  overflow: hidden;
  color: #8a8176;
  font-size: 10px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wish-empty {
  min-height: 30px;
  padding: 7px 8px;
  border: 1px dashed rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  color: #8a8176;
  font-size: 11px;
  line-height: 1.3;
}

.chat-message-list {
  min-height: 0;
  padding: 13px 12px 11px;
  background: transparent;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.chat-message-list::-webkit-scrollbar {
  display: none;
}

.chat-load-more {
  justify-self: center;
  display: block;
  min-height: 28px;
  margin: 0 auto 12px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: #777;
  font-size: 12px;
  font-weight: 500;
  box-shadow: none;
  backdrop-filter: none;
}

.chat-load-more:disabled {
  opacity: 0.56;
}

.chat-time-divider {
  display: block;
  width: fit-content;
  max-width: 72%;
  margin: 11px auto 8px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.12);
  color: rgba(255, 255, 255, 0.96);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.chat-message {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 11px 0;
}

.chat-message--highlight .chat-bubble {
  box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.38), 0 8px 18px rgba(7, 193, 96, 0.12);
  animation: chat-highlight 1.1s ease-in-out 1;
}

.chat-message--user {
  justify-content: flex-end;
}

.chat-avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  background: #dfefff;
  color: #315d9d;
  font-size: 16px;
  font-weight: 600;
  box-shadow: none;
}

.chat-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-avatar--pet {
  background: #fff;
}

.chat-avatar--pet img {
  object-fit: contain;
  padding: 2px;
}

.chat-message-body {
  display: grid;
  gap: 4px;
  max-width: min(72%, 330px);
}

.chat-message--user .chat-message-body {
  justify-items: end;
}

.chat-message-meta {
  max-width: 100%;
  padding: 0 3px;
  display: none;
}

.chat-bubble {
  position: relative;
  max-width: 100%;
  padding: 9px 11px;
  border-radius: 4px;
  background: #fff;
  color: #111;
  font-size: 14px;
  line-height: 1.46;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: none;
}

.chat-message--pet .chat-bubble {
  cursor: pointer;
}

.chat-message--user .chat-bubble {
  background: #95ec69;
  box-shadow: none;
}

.chat-message.pending .chat-bubble {
  color: #6a7484;
  font-style: normal;
  opacity: 0.82;
}

.chat-score-detail {
  max-width: 100%;
  margin-top: 2px;
  padding: 6px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.72);
  color: #666;
  font-size: 11px;
  line-height: 1.4;
}

.chat-score-detail summary {
  color: #576b95;
  font-weight: 500;
}

.chat-score-detail p {
  margin: 5px 0 0;
}

.chat-entry-review {
  color: #4d5a69;
}

.chat-message-tags,
.chat-quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chat-message-tags span,
.chat-quick-tags button {
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: #576b95;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 500;
}

.chat-quick-tags {
  min-height: 0;
  max-height: 34px;
  overflow: hidden;
  padding: 3px 12px 4px;
  background: transparent;
}

.chat-quick-tags button {
  cursor: pointer;
}

.chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px 50px;
  gap: 6px;
  align-items: end;
  padding: 6px 8px max(6px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0;
  background: #f7f7f7;
  box-shadow: none;
  backdrop-filter: none;
}

.chat-composer #entryText {
  width: 100%;
  height: 34px;
  min-height: 34px;
  max-height: 86px;
  padding: 6px 9px;
  border: 0;
  border-radius: 4px;
  background: #fff;
  color: #111;
  font-size: 16px;
  line-height: 1.35;
  resize: none;
  outline: none;
  overflow: hidden;
  white-space: nowrap;
  word-break: keep-all;
  -webkit-user-modify: read-write-plaintext-only;
}

.chat-composer #entryText:empty::before {
  content: attr(data-placeholder);
  color: #9b9b9b;
  font-size: 16px;
  pointer-events: none;
}

.chat-composer .voice-action {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 4px;
  background: #fff;
  color: #9a6a12;
  box-shadow: none;
}

.chat-composer .voice-action svg {
  width: 18px;
  height: 18px;
}

.chat-send-action {
  height: 34px;
  padding: 0 9px;
  border: 0;
  border-radius: 4px;
  background: #07c160;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
}

.chat-send-action:disabled {
  background: #b8c2be;
  box-shadow: none;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
}

.tag-list button,
.tag-pill {
  border: 1px solid rgba(91, 141, 239, 0.35);
  border-radius: 999px;
  background: rgba(239, 245, 255, 0.9);
  color: #315d9d;
  padding: 7px 11px;
  font-size: 13px;
  box-shadow: 0 5px 12px rgba(42, 55, 73, 0.08);
}

.tag-list button {
  cursor: pointer;
}

.chat-quick-tags {
  gap: 5px;
  min-height: 0;
  max-height: 34px;
  overflow: hidden;
  padding: 0 2px;
}

.chat-quick-tags button {
  padding: 4px 8px;
  font-size: 11px;
  box-shadow: 0 3px 8px rgba(42, 55, 73, 0.06);
}

.feedback-box {
  margin-top: 12px;
  padding: 12px;
}

.feedback-box p {
  color: #334154;
  line-height: 1.55;
}

.feedback-box.subtle {
  background: #fbfaf5;
}

.shop-grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  gap: 8px;
  min-height: 0;
  padding: 10px 0 22px;
}

.lower-area[data-page="inventory"] .shop-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.lower-area[data-page="inventory"] .item-card {
  grid-template-rows: 82px 19px 22px 18px 24px;
  min-height: 184px;
}

.lower-area[data-page="inventory"] .shop-image-wrap {
  height: 82px;
}

.lower-area[data-page="inventory"] .shop-image {
  width: 76px;
  height: 76px;
}

.shop-page-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  margin: 0 0 8px;
  padding: 9px 10px;
  border: 1px solid rgba(128, 145, 166, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(239, 246, 255, 0.78));
  box-shadow: 0 6px 14px rgba(42, 55, 73, 0.08);
}

.shop-summary-main {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.shop-summary-main strong {
  color: #26364b;
  font-size: 13px;
  line-height: 1.2;
}

.shop-summary-main span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-summary-token {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 44px;
  height: 26px;
  justify-content: center;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 248, 228, 0.92);
  color: #8a5b11;
  font-size: 12px;
  font-weight: 900;
}

.shop-summary-token::before {
  content: "";
  width: 14px;
  height: 14px;
  background: var(--summary-icon) center / contain no-repeat;
}

.shop-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: none;
}

.shop-tabs::-webkit-scrollbar {
  display: none;
}

.shop-tab {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(185, 197, 211, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(42, 55, 73, 0.08);
  backdrop-filter: blur(7px);
}

.shop-tab.active {
  border-color: rgba(85, 168, 120, 0.42);
  background: #eaf3ee;
  color: #2f684a;
  font-weight: 800;
}

.item-card {
  position: relative;
  display: grid;
  grid-template-rows: 70px 18px 22px 18px 23px;
  gap: 3px;
  min-height: 170px;
  padding: 8px 7px 7px;
  border: 1px solid rgba(150, 169, 190, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(239, 246, 255, 0.86));
  color: var(--ink);
  text-align: center;
  box-shadow: 0 6px 16px rgba(42, 55, 73, 0.14);
  cursor: pointer;
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.item-card--recommended {
  border-color: rgba(7, 193, 96, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(232, 247, 237, 0.88));
  box-shadow: 0 8px 18px rgba(47, 104, 74, 0.16);
}

.item-card--recommended::before {
  content: "荐";
  position: absolute;
  left: 6px;
  top: 6px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #07c160;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  z-index: 2;
}

.item-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.98), inset 0 -2px 0 rgba(42, 55, 73, 0.05);
}

.item-card:active {
  transform: translateY(1px);
}

.item-card--using {
  pointer-events: none;
  border-color: rgba(85, 168, 120, 0.52);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(230, 247, 238, 0.92));
  box-shadow: 0 10px 22px rgba(47, 104, 74, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.88);
  animation: item-use-card var(--inventory-use-duration, 2s) ease-in-out both;
}

.item-card--using .shop-image {
  animation: item-use-image 0.82s ease-in-out infinite;
}

.item-card--using .shop-action {
  border-color: rgba(85, 168, 120, 0.32);
  background:
    linear-gradient(180deg, rgba(225, 246, 234, 0.98), rgba(169, 224, 191, 0.94));
  color: #2f684a;
}

.item-card strong {
  align-self: end;
  min-width: 0;
  overflow: hidden;
  color: #24303f;
  font-size: 14px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-image-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 70px;
  border: 1px solid rgba(216, 224, 232, 0.52);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 62%, rgba(217, 155, 43, 0.14), transparent 54%),
    linear-gradient(180deg, rgba(255, 253, 248, 0.84), rgba(237, 246, 255, 0.72));
  overflow: hidden;
}

.shop-image {
  display: block;
  width: 66px;
  height: 66px;
  object-fit: contain;
  filter: drop-shadow(0 5px 7px rgba(42, 55, 73, 0.14));
}

.shop-image-wrap i {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  background: rgba(85, 168, 120, 0.12);
  color: #2f684a;
  font-style: normal;
  font-weight: 900;
}

.item-use-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.item-use-sparkles i {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 210, 91, 0.95);
  box-shadow: 0 0 8px rgba(255, 210, 91, 0.42);
  animation: item-use-sparkle 1s ease-in-out infinite;
}

.item-use-sparkles i:nth-child(1) {
  left: 17%;
  top: 36%;
}

.item-use-sparkles i:nth-child(2) {
  right: 19%;
  top: 22%;
  animation-delay: 0.18s;
}

.item-use-sparkles i:nth-child(3) {
  right: 26%;
  bottom: 21%;
  animation-delay: 0.36s;
}

.inventory-use-layer {
  position: absolute;
  z-index: 24;
  left: var(--use-x, 50%);
  top: var(--use-y, 42%);
  width: var(--inventory-effect-size, 172px);
  height: var(--inventory-effect-size, 172px);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.inventory-use-sprite {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-size: var(--inventory-effect-sheet-width, 172px) var(--inventory-effect-sheet-height, 172px);
  filter: drop-shadow(0 12px 18px rgba(46, 60, 80, 0.12));
  will-change: background-position;
}

.shop-price {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid rgba(217, 155, 43, 0.26);
  border-radius: 999px;
  background: rgba(255, 248, 228, 0.94);
  color: #8a5b11;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.shop-price::before {
  content: "";
  width: 11px;
  height: 11px;
  background: url("./assets/icons/hud/heart.png") center / contain no-repeat;
}

.shop-count {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border: 1px solid rgba(91, 141, 239, 0.22);
  border-radius: 999px;
  background: rgba(239, 245, 255, 0.94);
  color: #315d9d;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.shop-owned {
  position: absolute;
  top: 29px;
  right: 7px;
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(49, 93, 157, 0.9);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.item-effects {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
}

.item-fit {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #637083;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-card--recommended .item-fit {
  color: #2f684a;
}

.effect-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  height: 20px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(216, 224, 232, 0.66);
  color: #315d9d;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.effect-chip img {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  object-fit: contain;
}

.shop-action {
  display: inline-grid;
  place-items: center;
  justify-self: center;
  width: min(72px, 100%);
  min-height: 23px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid rgba(214, 158, 63, 0.3);
  background:
    linear-gradient(180deg, rgba(255, 232, 172, 0.98), rgba(245, 188, 104, 0.96));
  color: #5b3d1f;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 5px 10px rgba(166, 105, 36, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.item-card--locked {
  opacity: 0.68;
  filter: grayscale(0.2);
}

.item-card--locked .shop-action {
  border-color: rgba(128, 145, 166, 0.28);
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.92), rgba(225, 234, 245, 0.9));
  color: #6e7b8d;
}

.inventory-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 148px;
  padding: 20px 12px;
  border: 1px dashed rgba(216, 224, 232, 0.95);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.inventory-empty button {
  min-width: 78px;
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(225, 242, 255, 0.98), rgba(174, 213, 244, 0.96));
  color: #315d9d;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 6px 12px rgba(49, 93, 157, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.page-toast {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  max-width: calc(100% - 48px);
  padding: 9px 13px;
  border: 1px solid rgba(216, 224, 232, 0.72);
  border-radius: 999px;
  background: rgba(36, 48, 63, 0.92);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.page-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 360px) {
  .shop-grid {
    gap: 7px;
  }

  .item-card {
    grid-template-rows: 64px 18px 21px 17px 22px;
    min-height: 158px;
    padding: 7px 6px;
  }

  .shop-image-wrap {
    height: 64px;
  }

  .shop-image {
    width: 60px;
    height: 60px;
  }

  .effect-chip {
    padding: 0 3px;
  }
}

@keyframes loading-breathe {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-3px) scale(1.03);
  }
}

@keyframes chat-highlight {
  0%, 100% {
    transform: translateY(0);
  }
  35% {
    transform: translateY(-2px);
  }
}

.tabs {
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(128, 145, 166, 0.16);
  background: #f3f7ff;
}

.tab {
  min-width: 72px;
  padding: 8px 13px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.tab.active {
  background:
    linear-gradient(180deg, rgba(225, 242, 255, 0.98), rgba(174, 213, 244, 0.96));
  color: #315d9d;
  font-weight: 900;
  box-shadow: 0 5px 12px rgba(49, 93, 157, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.tab-body {
  display: none;
}

.tab-body.active {
  display: block;
}

.change-panel {
  margin-top: 12px;
  padding: 0 4px 6px;
  color: var(--muted);
}

.change-panel-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 11px;
}

.change-list {
  display: grid;
  gap: 1px;
}

.change-empty {
  color: var(--muted);
  font-size: 10px;
  opacity: 0.72;
}

.change-item {
  display: block;
  align-items: baseline;
  padding: 3px 0;
  border-bottom: 1px solid rgba(216, 224, 232, 0.38);
  opacity: 0.78;
}

.change-item:last-child {
  border-bottom: 0;
}

.change-title {
  display: inline;
  margin-right: 4px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.change-deltas {
  display: inline;
  min-width: 0;
}

.change-delta {
  display: inline;
  color: #334154;
  font-size: 10px;
  white-space: nowrap;
}

.change-delta + .change-delta::before {
  content: " · ";
  color: var(--muted);
}

.change-delta.positive {
  color: #2f684a;
}

.change-delta.negative {
  color: #b2473d;
}

.profile-item,
.inventory-item {
  margin-top: 8px;
  padding: 11px 12px;
  line-height: 1.45;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.gallery-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 3px;
  border: 1px solid rgba(128, 145, 166, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 6px 15px rgba(42, 55, 73, 0.06);
}

.gallery-tab {
  min-height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #627084;
  font-size: 13px;
  font-weight: 900;
}

.gallery-tab.active {
  background: #2f684a;
  color: #fff;
  box-shadow: 0 5px 12px rgba(47, 104, 74, 0.18);
}

.gallery-pet-hint {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid rgba(47, 104, 74, 0.16);
  border-radius: 10px;
  background: rgba(247, 255, 250, 0.88);
  color: #4d5c50;
  text-align: left;
  box-shadow: 0 7px 16px rgba(47, 104, 74, 0.08);
}

.gallery-pet-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 21px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(47, 104, 74, 0.12);
  color: #2f684a;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.gallery-pet-hint span:last-child {
  min-width: 0;
  color: #4a554f;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.gallery-pet-hint.pulse {
  animation: gallery-hint-pulse 680ms ease-out;
}

.scene-gallery-section {
  display: grid;
  gap: 8px;
}

.scene-gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 1px;
  color: #26364b;
}

.scene-gallery-head strong {
  font-size: 14px;
}

.scene-gallery-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

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

.scene-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(128, 145, 166, 0.22);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 18px rgba(42, 55, 73, 0.08);
}

.scene-card.active {
  border-color: rgba(64, 145, 104, 0.72);
  box-shadow: 0 9px 20px rgba(64, 145, 104, 0.18);
}

.scene-card.newly-unlocked {
  border-color: rgba(245, 181, 76, 0.95);
  box-shadow: 0 0 0 2px rgba(255, 233, 161, 0.88), 0 12px 28px rgba(188, 121, 34, 0.2);
  animation: scene-card-glow 1.2s ease-in-out 3;
}

.scene-card.locked {
  opacity: 0.62;
  filter: saturate(0.64);
}

.scene-card-image {
  width: 100%;
  aspect-ratio: 8 / 5;
  background-color: #eef3f7;
  background-position: center;
  background-size: cover;
}

.scene-card.locked .scene-card-image {
  filter: saturate(0.9);
}

.scene-card-body {
  display: flex;
  flex-direction: column;
  padding: 8px;
}

.scene-card-body strong {
  display: block;
  overflow: hidden;
  color: #26364b;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-card-body span {
  display: inline-flex;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(225, 242, 255, 0.92);
  color: #315d9d;
  font-size: 10px;
  font-weight: 800;
}

.scene-card.locked .scene-card-body span {
  background: rgba(255, 244, 216, 0.92);
  color: #9a6825;
}

.map-fragment-track {
  display: flex;
  order: 3;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  margin: 2px auto 7px;
  align-items: center;
}

.map-fragment-track.hidden {
  display: none;
}

.map-fragment-track i {
  display: block;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter: saturate(0.92) brightness(0.95);
  transform: rotate(-1deg);
}

.map-fragment-track i:nth-child(even) {
  transform: rotate(1.5deg);
}

.map-fragment-track i.lit {
  filter: saturate(1.04) brightness(1.04);
}

.scene-card-body p {
  display: -webkit-box;
  order: 2;
  min-height: 30px;
  margin: 5px 0 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.scene-card-body p.scene-card-clue {
  min-height: 45px;
  color: #5e594f;
  font-weight: 800;
  -webkit-line-clamp: 3;
}

.scene-card-actions {
  display: flex;
  order: 4;
  justify-content: flex-end;
}

.scene-card-actions.empty {
  display: none;
}

.scene-card-actions button {
  min-width: 58px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: #2f684a;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.scene-card-actions button:disabled {
  background: rgba(128, 145, 166, 0.34);
  color: rgba(72, 84, 101, 0.72);
}

.memory-box-section {
  position: relative;
  display: grid;
  gap: 10px;
  padding-bottom: 10px;
}

.memory-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 0 2px;
}

.memory-box-head strong {
  color: #28415d;
  font-size: 15px;
  font-weight: 900;
}

.memory-box-head span {
  padding: 5px 8px;
  border: 1px solid rgba(228, 181, 97, 0.34);
  border-radius: 999px;
  background: rgba(255, 250, 230, 0.86);
  color: #8b6830;
  font-size: 11px;
  font-weight: 900;
}

.memory-box-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid rgba(228, 181, 97, 0.28);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 253, 241, 0.92), rgba(241, 249, 255, 0.84));
  color: #5a6574;
  text-align: left;
  box-shadow: 0 7px 16px rgba(42, 55, 73, 0.08);
}

button.memory-box-status {
  cursor: pointer;
}

.memory-box-status span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(228, 181, 97, 0.16);
  color: #8a5b11;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.memory-box-status strong {
  min-width: 0;
  overflow: hidden;
  color: #3e4d5f;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.memory-box-card {
  --memory-card-tilt: 0deg;
  position: relative;
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 112px;
  padding: 10px 9px;
  overflow: hidden;
  border: 1px solid rgba(93, 130, 160, 0.18);
  border-radius: 8px;
  background:
    radial-gradient(circle at 94% 12%, rgba(255, 232, 158, 0.42), transparent 24px),
    linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(239, 248, 255, 0.94));
  box-shadow: 0 9px 18px rgba(42, 55, 73, 0.1);
  color: #26364b;
  text-align: left;
  transform: rotate(var(--memory-card-tilt));
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.memory-box-card::after {
  content: "";
  position: absolute;
  inset: auto 10px 8px 10px;
  height: 1px;
  background: repeating-linear-gradient(90deg, rgba(94, 117, 144, 0.28) 0 6px, transparent 6px 11px);
}

.memory-box-card.active,
.memory-box-card:focus-visible {
  border-color: rgba(47, 104, 74, 0.42);
  box-shadow: 0 12px 24px rgba(31, 76, 57, 0.15);
  transform: translateY(-1px) rotate(0deg);
}

.memory-box-card.recent {
  border-color: rgba(228, 181, 97, 0.5);
  box-shadow: 0 10px 22px rgba(143, 96, 36, 0.14);
}

.memory-box-card.locked {
  opacity: 0.68;
  filter: saturate(0.66);
}

.memory-token {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border: 1px solid rgba(97, 135, 160, 0.14);
  border-radius: 8px;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 244, 196, 0.98), rgba(247, 204, 116, 0.8)),
    #f8df9a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86), 0 6px 12px rgba(66, 90, 115, 0.12);
  color: #7b5523;
  font-size: 12px;
  font-weight: 900;
}

.memory-token.has-image {
  overflow: hidden;
  border-radius: 8px;
  background:
    radial-gradient(circle at 45% 35%, rgba(255, 255, 255, 0.96), rgba(231, 240, 247, 0.78));
  color: transparent;
}

.memory-token.has-image img {
  display: block;
  width: 92%;
  height: 92%;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(48, 62, 82, 0.18));
}

.memory-box-card.locked .memory-token {
  background: rgba(220, 228, 237, 0.92);
  color: rgba(82, 94, 111, 0.64);
}

.memory-box-empty {
  grid-column: 1 / -1;
  padding: 18px 14px;
  border: 1px dashed rgba(95, 124, 154, 0.3);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(245, 250, 255, 0.78));
  color: #586879;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
  text-align: center;
}

.memory-box-body {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.memory-box-body strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memory-box-body em {
  color: #6b7890;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.memory-box-story {
  display: -webkit-box;
  overflow: hidden;
  color: #677180;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.34;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.memory-box-modal {
  position: fixed;
  z-index: 155;
  left: 50%;
  top: var(--viewport-offset-top);
  display: grid;
  place-items: center;
  width: min(480px, 100vw);
  height: var(--app-height);
  padding: max(66px, calc(env(safe-area-inset-top) + 58px)) 16px max(18px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 235, 171, 0.22), transparent 34%),
    rgba(23, 28, 38, 0.42);
  backdrop-filter: blur(8px);
  transform: translateX(-50%);
}

.memory-box-detail {
  position: relative;
  display: grid;
  gap: 10px;
  width: min(348px, calc(100vw - 32px));
  max-height: calc(var(--app-height) - 94px);
  padding: 12px;
  overflow-y: auto;
  border: 1px solid rgba(255, 241, 203, 0.78);
  border-radius: 16px;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 230, 151, 0.54), transparent 34%),
    linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(236, 248, 255, 0.96)),
    rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 58px rgba(22, 31, 44, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  animation: memory-box-modal-pop 0.24s ease-out both;
}

.memory-box-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.memory-box-detail-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.memory-box-detail-title em {
  color: #7a6b4c;
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
}

.memory-box-detail-close {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(38, 54, 75, 0.1);
  color: #34445a;
  font-size: 12px;
  font-weight: 900;
}

.memory-box-media {
  position: relative;
  overflow: hidden;
  width: min(100%, 300px);
  margin: 0 auto 2px;
  border: 4px solid rgba(255, 255, 255, 0.88);
  border-radius: 12px;
  background: rgba(22, 32, 44, 0.92);
  box-shadow: 0 12px 24px rgba(18, 32, 44, 0.18);
}

.memory-box-media video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 48vh;
  object-fit: contain;
}

.memory-box-loading {
  position: absolute;
  left: 50%;
  bottom: 10px;
  z-index: 2;
  display: none;
  align-items: center;
  max-width: calc(100% - 20px);
  min-height: 30px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.44);
  border-radius: 999px;
  background: rgba(24, 34, 48, 0.68);
  color: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  pointer-events: none;
  text-align: center;
  box-shadow: 0 8px 18px rgba(18, 32, 44, 0.2);
  transform: translateX(-50%);
}

.memory-box-loading::before {
  content: "";
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  margin-right: 6px;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-top-color: rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  animation: memoryVideoSpin 0.9s linear infinite;
}

.memory-box-media.is-loading .memory-box-loading {
  display: flex;
}

.memory-box-media.is-error .memory-box-loading::before {
  display: none;
}

@keyframes memoryVideoSpin {
  to {
    transform: rotate(360deg);
  }
}

.memory-box-detail strong {
  color: #26364b;
  font-size: 15px;
}

.memory-box-detail p {
  margin: 0;
  color: #425061;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.memory-box-detail span {
  color: #6a7a8d;
  font-size: 10px;
  font-weight: 800;
}

@keyframes memory-box-modal-pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.gallery-card,
.unlock-card {
  min-height: 96px;
  padding: 10px;
  border: 1px solid rgba(128, 145, 166, 0.2);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 251, 255, 0.86));
  box-shadow: 0 7px 16px rgba(42, 55, 73, 0.07);
}

.gallery-card.locked,
.unlock-card.locked {
  opacity: 0.68;
  filter: saturate(0.72);
}

.gallery-card strong,
.unlock-card strong {
  display: block;
  overflow: hidden;
  color: #26364b;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-card p,
.unlock-card p {
  display: -webkit-box;
  margin: 5px 0 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.gallery-card span,
.unlock-card span {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(225, 242, 255, 0.92);
  color: #315d9d;
  font-size: 10px;
  font-weight: 800;
}

.unlock-card span {
  background: rgba(255, 244, 216, 0.92);
  color: #9a6825;
}

.pwa-card {
  margin-top: 8px;
  padding: 12px;
  border: 1px solid rgba(128, 145, 166, 0.2);
  border-radius: 10px;
  background: #ffffff;
  line-height: 1.45;
  box-shadow: 0 7px 16px rgba(42, 55, 73, 0.08);
}

.account-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  grid-template-areas:
    "avatar info"
    "actions actions";
  gap: 10px;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid rgba(128, 145, 166, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 7px 16px rgba(42, 55, 73, 0.08);
}

.account-avatar-preview {
  grid-area: avatar;
}

.account-avatar-preview .chat-avatar {
  width: 58px;
  height: 58px;
  border-radius: 12px;
  font-size: 22px;
}

.account-info {
  grid-area: info;
  align-self: center;
  min-width: 0;
}

.account-info strong {
  display: block;
  color: #24303f;
  font-size: 16px;
}

.account-info p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.account-avatar-actions {
  grid-area: actions;
  display: flex;
  gap: 8px;
}

.account-avatar-button {
  flex: 1;
  min-height: 34px;
  border: 1px solid rgba(185, 197, 211, 0.56);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: #536071;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 5px 12px rgba(42, 55, 73, 0.08);
}

.account-avatar-button.primary {
  border-color: rgba(7, 193, 96, 0.24);
  background: rgba(224, 245, 225, 0.92);
  color: #255f36;
}

.account-avatar-button:disabled {
  opacity: 0.48;
}

.system-panel {
  padding: 12px;
}

.system-panel .tab-body {
  max-height: calc(var(--app-height) - 156px);
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: none;
}

.system-panel .tab-body::-webkit-scrollbar {
  display: none;
}

.profile-item {
  position: relative;
  padding: 12px 12px 12px 40px;
  border-color: rgba(128, 145, 166, 0.22);
  border-radius: 10px;
  background:
    linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 7px 16px rgba(42, 55, 73, 0.07);
}

.profile-section-title {
  margin: 10px 2px 4px;
  color: rgba(51, 65, 85, 0.74);
  font-size: 12px;
  font-weight: 900;
}

.profile-item.pending {
  border-style: dashed;
  background: rgba(255, 252, 240, 0.9);
}

.profile-item::before {
  position: absolute;
  left: 12px;
  top: 13px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: #eaf3ee;
  color: #2f684a;
  content: "";
  box-shadow: inset 0 0 0 5px rgba(85, 168, 120, 0.18);
}

.profile-item strong,
.inventory-item strong,
.pwa-card strong {
  display: block;
  margin-bottom: 4px;
}

.profile-item p,
.inventory-item p,
.pwa-card p {
  color: var(--muted);
  font-size: 13px;
}

.profile-item span {
  display: inline-flex;
  margin-top: 7px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(239, 245, 255, 0.9);
  color: #315d9d;
  font-size: 11px;
  font-weight: 800;
}

.system-empty {
  padding: 18px 12px;
  border: 1px dashed rgba(128, 145, 166, 0.42);
  border-radius: 10px;
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.system-empty.compact {
  padding: 10px 12px;
  font-size: 12px;
}

.pwa-install-button {
  height: 40px;
  margin-top: 10px;
}

pre {
  overflow: auto;
  max-height: 420px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #1f2933;
  color: #f4f7fb;
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 12px;
}

@keyframes sprite-loop {
  from { background-position-x: 0; }
  to { background-position-x: calc(var(--sprite-distance, 1536px) * -1); }
}

@keyframes sprite-pop {
  0%, 100% { transform: translateX(-50%) scale(1.05); }
  45% { transform: translateX(-50%) translateY(-10px) scale(1.08); }
}

@keyframes scene-unlock-pop {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.94);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes scene-unlock-pulse {
  0% {
    opacity: 0.2;
    transform: translate(-50%, -50%) scale(0.62);
  }

  42% {
    opacity: 0.88;
    transform: translate(-50%, -50%) scale(1);
  }

  100% {
    opacity: 0.28;
    transform: translate(-50%, -50%) scale(1.18);
  }
}

@keyframes scene-unlock-ring {
  0%, 100% {
    opacity: 0.54;
    transform: translate(-50%, -50%) scale(0.96) rotate(0deg);
  }

  50% {
    opacity: 0.95;
    transform: translate(-50%, -50%) scale(1.04) rotate(8deg);
  }
}

@keyframes scene-unlock-sweep {
  0%, 18% {
    opacity: 0;
    transform: translate(-88%, -50%) rotate(-12deg);
  }

  44% {
    opacity: 0.86;
  }

  72%, 100% {
    opacity: 0;
    transform: translate(-12%, -50%) rotate(-12deg);
  }
}

@keyframes scene-unlock-preview-shine {
  0%, 24% {
    opacity: 0;
    transform: translateX(-55%);
  }

  50% {
    opacity: 1;
  }

  82%, 100% {
    opacity: 0;
    transform: translateX(55%);
  }
}

@keyframes scene-card-glow {
  0%, 100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-2px);
  }
}

@keyframes gallery-hint-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(47, 104, 74, 0.24), 0 7px 16px rgba(47, 104, 74, 0.08);
  }

  100% {
    box-shadow: 0 0 0 8px rgba(47, 104, 74, 0), 0 7px 16px rgba(47, 104, 74, 0.08);
  }
}

@keyframes float-rise {
  0% {
    opacity: 0;
    transform: translate(-50%, 18px) scale(0.96);
  }
  14% {
    opacity: 1;
    transform: translate(-50%, 5px) scale(1);
  }
  68% {
    opacity: 1;
    transform: translate(-50%, -34px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -76px) scale(0.98);
  }
}

@keyframes item-use-card {
  0% {
    transform: translateY(0) scale(1);
  }
  18% {
    transform: translateY(-2px) scale(1.015);
  }
  82% {
    transform: translateY(-2px) scale(1.015);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes item-use-image {
  0%, 100% {
    transform: translateY(0) scale(1);
    filter: drop-shadow(0 5px 7px rgba(42, 55, 73, 0.14));
  }
  45% {
    transform: translateY(-5px) scale(1.06);
    filter: drop-shadow(0 9px 12px rgba(47, 104, 74, 0.2));
  }
}

@keyframes item-use-sparkle {
  0%, 100% {
    opacity: 0;
    transform: translateY(7px) scale(0.7);
  }
  42% {
    opacity: 1;
    transform: translateY(-2px) scale(1);
  }
}

@keyframes inventory-page-glow {
  0%, 100% {
    opacity: 0;
  }
  18%, 76% {
    opacity: 1;
  }
}

@keyframes hud-name-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, 6px) scale(0.96);
  }
  18% {
    opacity: 1;
  }
  78% {
    opacity: 1;
    transform: translate(-50%, -4px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -12px) scale(1);
  }
}

@keyframes voice-pulse {
  0%, 100% {
    box-shadow: 0 8px 18px rgba(42, 55, 73, 0.08);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 8px 22px rgba(178, 71, 61, 0.2);
    transform: scale(1.03);
  }
}

@media (max-width: 390px) {
  .form-row {
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }
}
