:root {
  --leaf: #2f6b3a;
  --leaf-deep: #1f4d2a;
  --moss: #6f9b57;
  --sun: #f0c95a;
  --earth: #6b4a2e;
  --clay: #c4a574;
  --paper: #f7f1e3;
  --wing: #e8f2dc;
  --ink: #1c2a1a;
  --muted: #5a6b55;
  --danger: #b5452a;
  --ok: #2f8f5b;
  --warn: #c4842a;
  --shadow: 0 10px 28px rgba(31, 77, 42, 0.12);
  --radius: 18px;
  --tab-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font-display: "ZCOOL KuaiLe", "Noto Serif SC", serif;
  --font-body: "Noto Serif SC", "Songti SC", serif;
  --font-ui: "Nunito", "Noto Serif SC", sans-serif;
  /* 缁冨瓧鐢ㄥ瓧锛氫紭鍏堢郴缁熸シ浣擄紝鐣ュ姞绮椾究浜庡鐓?*/
  --font-hanzi: "KaiTi", "妤蜂綋", "STKaiti", "Kaiti SC", "Noto Serif SC", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(ellipse at 20% -10%, rgba(240, 201, 90, 0.28), transparent 45%),
    radial-gradient(ellipse at 100% 0%, rgba(111, 155, 87, 0.22), transparent 40%),
    linear-gradient(165deg, #e7efd8 0%, var(--paper) 42%, #e4d7c0 100%);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cpath d='M10 40c20-18 40-18 60 0' fill='none' stroke='%232f6b3a' stroke-width='2'/%3E%3Ccircle cx='40' cy='22' r='3' fill='%232f6b3a'/%3E%3C/svg%3E");
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 12px 14px calc(var(--tab-h) + var(--safe-b) + 12px);
}

.topbar {
  position: relative;
  z-index: 25;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  animation: rise 0.45s ease-out both;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 26px;
  background: linear-gradient(145deg, var(--sun), #e8a94a);
  box-shadow: var(--shadow);
}

.brand-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.04em;
  color: var(--leaf-deep);
  line-height: 1.1;
}

.brand-tag {
  margin: 2px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  font-family: var(--font-ui);
}

.topbar-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--leaf-deep);
}

.topbar-points-wrap {
  position: relative;
}

.pill-points {
  cursor: pointer;
  border: none;
  font: inherit;
  font-weight: 800;
  color: inherit;
}

.pill-points:hover {
  background: rgba(47, 107, 58, 0.16);
}

.pill-points[aria-expanded="true"] {
  background: rgba(240, 201, 90, 0.45);
}

.points-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 1;
  width: min(240px, 78vw);
  padding: 12px;
  border-radius: 14px;
  background: var(--paper);
  border: 1px solid rgba(107, 74, 46, 0.18);
  box-shadow: var(--shadow);
  animation: rise 0.2s ease both;
}

.points-popover-title {
  margin: 0 0 8px;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--earth);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(47, 107, 58, 0.1);
  border: 1px solid rgba(47, 107, 58, 0.18);
  border-radius: 999px;
  padding: 4px 10px;
}

.view {
  animation: rise 0.35s ease-out both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes flutter {
  0%,
  100% {
    transform: rotate(-2deg) translateY(0);
  }
  50% {
    transform: rotate(2deg) translateY(-3px);
  }
}

@keyframes unlock-pop {
  0% {
    transform: scale(0.7);
    opacity: 0;
  }
  60% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.panel {
  background: rgba(255, 252, 245, 0.86);
  border: 1px solid rgba(107, 74, 46, 0.12);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
  backdrop-filter: blur(6px);
}

.panel h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--leaf-deep);
}

.panel p.lead {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(47, 107, 58, 0.12);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--moss), var(--sun));
  transition: width 0.4s ease;
}

.progress-stack {
  display: grid;
  gap: 10px;
  margin: 4px 0 2px;
}

.today-done-banner {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(145deg, #e8f7ec, #dff3e7);
  border: 1px solid rgba(47, 107, 58, 0.22);
  text-align: center;
}

.today-done-banner strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--leaf-deep);
}

.today-done-banner span {
  display: block;
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--muted);
}

.today-save-block {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.btn-save-progress {
  width: 100%;
}

.btn-save-progress--done,
.btn-save-progress:disabled {
  background: #c8d4ca;
  border-color: #b5c3b8;
  color: #5a6b5e;
  cursor: default;
  box-shadow: none;
}

.points-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.points-detail-item {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(47, 107, 58, 0.06);
}

.points-detail-label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
}

.points-detail-value {
  font-size: 1.1rem;
  color: var(--leaf-deep);
}

.points-detail-subtitle {
  margin: 4px 0 6px;
  font-size: 0.76rem;
  color: var(--muted);
}

.points-detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.points-detail-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.84rem;
  color: var(--ink);
}

.points-detail-list strong {
  color: var(--leaf-deep);
}

.points-detail-list strong.spent {
  color: #9a4f3a;
}

.points-detail-muted {
  font-size: 0.78rem;
  color: var(--muted);
}

.points-detail-muted strong {
  color: var(--muted);
  font-weight: 700;
}

.points-detail-total {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed rgba(107, 74, 46, 0.18);
  font-weight: 700;
}

.today-all-done {
  text-align: center;
  padding: 28px 16px;
}

.today-all-done-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--leaf), var(--leaf-deep));
  color: #fff;
  font-size: 1.6rem;
  line-height: 56px;
  font-weight: 800;
}

.today-all-done strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--leaf-deep);
}

.today-all-done p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.progress-block {
  display: grid;
  gap: 5px;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-ui);
}

.progress-label {
  font-weight: 800;
  font-size: 0.78rem;
  color: var(--leaf-deep);
  flex: 0 0 auto;
}

.progress-detail {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
  line-height: 1.3;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--muted);
}

.btn {
  appearance: none;
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(145deg, var(--leaf), var(--leaf-deep));
  color: #fff;
  width: 100%;
}

