/* Noto Sans Symbols subset; original copyright and OFL are retained in assets/fonts. */
@font-face {
  font-family: "CottonMusicSymbols";
  src: url("./assets/fonts/CottonMusicSymbols.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
  unicode-range: U+266A-266B;
}

@font-face {
  font-family: "YuzuPop";
  src: url("./assets/fonts/YuzuPop.ttf") format("truetype");
  font-display: swap;
  font-weight: 100 900;
}

:root {
  color-scheme: light;
  --ink: #263d37;
  --muted: #72847b;
  --paper: #fbfcf7;
  --canvas: #edf0e7;
  --line: #d9e0d5;
  --green: #8ea293;
  --green-dark: #506b5c;
  --green-pale: #e2e9df;
  --pink: #ecd7dc;
  --pink-strong: #c58f9f;
  --yellow: #f4e8bc;
  --shadow: 0 24px 70px rgb(48 65 56 / 12%);
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 7% 18%, rgb(255 255 255 / 75%) 0 2px, transparent 3px),
    radial-gradient(circle at 91% 8%, rgb(255 255 255 / 60%) 0 3px, transparent 4px),
    linear-gradient(135deg, #f5f3ec, #e9eee5 55%, #f4edef);
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgb(70 91 79 / 3%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(70 91 79 / 3%) 1px, transparent 1px);
  background-size: 38px 38px;
  content: "";
  mask-image: linear-gradient(to bottom, black, transparent 65%);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgb(91 124 105 / 30%);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.app-frame {
  width: min(100%, 1480px);
  min-height: 100vh;
  margin: auto;
  padding: 0 26px 24px;
}

.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 76px;
  border-bottom: 1px solid rgb(100 119 105 / 13%);
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-self: start;
  padding: 7px 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  place-items: center;
}

.brand-mark svg {
  width: 22px;
  stroke: currentColor;
}

.brand b,
.brand small {
  display: block;
}

.brand b {
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.brand small {
  margin-top: -2px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 3px;
}

.site-header nav {
  display: flex;
  gap: 5px;
  padding: 5px;
  border: 1px solid rgb(101 119 107 / 12%);
  border-radius: 999px;
  background: rgb(255 255 255 / 43%);
}

.nav-button {
  min-height: 35px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.nav-button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 4px 15px rgb(52 74 62 / 9%);
}

.nav-button span {
  margin-left: 5px;
  padding: 2px 5px;
  border-radius: 5px;
  color: #9b9f9a;
  background: #f0f1ed;
  font-size: 8px;
}

.header-actions {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-self: end;
}

.save-state {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 10px;
}

.save-state i,
.editor-status i,
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #91b39e;
  box-shadow: 0 0 0 4px rgb(145 179 158 / 14%);
}

.save-state i.pending {
  background: #d4b36d;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgb(255 255 255 / 65%);
  cursor: pointer;
  place-items: center;
}

.icon-button svg {
  width: 18px;
}

.icon-button.compact {
  width: 32px;
  height: 32px;
  border-color: rgb(98 116 104 / 14%);
  border-radius: 9px;
}

.icon-button:disabled {
  opacity: 0.32;
  cursor: default;
}

main {
  min-height: calc(100vh - 100px);
}

/*
 * Electron owns the desktop viewport. Keep document-level scrollbars out of
 * the native window; individual work areas remain responsible for scrolling.
 */
html.desktop-shell,
html.desktop-shell body {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

html.desktop-shell .app-frame {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding-bottom: 0;
  overflow: hidden;
}

html.desktop-shell .site-header {
  flex: 0 0 auto;
}

html.desktop-shell main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

html.desktop-shell body[data-route="pet"] main {
  overflow: hidden;
}

html.desktop-shell body[data-route="pet"] .pet-view:not([hidden]) {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 16px 0;
}

html.desktop-shell body[data-route="pet"] .pet-view > .mode-header {
  flex: 0 0 auto;
}

html.desktop-shell body[data-route="pet"] .pet-layout {
  flex: 1 1 auto;
  min-height: 0;
}

html.desktop-shell body[data-route="pet"] .pet-room {
  min-height: 0;
}

.home-view {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(330px, 1.1fr) minmax(230px, 0.72fr);
  gap: clamp(24px, 3vw, 54px);
  align-items: center;
  min-height: calc(100vh - 100px);
  padding: 32px clamp(8px, 2.4vw, 35px) 28px;
}

.home-copy {
  align-self: center;
  padding-left: clamp(0px, 2vw, 24px);
}

.eyebrow {
  margin: 0 0 20px;
  color: var(--green-dark);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2.3px;
}

.home-copy h1 {
  margin: 0;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: clamp(46px, 4.6vw, 60px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -2.6px;
}

.home-copy h1 em {
  position: relative;
  color: #687f70;
  font-style: normal;
  white-space: nowrap;
}

.home-copy h1 em::after {
  position: absolute;
  right: 2px;
  bottom: 0;
  left: 2px;
  height: 7px;
  border-radius: 50%;
  background: var(--pink);
  content: "";
  opacity: 0.65;
  z-index: -1;
}

.intro {
  max-width: 390px;
  margin: 24px 0 30px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.9;
}

.home-actions {
  display: flex;
  gap: 10px;
  max-width: 410px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  border-radius: 13px;
  cursor: pointer;
}

.primary-button {
  display: flex;
  flex: 1.2;
  gap: 12px;
  align-items: center;
  justify-content: center;
  border: 0;
  color: #fff;
  background: var(--green-dark);
  box-shadow: 0 9px 24px rgb(60 91 74 / 18%);
  font-size: 13px;
  font-weight: 650;
}

.primary-button svg {
  width: 19px;
}

.secondary-button {
  flex: 1;
  border: 1px solid var(--line);
  background: rgb(255 255 255 / 65%);
  font-size: 12px;
}

.home-meta {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-top: 27px;
  color: var(--muted);
  font-size: 9px;
}

.home-meta b {
  color: var(--ink);
  font-size: 14px;
}

.home-meta span:last-child {
  display: flex;
  gap: 6px;
  align-items: center;
}

.home-meta i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8eac96;
}

.home-stage-wrap {
  position: relative;
  display: grid;
  min-height: min(690px, calc(100vh - 140px));
  place-items: center;
}

.home-stage {
  position: relative;
  width: min(100%, 510px);
  height: min(650px, calc(100vh - 145px));
  min-height: 500px;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 70%);
  border-radius: 46% 46% 30px 30px;
  background:
    radial-gradient(circle at 20% 20%, rgb(255 255 255 / 85%) 0 3px, transparent 4px),
    radial-gradient(circle at 78% 35%, rgb(255 255 255 / 80%) 0 2px, transparent 3px),
    linear-gradient(155deg, #f8f6ef, #e6ede2 65%, #d9e5dc);
  box-shadow: var(--shadow), inset 0 0 0 12px rgb(255 255 255 / 22%);
}

.home-stage::before,
.home-stage::after {
  position: absolute;
  border: 1px solid rgb(105 135 114 / 12%);
  border-radius: 50%;
  content: "";
}

.home-stage::before {
  width: 72%;
  aspect-ratio: 1;
  top: 18%;
  left: 14%;
}

.home-stage::after {
  width: 50%;
  aspect-ratio: 1;
  top: 27%;
  left: 25%;
}

.stage-label {
  position: absolute;
  top: 34px;
  left: 50%;
  z-index: 3;
  color: #829086;
  font-size: 8px;
  letter-spacing: 3px;
  transform: translateX(-50%);
}

#homeCanvas {
  position: absolute;
  right: 9%;
  bottom: -5%;
  left: 9%;
  z-index: 2;
  width: 82%;
  height: 92%;
  object-fit: contain;
}

.spark {
  position: absolute;
  color: #c3aa68;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  z-index: 1;
}

.spark-a {
  top: 24%;
  left: 16%;
  font-size: 18px;
}

.spark-b {
  top: 37%;
  right: 13%;
  font-size: 12px;
}

.spark-c {
  top: 16%;
  right: 24%;
  font-size: 35px;
}

.hanger-button {
  position: absolute;
  bottom: 22px;
  left: 50%;
  z-index: 4;
  display: grid;
  width: 42px;
  height: 42px;
  border: 1px solid rgb(107 132 113 / 18%);
  border-radius: 50%;
  color: #71867a;
  background: rgb(255 255 255 / 75%);
  box-shadow: 0 8px 20px rgb(62 83 70 / 8%);
  cursor: pointer;
  transform: translateX(-50%);
  place-items: center;
}

.hanger-button svg {
  width: 24px;
}

.stage-caption {
  position: absolute;
  right: 22px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: var(--muted);
  font-size: 8px;
}

.stage-caption b {
  margin-top: 3px;
  color: var(--ink);
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 13px;
  font-weight: 400;
}

.home-tools {
  display: grid;
  gap: 11px;
  align-self: center;
}

.tool-card {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 78px;
  padding: 14px;
  border: 1px solid rgb(98 117 104 / 12%);
  border-radius: 16px;
  color: var(--ink);
  background: rgb(255 255 255 / 56%);
  text-align: left;
  cursor: pointer;
}

.tool-card.tool-editor {
  background: rgb(255 255 255 / 82%);
  box-shadow: 0 13px 35px rgb(64 82 71 / 7%);
}

.tool-card:disabled {
  color: var(--ink);
  cursor: default;
  opacity: 0.73;
}

.tool-card > span:nth-child(2) {
  min-width: 0;
}

.tool-card b,
.tool-card small {
  display: block;
}

.tool-card b {
  font-size: 12px;
  font-weight: 650;
}

.tool-card small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.tool-card > i {
  color: #819087;
  font-size: 9px;
  font-style: normal;
}

.tool-icon {
  display: grid;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: #678271;
  background: var(--green-pale);
  place-items: center;
}

.tool-icon.warm {
  color: #9a7e69;
  background: #f2e7d9;
}

.tool-icon.lilac {
  color: #807492;
  background: #e9e2ee;
}

.tool-icon svg {
  width: 22px;
}

.home-footer {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  padding-top: 3px;
  border-top: 1px solid rgb(101 119 107 / 10%);
  color: #86938b;
  font-size: 9px;
}

.editor-view {
  min-height: calc(100vh - 76px);
  padding: 18px 0 0;
}

.editor-header {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 17px;
  align-items: center;
  max-width: 1270px;
  margin: 0 auto 14px;
  padding: 0 6px;
}

.back-button {
  display: grid;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgb(255 255 255 / 60%);
  cursor: pointer;
  place-items: center;
}

.back-button svg {
  width: 20px;
}

.editor-title {
  position: relative;
  display: flex;
  gap: 11px;
  align-items: baseline;
  min-width: 0;
}

.editor-title.feedback-active > p,
.editor-title.feedback-active > h2 {
  visibility: hidden;
}

.editor-title p {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 1.8px;
}

.editor-title h2 {
  margin: 0;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 19px;
  font-weight: 400;
}

.editor-status {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 9px;
}

.editor-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.text-button,
.done-button {
  min-height: 36px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 10px;
}

.text-button {
  padding: 0 10px;
  border: 0;
  color: var(--muted);
  background: transparent;
}

.done-button {
  min-width: 72px;
  margin-left: 5px;
  border: 1px solid var(--green-dark);
  color: #fff;
  background: var(--green-dark);
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(390px, 0.88fr) minmax(500px, 1.12fr);
  max-width: 1270px;
  height: calc(100vh - 145px);
  min-height: 600px;
  margin: auto;
  overflow: hidden;
  border: 1px solid rgb(104 121 108 / 13%);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.preview-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  padding: 16px;
  border-right: 1px solid var(--line);
  background: #f4f5ef;
}

.preview-toolbar,
.preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 39px;
}

.preview-toolbar > div:first-child {
  display: flex;
  gap: 9px;
  align-items: center;
  font-size: 10px;
}

.preview-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.panel-command-bar {
  display: flex;
  min-height: 43px;
  padding: 0 22px;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e7e6de;
  background: #fffdf9;
}

.panel-selection {
  display: flex;
  min-width: 0;
  gap: 7px;
  align-items: baseline;
}

.panel-selection small {
  flex: none;
  color: #9aa59d;
  font-size: 8px;
}

.panel-selection b {
  overflow: hidden;
  color: #61766a;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-command-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.history-group {
  display: flex;
  gap: 5px;
}

.layer-quick-button {
  display: flex;
  gap: 5px;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #dfe5dc;
  border-radius: 10px;
  color: #65786d;
  background: rgb(255 255 255 / 72%);
  font-size: 9px;
  cursor: pointer;
}

.layer-quick-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.layer-quick-button b {
  min-width: 16px;
  padding: 1px 4px;
  border-radius: 999px;
  color: #fff;
  background: #84988a;
  font-size: 7px;
  font-weight: 600;
  text-align: center;
}

.layer-quick-button:hover,
.layer-quick-button.active {
  border-color: #9bada0;
  color: #41594b;
  background: #fff;
}

.character-stage {
  --stage-top: #f9f8f1;
  --stage-bottom: #e4ece4;
  --stage-accent: #b6c5b5;
  position: relative;
  overflow: hidden;
  border-radius: 150px 150px 18px 18px;
  background:
    radial-gradient(circle at 22% 20%, rgb(255 255 255 / 80%) 0 3px, transparent 4px),
    radial-gradient(circle at 76% 32%, rgb(255 255 255 / 65%) 0 2px, transparent 3px),
    linear-gradient(160deg, var(--stage-top), var(--stage-bottom));
}

.character-stage::before {
  position: absolute;
  width: 69%;
  aspect-ratio: 1;
  top: 16%;
  left: 15%;
  border: 1px solid color-mix(in srgb, var(--stage-accent), transparent 55%);
  border-radius: 50%;
  content: "";
}

#editorCanvas {
  position: absolute;
  right: 8%;
  bottom: -8%;
  left: 8%;
  z-index: 1;
  width: 84%;
  height: 105%;
  cursor: grab;
  object-fit: contain;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
}

#editorCanvas:focus-visible {
  outline: 3px solid rgb(80 107 92 / 36%);
  outline-offset: -5px;
  border-radius: 18px;
}

.character-stage.dragging #editorCanvas {
  cursor: grabbing;
}

.canvas-candidates {
  position: absolute;
  right: 10px;
  bottom: 34px;
  left: 10px;
  z-index: 3;
  display: grid;
  gap: 6px;
  padding: 8px;
  overflow: hidden;
  border: 1px solid rgb(75 98 84 / 14%);
  border-radius: 15px;
  background: rgb(255 255 255 / 88%);
  box-shadow: 0 9px 24px rgb(56 76 64 / 13%);
  backdrop-filter: blur(10px);
}

.canvas-candidates[hidden] {
  display: none;
}

.canvas-candidate-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 3px;
  color: #53675b;
}

.canvas-candidate-heading span {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.canvas-candidate-heading small {
  color: #89978e;
  font-size: 7px;
}

.canvas-candidate-list {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  touch-action: pan-x;
}

.canvas-candidate-list::-webkit-scrollbar {
  display: none;
}

.canvas-candidate {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 36px;
  padding: 0 11px 0 7px;
  border: 1px solid rgb(102 126 110 / 18%);
  border-radius: 999px;
  color: #53675b;
  background: #f7faf7;
  font: inherit;
  cursor: pointer;
}

.canvas-candidate span {
  display: grid;
  width: 25px;
  height: 25px;
  margin-right: 6px;
  place-items: center;
  border-radius: 50%;
  color: #7c8e82;
  background: #e8efe9;
  font-size: 7px;
  font-weight: 700;
}

.canvas-candidate b {
  max-width: 105px;
  overflow: hidden;
  font-size: 8px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-candidate.active {
  border-color: #627d6c;
  color: #fff;
  background: #627d6c;
}

.canvas-candidate.active span {
  color: #53675b;
  background: #fff;
}

.canvas-candidate:focus-visible {
  outline: 2px solid #405d4b;
  outline-offset: 2px;
}

.character-stage.dragging .canvas-candidates,
.character-stage.pinching .canvas-candidates {
  pointer-events: none;
}

.canvas-interaction-hint {
  position: absolute;
  right: 12px;
  bottom: 10px;
  left: 12px;
  z-index: 2;
  width: fit-content;
  max-width: calc(100% - 24px);
  margin: auto;
  padding: 5px 9px;
  overflow: hidden;
  border: 1px solid rgb(113 135 120 / 13%);
  border-radius: 999px;
  color: #7b8d81;
  background: rgb(255 255 255 / 62%);
  box-shadow: 0 4px 14px rgb(56 76 64 / 5%);
  font-size: 7px;
  letter-spacing: 0.2px;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.touch-feedback {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 4px 5px 4px 9px;
  border: 1px solid rgb(75 98 84 / 16%);
  border-radius: 12px;
  color: #4e6257;
  background: rgb(255 255 255 / 92%);
  box-shadow: 0 5px 16px rgb(56 76 64 / 12%);
  backdrop-filter: blur(12px);
  pointer-events: none;
  transform: translateY(-50%);
  animation: touch-feedback-in 160ms ease-out;
}

.touch-feedback-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #869b8d;
  box-shadow: 0 0 0 4px rgb(134 155 141 / 14%);
}

.touch-feedback-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.15;
}

.touch-feedback-copy b {
  overflow: hidden;
  font-size: 9px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.touch-feedback-copy small {
  margin-top: 2px;
  overflow: hidden;
  color: #829188;
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.touch-feedback button {
  min-width: 44px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid rgb(81 105 90 / 18%);
  border-radius: 9px;
  color: #536b5d;
  background: #f5f8f3;
  font-size: 8px;
  font-weight: 650;
  cursor: pointer;
  pointer-events: auto;
}

.touch-feedback button:active {
  transform: translateY(1px);
}

#touchFeedbackCancel {
  color: #866c72;
  border-color: rgb(145 109 119 / 18%);
  background: #fff6f7;
}

#touchFeedbackUndo {
  color: #fff;
  border-color: #59755f;
  background: #59755f;
}

.touch-feedback[data-state="longpress"] .touch-feedback-dot {
  background: #b48b56;
  box-shadow: 0 0 0 4px rgb(180 139 86 / 15%);
  animation: touch-feedback-pulse 900ms ease-in-out infinite;
}

.touch-feedback[data-state="drag"] .touch-feedback-dot {
  background: #5d8798;
  box-shadow: 0 0 0 4px rgb(93 135 152 / 15%);
  animation: touch-feedback-pulse 900ms ease-in-out infinite;
}

.touch-feedback[data-state="selection"] .touch-feedback-dot {
  background: #5f8b78;
  box-shadow: 0 0 0 4px rgb(95 139 120 / 14%);
}

.touch-feedback[data-state="navigation"] .touch-feedback-dot {
  background: #567f92;
  box-shadow: 0 0 0 4px rgb(86 127 146 / 14%);
}

.touch-feedback[data-state="panel"] {
  background: rgb(248 251 253 / 94%);
}

.touch-feedback[data-state="panel"] .touch-feedback-dot {
  background: #72899a;
  box-shadow: 0 0 0 4px rgb(114 137 154 / 14%);
}

.touch-feedback[data-state="color"] {
  border-color: rgb(160 116 143 / 19%);
  background: rgb(255 249 253 / 93%);
}

.touch-feedback[data-state="color"] .touch-feedback-dot {
  background: #a87896;
  box-shadow: 0 0 0 4px rgb(168 120 150 / 14%);
}

.touch-feedback[data-state="transform"] .touch-feedback-dot {
  background: #5d8798;
  box-shadow: 0 0 0 4px rgb(93 135 152 / 14%);
}

.touch-feedback[data-state="layer"] {
  border-color: rgb(146 120 95 / 20%);
  background: rgb(255 252 247 / 93%);
}

.touch-feedback[data-state="layer"] .touch-feedback-dot {
  background: #92785f;
  box-shadow: 0 0 0 4px rgb(146 120 95 / 14%);
}

.touch-feedback[data-state="pinch"] .touch-feedback-dot {
  background: #8578aa;
  box-shadow: 0 0 0 4px rgb(133 120 170 / 15%);
  animation: touch-feedback-pulse 900ms ease-in-out infinite;
}

.touch-feedback[data-state="scroll"] {
  color: #66727f;
  background: rgb(248 249 250 / 92%);
}

.touch-feedback[data-state="success"] {
  border-color: rgb(77 116 90 / 24%);
  background: rgb(244 250 244 / 94%);
}

.touch-feedback[data-state="success"] .touch-feedback-dot {
  background: #5e8b69;
  box-shadow: 0 0 0 4px rgb(94 139 105 / 14%);
}

.touch-feedback[data-state="canceled"] {
  border-color: rgb(151 108 116 / 20%);
  background: rgb(255 248 248 / 94%);
}

.touch-feedback[data-state="canceled"] .touch-feedback-dot {
  background: #a97780;
  box-shadow: 0 0 0 4px rgb(169 119 128 / 14%);
}

@keyframes touch-feedback-in {
  from {
    opacity: 0;
  }
}

@keyframes touch-feedback-pulse {
  50% {
    transform: scale(1.25);
  }
}

.loading-copy {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  color: #7c8b82;
  font-size: 11px;
  letter-spacing: 1.4px;
  transform: translate(-50%, -50%);
}

html[data-startup-loading] .app-frame {
  visibility: hidden;
}

#startupLoader {
  position: fixed;
  inset: 0;
  z-index: 2147483600;
  display: grid;
  place-items: center;
  background: #f6f5ef;
  color: #61736c;
  font: 14px "YuzuPop", "Microsoft YaHei", sans-serif;
  transition: opacity 180ms ease;
}

#startupLoader[hidden] {
  display: none !important;
}

#startupLoader.leaving {
  opacity: 0;
  pointer-events: none;
}

.startup-content {
  width: min(240px, calc(100vw - 80px));
}

.startup-content h1 {
  margin: 0 0 30px;
  font-size: 32px;
  font-weight: 400;
  letter-spacing: 3px;
  text-align: center;
}

.startup-meta {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 10px;
  color: #82958a;
  font-size: 12px;
}

#startupPercent {
  font: 12px sans-serif;
}

#startupProgress {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 18px;
  height: 56px;
  margin-top: 16px;
}

.startup-symbol {
  position: relative;
  display: block;
  color: #dde1d9;
  font: 43px/1 sans-serif;
}

.startup-symbol::after {
  position: absolute;
  inset: 0;
  color: #d8b7c6;
  content: attr(data-symbol);
  clip-path: inset(0 calc(100% - var(--fill, 0%)) 0 0);
  transition: clip-path 160ms ease-out;
}

#startupRetry {
  display: block;
  min-height: 40px;
  margin: 20px auto 0;
  padding: 9px 16px;
  border: 0;
  border-radius: 12px;
  background: #ecefe5;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

#startupRetry[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  #startupLoader,
  .startup-symbol::after {
    transition: none;
  }
}

.preview-footer {
  gap: 12px;
  padding-top: 12px;
}

.selected-summary {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.selected-summary span {
  color: var(--muted);
  font-size: 8px;
}

.selected-summary b {
  margin-top: 2px;
  overflow: hidden;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.background-control {
  display: grid;
  gap: 5px;
  justify-items: end;
  min-width: 0;
}

.background-control > span {
  max-width: 220px;
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.background-picker {
  display: flex;
  gap: 6px;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  touch-action: pan-x;
}

.background-picker::-webkit-scrollbar {
  display: none;
}

.background-dot {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--top), var(--bottom));
  box-shadow: 0 0 0 1px #d1d9d1;
  cursor: pointer;
}

.background-dot.active {
  box-shadow: 0 0 0 2px var(--green-dark);
}

.tool-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  background: #fffdf9;
  overscroll-behavior: contain;
}

.panel-scroll {
  min-height: 0;
  padding: 17px 22px 26px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-color: #bcc9be transparent;
  scrollbar-width: thin;
  touch-action: pan-y;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 3px;
  padding: 4px;
  border: 1px solid #e7e6de;
  border-radius: 12px;
  background: #f5f4ef;
}

.tabs button {
  min-height: 35px;
  border: 0;
  border-radius: 9px;
  color: #7b877f;
  background: transparent;
  font-size: 11px;
  cursor: pointer;
}

.tabs button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 3px 12px rgb(56 70 62 / 8%);
}

.category-row {
  display: flex;
  gap: 7px;
  padding: 14px 0 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  touch-action: pan-x;
}

.category-row::-webkit-scrollbar {
  display: none;
}

.category-row button {
  position: relative;
  flex: none;
  min-height: 31px;
  padding: 0 12px;
  border: 1px solid #dfe3db;
  border-radius: 999px;
  color: #6f7e75;
  background: #fff;
  font-size: 10px;
  cursor: pointer;
}

.category-row button.active {
  border-color: #9aad9e;
  color: #fff;
  background: #879a8d;
}

.category-row button[data-count]::after {
  display: inline-grid;
  min-width: 16px;
  height: 16px;
  margin-left: 5px;
  border-radius: 8px;
  background: #f0e0e3;
  color: #9b6876;
  content: attr(data-count);
  font-size: 8px;
  place-items: center;
}

.closet-scroll-note {
  display: none;
}

.catalog-heading {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  justify-content: space-between;
  margin: 4px 0 14px;
}

.catalog-heading p {
  margin: 0 0 3px;
  color: #94a096;
  font-size: 8px;
  letter-spacing: 1.2px;
}

.catalog-heading h3 {
  margin: 0;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 23px;
  font-weight: 400;
}

.catalog-search {
  display: flex;
  gap: 7px;
  align-items: center;
  width: min(180px, 42%);
  min-height: 35px;
  padding: 0 11px;
  border: 1px solid #e1e3dc;
  border-radius: 10px;
  color: #89958d;
  background: #f8f7f3;
}

.catalog-search svg {
  width: 15px;
}

.catalog-search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 10px;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(70px, 1fr));
  gap: 9px;
  padding-bottom: 6px;
}

.item-card {
  position: relative;
  min-width: 0;
  min-height: 138px;
  padding: 8px;
  overflow: hidden;
  border: 1px solid #e4e5de;
  border-radius: 13px;
  background: #faf9f5;
  text-align: center;
  cursor: pointer;
}

.item-card:hover {
  border-color: #bfcbc0;
  background: #fff;
}

.item-card.selected {
  border-color: #8da294;
  background: #f1f5ef;
  box-shadow: inset 0 0 0 1px #8da294;
}

.item-card.selected::after {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  color: #fff;
  background: #6f8877;
  content: "✓";
  font-size: 9px;
  place-items: center;
}

