/* 线上搬砖 3D · 跨端小游戏
   样式基线：Chrome 61（Android 8.1 WebView），现代特性仅作增强 */

:root {
  --ink: #221c15;
  --ink-soft: #5d5347;
  --paper: #f6ecdb;
  --paper-2: #efe0c8;
  --kraft: #d9b98c;
  --brick: #b4452f;
  --brick-deep: #8d3122;
  --mortar: #cdbca0;
  --lime: #f3efe3;
  --wood: #8a5a33;
  --green: #4d7a4a;
  --gold: #e0a83c;
  --shadow: 0 12px 30px rgba(34, 28, 21, 0.22);
  --target-size: 24px;
  /* Reserve safe top space on mobile viewports for native host top-left/top-right action buttons */
  --safe-top: max(52px, env(safe-area-inset-top, 0px), var(--safe-area-inset-top, 0px));
  --safe-bottom: max(12px, env(safe-area-inset-bottom, 0px), var(--safe-area-inset-bottom, 0px));
  --safe-left: max(0px, env(safe-area-inset-left, 0px));
  --safe-right: max(0px, env(safe-area-inset-right, 0px));
}

/* ---------- 现代 Web 标准：移动端粗触控大靶区 (WCAG 2.5.5) ---------- */
@media (pointer: coarse) {
  :root {
    --target-size: 44px;
  }
}

:where(.btn, .level-btn--start) {
  min-height: var(--target-size);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
}
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #16120e;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