.btn-secondary {
  background: var(--wing);
  color: var(--leaf-deep);
  border: 1px solid rgba(47, 107, 58, 0.2);
}

.btn-full {
  width: 100%;
}

.btn-ghost {
  background: transparent;
  color: var(--leaf);
  border: 1px dashed rgba(47, 107, 58, 0.35);
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.btn-ok {
  background: #dff3e7;
  color: var(--ok);
}

.btn-mid {
  background: #fff1d6;
  color: var(--warn);
}

.btn-bad {
  background: #f8e0d8;
  color: var(--danger);
}

.char-hero {
  text-align: center;
  padding: 18px 10px 8px;
}

.char-pinyin {
  font-family: var(--font-ui);
  color: var(--earth);
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.char-glyph {
  display: none;
}

.tianzige {
  width: min(300px, 82vw);
  aspect-ratio: 1;
  margin: 10px auto 0;
  border: 2px solid rgba(107, 74, 46, 0.35);
  background:
    linear-gradient(to right, transparent 49.5%, rgba(107, 74, 46, 0.25) 49.5%, rgba(107, 74, 46, 0.25) 50.5%, transparent 50.5%),
    linear-gradient(to bottom, transparent 49.5%, rgba(107, 74, 46, 0.25) 49.5%, rgba(107, 74, 46, 0.25) 50.5%, transparent 50.5%),
    #fffdf8;
  display: grid;
  place-items: center;
  border-radius: 8px;
  position: relative;
}

.tianzige .ghost {
  font-size: clamp(6.5rem, 34vw, 10rem);
  line-height: 1;
  font-family: var(--font-hanzi);
  color: #1c2a1a;
  font-weight: 700;
  user-select: none;
}

.detail-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.detail-item {
  background: rgba(232, 242, 220, 0.55);
  border-radius: 12px;
  padding: 10px 12px;
}

.detail-item strong {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--leaf);
  margin-bottom: 4px;
}

.detail-item span,
.detail-item p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
}

.list {
  display: grid;
  gap: 8px;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 252, 245, 0.9);
  border: 1px solid rgba(107, 74, 46, 0.1);
  cursor: pointer;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
}

.list-item .glyph {
  font-size: 1.6rem;
  font-weight: 700;
  width: 40px;
  font-family: var(--font-hanzi);
}
.list-item .glyph.glyph-word {
  width: auto;
  min-width: 40px;
  max-width: 5.5em;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
}

.bank-switch {
  display: flex;
  gap: 8px;
  margin: 8px 0 10px;
}
.bank-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(107, 74, 46, 0.25);
  background: #fffdf8;
  font-weight: 700;
  color: var(--earth);
  cursor: pointer;
}
.bank-option.active {
  background: rgba(90, 140, 90, 0.16);
  border-color: rgba(90, 140, 90, 0.45);
}
.bank-option input {
  accent-color: #4a7c59;
}

.tianzige-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 10px auto 0;
  width: min(340px, 92vw);
}
.tianzige.tianzige-sm {
  width: min(110px, 28vw);
  margin: 0;
  aspect-ratio: 1;
}
.tianzige.tianzige-sm .ghost {
  font-size: clamp(2.8rem, 14vw, 4.2rem);
}
.tianzige-row.len-3 .tianzige.tianzige-sm {
  width: min(96px, 24vw);
}
.tianzige-row.len-3 .tianzige.tianzige-sm .ghost {
  font-size: clamp(2.2rem, 11vw, 3.4rem);
}
.tianzige-row.len-4 .tianzige.tianzige-sm {
  width: min(78px, 20vw);
}
.tianzige-row.len-4 .tianzige.tianzige-sm .ghost {
  font-size: clamp(1.8rem, 9vw, 2.8rem);
}
.word-examples.sentence {
  color: #5a4a3a;
  font-style: italic;
}

.list-item .info {
  flex: 1;
  min-width: 0;
}

.list-item .info small {
  display: block;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.75rem;
}

.badge {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(47, 107, 58, 0.12);
  color: var(--leaf-deep);
  white-space: nowrap;
}

.badge.warn {
  background: #fff1d6;
  color: var(--warn);
}

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 10px;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  border: 1px solid rgba(47, 107, 58, 0.2);
  background: rgba(255, 252, 245, 0.8);
  color: var(--leaf-deep);
  border-radius: 999px;
  padding: 8px 12px;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
}

.chip.active {
  background: var(--leaf);
  color: #fff;
  border-color: var(--leaf);
}

.search {
  width: 100%;
  border: 1px solid rgba(107, 74, 46, 0.2);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  background: #fffdf8;
  margin-bottom: 10px;
}

.garden-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.bug-card {
  position: relative;
  background: rgba(255, 252, 245, 0.92);
  border: 1px solid rgba(107, 74, 46, 0.12);
  border-radius: 16px;
  padding: 12px 10px;
  text-align: center;
  min-height: 150px;
  animation: unlock-pop 0.45s ease both;
}

.bug-card--viewable {
  cursor: pointer;
}

.bug-card--viewable:focus-visible {
  outline: 2px solid var(--leaf-deep);
  outline-offset: 2px;
}

.bug-view-hint {
  margin: 6px 0 0;
  font-size: 0.68rem;
  color: var(--muted);
}

.bug-card-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(90, 107, 85, 0.12);
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.bug-card-remove:hover {
  background: rgba(180, 70, 50, 0.15);
  color: #a33;
}

.debug-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 10px 4px;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.debug-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--leaf);
}

.debug-actions {
  display: grid;
  gap: 8px;
}

.btn-danger {
  color: #a33;
  border-color: rgba(180, 70, 50, 0.35);
}

.bug-card.locked {
  filter: grayscale(0.35);
  background: rgba(90, 107, 85, 0.08);
}

.bug-art {
  width: 72px;
  height: 72px;
  margin: 0 auto 8px;
  animation: flutter 4s ease-in-out infinite;
}

.bug-card.locked .bug-art {
  animation: none;
  opacity: 0.55;
}

.bug-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--leaf-deep);
}

.bug-fact {
  margin: 4px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}