.item-thumbnail {
  display: grid;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-bottom: 4px;
  overflow: hidden;
  border-radius: 8px;
  color: #a1aaa3;
  background:
    linear-gradient(45deg, #eff0eb 25%, transparent 25%, transparent 75%, #eff0eb 75%),
    linear-gradient(45deg, #eff0eb 25%, #f8f8f4 25%, #f8f8f4 75%, #eff0eb 75%);
  background-position: 0 0, 6px 6px;
  background-size: 12px 12px;
  filter: contrast(1.08) saturate(1.06);
  place-items: center;
}

.item-thumbnail canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.item-card b,
.item-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-card b {
  font-size: 9px;
  font-weight: 600;
}

.item-card small {
  margin-top: 2px;
  color: #97a099;
  font-size: 7px;
}

.empty-thumb {
  color: #a3aca5;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 26px;
}

.skin-swatch {
  display: block;
  width: 58px;
  height: 58px;
  margin: 8px auto 10px;
  border: 4px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #dfe2dc;
}

.edit-dock {
  border-top: 1px solid #e4e5df;
  background: #f6f6f1;
  box-shadow: 0 -12px 30px rgb(74 88 79 / 4%);
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

.dock-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 51px;
  padding: 8px 20px;
}

.dock-heading > div {
  display: flex;
  flex-direction: column;
}

.dock-heading small {
  color: #89958d;
  font-size: 8px;
}

.dock-heading b {
  margin-top: 1px;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  font-weight: 400;
}

.dock-collapse,
.adjust-toggle {
  display: flex;
  gap: 6px;
  align-items: center;
  border: 0;
  color: #7b8880;
  background: transparent;
  font-size: 9px;
  cursor: pointer;
}

.dock-collapse svg,
.adjust-toggle svg {
  width: 16px;
  transition: transform 180ms;
}

.dock-collapse[aria-expanded="true"] svg,
.adjust-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.dock-body {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(280px, 1fr);
  gap: 14px;
  padding: 0 20px 16px;
}

.color-section,
.adjust-section {
  min-width: 0;
}

.control-title,
.adjust-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 8px;
  color: #77857c;
  font-size: 9px;
}

.control-title output {
  color: #9da59f;
}

.swatches {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.swatch {
  position: relative;
  width: 25px;
  height: 25px;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1px #d4d9d2;
  cursor: pointer;
}

.swatch.original {
  background: conic-gradient(#f3eee1 0 25%, #9fa59d 0 50%, #f3eee1 0 75%, #9fa59d 0);
}

.swatch.selected {
  box-shadow: 0 0 0 2px #627b6b;
}

.free-color {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 9px;
  color: #87928a;
  font-size: 8px;
}

.free-color input {
  width: 1px;
  height: 1px;
  opacity: 0;
}

.free-color button {
  display: inline-flex;
  min-height: 29px;
  padding: 0 9px 0 5px;
  gap: 6px;
  align-items: center;
  border: 1px solid #dfe4dc;
  border-radius: 999px;
  color: #6f8175;
  background: #fff;
  font-size: 8px;
  cursor: pointer;
}

.free-color button > span {
  width: 19px;
  height: 19px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #cfd6ce;
}

.free-color button > b {
  font-weight: 600;
  letter-spacing: 0.3px;
}

.free-color button.disabled,
.free-color button:disabled {
  opacity: 0.42;
  cursor: default;
}

.saved-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.saved-color-swatch {
  position: relative;
  width: 25px;
  height: 25px;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #d4d9d2;
  cursor: pointer;
}

.color-picker-dialog,
.saved-color-delete-dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: min(720px, calc(100dvh - 24px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgb(91 111 97 / 20%);
  border-radius: 22px;
  color: #344b3f;
  background: #faf9f3;
  box-shadow: 0 28px 90px rgb(30 45 35 / 25%);
}

.color-picker-dialog::backdrop,
.saved-color-delete-dialog::backdrop {
  background: #cbd6c8;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.color-picker-dialog form {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(720px, calc(100dvh - 24px));
}

.color-picker-dialog header,
.color-picker-dialog footer,
.saved-color-delete-dialog footer {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
}

.color-picker-dialog header {
  border-bottom: 1px solid #e1e5de;
}

.color-picker-dialog header small,
.color-picker-dialog header h2 {
  display: block;
  margin: 0;
}

.color-picker-dialog header small {
  color: #8b998f;
  font-size: 7px;
  letter-spacing: 1.5px;
}

.color-picker-dialog header h2 {
  margin-top: 2px;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 24px;
  font-weight: 400;
}

.color-picker-dialog header > button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #dce2da;
  border-radius: 50%;
  color: #73867a;
  background: #fff;
  font-size: 20px;
}

.color-picker-body {
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.color-picker-layout {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(190px, 0.9fr);
  gap: 18px;
}

.color-picker-field-wrap {
  display: grid;
  gap: 10px;
}

.color-picker-field {
  position: relative;
  min-height: 178px;
  overflow: hidden;
  border-radius: 15px;
  outline: 0;
  cursor: crosshair;
  touch-action: none;
}

.color-picker-field:focus-visible {
  box-shadow: 0 0 0 3px rgb(104 129 112 / 25%);
}

.color-picker-field i {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #526356;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

#colorPickerHue {
  width: 100%;
  height: 18px;
  margin: 0;
  border-radius: 999px;
  outline: 0;
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
  appearance: none;
  touch-action: pan-x;
}

#colorPickerHue::-webkit-slider-thumb {
  width: 20px;
  height: 24px;
  border: 2px solid #fff;
  border-radius: 10px;
  background: transparent;
  box-shadow: 0 0 1px #333;
  appearance: none;
}

.color-picker-controls {
  display: grid;
  align-content: start;
  gap: 12px;
}

.color-picker-preview {
  display: block;
  min-height: 72px;
  border: 1px solid #dfe4dc;
  border-radius: 14px;
}

.color-picker-hex {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  color: #74867a;
  font-size: 9px;
}

.color-picker-hex input {
  width: 112px;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid #d9e0d6;
  border-radius: 9px;
  color: #344b3f;
  background: #fff;
  font: 12px/1 monospace;
}

.color-picker-rgb {
  display: grid;
  gap: 7px;
}

.color-picker-rgb label {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) 30px;
  gap: 7px;
  align-items: center;
  color: #76877b;
  font-size: 8px;
}

.color-picker-rgb input {
  width: 100%;
  accent-color: #758f7d;
}

.color-picker-rgb output {
  text-align: right;
}

.color-picker-saved {
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid #e2e5de;
}

.color-picker-saved > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.color-picker-saved > div:first-child small {
  color: #919d95;
  font-size: 8px;
}

.color-picker-saved-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.color-picker-saved-grid button {
  width: 31px;
  height: 31px;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #d3d9d2;
}

.color-picker-saved-grid button:disabled,
.saved-color-swatch:disabled {
  opacity: 0.38;
  cursor: default;
}

.saved-color-empty {
  color: #98a39b;
  font-size: 8px;
}

.color-picker-dialog footer {
  justify-content: flex-end;
  border-top: 1px solid #e0e4dc;
  background: #f5f5ef;
}

.color-picker-dialog footer button,
.saved-color-delete-dialog footer button {
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid #d9e0d6;
  border-radius: 10px;
  color: #6c7f72;
  background: #fff;
  font-size: 9px;
}

.color-picker-dialog footer button:last-child,
.saved-color-delete-dialog footer button:last-child {
  border-color: #708b78;
  color: #fff;
  background: #708b78;
}

.saved-color-delete-dialog {
  width: min(360px, calc(100vw - 32px));
  padding: 20px;
}

.saved-color-delete-dialog h2 {
  margin: 0;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 22px;
  font-weight: 400;
}

.saved-color-delete-dialog p {
  margin: 9px 0 2px;
  color: #8a978f;
  font: 11px/1.5 monospace;
}

.saved-color-delete-dialog footer {
  padding: 18px 0 0;
}

@media (max-width: 600px) {
  .color-picker-dialog,
  .saved-color-delete-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 17px;
  }

  .color-picker-dialog form {
    max-height: calc(100dvh - 16px);
  }

  .color-picker-dialog header {
    padding: 11px 12px;
  }

  .color-picker-dialog header h2 {
    font-size: 20px;
  }

  .color-picker-body {
    padding: 11px;
  }

  .color-picker-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .color-picker-field {
    min-height: 138px;
  }

  .color-picker-preview {
    min-height: 46px;
  }

  .color-picker-dialog footer {
    padding: 10px 12px;
  }
}

@media (max-height: 620px) and (max-width: 520px) {
  .color-picker-dialog header {
    padding: 8px 10px;
  }

  .color-picker-dialog header small {
    display: none;
  }

  .color-picker-dialog header h2 {
    font-size: 18px;
  }

  .color-picker-dialog header > button {
    width: 32px;
    height: 32px;
  }

  .color-picker-body {
    padding: 8px 10px;
  }

  .color-picker-field {
    min-height: 112px;
  }

  .color-picker-controls {
    gap: 8px;
  }

  .color-picker-saved {
    margin-top: 12px;
    padding-top: 10px;
  }

  .color-picker-dialog footer {
    padding: 8px 10px;
  }

  .color-picker-dialog footer button {
    min-height: 34px;
  }
}

.swatch:disabled,
.adjust-controls input:disabled,
.adjust-actions button:disabled {
  opacity: 0.38;
  cursor: default;
}

.adjust-controls.is-locked {
  opacity: 0.72;
}

.adjust-section {
  padding-left: 14px;
  border-left: 1px solid #e0e1da;
}

.adjust-controls {
  display: grid;
  gap: 6px;
  max-height: 148px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding-right: 4px;
  touch-action: pan-y;
}

.adjust-controls label {
  display: grid;
  grid-template-columns: 34px minmax(90px, 1fr) 38px;
  gap: 7px;
  align-items: center;
  color: #7f8c84;
  font-size: 8px;
}

.adjust-controls input[type="range"] {
  width: 100%;
  accent-color: var(--green-dark);
  touch-action: pan-y;
}

.adjust-controls output {
  color: #5f6f65;
  font-size: 8px;
  text-align: right;
}

.adjust-actions {
  display: flex;
  gap: 6px;
}

.adjust-actions button {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid #d8ddd6;
  border-radius: 7px;
  color: #65736a;
  background: #fff;
  font-size: 8px;
  cursor: pointer;
}

.adjust-actions button.active {
  border-color: #90a496;
  background: #e5ede5;
}

.advanced-section {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  padding-top: 11px;
  border-top: 1px solid #e0e1da;
}

.feature-card,
.layer-editor {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid #e1e4dc;
  border-radius: 11px;
  background: rgb(255 255 255 / 70%);
}

.feature-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.feature-heading > span:first-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.feature-heading b {
  font-size: 10px;
  font-weight: 650;
}

.feature-heading small {
  margin-top: 2px;
  overflow: hidden;
  color: #929c95;
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feature-switch {
  display: flex;
  flex: none;
  gap: 5px;
  align-items: center;
  color: #6f7e75;
  font-size: 8px;
  cursor: pointer;
}

.feature-switch input {
  width: 13px;
  height: 13px;
  accent-color: var(--green-dark);
}

.feature-switch-row {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.feature-switch-row + .feature-switch-row {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.feature-switch-row > span {
  display: grid;
  gap: 2px;
}

.feature-switch-row b {
  font-size: 10px;
}

.feature-switch-row small {
  color: var(--muted);
  font-size: 7px;
}

.feature-switch-row input {
  width: 20px;
  height: 20px;
  flex: none;
  accent-color: var(--green-dark);
}

.gradient-controls,
.dual-color-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 7px;
  align-items: end;
  margin-top: 9px;
}

.gradient-controls label,
.dual-color-controls label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: #8a958e;
  font-size: 7px;
}

.gradient-controls select,
.dual-color-controls select {
  width: 100%;
  min-height: 29px;
  padding: 0 25px 0 8px;
  overflow: hidden;
  border: 1px solid #dce1d9;
  border-radius: 7px;
  color: #52665a;
  background: #fff;
  font-size: 8px;
  text-overflow: ellipsis;
}

.segmented-control {
  display: flex;
  padding: 3px;
  border: 1px solid #dce1d9;
  border-radius: 8px;
  background: #f3f5ef;
}

.segmented-control button {
  min-height: 23px;
  padding: 0 7px;
  border: 0;
  border-radius: 6px;
  color: #7e8d83;
  background: transparent;
  font-size: 7px;
  cursor: pointer;
}

.segmented-control button.active {
  color: #50665a;
  background: #fff;
  box-shadow: 0 2px 7px rgb(61 79 68 / 9%);
}

.gradient-controls[hidden],
.dual-color-controls[hidden] {
  display: none;
}

.dual-color-controls {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dual-color-controls label {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.dual-color-controls select {
  grid-column: 1 / -1;
}

.dual-eye-mark {
  display: inline-block;
  width: 11px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(90deg, #455879 0 50%, #a78bda 50%);
}

.dual-eye-mark.right {
  transform: scaleX(-1);
}

.copy-card {
  align-self: stretch;
}

.copy-actions {
  display: flex;
  flex: none;
  gap: 5px;
}

.copy-actions button,
.layer-actions button,
.layer-heading > button:last-child {
  min-height: 27px;
  padding: 0 8px;
  border: 1px solid #d9dfd6;
  border-radius: 7px;
  color: #64766b;
  background: #fff;
  font-size: 7px;
  cursor: pointer;
}

.copy-actions button#deleteCopyButton {
  color: #936b73;
  border-color: #eadce0;
  background: #fff8f9;
}

.layer-editor {
  grid-column: 1 / -1;
  padding: 0;
  overflow: hidden;
}

.layer-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 6px 10px;
}

.layer-heading > button:first-child {
  display: flex;
  gap: 7px;
  align-items: baseline;
  padding: 5px 0;
  border: 0;
  color: #61736a;
  background: transparent;
  cursor: pointer;
}

.layer-heading > button:first-child span {
  font-size: 9px;
  font-weight: 650;
}

.layer-heading > button:first-child b {
  color: #91a097;
  font-size: 7px;
  font-weight: 400;
}

.layer-heading > button:first-child small {
  color: #a0aaa3;
  font-size: 7px;
}

.layer-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 0 12px 12px;
}

.layer-new-top {
  display: flex;
  grid-column: 1 / -1;
  gap: 6px;
  align-items: center;
  min-height: 24px;
  color: #71837a;
  font-size: 8px;
  cursor: pointer;
}

.layer-new-top input {
  width: 13px;
  height: 13px;
  accent-color: var(--green-dark);
}

.layer-new-top small {
  color: #9ba59f;
  font-size: 7px;
}

.layer-list-caption {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  color: #71837a;
  font-size: 8px;
}

.layer-list-caption span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  font-weight: 650;
}

.layer-list-caption span::before {
  width: 13px;
  height: 7px;
  border-top: 2px solid #8ca094;
  border-bottom: 2px solid #8ca094;
  box-shadow: 0 3px 0 -1px #8ca094;
  content: "";
}

.layer-list-caption small {
  overflow: hidden;
  color: #91a098;
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-list {
  display: flex;
  gap: 4px;
  min-width: 0;
  max-height: 238px;
  padding: 5px;
  overflow-x: hidden;
  overflow-y: auto;
  flex-direction: column;
  border: 1px solid #e4e7e0;
  border-radius: 10px;
  background: #f7f8f3;
  overscroll-behavior: contain;
  scrollbar-color: #b8c5bb transparent;
  scrollbar-width: thin;
  touch-action: pan-y;
}

.layer-row {
  position: relative;
  display: grid;
  grid-template-columns: 26px 26px 34px minmax(0, 1fr) 30px 30px 30px;
  gap: 6px;
  align-items: center;
  min-height: 43px;
  padding: 4px 5px 4px 3px;
  border: 1px solid #e7eae3;
  border-radius: 8px;
  color: #75847b;
  background: #fff;
  font-size: 8px;
  box-shadow: 0 1px 2px rgb(64 82 71 / 3%);
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.layer-row::before {
  position: absolute;
  inset: 7px auto 7px 0;
  width: 3px;
  border-radius: 0 99px 99px 0;
  background: transparent;
  content: "";
}

.layer-row.active {
  border-color: #90a596;
  color: #465d50;
  background: #edf3eb;
  box-shadow: 0 4px 12px rgb(69 92 77 / 8%);
}

.layer-row.active::before {
  background: #647f6d;
}

.layer-row.hidden-layer:not(.active) {
  color: #a0aaa3;
  background: #f6f7f3;
}

.layer-row.hidden-layer .layer-thumbnail,
.layer-row.hidden-layer .layer-name,
.layer-row.hidden-layer .layer-meta {
  opacity: 0.48;
}

.layer-row.locked-layer .layer-name::after {
  margin-left: 5px;
  color: #9a826f;
  content: "锁定";
  font-size: 6px;
  font-weight: 500;
}

.layer-row.dragging {
  z-index: 2;
  border-color: #6f8b78;
  background: #eef4ec;
  box-shadow: 0 10px 24px rgb(55 78 63 / 18%);
  opacity: 0.96;
  transform: scale(0.992);
}

.layer-list.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
  user-select: none;
}

.layer-list.is-dragging .layer-row:not(.dragging) {
  pointer-events: none;
}

.layer-drag-handle {
  color: #7d9183 !important;
  cursor: grab !important;
  font-size: 14px !important;
  touch-action: none;
}

.layer-row.dragging .layer-drag-handle {
  cursor: grabbing !important;
}

.layer-index {
  display: grid;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  color: #809187;
  background: #f1f4ef;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 7px;
  place-items: center;
}

.layer-row:first-child .layer-index {
  color: #fff;
  background: #83998a;
}

.layer-thumbnail {
  display: grid;
  width: 32px;
  height: 32px;
  overflow: hidden;
  border: 1px solid #e2e6de;
  border-radius: 7px;
  background:
    linear-gradient(45deg, #f2f3ef 25%, transparent 25% 75%, #f2f3ef 75%),
    linear-gradient(45deg, #f2f3ef 25%, #fafaf7 25% 75%, #f2f3ef 75%);
  background-position: 0 0, 5px 5px;
  background-size: 10px 10px;
  cursor: pointer;
  place-items: center;
}

.layer-thumbnail canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.layer-thumb-placeholder {
  color: #a7b0a9;
  font-size: 9px;
}

.layer-select {
  display: flex;
  min-width: 0;
  min-height: 32px;
  padding: 0;
  border: 0;
  flex-direction: column;
  justify-content: center;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.layer-select:focus-visible,
.layer-row button:focus-visible {
  outline: 2px solid #789181;
  outline-offset: 1px;
}

.layer-name-line {
  display: flex;
  gap: 5px;
  min-width: 0;
  align-items: center;
}

.layer-name {
  min-width: 0;
  overflow: hidden;
  color: #52665a;
  font-size: 9px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-meta {
  margin-top: 2px;
  overflow: hidden;
  color: #9aa59e;
  font-size: 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-copy-badge {
  flex: none;
  padding: 1px 4px;
  border-radius: 999px;
  color: #9a7d86;
  background: #f2e9eb;
  font-size: 6px;
}

.layer-row > button:not(.layer-select) {
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: #839188;
  background: transparent;
  font-size: 13px;
  cursor: pointer;
  place-items: center;
}

.layer-tool svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.layer-tool.layer-visibility[aria-pressed="true"],
.layer-tool.layer-rename {
  color: #758b7c;
}

.layer-tool.layer-visibility.is-off {
  color: #a7afa9;
}

.layer-tool.layer-lock.is-locked {
  color: #8b715e;
  background: #f1ebe5;
}

.layer-row > button:not(.layer-select):hover {
  background: #e5ece3;
}

.layer-row > button:not(.layer-select):disabled {
  color: #c5cdc7;
  background: transparent;
  cursor: default;
}

.layer-rename-wrap {
  display: flex;
  min-width: 0;
  min-height: 32px;
  align-items: center;
}

.layer-rename-input {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #7f9886;
  border-radius: 7px;
  outline: 3px solid rgb(121 145 129 / 14%);
  color: #40574a;
  background: #fff;
  font: inherit;
  font-size: 9px;
}

.layer-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.layer-actions button {
  min-height: 31px;
  background: #fbfcf9;
}

.layer-actions button[data-layer-action="top"] {
  color: #fff;
  border-color: #718b79;
  background: #718b79;
}

.layer-actions button:disabled {
  opacity: 0.38;
  cursor: default;
}

.layer-live-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 500;
  max-width: calc(100vw - 32px);
  padding: 11px 17px;
  border-radius: 10px;
  color: #fff;
  background: rgb(42 62 51 / 92%);
  box-shadow: 0 10px 30px rgb(23 42 31 / 18%);
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 15px);
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1160px) {
  .home-view {
    grid-template-columns: minmax(270px, 0.9fr) minmax(330px, 1.1fr);
  }

  .home-tools {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, 1fr);
  }

  .home-footer {
    display: none;
  }

  .editor-layout {
    grid-template-columns: minmax(340px, 0.8fr) minmax(480px, 1.2fr);
  }

  .catalog-grid {
    grid-template-columns: repeat(4, minmax(70px, 1fr));
  }

  .dock-body {
    grid-template-columns: 1fr;
  }

  .adjust-section {
    padding-top: 10px;
    padding-left: 0;
    border-top: 1px solid #e0e1da;
    border-left: 0;
  }

  .advanced-section {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 850px) {
  .app-frame {
    padding: 0 14px 18px;
  }

  .site-header {
    grid-template-columns: 1fr auto;
  }

  .site-header nav {
    display: none;
  }

  .home-view {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 28px 8px;
  }

  .home-copy {
    padding: 0;
  }

  .home-copy h1 {
    font-size: clamp(43px, 11vw, 64px);
  }

  .intro {
    margin: 16px 0 20px;
  }

  .home-stage-wrap {
    min-height: 520px;
  }

  .home-stage {
    width: min(94vw, 460px);
    height: 560px;
  }

  .home-tools {
    grid-template-columns: 1fr;
  }

  .editor-view {
    min-height: calc(100vh - 65px);
    padding-top: 10px;
  }

  .editor-header {
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    margin-bottom: 8px;
  }

  .editor-title p,
  .editor-status,
  .editor-actions .text-button {
    display: none;
  }

  .editor-title h2 {
    font-size: 15px;
  }

  .editor-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(330px, 42vh) minmax(0, 1fr);
    height: calc(100vh - 105px);
    min-height: 570px;
    border-radius: 18px;
  }

  .preview-panel {
    grid-template-rows: auto 1fr;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .preview-footer {
    display: none;
  }

  .character-stage {
    border-radius: 110px 110px 14px 14px;
  }

  #editorCanvas {
    right: 18%;
    bottom: -12%;
    left: 18%;
    width: 64%;
    height: 112%;
  }

  .panel-scroll {
    padding: 10px 12px 18px;
  }

  .catalog-heading h3 {
    font-size: 19px;
  }

  .catalog-grid {
    grid-template-columns: repeat(3, minmax(72px, 1fr));
  }

  .item-card {
    min-height: 121px;
  }

  .edit-dock {
    max-height: min(32vh, 280px);
    overflow-y: auto;
  }

  .dock-heading {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f6f6f1;
  }

  .dock-body {
    padding: 0 14px 14px;
  }

  .advanced-section {
    grid-template-columns: 1fr;
  }

  .home-footer {
    display: none;
  }
}

@media (max-width: 520px) {
  .app-frame {
    padding-right: 0;
    padding-left: 0;
  }

  .site-header {
    min-height: 62px;
    padding: 0 17px;
  }

  .save-state {
    display: none;
  }

  .home-view {
    padding: 24px 20px 28px;
  }

  .eyebrow {
    margin-bottom: 14px;
    font-size: 8px;
  }

  .home-copy h1 {
    font-size: 46px;
    letter-spacing: -2px;
  }

  .intro {
    max-width: 330px;
    font-size: 12px;
  }

  .home-actions {
    gap: 8px;
  }

  .home-meta {
    gap: 14px;
  }

  .home-stage-wrap {
    min-height: 485px;
  }

  .home-stage {
    width: min(96vw, 410px);
    height: 500px;
    min-height: 0;
    border-radius: 43% 43% 24px 24px;
  }

  .stage-caption {
    display: none;
  }

  .tool-card {
    min-height: 71px;
  }

  body[data-route="editor"] .site-header {
    display: none;
  }

  .editor-view {
    position: fixed;
    inset: 0;
    z-index: 20;
    padding: 8px 9px;
    background: #eef1e9;
  }

  .editor-header {
    min-height: 45px;
    margin-bottom: 4px;
  }

  .editor-layout {
    height: calc(100dvh - 59px);
    min-height: 0;
    border-radius: 16px;
  }

  .preview-panel {
    min-height: 0;
  }

  .character-stage {
    border-radius: 90px 90px 12px 12px;
  }

  #editorCanvas {
    right: 13%;
    bottom: -17%;
    left: 13%;
    width: 74%;
    height: 118%;
  }

  .tabs {
    position: sticky;
    top: -10px;
    z-index: 5;
    background: #f5f4ef;
  }

  .category-row {
    position: sticky;
    top: 38px;
    z-index: 5;
    background: #fffdf9;
  }

  /*
   * Keep programmatic focus and browser scroll gestures out from under the
   * two sticky navigation rows. This also affects Playwright's native
   * scroll-into-view path, so the hit target remains the card a user sees.
   */
  .panel-scroll {
    scroll-padding-block-start: 102px;
  }

  .catalog-heading,
  .item-card,
  .outfit-new-slot,
  .outfit-card,
  .outfit-empty-state {
    scroll-margin-block-start: 102px;
  }

  .catalog-search {
    width: 122px;
  }

  .catalog-grid {
    grid-template-columns: repeat(3, minmax(70px, 1fr));
    gap: 7px;
  }

  .item-card {
    min-height: 115px;
    padding: 6px;
  }

  .dock-body {
    gap: 10px;
  }

  .swatches {
    gap: 6px;
  }

  .swatch {
    width: 24px;
    height: 24px;
  }

  .gradient-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .segmented-control {
    grid-column: 1 / -1;
    width: max-content;
  }

  .feature-heading {
    align-items: flex-start;
  }

  .copy-card .feature-heading {
    align-items: center;
  }

  .copy-actions button {
    padding: 0 6px;
  }

  .layer-heading > button:first-child small {
    display: none;
  }

  .layer-list {
    max-height: min(238px, 34dvh);
  }

  .layer-row {
    grid-template-columns: 28px 28px 38px minmax(0, 1fr) 32px 32px 32px;
    gap: 4px;
    min-height: 48px;
  }

  .layer-row > button:not(.layer-select) {
    width: 32px;
    height: 32px;
  }

  .layer-thumbnail {
    width: 36px;
    height: 36px;
  }

  .layer-list-caption small {
    max-width: 54%;
  }

  .layer-content {
    grid-template-columns: 1fr;
  }

  .layer-actions {
    grid-template-columns: repeat(4, 1fr);
  }

  .canvas-interaction-hint {
    bottom: 6px;
    font-size: 6px;
  }

  .touch-feedback {
    gap: 5px;
    min-height: 40px;
    padding: 3px 4px 3px 7px;
    border-radius: 11px;
  }

  .touch-feedback-copy b {
    font-size: 9px;
  }

  .touch-feedback-copy small {
    font-size: 7px;
  }

  .touch-feedback button {
    min-width: 42px;
    min-height: 34px;
    padding: 0 7px;
    font-size: 8px;
  }

  .canvas-candidates {
    right: 7px;
    bottom: 27px;
    left: 7px;
    gap: 5px;
    padding: 7px;
    border-radius: 13px;
  }

  .canvas-candidate-heading small {
    display: none;
  }

  .canvas-candidate {
    min-height: 40px;
    padding-right: 10px;
  }
}

@media (max-width: 850px) and (max-height: 700px) {
  .editor-layout {
    grid-template-rows: clamp(176px, 31vh, 224px) minmax(0, 1fr);
  }

  .preview-toolbar {
    min-height: 35px;
  }

  .tabs button {
    min-height: 33px;
  }

  .category-row {
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .item-card {
    min-height: 104px;
  }

  .edit-dock {
    max-height: min(30vh, 220px);
    scroll-padding-top: 54px;
  }

  .adjust-controls {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .layer-list {
    max-height: none;
    overflow: visible;
    overscroll-behavior-y: auto;
  }

  .dock-heading {
    z-index: 8;
    min-height: 46px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Yuzu House 2.175 interaction pass */
body[data-route="home"] {
  background:
    radial-gradient(circle at 18% 14%, rgb(255 255 255 / 74%) 0 2px, transparent 3px),
    radial-gradient(circle at 82% 23%, rgb(255 255 255 / 60%) 0 3px, transparent 4px),
    #f5f4eb;
}

.yu-home {
  position: relative;
  display: flex;
  width: min(100%, 980px);
  min-height: calc(100vh - 92px);
  margin: auto;
  padding: 26px 20px 22px;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #536e61;
}

.yu-home-rain {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.yu-home-drop {
  position: absolute;
  top: 0;
  left: var(--x);
  width: var(--s);
  height: var(--s);
  opacity: 0.43;
  filter: saturate(0.28);
  animation: yu-home-fall var(--d) linear var(--delay) infinite;
}

.yu-home-drop img {
  display: block;
  width: 100%;
  height: 100%;
}

@keyframes yu-home-fall {
  0% {
    transform: translate3d(0, -65px, 0) rotate(var(--r));
  }
  100% {
    transform: translate3d(var(--drift), var(--fall), 0)
      rotate(calc(var(--r) + 30deg));
  }
}

.yu-home-topline {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
}

.yu-home-signature {
  color: #7d8b80;
  font-family: "YuzuPop", sans-serif;
  font-size: 13px;
  letter-spacing: 1.2px;
}

.yu-home-top-actions {
  display: flex;
  gap: 9px;
  align-items: center;
}

.yu-pill,
.yu-menu-button {
  border: 1px solid rgb(91 113 101 / 24%);
  background: #ecefe7;
  box-shadow: 0 9px 24px rgb(75 94 83 / 6%);
  cursor: pointer;
}

.yu-pill {
  display: flex;
  height: 36.524px;
  min-height: 36.524px;
  padding: 0 12.762px;
  gap: 5px;
  align-items: center;
  border-radius: 15px;
  color: #53675b;
  background: #ecefe7;
  border-color: #d9dfd5;
}

.yu-pill svg {
  width: 20px;
}

.yu-menu-button {
  display: grid;
  width: 52px;
  height: 52px;
  padding: 15px;
  border-radius: 50%;
  border-color: #d9dfd5;
  place-content: center;
  gap: 5px;
  color: #53675b;
}

.yu-menu-button span {
  display: block;
  width: 21px;
  height: 1.5px;
  border-radius: 2px;
  background: currentColor;
}

.yu-home-heading {
  display: grid;
  width: 100%;
  height: 142px;
  margin-top: 0;
  padding-top: 4.149px;
  box-sizing: border-box;
  align-content: start;
  justify-items: center;
  text-align: center;
}

.yu-home-heading p {
  margin: 0;
  color: #7d8b80;
  font-family: "YuzuPop", sans-serif;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 1.4px;
}

.yu-home-heading h1 {
  position: relative;
  display: flex;
  margin: 4px 0 0;
  gap: 5px;
  align-items: center;
  justify-content: center;
  color: #6c8276;
  font-family: "YuzuPop", sans-serif;
  font-size: clamp(64px, 9vw, 112px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 2px;
  text-shadow: none;
}

.yu-home-heading h1 > span {
  display: block;
  animation: yu-title-nod 4.6s ease-in-out infinite;
}

.yu-home-heading h1 > span:nth-child(2) {
  animation-delay: 0.18s;
}

.yu-home-heading h1 > span:nth-child(3) {
  animation-delay: 0.36s;
}

.yu-home-heading h1 > span:nth-child(2) {
  color: #7d9286;
}

.yu-home-heading h1 .title-leaf {
  position: absolute;
  top: -3px;
  left: calc(100% + 2px);
  width: 23px;
  height: 23px;
  overflow: visible;
  color: #6c8276;
  fill: #9db4a7;
  stroke: #f6f5ef;
  stroke-width: 1.3;
}

.yu-home-heading > span {
  margin-top: 0;
  color: #53675b;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 1px;
  line-height: 1.5;
}

.yu-home-stage {
  position: relative;
  width: min(100%, 560px);
  height: clamp(320px, 44vh, 470px);
  min-height: 320px;
}

.yu-home-stage #homeCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: calc(100% - 39.357px);
  object-fit: contain;
}

.yu-home-stage .hanger-button {
  bottom: 0;
  width: 60px;
  height: 60px;
  border-color: #d9dfd5;
  background: #ecefe7;
  color: #53675b;
  box-shadow: none;
}

.yu-home-stage .hanger-button svg {
  width: 34px;
}

.yu-stage-look {
  position: absolute;
  right: 16%;
  bottom: 19px;
  z-index: 5;
  padding: 5px 10px;
  border-radius: 999px;
  color: #7c8b83;
  background: rgb(255 255 255 / 48%);
  font-size: 10px;
}

.yu-home-line-detail {
  position: absolute;
  inset: 0;
  z-index: 1;
  color: #c3c9b9;
  pointer-events: none;
}

.yu-home-line-detail svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 1;
}

.yu-decor {
  position: absolute;
  z-index: 3;
  color: rgb(118 141 127 / 52%);
  opacity: 0.6;
  pointer-events: none;
  animation: yu-home-decor-float 4s ease-in-out infinite;
}

.yu-decor-star {
  top: 28%;
  left: 6%;
  width: 34px;
  height: 34px;
  animation-delay: -1.3s;
}

.yu-decor-ring {
  top: 23%;
  right: 12%;
  width: 9px;
  height: 9px;
  border: 1px solid #899a90;
  border-radius: 50%;
}

.yu-decor-candy {
  display: none;
}

.yu-decor-gift {
  width: 38px;
  height: 38px;
}

.yu-decor-gift.left {
  top: 65%;
  right: auto;
  left: 76%;
  bottom: auto;
  width: 35px;
  height: 35px;
  animation-delay: -2.7s;
}

.yu-decor-gift.right {
  top: 27%;
  right: auto;
  left: 77%;
  width: 40px;
  height: 40px;
  animation-delay: 0s;
}

.yu-decor-cake {
  bottom: 18%;
  left: 5%;
  width: 30px;
  height: 30px;
  opacity: 0.18;
  transform: rotate(-5deg);
}

.yu-decor-art {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: none;
}

.yu-decor-cake {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .yu-home-drop {
    animation: none !important;
    transform: translateY(calc(var(--fall) * 0.3)) rotate(var(--r));
  }

  .yu-decor,
  .yu-home-heading h1 > span {
    animation: none !important;
  }
}

.yu-home-mark {
  color: #7d8b80;
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 2px;
}

@keyframes yu-home-decor-float {
  0%,
  100% {
    transform: translateY(6px) rotate(-5deg);
  }

  50% {
    transform: translateY(-12px) rotate(6deg);
  }
}

@keyframes yu-title-nod {
  0%,
  76%,
  100% {
    translate: 0 0;
  }

  83% {
    translate: 0 -7px;
  }

  90% {
    translate: 0 2px;
  }
}

.yu-home-actions {
  display: grid;
  width: min(100%, 660px);
  grid-template-columns: 1fr 1fr;
  gap: 13px 18px;
}

.yu-main-action {
  min-height: 72px;
  border: 0;
  border-radius: 22px;
  color: #fffef7;
  font-size: 26px;
  font-weight: 400;
  cursor: pointer;
}

.yu-main-action.level {
  background: #9db4a7;
}

.yu-main-action.endless {
  color: #53675b;
  background: #e9dcde;
}

.yu-secondary-actions {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.yu-secondary-actions button {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  border: 0;
  border-radius: 17px;
  color: #53675b;
  background: #ecefe7;
  font-size: 17px;
  font-weight: 400;
  cursor: pointer;
}

.yu-home-achievements {
  position: relative;
  display: block;
  width: 100%;
  height: 30px;
  margin-top: 2px;
  color: #71837a;
  font-size: 10px;
  font-weight: 400;
  text-align: center;
}

.yu-home-achievements > span {
  position: absolute;
  right: 0;
  left: 0;
  width: 100%;
  line-height: normal;
}

.yu-home-achievements > span:nth-child(1) {
  top: 0;
  color: #7d8b80;
  font-size: 11px;
  letter-spacing: 2px;
}

.yu-home-achievements > .yu-home-best {
  top: 16.667px;
  display: inline-flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  color: #53675b;
}

.yu-home-best b {
  color: #53675b;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.yu-home-achievements > span:nth-child(3) {
  top: 34.857px;
}

.yu-home-language-note {
  width: auto;
  text-align: center;
  margin: 12px 0 0;
  color: #7d8b80;
  font-family: "Segoe UI", sans-serif;
  font-size: 10px;
  font-weight: 400;
  line-height: 15px;
  opacity: 0.72;
}

.wardrobe-stage-actions {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 12;
  display: grid;
  gap: 7px;
}

.wardrobe-stage-actions button {
  display: flex;
  width: max-content;
  min-height: 34px;
  padding: 0 12px;
  gap: 6px;
  align-items: center;
  border: 1px solid rgb(92 115 102 / 16%);
  border-radius: 13px;
  color: #64786d;
  background: rgb(250 251 246 / 78%);
  box-shadow: 0 7px 20px rgb(74 92 81 / 7%);
  font-size: 9px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.wardrobe-stage-actions button svg {
  width: 16px;
}

.wardrobe-stage-actions button.active {
  color: #fff;
  background: #6f8979;
}

.wardrobe-tool {
  display: inline-flex;
  min-height: 32px;
  padding: 0 9px;
  gap: 5px;
  align-items: center;
  border: 1px solid rgb(90 115 99 / 14%);
  border-radius: 9px;
  background: rgb(255 255 255 / 66%);
  font-size: 8px;
  cursor: pointer;
}

.wardrobe-tool svg {
  width: 15px;
}

.character-stage {
  transition: background 220ms ease, filter 220ms ease;
}

.character-stage.is-night {
  --stage-top: #343b52 !important;
  --stage-bottom: #18253f !important;
  --stage-accent: #8091ad !important;
}

.character-stage.is-night #editorCanvas {
  filter: saturate(0.78) brightness(0.9);
}

.part-import-dialog {
  width: min(94vw, 680px);
  max-height: min(88vh, 760px);
  padding: 0;
  overflow: hidden;
  border: 1px solid rgb(91 113 101 / 20%);
  border-radius: 22px;
  color: var(--ink);
  background: #fbfaf5;
  box-shadow: 0 30px 90px rgb(31 48 39 / 24%);
}

.part-import-dialog::backdrop {
  background: #cbd6c8;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.part-import-dialog form {
  display: grid;
  max-height: min(88vh, 760px);
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.part-import-dialog header,
.part-import-dialog footer {
  display: flex;
  padding: 14px 18px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.part-import-dialog footer {
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.part-import-dialog header small {
  color: var(--muted);
  font-size: 7px;
  letter-spacing: 0.15em;
}

.part-import-dialog h2 {
  margin: 2px 0 0;
  font-size: 20px;
}

.part-import-dialog header button,
.part-import-dialog footer button,
.part-import-mode button,
.part-import-row button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.part-import-dialog header button {
  width: 34px;
  height: 34px;
}

.part-import-dialog footer button {
  min-height: 36px;
  padding: 0 14px;
}

.part-import-dialog footer button:last-child {
  color: #fff;
  background: var(--green-dark);
}

.part-import-scroll {
  min-height: 0;
  padding: 14px 18px;
  overflow-y: auto;
}

.part-import-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.part-import-mode button {
  display: grid;
  min-height: 54px;
  padding: 8px 12px;
  gap: 2px;
  color: var(--ink);
  justify-items: start;
}

.part-import-mode button.active {
  border-color: #789083;
  background: #e8efe8;
}

.part-import-mode small {
  color: var(--muted);
  font-size: 8px;
}

.part-import-field,
.pet-outfit-picker,
.pet-control-group label,
.pet-file-field {
  display: grid;
  margin-top: 11px;
  gap: 6px;
  color: var(--ink);
  font-size: 10px;
}

.part-import-field select,
.part-import-field input,
.pet-outfit-picker select,
.pet-inline-fields input:not([type="color"]),
.pet-control-group select,
.pet-control-group input:not([type="range"]) {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
}

.part-import-drop {
  display: grid;
  min-height: 104px;
  margin-top: 12px;
  padding: 14px;
  place-content: center;
  border: 1px dashed #a9b7ad;
  border-radius: 14px;
  background: #f2f4ed;
  text-align: center;
  cursor: pointer;
}

.part-import-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.part-import-drop small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 8px;
}

.part-import-note,
.part-import-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
}

.part-import-status[data-kind="error"] {
  color: #a55c5c;
}

.part-import-status[data-kind="success"] {
  color: #4f7863;
}

.part-import-manage {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.part-import-manage summary {
  display: flex;
  justify-content: space-between;
  cursor: pointer;
}

.part-import-row {
  display: grid;
  margin-top: 8px;
  padding-top: 8px;
  grid-template-columns: 38px 1fr auto;
  gap: 9px;
  align-items: center;
  border-top: 1px solid var(--line);
}

.part-import-row img {
  width: 38px;
  height: 50px;
  object-fit: contain;
}

.part-import-row span {
  display: grid;
  gap: 2px;
}

.part-import-row small,
.part-import-empty {
  color: var(--muted);
  font-size: 8px;
}

.part-import-row button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 8px;
}

.game-stage-strip {
  display: grid;
  padding: 0 0 9px;
  gap: 7px;
  border-bottom: 1px solid var(--line);
}

.game-stage-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 8px;
}

.game-stage-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.game-stage-card {
  display: grid;
  min-width: 0;
  min-height: 45px;
  padding: 6px;
  grid-template-columns: 23px 1fr;
  gap: 5px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: rgb(255 255 255 / 55%);
  text-align: left;
  cursor: pointer;
}

.game-stage-card i {
  display: grid;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  color: var(--muted);
  background: var(--green-pale);
  font-size: 8px;
  font-style: normal;
  place-items: center;
}

.game-stage-card span {
  display: grid;
  min-width: 0;
}

.game-stage-card b {
  overflow: hidden;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-stage-card small {
  color: var(--muted);
  font-size: 6px;
}

.game-stage-card.active {
  border-color: #718d7c;
  background: #e4ece5;
}

.game-stage-card.completed {
  border-color: #b7c8b7;
}

.game-stage-card.locked {
  opacity: 0.42;
  cursor: not-allowed;
}

.chapter-picker {
  box-sizing: border-box;
  width: min(100%, 440px);
  max-width: 440px;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 auto;
  padding: 22px;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  color: #667b74;
  background: #f8f6f1;
  box-shadow: none;
  overscroll-behavior: contain;
}

.chapter-picker[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.chapter-picker::backdrop {
  background: #cbd6c8;
  backdrop-filter: none;
}

.chapter-panel {
  width: 100%;
  max-width: 360px;
  margin: auto;
}

.chapter-picker header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chapter-picker header small {
  color: #94a69d;
  font-size: 10px;
  letter-spacing: 1px;
}

.chapter-picker h2 {
  margin: 9px 0 12px;
  font-family: "YuzuPop", "Microsoft YaHei", sans-serif;
  font-size: 29px;
  font-weight: 400;
}

.chapter-picker header button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  color: #80958a;
  background: #e9ede6;
  cursor: pointer;
  font-size: 25px;
  touch-action: manipulation;
}

.chapter-picker p {
  margin: 0 0 23px;
  color: #899a92;
  font: 13px/1.7 "YuzuPop", "Microsoft YaHei", sans-serif;
}

.chapter-picker-list {
  display: grid;
  gap: 11px;
}

.chapter-picker-list button {
  display: flex;
  min-height: 79px;
  padding: 18px 14px;
  gap: 14px;
  align-items: center;
  border: 0;
  border-radius: 19px;
  color: #886f78;
  background: #f1d9da;
  cursor: pointer;
  text-align: left;
  touch-action: manipulation;
}

.chapter-picker-list button:nth-child(2) {
  color: #648278;
  background: #dcebe5;
}

.chapter-picker-list button:nth-child(3) {
  color: #77829b;
  background: #e1e7f1;
}

.chapter-picker-list button:nth-child(4) {
  color: #a17d8d;
  background: #f5dfe8;
}

.chapter-picker-list button > i {
  display: block;
  width: auto;
  height: auto;
  color: inherit;
  background: transparent;
  font-size: 26px;
  font-weight: 400;
  font-style: normal;
  opacity: 0.65;
}

.chapter-picker-list button > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
  flex: 1;
}

.chapter-picker-list button b {
  font-size: 18px;
  font-weight: 400;
}

.chapter-picker-list button small,
.chapter-picker-list button > em {
  color: inherit;
  font-size: 11px;
  font-style: normal;
  opacity: 0.8;
}

.chapter-picker-list button.active {
  box-shadow: none;
}

.chapter-picker-list button.completed > i {
  color: inherit;
  background: transparent;
}

.chapter-picker-list button:disabled {
  color: #a5afa7;
  background: #eceee9;
  opacity: 1;
  cursor: not-allowed;
}

.chapter-tools {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.chapter-tools button {
  min-width: 0;
  min-height: 47px;
  flex: 1;
  padding: 13px 10px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: #a2b8ab;
  font-size: 15px;
  cursor: pointer;
  touch-action: manipulation;
}

.chapter-tools button[hidden] {
  display: none !important;
}

.chapter-tools .chapter-free-button {
  color: #7e9385;
  background: #e5ebe2;
}

.chapter-free-button {
  width: auto;
}

.chapter-picker .chapter-save {
  margin: 17px 0 0;
  font-size: 10px;
  text-align: center;
}

@media (max-height: 650px) {
  .chapter-picker {
    padding: 16px 22px;
  }

  .chapter-picker h2 {
    margin: 5px 0 9px;
    font-size: 25px;
  }

  .chapter-picker p {
    margin-bottom: 13px;
  }

  .chapter-picker-list {
    gap: 8px;
  }

  .chapter-picker-list button {
    min-height: 67px;
    padding: 13px;
  }

  .chapter-tools {
    margin-top: 13px;
  }
}

.game-result-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.game-result-actions button {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.game-result-actions button:first-child:not([hidden]) {
  color: #fff;
  background: var(--green-dark);
}

.pet-panel-scroll {
  display: grid;
  align-content: start;
  gap: 9px;
}

.pet-outfit-picker {
  padding: 10px;
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgb(255 255 255 / 45%);
}

.pet-outfit-picker > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
}

.pet-outfit-picker button,
.pet-control-group > button,
.pet-file-field,
.pet-relationship-list button {
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.pet-outfit-picker button {
  padding: 0 11px;
}

.pet-outfit-picker small {
  color: var(--muted);
  font-size: 8px;
}

.pet-size-control {
  padding: 7px 9px;
  margin: 0;
  border-radius: 11px;
  background: rgb(255 255 255 / 42%);
}

.pet-control-group {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgb(255 255 255 / 45%);
}

.pet-control-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  cursor: pointer;
}

.pet-control-group summary::-webkit-details-marker {
  display: none;
}

.pet-control-group summary span {
  display: grid;
  gap: 2px;
}

.pet-control-group summary small {
  color: var(--muted);
  font-size: 7px;
}

.pet-control-group summary i {
  font-style: normal;
  transition: transform 180ms ease;
}

.pet-control-group[open] summary i {
  transform: rotate(180deg);
}

.pet-background-choices {
  display: grid;
  margin-top: 9px;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}

.pet-background-choices button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 8px;
  cursor: pointer;
}

.pet-background-choices button.active {
  border-color: #718d7c;
  background: #e3ece4;
}

.pet-background-dialog {
  box-sizing: border-box;
  width: min(370px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: 20px;
  overflow: auto;
  border: 0.762px solid #e2e5dc;
  border-radius: 22px;
  color: #7e9188;
  background: #fcfaf4;
  font: 13px YuzuPop, sans-serif;
}

.pet-background-dialog:not([open]) {
  display: none;
}

.pet-background-dialog::backdrop {
  background: rgb(96 109 102 / 27%);
}

.pet-background-dialog > header {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pet-background-dialog h3,
.pet-background-dialog h4 {
  margin: 0;
  color: inherit;
  font-family: YuzuPop, sans-serif;
}

.pet-background-dialog h3 {
  font-size: 19px;
  font-weight: 500;
}

.pet-background-dialog h4 {
  font-size: 15px;
  font-weight: 500;
}

.pet-background-dialog > header > button {
  display: grid;
  width: 36px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  place-items: center;
  color: #7f9287;
  background: transparent;
  font: 22px/normal sans-serif;
}

.pet-background-dialog .pet-background-choices {
  display: grid;
  margin: 18px 0 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.pet-background-dialog .pet-background-choices button,
.pet-background-dialog .pet-background-import,
.pet-background-dialog .pet-foreground-actions button {
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 0.762px solid #dce3d9;
  border-radius: 12px;
  color: #7f9287;
  background: #edf1e9;
  font: 13px/normal YuzuPop, sans-serif;
}

.pet-background-dialog .pet-background-choices button[aria-pressed="true"] {
  border-color: #bdd4d9;
  color: #5f8084;
  background: #dfecef;
}

.pet-background-colors {
  display: grid;
  margin: 15px 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.pet-background-colors[hidden] {
  display: none;
}

.pet-background-colors button {
  box-sizing: border-box;
  width: 100%;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 14px;
}

.pet-background-colors button[aria-pressed="true"] {
  box-shadow: 0 0 0 2px #8ba7a3;
}

.pet-background-dialog .pet-background-import {
  width: 100%;
  margin-top: 12px;
  background: #eee2e6;
}

.pet-foreground-settings {
  padding-top: 14px;
  margin-top: 18px;
  border-top: 1px solid #dde3d8;
}

.pet-foreground-actions {
  display: flex;
  margin-top: 10px;
  gap: 8px;
  flex-wrap: wrap;
}

.pet-foreground-settings label {
  display: grid;
  margin-top: 10px;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
}

.pet-foreground-settings .pet-foreground-enabled {
  grid-template-columns: 22px minmax(0, 1fr);
  color: #748673;
}

.pet-foreground-settings .pet-foreground-enabled input {
  width: 18px;
  height: 18px;
  accent-color: #9eb3ad;
}

.pet-foreground-settings input[type="range"] {
  min-width: 0;
  width: 100%;
  accent-color: #9eb3ad;
}

.pet-foreground-settings output {
  color: #81938a;
  text-align: right;
}

.pet-foreground-settings p,
.pet-background-status {
  margin: 10px 0 0;
  color: #8c9a90;
  font-size: 11px;
  line-height: 1.6;
}

.pet-background-status {
  margin-top: 13px;
  color: #9ba69b;
}

.pet-voice-dialog,
.pet-choice-dialog {
  box-sizing: border-box;
  width: min(340px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: 20px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 0.762px solid #dce4d7;
  border-radius: 23px;
  color: #748673;
  background: #fbfaf3;
  font: 13px YuzuPop, sans-serif;
}

.pet-choice-dialog {
  width: min(440px, calc(100vw - 24px));
  max-height: calc(100dvh - 30px);
  padding: 18px;
  border-radius: 22px;
  background: #faf9f1;
  font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif;
}

.pet-voice-dialog:not([open]),
.pet-choice-dialog:not([open]) {
  display: none;
}

.pet-voice-dialog::backdrop,
.pet-choice-dialog::backdrop {
  background: rgb(79 91 73 / 19%);
}

.pet-voice-dialog > header,
.pet-choice-dialog > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pet-voice-dialog > header {
  margin-bottom: 14px;
}

.pet-voice-dialog h3,
.pet-choice-dialog h3 {
  margin: 0;
  color: inherit;
  font: 21px/normal YuzuPop, sans-serif;
}

.pet-voice-dialog h3 {
  font-size: 19px;
  font-weight: 700;
}

.pet-voice-dialog > header > button,
.pet-choice-dialog > header > button {
  display: grid;
  width: 29px;
  height: 29px;
  padding: 4px;
  border: 0.762px solid transparent;
  border-radius: 14px;
  place-items: center;
  color: inherit;
  background: rgb(249 251 243 / 93%);
  font: 22px/normal sans-serif;
}

.pet-voice-dialog > header > button {
  border-color: #dce4d7;
}

.pet-choice-dialog > header > button {
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.pet-voice-presets {
  display: flex;
  margin: 13px 0;
  gap: 9px;
}

.pet-voice-presets button {
  display: grid;
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 10px;
  border: 1px solid #dce4d7;
  border-radius: 14px;
  color: #82947e;
  background: rgb(249 251 243 / 93%);
  box-shadow: 0 3px 10px rgb(101 117 92 / 5%);
  place-items: center;
}

.pet-voice-presets button svg {
  display: block;
  width: 100%;
  height: 100%;
}

.pet-voice-presets button.active,
.pet-voice-presets button[aria-pressed="true"] {
  border-color: #96ae8e;
  color: #65825d;
  background: #e9f0df;
  box-shadow: 0 0 0 2px #dde8d3;
}

.pet-voice-dialog > label,
.pet-voice-more > label {
  display: flex;
  margin: 12px 0;
  gap: 10px;
  align-items: center;
}

.pet-voice-dialog > label > span,
.pet-voice-more > label > span {
  display: block;
  width: 42px;
  flex: none;
}

.pet-voice-dialog input[type="range"] {
  flex: 1;
  min-width: 0;
  width: auto;
  accent-color: #9caf89;
}

.pet-voice-dialog output {
  width: 36px;
  flex: none;
  text-align: right;
  font: 11px sans-serif;
}

.pet-voice-more {
  margin: 14px 0 0;
}

.pet-voice-more summary {
  color: #97a18e;
  cursor: pointer;
  font-size: 12px;
}

.pet-choice-remove {
  min-height: 40px;
  border: 1px solid #dce4d7;
  border-radius: 13px;
  color: #758b71;
  background: #e9f0df;
  font: inherit;
}

.pet-choice-dialog > p {
  color: #7c9285;
  line-height: 1.7;
}

.pet-choice-grid {
  display: grid;
  margin-top: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pet-choice-grid button {
  display: flex;
  min-width: 0;
  padding: 9px;
  border: 1px solid #dce3d4;
  border-radius: 13px;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  color: #748672;
  background: #edf1e7;
  font: inherit;
}

.pet-choice-grid button:disabled {
  opacity: 0.5;
}

.pet-choice-grid canvas {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: contain;
}

.pet-choice-grid strong {
  overflow: hidden;
  max-width: 100%;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pet-choice-remove {
  width: 100%;
  margin-top: 14px;
}

.pet-relations-dialog {
  box-sizing: border-box;
  width: min(340px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: 20px;
  overflow: auto;
  border: 0.762px solid #dce4d7;
  border-radius: 23px;
  color: #748673;
  background: #fbfaf3;
  font: 13px YuzuPop, sans-serif;
}

.pet-relations-dialog:not([open]) {
  display: none;
}

.pet-relations-dialog::backdrop {
  background: rgb(79 91 73 / 19%);
}

.pet-relations-dialog > header {
  display: flex;
  min-height: 29px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.pet-relations-dialog h3 {
  margin: 0;
  color: #748673;
  font: 19px/normal YuzuPop, sans-serif;
}

.pet-relations-dialog > header > button {
  display: grid;
  width: 29px;
  height: 29px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  place-items: center;
  color: #82947e;
  background: transparent;
  font: 22px/normal sans-serif;
}

#petRelationPair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 5px 0 16px;
}

.pet-relations-dialog .pet-relation-avatar {
  display: flex;
  width: 94px;
  min-width: 0;
  padding: 0;
  border: 0;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  color: #82947e;
  background: transparent;
  font: 12px YuzuPop, sans-serif;
}

.pet-relations-dialog .pet-relation-avatar canvas {
  display: block;
  box-sizing: border-box;
  width: 88px;
  height: 88px;
  border: 0;
  border-radius: 50%;
  background: #fffdf8;
}

.pet-relation-avatar span {
  display: block;
  width: 100%;
  overflow: hidden;
  color: #82947e;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pet-relation-arrow {
  padding-bottom: 24px;
  color: #98a58d;
  font: 27px sans-serif;
}

#petRelationAdd {
  width: 70px;
  height: 70px;
  min-width: 70px;
  padding: 0;
  margin-bottom: 23px;
  border: 0;
  border-radius: 50%;
  color: #91a18a;
  background: #eff3e7;
  font: 34px/normal sans-serif;
}

.pet-attitudes {
  display: flex;
  margin: 8px 0 21px;
  justify-content: center;
  gap: 14px;
}

.pet-attitudes button {
  box-sizing: border-box;
  width: 53px;
  height: 66px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: #cc95aa;
  background: transparent;
  font: 21px YuzuPop, sans-serif;
}

.pet-attitudes button svg {
  display: block;
  width: 30px;
  height: 30px;
  margin: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pet-attitudes button[data-relation-kind="awkward"] {
  color: #80b5c8;
}

.pet-attitudes button[data-relation-kind="angry"] {
  color: #cc9287;
}

.pet-attitudes button[aria-pressed="true"] {
  border-color: currentColor;
  background: #f6e9ed;
}

#petRelationshipSave {
  width: 38px;
  height: 38px;
  align-self: center;
  padding: 8px;
  margin-left: 2px;
  border: 1px solid #c6d6b9;
  border-radius: 12px;
  color: #78946d;
  background: #e5eddb;
  font-size: 17px;
}

.pet-relation-editor {
  display: grid;
  gap: 8px;
  padding: 12px 0 4px;
  border-top: 1px solid #e5e9dd;
}

.pet-relation-editor label {
  display: grid;
  margin: 0;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.pet-relation-editor select,
.pet-relation-editor input {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid #dce4d7;
  border-radius: 11px;
  color: inherit;
  background: #fffdf6;
  font: inherit;
}

.pet-relation-existing {
  margin-top: 4px;
}

.pet-relation-existing[hidden] {
  display: none;
}

.pet-relation-existing summary {
  display: flex;
  height: 33px;
  padding: 8px 0;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #97a18e;
  text-align: center;
  font: 12px/normal YuzuPop, sans-serif;
}

.pet-relation-existing summary::-webkit-details-marker {
  display: none;
}

.pet-relation-existing summary span {
  display: block;
}

.pet-relation-existing summary svg {
  display: block;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

#petRelationSwap {
  width: 32px;
  height: 32px;
  flex: none;
  padding: 4px;
  margin-bottom: 24px;
  border: 0;
  color: #93a18b;
  background: transparent;
}
#petRelationSwap svg { width: 100%; height: 100%; }
.pet-relation-avatar.relation-editing { outline: 2px solid #a5b79c; outline-offset: 3px; border-radius: 12px; }
#petRelationPicker {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 12px 0;
  margin-bottom: 12px;
  border-block: 1px solid #e5e9dd;
}
#petRelationPicker .pet-relation-avatar { width: 70px; }
#petRelationPicker .pet-relation-avatar canvas { width: 62px; height: 62px; }
#petRelationPicker .pet-relation-add {
  width: 62px;
  min-height: 62px;
  align-self: flex-start;
  border: 0;
  border-radius: 50%;
  background: #eff3e7;
  color: #91a18a;
  font-size: 32px;
}
.pet-attitudes button > span { display: block; margin-top: 3px; font: 11px/14px YuzuPop, sans-serif; white-space: nowrap; }
#petRelationshipSave:disabled { opacity: .4; cursor: default; }
#petRelationEditor { display: contents; }
#petRelationNote {
  width: 100%;
  min-height: 0;
  margin: -6px 0 16px;
  padding: 10px 12px;
  border: 0.762px solid #dce4d7;
  border-radius: 12px;
  color: #788b70;
  background: #fffdf7;
  font: 13px YuzuPop, sans-serif;
}
#petRelationshipList { max-height: 230px; overflow-y: auto; overscroll-behavior: contain; }
#petRelationshipList .pet-existing-relation {
  display: flex;
  width: 100%;
  height: 57px;
  padding: 5px 12px;
  justify-content: center;
  align-items: center;
  gap: 16px;
  border: 0;
  border-top: 1px solid #e7ebdf;
  border-radius: 0;
  color: #82947e;
  background: transparent;
}
#petRelationshipList .pet-existing-relation canvas { width: 43px; height: 43px; border-radius: 50%; background: #fffdf8; }
#petRelationshipList .pet-existing-feeling { width: 25px; height: 25px; color: #cc95aa; }
#petRelationshipList .pet-existing-feeling.awkward { color: #80b5c8; }
#petRelationshipList .pet-existing-feeling.angry { color: #cc9287; }
#petRelationshipList .pet-existing-feeling svg { width: 100%; height: 100%; }
@media (max-width: 370px) {
  #petRelationPair { gap: 7px; }
  #petRelationPair .pet-relation-avatar { width: 80px; flex: none; }
  #petRelationPair .pet-relation-avatar canvas { width: 75px; height: 75px; }
  .pet-attitudes { gap: 12px; }
}

.pet-inline-fields {
  display: grid;
  margin-top: 8px;
  grid-template-columns: 1fr 1.4fr;
  gap: 6px;
}

.pet-inline-fields label {
  margin-top: 0;
  font-size: 8px;
}

.pet-inline-fields input[type="color"] {
  width: 100%;
  height: 34px;
  margin-top: 4px;
  border: 0;
  background: transparent;
}

.pet-filter-controls {
  display: grid;
  margin-top: 7px;
  gap: 5px;
}

.pet-filter-controls label {
  display: grid;
  margin: 0;
  grid-template-columns: 50px 1fr 38px;
  gap: 7px;
  align-items: center;
  font-size: 8px;
}

.pet-filter-controls output {
  color: var(--muted);
  text-align: right;
}

.pet-control-group > button,
.pet-filter-controls button {
  width: 100%;
  min-height: 32px;
  margin-top: 8px;
  font-size: 8px;
}

.pet-relationship-list {
  display: grid;
  margin-top: 8px;
  gap: 5px;
}

.pet-relationship-list > div {
  display: flex;
  padding: 7px;
  align-items: center;
  justify-content: space-between;
  border-radius: 8px;
  background: #edf1e9;
}

.pet-relationship-list span {
  display: grid;
  gap: 2px;
}

.pet-relationship-list small,
.pet-relationship-list > p {
  margin: 0;
  color: var(--muted);
  font-size: 7px;
}

.pet-relationship-list button {
  min-height: 26px;
  padding: 0 8px;
  font-size: 7px;
}

.pet-foreground-image {
  position: absolute;
  inset: 0;
  z-index: 8;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  transform:
    translate(var(--foreground-shift-x, 0%), var(--foreground-shift-y, 0%))
    scale(var(--foreground-scale, 1));
  transform-origin: center;
}

.pet-room[data-pet-background="solid"] {
  background: var(--pet-solid, #eef1e9) !important;
}

.pet-room[data-pet-background="green"] {
  background: #19b65b !important;
}

.pet-room[data-pet-background="transparent"] {
  background-color: transparent !important;
  background-image:
    linear-gradient(45deg, #e4e6e0 25%, transparent 25%),
    linear-gradient(-45deg, #e4e6e0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e4e6e0 75%),
    linear-gradient(-45deg, transparent 75%, #e4e6e0 75%) !important;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0 !important;
  background-size: 16px 16px !important;
}

.pet-room[data-pet-background="custom"] {
  background-image: var(--pet-custom-background) !important;
  background-position: center !important;
  background-size: cover !important;
}

.pet-instance {
  scale: var(--pet-scale, 1);
  transform-origin: bottom center;
}

.settings-menu {
  display: grid;
  min-height: min(760px, calc(100vh - 155px));
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgb(97 117 104 / 14%);
  border-radius: 22px;
  background: rgb(250 251 246 / 72%);
  box-shadow: var(--shadow);
}

.settings-menu-tabs {
  display: grid;
  padding: 8px;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  border-bottom: 1px solid var(--line);
}

.settings-menu-tabs button {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.settings-menu-tabs button.active {
  color: var(--ink);
  background: #e3ebe3;
}

.settings-menu-scroll {
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
}

.settings-pane {
  display: grid;
  gap: 13px;
}

.settings-pane-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.settings-pane-heading.compact {
  align-items: center;
}

.settings-pane-heading small {
  color: var(--muted);
  font-size: 7px;
  letter-spacing: 0.14em;
}

.settings-pane-heading h3 {
  margin: 2px 0 0;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 26px;
  font-weight: 500;
}

.settings-pane-heading > span {
  color: var(--muted);
  font-size: 8px;
  text-align: right;
}

.settings-volume-grid,
.voice-design-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 16px;
}

.voice-design-card {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgb(255 255 255 / 50%);
}

.voice-design-grid {
  margin-top: 11px;
}

.voice-design-grid label {
  display: grid;
  gap: 5px;
  color: var(--ink);
  font-size: 9px;
}

.voice-design-grid label > span {
  display: flex;
  justify-content: space-between;
}

.voice-design-grid label > small {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 7px;
}

.voice-design-grid label > small i {
  font-style: normal;
}

.voice-design-grid output {
  color: var(--muted);
}

.settings-home-music {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgb(255 255 255 / 44%);
}

.settings-home-music small {
  color: var(--muted);
  font-size: 8px;
}

.voice-preset-row {
  display: flex;
  gap: 7px;
  margin-top: 11px;
  flex-wrap: wrap;
}

.voice-preset-row button,
.voice-stage-grid button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.voice-preset-row button.active,
.voice-stage-grid button.active {
  border-color: var(--green-dark);
  background: var(--green-pale);
  box-shadow: inset 0 0 0 1px var(--green-dark);
}

.voice-preset-note {
  min-height: 1.5em;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 8px;
}

.voice-stage-picker {
  display: grid;
  margin-top: 12px;
  grid-template-columns: minmax(120px, 0.8fr) minmax(180px, 1.2fr);
  gap: 10px 16px;
  align-items: center;
}

.voice-stage-picker > div:first-child {
  display: grid;
  gap: 3px;
}

.voice-stage-picker > div:first-child small {
  color: var(--muted);
  font-size: 7px;
  letter-spacing: 0.12em;
}

.voice-stage-preview {
  position: relative;
  min-height: 92px;
  grid-column: 1;
  grid-row: 2;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 86%, #fff 0 12%, transparent 13%),
    linear-gradient(145deg, #fbfaef 0 60%, #e6eed5 60%);
}

.voice-stage-preview::before {
  position: absolute;
  inset: 8px 12px auto;
  height: 35%;
  border-radius: 50% 50% 8px 8px;
  background: #bdde93;
  content: "";
}

.voice-stage-preview i {
  position: absolute;
  left: 50%;
  bottom: 16px;
  width: 22px;
  height: 32px;
  border-radius: 45% 45% 40% 40%;
  background: var(--green-dark);
  transform: translateX(-50%);
}

.voice-stage-preview span {
  position: absolute;
  left: 50%;
  bottom: 11px;
  width: 48px;
  height: 10px;
  border-radius: 50%;
  background: var(--pink);
  transform: translateX(-50%);
}

.voice-stage-preview b {
  position: absolute;
  top: 18px;
  right: 18px;
  color: #fff;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
}

.voice-stage-preview[data-stage-theme="mist"] {
  background:
    radial-gradient(circle at 23% 23%, #f8e7dc 0 12%, transparent 13%),
    radial-gradient(circle at 74% 18%, #fff4e8 0 2%, transparent 3%),
    linear-gradient(145deg, #f4f9f9, #bad9df);
}

.voice-stage-preview[data-stage-theme="mist"]::before {
  background: #a0cbd2;
}

.voice-stage-preview[data-stage-theme="mint"] {
  background:
    repeating-linear-gradient(90deg, transparent 0 22px, rgb(255 255 255 / 55%) 23px 24px),
    linear-gradient(145deg, #f3f9f8, #a0cbd2);
}

.voice-stage-preview[data-stage-theme="mint"]::before {
  background: #d4e7e8;
}

.voice-stage-preview[data-stage-theme="peach"] {
  background:
    linear-gradient(90deg, #fae6e7 0 16%, transparent 16% 84%, #fae6e7 84%),
    linear-gradient(145deg, #fff, #f5c7c9);
}

.voice-stage-preview[data-stage-theme="peach"]::before {
  background: #b9d9ea;
}

.voice-stage-grid {
  display: grid;
  grid-column: 2;
  grid-row: 2;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.voice-stage-grid button {
  display: flex;
  padding: 5px 8px;
  justify-content: flex-start;
  gap: 7px;
  border-radius: 11px;
}

.voice-stage-grid button i {
  width: 24px;
  height: 18px;
  flex: none;
  border-radius: 5px;
  background: linear-gradient(145deg, #fbfaef, #bdde93);
}

.voice-stage-grid button:nth-child(2) i { background: linear-gradient(145deg, #f4f9f9, #a0cbd2); }
.voice-stage-grid button:nth-child(3) i { background: linear-gradient(90deg, #d4e7e8 35%, #a0cbd2 35%); }
.voice-stage-grid button:nth-child(4) i { background: linear-gradient(145deg, #fff, #f5c7c9 55%, #b9d9ea 55%); }

.voice-stage-grid button span {
  font-size: 8px;
}

.settings-action-row {
  display: flex;
  margin-top: 11px;
  gap: 6px;
  flex-wrap: wrap;
}

.settings-action-row button,
.settings-data-row button,
.settings-icon-footer button,
.language-choice-grid button,
.settings-pane > button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.settings-action-row button:first-child {
  color: #fff;
  background: var(--green-dark);
}

.settings-advanced {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.settings-advanced summary {
  cursor: pointer;
}

.settings-advanced p {
  color: var(--muted);
  font-size: 8px;
}

.settings-compat-select {
  max-width: 420px;
  margin-top: 7px;
}

.language-choice-grid {
  display: grid;
  max-width: 540px;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.language-choice-grid button {
  display: grid;
  min-height: 88px;
  place-content: center;
  gap: 5px;
}

.language-choice-grid button b {
  font-size: 22px;
}

.language-choice-grid button span {
  color: var(--muted);
  font-size: 9px;
}

.language-choice-grid button.active {
  border-color: #708b7b;
  background: #e5ece5;
}

.settings-help {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
}

.settings-icon-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.settings-icon-card {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 17px;
  color: var(--green-dark);
  background: #fff;
  cursor: pointer;
  place-content: center;
  gap: 4px;
}

.settings-icon-card img {
  width: 100%;
  height: 100%;
  border-radius: 13px;
  object-fit: cover;
}

.settings-icon-card > span {
  font-size: 30px;
}

.settings-icon-card small {
  color: var(--muted);
  font-size: 6px;
}

.settings-icon-card.active {
  border: 2px solid #6d8978;
}

.settings-icon-card.dragging {
  opacity: 0.4;
}

.settings-icon-footer {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 10px;
}

.settings-icon-footer > button:first-child {
  flex: 1;
}

.settings-icon-trash {
  display: grid;
  min-width: 150px;
  color: var(--muted) !important;
  place-content: center;
  gap: 2px;
  border-style: dashed !important;
}

.settings-icon-trash.active {
  color: #986363 !important;
  background: #f3e2e2 !important;
}

.settings-icon-trash small {
  font-size: 7px;
}

.settings-letter {
  position: relative;
  display: grid;
  min-height: 250px;
  padding: 34px;
  place-content: center;
  border: 1px solid #d8d1c1;
  border-radius: 10px;
  color: #5d665f;
  background:
    linear-gradient(90deg, transparent 28px, rgb(176 153 156 / 13%) 29px, transparent 30px),
    repeating-linear-gradient(#fbf3df 0 27px, #e8ddc6 28px);
  box-shadow: 0 18px 40px rgb(92 79 54 / 10%);
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 17px;
  line-height: 1.75;
  transform: rotate(-0.5deg);
}

.settings-letter.opened {
  animation: letter-open 420ms ease both;
}

.settings-letter-mark {
  position: absolute;
  top: 20px;
  right: 24px;
  color: #c58f9f;
  font-size: 25px;
}

.settings-letter p {
  margin: 4px 0;
}

.settings-letter b {
  margin-top: 12px;
  color: #7b857f;
  font-size: 11px;
  text-align: right;
}

@keyframes letter-open {
  from { transform: translateY(20px) rotate(-1.5deg); opacity: 0; }
  to { transform: rotate(-0.5deg); opacity: 1; }
}

.settings-theme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.settings-theme-card {
  display: grid;
  min-height: 92px;
  padding: 8px;
  grid-template-columns: 54px 1fr;
  gap: 9px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.settings-theme-card i {
  width: 54px;
  height: 70px;
  border-radius: 10px;
  background: linear-gradient(150deg, #f5f4eb, #b9cbb9);
}

.settings-theme-card i[data-preview-theme="original"] { background: linear-gradient(150deg, #f6f5ef, #9db4a7 62%, #e9dcde); }
.settings-theme-card i[data-preview-theme="berry"] { background: linear-gradient(150deg, #fcf7f4, #adc9bc 62%, #efdce0); }
.settings-theme-card i[data-preview-theme="mist"] { background: linear-gradient(150deg, #f7f6fb, #a7afd2 62%, #e8e0ec); }
.settings-theme-card i[data-preview-theme="linen"] { background: linear-gradient(150deg, #f8f5ef, #b9aea0 62%, #e5ddd2); }
.settings-theme-card i[data-preview-theme="silver"] { background: linear-gradient(150deg, #faf6f8, #b9afb7 62%, #e8dce2); }
.settings-theme-card i[data-preview-theme="citrus"] { background: linear-gradient(150deg, #f9f8f0, #bec7a0 62%, #e9e2c9); }

.settings-theme-card span {
  display: grid;
  gap: 4px;
}

.settings-theme-card small {
  color: var(--muted);
  font-size: 7px;
}

.settings-theme-card.active {
  border: 2px solid #708c7a;
  background: #e8efe8;
}

.settings-data-row {
  display: flex;
  gap: 7px;
}

.settings-legal-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.settings-legal-row button {
  padding: 4px 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-dialog {
  box-sizing: border-box;
  width: min(620px, calc(100vw - 28px));
  max-height: min(720px, calc(100dvh - 30px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--ink);
  background: #f6f5ef;
  box-shadow: 0 18px 70px rgb(53 72 59 / 20%);
}

.consent-gate {
  box-sizing: border-box;
  width: min(480px, calc(100vw - 28px));
  max-height: calc(100dvh - 32px);
  padding: 26px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 14%, rgb(230 212 218 / 44%), transparent 25%),
    #f6f5ef;
  box-shadow: 0 18px 70px rgb(53 72 59 / 20%);
}

.consent-gate::backdrop {
  background: rgb(70 83 71 / 53%);
}

.consent-gate-mark {
  display: grid;
  width: 46px;
  height: 46px;
  margin-bottom: 13px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-size: 23px;
}

.consent-gate > small {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.15em;
}

.consent-gate h2 {
  margin: 4px 0 16px;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 27px;
  font-weight: 500;
}

.consent-gate p {
  margin: 9px 0;
  font-size: 12px;
  line-height: 1.8;
}

.consent-gate a {
  color: var(--green-dark);
}

.consent-gate > div {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.consent-gate > div button {
  min-height: 42px;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.consent-gate > div button:last-child {
  color: #fff;
  background: var(--green-dark);
}

.consent-gate output {
  display: block;
  margin-top: 11px;
  color: #9a6a70;
  font-size: 9px;
}

.legal-dialog::backdrop {
  background: rgb(70 83 71 / 52%);
}

.legal-dialog header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--line);
  background: #f6f5ef;
}

.legal-dialog header small {
  color: var(--muted);
  font-size: 7px;
  letter-spacing: 0.16em;
}

.legal-dialog header h2 {
  margin: 3px 0 0;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 25px;
  font-weight: 500;
}

.legal-dialog header button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  background: var(--green-pale);
  cursor: pointer;
  font-size: 22px;
}

.legal-dialog article {
  box-sizing: border-box;
  max-height: calc(100dvh - 190px);
  padding: 18px 24px 24px;
  overflow: auto;
  line-height: 1.75;
}

.legal-dialog article h3 {
  margin: 0 0 12px;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 22px;
  font-weight: 500;
}

.legal-dialog article h4 {
  margin: 18px 0 5px;
  font-size: 14px;
}

.legal-dialog article p {
  margin: 7px 0;
  font-size: 12px;
}

.legal-dialog article a {
  color: var(--green-dark);
}

.legal-dialog .legal-notice {
  padding: 10px 12px;
  border: 1px solid #ddc7ca;
  border-radius: 11px;
  background: #f5e8e9;
}

.legal-dialog footer {
  display: flex;
  padding: 12px 22px 18px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
}

.legal-dialog footer a {
  color: var(--green-dark);
  font-size: 10px;
}

.legal-dialog footer button {
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: var(--green-dark);
  cursor: pointer;
}

.settings-menu-footer {
  display: flex;
  padding: 12px 20px;
  justify-content: space-between;
  border-top: 1px solid var(--line);
}

.settings-menu-footer button {
  min-height: 38px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  cursor: pointer;
}

.settings-menu-footer button:last-child {
  color: #fff;
  background: var(--green-dark);
}

body[data-theme="original"] {
  --ink: #53675b;
  --muted: #7d8b80;
  --canvas: #f6f5ef;
  --green: #9db4a7;
  --green-dark: #687f70;
  --green-pale: #ecefe7;
  --pink: #e9dcde;
  background-color: #f6f5ef;
}

body[data-theme="berry"] {
  --ink: #52655a;
  --muted: #828d83;
  --canvas: #fcf7f4;
  --green: #adc9bc;
  --green-dark: #668777;
  --green-pale: #edf0e9;
  --pink: #efdce0;
  background-color: #fcf7f4;
}

body[data-theme="mist"] {
  --ink: #555c78;
  --muted: #85889d;
  --canvas: #f7f6fb;
  --green: #a7afd2;
  --green-dark: #6d7595;
  --green-pale: #ebeaf3;
  --pink: #e8e0ec;
  background-color: #f7f6fb;
}

body[data-theme="linen"] {
  --ink: #5f574e;
  --muted: #8e8478;
  --canvas: #f8f5ef;
  --green: #b9aea0;
  --green-dark: #877b6d;
  --green-pale: #eee9e0;
  --pink: #e5ddd2;
  background-color: #f8f5ef;
}

body[data-theme="silver"] {
  --ink: #625b63;
  --muted: #938991;
  --canvas: #faf6f8;
  --green: #b9afb7;
  --green-dark: #877d85;
  --green-pale: #efeaed;
  --pink: #e8dce2;
  background-color: #faf6f8;
}

body[data-theme="citrus"] {
  --ink: #61684f;
  --muted: #8e947a;
  --canvas: #f9f8f0;
  --green: #bec7a0;
  --green-dark: #818968;
  --green-pale: #edf0e1;
  --pink: #e9e2c9;
  background-color: #f9f8f0;
}

@media (max-width: 1050px) {
  .game-stage-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 850px) {
  body[data-route="home"] .site-header {
    min-height: 58px;
  }

  .yu-home {
    min-height: calc(100vh - 62px);
    padding: 18px 12px;
  }

  .yu-home-heading h1 {
    font-size: clamp(58px, 19vw, 92px);
  }

  .yu-home-stage {
    width: min(100%, 500px);
    height: clamp(290px, 43vh, 410px);
  }

  .wardrobe-stage-actions {
    top: 8px;
    left: 8px;
  }

  .wardrobe-stage-actions button {
    min-height: 30px;
    padding: 0 8px;
  }

  .settings-menu {
    min-height: calc(100dvh - 72px);
    border-radius: 16px;
  }
}

@media (max-width: 520px) {
  body[data-route="home"] .site-header {
    display: none;
  }

  body[data-route="home"] {
    background: #f6f5ef;
  }

  body[data-route="home"]::before {
    display: none;
  }

  body[data-route="home"] .app-frame {
    padding: 0;
  }

  .yu-home {
    min-height: 100dvh;
    padding: max(114.143px, env(safe-area-inset-top)) 30px max(12px, env(safe-area-inset-bottom));
    gap: 2px;
  }

  .yu-home-topline {
    min-height: 38px;
  }

  .yu-pill {
    height: 36.524px;
    min-height: 36.524px;
    padding: 0 12.762px;
    gap: 5px;
    border-radius: 15px;
    font-size: 10px;
  }

  .yu-pill svg {
    width: 19px;
    height: 19px;
  }

  .yu-menu-button {
    width: 34px;
    height: 34px;
    padding: 8px;
    gap: 4px;
  }

  .yu-menu-button span {
    width: 15px;
  }

  .yu-home-signature {
    font-size: 13px;
    letter-spacing: 0.09em;
  }

  .yu-home-heading {
    padding-top: 4.149px;
  }

  .yu-home-heading h1 {
    font-size: 78px;
    line-height: 1.1;
    margin: 10px 0 7px;
    gap: 5px;
    letter-spacing: 2px;
    transform: none;
  }

  .yu-home-heading p {
    font-size: 10px;
    letter-spacing: 1.4px;
  }

  .yu-home-heading > span {
    font-size: 14px;
    letter-spacing: 1px;
    line-height: 1.5;
  }

  .yu-home-stage {
    width: 100%;
    height: 246px;
    min-height: 246px;
    margin-top: 6px;
  }

  .yu-home-stage #homeCanvas {
    inset: -19px auto auto 50%;
    width: min(62vw, 185px);
    height: auto;
    aspect-ratio: 1525 / 2048;
    transform: translateX(-50%);
  }

  .yu-home-stage .hanger-button {
    bottom: 1%;
    width: 42px;
    height: 42px;
  }

  .yu-home-stage .hanger-button svg {
    width: 25px;
    height: 25px;
  }

  .yu-stage-look {
    display: none;
  }

  .yu-home-actions {
    width: min(100%, 290px);
    margin-top: 6px;
    padding: 2.5px 0;
    gap: 10px;
  }

  .yu-main-action {
    min-height: 53px;
    border-radius: 16px;
    font-size: 19px;
  }

  .yu-secondary-actions {
    gap: 8px;
  }

  .yu-secondary-actions button {
    min-height: 38px;
    border-radius: 12px;
    font-size: 13px;
  }

  .yu-home-achievements {
    margin-top: 6px;
    gap: 0;
    line-height: 10px;
    font-size: 10px;
  }

  .yu-home-language-note {
    margin: 10px 0 0;
    font-size: 10px;
    line-height: 15px;
  }

  .yu-decor-star {
    top: 24%;
    left: 6%;
    width: 34px;
    height: 34px;
  }

  .yu-decor-ring {
    display: none;
  }

  .yu-decor-candy {
    display: none;
  }

  .yu-decor-gift.left {
    top: 65%;
    right: 14%;
    bottom: auto;
    width: 35px;
    height: 35px;
  }

  .yu-decor-gift.right {
    top: 27%;
    right: 11%;
    width: 40px;
    height: 40px;
  }

  .yu-decor-cake {
    bottom: 18%;
    left: 5%;
    width: 30px;
    height: 30px;
  }

  .wardrobe-stage-actions {
    grid-template-columns: 1fr;
  }

  .wardrobe-stage-actions button {
    width: 76px;
    max-width: 76px;
    font-size: 8px;
  }

  .preview-actions .wardrobe-tool span {
    display: none;
  }

  .wardrobe-tool {
    width: 32px;
    justify-content: center;
  }

  .part-import-dialog {
    width: calc(100vw - 12px);
    max-height: 94dvh;
    border-radius: 16px;
  }

  .part-import-dialog form {
    max-height: 94dvh;
  }

  .part-import-scroll {
    padding: 10px 12px;
  }

  .part-import-dialog header,
  .part-import-dialog footer {
    padding: 10px 12px;
  }

  .game-stage-strip {
    padding-bottom: 6px;
  }

  .game-stage-list {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .game-stage-list::-webkit-scrollbar {
    display: none;
  }

  .game-stage-card {
    min-width: 132px;
  }

  .game-result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .game-result-actions button:last-child {
    grid-column: 1 / -1;
  }

  .settings-menu {
    min-height: calc(100dvh - 61px);
  }

  .settings-menu-tabs {
    padding: 5px;
    gap: 2px;
  }

  .settings-menu-tabs button {
    min-height: 36px;
    padding: 0 3px;
    font-size: 9px;
  }

  .settings-menu-scroll {
    padding: 12px;
  }

  .settings-pane-heading h3 {
    font-size: 22px;
  }

  .settings-pane-heading > span {
    max-width: 45%;
  }

  .settings-volume-grid,
  .voice-design-grid {
    gap: 8px 10px;
  }

  .voice-stage-picker {
    grid-template-columns: 1fr;
  }

  .voice-stage-preview,
  .voice-stage-grid {
    grid-column: 1;
  }

  .voice-stage-preview {
    grid-row: auto;
    min-height: 82px;
  }

  .voice-stage-grid {
    grid-row: auto;
  }

  .settings-icon-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .settings-icon-card {
    max-width: 86px;
  }

  .settings-theme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-theme-card {
    min-height: 78px;
    grid-template-columns: 42px 1fr;
  }

  .settings-theme-card i {
    width: 42px;
    height: 60px;
  }

  .settings-icon-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .settings-icon-trash {
    min-width: 0;
  }

  .settings-letter {
    min-height: 220px;
    padding: 24px;
    font-size: 14px;
  }

  .settings-data-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .pet-background-choices {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 321px) and (max-width: 370px) and (min-height: 621px) {
  body[data-route="home"] .yu-home {
    padding-top: clamp(60px, calc(50dvh - 307px), 114.143px);
  }
}

@media (max-height: 620px) and (max-width: 520px) {
  .yu-home {
    padding: max(38.5px, env(safe-area-inset-top)) 30px max(10px, env(safe-area-inset-bottom));
    gap: 2px;
  }

  /* Android 2.175 short-portrait CSS gives the home puppet a 135px box and
     translates it 10px up. Our full-body canvas draws into ~70% of its own
     height, so 210px of backing space makes the visible puppet ~145px tall.
     Keep the portrait flow and all button hit areas at their original spots. */
  body[data-route="home"] .yu-home-character-pane {
    position: relative;
    z-index: 2;
  }

  body[data-route="home"] .yu-home-operation-pane {
    position: relative;
    z-index: 3;
  }

  body[data-route="home"] .yu-home-stage {
    height: 174px;
    min-height: 174px;
    margin-top: 4px;
  }

  body[data-route="home"] .yu-home-stage #homeCanvas {
    top: -14px;
    width: min(66%, 198px);
    height: 179px;
  }

  body[data-route="home"] .yu-home-stage .hanger-button {
    z-index: 6;
  }

  .yu-home-topline {
    min-height: 32px;
    height: 32px;
  }

  .yu-pill {
    height: 32px;
    min-height: 32px;
    padding: 0 12px;
  }

  .yu-menu-button {
    width: 32px;
    height: 32px;
    padding: 8px;
  }

  .yu-home-heading {
    height: 120px;
    padding-top: 3.37px;
  }

  .yu-home-heading h1 {
    margin: 7px 0 5px;
    font-size: 66px;
  }

  .yu-home-heading p {
    font-size: 9px;
  }

  .yu-home-heading > span {
    font-size: 13px;
  }

  .yu-home-stage {
    height: 174px;
    min-height: 174px;
    margin-top: 4px;
  }

  .yu-home-stage #homeCanvas {
    width: min(66%, 176px);
    height: 160px;
  }

  .yu-home-stage .hanger-button {
    width: 36px;
    height: 36px;
  }

  .yu-stage-look {
    display: none;
  }

  .yu-home-actions {
    width: 100%;
    height: 92px;
    margin-top: 4px;
    padding: 3px 0;
    column-gap: 10px;
    row-gap: 8px;
    grid-template-rows: 46px 32px;
  }

  .yu-main-action {
    min-height: 46px;
    font-size: 19px;
  }

  .yu-secondary-actions button {
    min-height: 32px;
    font-size: 14px;
  }

  .yu-home-achievements {
    margin-top: 4px;
    height: 26px;
  }

  .yu-home-language-note {
    margin-top: 8px;
    font-size: 9px;
    line-height: 15px;
  }

  .yu-home-achievements > .yu-home-best {
    top: 14px;
  }

  .yu-home-achievements > span:nth-child(3) {
    top: 27px;
  }

  .wardrobe-stage-actions button span {
    display: none;
  }

  .wardrobe-stage-actions button {
    width: 30px;
    height: 30px;
    padding: 0;
    justify-content: center;
  }

  .settings-volume-grid,
  .voice-design-grid {
    grid-template-columns: 1fr;
  }

  .voice-stage-grid {
    grid-template-columns: 1fr;
  }

  .voice-stage-grid button {
    min-height: 38px;
  }

  .settings-theme-grid {
    grid-template-columns: 1fr;
  }

  .settings-theme-card {
    min-height: 68px;
  }

  .settings-letter {
    min-height: 190px;
    padding: 18px;
  }

  .pet-background-choices {
    grid-template-columns: repeat(2, 1fr);
  }
}

.outfit-quick-button.active {
  border-color: #728c7a;
  color: #fff;
  background: #728c7a;
}

.outfit-quick-button.active b {
  color: #64786a;
  background: #fff;
}

.outfit-toolbar {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: flex-end;
}

.outfit-toolbar button {
  min-height: 35px;
  padding: 0 12px;
  border: 1px solid #dce3da;
  border-radius: 10px;
  color: #66796d;
  background: #fff;
  font-size: 9px;
  white-space: nowrap;
  cursor: pointer;
}

.outfit-toolbar button:first-child {
  border-color: #718b79;
  color: #fff;
  background: #718b79;
}

.outfit-toolbar button:hover,
.outfit-toolbar button:focus-visible {
  border-color: #9aad9e;
  background: #f3f7f1;
}

.outfit-toolbar button:first-child:hover,
.outfit-toolbar button:first-child:focus-visible {
  background: #627c6a;
}

.catalog-grid.outfit-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.outfit-new-slot,
.outfit-card,
.outfit-empty-state {
  min-width: 0;
  border: 1px solid #dfe5dc;
  border-radius: 17px;
  background: #faf9f4;
}

.outfit-new-slot {
  display: grid;
  min-height: 238px;
  padding: 18px;
  border-style: dashed;
  color: #7b8d80;
  background:
    radial-gradient(circle at 50% 38%, rgb(255 255 255 / 88%) 0 20%, transparent 55%),
    #f5f8f2;
  place-content: center;
  text-align: center;
  cursor: pointer;
}

.outfit-new-slot > b {
  display: grid;
  width: 46px;
  height: 46px;
  margin: 0 auto 10px;
  border-radius: 50%;
  color: #fff;
  background: #829a89;
  font: 25px/1 "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  place-items: center;
}

.outfit-new-slot > span {
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 17px;
}

.outfit-new-slot > small {
  max-width: 190px;
  margin: 7px auto 0;
  color: #9aa69e;
  font-size: 8px;
  line-height: 1.55;
}

.outfit-new-slot:disabled {
  cursor: default;
  opacity: 0.48;
}

.outfit-empty-state {
  display: grid;
  grid-column: 1 / -1;
  min-height: 238px;
  padding: 22px;
  place-content: center;
  text-align: center;
}

.outfit-empty-state b,
.outfit-empty-state span {
  display: block;
}

.outfit-empty-state b {
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 18px;
  font-weight: 400;
}

.outfit-empty-state span {
  max-width: 270px;
  margin-top: 8px;
  color: #929f97;
  font-size: 9px;
  line-height: 1.65;
}

.outfit-card {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.outfit-card:hover {
  border-color: #b9c8bc;
  transform: translateY(-2px);
  box-shadow: 0 11px 28px rgb(54 75 62 / 8%);
}

.outfit-card.is-current {
  border-color: #88a18f;
  box-shadow: inset 0 0 0 1px #88a18f;
}

.outfit-card-load {
  display: grid;
  grid-template-rows: minmax(130px, 1fr) auto;
  min-width: 0;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.outfit-card-preview {
  position: relative;
  display: block;
  min-height: 158px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, rgb(255 255 255 / 90%) 0 26%, transparent 52%),
    linear-gradient(155deg, #eaf1e7, #f4eaed);
}

.outfit-card-preview::before {
  position: absolute;
  right: 12%;
  bottom: 8%;
  left: 12%;
  height: 16%;
  border-radius: 50%;
  background: rgb(79 98 85 / 8%);
  content: "";
  filter: blur(7px);
}

.outfit-card-preview canvas {
  position: absolute;
  right: 6%;
  bottom: -4%;
  z-index: 1;
  width: 88%;
  height: 112%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 180ms ease;
}

.outfit-card-preview canvas.is-ready {
  opacity: 1;
}

.outfit-current-badge {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 2;
  padding: 4px 8px;
  border-radius: 999px;
  color: #fff;
  background: rgb(87 116 96 / 88%);
  font-size: 7px;
  letter-spacing: 0.4px;
}

.outfit-card-copy {
  display: block;
  min-width: 0;
  padding: 10px 11px 9px;
}

.outfit-card-copy b,
.outfit-card-copy small,
.outfit-card-copy time {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outfit-card-copy b {
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 15px;
  font-weight: 400;
}

.outfit-card-copy small {
  margin-top: 4px;
  color: #839188;
  font-size: 8px;
}

.outfit-card-copy time {
  margin-top: 4px;
  color: #a0aaa3;
  font-size: 7px;
}

.outfit-card-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid #e5e8e1;
}

.outfit-card-actions button {
  min-width: 0;
  min-height: 36px;
  padding: 0 4px;
  border: 0;
  border-right: 1px solid #e8e9e3;
  color: #6d7f73;
  background: #fffdfa;
  font-size: 8px;
  cursor: pointer;
}

.outfit-card-actions button:last-child {
  border-right: 0;
}

.outfit-card-actions button:first-child {
  color: #fff;
  background: #809789;
}

.outfit-card-actions button.danger {
  color: #9b6e76;
}

.outfit-card-actions button:hover,
.outfit-card-actions button:focus-visible {
  background: #edf3ea;
}

.outfit-card-actions button:first-child:hover,
.outfit-card-actions button:first-child:focus-visible {
  background: #6f8877;
}

.outfit-dialog {
  width: min(520px, calc(100vw - 24px));
  max-height: min(760px, calc(100dvh - 24px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgb(91 111 97 / 20%);
  border-radius: 22px;
  color: var(--ink);
  background: #fbfaf5;
  box-shadow: 0 28px 90px rgb(30 45 35 / 25%);
}

.outfit-import-dialog {
  width: min(760px, calc(100vw - 24px));
}

.outfit-dialog::backdrop {
  background: #cbd6c8;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.outfit-dialog > form,
.outfit-dialog > div {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(760px, calc(100dvh - 24px));
}

.outfit-dialog header {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 17px 19px 14px;
  border-bottom: 1px solid #e0e5dc;
  background: rgb(251 250 245 / 94%);
}

.outfit-dialog header small,
.outfit-dialog header h2 {
  display: block;
  margin: 0;
}

.outfit-dialog header small {
  color: #86958a;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 1.7px;
}

.outfit-dialog header h2 {
  margin-top: 3px;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 23px;
  font-weight: 400;
}

.outfit-dialog header > button {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #dbe2d9;
  border-radius: 11px;
  color: #7b8c80;
  background: #fff;
  font-size: 19px;
  cursor: pointer;
  place-items: center;
}

.outfit-dialog-body {
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.outfit-dialog-body > p {
  margin: 0;
  color: #718177;
  font-size: 11px;
  line-height: 1.75;
}

.outfit-field {
  position: relative;
  display: grid;
  gap: 7px;
  color: #6e8074;
  font-size: 9px;
}

.outfit-field input {
  width: 100%;
  min-height: 45px;
  padding: 0 46px 0 12px;
  border: 1px solid #d8e0d6;
  border-radius: 12px;
  outline: 0;
  color: #344b3f;
  background: #fff;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 17px;
}

.outfit-field input:focus {
  border-color: #8ca292;
  box-shadow: 0 0 0 3px rgb(113 139 121 / 12%);
}

.outfit-field input[aria-invalid="true"] {
  border-color: #b67d86;
  box-shadow: 0 0 0 3px rgb(178 114 125 / 10%);
}

.outfit-field > small {
  position: absolute;
  right: 11px;
  bottom: 16px;
  color: #9ba79f;
  font-size: 7px;
}

.outfit-field > small b {
  font-weight: 500;
}

.outfit-dialog-help,
.outfit-form-error {
  margin: 8px 1px 0 !important;
  color: #8a9890 !important;
  font-size: 8px !important;
}

.outfit-form-error {
  margin-top: 10px !important;
  padding: 8px 10px;
  border-radius: 9px;
  color: #925f69 !important;
  background: #fff0f2;
}

.outfit-dialog footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 13px 18px 16px;
  border-top: 1px solid #e3e6df;
  background: #f6f6f1;
}

.outfit-dialog footer button {
  min-height: 39px;
  padding: 0 15px;
  border: 1px solid #d8dfd5;
  border-radius: 10px;
  color: #6f8075;
  background: #fff;
  font-size: 9px;
  cursor: pointer;
}

.outfit-dialog footer button[type="submit"],
.outfit-dialog footer button:last-child:not(.danger) {
  border-color: #708b78;
  color: #fff;
  background: #708b78;
}

.outfit-dialog footer button.danger {
  border-color: #a9757e;
  color: #fff;
  background: #a9757e;
}

.outfit-dialog footer button:disabled {
  cursor: default;
  opacity: 1;
  color: #657064;
  background: #edf0e8;
}

.outfit-import-layout {
  display: grid;
  grid-template-columns: minmax(190px, 0.72fr) minmax(240px, 1.28fr);
  gap: 18px;
  padding: 18px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.outfit-import-preview {
  position: relative;
  min-height: 275px;
  overflow: hidden;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 45%, rgb(255 255 255 / 88%) 0 24%, transparent 54%),
    linear-gradient(155deg, #eaf2e8, #f5e9ec);
}

.outfit-import-preview canvas {
  position: absolute;
  right: 1%;
  bottom: -9%;
  width: 98%;
  height: 116%;
  object-fit: contain;
}

.outfit-import-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
}

.outfit-import-copy > p {
  margin: 12px 1px 0;
  color: #819087;
  font-size: 9px;
  line-height: 1.65;
}

@media (max-width: 1160px) {
  .catalog-grid.outfit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 850px) {
  .outfit-toolbar button {
    min-height: 33px;
    padding: 0 9px;
  }

  .outfit-card-preview {
    min-height: 145px;
  }
}

@media (max-width: 520px) {
  .outfit-quick-button span {
    display: none;
  }

  .outfit-quick-button {
    padding: 0 8px;
  }

  .catalog-heading {
    gap: 8px;
    align-items: flex-start;
  }

  .catalog-heading.is-outfit-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .catalog-heading.is-outfit-heading .outfit-toolbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .catalog-heading.is-outfit-heading .outfit-toolbar button {
    width: 100%;
  }

  .catalog-grid.outfit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .outfit-toolbar {
    gap: 4px;
  }

  .outfit-toolbar button {
    min-height: 31px;
    padding: 0 8px;
    font-size: 8px;
  }

  .outfit-new-slot,
  .outfit-card,
  .outfit-empty-state {
    border-radius: 14px;
  }

  .outfit-new-slot {
    min-height: 190px;
    padding: 11px;
  }

  .outfit-new-slot > b {
    width: 38px;
    height: 38px;
    font-size: 21px;
  }

  .outfit-new-slot > span {
    font-size: 14px;
  }

  .outfit-new-slot > small {
    font-size: 7px;
  }

  .outfit-empty-state {
    min-height: 190px;
    padding: 14px;
  }

  .outfit-card-load {
    grid-template-rows: minmax(116px, 1fr) auto;
  }

  .outfit-card-preview {
    min-height: 126px;
  }

  .outfit-card-copy {
    padding: 8px;
  }

  .outfit-card-copy b {
    font-size: 13px;
  }

  .outfit-card-copy small {
    font-size: 7px;
  }

  .outfit-card-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .outfit-card-actions button {
    min-height: 38px;
    border-bottom: 1px solid #e8e9e3;
  }

  .outfit-card-actions button:nth-child(2) {
    border-right: 0;
  }

  .outfit-card-actions button:nth-child(n + 3) {
    border-bottom: 0;
  }

  .outfit-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 18px;
  }

  .outfit-dialog > form,
  .outfit-dialog > div {
    max-height: calc(100dvh - 16px);
  }

  .outfit-dialog header {
    padding: 13px 13px 10px;
  }

  .outfit-dialog header h2 {
    font-size: 19px;
  }

  .outfit-dialog-body {
    padding: 14px;
  }

  .outfit-dialog footer {
    padding: 10px 12px 12px;
  }

  .outfit-dialog footer button {
    min-height: 40px;
    padding: 0 12px;
  }

  .outfit-import-dialog > div {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .outfit-import-layout {
    grid-template-columns: minmax(112px, 0.65fr) minmax(0, 1.35fr);
    gap: 10px;
    padding: 11px;
  }

  .outfit-import-preview {
    min-height: 220px;
  }

  .outfit-import-copy > p {
    font-size: 8px;
  }

  .outfit-import-dialog footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .outfit-import-dialog footer button:first-child {
    display: none;
  }
}

@media (max-width: 850px) and (max-height: 700px) {
  .outfit-card-preview {
    min-height: 112px;
  }

  .outfit-new-slot,
  .outfit-empty-state {
    min-height: 165px;
  }

  .outfit-import-preview {
    min-height: 185px;
  }

  .outfit-dialog-body,
  .outfit-import-layout,
  .outfit-dialog > form > .outfit-dialog-body {
    overflow-y: auto;
  }
}

body[data-motion="reduce"] .studio-fx::before,
body[data-motion="reduce"] .studio-fx::after,
body[data-motion="reduce"] .game-cell.well-charge,
body[data-motion="reduce"] .game-cell.just-merged,
body[data-motion="reduce"] .game-cell.just-pulse {
  animation: none !important;
}

body[data-theme="night"] .site-header nav,
body[data-theme="night"] .mode-segmented {
  border-color: #3d4f47;
  background: rgb(23 34 31 / 72%);
}

body[data-theme="night"] .nav-button.active,
body[data-theme="night"] .mode-segmented button.active {
  color: #eef2ed;
  background: #2b3d35;
}

body[data-theme="night"] .icon-button,
body[data-theme="night"] .tool-card,
body[data-theme="night"] .mode-tabs button,
body[data-theme="night"] .export-grid button,
body[data-theme="night"] .game-actions button,
body[data-theme="night"] .pet-actions button,
body[data-theme="night"] .pet-count-actions button,
body[data-theme="night"] .settings-card > button,
body[data-theme="night"] .transport-main + button,
body[data-theme="night"] .stage-transport > .transport-main + button {
  color: var(--ink);
  border-color: #3d4f47;
  background: #27352f;
}

body[data-theme="night"] .mode-tabs button.active {
  color: #17221f;
  background: #b6cbbd;
}

body[data-theme="night"] .mode-view {
  background: transparent;
}

body[data-theme="night"] .field-card,
body[data-theme="night"] .pet-tip,
body[data-theme="night"] .game-board,
body[data-theme="night"] .game-level-card,
body[data-theme="night"] .game-hud > div {
  border-color: #3d4f47;
  background-color: #26342e;
}

body[data-theme="night"] .game-character-stage,
body[data-theme="night"] .pet-room {
  border: 1px solid #3d4f47;
}

body[data-theme="night"] .studio-caption,
body[data-theme="night"] .game-reaction,
body[data-theme="night"] .pet-bubble {
  color: var(--ink);
  background: rgb(39 53 47 / 88%);
}

body[data-theme="night"][data-route="editor"] {
  --ink: #263d37;
  --muted: #72847b;
  --paper: #fbfcf7;
  --canvas: #edf0e7;
  --line: #d9e0d5;
  --green: #8ea293;
  --green-dark: #506b5c;
  --green-pale: #e2e9df;
  --pink: #ecd7dc;
  --pink-strong: #c58f9f;
  color: var(--ink);
  background: #eef1e9;
}

@media (max-width: 520px) {
  body[data-theme="night"] .mode-view {
    background: #17221f;
  }
}

/* Playable modes */

.mode-view {
  min-height: calc(100vh - 76px);
  padding: 22px 0 30px;
}

/*
 * The original merge game uses its readable UI sans for controls, scores and
 * goals at every window size. The decorative YuzuPop face makes the compact
 * zero glyph look like an empty box, especially after a large landscape
 * responsive breakpoint. Keep the original game shell on the same sans stack
 * instead of relying on the phone-only rule further down this file.
 */
.game-view {
  position: relative;
  font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif;
}

.game-top-alert {
  position: absolute;
  top: 66px;
  left: 50%;
  z-index: 88;
  display: flex;
  max-width: calc(100% - 16px);
  padding: 7px 13px;
  overflow: hidden;
  border: 1.5px solid #c6b9e4;
  border-radius: 11px;
  background: #fffafd;
  box-shadow: 0 4px 18px rgb(160 146 195 / 17%);
  color: #80719d;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
  align-items: center;
  gap: 7px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -130%);
}

.game-top-alert.on {
  animation: game-top-alert-in 340ms cubic-bezier(.2, 1.3, .4, 1) forwards;
}

.game-top-alert.off {
  animation: game-top-alert-out 300ms ease-in forwards;
}

.game-top-alert i {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #b19fdf;
}

@keyframes game-top-alert-in {
  from {
    opacity: 0;
    transform: translate(-50%, -130%);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes game-top-alert-out {
  from {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  to {
    opacity: 0;
    transform: translate(-50%, -130%);
  }
}

.game-view .game-mobile-home-icon {
  display: block;
}

.game-view .game-back-icon {
  display: none;
}

.mode-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  max-width: 1270px;
  margin: 0 auto 17px;
  padding: 0 6px;
}

.mode-heading {
  min-width: 0;
}

.mode-heading p,
.mode-heading h2 {
  margin: 0;
}

.mode-heading p {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2.2px;
}

.mode-heading h2 {
  margin-top: 2px;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 25px;
  font-weight: 400;
}

.mode-save-state {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 10px;
}

.mode-save-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #91b39e;
  box-shadow: 0 0 0 4px rgb(145 179 158 / 14%);
}

.studio-layout,
.game-layout,
.live-layout,
.pet-layout,
.settings-layout {
  max-width: 1270px;
  margin: 0 auto;
}

.studio-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1.25fr) minmax(330px, 0.75fr);
  gap: 16px;
  height: calc(100vh - 139px);
  min-height: 630px;
}

.studio-stage-card,
.mode-panel,
.game-character-card,
.game-board-card,
.live-stage-card,
.pet-room,
.settings-card {
  border: 1px solid rgb(96 115 102 / 13%);
  border-radius: 22px;
  background: rgb(251 252 247 / 78%);
  box-shadow: 0 16px 45px rgb(59 76 65 / 7%);
}

.studio-stage-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  padding: 14px;
  overflow: hidden;
}

.stage-topline {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 0 7px 8px;
  color: var(--muted);
  font-size: 10px;
}

.stage-topline b {
  color: var(--ink);
  font-size: 12px;
}

.stage-topline small {
  justify-self: end;
  padding: 5px 8px;
  border-radius: 999px;
  background: #edf2ea;
  font-size: 8px;
}

.studio-stage {
  --stage-top: #fff6f4;
  --stage-bottom: #e9eaff;
  --stage-accent: #c9b8e9;
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-radius: 18px;
  background:
    radial-gradient(circle at 22% 20%, rgb(255 255 255 / 66%) 0 3px, transparent 4px),
    radial-gradient(circle at 77% 34%, rgb(255 255 255 / 48%) 0 2px, transparent 3px),
    linear-gradient(155deg, var(--stage-top), var(--stage-bottom));
}

.studio-stage::before,
.studio-stage::after {
  position: absolute;
  left: 50%;
  border: 1px solid color-mix(in srgb, var(--stage-accent), transparent 60%);
  border-radius: 50%;
  content: "";
  transform: translateX(-50%);
}

.studio-stage::before {
  top: 9%;
  width: 67%;
  aspect-ratio: 1;
}

.studio-stage::after {
  bottom: -30%;
  width: 94%;
  aspect-ratio: 1.4;
  background: rgb(255 255 255 / 14%);
}

#studioCanvas {
  position: absolute;
  right: 8%;
  bottom: -6%;
  left: 8%;
  z-index: 2;
  width: 84%;
  height: 104%;
  object-fit: contain;
}

.studio-fx {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}

.studio-fx::before,
.studio-fx::after {
  position: absolute;
  content: var(--fx-symbol, "✦");
  color: var(--fx-color, #c8a95e);
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  opacity: var(--fx-opacity, 0.25);
  animation: studio-float 2.8s ease-in-out infinite alternate;
}

.studio-fx::before {
  top: 13%;
  left: 13%;
  font-size: 30px;
}

.studio-fx::after {
  top: 32%;
  right: 11%;
  font-size: 18px;
  animation-delay: -1.2s;
}

@keyframes studio-float {
  from { transform: translateY(5px) rotate(-8deg); }
  to { transform: translateY(-8px) rotate(8deg); }
}

.studio-custom-asset {
  position: absolute;
  right: 7%;
  bottom: 13%;
  z-index: 4;
  max-width: 35%;
  max-height: 35%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 9px 14px rgb(51 65 57 / 13%));
}

.studio-meme-caption {
  position: absolute;
  top: 9%;
  left: 50%;
  z-index: 6;
  max-width: 72%;
  padding: 9px 15px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  color: var(--ink);
  background: rgb(255 255 255 / 82%);
  box-shadow: 4px 5px 0 rgb(38 61 55 / 12%);
  font-size: clamp(10px, 1.4vw, 18px);
  font-weight: 700;
  text-align: center;
  transform: translateX(-50%) rotate(-1.5deg);
}

.studio-caption {
  position: absolute;
  right: 21px;
  bottom: 20px;
  z-index: 5;
  display: grid;
  justify-items: end;
  padding: 9px 12px;
  border-radius: 12px;
  background: rgb(255 255 255 / 64%);
  backdrop-filter: blur(10px);
}

.studio-caption span {
  color: var(--muted);
  font-size: 8px;
}

.studio-caption b {
  margin-top: 3px;
  max-width: 210px;
  overflow: hidden;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-transport {
  display: grid;
  grid-template-columns:
    auto
    auto
    minmax(110px, 1fr)
    minmax(110px, 1fr)
    minmax(145px, 1.25fr);
  gap: 10px;
  align-items: end;
  padding: 12px 7px 0;
}

.transport-main,
.stage-transport > button,
.mode-tabs button,
.mode-segmented button,
.export-grid button,
.game-actions button,
.pet-actions button,
.pet-count-actions button,
.settings-card button {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgb(255 255 255 / 78%);
  cursor: pointer;
}

.transport-main {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  min-height: 43px;
  padding: 0 13px;
  color: #fff;
  background-color: var(--green-dark) !important;
}

.transport-main svg {
  width: 16px;
}

.stage-transport > button {
  min-width: 43px;
  min-height: 43px;
  font-size: 20px;
}

.stage-speed {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 9px;
}

.stage-speed span {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stage-progress-control small {
  color: #5c6e61;
  font-size: 8px;
  line-height: 1.35;
}

input[type="range"] {
  accent-color: var(--green-dark);
}

.mode-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.mode-tabs button {
  min-height: 37px;
  color: var(--muted);
  font-size: 11px;
}

.mode-tabs button.active {
  color: #fff;
  border-color: var(--green-dark);
  background: var(--green-dark);
}

.mode-panel-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px;
  touch-action: pan-y;
}

.panel-section-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 13px;
}

.panel-section-heading small,
.panel-section-heading h3 {
  display: block;
  margin: 0;
}

.panel-section-heading small {
  color: var(--muted);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 1.7px;
}

.panel-section-heading h3 {
  margin-top: 3px;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 20px;
  font-weight: 400;
}

.panel-section-heading > span,
.panel-section-heading > button {
  color: var(--muted);
  font-size: 9px;
}

.panel-section-heading > button {
  min-height: 32px;
  padding: 0 12px;
}

.motion-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.motion-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 48px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.motion-button > i {
  display: grid;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: var(--green-dark);
  background: var(--green-pale);
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  font-style: normal;
  place-items: center;
}

.motion-button b,
.motion-button small {
  display: block;
}

.motion-button b {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.motion-button small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.motion-button.active {
  border-color: #7f998a;
  background: #eaf1e9;
  box-shadow: inset 0 0 0 1px rgb(80 107 92 / 12%);
}

.field-card {
  margin-top: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgb(255 255 255 / 62%);
}

.field-card label,
.field-card > span {
  display: block;
  color: var(--ink);
  font-size: 10px;
  font-weight: 650;
}

.field-card select,
.field-card input[type="text"],
.field-card input:not([type]),
.settings-select select,
.meme-search input {
  width: 100%;
  min-height: 38px;
  margin-top: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
}

.field-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.meme-search {
  position: relative;
  display: block;
  margin-bottom: 10px;
}

.meme-search svg {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 15px;
  color: var(--muted);
  transform: translateY(-50%);
}

.meme-search input {
  margin: 0;
  padding-left: 34px;
}

.meme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.meme-card {
  min-height: 62px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.meme-card > span {
  color: var(--pink-strong);
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 11px;
}

.meme-card b,
.meme-card small {
  display: block;
}

.meme-card b {
  margin-top: 5px;
  font-size: 10px;
}

.meme-card small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.meme-card.active {
  border-color: #c793a5;
  background: #fff3f7;
}

.custom-meme-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  align-items: center;
}

.custom-meme-card > div small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.custom-meme-card input[type="file"] {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 34px;
  padding: 5px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  font-size: 10px;
}

.custom-meme-card button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 10px;
}

.meme-caption-field {
  display: grid;
  gap: 7px;
}

.meme-caption-field input {
  margin-top: 0;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.export-grid button {
  min-height: 68px;
  padding: 11px;
  text-align: left;
}

.export-grid b,
.export-grid small {
  display: block;
}

.export-grid b {
  font-size: 10px;
}

.export-grid small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.export-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.export-settings label {
  font-size: 9px;
}

.export-settings select {
  margin-top: 7px;
}

.export-progress {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.export-progress > span {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e8e1;
}

.export-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8ba394, #c69aaa);
  transition: width 120ms linear;
}

.export-progress b {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.capability-note {
  margin: 12px 1px 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.mode-segmented {
  display: flex;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(255 255 255 / 55%);
}

.mode-segmented button {
  min-height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
}

.mode-segmented button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 4px 13px rgb(57 78 65 / 9%);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.65fr) minmax(450px, 1.35fr);
  gap: 16px;
  min-height: calc(100vh - 139px);
}

.game-character-card {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 11px;
  min-height: 0;
  padding: 13px;
  overflow: hidden;
  background: #fbfcf7;
}

.game-character-side {
  display: grid;
  gap: 11px;
}

.game-character-stage {
  position: relative;
  min-height: 250px;
  overflow: hidden;
  border-radius: 17px;
  background: #fbfaef;
}

.game-character-stage::after {
  display: none;
}

.game-stage-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}

#gameFullEffects {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#gameFlash {
  position: fixed;
  inset: 0;
  z-index: 160;
  background: #e5d7ed;
  opacity: 0;
  pointer-events: none;
}

#gameFlash.is-on {
  animation: cotton-game-flash 350ms ease-out;
}

#gameFlash.is-on.is-strong {
  background: #c3b5db;
  animation: cotton-game-flash-strong 500ms ease-out;
}

@keyframes cotton-game-flash {
  0%,
  100% {
    opacity: 0;
  }

  20% {
    opacity: 0.075;
  }
}

@keyframes cotton-game-flash-strong {
  0%,
  100% {
    opacity: 0;
  }

  18% {
    opacity: 0.3;
  }
}

@media (prefers-reduced-motion: reduce) {
  #gameFlash.is-on {
    animation: none !important;
  }
}

#gameStageEffects {
  position: absolute;
  z-index: 1;
  display: block;
  width: 100%;
  height: var(--game-stage-effect-height, 100%);
  pointer-events: none;
}

.game-particle-effects {
  position: absolute;
  inset: 0;
  z-index: 36;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  pointer-events: none;
}

.game-stage-audience {
  display: none;
  width: 100%;
  height: 34px;
  object-fit: fill;
  background: #fbfaef;
  pointer-events: none;
  user-select: none;
}

#gameCanvas {
  position: absolute;
  right: 4%;
  bottom: -22%;
  z-index: 2;
  width: 92%;
  height: 122%;
  object-fit: contain;
}

.game-reaction {
  display: none !important;
  position: absolute;
  top: 14px;
  right: 13px;
  left: 13px;
  z-index: 3;
  width: max-content;
  max-width: calc(100% - 26px);
  margin: auto;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: #fffdf8;
  box-shadow: 0 6px 18px rgb(51 66 58 / 8%);
  font-size: 10px;
  text-align: center;
  backdrop-filter: none;
}

.game-reaction[hidden] {
  display: none !important;
}

/* Android 2.175: the first-run game coaching text floats beside the character. */
#characterSpeech {
  position: fixed;
  z-index: 145;
  max-width: 110px;
  pointer-events: none;
  user-select: none;
  font: 15px/1.65 "YuzuPop", "Microsoft YaHei", sans-serif;
  color: #798674;
  text-shadow: 1px 1px 0 #fffdf7, -1px -1px 0 #fffdf7;
  animation: yuzu-speech-in 0.32s ease-out;
}

#characterSpeech[hidden] {
  display: none !important;
}

body:not([data-route="game"]) #characterSpeech {
  display: none !important;
}

@keyframes yuzu-speech-in {
  from {
    opacity: 0;
    translate: 0 5px;
  }

  to {
    opacity: 1;
    translate: 0 0;
  }
}

.game-level-card {
  position: relative;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: #eef3eb;
  cursor: pointer;
}

.game-level-card:focus-visible,
.game-level-card[data-pending="true"] {
  border-color: #9cad75;
  background: #e5eddd;
}

.game-level-card[data-pending="true"]::after {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d5a95b;
  box-shadow: 0 0 0 4px rgb(213 169 91 / 18%);
  content: "";
}

.game-level-card > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9px;
}

.game-level-card b {
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 16px;
  font-weight: 400;
}

.energy-track {
  height: 7px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgb(80 107 92 / 12%);
}

.energy-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8eaa99, #d1b878);
  transition: width 220ms ease;
}

.game-level-card small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 9px;
}

.game-pulse-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 47px;
  padding: 0 15px;
  border: 1px solid #d8c58f;
  border-radius: 13px;
  background: #fbf3d9;
  cursor: pointer;
}

.game-pulse-button:disabled {
  cursor: default;
  opacity: 0.5;
}

.game-pulse-button.pop {
  animation: game-mobile-pulse-pop 0.44s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.game-pulse-button span {
  font-size: 10px;
}

.game-pulse-button b {
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 15px;
  font-weight: 400;
}

.game-board-card {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  min-width: 0;
  min-height: 0;
  padding: 13px;
  overflow: hidden;
  background: #fbfcf7;
}

.game-hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.game-hud > div {
  padding: 9px 10px;
  border-radius: 11px;
  background: #f1f4ef;
}

.game-hud small,
.game-hud b {
  display: block;
}

.game-hud small {
  color: var(--muted);
  font-size: 9px;
}

.game-hud b {
  margin-top: 3px;
  overflow: hidden;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  font-weight: 400;
  text-overflow: ellipsis;
}

.game-board-wrap {
  position: relative;
  display: grid;
  min-height: 0;
  padding: 15px 0;
  place-items: center;
}

.game-drag-feedback {
  position: absolute;
  z-index: 20;
  overflow: hidden;
  border-radius: 22px;
  pointer-events: none;
  user-select: none;
}

.game-drag-ring {
  position: absolute;
  z-index: 1;
  display: block;
  border: 1px dashed rgb(176 196 236 / 92%);
  border-radius: 50%;
  background: rgb(157 207 198 / 3%);
  box-shadow: none;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition:
    width 180ms ease,
    height 180ms ease,
    left 180ms ease,
    top 180ms ease,
    opacity 180ms ease;
}

.game-drag-ring.active {
  opacity: 1;
  animation: game-drag-ring-spin 9s linear infinite;
}

.game-drag-ring.active.focus {
  border-color: rgb(176 196 236 / 92%);
  background: rgb(169 188 234 / 12%);
}

.game-drag-ring.active.bad {
  border-color: rgb(228 144 124 / 80%);
  background: rgb(228 144 124 / 7%);
}

@keyframes game-drag-ring-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.game-drag-range-label,
.game-drag-prediction {
  position: absolute;
  z-index: 4;
  display: block;
  width: max-content;
  max-width: min(160px, calc(100% - 8px));
  padding: 1px 5px;
  border: 1px solid #d6c4df;
  border-radius: 8px;
  color: #9781a5;
  background: #fffdf5;
  box-shadow: none;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.3;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 80ms ease;
  white-space: nowrap;
}

.game-drag-range-label.active,
.game-drag-prediction.active {
  opacity: 1;
}

.game-drag-range-label.focus {
  border-color: #d6c4df;
  color: #9781a5;
  background: #fffdf5;
  box-shadow: none;
}

.game-drag-range-label.bad,
.game-drag-prediction.bad {
  border-color: #dc9aae;
  color: #e4907c;
  background: #fff7f9;
  box-shadow: none;
}

.game-drag-prediction {
  z-index: 6;
  padding: 6px 10px;
  border: 1.5px solid #9c7eaf;
  border-radius: 9px;
  color: #8f689f;
  background: #fffdf7;
  box-shadow: 0 2px 0 #e5d6ec;
  font-size: 12px;
}

.game-drag-prediction.bad {
  border-color: #dc9aae;
  color: #a75f76;
  background: #fff7f9;
  box-shadow: 0 2px 0 #f1d6df;
}

.game-drag-guide {
  position: absolute;
  z-index: 2;
  display: block;
  height: 0;
  border-top: 2px dashed rgb(228 144 124 / 70%);
  opacity: 0;
  transform-origin: 0 50%;
  transition: opacity 120ms ease;
}

.game-drag-guide.active {
  opacity: 1;
}

.game-drag-ghost {
  position: absolute;
  z-index: 7;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 6px 8px rgb(75 66 93 / 20%));
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.1);
}

.game-drag-ghost.active {
  opacity: 0.94;
}

.game-board {
  --board-size: min(73vh, 650px);
  position: relative;
  display: grid;
  width: min(100%, var(--board-size));
  max-height: 100%;
  aspect-ratio: 1;
  padding: 8px;
  overflow: hidden;
  border: 2px solid #ddd9ce;
  border-radius: 22px;
  background: #ecefe7;
  box-shadow:
    inset 0 0 0 4px #fffdf7,
    0 3px 0 #eee0e6;
  gap: 5px;
  isolation: isolate;
}

.game-score-layer {
  position: absolute;
  inset: 0;
  z-index: 38;
  overflow: visible;
  pointer-events: none;
}

.game-cell {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: clamp(8px, 2.1vw, 17px);
  color: var(--ink);
  background: #f6f5ef;
  box-shadow: none;
  cursor: pointer;
  touch-action: none;
  place-items: center;
  isolation: isolate;
}

.game-cell::after {
  content: none;
}

.game-cell-inner {
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: none;
}

.game-cell-gem {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.game-cell-core {
  position: absolute;
  top: 50%;
  left: 50%;
  display: none;
  width: var(--tile-core-size, 0%);
  height: var(--tile-core-size, 0%);
  border: 1px solid #fff;
  border-radius: 50%;
  background: var(--tile-light, #f8e3ec);
  opacity: 0.13;
  transform: translate(-50%, -50%);
}

.game-cell-icon {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.game-cell-level {
  position: absolute;
  right: 2%;
  bottom: 2%;
  display: flex;
  min-width: 15px;
  height: 15px;
  padding: 0 2px;
  border: 1px solid #b6a0c1;
  border-radius: 5px;
  background: #fffdf5;
  align-items: center;
  justify-content: center;
  color: #7a5b85;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.game-cell-mark {
  position: absolute;
  inset: 1%;
  display: none;
}

.game-cell[data-kind="reson"] .game-cell-mark {
  display: block;
  animation: game-tile-spin 4.2s linear infinite;
}

.game-cell-ring-one,
.game-cell-ring-two {
  position: absolute;
  border-radius: 50%;
}

.game-cell-ring-one {
  inset: 0;
  border: 1.8px dashed #bea3d5;
}

.game-cell-ring-two {
  inset: 9%;
  border: 1px solid #edcf8c;
}

.game-cell[data-kind="reson"] .game-cell-icon {
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
}

@keyframes game-tile-spin {
  to { transform: rotate(360deg); }
}

.game-cell[data-kind="void"] {
  color: #f5eefa;
  background: #f6f5ef;
}

.game-cell[data-kind="void"] .game-cell-gem {
  background: #b1a9bf;
  border: 1px solid #8d829f;
  border-radius: 25%;
  box-shadow: inset 0 2px 0 #d2c9db;
}

.game-cell[data-kind="void"] .game-cell-mark {
  display: block;
}

.game-cell[data-kind="void"][data-hole="true"] .game-cell-gem {
  top: 8%;
  right: 8%;
  bottom: 8%;
  left: 8%;
  border: 2px solid #6f627f;
  border-radius: 50%;
  background:
    radial-gradient(circle, #241e31 0 23%, #4f4266 24% 45%, #9a86ae 46% 62%, #ded4e8 63%);
  box-shadow:
    inset 0 0 0 3px #c9bcd8,
    0 0 0 2px #f6f5ef;
}

.game-cell[data-kind="void"][data-hole="true"] .game-cell-mark {
  inset: 20%;
  border: 1.5px dashed #eee7f3;
  border-radius: 50%;
  animation: game-tile-spin 3.2s linear infinite;
}

.game-cell[data-kind="void"][data-hole="true"] .game-cell-x-one,
.game-cell[data-kind="void"][data-hole="true"] .game-cell-x-two {
  top: 48%;
  left: 25%;
  width: 50%;
  height: 4%;
  background: #d8cce5;
}

.game-cell-x-one,
.game-cell-x-two {
  position: absolute;
  top: 47%;
  left: 29%;
  width: 43%;
  height: 5%;
  border-radius: 2px;
  background: #f5eefa;
}

.game-cell-x-one { transform: rotate(45deg); }
.game-cell-x-two { transform: rotate(-45deg); }

.game-cell.selected {
  z-index: 2;
  outline: 2px solid #a9bcea;
  outline-offset: 2px;
  transform: scale(0.96);
}

.game-cell.drag-peer::before,
.game-cell.drag-absorbed::before,
.game-cell.drag-target::before,
.game-cell.drag-bad::before,
.game-cell.drag-focus::before {
  position: absolute;
  inset: -4px;
  z-index: 6;
  display: block;
  border-radius: 50%;
  pointer-events: none;
  content: "";
}

.game-cell.drag-peer::before {
  border: 2px solid #a9bcea;
  opacity: 0.85;
  animation: game-drag-peer-pulse 1.1s ease-in-out infinite;
}

.game-cell.drag-absorbed::before {
  border: 2px solid #a9bcea;
  opacity: 0.85;
  animation: game-drag-peer-pulse 1.1s ease-in-out infinite;
}

.game-cell.drag-target {
  z-index: 3;
  outline: 0;
  background: #d4efe8;
  box-shadow: inset 0 0 0 2px #85beb5;
}

.game-cell.drag-target::before {
  border: 3px solid #a9bcea;
  opacity: 1;
}

.game-cell.drag-bad {
  z-index: 3;
  outline: 0;
  background: #f8dbdf;
}

.game-cell.drag-bad::before {
  border: 3px solid #e4907c;
  opacity: 0.9;
}

.game-cell.drag-focus::before {
  inset: -4px;
  border: 2px solid rgb(169 188 234 / 80%);
  border-radius: 22%;
  opacity: 0.55;
  animation: game-drag-focus-pulse 1.9s ease-in-out infinite;
}

.game-cell.drag-hole .game-cell-inner {
  animation: game-drag-hole-pulse 660ms ease-in-out infinite;
}

.game-cell.drag-picked .game-cell-inner {
  opacity: 0.45;
  transform: scale(0.78);
  transition: opacity 70ms ease, transform 70ms ease;
}

.game-cell.game-cell-rejected .game-cell-inner {
  animation: game-cell-rejected-bounce 150ms ease;
}

@keyframes game-drag-peer-pulse {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(1.08); }
}

@keyframes game-cell-rejected-bounce {
  0% { transform: translateX(0) scale(1); }
  30% { transform: translateX(-9%) scale(0.94); }
  65% { transform: translateX(7%) scale(1.03); }
  100% { transform: translateX(0) scale(1); }
}

@keyframes game-drag-focus-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.85; }
}

@keyframes game-drag-hole-pulse {
  0%, 100% {
    filter: drop-shadow(0 0 0 rgb(228 144 124 / 0%));
  }
  50% {
    filter: drop-shadow(0 0 9px rgb(228 144 124 / 90%));
  }
}

.game-cell.just-dropped .game-cell-inner {
  animation: game-tile-drop 260ms cubic-bezier(.2, .9, .3, 1) both;
}

.game-cell.just-moved .game-cell-inner {
  animation: game-tile-move 220ms ease-out both;
}

.game-cell.well-charge .game-cell-icon {
  animation: game-dessert-charge 205ms ease-in both;
}

.game-cell.just-merged .game-cell-icon,
.game-cell.just-pulse .game-cell-icon {
  animation: game-dessert-bloom 270ms cubic-bezier(.16, .7, .25, 1) both;
}

@keyframes game-dessert-charge {
  0% { transform: scale(1); }
  75% { transform: scale(.92, .9); }
  100% { transform: scale(.88, 1.04); }
}

@keyframes game-dessert-bloom {
  0%, 12% { transform: scale(.82, .9); }
  29% { transform: scale(1.14, 1.17); }
  57% { transform: scale(.98, 1.015); }
  80% { transform: scale(1.035); }
  100% { transform: scale(1); }
}

@keyframes game-tile-drop {
  0% { transform: scale(.2); opacity: 0; }
  60% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes game-tile-move {
  0% { transform: scale(.88); opacity: .72; }
  55% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.game-flight-tile,
.game-hole-vortex,
.game-clear-flash,
.game-clear-ring,
.game-clear-burst,
.game-clear-shard {
  pointer-events: none;
  user-select: none;
}

.game-flight-tile {
  position: absolute;
  z-index: 30;
  overflow: visible;
  border-radius: 18%;
  background: #f6f5ef;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
}

.game-flight-inner {
  position: absolute;
  inset: 0;
  overflow: visible;
  border-radius: inherit;
}

.game-flight-inner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.game-flight-inner b {
  position: absolute;
  right: 2%;
  bottom: 2%;
  display: flex;
  min-width: 15px;
  height: 15px;
  padding: 0 2px;
  border: 1px solid #b6a0c1;
  border-radius: 5px;
  background: #fffdf5;
  align-items: center;
  justify-content: center;
  color: #7a5b85;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.game-flight-tile.is-void .game-flight-inner {
  background: #b1a9bf;
  border: 1px solid #8d829f;
  box-shadow: inset 0 2px 0 #d2c9db;
}

.game-flight-tile.is-void .game-flight-inner i {
  position: absolute;
  top: 47%;
  left: 29%;
  width: 43%;
  height: 5%;
  border-radius: 2px;
  background: #f5eefa;
}

.game-flight-tile.is-void .game-flight-inner i:first-child {
  transform: rotate(45deg);
}

.game-flight-tile.is-void .game-flight-inner i:last-child {
  transform: rotate(-45deg);
}

.game-hole-vortex {
  position: absolute;
  z-index: 35;
  border-radius: 50%;
  background:
    radial-gradient(circle, #17152d 0 18%, #3f416b 21% 35%, #7878ae 37% 43%, transparent 61%),
    conic-gradient(from 15deg, transparent, rgb(217 199 255 / 74%), transparent 38%, rgb(171 213 237 / 58%), transparent 72%);
  box-shadow:
    0 0 0 1px #bdb1e9,
    0 0 13px rgb(170 154 218 / 42%),
    inset 0 0 12px rgb(72 61 105 / 72%);
  transform-origin: 50% 50%;
  will-change: transform, opacity;
}

.game-score-float {
  position: absolute;
  z-index: 38;
  color: #778ac0;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-weight: 800;
  line-height: 1;
  text-shadow:
    0 1px 0 #fff,
    0 2px 4px #fff;
  transform: translate(-50%, -50%);
  animation: game-score-float 850ms ease-out forwards;
  pointer-events: none;
  user-select: none;
  will-change: transform, opacity;
}

.game-score-float.is-big {
  color: #c49a4b;
}

.game-score-float.is-negative {
  color: #cc7c95;
}

@keyframes game-score-float {
  0% {
    opacity: 0;
    transform: translate(-50%, -30%) scale(.7);
  }

  25% {
    opacity: 1;
    transform: translate(-50%, -70%) scale(1.1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -190%) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-score-float {
    animation-duration: 1ms;
  }
}

.game-clear-flash {
  position: absolute;
  inset: 0;
  z-index: 20;
  border-radius: inherit;
  background: radial-gradient(circle, #fffdfb 0 14%, #eee1f4 36%, rgb(226 211 239 / 32%) 61%, transparent 76%);
  will-change: opacity;
}

.game-clear-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 25;
  width: 72%;
  aspect-ratio: 1;
  margin: -36% 0 0 -36%;
  border: 2px solid #d8b97b;
  border-radius: 50%;
  box-shadow:
    0 0 8px #ecd8b9,
    inset 0 0 8px #ecd8b9;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
}

.game-clear-burst {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 40;
  display: grid;
  min-width: 126px;
  padding: 13px 20px;
  border: 1px solid #eadbee;
  border-radius: 23px;
  background: #fffdfb;
  box-shadow: 0 6px 28px rgb(166 154 194 / 24%);
  justify-items: center;
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}

.game-clear-burst b {
  color: #c29b5c;
  font: 700 24px/1.1 "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  text-shadow: 0 2px 0 #fff;
}

.game-clear-burst small {
  margin-top: 4px;
  color: #a58bb8;
  font-size: 10px;
  white-space: nowrap;
}

.game-clear-shard {
  position: absolute;
  z-index: 32;
  border-radius: 2px;
  background: #f3c583;
  box-shadow: 0 0 6px rgb(243 197 131 / 52%);
  will-change: transform, opacity;
}

.game-result {
  position: absolute;
  inset: 12px;
  z-index: 10;
  display: grid;
  padding: 22px;
  border: 1px solid #d8ded1;
  border-radius: 20px;
  background: #f8f9f4;
  box-shadow: 0 24px 60px rgb(45 61 51 / 18%);
  place-items: center;
  backdrop-filter: none;
}

.game-upgrade {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  margin: 0;
  z-index: 500;
  display: grid;
  padding: 20px;
  border: 0;
  background: #cbd6c8;
  place-items: center;
  backdrop-filter: none;
}

.game-restart-dialog {
  width: min(320px, calc(100vw - 36px));
  max-height: calc(100dvh - 20px);
  margin: auto;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid #d9dfd5;
  border-radius: 22px;
  color: #53675b;
  background: #f6f5ef;
  box-shadow: none;
  box-sizing: border-box;
  overscroll-behavior: contain;
}

.game-restart-dialog::backdrop {
  background: rgb(102 115 105 / 27%);
  backdrop-filter: none;
}

.game-restart-panel {
  padding: 16px 14px 14px;
  font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif;
  text-align: center;
}

.game-restart-panel h2 {
  margin: 0;
  color: #8c77b8;
  font: 900 22px/normal "Microsoft YaHei UI", "PingFang SC", sans-serif;
  letter-spacing: 4px;
}

.game-restart-panel > p {
  margin: 4px 0 12px;
  color: #7d8b80;
  font-size: 11px;
  line-height: normal;
}

.game-restart-growth {
  margin: 2px 0 14px;
  padding: 9px 10px 10px;
  border: 1.5px dashed #e4dcec;
  border-radius: 11px;
  background: #f5f2fa;
  text-align: left;
}

.game-restart-growth > div:first-child {
  margin-bottom: 7px;
  color: #7d8b80;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.1px;
}

.game-restart-growth > div:first-child b {
  margin: 0 2px;
  color: #9db4a7;
  font-size: 11.5px;
}

.game-restart-growth-list {
  display: flex;
  max-height: 86px;
  gap: 5px;
  flex-wrap: wrap;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.game-restart-growth-item {
  display: inline-flex;
  height: 22px;
  padding: 0 7px;
  gap: 4px;
  align-items: center;
  border: 1px solid #d8cdea;
  border-radius: 7px;
  color: #9db4a7;
  background: #ebe6f5;
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
}

.game-restart-growth-item u {
  color: #fffdf6;
  font-size: 10px;
  font-weight: 800;
  text-decoration: none;
  opacity: 0.92;
}

.game-restart-growth-empty {
  color: #87958c;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 22px;
  letter-spacing: 0.5px;
}

.game-restart-actions {
  display: grid;
  gap: 9px;
}

.game-restart-actions button {
  display: grid;
  width: 100%;
  height: 56px;
  padding: 0 2px;
  border: 0;
  border-radius: 13px;
  color: #263e31;
  background: #9db4a7;
  place-content: center;
  cursor: pointer;
}

.game-restart-actions button:last-child {
  color: #53675b;
  background: #e9dcde;
}

.game-restart-actions b {
  font-size: 16px;
  line-height: 18.4px;
  letter-spacing: 0.5px;
}

.game-restart-actions small {
  margin-top: 3px;
  font-size: 10.5px;
  line-height: normal;
  opacity: 0.9;
}

.game-restart-cancel {
  height: 30px;
  margin: 10px auto 0;
  padding: 0 10px;
  border: 0;
  color: #7d8b80;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  text-decoration: underline;
  cursor: pointer;
}

.game-restart-actions button:active {
  transform: scale(0.96);
}

@media (max-height: 360px) {
  .game-restart-panel {
    padding: 15px 12px 10px;
  }

  .game-restart-panel h2 {
    font-size: 20px;
  }

  .game-restart-panel > p {
    margin: 5px 0 10px;
  }

  .game-restart-growth {
    margin-bottom: 10px;
    padding: 7px 9px 8px;
  }

  .game-restart-growth-list {
    max-height: 48px;
  }

  .game-restart-actions button {
    height: 42px;
  }

  .game-restart-cancel {
    margin-top: 5px;
  }
}

.game-upgrade > div {
  width: min(410px, 100%);
  max-height: calc(100dvh - 40px);
  padding: 22px;
  overflow-y: auto;
  border: 1px solid #dfe2d9;
  border-radius: 25px;
  background: #f6f5ef;
  box-shadow: 0 14px 50px rgb(54 71 56 / 18%);
  overscroll-behavior: contain;
}

.game-upgrade > div,
.game-result {
  position: relative;
  text-align: center;
}

.game-upgrade-heading {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: min(410px, 100%);
  margin: 0 auto 20px;
  text-align: center;
}

.game-upgrade-heading > div {
  flex: 1;
  min-width: 0;
}

#gameUpgradeClose {
  width: 24px;
  min-width: 24px;
  height: 30px;
  padding: 0;
  border: 0;
  color: #687a70;
  background: #f6f5ef;
  font: 24px/1 sans-serif;
  cursor: pointer;
}

#gameUpgradeLevel {
  margin-top: 3px;
  padding: 6px 9px;
  border-radius: 10px;
  color: #586b60;
  background: #ecefe5;
  font: 12px/1 sans-serif;
  white-space: nowrap;
}

.game-result > span {
  color: var(--pink-strong);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 2px;
}

.game-upgrade h3,
.game-result h3 {
  margin: 0;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 25px;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 1px;
}

.game-upgrade p,
.game-result p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.game-upgrade-heading p {
  margin: 6px 0 0;
  font-size: 12px;
}

#gameUpgradeChoices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: min(410px, 100%);
  margin: 0 auto;
}

.upgrade-choice {
  position: relative;
  display: block;
  width: 100%;
  min-height: 100px;
  padding: 16px 15px 16px 76px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: #f8f8f3;
  text-align: left;
  cursor: pointer;
}

.upgrade-choice b {
  display: block;
  margin: 0 0 5px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
}

.upgrade-choice .upgrade-description {
  display: block;
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.65;
  opacity: 0.8;
}

.upgrade-icon {
  position: absolute;
  top: 50%;
  left: 15px;
  display: grid;
  width: 45px;
  height: 45px;
  border-radius: 15px;
  color: #5e7166;
  background: #ecefe5;
  place-items: center;
  transform: translateY(-50%);
}

.upgrade-icon svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#gameUpgradeHint {
  width: min(410px, 100%);
  margin: 17px auto 0;
  margin-top: 17px;
  font-size: 11px;
  text-align: center;
}

.game-result > span {
  font-size: 42px;
}

.game-result button {
  min-height: 39px;
  margin-top: 12px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: var(--green-dark);
}

.chapter-win-overlay {
  position: fixed;
  inset: 0;
  z-index: 420;
  display: flex;
  width: min(100%, 440px);
  margin: 0 auto;
  padding: 22px;
  align-items: center;
  justify-content: center;
  overflow: auto;
  color: #667b74;
  background: #f8f6f1;
  overscroll-behavior: contain;
}

.chapter-win-overlay[hidden] {
  display: none !important;
}

.chapter-win-panel {
  width: 100%;
  max-width: 360px;
  margin: auto;
  text-align: center;
}

.chapter-win-panel > small {
  color: #94a69d;
  font-size: 10px;
  letter-spacing: 1px;
}

.chapter-confetti {
  margin-bottom: 25px;
  color: #d8b7c6;
  font-size: 43px;
  letter-spacing: 12px;
}

.chapter-win-panel h2 {
  margin: 9px 0 12px;
  color: #667b74;
  font-size: 27px;
  font-weight: 500;
}

.chapter-win-panel p {
  margin: 0;
  color: #899a92;
  font-size: 13px;
  line-height: 1.7;
}

.chapter-win-actions {
  display: grid;
  gap: 12px;
  margin-top: 30px;
}

.chapter-win-actions button {
  padding: 16px;
  border: 0;
  border-radius: 15px;
  color: #809184;
  background: #e7ebe3;
  font: inherit;
  font-size: 17px;
  line-height: normal;
  cursor: pointer;
}

.chapter-win-actions button:first-child {
  color: #fff;
  background: #dcbac9;
}

.chapter-win-actions button:last-child {
  color: #809184;
  background: transparent;
  font-size: 13px;
}

.chapter-win-actions button:active {
  transform: scale(0.95);
}

@media (max-height: 650px) {
  .chapter-win-overlay {
    padding: 16px 22px;
  }

  .chapter-confetti {
    margin-bottom: 12px;
    font-size: 34px;
  }

  .chapter-win-panel h2 {
    margin: 5px 0 8px;
    font-size: 25px;
  }

}

.game-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.game-actions button {
  min-height: 55px;
  padding: 8px 10px;
  text-align: left;
}

.game-actions b,
.game-actions small {
  display: block;
}

.game-actions b {
  font-size: 10px;
}

.game-actions small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.game-actions button.active {
  border-color: #76917f;
  background: #edf3ea;
}

.game-help {
  margin: 8px 3px 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.live-layout {
  display: grid;
  grid-template-columns: minmax(440px, 1.25fr) minmax(340px, 0.75fr);
  gap: 16px;
  height: calc(100vh - 188px);
  min-height: 600px;
}

.live-stage-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  padding: 14px;
  overflow: hidden;
}

.live-stage-topline {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  padding: 0 8px 9px;
  color: var(--muted);
  font-size: 9px;
}

.live-stage-topline > span {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.live-stage-topline > span:last-child {
  justify-self: end;
}

.live-stage-topline b {
  color: var(--ink);
  font-size: 10px;
}

.live-stage-topline small {
  justify-self: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: #edf2ea;
  font-size: 8px;
}

.live-state-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #91b39e;
  box-shadow: 0 0 0 4px rgb(145 179 158 / 13%);
}

.live-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-radius: 19px;
  background:
    radial-gradient(circle at 50% 38%, rgb(255 255 255 / 86%) 0 22%, transparent 22.5%),
    linear-gradient(155deg, #fbf5ed, #e9e8f5 58%, #dceadf);
}

.live-stage::before,
.live-stage::after {
  position: absolute;
  left: 50%;
  border-radius: 50%;
  content: "";
  transform: translateX(-50%);
}

.live-stage::before {
  top: 6%;
  width: 72%;
  aspect-ratio: 1;
  border: 1px solid rgb(192 171 111 / 23%);
}

.live-stage::after {
  bottom: -28%;
  width: 96%;
  aspect-ratio: 1.55;
  background: rgb(255 255 255 / 32%);
  box-shadow: 0 -16px 45px rgb(255 255 255 / 22%);
}

.live-stage-orbit {
  position: absolute;
  top: 13%;
  left: 50%;
  width: min(68%, 470px);
  aspect-ratio: 1;
  border: 1px dashed rgb(103 126 111 / 18%);
  border-radius: 50%;
  pointer-events: none;
  transform: translateX(-50%);
}

.live-stage-orbit i {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #c6aa72;
  box-shadow: 0 0 0 6px rgb(198 170 114 / 12%);
}

.live-stage-orbit i:nth-child(1) {
  top: 12%;
  right: 13%;
}

.live-stage-orbit i:nth-child(2) {
  right: 2%;
  bottom: 37%;
  width: 6px;
  height: 6px;
  background: #aebdb0;
}

.live-stage-orbit i:nth-child(3) {
  bottom: 12%;
  left: 14%;
  width: 5px;
  height: 5px;
  background: #d0a5b2;
}

.live-stage-spark {
  position: absolute;
  z-index: 1;
  color: #bfa362;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
}

.live-stage-spark-a {
  top: 16%;
  left: 13%;
  font-size: 22px;
}

.live-stage-spark-b {
  top: 31%;
  right: 16%;
  font-size: 34px;
}

#liveCanvas {
  position: absolute;
  right: 10%;
  bottom: -13%;
  left: 10%;
  z-index: 2;
  width: 80%;
  height: 115%;
  object-fit: contain;
}

.live-camera-note {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 4;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: rgb(255 255 255 / 73%);
  box-shadow: 0 6px 18px rgb(57 73 63 / 7%);
  font-size: 8px;
  backdrop-filter: blur(9px);
}

.live-camera-note svg {
  width: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.6;
}

.live-expression-chip {
  position: absolute;
  right: 14px;
  bottom: 14px;
  left: 14px;
  z-index: 5;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: calc(100% - 28px);
  margin: auto;
  padding: 7px 11px;
  border: 1px solid rgb(255 255 255 / 56%);
  border-radius: 999px;
  color: var(--muted);
  background: rgb(255 255 255 / 74%);
  box-shadow: 0 8px 23px rgb(52 66 57 / 8%);
  font-size: 8px;
  backdrop-filter: blur(10px);
}

.live-expression-chip span {
  font-size: 6px;
  font-weight: 700;
  letter-spacing: 1px;
}

.live-expression-chip b {
  color: var(--ink);
  font-size: 9px;
}

.live-expression-chip i {
  width: 1px;
  height: 13px;
  background: var(--line);
}

.live-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 6px 0;
}

.live-controls button {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: rgb(255 255 255 / 78%);
  cursor: pointer;
}

.live-controls button:disabled {
  cursor: progress;
  opacity: 0.58;
}

#liveSettingsToggle.active,
#liveCameraPreviewToggle.active {
  border-color: #a9bcaa;
  background: #edf4eb;
}

.live-controls .live-camera-toggle {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  color: #fff;
  border-color: var(--green-dark);
  background: var(--green-dark);
  text-align: left;
}

.live-controls .live-camera-toggle.active {
  color: var(--ink);
  border-color: #d5b4be;
  background: #fff1f4;
}

.live-control-icon {
  display: grid;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgb(255 255 255 / 16%);
  place-items: center;
}

.live-camera-toggle.active .live-control-icon {
  background: rgb(197 143 159 / 14%);
}

.live-control-icon svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.live-controls button b,
.live-controls button small {
  display: block;
}

.live-controls button b {
  font-size: 10px;
}

.live-controls button small {
  margin-top: 3px;
  opacity: 0.72;
  font-size: 8px;
}

.live-controls .live-screen-toggle {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  text-align: left;
}

.live-controls .live-screen-toggle.active {
  color: #fff;
  border-color: #7f9989;
  background: #7f9989;
}

.live-controls .live-screen-toggle.pending {
  cursor: progress;
  opacity: 0.72;
}

#liveCalibrate {
  padding: 7px 12px;
}

.live-panel .mode-panel-scroll {
  display: grid;
  align-content: start;
  gap: 13px;
}

.live-panel .panel-section-heading {
  margin-bottom: 0;
}

.live-status-copy {
  margin: 0;
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--muted);
  background: #f0f3ed;
  font-size: 9px;
  line-height: 1.65;
}

.live-signal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.live-signal-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(255 255 255 / 68%);
}

.live-signal-card.wide {
  grid-column: 1 / -1;
}

.live-signal-card > span {
  display: flex;
  gap: 5px;
  align-items: center;
  color: var(--muted);
  font-size: 8px;
}

.live-signal-card > span > i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #86a18f;
}

.live-signal-card output {
  margin-left: auto;
  color: var(--ink);
  font-size: 8px;
}

.live-signal-card > i {
  position: relative;
  display: block;
  height: 6px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e9e2;
}

.live-signal-card > i > b {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8ca697, #d1b878);
  transition: width 90ms linear;
}

.live-signal-card > .live-bipolar-meter {
  overflow: visible;
}

.live-bipolar-meter > b {
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  background: linear-gradient(90deg, #b6a1cb, #d3b878) !important;
}

.live-bipolar-meter > u {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 50%;
  width: 1px;
  background: #809087;
  text-decoration: none;
}

.live-mapping-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(145deg, rgb(255 255 255 / 76%), rgb(238 243 235 / 76%));
}

.live-mapping-card ol {
  display: grid;
  gap: 8px;
  margin: 11px 0 0;
  padding: 0;
  list-style: none;
}

.live-mapping-card li {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgb(94 112 100 / 10%);
}

.live-mapping-card li b {
  color: #52685a;
  font-size: 9px;
}

.live-mapping-card li span {
  color: var(--muted);
  font-size: 8px;
  line-height: 1.55;
}

.live-privacy-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.6;
}

.live-privacy-note svg {
  width: 18px;
  fill: none;
  stroke: #79907f;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.live-display-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(255 255 255 / 62%);
}

.live-display-card .feature-heading {
  margin-bottom: 1px;
}

.live-display-card .feature-heading button,
.live-setting-heading button {
  min-height: 29px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #f8faf5;
  font-size: 8px;
  cursor: pointer;
}

.live-display-card label {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 8px;
}

.live-display-card input[type="range"] {
  min-width: 0;
}

.live-display-card output {
  min-width: 34px;
  color: var(--ink);
  text-align: right;
}

.live-display-card select {
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.live-stage {
  --live-scale: 1;
}

#liveCanvas {
  transform: scale(var(--live-scale));
  transform-origin: 50% 100%;
}

.live-stage[data-live-bg="rose"] {
  background:
    radial-gradient(circle at 50% 38%, rgb(255 255 255 / 83%) 0 22%, transparent 22.5%),
    linear-gradient(155deg, #fff1f1, #f4dfe7 58%, #e3e9ef);
}

.live-stage[data-live-bg="mint"] {
  background:
    radial-gradient(circle at 50% 38%, rgb(255 255 255 / 84%) 0 22%, transparent 22.5%),
    linear-gradient(155deg, #f7f5e9, #dfeee4 58%, #dce8e2);
}

.live-stage[data-live-bg="night"] {
  background:
    radial-gradient(circle at 50% 38%, rgb(255 255 255 / 14%) 0 22%, transparent 22.5%),
    linear-gradient(155deg, #4b5262, #323a4a 58%, #26312f);
}

.live-stage[data-live-bg="night"] .live-camera-note,
.live-stage[data-live-bg="night"] .live-expression-chip {
  color: #e6ece8;
  background: rgb(38 49 47 / 72%);
}

.live-stage[data-live-bg="night"] .live-expression-chip b {
  color: #fff;
}

.live-setting-dialog,
.live-camera-confirm {
  width: min(720px, calc(100vw - 28px));
  max-height: min(780px, calc(100dvh - 30px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgb(96 115 102 / 18%);
  border-radius: 21px;
  color: var(--ink);
  background: #faf9f3;
  box-shadow: 0 28px 90px rgb(28 44 34 / 24%);
}

.live-setting-dialog::backdrop,
.live-camera-confirm::backdrop {
  background: rgb(47 59 51 / 46%);
  backdrop-filter: blur(5px);
}

.live-setting-dialog > header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: rgb(250 249 243 / 94%);
  backdrop-filter: blur(12px);
}

.live-setting-dialog small,
.live-setting-dialog h2,
.live-setting-dialog h3 {
  display: block;
  margin: 0;
}

.live-setting-dialog header small,
.live-setting-heading small {
  color: var(--muted);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 1.6px;
}

.live-setting-dialog h2 {
  margin-top: 3px;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 23px;
  font-weight: 400;
}

.live-setting-dialog header > button {
  display: grid;
  width: 37px;
  height: 37px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
  font-size: 19px;
  place-items: center;
}

.live-setting-scroll {
  max-height: calc(min(780px, 100dvh - 30px) - 72px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 18px 20px;
}

.live-master-switch {
  display: flex;
  min-height: 57px;
  padding: 10px 12px;
  border: 1px solid #d6e3d8;
  border-radius: 14px;
  align-items: center;
  justify-content: space-between;
  background: #edf5ed;
}

.live-master-switch b,
.live-master-switch small {
  display: block;
}

.live-master-switch b {
  font-size: 10px;
}

.live-master-switch small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.live-master-switch input {
  width: 36px;
  height: 21px;
  accent-color: var(--green-dark);
}

.live-setting-section {
  margin-top: 14px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}

.live-setting-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.live-setting-heading h3 {
  margin-top: 3px;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 17px;
  font-weight: 400;
}

.live-expression-rows,
.live-motion-rows,
.live-filter-rows {
  display: grid;
  gap: 7px;
}

.live-expression-rows label,
.live-motion-rows label,
.live-filter-rows label {
  display: grid;
  grid-template-columns: 54px minmax(80px, 1fr) 42px 35px 20px;
  gap: 7px;
  align-items: center;
  min-height: 30px;
  color: var(--muted);
  font-size: 8px;
}

.live-motion-rows label,
.live-filter-rows label {
  grid-template-columns: 62px minmax(80px, 1fr) 42px;
}

.live-expression-rows input,
.live-motion-rows input,
.live-filter-rows input {
  min-width: 0;
}

.live-expression-rows output,
.live-motion-rows output,
.live-filter-rows output {
  color: var(--ink);
  font-size: 8px;
  text-align: right;
}

.live-expression-rows .expression-direct,
.live-expression-rows label > b {
  justify-self: end;
}

.live-expression-rows label > b {
  color: #9aa59e;
  font-size: 7px;
  font-weight: 500;
}

.live-expression-rows input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--green-dark);
}

.live-expression-rows input[type="range"]:disabled,
.live-expression-rows output:disabled {
  opacity: 0.38;
}

.live-setting-note {
  margin: 13px 2px 0;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.65;
}

.live-camera-confirm {
  width: min(390px, calc(100vw - 30px));
  padding: 22px;
  text-align: center;
}

.live-camera-confirm > span {
  display: grid;
  width: 43px;
  height: 43px;
  margin: 0 auto 10px;
  border-radius: 50%;
  color: #fff;
  background: #d0a36b;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 25px;
  place-items: center;
}

.live-camera-confirm h2 {
  margin: 0;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 22px;
  font-weight: 400;
}

.live-camera-confirm p {
  margin: 9px 0 17px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.65;
}

.live-camera-confirm > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.live-camera-confirm button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.live-camera-confirm #liveCameraAccept {
  color: #fff;
  border-color: var(--green-dark);
  background: var(--green-dark);
}

.live-camera-preview-panel {
  position: fixed;
  top: 72px;
  left: 16px;
  z-index: 1200;
  width: min(280px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 55%);
  border-radius: 14px;
  background: #28342f;
  box-shadow: 0 20px 55px rgb(24 37 30 / 28%);
  touch-action: none;
}

.live-camera-preview-panel header {
  display: flex;
  min-height: 34px;
  padding: 0 5px 0 10px;
  align-items: center;
  justify-content: space-between;
  color: #eef2ee;
  background: rgb(29 43 35 / 92%);
  cursor: grab;
  font-size: 8px;
}

.live-camera-preview-panel header:active {
  cursor: grabbing;
}

.live-camera-preview-panel header button {
  display: grid;
  width: 27px;
  height: 27px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: transparent;
  cursor: pointer;
  font-size: 17px;
  place-items: center;
}

.live-camera-preview-panel video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transform: scaleX(-1);
}

.live-filter-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

@media (max-width: 600px) {
  .live-setting-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 17px;
  }

  .live-setting-dialog > header {
    padding: 13px 12px 10px;
  }

  .live-setting-dialog h2 {
    font-size: 20px;
  }

  .live-setting-scroll {
    max-height: calc(100dvh - 79px);
    padding: 10px;
  }

  .live-setting-section {
    margin-top: 10px;
    padding: 10px;
  }

  .live-expression-rows label {
    grid-template-columns: 44px minmax(70px, 1fr) 38px 18px;
    gap: 5px;
  }

  .live-expression-rows label > b {
    display: none;
  }

  .live-motion-rows label,
  .live-filter-rows label {
    grid-template-columns: 52px minmax(70px, 1fr) 38px;
    gap: 5px;
  }

  .live-setting-heading h3 {
    font-size: 16px;
  }

  .live-setting-heading button {
    min-height: 27px;
    padding: 0 8px;
  }

  .live-camera-preview-panel {
    width: min(250px, calc(100vw - 16px));
  }
}

.pet-layout {
  display: grid;
  grid-template-columns: minmax(440px, 1.25fr) minmax(330px, 0.75fr);
  gap: 16px;
  min-height: calc(100vh - 139px);
}

.pet-room {
  position: relative;
  min-height: 590px;
  overflow: hidden;
  background:
    linear-gradient(rgb(255 255 255 / 25%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 22%) 1px, transparent 1px),
    linear-gradient(155deg, #f5efe9, #e3ece3);
  background-size: 40px 40px, 40px 40px, auto;
  touch-action: none;
}

.pet-room::after {
  position: absolute;
  right: -5%;
  bottom: -10%;
  left: -5%;
  height: 34%;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(#e9dccf, #d6c8bd);
  box-shadow: inset 0 12px 35px rgb(255 255 255 / 25%);
  content: "";
}

.pet-room-sky span {
  position: absolute;
  color: #c2aa6e;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
}

.pet-room-sky span:nth-child(1) { top: 12%; left: 13%; font-size: 22px; }
.pet-room-sky span:nth-child(2) { top: 23%; right: 17%; font-size: 36px; }
.pet-room-sky span:nth-child(3) { top: 39%; left: 27%; font-size: 14px; }

.pet-instances {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.pet-instance {
  position: absolute;
  right: var(--pet-x, 11%);
  bottom: var(--pet-y, 7%);
  width: var(--pet-width, min(48%, 340px));
  height: 76%;
  outline: 0;
  cursor: grab;
  touch-action: none;
  transition: filter 160ms ease, transform 160ms ease;
}

.pet-instance:nth-child(2) {
  right: 44%;
  z-index: 2;
  width: min(36%, 260px);
  height: 62%;
}

.pet-instance:nth-child(3) {
  right: 2%;
  z-index: 1;
  width: min(32%, 230px);
  height: 56%;
}

.pet-instance:nth-child(4) {
  right: 67%;
  bottom: 3%;
  z-index: 3;
  width: min(24%, 150px);
  height: 44%;
}

.pet-instance:nth-child(5) {
  right: 70%;
  bottom: 43%;
  z-index: 3;
  width: min(22%, 140px);
  height: 41%;
}

.pet-instance:nth-child(6) {
  right: 37%;
  bottom: 2%;
  z-index: 3;
  width: min(22%, 140px);
  height: 40%;
}

.pet-instance:hover,
.pet-instance:focus-visible {
  filter: drop-shadow(0 9px 15px rgb(63 78 69 / 14%));
  outline: 2px solid rgb(94 126 107 / 30%);
  outline-offset: 5px;
}

.pet-instance.dragging {
  z-index: 8;
  cursor: grabbing;
  transform: scale(1.03);
}

.pet-instance canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.pet-bubble {
  position: absolute;
  top: -2px;
  left: 50%;
  z-index: 4;
  max-width: 90%;
  padding: 7px 10px;
  border-radius: 11px 11px 11px 3px;
  background: rgb(255 255 255 / 84%);
  box-shadow: 0 7px 18px rgb(51 65 57 / 9%);
  color: var(--ink);
  font-size: 8px;
  opacity: 0;
  transform: translate(-50%, -5px);
  transition: opacity 150ms ease, transform 150ms ease;
  white-space: nowrap;
}

.pet-instance.speaking .pet-bubble {
  opacity: 1;
  transform: translate(-50%, 0);
}

.pet-relation-pop {
  position: absolute;
  z-index: 6;
  top: -3%;
  left: calc(50% - 28px);
  width: 56px;
  height: 43px;
  box-sizing: border-box;
  padding: 8px 15px;
  border: 2px solid #d9bdc8;
  border-radius: 16px;
  color: #cc95aa;
  background: #fffaf7;
  pointer-events: none;
}
.pet-relation-pop::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  left: 17px;
  bottom: -7px;
  transform: rotate(45deg);
  border-right: 2px solid #d9bdc8;
  border-bottom: 2px solid #d9bdc8;
  background: #fffaf7;
}
.pet-relation-pop svg { position: relative; z-index: 1; display: block; width: 100%; height: 100%; fill: #f1c0d0; }
.pet-relation-pop.awkward svg { fill: none; stroke: #80b5c8; stroke-width: 2; }
.pet-relation-pop.angry svg { fill: none; stroke: #cf9286; }
.pet-relation-pop.with-text {
  width: 156px;
  height: auto;
  min-height: 62px;
  left: calc(50% - 78px);
  padding: 8px 12px;
  text-align: center;
}
.pet-relation-pop.with-text svg { width: 25px; height: 25px; margin: 0 auto 4px; }
.pet-relation-pop.with-text > span { display: block; font: 12px/1.45 YuzuPop, sans-serif; color: #8c7c82; overflow-wrap: break-word; word-break: break-all; }

.pet-drag-handle {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 5;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: rgb(255 255 255 / 58%);
  font-size: 8px;
  transform: translateX(-50%);
}

.pet-panel {
  min-height: 0;
}

.pet-panel > .mode-panel-scroll,
.pet-panel {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.pet-panel {
  padding: 14px;
  touch-action: pan-y;
}

.pet-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.pet-actions button,
.pet-count-actions button {
  min-height: 43px;
  font-size: 9px;
}

.pet-actions button.active {
  background: #e9f0e7;
}

.pet-count-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  margin-top: 8px;
}

.switch-line {
  display: flex !important;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  font-size: 10px !important;
}

.switch-line + .switch-line {
  border-top: 1px solid var(--line);
}

.switch-line > span {
  min-width: 0;
}

.switch-line small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 7px;
  font-weight: 400;
}

.switch-line input {
  flex: none;
  width: 34px;
  height: 20px;
  accent-color: var(--green-dark);
}

.pet-tip {
  margin-top: 12px;
  padding: 12px;
  border-radius: 13px;
  background: #f7eee9;
}

.pet-tip b {
  font-size: 11px;
}

.pet-tip p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.settings-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-card {
  min-width: 0;
  padding: 16px;
}

.settings-range,
.settings-select {
  display: grid;
  gap: 7px;
  min-height: 53px;
  color: var(--ink);
  font-size: 10px;
}

.settings-range > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-range output {
  color: var(--muted);
  font-size: 9px;
}

.settings-select select {
  margin-top: 0;
}

.settings-card > button {
  width: 100%;
  min-height: 42px;
  margin-top: 8px;
  font-size: 9px;
}

.settings-card > button:first-of-type {
  margin-top: 0;
}

.capability-card ul {
  display: grid;
  gap: 9px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.capability-card li {
  display: grid;
  grid-template-columns: 95px 1fr;
  gap: 9px;
  align-items: start;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  line-height: 1.55;
}

.capability-card li:first-child {
  padding-top: 0;
  border-top: 0;
}

.capability-card li b {
  color: var(--ink);
}

.capability-card li span,
.data-card p {
  color: var(--muted);
}

.data-card p {
  margin: 10px 1px 0;
  font-size: 10px;
  line-height: 1.6;
}

body[data-theme="mint"] {
  --canvas: #e9f0e8;
  --green: #9db4a2;
  --green-dark: #446b58;
  --green-pale: #e3eee4;
  --pink: #e5d8dc;
}

body[data-theme="night"] {
  --ink: #eef2ed;
  --muted: #aebbb4;
  --paper: #1d2925;
  --canvas: #17221f;
  --line: #3d4f47;
  --green-dark: #92b4a0;
  --green-pale: #293a33;
  color: #eef2ed;
  background:
    radial-gradient(circle at 12% 18%, rgb(160 187 171 / 12%) 0 2px, transparent 3px),
    linear-gradient(135deg, #17221f, #202833 58%, #2b2229);
}

body[data-theme="night"] .site-header,
body[data-theme="night"] .studio-stage-card,
body[data-theme="night"] .mode-panel,
body[data-theme="night"] .game-character-card,
body[data-theme="night"] .game-board-card,
body[data-theme="night"] .pet-room,
body[data-theme="night"] .settings-card {
  color: var(--ink);
  background-color: rgb(29 41 37 / 84%);
}

body[data-theme="night"] input,
body[data-theme="night"] select,
body[data-theme="night"] .motion-button,
body[data-theme="night"] .meme-card,
body[data-theme="night"] .upgrade-choice {
  color: var(--ink);
  background: #27352f;
}

body[data-theme="night"] .game-level-card,
body[data-theme="night"] .game-hud > div,
body[data-theme="night"] .studio-caption,
body[data-theme="night"] .game-reaction {
  color: var(--ink);
  background: rgb(39 53 47 / 80%);
}

@media (max-width: 1050px) {
  .studio-layout,
  .live-layout,
  .pet-layout {
    grid-template-columns: minmax(360px, 1fr) minmax(300px, 0.72fr);
  }

  .game-layout {
    grid-template-columns: minmax(210px, 0.55fr) minmax(430px, 1.45fr);
  }

  .game-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 850px) {
  .mode-view {
    min-height: calc(100vh - 62px);
    padding: 13px 12px 20px;
  }

  .mode-header {
    margin-bottom: 10px;
    padding: 0;
  }

  .mode-save-state {
    display: none;
  }

  .studio-layout,
  .game-layout,
  .live-layout,
  .pet-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  .studio-layout {
    grid-template-rows: minmax(420px, 62dvh) minmax(340px, 50dvh);
  }

  .studio-stage-card {
    padding: 9px;
  }

  .mode-panel {
    min-height: 0;
  }

  .game-layout {
    grid-template-rows: auto auto;
  }

  .game-character-card {
    grid-template-columns: minmax(170px, 0.8fr) minmax(130px, 0.55fr);
    grid-template-rows: minmax(220px, 34dvh);
    align-items: stretch;
  }

  .game-character-stage {
    grid-column: 1;
    grid-row: 1;
  }

  .game-character-side {
    grid-column: 2;
    grid-row: 1;
    align-content: center;
  }

  .game-board-card {
    min-height: min(760px, calc(100dvh - 80px));
  }

  .game-board {
    --board-size: min(75vw, 67dvh, 560px);
  }

  .pet-layout {
    grid-template-rows: minmax(500px, 65dvh) auto;
  }

  .live-layout {
    grid-template-rows: minmax(520px, 66dvh) auto;
  }

  .pet-room {
    min-height: 500px;
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  body[data-route="studio"] .site-header,
  body[data-route="meme"] .site-header,
  body[data-route="game"] .site-header,
  body[data-route="live"] .site-header,
  body[data-route="pet"] .site-header,
  body[data-route="settings"] .site-header {
    display: none;
  }

  .mode-view {
    min-height: 100dvh;
    padding: 8px 8px 16px;
    background: #eef1e9;
  }

  .mode-header {
    min-height: 49px;
    margin-bottom: 6px;
  }

  .mode-heading p {
    font-size: 8px;
  }

  .mode-heading h2 {
    font-size: 18px;
  }

  .back-button {
    width: 36px;
    height: 36px;
  }

  .mode-segmented button {
    min-height: 30px;
    padding: 0 9px;
    font-size: 8px;
  }

  /*
   * Keep the action stage inside the real WebView height. The old fixed
   * 63px offset ignored the mode padding and the app frame's 18px bottom
   * inset, so the stage could exceed the viewport before its controls wrapped.
   * Let the header own its natural height and give the remaining space to the
   * stage/panel grid; the right panel already owns its internal scrolling.
   */
  body[data-route="studio"] .app-frame {
    height: 100dvh;
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }

  body[data-route="studio"] main,
  body[data-route="studio"] #studioView {
    height: 100%;
    min-height: 0;
  }

  body[data-route="studio"] #studioView {
    display: grid;
    height: 100dvh;
    padding: 8px 8px max(12px, env(safe-area-inset-bottom));
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }

  body[data-route="studio"] .mode-header {
    width: 100%;
    max-width: none;
    margin-bottom: 6px;
    justify-self: stretch;
  }

  .studio-layout {
    grid-template-rows: minmax(350px, 54dvh) minmax(0, 1fr);
    gap: 8px;
    height: auto;
    min-height: 0;
    overflow: hidden;
  }

  .studio-stage-card,
  .mode-panel,
  .game-character-card,
  .game-board-card,
  .live-stage-card,
  .pet-room,
  .settings-card {
    border-radius: 16px;
  }

  .stage-topline {
    min-height: 30px;
    padding-bottom: 4px;
  }

  .stage-transport {
    grid-template-columns: auto auto minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
    padding-top: 7px;
  }

  .stage-transport .stage-progress-control {
    grid-column: 1 / -1;
  }

  .transport-main {
    min-width: 72px;
    min-height: 39px;
  }

  .stage-transport > button {
    min-width: 39px;
    min-height: 39px;
  }

  .stage-speed {
    font-size: 9px;
  }

  .stage-speed > span {
    min-width: 0;
    gap: 4px;
  }

  .stage-speed input {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 22px;
  }

  .stage-progress-control small {
    font-size: 8px;
  }

  .mode-tabs {
    padding: 7px;
  }

  .mode-tabs button {
    min-height: 34px;
  }

  .mode-panel-scroll {
    padding: 10px;
  }

  .panel-section-heading {
    margin-bottom: 9px;
  }

  .panel-section-heading h3 {
    font-size: 17px;
  }

  .motion-grid,
  .meme-grid {
    gap: 5px;
  }

  .motion-button {
    min-height: 42px;
    padding: 6px;
  }

  .motion-button > i {
    width: 26px;
    height: 26px;
  }

  .mode-panel-scroll .field-card,
  .custom-meme-card,
  .export-grid button,
  .custom-meme-card input[type="file"],
  .custom-meme-card button,
  .settings-card,
  .settings-card button,
  .pet-actions button,
  .pet-count-actions button {
    scroll-margin-top: 64px;
  }

  .game-layout {
    gap: 8px;
  }

  .game-character-card {
    grid-template-columns: minmax(150px, 1fr) minmax(112px, 0.7fr);
    grid-template-rows: minmax(180px, 26dvh);
    gap: 7px;
    padding: 8px;
  }

  .game-character-stage {
    min-height: 180px;
  }

  #gameCanvas {
    bottom: -14%;
  }

  .game-level-card {
    margin-top: 0;
    padding: 9px;
  }

  .game-pulse-button {
    min-height: 41px;
  }

  .game-board-card {
    min-height: calc(100dvh - 150px);
    padding: 8px;
  }

  .game-hud {
    gap: 4px;
  }

  .game-hud > div {
    padding: 6px;
  }

  .game-hud b {
    font-size: 11px;
  }

  .game-board-wrap {
    padding: 8px 0;
  }

  .game-board {
    --board-size: min(91vw, calc(100dvh - 325px));
    gap: 3px;
    padding: 5px;
    border-radius: 17px;
  }

  .game-cell {
    border-radius: 8px;
    touch-action: none;
  }

  .game-actions {
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
  }

  .game-actions button {
    min-height: 45px;
    padding: 6px;
  }

  .game-help {
    margin-top: 5px;
  }

  .game-result {
    inset: 5px;
    padding: 12px;
    overflow: hidden;
  }

  .game-upgrade {
    inset: 0;
    padding: 20px;
    overflow: hidden;
  }

  .game-upgrade > div {
    width: 100%;
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  #gameUpgradeChoices {
    grid-template-columns: 1fr;
    gap: 10px;
    max-height: none;
    overflow: visible;
  }

  .upgrade-choice {
    min-height: 100px;
    padding: 16px 15px 16px 76px;
  }

  .upgrade-icon {
    left: 15px;
    width: 45px;
    height: 45px;
    border-radius: 15px;
  }

  .pet-layout {
    grid-template-rows: minmax(330px, 55dvh) auto;
    gap: 8px;
  }

  .live-layout {
    grid-template-rows: minmax(390px, 59dvh) auto;
    gap: 8px;
  }

  .live-stage-card {
    padding: 8px;
  }

  .live-stage-topline {
    grid-template-columns: 1fr auto;
    min-height: 31px;
    padding: 0 4px 6px;
  }

  .live-stage-topline small {
    display: none;
  }

  .live-stage-topline > span:last-child {
    font-size: 7px;
  }

  #liveCanvas {
    right: 5%;
    bottom: -15%;
    left: 5%;
    width: 90%;
    height: 119%;
  }

  .live-stage-orbit {
    width: 78%;
  }

  .live-camera-note {
    top: 9px;
    left: 9px;
    padding: 6px 8px;
    font-size: 7px;
  }

  .live-expression-chip {
    right: 8px;
    bottom: 8px;
    left: 8px;
    gap: 5px;
    padding: 6px 8px;
  }

  .live-expression-chip span {
    font-size: 5px;
  }

  .live-expression-chip b {
    font-size: 8px;
  }

  .live-controls {
    padding-top: 7px;
  }

  .live-controls button {
    min-height: 46px;
  }

  .live-controls .live-camera-toggle {
    grid-template-columns: 32px 1fr;
    gap: 7px;
    padding: 6px 8px;
  }

  .live-controls .live-screen-toggle {
    grid-template-columns: 32px 1fr;
    gap: 7px;
    padding: 6px 8px;
  }

  .live-control-icon {
    width: 30px;
    height: 30px;
  }

  #liveCalibrate {
    min-width: 96px;
    padding: 5px 8px;
  }

  .live-panel {
    padding: 0;
  }

  .live-panel .mode-panel-scroll {
    padding: 10px;
  }

  .pet-room {
    min-height: 330px;
  }

  .pet-instance {
    width: min(62%, 280px);
    height: 80%;
  }

  .pet-instance:nth-child(2) {
    width: min(44%, 200px);
    height: 65%;
  }

  .pet-instance:nth-child(3) {
    width: min(38%, 170px);
    height: 58%;
  }

  .pet-instance:nth-child(4),
  .pet-instance:nth-child(5),
  .pet-instance:nth-child(6) {
    width: min(30%, 112px);
    height: 44%;
  }

  .pet-panel {
    padding: 10px;
  }

  .pet-actions {
    gap: 5px;
  }

  .pet-actions button {
    min-height: 40px;
  }

  .settings-layout {
    gap: 8px;
  }

  .settings-card {
    padding: 12px;
  }
}

/*
 * Android renders the exact WebView that already owns the MediaPipe camera
 * stream inside TYPE_APPLICATION_OVERLAY. Only the live character canvas is
 * exposed; all page chrome stays in the activity.
 */
html.cotton-native-live-overlay,
html.cotton-native-live-overlay body {
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  overflow: hidden !important;
  background: transparent !important;
  touch-action: none !important;
}

html.cotton-native-live-overlay .app-frame,
html.cotton-native-live-overlay main {
  position: fixed !important;
  inset: 0 !important;
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  background: transparent !important;
}

html.cotton-native-live-overlay .app-frame > :not(main),
html.cotton-native-live-overlay main > :not(#liveView),
html.cotton-native-live-overlay #liveView > :not(.live-layout),
html.cotton-native-live-overlay .live-layout > :not(.live-stage-card),
html.cotton-native-live-overlay .live-stage-card > :not(.live-stage),
html.cotton-native-live-overlay .live-stage > :not(#liveCanvas) {
  display: none !important;
}

html.cotton-native-live-overlay #liveView,
html.cotton-native-live-overlay .live-layout,
html.cotton-native-live-overlay .live-stage-card,
html.cotton-native-live-overlay #liveStage {
  visibility: visible !important;
}

html.cotton-native-live-overlay .app-frame,
html.cotton-native-live-overlay main,
html.cotton-native-live-overlay #liveView,
html.cotton-native-live-overlay .live-layout,
html.cotton-native-live-overlay .live-stage-card,
html.cotton-native-live-overlay #liveStage,
html.cotton-native-live-overlay #liveCanvas {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none !important;
}

html.cotton-native-live-overlay #liveView {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  background: transparent !important;
}

html.cotton-native-live-overlay .live-layout,
html.cotton-native-live-overlay .live-stage-card {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  background: transparent !important;
}

html.cotton-native-live-overlay #liveStage {
  position: fixed !important;
  top: var(--live-overlay-top, 3%) !important;
  left: var(--live-overlay-left, 3%) !important;
  right: auto !important;
  bottom: auto !important;
  width: var(--live-overlay-width, 94%) !important;
  height: var(--live-overlay-height, 94%) !important;
  min-height: 0 !important;
  overflow: visible !important;
  transform: none !important;
  border-radius: 0 !important;
  background: transparent !important;
}

html.cotton-native-live-overlay #liveStage::before,
html.cotton-native-live-overlay #liveStage::after,
html.cotton-native-live-overlay .live-stage-orbit,
html.cotton-native-live-overlay .live-stage-spark {
  display: none !important;
}

html.cotton-native-live-overlay #liveCanvas {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  transform: none !important;
  object-fit: contain !important;
}

/* Standalone meme workbench */
.tool-meme .tool-icon {
  background: linear-gradient(145deg, #f6dfb5, #f0b9a8);
}

.meme-native-controls { display: none; }
.meme-stage-badge { visibility: hidden; }
.meme-view {
  --meme-ink: #263d37;
  --meme-muted: #74837b;
  --meme-line: rgba(51, 73, 66, 0.13);
  --meme-paper: #fbfaf5;
  --meme-green: #6f927a;
  min-height: 0;
}

.meme-header {
  flex: 0 0 auto;
}

.meme-layout {
  display: grid;
  grid-template-columns: minmax(440px, 0.92fr) minmax(450px, 1.08fr);
  gap: clamp(16px, 2vw, 28px);
  width: min(1500px, calc(100% - 48px));
  min-height: 0;
  margin: 0 auto;
  padding: 0 0 22px;
}

.meme-stage-card,
.meme-panel {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--meme-line);
  border-radius: 28px;
  background: color-mix(in srgb, var(--meme-paper) 94%, transparent);
  box-shadow: 0 24px 70px rgba(55, 71, 61, 0.09);
}

.meme-stage-card {
  align-self: start;
  padding: 18px;
}

.meme-stage-topline {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 0 5px 12px;
}

.meme-stage-topline > span,
.meme-stage-topline > small {
  color: var(--meme-muted);
  font-size: 12px;
}

.meme-stage-topline > span {
  padding: 5px 9px;
  border-radius: 999px;
  background: #edf2ea;
}

.meme-stage-topline > b {
  min-width: 0;
  overflow: hidden;
  color: var(--meme-ink);
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meme-stage-topline > small {
  color: var(--meme-green);
}

.meme-stage-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid rgba(46, 67, 58, 0.12);
  border-radius: 22px;
  background-color: #f4f1e8;
  isolation: isolate;
}

.meme-stage-frame[data-background="transparent"] {
  background-color: #f7f5ef;
  background-image:
    linear-gradient(45deg, rgba(111, 146, 122, 0.09) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(111, 146, 122, 0.09) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(111, 146, 122, 0.09) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(111, 146, 122, 0.09) 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

#memeCanvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.meme-stage-badge {
  position: absolute;
  z-index: 2;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 6px;
  align-items: center;
  pointer-events: none;
}

.meme-stage-badge span,
.meme-stage-badge b {
  padding: 6px 9px;
  border: 1px solid rgba(53, 73, 65, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #52625a;
  font-size: 10px;
  font-weight: 650;
  backdrop-filter: blur(8px);
}

.meme-stage-badge b {
  color: var(--meme-ink);
}

.meme-export-progress {
  position: absolute;
  z-index: 4;
  right: 14px;
  bottom: 14px;
  left: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(43, 65, 56, 0.16);
  border-radius: 14px;
  background: rgba(250, 249, 244, 0.94);
  box-shadow: 0 12px 32px rgba(39, 58, 50, 0.16);
  backdrop-filter: blur(12px);
}

.meme-export-progress > span,
.meme-batch-progress > span {
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: #e2e7e1;
}

.meme-export-progress > span > i,
.meme-batch-progress > span > i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #708f7a, #c1a75d);
  transition: width 180ms ease;
}

.meme-export-progress > b,
.meme-batch-progress > b {
  display: block;
  margin-top: 7px;
  color: #42534b;
  font-size: 11px;
  font-weight: 650;
}

.meme-stage-controls {
  display: grid;
  grid-template-columns: auto auto minmax(150px, 1fr);
  gap: 9px;
  align-items: end;
  padding: 14px 2px 10px;
}

.meme-stage-controls > button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--meme-line);
  border-radius: 13px;
  background: #fff;
  color: var(--meme-ink);
  font-weight: 650;
}

.meme-stage-controls .meme-play-button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  background: #eef3ed;
}

.meme-play-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
}

.meme-speed-control {
  display: grid;
  gap: 7px;
  padding: 0 3px;
}

.meme-speed-control > span {
  display: flex;
  justify-content: space-between;
  color: var(--meme-muted);
  font-size: 11px;
}

.meme-speed-control output {
  color: var(--meme-ink);
  font-weight: 700;
}

.meme-speed-control input {
  width: 100%;
  accent-color: var(--meme-green);
}

#memeSpeed,
#memeNativeSpeed {
  --meme-range-progress: 50%;
  appearance: none;
  -webkit-appearance: none;
  height: 16.04px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  accent-color: #9db4a5;
  cursor: pointer;
}

#memeSpeed::-webkit-slider-runnable-track,
#memeNativeSpeed::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #bccbc0 0 var(--meme-range-progress),
    #3b3b3b var(--meme-range-progress) 100%
  );
}

#memeSpeed::-webkit-slider-thumb,
#memeNativeSpeed::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 19px;
  height: 19px;
  margin-top: -6.5px;
  border: 0;
  border-radius: 50%;
  background: #bccbc0;
  box-shadow: 0 0 0 1px rgb(59 59 59 / 8%);
}

#memeSpeed::-moz-range-track,
#memeNativeSpeed::-moz-range-track {
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #bccbc0 0 var(--meme-range-progress),
    #3b3b3b var(--meme-range-progress) 100%
  );
}

#memeSpeed::-moz-range-thumb,
#memeNativeSpeed::-moz-range-thumb {
  width: 19px;
  height: 19px;
  border: 0;
  border-radius: 50%;
  background: #bccbc0;
  box-shadow: 0 0 0 1px rgb(59 59 59 / 8%);
}

.meme-export-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.meme-export-actions button {
  display: grid;
  gap: 3px;
  min-height: 61px;
  padding: 9px 7px;
  border: 1px solid var(--meme-line);
  border-radius: 14px;
  background: #fff;
  color: var(--meme-ink);
}

.meme-export-actions button:first-child {
  border-color: rgba(89, 125, 101, 0.3);
  background: #e8f0e6;
}

.meme-export-actions button:disabled {
  opacity: 0.52;
}

.meme-export-actions b {
  font-size: 12px;
}

.meme-export-actions small {
  color: var(--meme-muted);
  font-size: 9px;
}

.meme-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  background: rgba(249, 249, 244, 0.95);
}

.meme-panel-scroll {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 19px 20px 26px;
  scrollbar-width: thin;
}

.meme-panel-section {
  padding: 0 0 21px;
  margin: 0 0 21px;
  border-bottom: 1px solid var(--meme-line);
}

.meme-panel-section:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: 0;
}

.compact-heading {
  margin-bottom: 12px;
}

.compact-heading > span {
  max-width: 46%;
  color: var(--meme-muted);
  font-size: 10px;
  text-align: right;
}

.meme-category-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border-radius: 15px;
  background: #e9eee7;
}

.meme-category-tabs button {
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #697a71;
  font-weight: 650;
}

.meme-category-tabs button b {
  margin-left: 3px;
  font-size: 10px;
  opacity: 0.65;
}

.meme-category-tabs button.active {
  background: #fff;
  color: var(--meme-ink);
  box-shadow: 0 4px 16px rgba(51, 69, 60, 0.08);
}

.meme-workbench-search {
  margin: 11px 0;
}

.meme-workbench-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  max-height: 258px;
  overflow: auto;
  padding: 2px 2px 3px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.meme-workbench-card {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  min-height: 87px;
  padding: 8px 5px;
  border: 1px solid var(--meme-line);
  border-radius: 13px;
  background: #fff;
  color: var(--meme-ink);
}

.meme-workbench-card > span {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #f3eee1;
  color: #a8874c;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 16px;
}

.meme-workbench-card b {
  max-width: 100%;
  overflow: hidden;
  font-size: 10px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meme-workbench-card small {
  color: var(--meme-muted);
  font-size: 8px;
}

.meme-workbench-card.active {
  border-color: #6d9078;
  background: #edf3eb;
  box-shadow: inset 0 0 0 1px rgba(109, 144, 120, 0.26);
}

.meme-empty-state {
  grid-column: 1 / -1;
  padding: 18px;
  color: var(--meme-muted);
  text-align: center;
}

.meme-choice-grid {
  display: grid;
  gap: 7px;
}

.expression-choice-grid {
  grid-template-columns: repeat(3, 1fr);
}

.background-choice-grid {
  grid-template-columns: repeat(4, 1fr);
}

.meme-choice-button {
  display: grid;
  gap: 2px;
  min-height: 55px;
  padding: 8px 7px;
  border: 1px solid var(--meme-line);
  border-radius: 12px;
  background: #fff;
  color: var(--meme-ink);
}

.meme-choice-button b {
  font-size: 11px;
}

.meme-choice-button small {
  color: var(--meme-muted);
  font-size: 8px;
  line-height: 1.2;
}

.meme-choice-button.active {
  border-color: #6d9078;
  background: #eaf1e8;
  box-shadow: inset 0 0 0 1px rgba(109, 144, 120, 0.2);
}

.meme-color-field,
.meme-custom-background {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px solid var(--meme-line);
  border-radius: 12px;
  background: #fff;
  color: var(--meme-muted);
  font-size: 10px;
}

.meme-color-field > span {
  margin-right: auto;
}

.meme-color-field input {
  width: 31px;
  height: 25px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
}

.meme-color-field output {
  color: var(--meme-ink);
  font-weight: 650;
}

.meme-custom-background input {
  min-width: 0;
  flex: 1;
  color: var(--meme-muted);
  font-size: 10px;
}

.meme-custom-background button {
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: #edf0eb;
  color: var(--meme-ink);
}

.meme-quality-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.meme-quality-button {
  display: grid;
  gap: 3px;
  min-height: 68px;
  padding: 10px;
  border: 1px solid var(--meme-line);
  border-radius: 13px;
  background: #fff;
  color: var(--meme-ink);
  text-align: left;
}

.meme-quality-button span {
  color: var(--meme-muted);
  font-size: 9px;
}

.meme-quality-button small {
  color: #95a099;
  font-size: 8px;
}

.meme-quality-button.active {
  border-color: #6d9078;
  background: #eaf1e8;
}

.meme-caption-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.meme-caption-card > span,
.meme-caption-card > small {
  color: var(--meme-muted);
  font-size: 10px;
}

.meme-caption-card input {
  min-width: 0;
}

.meme-sticker-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  margin-top: 9px;
  padding: 10px 12px;
  border: 1px solid var(--meme-line);
  border-radius: 13px;
  background: #fff;
}

.meme-sticker-card > div {
  display: grid;
  gap: 2px;
}

.meme-sticker-card b {
  color: var(--meme-ink);
  font-size: 11px;
}

.meme-sticker-card small {
  color: var(--meme-muted);
  font-size: 8px;
}

.meme-sticker-card input {
  width: 148px;
  min-width: 0;
  color: var(--meme-muted);
  font-size: 9px;
}

.meme-sticker-card button {
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: #edf0eb;
  color: var(--meme-ink);
}

.meme-batch-dock {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 13px 18px;
  border-top: 1px solid var(--meme-line);
  background: rgba(240, 242, 236, 0.96);
  backdrop-filter: blur(14px);
}

.meme-batch-dock > div {
  display: grid;
  gap: 1px;
  margin-right: auto;
}

.meme-batch-dock small {
  color: var(--meme-muted);
  font-size: 8px;
  letter-spacing: 0.11em;
}

.meme-batch-dock b {
  color: var(--meme-ink);
  font-size: 12px;
}

.meme-batch-dock > button {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 13px;
  background: #6f927a;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(70, 100, 81, 0.18);
}

.meme-batch-dialog {
  width: min(620px, calc(100vw - 28px));
  max-height: min(780px, calc(100dvh - 28px));
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  background: #fbfaf5;
  color: var(--meme-ink);
  box-shadow: 0 30px 100px rgba(33, 48, 41, 0.3);
}

.meme-batch-dialog::backdrop {
  background: rgba(28, 40, 34, 0.35);
  backdrop-filter: blur(6px);
}

.meme-batch-shell {
  display: grid;
  grid-template-rows: auto auto auto minmax(120px, 1fr) auto auto;
  max-height: min(780px, calc(100dvh - 28px));
  padding: 0;
}

.meme-batch-shell > header {
  display: flex;
  align-items: center;
  padding: 18px 19px 12px;
}

.meme-batch-shell > header p {
  margin: 0 0 3px;
  color: var(--meme-muted);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.meme-batch-shell > header h2 {
  margin: 0;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 22px;
  font-weight: 500;
}

.meme-batch-shell .dialog-close {
  width: 36px;
  height: 36px;
  margin-left: auto;
  border: 1px solid var(--meme-line);
  border-radius: 50%;
  background: #fff;
  color: var(--meme-ink);
  font-size: 22px;
}

.meme-batch-summary {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 19px 13px;
  border-bottom: 1px solid var(--meme-line);
}

.meme-batch-summary label {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--meme-muted);
  font-size: 10px;
}

.meme-batch-summary select {
  min-height: 34px;
  border: 1px solid var(--meme-line);
  border-radius: 9px;
  background: #fff;
  color: var(--meme-ink);
}

.meme-batch-summary > span {
  color: var(--meme-muted);
  font-size: 9px;
}

.meme-batch-toolbar {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 10px 19px;
}

.meme-batch-toolbar label {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  font-weight: 650;
}

.meme-batch-toolbar button {
  padding: 5px 9px;
  border: 0;
  border-radius: 8px;
  background: #edf1eb;
  color: var(--meme-ink);
  font-size: 10px;
}

.meme-batch-toolbar b {
  margin-left: auto;
  color: var(--meme-muted);
  font-size: 10px;
}

.meme-batch-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  min-height: 120px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 2px 19px 13px;
  scrollbar-width: thin;
}

.meme-batch-item {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 7px 9px;
  border: 1px solid var(--meme-line);
  border-radius: 10px;
  background: #fff;
  font-size: 10px;
}

.meme-batch-item input {
  accent-color: var(--meme-green);
}

.meme-batch-item span {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.meme-batch-item i {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #f2eee2;
  color: #a8874c;
  font-family: "YuzuPop", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-style: normal;
}

.meme-batch-item b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meme-batch-progress {
  margin: 0 19px 10px;
  padding: 10px 12px;
  border-radius: 11px;
  background: #eef2eb;
}

.meme-batch-shell > footer {
  display: flex;
  gap: 9px;
  padding: 13px 19px 18px;
  border-top: 1px solid var(--meme-line);
}

.meme-batch-shell > footer button {
  min-height: 44px;
  padding: 0 17px;
  border: 1px solid var(--meme-line);
  border-radius: 12px;
  background: #fff;
  color: var(--meme-ink);
  font-weight: 650;
}

.meme-batch-shell > footer button:last-child {
  display: flex;
  flex: 1;
  gap: 10px;
  align-items: center;
  justify-content: center;
  border: 0;
  background: #6f927a;
  color: #fff;
}

.meme-batch-shell > footer button small {
  color: rgba(255, 255, 255, 0.74);
}

.meme-batch-shell > footer button:disabled {
  opacity: 0.55;
}

@media (max-width: 1050px) {
  .meme-view {
    overflow: auto;
  }

  .meme-layout {
    grid-template-columns: 1fr;
    width: min(760px, calc(100% - 32px));
    padding-bottom: 42px;
  }

  .meme-panel {
    overflow: visible;
  }

  .meme-panel-scroll {
    overflow: visible;
  }

  .meme-workbench-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    max-height: 280px;
  }

  .meme-batch-dock {
    position: sticky;
    z-index: 8;
    bottom: 10px;
    border: 1px solid var(--meme-line);
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(43, 59, 51, 0.13);
  }
}

@media (max-width: 640px) {
  .meme-layout {
    width: calc(100% - 20px);
    gap: 12px;
    padding-bottom: 26px;
  }

  .meme-stage-card,
  .meme-panel {
    border-radius: 21px;
  }

  .meme-stage-card {
    padding: 11px;
  }

  .meme-stage-frame {
    border-radius: 17px;
  }

  .meme-stage-topline {
    padding-bottom: 9px;
  }

  .meme-stage-controls {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .meme-speed-control {
    grid-column: 1 / -1;
    padding-top: 2px;
  }

  .meme-export-actions {
    grid-template-columns: repeat(2, 1fr);
  }

  .meme-export-actions button {
    min-height: 54px;
  }

  .meme-panel-scroll {
    padding: 16px 14px 22px;
  }

  .meme-workbench-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-height: 272px;
  }

  .background-choice-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .meme-quality-button {
    padding: 8px 6px;
  }

  .meme-quality-button small {
    font-size: 7px;
  }

  .meme-caption-card {
    grid-template-columns: 1fr auto;
  }

  .meme-caption-card > span {
    grid-column: 1 / -1;
  }

  .meme-sticker-card {
    grid-template-columns: 1fr auto;
  }

  .meme-sticker-card > div {
    grid-column: 1 / -1;
  }

  .meme-sticker-card input {
    width: 100%;
  }

  .meme-batch-dock {
    padding: 11px;
  }

  .meme-batch-dock > div {
    min-width: 0;
  }

  .meme-batch-dock b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .meme-batch-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 18px;
  }

  .meme-batch-shell {
    max-height: calc(100dvh - 16px);
  }

  .meme-batch-summary {
    display: grid;
  }

  .meme-batch-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 370px), (max-height: 610px) and (max-width: 640px) {
  .meme-layout {
    width: calc(100% - 12px);
  }

  .meme-stage-card {
    padding: 8px;
  }

  .meme-stage-topline {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .meme-stage-topline > small {
    display: none;
  }

  .meme-stage-badge {
    right: 8px;
    bottom: 8px;
  }

  .meme-stage-badge span {
    display: none;
  }

  .meme-stage-controls {
    gap: 6px;
    padding-top: 9px;
  }

  .meme-stage-controls > button {
    min-height: 38px;
    padding: 0 10px;
    font-size: 11px;
  }

  .meme-export-actions {
    gap: 6px;
  }

  .meme-workbench-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: 236px;
  }

  .meme-choice-button {
    min-height: 50px;
    padding: 7px 5px;
  }

  .meme-choice-button small {
    display: none;
  }

  .meme-batch-dock > div {
    display: none;
  }

  .meme-batch-dock > button {
    width: 100%;
  }

  .meme-batch-shell > header {
    padding: 13px 14px 9px;
  }

  .meme-batch-summary,
  .meme-batch-toolbar,
  .meme-batch-list,
  .meme-batch-shell > footer {
    padding-right: 14px;
    padding-left: 14px;
  }

  .meme-batch-summary > span {
    display: none;
  }

  .meme-batch-progress {
    margin-right: 14px;
    margin-left: 14px;
  }
}

@media (max-width: 850px) and (max-height: 700px) {
  .studio-layout {
    grid-template-rows: clamp(310px, 52dvh, 355px) minmax(0, 1fr);
  }

  .mode-panel-scroll {
    padding-bottom: 16px;
  }

  .game-board {
    --board-size: min(91vw, 500px);
  }

  .game-view {
    padding-right: 8px;
    padding-left: 8px;
  }

  .game-board-card {
    padding: 6px;
  }

  .pet-layout {
    grid-template-rows: clamp(320px, 53dvh, 370px) auto;
  }

  .live-layout {
    grid-template-rows: clamp(360px, 57dvh, 410px) auto;
  }

  .pet-room {
    min-height: 0;
  }
}

/*
 * Yuzu 2.175 mobile wardrobe: the native header occupies 62.75px, the room
 * takes 35% of the remaining viewport, and the collection sheet owns the rest.
 * Desktop keeps the broader side-by-side editor.
 */
@media (max-width: 850px) {
  body[data-route="editor"] {
    overflow: hidden;
    background: #ecefe7;
  }

  body[data-route="editor"] .app-frame {
    padding: 0;
  }

  body[data-route="editor"] .editor-view {
    padding: 0;
    background: #ecefe7;
  }

  body[data-route="editor"] .editor-header {
    min-height: 62.75px;
    margin: 0;
    padding: 0 16.4px 0 19px;
    gap: 10px;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    background: #ecefe7;
  }

  body[data-route="editor"] .editor-header .back-button {
    width: 34px;
    height: 34px;
    border-color: rgb(121 142 124 / 16%);
    background: rgb(250 251 246 / 42%);
  }

  body[data-route="editor"] .editor-title p,
  body[data-route="editor"] .editor-status,
  body[data-route="editor"] .editor-actions .text-button {
    display: none;
  }

  body[data-route="editor"] .editor-title {
    display: block;
  }

  body[data-route="editor"] .editor-title h2 {
    color: #83957c;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 20px;
    font-weight: 700;
  }

  body[data-route="editor"] .editor-actions {
    margin: 0;
  }

  body[data-route="editor"] .done-button {
    min-width: 65.8px;
    min-height: 42.4px;
    margin: 0;
    padding: 9px 14px;
    border: 0;
    border-radius: 12px;
    color: #f9faef;
    background: #9bad8e;
    font-size: 11px;
  }

  body[data-route="editor"] .editor-layout {
    height: calc(100dvh - 62.75px);
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 35% minmax(0, 1fr);
    border: 0;
    border-radius: 0;
    background: #f8f8f1;
    box-shadow: none;
  }

  body[data-route="editor"] .preview-panel {
    position: relative;
    display: block;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: #ecefe7;
  }

  body[data-route="editor"] .preview-toolbar {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: block;
    min-height: 0;
    pointer-events: none;
  }

  body[data-route="editor"] .preview-toolbar > div:first-child,
  body[data-route="editor"] .preview-actions,
  body[data-route="editor"] .preview-footer {
    display: none;
  }

  body[data-route="editor"] .character-stage {
    position: absolute;
    inset: 0;
    border-radius: 0;
    background:
      linear-gradient(145deg, rgb(255 255 255 / 8%), transparent 54%),
      linear-gradient(180deg, #ecefe7, #e6eadf);
  }

  body[data-route="editor"] .character-stage::before {
    width: 34%;
    top: 7%;
    left: 7%;
    border: 0;
    border-radius: 44px;
    background:
      linear-gradient(90deg, transparent 48%, rgb(250 251 245 / 78%) 49% 53%, transparent 54%),
      linear-gradient(180deg, transparent 48%, rgb(250 251 245 / 78%) 49% 53%, transparent 54%),
      #dce5da;
  }

  body[data-route="editor"] .character-stage::after {
    position: absolute;
    right: 8%;
    bottom: 0;
    width: 29%;
    height: 39%;
    border: 3px solid #bdc9b7;
    border-bottom: 0;
    border-radius: 68px 68px 0 0;
    box-shadow: inset 0 0 0 7px rgb(247 248 241 / 72%);
    content: "";
    pointer-events: none;
  }

  body[data-route="editor"] #editorCanvas {
    right: 19%;
    bottom: -14%;
    left: 19%;
    width: 62%;
    height: 114%;
  }

  body[data-route="editor"] .wardrobe-stage-actions {
    inset: 0;
    display: block;
    pointer-events: none;
  }

  body[data-route="editor"] .wardrobe-stage-actions button {
    position: absolute;
    width: auto;
    min-height: 31px;
    padding: 5px 9px;
    gap: 5px;
    border-color: #d8dfd0;
    border-radius: 11px;
    color: #8c9b80;
    background: rgb(245 246 237 / 84%);
    box-shadow: none;
    font-size: 10px;
    white-space: nowrap;
    pointer-events: auto;
  }

  body[data-route="editor"] .wardrobe-stage-actions button svg {
    width: 15px;
    height: 15px;
  }

  body[data-route="editor"] #wardrobeClear {
    top: 12px;
    left: 12px;
    display: grid;
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    place-items: center;
  }

  body[data-route="editor"] #wardrobeClear span {
    display: none;
  }

  body[data-route="editor"] #wardrobeTurn {
    top: 53px;
    left: 12px;
    min-width: 60px;
  }

  body[data-route="editor"] #wardrobeMirror {
    top: 93px;
    left: 12px;
    min-width: 60px;
  }

  body[data-route="editor"] #wardrobeFreeImport {
    bottom: 12px;
    left: 12px;
    min-width: 76px;
  }

  body[data-route="editor"] #wardrobeNight {
    top: 12px;
    right: 12px;
    width: 52px;
  }

  body[data-route="editor"] #wardrobeSave {
    top: 51px;
    right: 12px;
    width: 52px;
  }

  body[data-route="editor"] #wardrobeShare {
    top: 90px;
    right: 12px;
    width: 54px;
  }

  body[data-route="editor"] .wardrobe-stage-actions button.active {
    color: #f8faf3;
    background: #7f9478;
  }

  body[data-route="editor"] .canvas-interaction-hint {
    bottom: 8px;
    z-index: 5;
    font-size: 6px;
  }

  body[data-route="editor"] .tool-panel {
    min-height: 0;
    grid-template-rows: 55px minmax(0, 1fr) auto;
    overflow: hidden;
    border: 1px solid #e1e6d9;
    border-right: 0;
    border-top: 1px solid #d9dfd2;
    border-left: 0;
    border-radius: 22px 22px 0 0;
    background: #f8f8f1;
  }

  body[data-route="editor"] .panel-command-bar {
    min-height: 55px;
    height: 55px;
    padding: 12px 16px 7px;
    border: 0;
    background: transparent;
  }

  body[data-route="editor"] .panel-selection small {
    display: none;
  }

  body[data-route="editor"] .panel-selection b {
    color: #7f9278;
    font-size: 11px;
    font-weight: 500;
  }

  body[data-route="editor"] .panel-command-actions {
    gap: 2px;
  }

  body[data-route="editor"] .panel-command-actions .layer-quick-button {
    min-height: 27px;
    padding: 0 5px;
    border: 0;
    background: transparent;
    color: #85967d;
  }

  body[data-route="editor"] .panel-command-actions .layer-quick-button span {
    font-size: 9px;
  }

  body[data-route="editor"] .panel-command-actions .layer-quick-button b {
    min-width: 15px;
    color: #7f9478;
    background: #e4ebdc;
  }

  body[data-route="editor"] .panel-command-actions .history-group {
    gap: 1px;
    margin-left: 3px;
  }

  body[data-route="editor"] .panel-command-actions .history-group button {
    width: 29px;
    height: 27px;
    min-height: 27px;
    border: 0;
    background: transparent;
  }

  body[data-route="editor"] .panel-scroll {
    min-height: 0;
    padding: 0 16px 14px;
    scroll-padding-block-start: 76px;
  }

  body[data-route="editor"] .tabs {
    position: sticky;
    top: 0;
    z-index: 7;
    display: flex;
    margin: 0 0 8px;
    padding: 0;
    gap: 3px;
    border: 0;
    border-radius: 0;
    background: #f8f8f1;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    touch-action: pan-x;
  }

  body[data-route="editor"] .tabs::-webkit-scrollbar {
    display: none;
  }

  body[data-route="editor"] .tabs button {
    flex: 0 0 auto;
    min-height: 37px;
    padding: 7px 12px;
    border-radius: 11px;
    color: #a2ae94;
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
  }

  body[data-route="editor"] .tabs button.active {
    color: #849971;
    background: #e3ebd9;
    box-shadow: none;
  }

@media (max-width: 480px) {
  body[data-route="editor"] .tabs {
    gap: 1px;
  }

  body[data-route="editor"] .tabs button {
    padding-inline: clamp(6px, 1.9vw, 9px);
    font-size: clamp(10px, 2.8vw, 12px);
  }
}

  body[data-route="editor"] .category-row {
    position: sticky;
    top: 37px;
    z-index: 6;
    min-height: 38px;
    margin: 0;
    padding: 0 0 6px;
    gap: 14px;
    background: #f8f8f1;
  }

  body[data-route="editor"] .category-row button {
    min-height: 32px;
    padding: 6px 1px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: #a9b29f;
    background: transparent;
    font-size: 11px;
  }

  body[data-route="editor"] .category-row button.active {
    color: #8fa577;
    border-bottom-color: #b0c19f;
    background: transparent;
  }

  body[data-route="editor"] .category-row button[data-count]::after {
    display: none;
  }

  body[data-route="editor"] .closet-scroll-note {
    display: block;
    margin: 0;
    padding: 0 1px 15px;
    color: #a3ae98;
    font-size: 10px;
    line-height: 15px;
  }

  body[data-route="editor"] .catalog-heading:not(.is-outfit-heading) {
    display: none;
  }

  body[data-route="editor"] .catalog-heading.is-outfit-heading {
    margin: 2px 0 10px;
  }

  body[data-route="editor"] .catalog-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
  }

  body[data-route="editor"] .item-card {
    min-height: 80px;
    padding: 5px 3px;
    border-color: #e4e8dc;
    border-radius: 12px;
    color: #7a8d70;
    background: #fffef8;
  }

  body[data-route="editor"] .item-card.selected {
    border-color: #aabc96;
    background: #eaf0e1;
    box-shadow: none;
  }

  body[data-route="editor"] .item-card-image {
    height: 52px;
  }

  body[data-route="editor"] .item-card b {
    color: #87977a;
    font-size: 9px;
  }

  body[data-route="editor"] .item-card small {
    display: none;
  }

  body[data-route="editor"] .edit-dock {
    max-height: min(34dvh, 280px);
    border-top: 1px solid #e1e6d9;
    background: #f8f8f1;
    box-shadow: none;
  }

  body[data-route="editor"] .dock-heading {
    min-height: 45px;
    padding: 5px 16px;
  }

  body[data-route="editor"] .dock-heading small {
    font-size: 8px;
  }

  body[data-route="editor"] .dock-heading b {
    font-size: 14px;
  }

  body[data-route="editor"] .dock-body {
    padding: 0 16px 14px;
  }
}

@media (max-width: 520px) and (max-height: 620px) {
  /* Keep all 32 runtime colors reachable without making the short-screen dock taller. */
  body[data-route="editor"] .swatches {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(2, 24px);
    grid-auto-columns: 24px;
    justify-content: start;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 3px;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  body[data-route="editor"] .saved-colors {
    flex-wrap: nowrap;
    overflow-x: auto;
    min-height: 12px;
    scrollbar-width: none;
  }
  body[data-route="editor"] .saved-color-swatch {
    flex-shrink: 0;
  }
  body[data-route="editor"] .editor-layout {
    grid-template-rows: 31% minmax(0, 1fr);
  }

  body[data-route="editor"] .panel-command-bar {
    height: 36px;
    min-height: 36px;
    padding: 7px 16px 3px;
  }

  body[data-route="editor"] .tool-panel {
    grid-template-rows: 36px minmax(0, 1fr) auto;
  }

  body[data-route="editor"] .panel-scroll {
    padding-bottom: 9px;
  }

  body[data-route="editor"] .tabs button {
    min-height: 33px;
  }

  body[data-route="editor"] .category-row {
    top: 33px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .studio-fx::before,
  .studio-fx::after,
  .game-cell.well-charge,
  .game-cell.just-merged,
  .game-cell.just-pulse {
    animation: none !important;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
/* Android 2.175 phone and landscape meme screen. Landscape retains the same
   full-width preview and vertical control sheet rather than expanding into a
   desktop two-column workspace. */
@media (max-width: 640px), (orientation: landscape) and (max-height: 500px) and (max-width: 900px) {
  body[data-route="meme"] .site-header { display: none; }
  #memeView {
    position: fixed;
    inset: 0;
    z-index: 15000;
    box-sizing: border-box;
    width: 100%;
    height: 100dvh;
    padding: 16px;
    color: #53675b;
    background: #f6f5ef;
    font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif;
    overflow: auto;
  }
  #memeView .meme-header { display:flex; justify-content:space-between; height:56.667px; min-height:56.667px; margin:0 0 18px; padding:0; }
  #memeView .mode-heading { order:0; }
  #memeView .mode-heading p, #memeSaveState { display:none; }
  #memeView .mode-heading h2 { margin:0; font:700 24px/normal "Microsoft YaHei UI", "PingFang SC", sans-serif; color:#53675b; }
  #memeView .back-button { order:1; width:44px; height:56.667px; padding:11px; border:1px solid #d9dfd5; border-radius:12px; color:#53675b; background:#f6f5ef; }
  #memeView .back-button svg { display:none; }
  #memeView .back-button::before { content:'×'; font:23px/normal "Microsoft YaHei UI", "PingFang SC", sans-serif; }
  #memeView .meme-layout { display:block; width:100%; margin:0; padding:0; }
  #memeView .meme-stage-card { padding:0; border:0; border-radius:0; background:transparent; box-shadow:none; }
  #memeView .meme-stage-frame { border:0; border-radius:22px; }
  #memeView .meme-stage-topline, #memeView .meme-stage-controls,
  #memeView .meme-export-actions, #memeView .meme-panel,
  #memeView .meme-accessory-open { display:none; }
  #memeView .meme-native-controls { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin-top:14px; padding:14px; border-radius:20px; background:#ecefe7; color:#53675b; font:12px/normal "Microsoft YaHei UI", "PingFang SC", sans-serif; }
  .meme-native-controls label { display:flex; flex-direction:column; gap:7px; min-width:0; line-height:17.524px; }
  .meme-native-controls select, .meme-native-controls button { width:100%; min-width:0; min-height:42px; border:1px solid #d9dfd5; border-radius:12px; background:#f6f5ef; color:inherit; font:inherit; padding:11px; }
  .meme-native-controls button { cursor:pointer; align-self:stretch; }
  .meme-native-controls .theme-select-wrap { display:block; width:100%; min-width:0; }
  .meme-native-controls .theme-select-button {
    position:relative;
    box-sizing:border-box;
    width:100%;
    min-height:42px;
    padding:11px 32px 11px 11px;
    border:1px solid #d9dfd5;
    border-radius:12px;
    background:#f6f5ef;
    color:inherit;
    font:12px/16.8px "Microsoft YaHei UI", "PingFang SC", sans-serif;
    text-align:left;
  }
  .meme-native-controls .theme-select-button::after {
    content:"";
    position:absolute;
    top:calc(50% - 4px);
    right:14px;
    width:6px;
    height:6px;
    border-right:1.5px solid #91a18a;
    border-bottom:1.5px solid #91a18a;
    transform:rotate(45deg);
  }
  .meme-native-controls button:disabled { opacity:.45; cursor:default; }
  .meme-native-controls [data-meme-native-export="png"] { background:#9db4a7; color:#263e31; }
  .meme-native-controls [data-meme-native-export="layers"] { background:#e9dcde; }
  .meme-native-controls #memeNativeQuality { height:42.571px; }
  .meme-native-controls .meme-native-speed { grid-column:1 / -1; display:grid; grid-template-columns:1fr auto; gap:7px; font-size:13px; line-height:19.048px; }
  .meme-native-speed input { grid-column:1 / -1; width:100%; accent-color:#9db5a7; }
  .meme-native-controls input[type="color"] { width:100%; min-height:42px; }
  #memeNativeStatus { grid-column:1 / -1; margin:0; font-size:12px; line-height:20.4px; overflow-wrap:anywhere; }
}

body[data-route="meme"] #themeSelectDialog {
  box-sizing:border-box;
  width:min(390px,calc(100vw - 32px));
  max-height:min(620px,85dvh);
  padding:16px;
  overflow:hidden;
  border:1px solid #d9e2cf;
  border-radius:21px;
  background:#faf9f2;
  color:#7e9076;
  box-shadow:0 16px 50px #49584326;
  font:14px "Microsoft YaHei UI", "PingFang SC", sans-serif;
}
body[data-route="meme"] #themeSelectDialog::backdrop {
  background:#58694d44;
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}
body[data-route="meme"] #themeSelectDialog header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin-bottom:13px;
}
body[data-route="meme"] #themeSelectDialog h3 {
  margin:0;
  font-size:18px;
  font-weight:400;
}
body[data-route="meme"] #themeSelectDialog header button {
  width:32px;
  height:32px;
  min-height:32px;
  padding:0;
  border:0;
  border-radius:50%;
  background:#e9eddf;
  color:#91a080;
  font-size:21px;
  cursor:pointer;
}
body[data-route="meme"] #themeSelectDialog input {
  box-sizing:border-box;
  width:100%;
  min-height:42px;
  margin:0 0 10px;
  padding:10px 13px;
  border:1px solid #dce4d3;
  border-radius:12px;
  background:#fffdf8;
  color:#7d8e76;
  font:inherit;
}
body[data-route="meme"] #themeSelectDialog input[hidden] { display:none; }
body[data-route="meme"] #themeSelectDialog .theme-choice-list {
  display:grid;
  gap:7px;
  max-height:min(440px,60dvh);
  margin:0;
  padding:2px 4px 3px 1px;
  overflow:auto;
  overscroll-behavior:contain;
  scrollbar-width:thin;
  scrollbar-color:#bfccb1 transparent;
}
body[data-route="meme"] #themeSelectDialog .theme-choice-list button {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  min-height:43px;
  padding:11px 13px;
  border:1px solid #e1e6d8;
  border-radius:12px;
  background:#fffef8;
  color:#87977d;
  font:14px "Microsoft YaHei UI", "PingFang SC", sans-serif;
  text-align:left;
  cursor:pointer;
}
body[data-route="meme"] #themeSelectDialog .theme-choice-list button[aria-selected="true"] {
  border-color:#b7cda5;
  background:#e6eedc;
  color:#748f60;
}
body[data-route="meme"] #themeSelectDialog .theme-choice-list p {
  margin:8px;
  font-size:12px;
  color:#a4ae99;
  text-align:center;
}
.appearance-options > div { display:flex; flex-wrap:wrap; gap:12px; padding:8px 0; font-size:12px; }
.appearance-options label { min-height:32px; align-items:center; }
.appearance-options input { accent-color:#7a947d; }
.meme-accessory-open { margin:12px 0; min-height:44px; padding:10px 16px; border:1px solid #d8e1d1; border-radius:12px; background:#ecefe5; color:#52665a; cursor:pointer; }
.meme-accessory-dialog { box-sizing:border-box; width:min(460px,calc(100vw - 24px)); max-height:calc(100dvh - 24px); overflow:auto; overscroll-behavior:contain; padding:18px; border:1px solid #d8e1d1; border-radius:20px; color:#52665a; background:#f7f5ef; }
.meme-accessory-dialog::backdrop { background:#203b315c; }
.meme-accessory-dialog header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.meme-accessory-dialog h3 { margin:0 0 12px; }
.meme-accessory-content p { font-size:12px; line-height:1.6; overflow-wrap:anywhere; }
.meme-accessory-content select { width:100%; margin:8px 0; min-height:44px; }
.meme-accessory-content button, .meme-accessory-dialog header button { min-height:44px; padding:8px 12px; border:1px solid #d8e1d1; border-radius:10px; background:#ecefe5; color:inherit; cursor:pointer; }
.meme-accessory-content button:disabled { opacity:.45; cursor:default; }
.meme-accessory-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.meme-accessory-preview { display:grid; place-items:center; height:140px; border-radius:12px; background:repeating-conic-gradient(#eee 0% 25%,white 0% 50%) 50% / 16px 16px; }
.meme-accessory-preview img { max-width:100%; max-height:140px; object-fit:contain; }
@media (max-height:600px) { .meme-accessory-preview { height:90px; } .meme-accessory-preview img { max-height:90px; } .meme-accessory-dialog { padding:12px; } }

.part-import-dialog form.has-import-tabs { grid-template-rows:auto auto minmax(0,1fr); }
#wardrobeImportSection { min-height:0; display:grid; grid-template-rows:minmax(0,1fr) auto; }
.import-section-tabs { display:flex; gap:8px; padding:8px 12px; }
.import-section-tabs button { flex:1; min-height:40px; border:1px solid var(--line); border-radius:10px; background:#f5f7f0; color:var(--ink); }
.import-section-tabs button[aria-pressed="true"] { background:#dce7db; }
.meme-accessory-inline { min-height:0; overflow:auto; overscroll-behavior:contain; padding:12px; }

/*
 * Wardrobe readability pass. Keep every content-bearing wardrobe surface on
 * an opaque fill. Alpha belongs in character artwork; it should not leak into
 * the editor chrome, thumbnail mats or outfit preview mats.
 */
body[data-route="editor"] .editor-header,
body[data-route="editor"] .editor-layout,
body[data-route="editor"] .preview-panel,
body[data-route="editor"] .tool-panel,
body[data-route="editor"] .tabs,
body[data-route="editor"] .category-row,
body[data-route="editor"] .edit-dock,
body[data-route="editor"] .dock-body,
body[data-route="editor"] .outfit-dialog,
body[data-route="editor"] .outfit-dialog > form,
body[data-route="editor"] .outfit-dialog-body,
body[data-route="editor"] .outfit-dialog footer,
body[data-route="editor"] .part-import-dialog,
body[data-route="editor"] .part-import-dialog form,
body[data-route="editor"] .part-import-scroll,
body[data-route="editor"] .color-picker-dialog,
body[data-route="editor"] .color-picker-body,
body[data-route="editor"] .saved-color-delete-dialog {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body[data-route="editor"] .part-import-dialog form,
body[data-route="editor"] .part-import-scroll,
body[data-route="editor"] .import-section-tabs {
  background: #fbfaf5 !important;
  background-image: none !important;
  opacity: 1 !important;
}

body[data-route="editor"] .editor-header,
body[data-route="editor"] .preview-panel {
  background: #ecefe7 !important;
}

body[data-route="editor"] .editor-layout,
body[data-route="editor"] .tool-panel,
body[data-route="editor"] .panel-command-bar,
body[data-route="editor"] .edit-dock {
  background: #f8f8f1 !important;
}

body[data-route="editor"] .editor-header .back-button,
body[data-route="editor"] .wardrobe-stage-actions button {
  background: #fafbf6 !important;
}

body[data-route="editor"] .wardrobe-stage-actions button.active {
  color: #f8faf3 !important;
  background: #7f9478 !important;
}

body[data-route="editor"] .character-stage {
  background: #ecefe7 !important;
  background-image: none !important;
}

body[data-route="editor"] .character-stage::before {
  display: none !important;
}

body[data-route="editor"] .character-stage::after {
  display: none !important;
}

body[data-route="editor"] .wardrobe-room {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #ecefe7;
  pointer-events: none;
}

body[data-route="editor"] .wardrobe-room svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: initial;
  stroke: none;
}

body[data-route="editor"] .character-stage.is-night .wardrobe-room {
  filter: brightness(0.5) saturate(0.78) hue-rotate(18deg);
}

body[data-route="editor"] #editorCanvas,
body[data-route="editor"] .canvas-candidates,
body[data-route="editor"] .canvas-interaction-hint {
  z-index: 2;
}

body[data-route="editor"] .wardrobe-stage-actions {
  z-index: 3;
}

body[data-route="editor"] .wardrobe-tool,
body[data-route="editor"] .outfit-toolbar button,
body[data-route="editor"] .outfit-card,
body[data-route="editor"] .outfit-card-actions button {
  background: #fffef9 !important;
}

body[data-route="editor"] .outfit-toolbar button:first-child,
body[data-route="editor"] .outfit-card-actions button:first-child {
  color: #fff !important;
  background: #718b79 !important;
}

body[data-route="editor"] .outfit-card-load {
  background: #fffef9 !important;
  background-image: none !important;
}

body[data-route="editor"] .outfit-new-slot {
  background: #f5f8f2 !important;
  background-image: none !important;
}

body[data-route="editor"] .outfit-card-preview {
  background: #e5ebe2 !important;
  background-image: none !important;
}

body[data-route="editor"] .outfit-card-preview::before {
  background: #cfd9ce !important;
  filter: none !important;
}

body[data-route="editor"] .outfit-card.is-current {
  border-color: #91a489 !important;
  background: #edf2e7 !important;
  box-shadow: inset 0 0 0 1px #91a489 !important;
}

body[data-route="editor"] .outfit-card.is-current .outfit-card-preview {
  background: #e7eee1 !important;
}

body[data-route="editor"] .outfit-card-copy {
  background: #fffef9 !important;
  background-image: none !important;
}

body[data-route="editor"] .outfit-card.is-current .outfit-card-load,
body[data-route="editor"] .outfit-card.is-current .outfit-card-copy {
  background: #edf2e7 !important;
}

body[data-route="editor"] .item-thumbnail,
body[data-route="editor"] .layer-thumbnail {
  background: #f1f3ec !important;
  background-image: none !important;
}

body[data-route="editor"] .outfit-import-preview {
  background: #e5ece3 !important;
  background-image: none !important;
}

body[data-route="editor"] .outfit-dialog header,
body[data-route="editor"] .color-picker-dialog header {
  background: #fbfaf5 !important;
}

body[data-route="editor"] .outfit-dialog::backdrop,
body[data-route="editor"] .part-import-dialog::backdrop,
body[data-route="editor"] .color-picker-dialog::backdrop,
body[data-route="editor"] .saved-color-delete-dialog::backdrop {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/*
 * The original mobile wardrobe uses the stage "保存" control as the entry
 * to slot editing. Keep the utility row available on wide layouts, while the
 * phone layout keeps the tab, save mode and stage actions as its only chrome.
 */
@media (max-width: 850px) {
  body[data-route="editor"] .catalog-heading.is-outfit-heading {
    display: none !important;
  }

  body[data-route="editor"] .catalog-heading.is-outfit-heading .outfit-toolbar {
    display: none !important;
  }

  body[data-route="editor"] .catalog-grid.outfit-grid {
    gap: 9px;
    padding-inline: 3px;
  }

  body[data-route="editor"] .outfit-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-height: 0;
    overflow: visible;
    border: 0 !important;
    border-radius: 0;
    background: #f8f8f1 !important;
    box-shadow: none !important;
  }

  body[data-route="editor"] .outfit-card.is-current {
    background: #f8f8f1 !important;
    box-shadow: none !important;
  }

  body[data-route="editor"] .outfit-card-load {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    border: 1px solid #e0e5d7;
    border-radius: 14px;
    background: #f1f2e9 !important;
  }

  body[data-route="editor"] .outfit-card:first-child .outfit-card-load,
  body[data-route="editor"] .outfit-card:first-child .outfit-card-preview,
  body[data-route="editor"] .outfit-card:first-child .outfit-card-copy {
    background: #f1f2e9 !important;
  }

  body[data-route="editor"] .outfit-card:nth-child(2) .outfit-card-load,
  body[data-route="editor"] .outfit-card:nth-child(2) .outfit-card-preview,
  body[data-route="editor"] .outfit-card:nth-child(2) .outfit-card-copy {
    background: #f1ece2 !important;
  }

  body[data-route="editor"] .outfit-card:nth-child(3) .outfit-card-load,
  body[data-route="editor"] .outfit-card:nth-child(3) .outfit-card-preview,
  body[data-route="editor"] .outfit-card:nth-child(3) .outfit-card-copy {
    background: #eeebf2 !important;
  }

  body[data-route="editor"] .outfit-card:nth-child(4) .outfit-card-load,
  body[data-route="editor"] .outfit-card:nth-child(4) .outfit-card-preview,
  body[data-route="editor"] .outfit-card:nth-child(4) .outfit-card-copy {
    background: #f4e9e7 !important;
  }

  body[data-route="editor"] .outfit-card.is-current .outfit-card-load,
  body[data-route="editor"] .outfit-card.is-current .outfit-card-preview,
  body[data-route="editor"] .outfit-card.is-current .outfit-card-copy {
    background: #eaf0e1 !important;
  }

  body[data-route="editor"] .outfit-card.is-current .outfit-card-load {
    border-color: #aabc96;
    box-shadow: inset 0 0 0 1px #aabc96;
  }

  body[data-route="editor"] .outfit-card-preview {
    width: 100%;
    height: clamp(78px, 13vh, 114px);
    min-height: 0;
  }

  body[data-route="editor"] .outfit-card-copy {
    min-height: 32px;
    padding: 0 5px 8px;
    text-align: center;
  }

  body[data-route="editor"] .outfit-card-copy b {
    color: #7d8c7c;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
  }

  body[data-route="editor"] .outfit-card-copy small {
    margin-top: 0;
    color: #929c8d;
    font-size: 9px;
    line-height: 1.6;
  }

  body[data-route="editor"] .outfit-card-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 0;
    border: 0;
    background: #f8f8f1 !important;
  }

  body[data-route="editor"] .outfit-card-actions button {
    flex: 1 1 0;
    min-height: 36px;
    border: 1px solid #dde3d5;
    border-radius: 10px;
    color: #7d8c7c !important;
    background: #f5f5ed !important;
    font-size: 12px;
  }

  body[data-route="editor"] .outfit-card-actions button:first-child {
    color: #7d8c7c !important;
    background: #f5f5ed !important;
  }
}

/*
 * Wardrobe readability pass: every text-bearing control receives its own
 * opaque fill and a stronger foreground colour. This prevents transparent
 * child controls from relying on whatever happens to be painted behind them.
 */
body[data-route="editor"] .editor-header h2 {
  color: #566c4e !important;
}

body[data-route="editor"] .editor-title {
  background: #ecefe7 !important;
  background-image: none !important;
  opacity: 1 !important;
}

body[data-route="editor"] .editor-header .back-button {
  color: #53694e !important;
  background: #fbfcf7 !important;
}

body[data-route="editor"] .text-button {
  border: 1px solid #dbe2d7 !important;
  color: #5b6d60 !important;
  background: #f4f6ef !important;
  background-image: none !important;
  opacity: 1 !important;
}

body[data-route="editor"] .done-button {
  color: #fffef9 !important;
  background: #61785a !important;
}

body[data-route="editor"] .panel-selection b,
body[data-route="editor"] .panel-command-actions .layer-quick-button,
body[data-route="editor"] .panel-command-actions .history-group button {
  color: #53684c !important;
}

body[data-route="editor"] .panel-command-actions .layer-quick-button,
body[data-route="editor"] .panel-command-actions .history-group button {
  border-color: #dbe2d7 !important;
  background: #f4f6ef !important;
  background-image: none !important;
  opacity: 1 !important;
}

body[data-route="editor"] .panel-command-actions .layer-quick-button.active {
  color: #415d3f !important;
  border-color: #aebda6 !important;
  background: #e7eee0 !important;
}

body[data-route="editor"] .panel-command-actions .layer-quick-button:disabled,
body[data-route="editor"] .panel-command-actions .history-group button:disabled {
  color: #758172 !important;
  border-color: #d8ded4 !important;
  background: #e9ede5 !important;
  background-image: none !important;
  opacity: 1 !important;
}

body[data-route="editor"] .panel-command-bar,
body[data-route="editor"] .panel-scroll,
body[data-route="editor"] .catalog-heading,
body[data-route="editor"] .catalog-list {
  background: #fbfcf7 !important;
  background-image: none !important;
}

body[data-route="editor"] .tabs,
body[data-route="editor"] .category-row {
  background: #fbfcf7 !important;
  background-image: none !important;
}

body[data-route="editor"] .tabs button,
body[data-route="editor"] .category-row button {
  color: #5f6e58 !important;
  background: #f4f6ef !important;
}

body[data-route="editor"] .tabs button.active {
  color: #48633f !important;
  background: #dfe9d7 !important;
}

body[data-route="editor"] .category-row button.active {
  color: #4e6a41 !important;
  background: #eef3e9 !important;
  border-bottom-color: #8ea47f !important;
}

body[data-route="editor"] .closet-scroll-note {
  color: #5f6e58 !important;
}

body[data-route="editor"] .wardrobe-stage-actions button {
  color: #53684c !important;
  background: #fbfcf7 !important;
}

body[data-route="editor"] .wardrobe-stage-actions button.active {
  color: #fffef9 !important;
  background: #61785a !important;
}

body[data-route="editor"] .outfit-card-load,
body[data-route="editor"] .outfit-card-preview,
body[data-route="editor"] .outfit-card-copy {
  background-image: none !important;
}

body[data-route="editor"] .outfit-card-load {
  background: #f1f2e9 !important;
}

body[data-route="editor"] .outfit-card:first-child .outfit-card-load {
  background: #f1f2e9 !important;
}

body[data-route="editor"] .outfit-card:nth-child(2) .outfit-card-load {
  background: #f1ece2 !important;
}

body[data-route="editor"] .outfit-card:nth-child(3) .outfit-card-load {
  background: #eeebf2 !important;
}

body[data-route="editor"] .outfit-card:nth-child(4) .outfit-card-load {
  background: #f4e9e7 !important;
}

body[data-route="editor"] .outfit-card.is-current .outfit-card-load {
  background: #e6eedc !important;
}

body[data-route="editor"] .outfit-card-copy b {
  color: #607454 !important;
  font-weight: 700 !important;
}

body[data-route="editor"] .outfit-card-copy small {
  color: #606b58 !important;
}

body[data-route="editor"] .outfit-current-badge {
  color: #fffef9 !important;
  background: #557460 !important;
  background-image: none !important;
}

body[data-route="editor"] .outfit-card-actions,
body[data-route="editor"] .outfit-card-actions button,
body[data-route="editor"] .outfit-toolbar button {
  background-image: none !important;
}

body[data-route="editor"] .outfit-card-actions button {
  color: #5f7057 !important;
  background: #fbfcf7 !important;
}

body[data-route="editor"] .outfit-toolbar button {
  color: #5f7057 !important;
  background: #fbfcf7 !important;
}

body[data-route="editor"] .outfit-toolbar button:first-child {
  color: #fffef9 !important;
  background: #61785a !important;
}

body[data-route="editor"] .outfit-dialog footer button,
body[data-route="editor"] .outfit-dialog header > button,
body[data-route="editor"] .outfit-field input,
body[data-route="editor"] .outfit-form-error {
  background-image: none !important;
}

body[data-route="editor"] .outfit-dialog footer button,
body[data-route="editor"] .outfit-dialog header > button,
body[data-route="editor"] .outfit-field input {
  background-color: #fffef9 !important;
}

body[data-route="editor"] .outfit-dialog footer button[type="submit"],
body[data-route="editor"] .outfit-dialog footer button:last-child:not(.danger) {
  background-color: #61785a !important;
}

body[data-route="editor"] .outfit-dialog footer button.danger {
  background-color: #a9757e !important;
}

body[data-route="editor"] .outfit-form-error {
  background-color: #fff0f2 !important;
}

body[data-route="editor"] .import-section-tabs button {
  color: #53684c !important;
  background: #f5f7f0 !important;
  background-image: none !important;
  opacity: 1 !important;
}

body[data-route="editor"] .import-section-tabs button[aria-pressed="true"] {
  color: #40583a !important;
  background: #dfe9d7 !important;
}

body[data-route="editor"] .outfit-new-slot:disabled,
body[data-route="editor"] .outfit-dialog footer button:disabled {
  color: #657064 !important;
  border-color: #d8dfd5 !important;
  background-color: #edf0e8 !important;
  background-image: none !important;
  opacity: 1 !important;
}

body[data-route="editor"] .wardrobe-tool,
body[data-route="editor"] .item-card,
body[data-route="editor"] .item-thumbnail,
body[data-route="editor"] .layer-thumbnail {
  background-image: none !important;
}

body[data-route="editor"] .item-card,
body[data-route="editor"] .item-thumbnail {
  color: #617459 !important;
  background-color: #fffef9 !important;
}

body[data-route="editor"] .item-card b {
  color: #63765b !important;
}

@media (max-width: 850px) {
  body[data-route="editor"] .editor-title h2 {
    color: #566c4e !important;
  }

  body[data-route="editor"] .tool-panel,
  body[data-route="editor"] .panel-command-bar,
  body[data-route="editor"] .panel-scroll,
  body[data-route="editor"] .tabs,
  body[data-route="editor"] .category-row,
  body[data-route="editor"] .edit-dock {
    background: #fbfcf7 !important;
  }

  body[data-route="editor"] .tabs button.active {
    color: #48633f !important;
    background: #dfe9d7 !important;
  }

  body[data-route="editor"] .category-row button.active {
    color: #4e6a41 !important;
    background: #eef3e9 !important;
  }

  body[data-route="editor"] .outfit-card {
    background: #f8f8f1 !important;
  }

  body[data-route="editor"] .outfit-card-copy b {
    color: #607454 !important;
    font-size: 12px;
  }

  body[data-route="editor"] .outfit-card-copy small {
    color: #606b58 !important;
    font-size: 9px;
  }

  body[data-route="editor"] .outfit-card-actions button {
    color: #5f7057 !important;
    background: #f5f5ed !important;
  }
}

/* Illustrated play guide, aligned to Yuzu House 2.175.0. */
.howto-dialog {
  width: min(360px, calc(100vw - 40px));
  max-width: none;
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #e1e7e3;
  border-radius: 24px;
  color: #687b80;
  background: #fffdf8;
  box-shadow: 0 24px 80px rgb(42 60 51 / 16%);
}

.howto-dialog::backdrop {
  background: #e9e9e1f2;
}

.howto-card {
  max-height: calc(100dvh - 42px);
  padding: 22px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: #687b80;
  background: #fffdf8;
  font-family: "YuzuPop", "Microsoft YaHei", sans-serif;
}

.howto-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #75878a;
  font-size: 14px;
}

.howto-card button {
  min-height: 42px;
  padding: 8px 16px;
  border: 0;
  border-radius: 12px;
  color: #687b80;
  background: #e9efed;
  font: 16px "YuzuPop", "Microsoft YaHei", sans-serif;
  cursor: pointer;
}

.howto-card button:focus-visible {
  outline: 3px solid #75998b;
  outline-offset: 2px;
}

.howto-card #howToClose {
  display: grid;
  width: 42px;
  min-height: 42px;
  padding: 0;
  place-items: center;
  background: #fffdf8;
  font: 28px/1 sans-serif;
}

.howto-card #howToCount {
  margin: 8px 0;
  color: #ad777f;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.howto-card h2 {
  margin: 12px 0 18px;
  color: #60757a;
  font-size: 24px;
  line-height: 1.25;
}

.howto-card #howToText {
  min-height: 60px;
  margin: 12px 0;
  color: #607278;
  font-size: 16px;
  line-height: 1.8;
}

.howto-art {
  display: flex;
  min-height: 190px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px;
  background: #f8eff0;
}

.howto-sweet {
  display: block;
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
}

.howto-sweet img,
.howto-mini img {
  display: block;
  width: 100%;
  height: 100%;
}

.howto-track {
  position: relative;
  display: flex;
  align-items: center;
  gap: 26px;
}

.howto-arrow {
  color: #ad858e;
  font-size: 26px;
}

.howto-track .drag-from {
  animation: howto-drag 2.5s ease-in-out infinite;
}

.howto-finger {
  position: absolute;
  bottom: -23px;
  left: 22px;
  color: #94707d;
  font-size: 28px;
  animation: howto-drag 2.5s ease-in-out infinite;
}

.howto-range {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 46px);
  gap: 5px;
}

.howto-mini {
  width: 46px;
  height: 46px;
  padding: 5px;
  border-radius: 9px;
  background: #fffdf9;
}

.howto-mini.matching {
  background: #f7cdce;
}

.howto-ring {
  position: absolute;
  inset: 0;
  border: 2px dashed #849da6;
  border-radius: 50%;
  pointer-events: none;
  animation: howto-ring 2s ease-in-out infinite;
}

.howto-chain {
  display: flex;
  align-items: center;
  gap: 4px;
}

.howto-chain .howto-sweet {
  width: 58px;
  height: 58px;
}

.howto-chain b {
  color: #a67e88;
  font-size: 18px;
}

.howto-chain .result {
  animation: howto-pop 1.8s ease-in-out infinite;
}

.howto-upgrade {
  margin-top: 18px;
  padding: 8px 16px;
  border-radius: 9px;
  color: #536f80;
  background: #b9d9ea;
}

.howto-upgrade span {
  margin-left: 14px;
  color: #5d7477;
}

.howto-dots {
  display: flex;
  margin: 6px 0 14px;
  justify-content: center;
  gap: 12px;
}

.howto-dots button {
  width: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 50%;
  background: radial-gradient(circle, #dce2dd 0 4px, #fffdf8 5px);
}

.howto-dots button[aria-current="step"] {
  background: radial-gradient(circle, #d9a7ae 0 5px, #fffdf8 6px);
}

.howto-card footer {
  display: flex;
  gap: 10px;
}

.howto-card footer button {
  flex: 1;
}

.howto-card #howToNext {
  color: #8c6974;
  background: #f7cdce;
}

.howto-card #howToBack:disabled {
  color: #98a29f;
  background: #e9efed;
  opacity: 1;
  cursor: default;
}

@keyframes howto-drag {
  0%,
  15% {
    transform: translateX(0);
  }

  55%,
  75% {
    transform: translateX(30px);
  }

  100% {
    transform: translateX(0);
  }
}

@keyframes howto-ring {
  50% {
    transform: scale(0.95);
  }
}

@keyframes howto-pop {
  50% {
    transform: scale(1.1) rotate(4deg);
  }
}

@media (max-width: 380px), (max-height: 650px) {
  .howto-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 20px;
  }

  .howto-card {
    max-height: calc(100dvh - 18px);
    padding: 14px 16px;
  }

  .howto-art {
    min-height: 148px;
  }

  .howto-card h2 {
    margin: 6px 0 12px;
    font-size: 22px;
  }

  .howto-card #howToText {
    min-height: 52px;
    margin: 8px 0;
    font-size: 15px;
  }

  .howto-dots {
    margin: 0 0 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .howto-dialog *,
  .howto-dialog *::before,
  .howto-dialog *::after {
    animation: none !important;
  }
}

/* Yuzu 2.175 mobile merge layout: header, route, goal, stage, board, footer. */
.game-mobile-hud,
.game-mobile-help,
.game-mobile-route,
.game-mobile-goal,
#gameMobilePulse {
  display: none;
}

@media (max-width: 900px) {
  body[data-route="game"] .app-frame {
    min-height: 100dvh;
    padding-bottom: 0;
  }

  .game-view {
    min-height: 100dvh;
    padding: 0;
    background: #f6f5ef;
    font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif;
  }

  .game-view .mode-header {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 27px 29px;
    gap: 8px;
    width: 100%;
    max-width: none;
    height: 65px;
    margin: 0;
    padding: 8px 12px;
    background: #f6f5ef;
  }

  .game-view .mode-header > .back-button {
    width: 34px;
    height: 36px;
    padding: 7px;
    border: 0;
    border-radius: 11px;
    background: #ecefe7;
  }

  .game-view .game-mobile-home-icon {
    display: block;
    width: 19px;
    height: 19px;
    margin: auto;
    fill: none;
  }

  .game-view .game-back-icon {
    display: none;
  }

  .game-view .mode-heading,
  .game-view .mode-segmented {
    display: none;
  }

  .game-mobile-hud {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 8px;
    min-width: 0;
  }

  .game-mobile-hud > div {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 46px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: #ecefe7;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
  }

  .game-mobile-hud small {
    color: #7d8b80;
    font-size: 10px;
    line-height: 11px;
  }

  .game-mobile-hud b {
    margin: 0;
    color: #53675b;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
  }

  .game-mobile-level > b {
    font-size: 19px;
    line-height: 1.1;
  }

  #gameMobileScore {
    font-size: 18px;
    line-height: 1.2;
  }

  .game-mobile-level > i {
    position: absolute;
    right: 6px;
    bottom: 4px;
    left: 6px;
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: #dfe3d9;
  }

  .game-mobile-level > i > span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #a8bbae;
  }

  .game-mobile-level[data-pending="true"] {
    border-color: #a8b87d;
    background: #e5eddd;
    cursor: pointer;
  }

  .game-mobile-level[data-pending="true"]::after {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #d5a95b;
    content: "";
  }

  .game-mobile-help {
    display: grid;
    width: 27px;
    height: 32px;
    padding: 0;
    border: 1px solid #d9dfd5;
    border-radius: 10px;
    border-color: #d9dfd5;
    background: transparent;
    color: #5d7267;
    font: 18px/normal "Microsoft YaHei UI", "PingFang SC", sans-serif;
    place-items: center;
  }

  .game-mobile-settings {
    display: grid;
    width: 29px;
    height: 36px;
    padding: 7px;
    border: 0;
    border-radius: 11px;
    background: #ecefe7;
    color: #8e9d91;
    place-items: center;
  }

  .game-mobile-settings svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.55;
  }

  .game-mobile-route {
    display: flex;
    width: 100%;
    height: 28px;
    padding: 0 14px;
    gap: 6px;
    border-top: 1px solid #dfe4d9;
    border-bottom: 1px solid #e4e4da;
    background: #ecefe7;
    align-items: center;
    color: #53675b;
    font-size: 9px;
    white-space: nowrap;
  }

  .game-mobile-route b {
    margin: 0;
    color: #53675b;
    font-size: 10px;
    font-weight: 800;
  }

  .game-mobile-route > i {
    width: 64px;
    height: 4px;
    margin-left: 0;
    overflow: hidden;
    border-radius: 999px;
    background: #dfe4da;
  }

  .game-mobile-route > i > span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #a8bbae;
  }

  .game-mobile-route > button {
    width: 32px;
    min-height: 22px;
    margin-left: auto;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #8d9a8b;
    font: 17px sans-serif;
  }

  .game-mobile-goal {
    display: block;
    width: 100%;
    height: 30px;
    padding: 1px 6px;
    border: 0;
    border-bottom: 1px solid #dfe4d9;
    background: #f3e3e7;
    color: #937c87;
    font: 11px/28px "Microsoft YaHei UI", "PingFang SC", sans-serif;
    line-height: 28px;
    text-align: center;
  }

  .game-mobile-goal[hidden] {
    display: none !important;
  }

  .game-view .game-layout {
    display: block;
    width: auto;
    min-height: 0;
    margin: 0 12px;
  }

  .game-view .game-character-card {
    display: block;
    width: 100%;
    height: 248px;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0 0 24px 24px;
    background: #f6f5ef;
    box-shadow: none;
  }

  .game-view .game-character-stage {
    width: 100%;
    height: 214px;
    min-height: 214px;
    border-radius: 24px 24px 0 0;
    background: #fbfaef;
  }

  .game-view .game-stage-audience {
    display: block;
  }

  .game-view #gameCanvas {
    right: 13%;
    bottom: -14%;
    width: 74%;
    height: 132%;
  }

  .game-view .game-reaction {
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .game-view .game-character-side {
    display: none;
  }

  .game-view .game-board-card {
    display: block;
    width: 100%;
    min-height: 0;
    margin-top: 7px;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: #f6f5ef;
    box-shadow: none;
  }

  .game-view .game-stage-strip,
  .game-view .game-hud,
  .game-view .game-help {
    display: none;
  }

  .game-view .game-board-wrap {
    display: block;
    width: 100%;
    padding: 0;
  }

  .game-view .game-board {
    --board-size: none;
    width: 100%;
    max-height: none;
    padding: 4.5px;
    gap: 8.4px;
    border: 1.14px solid #dcded2;
    border-radius: 21px;
    background: #ecefe7;
    box-shadow: none;
  }

  .game-view .game-cell {
    border-radius: 18%;
  }

  .game-view .game-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    box-sizing: border-box;
    width: calc(100% + 24px);
    height: 72px;
    margin: 4px -12px 0;
    padding: 11px 14px 13px;
    background: #ecefe7;
  }

  .game-view .game-actions > button:not(#gameFeed):not(#gameMobilePulse) {
    display: none;
  }

  .game-view #gameFeed,
  .game-view #gameMobilePulse {
    display: flex;
    min-height: 48px;
    padding: 0;
    border-radius: 13px;
    align-items: center;
    justify-content: center;
    font-size: 16px;
  }

  .game-view #gameFeed {
    border: 0;
    background: #9db4a7;
    color: #26392f;
  }

  .game-view #gameMobilePulse {
    position: relative;
    flex-direction: column;
    border: 0;
    background: #e9dcde;
    color: #53675b;
    line-height: 1.1;
    overflow: visible;
  }

  .game-view #gameFeed b,
  .game-view #gameMobilePulse b {
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 1px;
  }

  .game-view #gameFeed small,
  .game-view #gameMobilePulse small {
    display: none;
  }

  .game-view #gameMobilePulse small {
    display: block;
    margin-top: 1px;
    color: #53675b;
    font-size: 11px;
    font-weight: 800;
    line-height: 12.1px;
    opacity: 0.72;
  }

  .game-view #gameMobilePulse:disabled {
    opacity: 0.72;
  }

  .game-view .game-mobile-pulse-bolts {
    position: absolute;
    top: -20px;
    left: -20px;
    display: none;
    width: 227px;
    height: 88px;
    overflow: visible;
    pointer-events: none;
  }

  .game-view #gameMobilePulse.charged {
    background: #f3c583;
    color: #2a2028;
    animation: game-mobile-pulse-glow 1.15s ease-in-out infinite;
  }

  .game-view #gameMobilePulse.charged.pop {
    animation:
      game-mobile-pulse-pop 0.44s cubic-bezier(0.2, 0.9, 0.3, 1),
      game-mobile-pulse-glow 1.15s ease-in-out infinite;
  }

  .game-view #gameMobilePulse.charged .game-mobile-pulse-bolts {
    display: block;
  }

  .game-view #gameMobilePulse.charged small {
    color: #2a2028;
    opacity: 0.85;
  }

  .game-view .game-mobile-pulse-bolts .arc {
    fill: none;
    stroke: url("#gameMobilePulseGradient");
    stroke-linecap: round;
    filter: drop-shadow(0 0 4px rgb(243 197 131 / 85%));
  }

  .game-view .game-mobile-pulse-bolts .a1 {
    stroke-width: 2.6;
    stroke-dasharray: 14 34;
    animation: game-mobile-arc-run 1.5s linear infinite;
  }

  .game-view .game-mobile-pulse-bolts .a2 {
    stroke-width: 1.3;
    stroke-dasharray: 5 43;
    opacity: 0.9;
    animation: game-mobile-arc-run 2.4s linear infinite reverse;
  }

  .game-view .game-mobile-pulse-bolts .fork {
    fill: none;
    stroke: #fbedd2;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 3px rgb(250 214 160 / 95%));
    animation: game-mobile-fork-flick 0.54s steps(1) infinite;
  }

  .game-view .game-mobile-pulse-bolts .fork:nth-of-type(2) {
    animation-delay: 0.09s;
  }

  .game-view .game-mobile-pulse-bolts .fork:nth-of-type(3) {
    animation-delay: 0.21s;
  }

  .game-view .game-mobile-pulse-bolts .fork:nth-of-type(4) {
    animation-delay: 0.14s;
  }

  .game-view .game-mobile-pulse-bolts .fork:nth-of-type(5) {
    animation-delay: 0.31s;
  }

  .game-view .game-mobile-pulse-bolts .fork:nth-of-type(6) {
    animation-delay: 0.05s;
  }

  .game-view .game-mobile-pulse-bolts .fork:nth-of-type(7) {
    animation-delay: 0.26s;
  }
}