h1, h2, h3, h4, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button { font-family: inherit; font-size: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
button:active { opacity: 0.82; }
button:focus { outline: 2px solid rgba(224, 168, 60, 0.9); outline-offset: 2px; }

/* ---------- 现代响应式多端形态容器 (Form-Factor Adaptation) ---------- */
.app {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: radial-gradient(circle at 50% 12%, #3a2f24 0%, #1a1511 62%, #100d0a 100%);
  margin: 0 auto;
}

/* 窄竖屏大视口（例如竖屏平板或半屏窗口）：保留优雅居中竖屏框 */
@media (min-width: 600px) and (max-width: 759px), (min-width: 600px) and (max-aspect-ratio: 9/10) {
  .app {
    max-width: 440px;
    height: min(100dvh, 880px);
    border-radius: 28px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
  }
}

/* 移动端全屏无缝边缘铺满 */
@media (max-width: 599px) {
  .app {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
}

/* 防手势穿透与橡皮筋下拉冲突 */
.scene-canvas, canvas, dialog {
  touch-action: none;
  overscroll-behavior: none;
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  opacity: 0;
}
.screen.screen--active {
  display: flex;
  opacity: 1;
}
.screen--fade { transition: opacity 0.26s ease; }

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:active { transform: scale(0.97); }
.btn[hidden] { display: none; }
.btn--solid {
  color: #fff6e8;
  background: linear-gradient(180deg, #c2503a 0%, #94321f 100%);
  box-shadow: 0 6px 0 #6d2417, 0 10px 18px rgba(0, 0, 0, 0.28);
}
.btn--solid[disabled] { opacity: 0.5; box-shadow: 0 4px 0 #5b2014; }
.btn--ghost {
  color: var(--paper);
  background: rgba(246, 236, 219, 0.12);
  border: 1px solid rgba(246, 236, 219, 0.32);
}
.btn--ghost-light {
  color: var(--ink);
  background: rgba(246, 236, 219, 0.9);
  border: 1px solid rgba(34, 28, 21, 0.12);
}
.btn--ghost-dark {
  color: #fff6e8;
  background: rgba(246, 236, 219, 0.16);
  border: 1px solid rgba(246, 236, 219, 0.28);
}
.btn--wide { width: 100%; }
.btn--sm { min-height: 36px; padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn--xs { min-height: 28px; padding: 5px 10px; font-size: 11px; border-radius: 8px; }

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  color: var(--paper);
  background: rgba(20, 16, 12, 0.42);
  border: 1px solid rgba(246, 236, 219, 0.18);
}
.icon-btn--sm { width: 30px; height: 30px; font-size: 18px; }

/* ---------- 启动页 ---------- */
#screen-boot {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 18%, #4a3b2b 0%, #1d1712 58%, #0d0a08 100%);
}
.boot { width: 84%; max-width: 420px; text-align: center; }
.boot-top {
  position: absolute;
  top: max(16px, var(--safe-top));
  right: max(16px, var(--safe-right));
  z-index: 10;
  display: flex;
  justify-content: flex-end;
}
.lang-switch-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
}
.lang-switch-pill:hover, .lang-switch-pill:active {
  background: rgba(224, 168, 60, 0.35);
  border-color: rgba(224, 168, 60, 0.8);
  color: #ffdf79;
  transform: translateY(-1px);
}
.boot-hero {
  display: flex;
  justify-content: center;
  margin: 0 0 2px;
}
.boot-hero-img {
  display: block;
  width: 86%;
  max-width: 300px;
  height: auto;
  filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.45));
  animation: heroFloat 6.2s ease-in-out infinite;
}
@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.boot-title {
  margin-top: 6px;
  font-size: 30px;
  letter-spacing: 4px;
  color: var(--paper);
}
.boot-sub {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(246, 236, 219, 0.72);
}
.boot-status {
  margin-top: 26px;
  font-size: 13px;
  color: var(--gold);
  min-height: 20px;
}
#boot-start { margin-top: 18px; max-width: 240px; margin-left: auto; margin-right: auto; }
.boot-note {
  margin-top: 16px;
  font-size: 11px;
  color: rgba(246, 236, 219, 0.42);
}

/* ---------- 大厅 ---------- */
#screen-lobby {
  flex-direction: column;
  background: linear-gradient(180deg, #efe0c8 0%, #e3ceac 100%);
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  width: 100%;
  height: 100%;
  min-height: 100dvh;
}

.lobby-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 8px;
}
.lobby-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.brand-avatar {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}
.brand-titles {
  min-width: 0;
}
.brand-titles h2 {
  font-size: 17.5px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.3px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-titles p {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.25;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lobby-side {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.wallet {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2c231a 0%, #1e1711 100%);
  border: 1px solid rgba(224, 168, 60, 0.4);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
  color: var(--gold);
  white-space: nowrap;
  flex-shrink: 0;
}
.wallet-icon {
  font-size: 14px;
  line-height: 1;
}
.wallet-label {
  font-size: 10.5px;
  font-weight: 600;
  color: rgba(246, 236, 219, 0.72);
  white-space: nowrap;
}
.wallet strong {
  font-size: 14.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #ffdf79;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.wallet.wallet--md {
  padding: 4px 9px;
  gap: 4px;
}
.wallet.wallet--md strong {
  font-size: 13px;
  letter-spacing: 0.1px;
}
.wallet.wallet--lg {
  padding: 4px 8px;
  gap: 4px;
}
.wallet.wallet--lg strong {
  font-size: 12px;
  letter-spacing: 0;
}
@media (max-width: 480px) {
  .wallet-label {
    display: none;
  }
}
@media (max-width: 400px) {
  .lobby-head {
    padding: 10px 12px 6px;
    gap: 6px;
  }
  .brand-titles h2 {
    font-size: 16px;
  }
  .brand-titles p {
    font-size: 10.5px;
  }
  .lobby-side {
    gap: 5px;
  }
}
.lang-switch-pill[hidden],
.lobby-lang-btn[hidden],
.lobby-settings-btn[hidden],
.settings-lang-section[hidden] {
  display: none;
}
.lobby-settings-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 11px;
  font-size: 17px;
  color: var(--ink);
  background: rgba(255, 251, 243, 0.92);
  border: 1px solid rgba(94, 76, 52, 0.2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, background 0.15s ease;
}
.lobby-settings-btn:active {
  transform: scale(0.92);
  background: rgba(240, 232, 218, 0.95);
}
.lobby-lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 34px;
  padding: 0 9px;
  flex-shrink: 0;
  white-space: nowrap;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  background: rgba(255, 251, 243, 0.92);
  border: 1px solid rgba(94, 76, 52, 0.2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, background 0.15s ease;
}
.lobby-lang-btn:active {
  transform: scale(0.92);
  background: rgba(240, 232, 218, 0.95);
}
.lobby-preset-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  height: 36px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  color: #8b3c1b;
  background: linear-gradient(135deg, #fff7eb 0%, #ffeed2 100%);
  border: 1px solid rgba(224, 142, 60, 0.45);
  box-shadow: 0 2px 6px rgba(180, 69, 47, 0.1);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, background 0.15s ease;
}
.lobby-preset-btn:active {
  transform: scale(0.92);
  background: #ffe3b5;
}

/* 顶部/大厅导航栏 Tabs */
.lobby-nav {
  display: flex;
  align-items: stretch;
  padding: 4px 14px 10px;
  gap: 7px;
}
.lobby-nav-tab {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 6px;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--ink-soft);
  background: rgba(255, 251, 243, 0.6);
  border: 1px solid rgba(94, 76, 52, 0.14);
  box-shadow: 0 2px 6px rgba(90, 66, 40, 0.06);
  transition: all 0.2s ease;
}
.nav-tab-text {
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 400px) {
  .lobby-nav {
    padding: 4px 12px 10px;
    gap: 6px;
  }
  .lobby-nav-tab {
    font-size: 11.5px;
    gap: 4px;
    padding: 8px 4px;
  }
}
.lobby-nav-tab.is-active {
  color: #fff6e8;
  background: linear-gradient(180deg, #9d4230 0%, #7d2a1b 100%);
  border-color: rgba(125, 42, 27, 0.85);
  box-shadow: 0 3px 8px rgba(125, 42, 27, 0.28);
}
.nav-tab-icon {
  font-size: 14px;
}

.lobby-tab-page {
  display: none;
  animation: tabFadeIn 0.22s ease-out;
}
.lobby-tab-page.is-active {
  display: block;
}
@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.lobby-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 0 18px 28px;
}

.level-list { display: block; }
.level-card {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  padding: 13px 14px;
  border-radius: 18px;
  background: rgba(255, 252, 246, 0.96);
  border: 1px solid rgba(225, 205, 180, 0.45);
  box-shadow: 0 4px 14px rgba(90, 66, 40, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.level-card.is-locked { opacity: 0.68; background: rgba(248, 244, 237, 0.85); }
.level-card.is-demo-locked .level-thumb { filter: grayscale(0.6) brightness(0.85); }
.level-card.is-demo-locked .level-btn--locked {
  background: rgba(234, 88, 12, 0.12);
  color: #ea580c;
  border: 1px solid rgba(234, 88, 12, 0.35);
  font-weight: 700;
}
.level-thumb {
  width: 68px;
  height: 68px;
  margin-right: 12px;
  border-radius: 15px;
  background: #e9d6b6;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
  flex: none;
}
.level-info { flex: 1; min-width: 0; }
.level-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.level-title {
  font-size: 15.5px;
  font-weight: 700;
  color: #2a2016;
  margin: 0;
  line-height: 1.25;
}
.level-tier-badge {
  font-size: 10.5px;
  font-weight: 600;
  color: #b43e1d;
  background: rgba(180, 69, 47, 0.09);
  border: 1px solid rgba(180, 69, 47, 0.2);
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.level-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 4px 0 6px;
  font-size: 11.5px;
  color: #6d5b49;
}
.level-spec-item {
  display: inline-flex;
  align-items: center;
  background: rgba(60, 40, 20, 0.04);
  padding: 1px 6px;
  border-radius: 5px;
  line-height: 1.35;
}
.level-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.level-reward-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  color: #a03218;
  background: linear-gradient(135deg, #fff3e6 0%, #fee5d3 100%);
  border: 1px solid rgba(180, 69, 47, 0.22);
  line-height: 1.3;
}
.level-reward-pill .reward-coin { font-size: 12px; }
.level-pill {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  font-weight: 600;
  line-height: 1.3;
}
.level-pill--best {
  color: #3b6b28;
  background: #eef6ea;
  border: 1px solid #c9e4bf;
}
.level-pill--discount {
  color: #9c5417;
  background: #fff5e4;
  border: 1px solid #fedfa7;
}

/* Fallback legacy tags if rendered */
.level-info h3 { font-size: 15.5px; }
.level-info p {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-soft);
}
.level-tags { margin-top: 6px; display: flex; flex-wrap: wrap; }
.tag {
  display: inline-block;
  margin: 0 5px 3px 0;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--ink-soft);
  background: rgba(34, 28, 21, 0.06);
}
.tag--reward { color: #8d3122; background: rgba(180, 69, 47, 0.12); font-weight: 600; }

.level-action { flex: none; margin-left: 10px; }
.level-btn {
  height: 38px;
  min-width: 74px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.level-btn--start {
  background: linear-gradient(135deg, #c9543a 0%, #9e321e 100%);
  color: #ffffff;
  box-shadow: 0 3px 9px rgba(158, 50, 30, 0.3);
}
.level-btn--start:active {
  transform: scale(0.93);
  box-shadow: 0 1px 4px rgba(158, 50, 30, 0.2);
}
.level-btn--locked {
  background: #ebe3d5;
  color: #8e7a68;
  border: 1px solid #d8ccba;
  box-shadow: none;
}

.panel {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 251, 243, 0.92);
  box-shadow: 0 6px 16px rgba(90, 66, 40, 0.12);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel-head h3 { font-size: 15px; }
.panel-tag {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  color: #6a4a24;
  background: rgba(217, 185, 140, 0.44);
}
.panel-desc { margin-top: 8px; font-size: 12px; line-height: 1.6; color: var(--ink-soft); }

.home-preview {
  position: relative;
  height: 148px;
  margin-top: 12px;
  border-radius: 14px;
  overflow: hidden;
  background: #efe0c8;
  box-shadow: inset 0 0 0 1px rgba(34, 28, 21, 0.08);
}
.home-preview > span {
  position: absolute;
  display: block;
}
.home-preview-note {
  position: absolute;
  left: 10px;
  bottom: 8px;
  z-index: 3;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 11px;
  color: #fff6e8;
  background: rgba(24, 19, 14, 0.62);
}

/* ---------- 小院置办铺样式 ---------- */
.shop-section-head {
  margin-top: 22px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.shop-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
}
.shop-section-icon { font-size: 16px; line-height: 1; }
.shop-section-title h4 {
  font-size: 15px;
  font-weight: 700;
  color: #2b2015;
  margin: 0;
}
.shop-section-sub {
  font-size: 11.5px;
  color: #7c6a58;
}

.shop-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 4px;
  margin-bottom: 10px;
}
.shop-tab {
  flex-shrink: 0;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #6a5744;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(120, 90, 60, 0.18);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.shop-tab:active { transform: scale(0.94); }
.shop-tab.is-active {
  color: #ffffff;
  background: linear-gradient(135deg, #a8422a 0%, #872e1c 100%);
  border-color: transparent;
  box-shadow: 0 2px 6px rgba(135, 46, 28, 0.25);
}

.shop-grid {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 4px;
}
.shop-card, .shop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(220, 200, 175, 0.5);
  box-shadow: 0 2px 8px rgba(80, 50, 20, 0.05);
  transition: transform 0.12s ease;
  overflow: hidden;
}
.shop-card.is-owned {
  background: rgba(250, 246, 238, 0.75);
  border-color: rgba(210, 195, 175, 0.35);
}
.shop-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: linear-gradient(135deg, #fff7ea 0%, #faebd4 100%);
  border: 1px solid rgba(210, 180, 140, 0.35);
  flex-shrink: 0;
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.8);
}
.shop-card-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.shop-card-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}
.shop-card-name {
  font-size: 14px;
  font-weight: 700;
  color: #2c2015;
  line-height: 1.28;
}
.shop-card-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  max-width: 100%;
  white-space: normal;
  line-height: 1.3;
  word-break: break-word;
}
.shop-card-tag--pet {
  color: #a43a18;
  background: #fff0ea;
  border: 1px solid #ffd8cb;
}
.shop-card-tag--food {
  color: #92531a;
  background: #fff5e6;
  border: 1px solid #ffe2ba;
}
.shop-card-tag--yard {
  color: #3b6d2e;
  background: #f0f7ec;
  border: 1px solid #cbe4c1;
}
.shop-card-tag--furniture {
  color: #55447a;
  background: #f4f0fa;
  border: 1px solid #ded5f0;
}
.shop-card-tag--tool {
  color: #2b6175;
  background: #ebf5f8;
  border: 1px solid #c2e2eb;
}

.shop-card-desc {
  font-size: 11.5px;
  line-height: 1.42;
  color: #736352;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.shop-card-stock {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  color: #7f5223;
  background: #fff1d8;
  border: 1px solid #f8dec0;
  border-radius: 4px;
  padding: 1px 5px;
  margin-top: 3px;
}

.shop-card-action {
  flex-shrink: 0;
  margin-left: 4px;
}
.shop-card-btn {
  min-width: 86px;
  height: 36px;
  padding: 0 12px;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.shop-card-btn--buy {
  background: linear-gradient(135deg, #c4543a 0%, #9e321e 100%);
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(158, 50, 30, 0.28);
}
.shop-card-btn--buy:active { transform: scale(0.94); }
.shop-card-btn--owned {
  background: rgba(100, 80, 60, 0.08);
  color: #887868;
  border: 1px solid rgba(100, 80, 60, 0.15);
  cursor: default;
  box-shadow: none;
}

/* Fallback legacy shop classes */
.shop-name { font-size: 14px; }
.shop-name small { display: block; margin-top: 2px; font-size: 11px; color: var(--ink-soft); }
.shop-right { display: flex; align-items: center; }

.rank-list { margin-top: 10px; }
.rank-row {
  display: flex;
  align-items: center;
  padding: 7px 0;
  font-size: 13px;
  border-top: 1px solid rgba(34, 28, 21, 0.07);
}
.rank-row:first-child { border-top: 0; }
.rank-no { width: 26px; color: var(--ink-soft); font-weight: 600; }
.rank-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-score { color: var(--brick-deep); font-weight: 600; }
.rank-empty { padding: 8px 0; font-size: 12px; color: var(--ink-soft); }

.lobby-foot {
  margin-top: 18px;
  font-size: 11px;
  line-height: 1.7;
  color: rgba(93, 83, 71, 0.8);
  text-align: center;
}

/* ---------- 游戏场景 ---------- */
#screen-game, #screen-home { background: #100d0a; }
#screen-home .hud-title h3 { font-size: 15px; }
#btn-home-open { margin-top: 12px; }
.scene-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  z-index: 16;
  padding: var(--safe-top) 12px 0;
  box-sizing: border-box;
  pointer-events: none;
}
.hud > * { pointer-events: auto; max-width: 100%; box-sizing: border-box; }
.hud-top { display: flex; align-items: center; padding-top: 10px; width: 100%; }
.hud-title { flex: 1; min-width: 0; padding: 0 10px; }
.hud-title h3 { font-size: 15px; color: var(--paper); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); }
.hud-title p { margin-top: 2px; font-size: 11px; color: rgba(246, 236, 219, 0.78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-meta { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.hud-meta span { display: block; font-size: 13px; color: var(--paper); }
.hud-env-bar[hidden],
.hud-weather-pills[hidden],
.hud-tz-wrap[hidden],
.hud-tz-select[hidden] {
  display: none !important;
}
.hud-env-bar {
  margin-top: 8px;
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-sizing: border-box;
}
#home-badge, .hud-tz-pill {
  display: inline-block;
  font-size: 11px;
  color: var(--paper);
  background: rgba(16, 13, 10, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  padding: 3px 8px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}
.hud-weather-pills {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 14px;
  background: rgba(16, 13, 10, 0.64);
  border: 1px solid rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(6px);
  flex-shrink: 0;
}
.weather-pill {
  border: 0;
  background: transparent;
  color: rgba(246, 236, 219, 0.90);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.weather-pill.is-active {
  background: rgba(255, 255, 255, 0.95);
  color: #1f2937;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}
.hud-tz-wrap {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
}
.hud-tz-select {
  appearance: auto;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--paper);
  background: rgba(16, 13, 10, 0.64);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 12px;
  padding: 5px 10px;
  cursor: pointer;
  max-width: 176px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-tz-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  white-space: nowrap;
}
#home-tz-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hud-tz-caret {
  flex-shrink: 0;
  font-size: 11px;
  opacity: 0.85;
}
.hud-tz-menu {
  min-width: 178px;
  max-width: min(260px, calc(100vw - 24px));
  max-height: min(320px, 60dvh);
  overflow-y: auto;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(24, 19, 14, 0.96);
  color: #f6ecdb;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.52);
  overscroll-behavior: contain;
}
@supports (position-area: block-end) {
  .hud-tz-menu {
    inset: auto;
    margin: 6px 0 0 0;
    position-area: block-end span-inline-start;
    position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
  }
}
@supports not selector(:popover-open) {
  .hud-tz-menu {
    display: none;
    position: fixed;
    z-index: 60;
  }
  .hud-tz-menu.is-open {
    display: block;
  }
}
.hud-tz-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #f6ecdb;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.hud-tz-option:hover {
  background: rgba(224, 168, 60, 0.16);
}
.hud-tz-option.is-active {
  background: rgba(224, 168, 60, 0.26);
  color: #fff6e8;
}
.hud-tz-check {
  width: 12px;
  flex-shrink: 0;
  color: var(--gold);
  font-weight: 800;
}
.hud-tz-select option {
  color: #1f2937;
  background: #fff;
}
@supports (appearance: base-select) {
  .settings-tz-select,
  .settings-tz-select::picker(select) {
    appearance: base-select;
  }
  .settings-tz-select::picker(select) {
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(94, 76, 52, 0.24);
    background: #fffdfa;
    color: var(--ink);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
  }
  .settings-tz-select option {
    padding: 7px 10px;
    border-radius: 8px;
    cursor: pointer;
  }
  .settings-tz-select option:hover,
  .settings-tz-select option:checked {
    background: rgba(224, 168, 60, 0.18);
  }
}
.hud-coins { color: var(--gold); font-weight: 600; }

.hud-track { margin-top: 10px; padding: 8px 10px; border-radius: 14px; background: rgba(16, 13, 10, 0.44); }
.hud-steps { display: flex; }
.hud-step {
  flex: 1;
  height: 4px;
  margin-right: 4px;
  border-radius: 2px;
  background: rgba(246, 236, 219, 0.24);
}
.hud-step:last-child { margin-right: 0; }
.hud-step.is-done { background: var(--green); }
.hud-step.is-now { background: var(--gold); }
.hud-bar { margin-top: 8px; height: 6px; border-radius: 3px; background: rgba(246, 236, 219, 0.2); overflow: hidden; }
.hud-mortar { margin-top: 8px; display: flex; align-items: center; }
.hud-mortar[hidden] { display: none; }
.hud-mortar > span:first-child { font-size: 11px; color: rgba(246, 236, 219, 0.78); margin-right: 8px; flex: none; }
.hud-mortar-track { flex: 1; height: 5px; border-radius: 3px; background: rgba(246, 236, 219, 0.2); overflow: hidden; }
.hud-mortar-track > span { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #b9b2a4 0%, #e8e0cd 100%); }

.hud-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, #e0a83c 0%, #f3d089 100%);
  transition: width 0.24s ease;
}

.hud-hint {
  position: relative;
  margin-top: 10px;
  padding: 8px 28px 8px 12px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #2a2118;
  background: rgba(246, 236, 219, 0.9);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.hud-hint::after {
  content: "×";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  color: #5b4936;
  opacity: 0.6;
}
.hud-hint.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  cursor: pointer;
}
.hud-hint.is-visible:active {
  transform: scale(0.985);
  opacity: 0.85;
}

.dock {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(var(--safe-bottom) + 14px);
  display: flex;
  align-items: center;
}
.dock .btn { flex: 1; }
.dock .btn + .btn { margin-left: 8px; }
.dock .btn { font-size: 14px; padding: 10px 12px; }

.home-inside-bar {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(var(--safe-bottom) + 64px);
  z-index: 16;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 10px;
  border-radius: 16px;
  background: rgba(16, 13, 10, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  scrollbar-width: none;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  user-select: none;
  cursor: grab;
}
.home-inside-bar.is-dragging { cursor: grabbing; }
.home-inside-bar[hidden] { display: none !important; }
.home-inside-bar::-webkit-scrollbar { display: none; }
.inside-pill {
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: var(--paper);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.inside-pill[hidden] { display: none !important; }
.inside-pill.is-active {
  background: rgba(251, 191, 36, 0.94);
  color: #1f2937;
  border-color: rgba(253, 224, 71, 0.9);
}

/* ---------- 特写弹层 ---------- */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(12, 9, 7, 0.56);
  z-index: 45;
}
.overlay[hidden] { display: none; }
.sheet {
  width: 100%;
  max-height: min(86%, calc(100dvh - var(--safe-top) - 8px));
  border-radius: 22px 22px 0 0;
  background: linear-gradient(180deg, #fbf3e4 0%, #f2e4cc 100%);
  box-shadow: 0 -14px 34px rgba(0, 0, 0, 0.36);
  display: flex;
  flex-direction: column;
  animation: sheetUp 0.24s ease-out;
  padding-bottom: var(--safe-bottom);
}
@keyframes sheetUp {
  from { transform: translateY(28px); opacity: 0.4; }
  to { transform: translateY(0); opacity: 1; }
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
}
.sheet-head h2 { font-size: 16px; letter-spacing: 0.5px; }
.sheet-head .icon-btn { color: var(--ink); background: rgba(34, 28, 21, 0.08); border-color: rgba(34, 28, 21, 0.1); }
.sheet-body { padding: 4px 16px 18px; overflow-y: auto; }

.mg-desc { font-size: 12px; line-height: 1.6; color: var(--ink-soft); }
.mg-stage {
  position: relative;
  margin-top: 12px;
  border-radius: 16px;
  background: #e7d6bb;
  overflow: hidden;
}
.mg-canvas { display: block; width: 100%; touch-action: none; }
.mg-meter { margin-top: 12px; }
.mg-meter-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-soft); }
.mg-meter-track {
  position: relative;
  margin-top: 6px;
  height: 16px;
  border-radius: 8px;
  background: rgba(34, 28, 21, 0.12);
  overflow: hidden;
}
.mg-meter-fill {
  height: 100%;
  width: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, #c98b56 0%, #b4452f 100%);
  transition: width 0.1s linear;
}
.mg-meter-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(77, 122, 74, 0.32);
  border-left: 1px solid rgba(77, 122, 74, 0.7);
  border-right: 1px solid rgba(77, 122, 74, 0.7);
}
.mg-row { margin-top: 12px; display: flex; flex-wrap: wrap; }
.mg-row .btn { margin: 0 8px 8px 0; }
.mg-row .btn:last-child { margin-right: 0; }
.mg-note { margin-top: 10px; font-size: 12px; color: var(--brick-deep); min-height: 18px; }
.mg-steps { margin-top: 10px; display: flex; }
.mg-step {
  flex: 1;
  margin-right: 6px;
  padding: 7px 2px;
  border-radius: 8px;
  text-align: center;
  font-size: 11px;
  color: var(--ink-soft);
  background: rgba(34, 28, 21, 0.07);
}
.mg-step:last-child { margin-right: 0; }
.mg-step.is-done { color: #fff6e8; background: var(--green); }
.mg-step.is-now { color: #2a2118; background: rgba(224, 168, 60, 0.55); }
.mg-big {
  margin-top: 10px;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
  color: var(--brick-deep);
}
.mg-big small { font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.mg-hammer-grid { display: flex; flex-wrap: wrap; margin-top: 10px; }
.hammer-cell {
  position: relative;
  width: 50%;
  height: 84px;
  border-radius: 12px;
  margin-bottom: 8px;
  background: rgba(34, 28, 21, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--ink-soft);
}
.hammer-cell.is-done { background: rgba(77, 122, 74, 0.2); color: #2f5230; }
.hammer-label { position: relative; z-index: 1; }
.bolt-track {
  position: relative;
  margin: 14px 6px 4px;
  height: 48px;
  border-radius: 24px;
  background: rgba(34, 28, 21, 0.1);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  overflow: hidden;
  border: 1.5px solid rgba(138, 90, 51, 0.2);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.bolt-track.is-enabled {
  background: rgba(224, 168, 60, 0.16);
  border-color: rgba(201, 140, 50, 0.55);
  box-shadow: 0 0 12px rgba(224, 168, 60, 0.35);
  animation: boltTrackPulse 1.6s infinite ease-in-out;
}
@keyframes boltTrackPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(224, 168, 60, 0.25); border-color: rgba(201, 140, 50, 0.45); }
  50% { box-shadow: 0 0 18px rgba(245, 194, 66, 0.65); border-color: rgba(245, 194, 66, 0.85); }
}
.bolt-track.is-locked {
  background: rgba(77, 122, 74, 0.18);
  border-color: rgba(47, 82, 48, 0.45);
  box-shadow: 0 0 8px rgba(77, 122, 74, 0.3);
}
.bolt-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  border-radius: 24px;
  background: linear-gradient(90deg, rgba(201, 139, 86, 0.35), rgba(224, 168, 60, 0.55));
  pointer-events: none;
}
.bolt-buckle {
  position: absolute;
  right: 8px;
  top: 7px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #8a5a33;
  pointer-events: none;
  z-index: 1;
  transition: transform 0.2s ease, color 0.2s ease;
}
.bolt-track.is-locked .bolt-buckle {
  transform: scale(1.15);
  color: #2f5230;
}
.bolt-knob {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(180deg, #d8985c 0%, #8a5a33 100%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  z-index: 2;
}
.bolt-knob.is-snapping {
  transition: left 0.18s cubic-bezier(0.2, 0.85, 0.3, 1.15);
}
.bolt-knob.is-dragging {
  cursor: grabbing;
  transform: scale(1.08);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.38);
}
.bolt-knob.is-locked {
  background: linear-gradient(180deg, #5ba45a 0%, #2f6830 100%);
  cursor: default;
}

/* ---------- 结算 ---------- */
.result {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 8, 6, 0.66);
  z-index: 30;
}
.result[hidden] { display: none; }
.result-card {
  width: 100%;
  max-width: 380px;
  padding: 22px 20px 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, #fbf3e4 0%, #efdfc4 100%);
  box-shadow: var(--shadow);
  text-align: center;
  animation: resultIn 0.28s ease-out;
}
@keyframes resultIn {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.result-kicker { font-size: 11px; letter-spacing: 3px; color: var(--brick-deep); }
.result-card h2 { margin-top: 6px; font-size: 19px; }
.result-score { margin-top: 16px; display: flex; align-items: center; }
.score-main { flex: none; width: 112px; text-align: center; }
.score-main span { font-size: 44px; font-weight: 700; color: var(--brick-deep); line-height: 1; }
.score-main small { display: block; margin-top: 4px; font-size: 11px; color: var(--ink-soft); letter-spacing: 2px; }
.score-list { flex: 1; min-width: 0; padding-left: 10px; }
.score-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  color: var(--ink-soft);
  border-bottom: 1px dashed rgba(34, 28, 21, 0.14);
}
.score-list li > span:first-child { flex: none; white-space: nowrap; }
.score-list li:last-child { border-bottom: 0; }
.score-list b { color: var(--ink); text-align: right; }
.result-coin {
  margin-top: 14px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(224, 168, 60, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--ink-soft);
}
.result-coin strong { margin-left: 8px; font-size: 20px; color: #8d5a12; }
.result-actions { margin-top: 14px; }
.result-actions .btn { margin-bottom: 8px; }
.result-note {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--ink-soft);
  cursor: pointer;
}
.result.is-minimized {
  background: transparent !important;
  pointer-events: none;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}
.result.is-minimized .result-card {
  display: none !important;
}
.result-pill {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(24, 19, 14, 0.90);
  border: 1px solid rgba(255, 235, 205, 0.24);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  color: #fff6e8;
  font-size: 13px;
  animation: resultIn 0.25s ease-out;
  cursor: pointer;
}
.result-pill[hidden] {
  display: none !important;
}
.pill-badge {
  font-weight: 700;
  color: #f59e0b;
}
.pill-hint {
  font-size: 12px;
  color: #e5ded2;
}

/* ---------- 院子大橘互动动作栏 ---------- */
.cat-bar {
  position: absolute;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 420px;
  padding: 12px 14px 10px;
  border-radius: 20px;
  background: rgba(28, 22, 17, 0.92);
  border: 1px solid rgba(230, 190, 140, 0.25);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  z-index: 25;
  animation: catBarIn 0.25s cubic-bezier(0.2, 0.8, 0.3, 1.15);
}
.cat-bar[hidden] { display: none; }
@keyframes catBarIn {
  from { transform: translateX(-50%) translateY(14px) scale(0.96); opacity: 0; }
  to { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}
.cat-bar-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  padding: 0 2px;
}
.cat-bar-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.cat-bar-tools {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.cat-bar-tool-btn {
  padding: 2px 7px !important;
  font-size: 11px !important;
  border-radius: 12px !important;
  min-height: 24px !important;
  white-space: nowrap;
}
.cat-bar-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.cat-name {
  font-size: 14px;
  font-weight: 700;
  color: #ffedd5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.cat-affection {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(244, 63, 94, 0.22);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.35);
  white-space: nowrap;
  max-width: 100%;
}
.cat-affection-btn {
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}
.cat-affection-btn:hover {
  background: rgba(244, 63, 94, 0.38);
  color: #fff;
  transform: scale(1.04);
}
.cat-daily-pill {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.35);
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.cat-bar-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #d1c7bd;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.cat-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.cat-act-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
  color: #fff6e8;
  cursor: pointer;
  transition: transform 0.12s, background 0.12s, opacity 0.15s;
  user-select: none;
}
.cat-act-btn:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.16);
}
.cat-act-btn.is-locked {
  opacity: 0.52;
  filter: grayscale(0.4);
  border-color: rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.25);
}
.cat-act-icon {
  font-size: 22px;
  line-height: 1.2;
}
.cat-act-label {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ---------- 宠物羁绊成长手册弹窗（高对比暖羊皮纸实感排版） ---------- */
.sheet--handbook {
  max-width: 440px;
  max-height: 85vh;
  overflow-y: auto;
  padding-bottom: 24px;
  color: #2a1e12;
}
.sheet--handbook .sheet-head h3,
#handbook-title {
  color: #2a1e12;
  font-size: 17px;
  font-weight: 800;
}
.sheet--handbook .sheet-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #d6c3a5;
  background: #fff8eb;
  color: #2a1e12;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.hb-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fffaf0;
  border: 1.5px solid #dfc59c;
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(74, 52, 28, 0.08);
}
.hb-avatar {
  font-size: 36px;
  line-height: 1;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #fef3c7;
  border: 1.5px solid #f59e0b;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hb-info {
  flex: 1;
  min-width: 0;
}
.hb-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.hb-name-row h4,
.hb-info h4 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 800;
  color: #2a1e12;
}
.hb-species-tag {
  font-size: 11px;
  font-weight: 700;
  color: #78350f;
  background: #fde68a;
  border: 1px solid #f59e0b;
  padding: 2px 8px;
  border-radius: 999px;
}
.hb-badge-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 5px;
}
.hb-badge-line .badge {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
  font-weight: 700;
}
.hb-points {
  font-size: 12.5px;
  color: #b45309;
  font-weight: 700;
}
.hb-cap-line {
  font-size: 11.5px;
  color: #5c4632;
  font-weight: 600;
}
.hb-section-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #7c2d12;
  margin: 16px 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.hb-tiers {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hb-tier-card {
  padding: 11px 14px;
  border-radius: 12px;
  border: 1.5px solid #e2d1b5;
  background: #ffffff;
  transition: border-color 0.15s;
}
.hb-tier-card.is-unlocked {
  border-color: #86efac;
  background: #f0fdf4;
}
.hb-tier-card.is-unlocked.is-current {
  border-color: #22c55e;
  border-width: 2px;
  background: #ecfdf5;
  box-shadow: 0 2px 10px rgba(34, 197, 94, 0.16);
}
.hb-tier-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.hb-tier-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #1e293b;
}
.hb-tier-status {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.hb-tier-status.is-unlocked {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}
.hb-tier-status.is-locked {
  background: #e2e8f0;
  color: #475569;
}
.hb-tier-desc {
  font-size: 12px;
  color: #473624;
  font-weight: 500;
  line-height: 1.5;
  margin: 0;
}
.hb-rules {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hb-rule-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #ffffff;
  border-radius: 12px;
  border: 1.5px solid #e2d1b5;
}
.hb-rule-icon {
  font-size: 20px;
  line-height: 1.2;
}
.hb-rule-text strong {
  font-size: 12.5px;
  color: #1e293b;
}
.hb-rule-text p {
  font-size: 11.5px;
  color: #4b3a28;
  margin: 3px 0 0;
  line-height: 1.45;
}

/* ---------- 屋主档案 / 信箱署名 / 宠物命名弹窗 ---------- */
.op-avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1.5px solid #e2d1b5;
  border-radius: 14px;
  margin-bottom: 14px;
}
.op-avatar-box {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 2.5px solid #eab308;
  background: linear-gradient(135deg, #bae6fd 0%, #fef08a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  overflow: hidden;
  flex-shrink: 0;
}
.op-avatar-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.op-avatar-actions strong {
  display: block;
  font-size: 13.5px;
  color: #1e293b;
}
.op-tip {
  font-size: 11.5px;
  color: #574430;
  margin: 4px 0 8px;
  line-height: 1.4;
}
.op-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.op-btn-row .btn--ghost-dark {
  color: #3f2f21;
  border: 1px solid #d6c3a5;
  background: #fbf3e4;
}
.op-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}
.op-field > span {
  font-size: 13px;
  font-weight: 800;
  color: #2a1e12;
}
.op-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  background: #ffffff;
  border: 1.5px solid #d6c3a5;
  border-radius: 10px;
}
.op-field small {
  font-size: 11px;
  color: #6b533b;
  line-height: 1.4;
}