.bug-lock-label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muted);
}

.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(480px, 100%);
  height: calc(var(--tab-h) + var(--safe-b));
  padding: 8px 10px var(--safe-b);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  background: rgba(255, 252, 245, 0.94);
  border-top: 1px solid rgba(107, 74, 46, 0.12);
  backdrop-filter: blur(10px);
  z-index: 20;
}

/* ?garden=1 时多一个花园入口，避免第 6 个挤出底栏 */
body.garden-mode .tabbar {
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
}

body.garden-mode .tab {
  font-size: 0.72rem;
}

body.garden-mode .tab-icon {
  font-size: 1.05rem;
}

/* ?debug=x 时露出仿真 Tab */
body.sim-mode .tabbar {
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
}
body.sim-mode .tab {
  font-size: 0.72rem;
}
body.sim-mode .tab-icon {
  font-size: 1.05rem;
}

.sim-panel .sim-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 8px 0 10px;
  font-size: 0.88rem;
  color: var(--muted);
}
.sim-stage-wrap {
  position: relative;
  min-height: 240px;
  height: min(58vh, 440px);
  border-radius: 16px;
  overflow: hidden;
  background: #cfdcba;
  box-shadow: inset 0 0 0 1px rgba(60, 80, 40, 0.12);
}
.sim-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.sim-loading,
.sim-webgl-err,
.sim-glb-info {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  margin: 0;
  z-index: 1;
  text-align: center;
}
.sim-glb-info {
  bottom: 36px;
  color: rgba(40, 55, 30, 0.85);
  font-size: 0.8rem;
}
.sim-controls {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--muted);
}
.sim-controls label {
  display: grid;
  gap: 4px;
}
.sim-controls input[type="range"] {
  width: 100%;
}
.sim-controls select {
  font: inherit;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(107, 74, 46, 0.2);
}
.sim-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.dictation-listen {
  text-align: center;
  position: relative;
}

.dictation-listen-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  text-align: left;
}

.dictation-listen-head h2 {
  margin: 0;
}

.dictation-exit {
  appearance: none;
  border: none;
  background: rgba(47, 107, 58, 0.1);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
}

.dictation-exit:active {
  background: rgba(47, 107, 58, 0.18);
}

.dictation-group-pos {
  margin: 0 auto 6px;
}

.dictation-auto-hint {
  margin: 8px 0 0;
}

.dictation-progress {
  margin: 8px 0 4px;
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--leaf-deep);
  letter-spacing: 0.04em;
}

.dictation-hint {
  margin: 0 auto 16px;
  max-width: 22em;
}

.btn-dictation-play {
  appearance: none;
  border: none;
  width: 120px;
  height: 120px;
  margin: 8px auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  gap: 4px;
  background: linear-gradient(145deg, var(--sun), #e8a94a);
  color: var(--leaf-deep);
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.btn-dictation-play:active {
  transform: scale(0.96);
}

.dictation-play-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.dictation-status {
  margin: 10px 0 16px;
  min-height: 1.2em;
}

.dictation-actions {
  grid-template-columns: 1fr 1.2fr;
}

.dictation-actions-3 {
  grid-template-columns: 0.9fr 1.1fr 1.1fr;
  gap: 8px;
}

.tab {
  border: none;
  background: transparent;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.72rem;
  color: var(--muted);
  cursor: pointer;
}

.tab.active {
  color: var(--leaf-deep);
  background: rgba(47, 107, 58, 0.1);
}

.tab-icon {
  font-size: 1.15rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
  transform: translateX(-50%);
  background: var(--leaf-deep);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.85rem;
  z-index: 40;
  box-shadow: var(--shadow);
  max-width: 90vw;
  text-align: center;
}

.modal.modal-study {
  padding: 12px 14px 14px;
  max-height: 92dvh;
}

.stroke-rule {
  margin: 0 0 6px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.study-hero {
  text-align: center;
  padding: 0;
}

.tianzige-lg {
  width: min(320px, 86vw);
  margin: 2px auto 0;
}

.word-examples {
  margin: 10px 0 12px;
  text-align: center;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--leaf-deep);
  letter-spacing: 0.04em;
}

.study-actions {
  margin-top: 0;
}

.study-extra-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.btn-compact {
  padding: 10px 8px;
  font-size: 0.82rem;
}

.modal.modal-study .study-actions .btn-row {
  margin-bottom: 0;
}

.study-extra-row--2 {
  grid-template-columns: 1fr 1fr;
}

.sync-setup {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.sync-field {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.sync-field input {
  width: 100%;
  border: 1px solid rgba(107, 74, 46, 0.2);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: var(--font-ui);
  background: #fffdf8;
}

.sync-status {
  margin: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 42, 26, 0.45);
  z-index: 50;
  display: grid;
  place-items: end center;
  padding: 12px;
}

.modal {
  width: min(480px, 100%);
  max-height: 88dvh;
  overflow: auto;
  background: var(--paper);
  border-radius: 22px 22px 16px 16px;
  padding: 16px;
  box-shadow: var(--shadow);
  animation: rise 0.25s ease both;
}

.modal-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.lightbox-backdrop {
  place-items: center;
  padding: 20px;
}

.lightbox-modal {
  position: relative;
  width: min(420px, 100%);
  max-height: 90dvh;
  overflow: auto;
  text-align: center;
  border-radius: 20px;
  padding: 18px 16px 16px;
}

.lightbox-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(90, 107, 85, 0.12);
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-photo {
  display: block;
  width: 100%;
  max-height: 62dvh;
  object-fit: contain;
  border-radius: 14px;
  background: rgba(255, 252, 245, 0.9);
}
/* 死虫：实拍仍可看，但与场景卡通一致改为灰阶，避免「还活着」的观感 */
.lightbox-photo.is-dead {
  filter: grayscale(1) brightness(0.92);
  opacity: 0.88;
}
.lightbox-modal.is-dead .lightbox-title {
  color: var(--muted);
}

.lightbox-title {
  margin: 12px 0 4px;
  font-family: var(--font-display);
  color: var(--leaf-deep);
  font-size: 1.15rem;
}

.lightbox-latin {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}

.study-session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: -4px 0 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(47, 107, 58, 0.08);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--leaf-deep);
}

.study-session-exit {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 4px 6px;
}

.empty {
  text-align: center;
  padding: 28px 12px;
  color: var(--muted);
}

.note {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.photo-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
}

.photo-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(107, 74, 46, 0.2);
}