@keyframes game-mobile-pulse-glow {
  0%,
  100% {
    box-shadow:
      0 2px 0 #26392f,
      0 0 0 0 rgb(243 197 131 / 0%),
      0 0 10px rgb(243 197 131 / 45%);
  }

  50% {
    box-shadow:
      0 2px 0 #26392f,
      0 0 0 4px rgb(243 197 131 / 28%),
      0 0 24px rgb(243 197 131 / 92%);
  }
}

@keyframes game-mobile-pulse-pop {
  0% {
    transform: scale(1);
  }

  26% {
    transform: scale(1.5);
  }

  100% {
    transform: scale(1);
  }
}

.pulseGhost {
  position: fixed;
  z-index: 900;
  box-sizing: border-box;
  border: 1px solid #f3c583;
  border-radius: 6px;
  background: rgb(243 197 131 / 22%);
  box-shadow:
    0 0 26px rgb(243 197 131 / 70%),
    inset 0 0 18px rgb(243 197 131 / 45%);
  opacity: 0.3;
  pointer-events: none;
  transform: scale(2);
  transform-origin: 50% 50%;
  animation: game-pulse-ghost-fade 1s ease-out forwards;
}

@keyframes game-pulse-ghost-fade {
  0% {
    opacity: 0.3;
    transform: scale(2);
  }

  100% {
    opacity: 0;
    transform: scale(2.14);
  }
}