/* ---------- 动态飘浮表情粒子（爱心、音符、呼噜泡泡） ---------- */
.floating-particle {
  position: fixed;
  pointer-events: none;
  z-index: 100;
  font-size: 24px;
  animation: floatUpParticle 1.35s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
  will-change: transform, opacity;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}
@keyframes floatUpParticle {
  0% { transform: translate(-50%, -50%) scale(0.4) rotate(0deg); opacity: 0; }
  15% { transform: translate(-50%, -50%) scale(1.2) rotate(-8deg); opacity: 1; }
  35% { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% - 24px)) scale(1.0) rotate(8deg); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% - 75px)) scale(0.7) rotate(16deg); opacity: 0; }
}

/* ---------- Toast ---------- */
.toast {
  position: absolute;
  left: 50%;
  bottom: 96px;
  z-index: 40;
  transform: translateX(-50%) translateY(8px);
  max-width: 80%;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 12px;
  color: #fff6e8;
  background: rgba(24, 19, 14, 0.88);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  text-align: center;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 横屏增强 ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  .hud-hint { max-width: 60%; }
  .dock { left: auto; right: 14px; bottom: 12px; width: 46%; }
  .boot-title { font-size: 24px; }
  .boot-hero-img { width: 42%; max-width: 146px; }
  .boot-sub { margin-top: 6px; }
  .sheet { max-height: min(94%, calc(100dvh - var(--safe-top) - 6px)); }
}