.hidden-input {
  display: none;
}

.season-label {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--earth);
}

.points-pill {
  font-weight: 800;
  color: var(--leaf-deep);
  background: rgba(240, 201, 90, 0.35);
  border-radius: 999px;
  padding: 2px 10px;
}

.pet-panel .pet-stage-art {
  width: min(280px, 78vw);
  margin: 8px auto 0;
}

.pet-photo {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 18px;
  display: block;
  box-shadow: var(--shadow);
  background: #e8f2dc;
}

.pet-photo.blank {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--font-ui);
  font-weight: 800;
}

.pet-mini .pet-photo {
  border-radius: 14px;
  box-shadow: none;
}

.egg-card .pet-photo {
  border-radius: 14px;
  box-shadow: none;
}

.next-need {
  margin: 0 0 10px;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: var(--leaf-deep);
}

.next-need strong {
  font-size: 1.2rem;
  color: var(--earth);
}

.stage-chip.mystery {
  background: rgba(90, 107, 85, 0.12);
  color: transparent;
  text-shadow: 0 0 0 #8a9584;
  color: #8a9584;
  min-width: 2rem;
  text-align: center;
  filter: grayscale(0.4);
  opacity: 0.55;
}

.pet-mini {
  width: 96px;
  margin: 0 auto 6px;
}

.pet-caption {
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--leaf-deep);
  margin: 8px 0 2px;
}

.pet-latin {
  text-align: center;
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
}