@keyframes game-mobile-arc-run {
  to {
    stroke-dashoffset: -48;
  }
}

@keyframes game-mobile-fork-flick {
  50% {
    opacity: 0.27;
  }
}

@media (max-width: 900px) {
  body[data-route="game"] {
    overflow: hidden;
  }
}

@media (max-width: 900px) and (max-height: 700px) {
  .game-top-alert {
    top: 57px;
  }

  .game-view .mode-header {
    height: 56px;
  }

  .game-view .game-layout {
    position: relative;
    height: calc(100dvh - 174px);
    min-height: 0;
  }

  .game-view .game-character-card {
    width: 100%;
    height: 33%;
    min-height: 96px;
    overflow: hidden;
  }

  .game-view .game-character-stage {
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .game-view .game-stage-audience {
    display: none;
  }

  .game-view .game-board-card {
    position: absolute;
    top: calc(33% + 2px);
    right: 0;
    bottom: 4px;
    left: 0;
    height: auto;
    margin: 0;
  }

  .game-view .game-board-wrap {
    display: flex;
    width: 100%;
    height: 100%;
    padding: 0;
    align-items: center;
    justify-content: center;
  }

  .game-view .game-board {
    width: auto;
    max-width: 100%;
    height: 100%;
    padding: 4px;
    gap: 6px;
    aspect-ratio: 1;
  }

  .game-view .game-actions {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 60px;
    margin: 0;
    padding: 0 12px;
    align-items: center;
  }

  .game-view #gameFeed,
  .game-view #gameMobilePulse {
    min-height: 48px;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .game-top-alert {
    left: 25%;
    max-width: calc(50% - 20px);
  }
}

/* Game dialogs are viewport modals on phones so a short board never clips them. */
@media (max-width: 850px) {
  .game-upgrade {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    max-height: none;
    padding: 20px;
    overflow: hidden;
    transform: none;
  }

  .game-view .game-result {
    position: fixed;
    inset: auto;
    top: 50%;
    left: 50%;
    width: min(calc(100vw - 24px), 380px);
    max-height: calc(100dvh - 24px);
    padding: 14px;
    overflow: hidden;
    transform: translate(-50%, -50%);
  }

  .game-upgrade > div {
    width: min(410px, 100%);
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

@media (max-width: 380px) {
  .game-upgrade {
    padding: 14px;
  }

  .game-upgrade > div {
    max-height: calc(100dvh - 28px);
    padding: 18px;
  }

  .upgrade-choice {
    padding-left: 67px;
  }

  .upgrade-icon {
    left: 12px;
    width: 40px;
    height: 40px;
  }
}

/* Yuzu 2.175 mobile companion room. Desktop keeps the full management panel. */
.pet-mobile-top-actions,
.pet-mobile-reset,
.pet-original-scenery,
.pet-mobile-toolbox,
.pet-mobile-help {
  display: none;
}

@media (max-width: 850px) {
  body[data-route="pet"] {
    overflow: hidden;
    background: #f5f2ec;
  }

  body[data-route="pet"] .site-header {
    display: none;
  }

  body[data-route="pet"] .app-frame {
    padding: 0;
    background: #f5f2ec;
  }

  #petView {
    position: fixed;
    inset: 0;
    z-index: 15000;
    display: block;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    padding: 18px 20px 0;
    overflow: hidden;
    color: #53675b;
    background: #f5f2ec;
    font-family: YuzuPop, sans-serif;
  }

  #petView .mode-header {
    position: relative;
    z-index: 40;
    display: flex;
    width: 100%;
    min-height: 48px;
    align-items: center;
    margin: 0;
    padding: 0;
  }

  #petView .mode-heading {
    order: 0;
    min-width: 0;
  }

  #petView .mode-heading p,
  #petView .mode-save-state {
    display: none;
  }

  #petView .mode-heading h2 {
    margin: 0;
    color: #6d7f86;
    font: 700 27px/normal YuzuPop, sans-serif;
  }

  #petView .mode-header .back-button {
    order: 1;
    display: grid;
    width: 40px;
    height: calc(1.43lh + 16.76px);
    min-width: 40px;
    min-height: calc(1.43lh + 16.76px);
    margin-left: auto;
    padding: 0;
    border: 0;
    border-radius: 50%;
    place-items: center;
    color: #8a9380;
    background: #e8e9df;
    font-size: 22px;
  }

  #petView .mode-header .back-button svg {
    display: none;
  }

  #petView .mode-header .back-button::before {
    content: "×";
    font: 22px/normal YuzuPop, sans-serif;
  }

  .pet-mobile-top-actions {
    position: absolute;
    top: 76px;
    left: 20px;
    z-index: 35;
    display: flex;
    gap: 9px;
  }

  .pet-mobile-top-actions button {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    min-height: calc(1.42725lh + 17.926px);
    padding: 8px 13px;
    border: 0.762px solid #d9dfd5;
    border-radius: 15px;
    color: #53675b;
    background: #ecefe7;
    font: 16px/1 "Microsoft YaHei UI", "PingFang SC", sans-serif;
  }

  .pet-mobile-top-actions svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
  }

  #petView .pet-layout {
    position: absolute;
    inset: 0;
    display: block;
    min-height: 0;
  }

  #petView .pet-room {
    position: absolute;
    inset: 0;
    min-height: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: transparent;
    touch-action: none;
  }

  #petView .pet-room::after {
    display: none;
  }

  #petView .pet-room-sky,
  #petView .pet-drag-handle {
    display: none;
  }

  .pet-original-scenery {
    position: absolute;
    inset: 90px 0 140px;
    z-index: 0;
    display: block;
    background: linear-gradient(#f5f2ec 77%, #e4e9df 77%);
    pointer-events: none;
  }

  .pet-original-window {
    position: absolute;
    top: 10%;
    left: 10%;
    box-sizing: border-box;
    width: 25%;
    height: 35%;
    border: 8px solid #fffdf7;
    border-bottom: 0;
    border-radius: 80px 80px 0 0;
    background:
      linear-gradient(90deg, transparent calc(50% - 4px), #fff calc(50% - 4px) calc(50% + 4px), transparent calc(50% + 4px)),
      linear-gradient(transparent 56%, #fff 56% calc(56% + 7px), transparent calc(56% + 7px)),
      #dbe7e6;
  }

  .pet-original-wall-art {
    position: absolute;
    top: 8%;
    right: 17%;
    width: 55px;
    height: 55px;
    rotate: 3deg;
  }

  .pet-original-shelf {
    position: absolute;
    top: 39%;
    right: 8%;
    width: 22%;
    height: 9px;
    background: #c8b9a7;
  }

  .pet-original-shelf-art {
    position: absolute;
    bottom: 7px;
    left: 0;
    display: block;
    width: 100%;
    height: auto;
  }

  .pet-mobile-reset {
    position: absolute;
    top: 124px;
    left: 20px;
    z-index: 24;
    display: block;
    min-width: calc(1lh + 20px);
    min-height: calc(1.483lh + 9.18px);
    width: calc(1lh + 20px);
    height: calc(1.483lh + 9.18px);
    padding: 5px 10px;
    border: 0;
    border-radius: 16px;
    place-items: center;
    color: #576e64;
    background: #e3e9e4;
    font: 19px/normal YuzuPop, sans-serif;
  }

  #petView .pet-instances {
    inset: 0;
    z-index: 4;
  }

  #petView .pet-instance:nth-child(2) {
    z-index: 2;
  }

  #petView .pet-instance:nth-child(3) {
    z-index: 1;
  }

  #petView .pet-instance:nth-child(4),
  #petView .pet-instance:nth-child(5),
  #petView .pet-instance:nth-child(6) {
    z-index: 3;
  }

  #petView .pet-instances > .pet-instance {
    right: auto;
    bottom: auto;
    left: calc((100% - var(--pet-mobile-width, min(54vw, 225px))) / 2);
    top: var(--pet-mobile-top, 158px);
    width: var(--pet-mobile-width, min(54vw, 225px));
    height: var(--pet-mobile-height, min(38vh, 280px));
  }

  #petView .pet-bubble {
    color: #53675b;
    background: #fffdf8;
    font-size: 11px;
  }

  .pet-mobile-toolbox {
    position: absolute;
    right: 16px;
    bottom: calc(2.397lh + 107.09px);
    left: 16px;
    z-index: 25;
    display: block;
    font-size: 12px;
  }

  .pet-mobile-controls-toggle {
    position: absolute;
    right: 0;
    bottom: calc(100% + 7px);
    min-height: max(32px, calc(0.892lh + 16.37px));
    padding: 6px 12px;
    border: 0.762px solid #dce2d8;
    border-radius: 12px;
    color: #82958b;
    background: rgb(255 253 244 / 91%);
    font: 12px/normal "Microsoft YaHei UI", "PingFang SC", sans-serif;
  }

  .pet-mobile-control-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    box-sizing: border-box;
    padding: 10px;
    border-radius: 20px 20px 0 0;
    background: rgb(245 242 236 / 94%);
  }

  .pet-mobile-control-grid button {
    min-height: max(48.762px, calc(0.989lh + 25.91px));
    padding: 12px 15px;
    border: 0.762px solid #dce3d9;
    border-radius: 16px;
    color: #576e64;
    background: #e3e9e4;
    font: 16px/normal "Microsoft YaHei UI", "PingFang SC", sans-serif;
  }

  .pet-mobile-control-grid button:nth-child(2) {
    background: #f0dfe3;
    color: #9a7a89;
  }

  .pet-mobile-control-grid button:nth-child(4) {
    background: #dde8ed;
    color: #788e9b;
  }

  .pet-mobile-control-grid button.active {
    border-color: #a9beb0;
    background: #d5e4d8;
  }

  #petView.pet-mobile-controls-collapsed .pet-mobile-control-grid {
    display: none;
  }

  #petView .pet-panel {
    position: absolute;
    right: 26px;
    top: auto;
    bottom: 16px;
    left: 26px;
    z-index: 28;
    height: calc(2.397lh + 92.09px);
    min-height: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: rgb(245 242 236 / 94%);
    box-shadow: none;
    font-size: 12px;
  }

  #petView .pet-panel-scroll {
    display: grid;
    gap: 9px;
    height: 100%;
    padding: 0;
    overflow: visible;
  }

  #petView .panel-section-heading,
  #petView .pet-actions,
  #petView .pet-count-actions {
    display: none;
  }

  #petView .pet-panel-scroll > :not(.pet-outfit-picker):not(.pet-size-control):not(.pet-mobile-help):not(.pet-mobile-toolbox) {
    display: none;
  }

  #petView .pet-outfit-picker {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr) 38px;
    gap: 7px;
    align-items: center;
    min-height: max(44px, calc(1.667lh + 24.4px));
    padding: 0;
    border: 0;
    background: transparent;
  }

  #petView .pet-outfit-picker > span {
    overflow: visible;
    font-size: 0;
    white-space: nowrap;
  }

  #petView .pet-outfit-picker > span::before {
    content: "当前桌宠";
    color: #6d8076;
    font: 12px/1 "Microsoft YaHei UI", "PingFang SC", sans-serif;
  }

  #petView .pet-outfit-picker > div {
    display: contents;
  }

  #petView .pet-outfit-picker select,
  #petView .pet-outfit-picker button {
    height: 36px;
    min-height: 36px;
    border: 0.762px solid #dce3d9;
    border-radius: 10px;
    color: #7c9285;
    background: #fffdf5;
    font: 12px/normal "Microsoft YaHei UI", "PingFang SC", sans-serif;
  }

  #petView .pet-outfit-picker button {
    padding: 0;
    width: 38px;
    height: 38px;
    min-height: 38px;
    font-size: 0;
  }

  #petView .pet-outfit-picker button::before {
    content: "+";
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
      font: 24px/normal sans-serif;
  }

  #petView .pet-outfit-picker small {
    display: none;
  }

  #petView .pet-size-control {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr) 43px;
    gap: 7px;
    align-items: center;
    min-height: 32px;
    max-height: 32px;
    padding: 2px 4px;
    border: 0;
    background: transparent;
  }

  #petView .pet-size-control > span {
    display: block;
    overflow: visible;
    color: #7a8b81;
    font: 12px/1 "Microsoft YaHei UI", "PingFang SC", sans-serif;
    text-overflow: clip;
    white-space: nowrap;
  }

  #petView .pet-size-control input {
    width: 100%;
    min-width: 0;
    accent-color: #a0b8c1;
  }

  #petView .pet-size-control output {
    color: #7a8b81;
    font-size: 12px;
    text-align: right;
  }

  #petView .pet-mobile-help {
    display: block;
    min-height: 18px;
    margin: 1px 0 0;
    color: #87918a;
      font: 11px/17.595px "Microsoft YaHei UI", "PingFang SC", sans-serif;
    text-align: center;
  }

  #petView .pet-panel-scroll > .pet-background-dialog[open] {
    display: block !important;
  }

  #petView .pet-panel-scroll > .pet-relations-dialog[open] {
    display: block !important;
  }

  #petView .pet-panel-scroll > .pet-voice-dialog[open],
  #petView .pet-panel-scroll > .pet-choice-dialog[open] {
    display: block !important;
  }
}