@media (min-width: 560px) and (max-width: 759px), (min-width: 560px) and (max-aspect-ratio: 9/10) {
  .lobby-scroll, .lobby-head, .lobby-nav { max-width: 520px; margin-left: auto; margin-right: auto; width: 100%; }
  .sheet { max-width: 520px; border-radius: 22px 22px 0 0; }
}

/* ---------- 桌面宽屏 Web & Electron 横屏双形态完整适配 (Desktop Landscape) ---------- */
@media (min-width: 760px) and (min-aspect-ratio: 1/1) {
  :root {
    --safe-top: max(12px, env(safe-area-inset-top, 0px));
    --safe-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }
  .app {
    max-width: none;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
  .boot {
    max-width: 540px;
  }
  .boot-hero-img {
    max-width: 240px;
  }
  .lobby-head,
  .lobby-nav,
  .lobby-scroll {
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    padding-left: 28px;
    padding-right: 28px;
  }
  .lobby-nav-tab {
    padding: 10px 14px;
    font-size: 14px;
  }
  .level-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
  }
  .level-card {
    margin-bottom: 0;
    height: 100%;
  }
  .shop-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
  }
  .home-preview {
    height: 196px;
  }
  .hud {
    max-width: 1120px;
    left: 0;
    right: 0;
    margin: 0 auto;
    padding: max(12px, var(--safe-top)) 24px 0;
  }
  .hud-hint {
    max-width: 580px;
  }
  .dock {
    left: 0;
    right: 0;
    margin: 0 auto;
    width: min(560px, calc(100% - 48px));
    bottom: max(18px, calc(var(--safe-bottom) + 14px));
  }
  .home-inside-bar {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: max-content;
    max-width: min(860px, calc(100% - 48px));
    justify-content: flex-start;
    bottom: max(72px, calc(var(--safe-bottom) + 68px));
  }
  .cat-bar {
    bottom: max(76px, calc(var(--safe-bottom) + 72px));
    max-width: 460px;
  }
  .overlay {
    align-items: center;
    padding: 24px;
  }
  .sheet {
    max-width: 560px;
    max-height: min(88vh, 760px);
    border-radius: 22px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.48);
    padding-bottom: 18px;
  }
  .sheet--handbook {
    max-width: 600px;
  }
  .result-card {
    max-width: 440px;
  }
}