.pet-stage-name {
  text-align: center;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.species-debug-list {
  margin: 8px 0 0;
  padding-left: 1.2rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.55;
}

.species-debug-list code {
  font-size: 0.78rem;
}

.egg-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.egg-card {
  position: relative;
  appearance: none;
  border: 1px solid rgba(107, 74, 46, 0.14);
  background: rgba(255, 252, 245, 0.95);
  border-radius: 16px;
  padding: 4px;
  text-align: center;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.egg-no {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  margin: 0;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(47, 107, 58, 0.92);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.75rem;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.egg-tried-mark {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  margin: 0;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(255, 252, 245, 0.92);
  color: var(--leaf-deep);
  font-size: 0.62rem;
  font-family: var(--font-ui);
  line-height: 1.2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.egg-card--tried {
  border-color: rgba(47, 107, 58, 0.28);
  background: rgba(240, 248, 242, 0.95);
}

.egg-card:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.egg-card .pet-stage-art.mini {
  width: 100%;
  margin: 0;
}

.stage-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stage-chip {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(90, 107, 85, 0.08);
  color: var(--muted);
}

.stage-chip small {
  display: block;
  font-weight: 600;
  opacity: 0.8;
}

.stage-chip.active {
  background: rgba(47, 107, 58, 0.18);
  color: var(--leaf-deep);
}

.stage-chip.done {
  background: rgba(111, 155, 87, 0.25);
  color: var(--leaf-deep);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 鈥斺€?铏埧瀹為獙 鈥斺€?*/
.ranch-panel .ranch-head {
  margin-bottom: 8px;
}
.ranch-head .lead {
  margin: 2px 0 0;
  font-size: 0.9rem;
}
.ranch-exp {
  font-size: 0.7em;
  font-weight: 700;
  color: var(--muted);
  vertical-align: middle;
  margin-left: 4px;
}
.ranch-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.ranch-hint {
  margin: 0 0 10px;
  font-size: 0.78rem;
  color: var(--muted);
}
.ranch-hint.soft {
  margin-top: -6px;
  opacity: 0.85;
}
.ranch-bag-tile.on-dock {
  box-shadow: inset 0 0 0 2px rgba(47, 107, 58, 0.35);
}
.ranch-bag-tile[data-equip-dock] {
  cursor: pointer;
}
.ranch-bag-dock-tag {
  position: absolute;
  left: 6px;
  top: 5px;
  font-size: 0.58rem;
  font-weight: 800;
  color: var(--leaf-deep);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 6px;
  padding: 1px 4px;
  line-height: 1.2;
}
.ranch-sec {
  margin: 14px 0 8px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* 鍟嗗簵锛氬亸鍥?*/
.ranch-shop-grid,
.ranch-bag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px;
}
.ranch-shop-tile,
.ranch-bag-tile {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid rgba(47, 107, 58, 0.16);
  border-radius: 16px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.72), rgba(232, 242, 228, 0.55));
  cursor: pointer;
  font: inherit;
  color: inherit;
  padding: 0;
  display: grid;
  place-items: center;
  overflow: visible;
}
.ranch-shop-tile:disabled,
.ranch-bag-tile:disabled {
  cursor: default;
}
.ranch-bag-tile.plain:not([data-equip-dock]) {
  cursor: default;
}
.ranch-shop-tile.owned,
.ranch-bag-tile.owned {
  filter: grayscale(0.35);
  opacity: 0.72;
}
.ranch-shop-ico {
  width: 68%;
  height: 68%;
  display: grid;
  place-items: center;
}
.ranch-shop-ico img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(31, 77, 42, 0.18));
}
.ranch-shop-ico .emoji {
  font-size: clamp(1.6rem, 7vw, 2.1rem);
  line-height: 1;
}
.ranch-shop-price,
.ranch-bag-count {
  position: absolute;
  right: 6px;
  bottom: 5px;
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--leaf-deep);
  background: rgba(255, 252, 245, 0.88);
  padding: 1px 6px;
  border-radius: 999px;
  line-height: 1.4;
}
.ranch-shop-tile[data-tip]::after,
.ranch-bag-tile[data-tip]::after,
.ranch-tool[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  width: max-content;
  max-width: 180px;
  padding: 6px 9px;
  border-radius: 10px;
  background: rgba(31, 49, 34, 0.92);
  color: #f6faf3;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 5;
  white-space: normal;
}
.ranch-shop-tile:hover::after,
.ranch-shop-tile:focus-visible::after,
.ranch-bag-tile:hover::after,
.ranch-bag-tile:focus-visible::after,
.ranch-tool:hover::after,
.ranch-tool:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 楗插吇鍦烘櫙锛氬簞鍥劅 */
.ranch-stage {
  display: grid;
  gap: 12px;
}
.ranch-scene {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  aspect-ratio: 1 / 1.12;
  background: linear-gradient(180deg, #9fd0f0 0%, #c8e7f8 38%, #e8f4c8 62%, #b8d98a 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 10px 28px rgba(47, 90, 60, 0.12);
}
.ranch-sky {
  position: absolute;
  inset: 0 0 45%;
  pointer-events: none;
}
.ranch-sun {
  position: absolute;
  top: 10%;
  left: 12%;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff7c2, #ffd56a 55%, #f0b43a);
  box-shadow: 0 0 24px rgba(255, 210, 100, 0.55);
  animation: ranch-sun-pulse 5s ease-in-out infinite;
}
.ranch-cloud {
  position: absolute;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow:
    14px 0 0 rgba(255, 255, 255, 0.8),
    -12px 4px 0 rgba(255, 255, 255, 0.7),
    0 8px 0 rgba(255, 255, 255, 0.65);
  animation: ranch-cloud-drift linear infinite;
  opacity: 0.9;
}
.ranch-cloud.c1 { top: 14%; left: -20%; width: 46px; animation-duration: 42s; }
.ranch-cloud.c2 { top: 22%; left: 30%; width: 36px; animation-duration: 56s; animation-delay: -12s; }
.ranch-cloud.c3 { top: 10%; left: 70%; width: 40px; animation-duration: 48s; animation-delay: -28s; }
.ranch-hills {
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: 40%;
  height: 22%;
  background:
    radial-gradient(ellipse 40% 90% at 20% 100%, #8fbf6e 0%, transparent 70%),
    radial-gradient(ellipse 45% 100% at 55% 100%, #7eb05f 0%, transparent 72%),
    radial-gradient(ellipse 38% 85% at 85% 100%, #92c472 0%, transparent 70%);
  pointer-events: none;
}
.ranch-fence {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 41%;
  height: 10%;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0 18px,
      rgba(140, 100, 60, 0.35) 18px 22px
    ),
    linear-gradient(180deg, transparent 40%, rgba(140, 100, 60, 0.28) 40% 52%, transparent 52%);
  opacity: 0.55;
  pointer-events: none;
}
.ranch-grass {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  background:
    linear-gradient(180deg, #a8cb72 0%, #7eb05a 28%, #6a9a48 70%, #5a8740 100%);
  pointer-events: none;
  border-top: 2px solid rgba(70, 100, 40, 0.25);
}
.ranch-grass::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      -12deg,
      transparent 0 10px,
      rgba(255, 255, 255, 0.07) 10px 12px
    );
  opacity: 0.45;
}
.ranch-grass::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 12%;
  height: 2px;
  border-radius: 999px;
  background: rgba(40, 70, 30, 0.14);
}

.ranch-hud.soft {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  max-width: 44%;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 252, 245, 0.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
}
.ranch-hud-title {
  font-family: var(--font-display);
  font-size: 0.92rem;
  color: var(--leaf-deep);
  line-height: 1.2;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}
.ranch-hud-line {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(31, 77, 42, 0.8);
  margin-top: 2px;
}
.ranch-hud-meters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 5px;
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(31, 77, 42, 0.72);
}
.ranch-hud-hint {
  margin-top: 4px;
  font-family: var(--font-ui);
  font-size: 0.62rem;
  font-weight: 700;
  color: rgba(31, 77, 42, 0.55);
}
.ranch-bubble {
  position: absolute;
  left: 10%;
  bottom: 42%;
  z-index: 6;
  max-width: 42%;
  padding: 8px 12px;
  border-radius: 16px 16px 16px 6px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--leaf-deep);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
  box-shadow: 0 4px 14px rgba(40, 70, 40, 0.12);
  animation: ranch-bubble-in 0.45s ease-out;
  pointer-events: none;
}
.ranch-bubble.pop {
  animation: ranch-bubble-pop 0.55s ease-out;
}