@media (max-width: 400px) {
  .pet-mobile-control-grid button {
    padding: 7px 15px;
  }

  #petView .pet-panel {
    top: calc(100% - 164px);
  }
}

@media (max-width: 850px) and (max-height: 700px) {
  #petView {
    padding: 12px 14px 0;
  }

  #petView .mode-header {
    min-height: 48px;
  }

  #petView .mode-heading h2 {
    font-size: 23px;
    line-height: normal;
  }

  #petView .mode-header .back-button {
    width: 40px;
    height: 48px;
    min-width: 40px;
  }

  .pet-mobile-top-actions {
    top: 76px;
  }

  .pet-mobile-top-actions button {
    min-height: 52.19px;
    padding: 8px 13px;
    font-size: 16px;
  }

  .pet-original-scenery {
    inset: 72px 0 125px;
  }

  .pet-mobile-toolbox {
    right: 12px;
    bottom: 123px;
    left: 12px;
  }

  .pet-mobile-control-grid {
    gap: 7px;
    padding: 7px;
  }

  .pet-mobile-control-grid button {
    min-height: 38px;
    font-size: 12px;
  }

  .pet-mobile-controls-toggle {
    min-height: 32px;
    font-size: 12px;
  }

  #petView .pet-panel {
    right: 26px;
    left: 26px;
    top: auto;
    bottom: 10px;
    height: 113px;
  }

  #petView .pet-outfit-picker {
    min-height: 44px;
  }

  #petView .pet-panel-scroll {
    gap: 7px;
  }

  #petView .pet-mobile-help {
    min-height: 16px;
    font: 10px/16px "Microsoft YaHei UI", "PingFang SC", sans-serif;
  }

  .pet-voice-dialog,
  .pet-choice-dialog {
    max-height: calc(100dvh - 16px);
    padding: 14px;
  }

  .pet-voice-dialog > header,
  .pet-choice-dialog > header {
    min-height: 34px;
  }

  .pet-voice-presets {
    margin-top: 12px;
    gap: 6px;
  }

  .pet-voice-presets button {
    min-height: 36px;
    padding: 6px;
    font-size: 10px;
  }

  .pet-voice-dialog > label,
  .pet-voice-more > label {
    margin: 9px 0;
  }

  .pet-choice-dialog > p {
    margin: 9px 0;
    font-size: 12px;
  }

  .pet-choice-grid {
    gap: 7px;
  }

  .pet-choice-grid button {
    padding: 7px;
  }

  .pet-choice-grid canvas {
    height: 108px;
  }
}