@media (min-width: 760px) and (min-aspect-ratio: 1/1) and (max-height: 740px) {
  .boot-hero-img {
    max-width: 195px;
  }
  .boot-title {
    font-size: 26px;
    margin-top: 2px;
  }
  .boot-status {
    margin-top: 14px;
  }
  #boot-start {
    margin-top: 10px;
  }
}
/* ---------- 设置与重置 ---------- */
.sheet-head h3 { font-size: 16px; letter-spacing: 0.5px; }
.sheet-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  color: var(--ink);
  background: rgba(34, 28, 21, 0.08);
  border: 1px solid rgba(34, 28, 21, 0.1);
}
.settings-stat {
  margin: 2px 0 12px;
  font-size: 12px;
  color: var(--ink-soft);
}

/* 语言设置区 */
.settings-lang-section {
  margin: 10px 0 12px;
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(34, 28, 21, 0.05);
  border: 1px solid rgba(94, 76, 52, 0.14);
}
.settings-lang-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.settings-lang-icon {
  font-size: 18px;
  line-height: 1;
}
.settings-lang-text h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}
.settings-lang-text small {
  font-size: 11px;
  color: var(--ink-soft);
  display: block;
}
.settings-lang-switch {
  display: flex;
  gap: 8px;
}
.settings-lang-switch .lang-opt-btn {
  flex: 1;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 9px;
  text-align: center;
  border: 1.5px solid rgba(94, 76, 52, 0.2);
  background: #fffdfa;
  color: var(--ink-soft);
  transition: all 0.15s ease;
}
.settings-lang-switch .lang-opt-btn.is-active {
  background: linear-gradient(135deg, #b4452f 0%, #8d3122 100%);
  color: #fff;
  border-color: #7a281b;
  box-shadow: 0 2px 8px rgba(180, 69, 47, 0.3);
}

/* 时区上下滑动选择器 */
.settings-tz-select {
  width: 100%;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  background: #fffdfa;
  border: 1.5px solid rgba(94, 76, 52, 0.24);
  border-radius: 10px;
  cursor: pointer;
}

/* 测试档位预设选择区 */
.preset-section {
  margin: 12px 0 14px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(34, 28, 21, 0.04);
  border: 1px solid rgba(94, 76, 52, 0.12);
}
.preset-section-head {
  margin-bottom: 8px;
}
.preset-section-head h4 {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}
.preset-section-head small {
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.4;
  display: block;
}
.preset-grid {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 2px;
}
.preset-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1.5px solid rgba(94, 76, 52, 0.16);
  background: #fffdfa;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}
.preset-card:active {
  transform: scale(0.98);
}
.preset-card.is-active {
  border-color: #b4452f;
  background: #fff6f2;
  box-shadow: 0 2px 8px rgba(180, 69, 47, 0.12);
}
.preset-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 3px;
}
.preset-card-badge {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}
.preset-card.is-active .preset-card-badge {
  color: #b4452f;
}
.preset-active-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: #b4452f;
  color: #fff;
}
.preset-card-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(94, 76, 52, 0.08);
  color: var(--ink-soft);
}
.preset-card.is-active .preset-card-tag {
  background: rgba(180, 69, 47, 0.15);
  color: #b4452f;
}
.preset-card-desc {
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.4;
  margin-bottom: 4px;
}
.preset-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  color: #8a5829;
}
.preset-card.is-active .preset-card-meta {
  color: #b4452f;
}