/* 地面层：虫子 + 木屑同一平面 */
.ranch-yard {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34%;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 6% 4%;
  box-sizing: border-box;
  pointer-events: none;
}
.ranch-yard-row {
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2%;
  pointer-events: none;
}
.ranch-yard-row.has-food {
  gap: 0;
  justify-content: center;
}
.ranch-yard-row.has-food .ranch-hero,
.ranch-yard-row.has-food .ranch-pet-wrap {
  margin-right: -14%;
  z-index: 3;
}
.ranch-yard-row.has-jelly .ranch-pet-wrap {
  margin-right: -22%;
}
.ranch-yard-row.has-puparium-prop .ranch-pet-wrap {
  margin-right: -10%;
}
.ranch-puparium.on-grass {
  position: relative;
  flex-shrink: 0;
  width: clamp(52px, 18vw, 72px);
  height: clamp(40px, 14vw, 56px);
  margin-bottom: 2%;
  z-index: 2;
  animation: ranch-puparium-in 0.45s ease-out both;
}
.ranch-puparium-shell {
  position: absolute;
  inset: 18% 6% 8%;
  border-radius: 50% 50% 46% 46%;
  background: radial-gradient(ellipse at 35% 30%, #e8d4b0 0%, #c4a882 55%, #8a6a48 100%);
  box-shadow: inset 0 -4px 8px rgba(80, 50, 20, 0.25), 0 3px 0 rgba(60, 80, 40, 0.18);
}
.ranch-puparium-rim {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 22%;
  height: 28%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, #d4b890 0%, transparent 70%);
  opacity: 0.55;
  pointer-events: none;
}
.ranch-puparium-tag {
  position: absolute;
  left: 50%;
  bottom: -2%;
  transform: translateX(-50%);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #6b4a2e;
  background: rgba(255, 252, 245, 0.88);
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(60, 40, 20, 0.12);
}
@keyframes ranch-puparium-in {
  from { opacity: 0; transform: translateY(8px) scale(0.86); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.ranch-yard-row.has-food .ranch-pet-wrap .ranch-hero {
  margin-right: 0;
}
.ranch-pet-wrap {
  position: relative;
  flex-shrink: 0;
  display: grid;
  place-items: end center;
}
.ranch-accel-badge {
  position: absolute;
  top: -6%;
  right: -4%;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px 3px 5px;
  border-radius: 999px;
  background: rgba(255, 248, 220, 0.92);
  box-shadow: 0 1px 4px rgba(60, 40, 10, 0.18);
  pointer-events: none;
  font-size: 11px;
  font-weight: 700;
  color: #8a4b12;
  line-height: 1;
}
.ranch-accel-badge.is-paused {
  background: rgba(230, 230, 230, 0.92);
  color: #666;
}
.ranch-accel-clock {
  position: relative;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.ranch-accel-face {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid currentColor;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.55);
}
.ranch-accel-hand {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 5px;
  margin-left: -1px;
  margin-top: -5px;
  border-radius: 1px;
  background: currentColor;
  transform-origin: 50% 100%;
  animation: ranch-accel-spin 0.55s linear infinite;
}
.ranch-accel-badge.is-paused .ranch-accel-hand {
  animation: none;
  transform: rotate(45deg);
  opacity: 0.7;
}
.ranch-accel-txt {
  letter-spacing: -0.02em;
}
@keyframes ranch-accel-spin {
  to { transform: rotate(360deg); }
}
/* 加速中：幼虫啃食略加快，蛹期不强行改卡通 */
.ranch-hero.is-accel.is-munching .ranch-toon-wrap {
  animation-duration: 0.55s;
}
.ranch-hero.is-accel.is-munching.stage-egg .ranch-toon-wrap {
  animation-duration: 0.7s;
}
.ranch-pet-wrap.is-accel .ranch-toon-wrap {
  filter: drop-shadow(0 0 0.4px rgba(200, 120, 20, 0.15));
}
.ranch-yard-row.has-food .ranch-chips,
.ranch-yard-row.has-food .ranch-jellies {
  margin-left: -10%;
  z-index: 1;
}
.ranch-jellies,
.ranch-jellies.on-grass {
  position: relative;
  width: 34%;
  max-width: 140px;
  height: 118px;
  flex-shrink: 0;
  pointer-events: none;
}
.ranch-jelly {
  position: absolute;
  bottom: 0;
  left: calc(6% + var(--i) * 28%);
  width: 42px;
  height: 56px;
  transform-origin: 50% 100%;
  animation: ranch-jelly-in 0.4s ease-out both;
  animation-delay: calc(var(--i) * 0.06s);
  filter: drop-shadow(0 3px 2px rgba(80, 50, 20, 0.28));
}
.ranch-jelly-blob {
  position: absolute;
  left: 50%;
  bottom: 16px;
  width: 30px;
  height: 26px;
  transform: translateX(-50%);
  border-radius: 50% 50% 42% 42%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.85) 0 4px, transparent 5px),
    radial-gradient(circle at 40% 35%, #fff4c4 0%, #f2c14a 42%, #e07a28 100%);
  border: 2px solid #c46820;
}
.ranch-jelly-cup {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 34px;
  height: 22px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(186, 214, 224, 0.45));
  border: 2px solid rgba(150, 176, 188, 0.95);
  border-radius: 2px 2px 10px 10px;
  clip-path: polygon(10% 0, 90% 0, 100% 100%, 0 100%);
}
.ranch-jelly.shrinking {
  animation: ranch-jelly-eat 1s ease-in forwards;
}
@keyframes ranch-jelly-in {
  from { transform: translateY(12px) scale(0.4); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes ranch-jelly-eat {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: translate(20%, 8%) scale(0.3); }
}
.ranch-yard-row > * {
  pointer-events: auto;
}
.ranch-chips,
.ranch-chips.on-grass {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  width: 72%;
  max-width: 280px;
  height: 118px;
  flex-shrink: 0;
  z-index: 1;
  pointer-events: none;
}
.ranch-chips.empty {
  width: 12%;
  height: 8px;
  opacity: 0;
}
.ranch-hero {
  position: relative;
  left: auto;
  bottom: auto;
  transform: none;
  width: min(42%, 150px);
  height: auto;
  aspect-ratio: 1;
  z-index: 2;
  display: grid;
  place-items: end center;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  flex-shrink: 0;
}
.ranch-hero.stage-egg { width: min(28%, 96px); }
.ranch-hero.stage-adult { width: min(48%, 168px); }
.ranch-hero.empty {
  width: min(34%, 110px);
  pointer-events: none;
}
.ranch-hero-silhouette {
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}
.ranch-toon-wrap {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: end center;
  position: relative;
  z-index: 1;
  animation: ranch-idle 2.8s ease-in-out infinite;
  transform-origin: 50% 100%;
}
.ranch-toon-wrap.stage-egg,
.ranch-hero.stage-egg .ranch-toon-wrap {
  animation: ranch-egg-wobble 3.6s ease-in-out infinite;
}
.ranch-toon-wrap.is-dead {
  animation: none;
  filter: grayscale(0.75) brightness(0.95);
  opacity: 0.8;
}
/* 有木屑：头朝右（木屑一侧），贴着堆一直在啃 */
.ranch-hero.is-munching .ranch-toon-wrap {
  animation: ranch-munch 1.15s ease-in-out infinite;
  transform-origin: 30% 100%;
}
.ranch-hero.is-munching.stage-egg .ranch-toon-wrap {
  animation: ranch-munch-egg 1.4s ease-in-out infinite;
}
.ranch-hero.is-eating .ranch-toon-wrap {
  animation: ranch-eat 1.05s ease-in-out;
}
.ranch-hero.just-placed .ranch-toon-wrap {
  animation: ranch-pop 0.7s ease-out;
}
.ranch-toon {
  width: 100%;
  height: auto;
  max-height: 100%;
  overflow: visible;
  display: block;
  filter: drop-shadow(0 2px 2px rgba(40, 70, 40, 0.12));
}
.ranch-toon-seq-box {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: end center;
  position: relative;
}
.ranch-toon-seq {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 2px rgba(40, 70, 40, 0.12));
}
.ranch-toon-fb[hidden] {
  display: none !important;
}
.ranch-toon-wrap.has-puparium::before {
  display: none; /* 蛹室已画进几何 SVG */
}
.ranch-toon-wrap.stage-chamber {
  animation: ranch-chamber-breathe 3.2s ease-in-out infinite;
}
.ranch-toon-wrap.stage-pupa {
  animation: ranch-pupa-pulse 2.6s ease-in-out infinite;
}
.ranch-toon-wrap.stage-eclose {
  animation: ranch-eclose-wiggle 2.4s ease-in-out infinite;
}
.ranch-toon-wrap.stage-soft {
  animation: ranch-soft-sway 3s ease-in-out infinite;
}
@keyframes ranch-chamber-breathe {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(0, 1%) scale(1.03, 0.97); }
}
@keyframes ranch-pupa-pulse {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(0, -1%) scale(1.04, 0.98); }
}
@keyframes ranch-eclose-wiggle {
  0%, 100% { transform: translate(0, 0) rotate(-2deg); }
  40% { transform: translate(2%, 0) rotate(3deg); }
  70% { transform: translate(-1%, 0) rotate(-1deg); }
}
@keyframes ranch-soft-sway {
  0%, 100% { transform: translate(0, 0) rotate(-1deg); }
  50% { transform: translate(1%, 0) rotate(2deg); }
}
.ranch-shop-ico .ranch-toon {
  width: 78%;
  height: 78%;
  filter: none;
}
.ranch-tool-ico .ranch-toon {
  width: 36px;
  height: 36px;
  filter: none;
}
.ranch-shadow {
  position: absolute;
  left: 50%;
  bottom: 2%;
  width: 55%;
  height: 8%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(40, 60, 30, 0.22);
  filter: blur(1.5px);
  z-index: 0;
  animation: ranch-shadow 2.8s ease-in-out infinite;
  pointer-events: none;
}
.ranch-hero.stage-egg .ranch-shadow {
  width: 48%;
  bottom: 4%;
}
.ranch-hero.is-dead .ranch-shadow { animation: none; }