/*
 * Yousongwu 2.175 live page geometry. Mobile keeps the original full-screen
 * room, compact character controls and two floating panels. The desktop
 * diagnostics remain available above the phone breakpoint.
 */
.live-mode-caption,
.live-reset-button,
.live-room-scenery,
.live-stage-toolbar,
.live-mobile-size,
.live-mobile-help,
.live-filter-panel {
  display: none;
}

.live-background-dialog {
  box-sizing: border-box;
  width: min(390px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid #d9e0d4;
  border-radius: 20px;
  color: #728477;
  background: #faf9f2;
  font: 14px "Microsoft YaHei UI", "PingFang SC", sans-serif;
}

.live-background-dialog::backdrop {
  background: rgb(67 83 74 / 34%);
}

.live-background-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.live-background-dialog h3 {
  margin: 0;
  font-size: 21px;
}

.live-background-dialog header button {
  min-width: 35px;
  min-height: 36px;
  border: 0;
  color: inherit;
  background: transparent;
  font-size: 22px;
}

.live-background-dialog > div {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.live-background-dialog > div button {
  min-height: 44px;
  border: 1px solid #d9e0d4;
  border-radius: 13px;
  color: inherit;
  background: #edf1e7;
  font: inherit;
}

@media (max-width: 850px) {
  body[data-route="live"] {
    overflow: hidden;
  }

  body[data-route="live"] .site-header {
    display: none;
  }

  #liveView {
    position: fixed;
    inset: 0;
    z-index: 70;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    color: #687d70;
    background: #f5f2ec;
    font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif;
  }

  #liveView .live-header {
    position: absolute;
    top: 0;
    right: 20px;
    left: 20px;
    z-index: 40;
    display: flex;
    min-height: 74px;
    margin: 0;
    padding: 18px 0 0;
    align-items: flex-start;
    pointer-events: none;
  }

  #liveView .live-header .live-close-button {
    position: relative;
    order: 2;
    width: 40px;
    height: 48px;
    min-width: 40px;
    margin: 0 0 0 auto;
    padding: 8px;
    border: 0;
    border-radius: 50%;
    color: #8a9380;
    background: #e8e9df;
    pointer-events: auto;
  }

  #liveView .live-header .live-close-button svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.6;
  }

  #liveView .live-header .mode-heading {
    order: 1;
    margin-top: 10px;
    min-width: 0;
  }

  #liveView .live-header .mode-heading p {
    display: none;
  }

  #liveView .live-header .mode-heading h2 {
    margin: 0;
    color: #6d7f86;
    font-family: YuzuPop, "Microsoft YaHei", sans-serif;
    font-size: 27px;
    font-weight: 700;
    line-height: 27px;
    letter-spacing: 0;
  }

  #liveView .live-header .mode-save-state {
    display: none;
  }

  #liveView .live-layout {
    position: absolute;
    inset: 74px 0 0;
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    margin: 0;
    overflow: hidden;
  }

  #liveView .live-stage-card {
    position: absolute;
    inset: 0;
    display: block;
    width: auto;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  #liveView .live-stage-topline,
  #liveView .live-panel {
    display: none;
  }

  #liveView .live-mode-caption {
    position: absolute;
    top: 32px;
    right: 20px;
    left: 20px;
    z-index: 14;
    display: block;
    margin: 0;
    color: #839189;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    pointer-events: none;
  }

  #liveView .live-reset-button {
    position: absolute;
    top: 48px;
    left: 20px;
    z-index: 16;
    display: grid;
    width: 39px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #576e64;
    background: #e3e9e4;
    font-size: 19px;
    place-items: center;
  }

  #liveView .live-room-scenery {
    position: absolute;
    inset: 10px 0 0;
    z-index: 1;
    display: block;
    overflow: hidden;
    background: linear-gradient(#f5f2ec 0 77%, #e4e9df 77%);
    pointer-events: none;
  }

  #liveView .live-room-window {
    position: absolute;
    top: 14%;
    left: 10%;
    width: 25%;
    height: 35%;
    overflow: hidden;
    border: 8px solid #fffdf7;
    border-radius: 80px 80px 0 0;
    background: #dbe7e6;
  }

  #liveView .live-room-window::before,
  #liveView .live-room-window::after {
    position: absolute;
    content: "";
    background: #fffdf7;
  }

  #liveView .live-room-window::before {
    top: 0;
    bottom: 0;
    left: calc(50% - 2px);
    width: 5px;
  }

  #liveView .live-room-window::after {
    top: calc(52% - 2px);
    right: 0;
    left: 0;
    height: 5px;
  }

  #liveView .live-room-shelf {
    position: absolute;
    top: 39%;
    right: 8%;
    width: 22%;
    height: 9px;
    background: #c8b9a7;
  }

  #liveView .live-room-shelf::before {
    position: absolute;
    right: 15%;
    bottom: 5px;
    width: 34px;
    height: 45px;
    border-radius: 3px 3px 9px 9px;
    background:
      linear-gradient(90deg, transparent 0 28%, #dcc1c5 28% 72%, transparent 72%),
      linear-gradient(#aebfa6, #aebfa6) 50% 0 / 18px 22px no-repeat;
    content: "";
  }

  #liveView .live-room-shelf::after {
    position: absolute;
    right: 54%;
    bottom: 5px;
    width: 42px;
    height: 25px;
    border-radius: 4px;
    background: linear-gradient(155deg, #c6d4d8, #9db1b5);
    content: "";
  }

  #liveView .live-room-art {
    position: absolute;
    top: 8%;
    right: 17%;
    width: 55px;
    height: 55px;
    rotate: 3deg;
  }

  #liveView .live-stage {
    --live-scale: 1;
    position: absolute;
    top: 20px;
    left: 50%;
    z-index: 5;
    width: min(340px, 88vw);
    height: min(440px, 58dvh);
    min-height: 0;
    overflow: visible;
    border-radius: 0;
    background: transparent;
    transform: translateX(-50%);
  }

  #liveView .live-stage::before,
  #liveView .live-stage::after,
  #liveView .live-stage-orbit,
  #liveView .live-stage-spark,
  #liveView .live-camera-note,
  #liveView .live-expression-chip {
    display: none;
  }

  #liveView #liveCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  #liveView .live-stage-toolbar {
    position: absolute;
    right: 16px;
    bottom: 275px;
    z-index: 24;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    transition: bottom 160ms ease;
  }

  #liveView .live-stage-card.controls-collapsed .live-stage-toolbar {
    bottom: 10px;
  }

  #liveView .live-stage-toolbar button {
    min-height: 32px;
    padding: 6px 13px;
    border: 1px solid #dce2d8;
    border-radius: 12px;
    color: #82958b;
    background: #fffdf4;
    font: 12px "Microsoft YaHei UI", "PingFang SC", sans-serif;
  }

  #liveView #liveFilterOpen {
    color: #7f9287;
    background: #edf0e9;
  }

  #liveView .live-controls {
    position: absolute;
    right: 8px;
    bottom: 16px;
    left: 8px;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-width: 420px;
    margin: 0 auto;
    padding: 10px;
    border-radius: 20px 20px 0 0;
    background: #f5f2ec;
  }

  #liveView .live-stage-card.controls-collapsed .live-controls {
    display: none;
  }

  #liveView .live-controls button {
    position: relative;
    min-width: 0;
    min-height: 49px;
    padding: 8px 10px;
    border: 1px solid #dce3d9;
    border-radius: 16px;
    color: #718995;
    background: #dce8ed;
    font: 16px "Microsoft YaHei UI", "PingFang SC", sans-serif;
  }

  #liveView .live-controls button b {
    font-size: 15px;
    font-weight: 400;
  }

  #liveView .live-controls button small {
    display: none;
  }

  #liveView .live-controls .live-camera-toggle {
    order: 1;
    grid-column: 1 / -1;
    display: block;
    min-height: 49px;
  }

  #liveView .live-controls .live-camera-toggle.active {
    color: #718995;
    border-color: #dce3d9;
    background: #dce8ed;
  }

  #liveView .live-control-icon {
    display: none;
  }

  #liveView #liveCalibrate {
    display: none;
  }

  #liveView #liveBackgroundOpen {
    order: 2;
    color: #9a7a89;
    background: #f0dfe3;
  }

  #liveView #liveSettingsToggle {
    order: 3;
    color: #8b8197;
    background: #e6e3ed;
  }

  #liveView #liveScreenToggle {
    order: 4;
    grid-column: auto;
    display: block;
    color: #788e9b;
    background: #dde8ed;
  }

  #liveView #liveCameraPreviewToggle {
    order: 5;
    color: #84907c;
    background: #eeeee5;
  }

  #liveView .live-mobile-size {
    order: 6;
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 42px;
    gap: 12px;
    min-height: 32px;
    padding: 2px 4px;
    align-items: center;
    color: #81938c;
    font: 12px "Microsoft YaHei UI", "PingFang SC", sans-serif;
  }

  #liveView .live-mobile-size input {
    width: 100%;
    min-width: 0;
    accent-color: #a0b8c1;
  }

  #liveView .live-mobile-size output {
    text-align: right;
  }

  #liveView .live-mobile-help {
    order: 7;
    grid-column: 1 / -1;
    display: block;
    min-height: 18px;
    margin: 0;
    color: #87918a;
    font: 11px / 17.6px "Microsoft YaHei UI", "PingFang SC", sans-serif;
    text-align: center;
  }

  #liveView .live-filter-panel {
    position: fixed;
    bottom: max(48px, calc(env(safe-area-inset-bottom) + 40px));
    left: 50%;
    z-index: 90;
    box-sizing: border-box;
    display: block;
    width: min(380px, calc(100vw - 16px));
    max-height: calc(100dvh - 118px);
    padding: 14px 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid #dce3d8;
    border-radius: 19px;
    color: #7a8f84;
    background: #faf8f1;
    font: 13px YuzuPop, "Microsoft YaHei", sans-serif;
    transform: translateX(-50%);
  }

  #liveView .live-filter-panel[hidden] {
    display: none;
  }

  #liveView .live-filter-panel header {
    display: flex;
    margin: 0 0 9px;
    align-items: center;
    justify-content: space-between;
  }

  #liveView .live-filter-panel h3 {
    margin: 0;
    font-size: 18px;
  }

  #liveView .live-filter-panel header button {
    min-width: 25px;
    min-height: 32px;
    padding: 1px 7px;
    border: 0;
    color: inherit;
    background: transparent;
    font-size: 21px;
  }

  #liveView .live-filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
  }

  #liveView .live-filter-grid label {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3px;
    min-width: 0;
    align-items: center;
  }

  #liveView .live-filter-grid output {
    color: #98a397;
    font-size: 11px;
  }

  #liveView .live-filter-grid input {
    grid-column: 1 / -1;
    width: 100%;
    height: 27px;
    min-width: 0;
    margin: 0;
    accent-color: #9cad99;
    touch-action: pan-y;
  }

  #liveView .live-filter-panel footer {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    align-items: center;
    justify-content: space-between;
  }

  #liveView .live-filter-panel footer span {
    color: #a1aa9b;
    font-size: 10px;
  }

  #liveView .live-filter-panel footer button {
    min-height: 32px;
    padding: 7px 12px;
    border: 1px solid #dce3d8;
    border-radius: 10px;
    color: #7d927f;
    background: #e8eee4;
    font: inherit;
  }

  #liveSettingsDialog.live-setting-dialog {
    box-sizing: border-box;
    width: min(390px, calc(100vw - 32px));
    height: min(640px, calc(100dvh - 32px));
    max-height: calc(100dvh - 32px);
    padding: 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid #d9e0d4;
    border-radius: 20px;
    color: #728477;
    background: #faf9f2;
    font: 14px YuzuPop, "Microsoft YaHei", sans-serif;
  }

  #liveSettingsDialog.live-setting-dialog::backdrop {
    background: rgb(67 83 74 / 34%);
    backdrop-filter: none;
  }

  #liveSettingsDialog > header {
    position: static;
    display: flex;
    padding: 0;
    border: 0;
    background: transparent;
  }

  #liveSettingsDialog > header > div > small {
    display: none;
  }

  #liveSettingsDialog h2 {
    margin: 0;
    color: inherit;
    font-family: inherit;
    font-size: 21px;
    font-weight: 700;
  }

  #liveSettingsDialog .live-adjust-scroll-hint {
    display: block;
    height: 16px;
    margin: 0 0 5px;
    color: #98a397;
    font-size: 11px;
    line-height: 16px;
    text-align: center;
  }

  #liveSettingsDialog header > button {
    width: 36px;
    height: 36px;
    border: 1px solid #d9e0d4;
    border-radius: 10px;
    color: inherit;
    background: transparent;
    font-size: 22px;
  }

  #liveSettingsDialog .live-setting-scroll {
    max-height: none;
    padding: 0;
    overflow: visible;
  }

  #liveSettingsDialog .live-master-switch {
    display: flex;
    height: 22px;
    min-height: 22px;
    margin: 7px 0 13px;
    padding: 0;
    border: 0;
    border-radius: 0;
    align-items: center;
    justify-content: flex-start;
    color: inherit;
    background: transparent;
  }

  #liveSettingsDialog .live-master-switch span {
    display: contents;
  }

  #liveSettingsDialog .live-master-switch b {
    order: 2;
    margin-left: 8px;
    font-size: 14px;
    font-weight: 400;
  }

  #liveSettingsDialog .live-master-switch small {
    display: none;
  }

  #liveSettingsDialog .live-master-switch input {
    order: 1;
    width: 22px;
    height: 22px;
  }

  #liveSettingsDialog .live-setting-section {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }

  #liveSettingsDialog .live-expression-section .live-setting-heading {
    display: none;
  }

  #liveSettingsDialog .live-setting-heading {
    min-height: 0;
  }

  #liveSettingsDialog .live-setting-heading small {
    display: none;
  }

  #liveSettingsDialog .live-setting-heading h3 {
    font-size: 13px;
    font-weight: 400;
  }

  #liveSettingsDialog #liveMotionReset {
    display: none;
  }

  #liveSettingsDialog .live-expression-rows,
  #liveSettingsDialog .live-motion-rows {
    display: grid;
    gap: 17px;
    margin: 17px 0 0;
  }

  #liveSettingsDialog .live-expression-rows label,
  #liveSettingsDialog .live-motion-rows label {
    display: grid;
    height: 22px;
    grid-template-columns: 47px minmax(0, 1fr) 42px 22px;
    gap: 5px;
    min-height: 22px;
    align-items: center;
  }

  #liveSettingsDialog .live-motion-rows label {
    grid-template-columns: 47px minmax(0, 1fr) 42px;
  }

  #liveSettingsDialog .live-expression-rows input[type="range"],
  #liveSettingsDialog .live-motion-rows input[type="range"] {
    width: 100%;
    min-width: 0;
    accent-color: #a3bfd3;
  }

  #liveSettingsDialog .live-expression-rows label > b {
    display: none;
  }

  #liveSettingsDialog .live-expression-rows input[type="checkbox"] {
    width: 22px;
    height: 22px;
  }

  #liveSettingsDialog #liveExpressionReset {
    min-height: 31px;
    margin: 13px 0 10px;
    padding: 7px 12px;
    border-radius: 10px;
    font-size: 13px;
  }

  #liveSettingsDialog .live-filter-section,
  #liveSettingsDialog .live-setting-note {
    display: none;
  }
}