.reset-btn {
  position: relative;
  display: block;
  width: 100%;
  margin-bottom: 10px;
  padding: 14px 16px;
  text-align: left;
  border-radius: 14px;
  border: 1px solid rgba(94, 76, 52, 0.18);
  background: #fffaf0;
  overflow: hidden;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.reset-btn strong { position: relative; display: block; font-size: 14px; color: var(--ink); }
.reset-btn small { position: relative; display: block; margin-top: 3px; font-size: 11px; line-height: 1.55; color: var(--ink-soft); }
.reset-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: rgba(180, 69, 47, 0.12);
  transition: width 0.12s linear;
}
.reset-btn.is-holding .reset-fill { width: 100%; transition: width 1.2s linear; }
.reset-btn--danger { border-color: rgba(180, 69, 47, 0.35); background: #fff5f1; }
.reset-btn--danger .reset-fill { background: rgba(180, 69, 47, 0.2); }
.settings-tip { margin-top: 6px; font-size: 11px; line-height: 1.6; color: var(--ink-soft); }
.rank-tabs {
  display: flex;
  margin: 6px 0 8px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(34, 28, 21, 0.06);
}
.rank-tab {
  flex: 1;
  padding: 6px 0;
  border: 0;
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-soft);
  background: transparent;
}
.rank-tab.is-active {
  color: var(--ink);
  background: #fffaf0;
  box-shadow: 0 1px 3px rgba(90, 66, 40, 0.18);
}
.rank-me { margin: 0 0 8px; font-size: 11px; color: var(--brick-deep); }
.rank-me[hidden] { display: none; }
.rank-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
}
.rank-period-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(34, 28, 21, 0.05);
}
.rank-period-btn {
  border: 0;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
}
.rank-period-btn.is-active {
  color: var(--ink);
  background: #fffaf0;
  box-shadow: 0 1px 3px rgba(90, 66, 40, 0.16);
}
/* ---------- 猫对话 ---------- */
.sheet--mailbox-card {
  max-width: 420px;
  border-radius: 22px 22px 0 0;
  transition: background 0.25s ease;
}
.mc-head {
  align-items: center;
}
.mc-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mc-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  color: #fff;
  background: #b4452f;
}
.mc-pager {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}
.mc-body-wrap {
  text-align: center;
  padding-top: 6px;
}
.mc-seal {
  width: 54px;
  height: 54px;
  margin: 4px auto 10px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 4px 14px rgba(94, 62, 34, 0.14);
}
.mc-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.35;
}
.mc-sender {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}
.mc-divider {
  height: 1px;
  margin: 12px 0;
  background: rgba(94, 76, 52, 0.16);
}
.mc-body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px dashed rgba(94, 76, 52, 0.22);
}
.mc-footer {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--ink-soft);
}