.ranch-welcome {
  position: absolute;
  left: 50%;
  top: 36%;
  transform: translate(-50%, -50%);
  z-index: 7;
  width: min(86%, 280px);
  text-align: center;
  padding: 16px 14px;
  border-radius: 18px;
  background: rgba(255, 252, 245, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(40, 70, 40, 0.12);
}
.ranch-welcome.soft {
  top: auto;
  bottom: 40%;
  transform: translateX(-50%);
  background: rgba(255, 252, 245, 0.55);
  padding: 10px 12px;
}
.ranch-welcome-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--leaf-deep);
}
.ranch-welcome-lead {
  margin: 6px 0 12px;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}
.ranch-welcome.soft .ranch-welcome-lead { margin-bottom: 0; }
.ranch-welcome-btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.9rem;
  color: #fff;
  background: linear-gradient(145deg, #5f9e4a, #2f6b3a);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(47, 107, 58, 0.28);
}
.ranch-welcome-btn:active { transform: scale(0.97); }

.ranch-scene-act.spray {
  position: absolute;
  right: 8%;
  bottom: 40%;
  z-index: 6;
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--leaf-deep);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 4px 14px rgba(40, 90, 120, 0.15);
  cursor: pointer;
}

@keyframes ranch-sun-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
@keyframes ranch-cloud-drift {
  from { transform: translateX(0); }
  to { transform: translateX(120vw); }
}
@keyframes ranch-breathe {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.04); opacity: 1; }
}
@keyframes ranch-idle {
  0%, 100% { transform: translate(0, 0) rotate(-2deg); }
  25% { transform: translate(3%, 0) rotate(2deg); }
  50% { transform: translate(1%, 0) rotate(-1deg); }
  75% { transform: translate(-2%, 0) rotate(1deg); }
}
@keyframes ranch-egg-wobble {
  0%, 100% { transform: translate(0, 0) rotate(-3deg); }
  50% { transform: translate(0, 0) rotate(3deg); }
}
@keyframes ranch-shadow {
  0%, 100% { transform: translateX(-50%) scaleX(1); opacity: 0.22; }
  25% { transform: translateX(-42%) scaleX(0.95); opacity: 0.18; }
  75% { transform: translateX(-58%) scaleX(0.95); opacity: 0.18; }
}
/* 头朝右，贴着木屑堆啃 */
@keyframes ranch-munch {
  0%, 100% { transform: translate(8%, 0) rotate(6deg); }
  40% { transform: translate(14%, 1%) rotate(10deg) scale(1.03, 0.97); }
  70% { transform: translate(11%, 0) rotate(7deg) scale(0.98, 1.02); }
}
@keyframes ranch-munch-egg {
  0%, 100% { transform: translate(6%, 0) rotate(4deg); }
  50% { transform: translate(10%, 0) rotate(8deg); }
}
@keyframes ranch-eat {
  0% { transform: translate(8%, 0) rotate(6deg); }
  35% { transform: translate(18%, 0) rotate(12deg) scale(1.05); }
  55% { transform: translate(16%, 0) rotate(4deg) scale(0.96); }
  100% { transform: translate(8%, 0) rotate(6deg); }
}
@keyframes ranch-pop {
  0% { transform: translateY(18px) scale(0.5); opacity: 0; }
  70% { transform: translateY(0) scale(1.08); opacity: 1; }
  100% { transform: translateY(0) scale(1); }
}
@keyframes ranch-bubble-in {
  from { opacity: 0; transform: translateY(6px) scale(0.92); }
  to { opacity: 1; transform: none; }
}
@keyframes ranch-bubble-pop {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* 木屑：小山堆，要比虫子醒目 */
.ranch-chip {
  position: absolute;
  bottom: 0;
  width: 62%;
  height: 108px;
  left: calc(var(--i) * var(--chip-step, 16%));
  transform-origin: 50% 100%;
  transform: scale(calc(0.9 + var(--i) * 0.05));
  background:
    linear-gradient(165deg, #e0c08a 0%, #c49a5c 28%, #9a7040 62%, #6e4a28 100%);
  clip-path: polygon(
    2% 100%,
    12% 68%,
    22% 82%,
    38% 36%,
    50% 18%,
    62% 40%,
    74% 58%,
    86% 42%,
    98% 100%
  );
  filter: drop-shadow(0 4px 3px rgba(60, 40, 20, 0.3));
  animation: ranch-chip-in 0.45s ease-out both;
  animation-delay: calc(var(--i) * 0.05s);
}
.ranch-chip::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 42% 38%, rgba(255, 230, 180, 0.45) 0 5px, transparent 6px),
    radial-gradient(circle at 58% 52%, rgba(90, 55, 25, 0.35) 0 3.5px, transparent 4.5px),
    radial-gradient(circle at 70% 70%, rgba(255, 220, 160, 0.3) 0 4px, transparent 5px),
    radial-gradient(circle at 30% 75%, rgba(80, 50, 20, 0.28) 0 3.5px, transparent 4.5px);
  clip-path: inherit;
  pointer-events: none;
}
.ranch-chip.shrinking {
  animation: ranch-chip-eat 1s ease-in forwards;
}
@keyframes ranch-chip-in {
  from { transform: translateY(16px) scale(0.45); opacity: 0; }
  to { transform: translateY(0) scale(calc(0.9 + var(--i) * 0.05)); opacity: 1; }
}
@keyframes ranch-chip-eat {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: translate(30%, 0) scale(0.35); }
}
.ranch-mist {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    radial-gradient(circle at 30% 40%, rgba(180, 220, 255, 0.45), transparent 35%),
    radial-gradient(circle at 60% 55%, rgba(200, 235, 255, 0.4), transparent 40%),
    radial-gradient(circle at 45% 30%, rgba(255, 255, 255, 0.35), transparent 30%);
  animation: ranch-mist 0.7s ease-out forwards;
}
@keyframes ranch-mist {
  0% { opacity: 0; transform: scale(0.9); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.15); }
}