@media (max-width: 850px) and (max-height: 700px) {
  #liveView .live-stage {
    top: 12px;
    width: min(292px, 88vw);
    height: min(330px, 57dvh);
  }

  #liveView .live-mode-caption {
    top: 24px;
  }

  #liveView .live-reset-button {
    top: 39px;
  }

  #liveView .live-controls {
    gap: 5px;
    padding: 7px;
  }

  #liveView .live-controls button {
    min-height: 42px;
    padding: 6px 8px;
    font-size: 14px;
  }

  #liveView .live-stage-toolbar {
    bottom: 234px;
  }

  #liveView .live-stage-card.controls-collapsed .live-stage-toolbar {
    bottom: 9px;
  }

  #liveView .live-filter-panel {
    bottom: 44px;
    max-height: calc(100dvh - 92px);
    padding: 10px 14px;
  }

  #liveView .live-filter-grid {
    gap: 3px 14px;
  }

  #liveView .live-filter-panel header {
    margin-bottom: 4px;
  }

  #liveSettingsDialog.live-setting-dialog {
    width: calc(100vw - 16px);
    height: calc(100dvh - 16px);
    max-height: calc(100dvh - 16px);
    padding: 14px;
  }

  #liveSettingsDialog .live-expression-rows,
  #liveSettingsDialog .live-motion-rows {
    gap: 11px;
    margin: 12px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  #liveView .live-stage-toolbar {
    transition: none;
  }
}