.visually-hidden {
  position: absolute;
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}
.sheet--chat { max-height: 82%; display: flex; flex-direction: column; }
.chat-head-title-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.chat-ai-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  color: #b4452f;
  background: rgba(180, 69, 47, 0.1);
  border: 1px solid rgba(180, 69, 47, 0.22);
}
.chat-ai-badge[hidden] {
  display: none;
}
.chat-ai-badge[data-state="online"] {
  color: #15803d;
  background: #dcfce7;
  border-color: #86efac;
}
.chat-ai-badge[data-state="fallback"] {
  color: #64748b;
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.chat-sheet-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chat-list {
  min-height: 150px;
  max-height: 40vh;
  overflow-y: auto;
  padding: 6px 0 8px;
}
.chat-row { display: flex; margin-bottom: 8px; }
.chat-row--mine { justify-content: flex-end; }
.chat-bubble {
  max-width: 78%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  background: #fffaf0;
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(90, 66, 40, 0.12);
  word-break: break-word;
}
.chat-row--mine .chat-bubble { background: rgba(180, 69, 47, 0.12); color: var(--brick-deep); }
.chat-row--typing .chat-bubble { color: var(--ink-soft); }
.chat-topics { display: flex; flex-wrap: wrap; margin-top: 6px; }
.chat-topic {
  margin: 0 8px 8px 0;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink);
  background: #fffaf0;
  border: 1px solid rgba(94, 76, 52, 0.2);
}
.chat-topic:disabled { opacity: 0.5; }
.chat-compose {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(94, 76, 52, 0.14);
}
.chat-input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 9px 13px;
  border-radius: 12px;
  border: 1.5px solid rgba(94, 76, 52, 0.28);
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
  font-size: max(1rem, 16px);
  line-height: 1.4;
}
.chat-input::placeholder {
  color: #8c7a64;
  font-size: 14px;
}
.chat-input:focus-visible,
.chat-send-btn:focus-visible,
.chat-topic:focus-visible {
  outline: 2px solid var(--brick);
  outline-offset: 2px;
}
.chat-send-btn {
  flex-shrink: 0;
  min-height: 44px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 700;
}
.chat-send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
@media (pointer: coarse) {
  .chat-input,
  .chat-send-btn {
    min-height: 48px;
  }
}
.order-note {
  margin: 0 0 14px;
  padding: 13px 15px;
  border-radius: 16px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink);
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.98) 0%, rgba(252, 246, 235, 0.94) 100%);
  border: 1px solid rgba(210, 180, 140, 0.38);
  box-shadow: 0 4px 12px rgba(80, 50, 20, 0.06);
  overflow: hidden;
}