.ranch-stage.dead .ranch-scene {
  filter: saturate(0.7);
}

/* 底栏道具：最多 6 格，不再滚动 */
.ranch-tools.manor {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 8px;
  padding: 6px 2px 2px;
  max-height: none;
  overflow: hidden;
}
.ranch-debug {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: 2;
  margin: 2px 0 4px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(20, 36, 24, 0.88);
  color: #e8f5e4;
  font-family: var(--font-ui);
  font-size: 0.68rem;
  backdrop-filter: blur(6px);
  pointer-events: auto;
}
.ranch-debug-title {
  font-weight: 800;
  color: #b8e0a8;
  margin-right: 6px;
}
.ranch-debug-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}
.ranch-debug-row + .ranch-debug-row {
  margin-top: 6px;
}
.ranch-debug-lab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.ranch-debug-lab select,
.ranch-debug-lab input[type="range"] {
  max-width: 120px;
}
.ranch-debug-btn {
  border: 1px solid rgba(180, 220, 160, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: #e8f5e4;
  border-radius: 8px;
  padding: 3px 8px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.ranch-debug-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ranch-debug-btn:not(:disabled):active {
  transform: scale(0.96);
}
.ranch-tools.manor .ranch-tool {
  width: 58px;
  min-height: 58px;
  height: auto;
  padding: 6px 4px 5px;
  border-radius: 14px;
  border: none;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 3px 10px rgba(47, 107, 58, 0.1);
  flex: 0 0 auto;
}
.ranch-tool {
  position: relative;
  width: 58px;
  border-radius: 14px;
  border: 1px solid rgba(47, 107, 58, 0.14);
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  font: inherit;
  padding: 6px 4px 5px;
  transition: opacity 0.15s ease, transform 0.12s ease, filter 0.15s ease;
}
.ranch-tool.lit {
  filter: none;
  opacity: 1;
}
.ranch-tool.dim,
.ranch-tool:disabled {
  /* 还能认出图标，只是略淡 */
  filter: grayscale(0.25);
  opacity: 0.72;
  cursor: not-allowed;
  box-shadow: none;
}
.ranch-tool.lit:active:not(:disabled) {
  transform: scale(0.94);
}
.ranch-tool-ico {
  font-size: 1.35rem;
  line-height: 1;
  display: grid;
  place-items: center;
  min-height: 1.4em;
}
.ranch-tool-ico img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}
.ranch-tool-name {
  font-family: var(--font-ui);
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--leaf-deep);
  line-height: 1.1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ranch-tool.dim .ranch-tool-name,
.ranch-tool:disabled .ranch-tool-name {
  color: var(--muted);
}
.ranch-tool-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--leaf);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  z-index: 1;
}

.ranch-log ul {
  padding-left: 1.1em;
  margin: 0 0 14px;
}
.btn-sm {
  padding: 6px 10px;
  font-size: 0.85rem;
}
.tab[hidden] {
  display: none !important;
}
#auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(28, 42, 26, 0.45);
  backdrop-filter: blur(6px);
}
.auth-gate-card {
  width: min(360px, 100%);
  background: rgba(255, 252, 245, 0.97);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px 18px;
  font-family: var(--font-ui);
}
.auth-gate-card h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  color: var(--leaf-deep);
}
.auth-field {
  display: grid;
  gap: 6px;
  margin: 10px 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.auth-field input {
  border: 1px solid rgba(107, 74, 46, 0.2);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}
.auth-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 4px 0 0;
}