@media (max-width: 520px) and (orientation: portrait) {
  body[data-route="home"] .yu-home-achievements {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    justify-content: space-between;
  }

  body[data-route="home"] .yu-home-achievements > span {
    position: static;
    right: auto;
    left: auto;
    width: auto;
  }
}

/*
 * Android 2.175 keeps the home experience in a centered 440px stage in
 * landscape. The surrounding viewport is only the outer paper colour; the
 * document itself must never grow beyond the WebView viewport.
 */
@media (orientation: landscape) and (max-height: 500px) {
  body[data-route="home"] {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    background: #edf1eb;
  }

  body[data-route="settings"] {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    background: #edf1eb;
  }

  body[data-route="home"]::before,
  body[data-route="settings"]::before {
    display: none;
  }

  body[data-route="home"] .app-frame {
    width: min(100%, 440px);
    height: 100dvh;
    min-height: 0;
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
    background: #f8f7f1;
  }

  body[data-route="settings"] .app-frame {
    width: min(100%, 440px);
    height: 100dvh;
    min-height: 0;
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
    background: #f8f7f1;
  }

  body[data-route="home"] .site-header,
  body[data-route="settings"] .site-header {
    display: none;
  }

  body[data-route="home"] main {
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  body[data-route="settings"] main {
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  body[data-route="home"] .yu-home {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }

  body[data-route="settings"] .yu-home {
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }

  body[data-route="home"] .yu-home-topline {
    position: absolute;
    top: 5px;
    right: 34px;
    left: 34px;
    z-index: 12;
    width: auto;
    height: 29px;
    min-height: 29px;
  }

  body[data-route="home"] .yu-home-signature {
    font-size: 13px;
    letter-spacing: 1.2px;
  }

  body[data-route="home"] .yu-home-top-actions {
    gap: 9px;
  }

  body[data-route="home"] .yu-pill {
    width: 79px;
    height: 36.524px;
    min-height: 36.524px;
    padding: 0 9px;
    gap: 4px;
    border-radius: 15px;
    font-size: 10px;
    white-space: nowrap;
  }

  body[data-route="home"] .yu-pill svg {
    width: 19px;
    height: 19px;
  }

  body[data-route="home"] .yu-menu-button {
    width: 34px;
    height: 34px;
    padding: 8px;
    gap: 4px;
  }

  body[data-route="home"] .yu-menu-button span {
    width: 15px;
  }

  body[data-route="home"] .yu-home-heading {
    position: absolute;
    top: 39px;
    right: 34px;
    left: 34px;
    z-index: 8;
    display: flex;
    width: auto;
    height: 88px;
    margin: 0;
    padding: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  body[data-route="home"] .yu-home-heading p {
    display: none;
  }

  body[data-route="home"] .yu-home-heading h1 {
    margin: 2px 0 4px;
    gap: 5px;
    font-size: 48px;
    line-height: 1.1;
    letter-spacing: 2px;
  }

  body[data-route="home"] .yu-home-heading h1 .title-leaf {
    top: -1px;
    width: 18px;
    height: 18px;
  }

  body[data-route="home"] .yu-home-heading > span {
    margin: 0;
    font-size: 11px;
    line-height: 1.5;
    letter-spacing: 1px;
  }

  body[data-route="home"] .yu-home-stage {
    position: absolute;
    top: 131px;
    right: 34px;
    left: 34px;
    width: auto;
    height: 86px;
    min-height: 0;
    margin: 0;
  }

  body[data-route="home"] .yu-home-stage #homeCanvas {
    inset: -14px auto auto 50%;
    width: 104px;
    height: 120px;
    transform: translateX(-50%);
  }

  body[data-route="home"] .yu-home-stage .hanger-button {
    bottom: 0;
    left: 50%;
    width: 36px;
    height: 36px;
    transform: translateX(-50%);
  }

  body[data-route="home"] .yu-home-stage .hanger-button svg {
    width: 25px;
    height: 25px;
  }

  body[data-route="home"] .yu-stage-look {
    display: none;
  }

  body[data-route="home"] .yu-decor-star {
    top: 20%;
    left: 6%;
    width: 32px;
    height: 32px;
  }

  body[data-route="home"] .yu-decor-ring {
    display: none;
  }

  body[data-route="home"] .yu-decor-gift.left {
    top: 17%;
    right: auto;
    left: 75%;
    width: 34px;
    height: 34px;
  }

  body[data-route="home"] .yu-decor-gift.right {
    top: 70%;
    right: auto;
    left: 75%;
    width: 34px;
    height: 34px;
  }

  body[data-route="home"] .yu-home-actions {
    position: absolute;
    top: 221px;
    left: 50%;
    z-index: 14;
    width: 265px;
    height: 82px;
    margin: 0;
    padding: 0;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 46px 32px;
    column-gap: 10px;
    row-gap: 5px;
    transform: translateX(-50%);
  }

  body[data-route="home"] .yu-main-action {
    min-height: 46px;
    height: 46px;
    padding: 0 8px;
    border-radius: 15px;
    font-size: 17px;
  }

  body[data-route="home"] .yu-secondary-actions {
    gap: 8px;
  }

  body[data-route="home"] .yu-secondary-actions button {
    min-height: 32px;
    height: 32px;
    padding: 0 5px;
    border-radius: 13px;
    font-size: 13px;
  }

  body[data-route="home"] .yu-home-achievements {
    position: absolute;
    top: 303.5px;
    right: 34px;
    left: 34px;
    z-index: 9;
    width: auto;
    height: 26px;
    margin: 0;
    font-size: 10px;
  }

  body[data-route="home"] .yu-home-achievements > span:nth-child(1) {
    top: 0;
    font-size: 11px;
    letter-spacing: 2px;
  }

  body[data-route="home"] .yu-home-achievements > .yu-home-best {
    top: 14px;
    gap: 9px;
  }

  body[data-route="home"] .yu-home-achievements > span:nth-child(3) {
    display: none;
  }

  body[data-route="home"] .yu-home-language-note {
    position: absolute;
    top: 332px;
    right: 0;
    left: 0;
    z-index: 9;
    width: auto;
    margin: 0;
    padding-inline: 34px;
    box-sizing: border-box;
    font-family: "YuzuPop", "Segoe UI", sans-serif;
    font-size: 10px;
    line-height: 15px;
    text-align: center;
    opacity: 0.72;
  }

  .settings-view > .settings-overlay {
    padding: 0;
  }

  #settingsMenuSurface {
    width: min(424px, calc(100vw - 32px));
    max-height: calc(100dvh - 48px);
    padding: 22px;
    border-radius: 24px;
  }

  #settingsMenuSurface .settings-volume-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px 24px;
  }
}

/*
 * Keep the home language hint on the same stable centre line at every size.
 * The wrapper spans the home content width, while the text itself remains a
 * single centred item. This avoids WebView font-metric rounding moving a
 * shrink-to-fit flex item by a few visible pixels on Android.
 */
.yu-home-language-note {
  display: flex;
  width: 100%;
  min-width: 0;
  margin-inline: auto;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.yu-home-language-note > span {
  display: block;
  max-width: 100%;
  text-align: center;
}

/*
 * On large landscape tablets, the site header remains visible, so the pet
 * view must own exactly the remaining viewport height. Using grid rows keeps
 * the header and the left/right workspace inside the same frame while the
 * room and its controls continue to scale with the window.
 */
@media (orientation: landscape) and (min-width: 1201px) {
  body[data-route="studio"] .app-frame,
  body[data-route="meme"] .app-frame,
  body[data-route="game"] .app-frame,
  body[data-route="live"] .app-frame,
  body[data-route="pet"] .app-frame,
  body[data-route="settings"] .app-frame {
    padding-bottom: 0;
  }

  body[data-route="pet"] {
    overflow: hidden;
  }

  #petView.pet-view {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 17px;
    height: calc(100dvh - 76px);
    min-height: 0;
    padding: 22px 0 30px;
  }

  #petView .mode-header {
    margin-bottom: 0;
  }

  #petView .pet-layout {
    width: 100%;
    max-width: 1270px;
    height: auto;
    min-height: 0;
    justify-self: center;
  }

  #petView .pet-room {
    min-height: 0;
  }
}