.craft-card-top, .order-note-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 8px;
  margin-bottom: 8px;
}
.craft-card-title, .order-note-title {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1 1 200px;
  min-width: 0;
}
.craft-card-icon {
  font-size: 18px;
  line-height: 1.15;
  flex-shrink: 0;
}
.craft-card-names {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 6px;
  min-width: 0;
}
.craft-card-main-title {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.3;
  color: #2b2015;
  word-break: break-word;
}
.craft-card-badge {
  font-size: 11px;
  font-weight: 600;
  color: #a43a18;
  background: rgba(180, 69, 47, 0.1);
  border: 1px solid rgba(180, 69, 47, 0.2);
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.craft-card-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
  max-width: 100%;
}
.craft-card-done, .order-note-count {
  font-size: 11px;
  font-weight: 600;
  color: #766350;
  background: rgba(0, 0, 0, 0.04);
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.craft-switch-pill, .order-note-switch {
  font-size: 11.5px;
  font-weight: 700;
  color: #8b3c1b;
  background: linear-gradient(135deg, #fff7ea 0%, #ffeed2 100%);
  border: 1px solid rgba(224, 142, 60, 0.45);
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s ease;
  box-shadow: 0 1px 4px rgba(180, 69, 47, 0.1);
}
.craft-switch-pill:active, .order-note-switch:active {
  transform: scale(0.92);
  background: #ffe5bf;
}

.craft-prog-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}
.craft-prog-bar, .order-note-bar {
  flex: 1;
  height: 6px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  overflow: hidden;
}
.craft-prog-fill, .order-note-fill {
  height: 100%;
  background: linear-gradient(90deg, #e0a040 0%, #c44c2c 100%);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.craft-prog-pct {
  font-size: 11px;
  font-weight: 700;
  color: #9c4c23;
  min-width: 28px;
  text-align: right;
}

.craft-card-desc, .order-note-desc {
  font-size: 11.5px;
  color: #786654;
  line-height: 1.45;
  margin: 0;
}
.btn--wash-finish {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
  border: none !important;
  border-radius: 12px !important;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn--wash-finish:active {
  transform: scale(0.98);
}

.social-privilege-banner {
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
  border: 1px solid #fecdd3;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.08);
}

.passcode-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.passcode-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.passcode-input {
  width: 100%;
  box-sizing: border-box;
  height: 36px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid #fda4af;
  background: #ffffff;
  color: #221c15;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.passcode-input:focus {
  border-color: #e11d48;
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.14);
}

.passcode-hover-tip {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  min-width: 220px;
  max-width: 280px;
  padding: 8px 11px;
  border-radius: 10px;
  background: #2c2119;
  color: #fff7ea;
  font-size: 11.5px;
  line-height: 1.45;
  box-shadow: 0 8px 22px rgba(20, 12, 6, 0.28);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

.passcode-hover-tip::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 100%;
  border-width: 6px 6px 0 6px;
  border-style: solid;
  border-color: #2c2119 transparent transparent transparent;
}

.passcode-input-wrap:hover .passcode-hover-tip,
.passcode-input-wrap:focus-within .passcode-hover-tip,
.passcode-input-wrap.is-tip-visible .passcode-hover-tip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ============ 适老版（大字模式）专属样式 ============ */
body.font-large {
  font-size: 112%;
}
body.font-large .boot-title {
  font-size: 34px;
}
body.font-large .boot-sub {
  font-size: 17px;
}
body.font-large .btn {
  font-size: 16px;
  min-height: 46px;
}
body.font-large .hud-title h3 {
  font-size: 18px;
}
body.font-large .hud-hint {
  font-size: 15px;
}
body.font-large .settings-stat {
  font-size: 14px;
}

/* ============ 随机突发事件（惊喜打赏 / 律师讨薪）与欢庆特效 ============ */
.result-fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 37;
}

.result-burst-item {
  position: absolute;
  left: 50%;
  top: 48%;
  font-size: 20px;
  line-height: 1;
  will-change: transform, opacity;
  opacity: 0;
  filter: drop-shadow(0 2px 6px rgba(217, 119, 6, 0.45));
}

@media (prefers-reduced-motion: no-preference) {
  .result-burst-item {
    animation: resultBurstFly 1.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: var(--delay, 0s);
  }
  .result-card.is-surprise {
    animation: surpriseCardPop 0.65s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation-timing-function: linear(0, 0.06 2%, 0.45 8%, 1.07 20%, 1.12 26%, 0.99 42%, 1.01 62%, 1);
  }
  .result-event.is-good {
    animation: surpriseBannerPop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    animation-timing-function: linear(0, 0.08 2%, 0.55 9%, 1.09 22%, 1.04 34%, 0.99 52%, 1);
  }
}

@keyframes resultBurstFly {
  0% {
    opacity: 0;
    transform: translate3d(-50%, -50%, 0) scale(0.4) rotate(0deg);
  }
  15% {
    opacity: 1;
  }
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px)), 0) scale(var(--sc, 1)) rotate(var(--rot, 180deg));
  }
}

@keyframes surpriseCardPop {
  0% { transform: scale(0.92); }
  100% { transform: scale(1); }
}

@keyframes surpriseBannerPop {
  0% { opacity: 0; transform: translate3d(0, 8px, 0) scale(0.94); }
  100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

.result-card {
  position: relative;
  z-index: 36;
}

.result-card.is-surprise {
  box-shadow: 0 0 0 2px #f59e0b, 0 18px 44px rgba(245, 158, 11, 0.34), var(--shadow);
  background: linear-gradient(180deg, #fffdf6 0%, #fef0cd 100%);
}

.result-event {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  text-align: left;
  border: 1px solid transparent;
}

.result-event.is-good {
  background: linear-gradient(135deg, #fff7d6 0%, #fde68a 100%);
  border-color: #f59e0b;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.22);
}

.result-event.is-bad {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  border-color: #9ca3af;
}

.result-event-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 4px;
}

.result-event.is-good .result-event-tag {
  background: #d97706;
  color: #ffffff;
}

.result-event.is-bad .result-event-tag {
  background: #4b5563;
  color: #ffffff;
}

.result-event-title {
  display: block;
  font-size: 13px;
  line-height: 1.35;
  color: #292524;
}

.result-event.is-good .result-event-title {
  color: #92400e;
}

.result-event-desc {
  margin: 4px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: #57534e;
}

.result-coin.is-surprise {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.24) 0%, rgba(251, 191, 36, 0.34) 100%);
  border: 1px solid rgba(217, 119, 6, 0.35);
}

.result-coin-badge {
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.result-coin-badge.is-good {
  background: #d97706;
  color: #ffffff;
}

.result-coin-badge.is-bad {
  background: #6b7280;
  color: #ffffff;
}

