:root {
  --cream: #f6efe2;
  --paper: #fdf8ee;
  --paper-2: #f3e9d8;
  --ink: #4b4034;
  --ink-soft: #8a7863;
  --leaf: #7fa86a;
  --leaf-dark: #55794b;
  --rose: #d9626f;
  --rose-soft: #f4b9c1;
  --gold: #d9a94a;
  --sky: #a9c6d6;
  --soil: #7d5c43;
  --soil-dark: #5e422f;
  --shadow: 0 10px 24px rgba(86, 66, 45, 0.18);
  --radius: 18px;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, "Times New Roman", serif;
  --sans: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
}

body {
  overscroll-behavior: none;
  background-image:
    radial-gradient(circle at 20% 12%, rgba(255, 255, 255, 0.7), transparent 42%),
    radial-gradient(circle at 82% 78%, rgba(214, 235, 205, 0.55), transparent 45%),
    linear-gradient(180deg, #f8f2e6 0%, #eef3e6 60%, #e7efe1 100%);
}

#app,
.app {
  height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
}

.app > * {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

.screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.screen.game {
  position: relative;
}

/* ----------------------------------------------------------- 通用控件 */
.btn {
  font-family: var(--sans);
  font-size: 15px;
  border: none;
  border-radius: 999px;
  padding: 11px 20px;
  cursor: pointer;
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, filter 0.15s ease;
}
.btn:active {
  transform: translateY(1px) scale(0.98);
}
.btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.btn-primary {
  background: linear-gradient(180deg, #8fbd79, #5f8d54);
  color: #fff;
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink-soft);
  box-shadow: none;
  border: 1px solid rgba(139, 119, 96, 0.25);
}
.btn-ad {
  background: linear-gradient(180deg, #f0c46a, #d9a94a);
  color: #5a431d;
}
.btn-small {
  padding: 6px 12px;
  font-size: 13px;
}

.icon-btn {
  border: none;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(90, 70, 50, 0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn.wide {
  width: auto;
  border-radius: 999px;
  padding: 0 14px;
  gap: 4px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 13px;
  color: var(--ink-soft);
  box-shadow: 0 2px 8px rgba(90, 70, 50, 0.1);
}
.level-chip {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--rose);
}
.rank-chip {
  color: var(--leaf-dark);
}
.coin-chip {
  color: var(--gold);
  font-weight: 600;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 26%;
  transform: translateX(-50%);
  background: rgba(70, 56, 42, 0.9);
  color: #fdf6e9;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 40;
  pointer-events: none;
  animation: toastIn 0.25s ease, toastOut 0.4s ease 1.2s forwards;
  max-width: 84%;
  text-align: center;
}
.toast.global {
  position: fixed;
  bottom: 12%;
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}
@keyframes toastOut {
  to {
    opacity: 0;
    transform: translate(-50%, -6px);
  }
}

/* ----------------------------------------------------------- 顶栏 */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 4px;
}
.tb-left,
.tb-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tb-center {
  flex: 1;
  min-width: 0;
}
.vine-bar {
  position: relative;
  height: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(140, 120, 96, 0.16);
  overflow: hidden;
}
.vine-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background:
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.35) 0 6px, transparent 6px 13px),
    linear-gradient(90deg, #a7cd8c, #5f8d54);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.vine-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  letter-spacing: 0.4px;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
  font-weight: 600;
}
.goal-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.goal {
  font-size: 11px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  padding: 2px 8px;
}

/* ----------------------------------------------------------- 花瓶区 */
.stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0 8px;
}
.vase-row {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 1.6vw, 16px);
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 2px;
  scrollbar-width: none;
}
.vase-row::after {
  content: none;
}
.stage-head {
  flex: 0 0 auto;
  text-align: center;
  padding: 14px 12px 0;
  position: relative;
  z-index: 1;
}
.stage-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 3px;
  color: #5c4c3a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}
.stage-head p {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
}
.stage-head .end-cond {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed rgba(139, 119, 96, 0.3);
  font-size: 11px;
  color: var(--ink);
}
.stage {
  position: relative;
}
.stage::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 62%;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 26% 0%, rgba(255, 255, 255, 0.85), transparent 58%),
    radial-gradient(circle at 10% 16%, rgba(127, 168, 106, 0.3), transparent 42%),
    radial-gradient(circle at 92% 8%, rgba(127, 168, 106, 0.26), transparent 42%),
    radial-gradient(circle at 62% 2%, rgba(217, 169, 74, 0.18), transparent 46%);
  filter: blur(1px);
}
.vase-row {
  position: relative;
}
.vase-row::-webkit-scrollbar {
  display: none;
}

.vase {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
  transition: transform 0.18s ease;
}
.vase.target .vase-body {
  box-shadow: 0 0 0 3px rgba(255, 236, 170, 0.95), var(--shadow);
}
.vase-rim {
  width: clamp(78px, 23vw, 122px);
  height: 9px;  border-radius: 999px;
  background: linear-gradient(180deg, #f7f1e4, #d9cbb3);
  box-shadow: 0 2px 4px rgba(90, 70, 50, 0.18);
  z-index: 2;
}
.vase-body {
  position: relative;
  width: clamp(78px, 23vw, 122px);
  height: clamp(160px, 32vh, 260px);
  flex: 0 0 auto;
  padding: 10px 8px 12px;
  border-radius: 6px 6px 26px 26px / 8px 8px 40px 40px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.18) 40%),
    linear-gradient(160deg, #e6d3b6, #cbb38f 60%, #b89a76);
  box-shadow: inset 0 -10px 18px rgba(120, 96, 70, 0.18), var(--shadow);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}
.vase-body::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 12%, rgba(255, 255, 255, 0.5), transparent 55%);
  pointer-events: none;
}
.vase-rainbow .vase-body {
  background:
    conic-gradient(from 210deg, rgba(255, 214, 220, 0.85), rgba(214, 236, 255, 0.85), rgba(226, 255, 226, 0.85), rgba(255, 245, 205, 0.85), rgba(255, 214, 220, 0.85)),
    #fff;
}
.vase-rainbow .vase-rim {
  background: linear-gradient(90deg, #f7c6d2, #c9e0f7, #d6f0cf, #f7ecc2);
}
.vase-small .vase-body {
  background: linear-gradient(160deg, #e8d8bd, #cdb696 60%, #b99b78);
}
/* 花瓶数量多时自动缩小，保证竖屏一屏放下 */
.vase-row[data-count="4"] .vase-body,
.vase-row[data-count="4"] .vase-rim {
  width: clamp(66px, 19vw, 104px);
}
.vase-row[data-count="5"] .vase-body,
.vase-row[data-count="5"] .vase-rim {
  width: clamp(52px, 15vw, 88px);
}
.vase-row[data-count="5"] .vase-name {
  font-size: 10px;
}
.vase-row[data-count="5"] .vase-body {
  padding: 8px 5px 10px;
}
.vase-row[data-count="4"] .vase-body {
  padding: 9px 6px 11px;
}

.vase-name {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 3px;
  font-family: var(--serif);
}
.vase-flag {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 10px;
  background: rgba(217, 98, 111, 0.9);
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  display: none;
}
.vase.full .vase-flag {
  display: block;
}
.vase-up {
  position: absolute;
  top: 42%;
  right: -10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: var(--leaf-dark);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(90, 70, 50, 0.2);
  z-index: 3;
}
.vase-up:hover {
  background: #fff;
}

.vase-grid {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  width: 100%;
  z-index: 1;
}
.vase-col {
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
  width: calc((100% - (var(--cols) - 1) * 4px) / var(--cols));
}
.cell {
  width: 100%;
  max-width: 46px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
  background: rgba(255, 255, 255, 0.28);
  border: 1px dashed rgba(120, 96, 70, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.cell.filled {
  background: rgba(255, 255, 255, 0.55);
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.7);
  animation: pop 0.28s cubic-bezier(0.22, 1.4, 0.36, 1);
}
.cell.filled.rare::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  box-shadow: inset 0 0 8px rgba(255, 238, 180, 0.9);
  pointer-events: none;
}
.cell .flower {
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.cell .flower svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(90, 60, 40, 0.25));
}
.cell.dragging {
  opacity: 0;
}
.cell.selected {
  box-shadow: 0 0 0 3px rgba(120, 190, 130, 0.9);
}
@keyframes pop {
  from {
    transform: scale(0.6) translateY(6px);
    opacity: 0;
  }
}

.vase.ring .vase-body {
  animation: ring 0.7s ease;
}
@keyframes ring {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 233, 160, 0.9), var(--shadow);
  }
  100% {
    box-shadow: 0 0 0 22px rgba(255, 233, 160, 0), var(--shadow);
  }
}
.vase.shake .vase-body {
  animation: shake 0.45s ease;
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-5px);
  }
  40% {
    transform: translateX(5px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(3px);
  }
}

.bloom-fx {
  position: absolute;
  width: 46px;
  height: 46px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 4;
  animation: bloomOut 0.65s cubic-bezier(0.3, 0.7, 0.4, 1) forwards;
}
.bloom-fx svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 8px rgba(255, 236, 170, 0.95)) brightness(1.25);
}
@keyframes bloomOut {
  0% {
    transform: translate(-50%, -50%) scale(0.7);
    opacity: 1;
  }
  45% {
    transform: translate(-50%, -50%) scale(1.45);
    opacity: 0.95;
  }
  100% {
    transform: translate(-50%, -50%) scale(2) rotate(10deg);
    opacity: 0;
  }
}

.float-text {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translateX(-50%);
  font-family: var(--serif);
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
  pointer-events: none;
  animation: floatUp 1.1s ease forwards;
  z-index: 5;
}
.float-text.big {
  font-size: 22px;
  color: var(--rose);
}
@keyframes floatUp {
  from {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.8);
  }
  30% {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translate(-50%, -46px) scale(1.1);
  }
}

/* ----------------------------------------------------------- 土壤 */
.soil {
  position: relative;
  flex: 0 0 20%;
  min-height: 104px;
  margin: 10px 0 20px;
  border-radius: 22px 22px 16px 16px;
  background:
    radial-gradient(ellipse at 22% 18%, rgba(150, 110, 78, 0.55), transparent 45%),
    radial-gradient(ellipse at 78% 30%, rgba(120, 86, 58, 0.5), transparent 40%),
    linear-gradient(180deg, #8b6849, var(--soil-dark));
  box-shadow: inset 0 6px 14px rgba(60, 40, 26, 0.45), 0 6px 14px rgba(90, 70, 50, 0.2);
  overflow: hidden;
}
.soil::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 9px 9px;
  opacity: 0.7;
}
.soil.warn {
  box-shadow: inset 0 6px 14px rgba(60, 40, 26, 0.45), 0 0 0 3px rgba(217, 98, 111, 0.55);
}
.soil.over {
  background: linear-gradient(180deg, #6d4630, #4a2f20);
}
.soil-count {
  position: absolute;
  right: 10px;
  bottom: 8px;
  z-index: 3;
  background: rgba(255, 250, 240, 0.85);
  color: var(--soil-dark);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}
.soil.warn .soil-count {
  color: var(--rose);
}
.soil-flower {
  position: absolute;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
  width: clamp(28px, 8.4vw, 46px);
  height: clamp(28px, 8.4vw, 46px);
  margin: -14px 0 0 -14px;
  cursor: grab;
  filter: drop-shadow(0 3px 3px rgba(50, 32, 20, 0.4));
  animation: sprout 0.45s cubic-bezier(0.22, 1.3, 0.36, 1);
  transition: transform 0.18s ease;
}
.soil-flower svg {
  width: 100%;
  height: 100%;
}
.soil-flower:hover {
  transform: scale(1.06);
}
.soil-flower.dragging {
  opacity: 0;
}
@keyframes sprout {
  from {
    transform: translateY(14px) scale(0.4);
    opacity: 0;
  }
}

.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 76px;
  height: 76px;
  pointer-events: none;
  z-index: 200;
  filter: drop-shadow(0 6px 8px rgba(60, 40, 25, 0.4));
  animation: sway 1.6s ease-in-out infinite;
}
.drag-ghost svg {
  width: 100%;
  height: 100%;
}
@keyframes sway {
  0%,
  100% {
    margin-top: 0;
  }
  50% {
    margin-top: -4px;
  }
}

/* ----------------------------------------------------------- 道具栏 */
.toolbar {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: clamp(8px, 3vw, 22px);
  padding: 4px 10px 2px;
}
.tool-btn {
  position: relative;
  width: clamp(52px, 15vw, 64px);
  height: clamp(52px, 15vw, 64px);
  border-radius: 18px;
  border: 1px solid rgba(140, 120, 96, 0.18);
  background: linear-gradient(180deg, #fffdf7, #efe4d0);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tool-btn .item-svg {
  width: 60%;
  height: 60%;
}
.tool-count {
  position: absolute;
  left: 4px;
  bottom: 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
}
.tool-name {
  position: absolute;
  top: -15px;
  font-size: 10px;
  color: var(--ink-soft);
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}
.tool-btn.armed {
  box-shadow: 0 0 0 3px rgba(217, 169, 74, 0.85), var(--shadow);
  transform: translateY(-3px);
}
.tool-btn.cooldown::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: rgba(90, 80, 60, 0.35);
  animation: fadeAway 0.6s ease forwards;
}
@keyframes fadeAway {
  to {
    opacity: 0;
  }
}

/* ----------------------------------------------------------- 底栏 */
.bottombar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px 12px;
}
.combo-meter {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--ink-soft);
  min-width: 54px;
}
.combo-meter .combo-count {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--rose);
}
.combo-meter small {
  font-size: 10px;
}
.combo-meter.active .combo-count {
  animation: pulse 0.9s ease infinite;
  text-shadow: 0 0 10px rgba(217, 98, 111, 0.5);
}
@keyframes pulse {
  50% {
    transform: scale(1.18);
  }
}

.fx-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}
.game-holder {
  position: relative;
  height: 100%;
  display: flex;
}
.game-holder > .screen {
  width: 100%;
}

/* ----------------------------------------------------------- 菜单 */
.menu {
  position: relative;
  overflow-y: auto;
  padding: 18px 16px 26px;
  align-items: center;
}
.menu-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 78%, rgba(255, 214, 150, 0.35), transparent 45%),
    radial-gradient(circle at 84% 22%, rgba(255, 190, 200, 0.35), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.menu-decor {
  position: absolute;
  inset: auto 0 0 0;
  height: 120px;
  pointer-events: none;
}
.decor-item {
  position: absolute;
  font-size: 40px;
  bottom: 8px;
  filter: drop-shadow(0 4px 6px rgba(90, 70, 50, 0.25));
}
.decor-item:nth-child(1) {
  left: 8%;
}
.decor-item:nth-child(2) {
  left: 32%;
  bottom: 20px;
}
.decor-item:nth-child(3) {
  right: 28%;
  bottom: 16px;
}
.decor-item:nth-child(4) {
  right: 8%;
  bottom: 4px;
}
.menu-head {
  text-align: center;
  margin-top: 12px;
}
.title {
  font-family: var(--serif);
  font-size: clamp(30px, 9vw, 44px);
  margin: 0;
  letter-spacing: 4px;
  color: #4a3b2c;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.7);
}
.subtitle {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  letter-spacing: 1px;
}
.menu-stats {
  display: flex;
  gap: 8px;
  margin: 16px 0 14px;
  flex-wrap: wrap;
  justify-content: center;
}
.menu-nav {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 460px;
}
.menu-card {
  border: none;
  border-radius: 20px;
  padding: 16px 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(250, 242, 228, 0.92));
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-family: var(--sans);
  transition: transform 0.15s ease;
}
.menu-card:active {
  transform: translateY(2px);
}
.menu-card.primary {
  grid-column: span 2;
  background: linear-gradient(180deg, #f7d9a0, #eab97a);
}
.card-emoji {
  font-size: 30px;
}
.card-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
}
.card-sub {
  font-size: 12px;
  color: var(--ink-soft);
}
.menu-note {
  margin-top: 18px;
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
}

/* ----------------------------------------------------------- 子页面 */
.sub-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 8px;
}
.sub-head h2 {
  flex: 1;
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 2px;
}
.scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 14px 24px;
  min-height: 0;
}
.chapter {
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 14px;
  background: var(--bg);
  box-shadow: var(--shadow);
}
.chapter h2 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 16px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.chapter h2 small {
  color: var(--ink-soft);
  font-weight: 400;
  font-size: 12px;
}
.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}
.level-card {
  position: relative;
  border: none;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 4px 10px rgba(90, 70, 50, 0.14);
  padding: 8px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-family: var(--sans);
}
.level-card.locked {
  opacity: 0.55;
  cursor: default;
}
.level-no {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--rose);
  font-weight: 700;
}
.level-name {
  font-size: 11px;
  color: var(--ink-soft);
}
.level-stars {
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 1px;
}
.lock {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 11px;
}

.codex-family {
  margin-bottom: 18px;
}
.codex-family h3 {
  font-family: var(--serif);
  font-size: 16px;
  margin: 0 0 8px;
  color: var(--ink);
  border-left: 4px solid var(--leaf);
  padding-left: 8px;
}
.codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}
.codex-card {
  background: rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  padding: 8px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(90, 70, 50, 0.12);
}
.codex-card.unknown .codex-art {
  filter: grayscale(1);
  opacity: 0.55;
}
.codex-art {
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.codex-art svg {
  width: 58px;
  height: 58px;
}
.unknown-mark {
  font-size: 30px;
  color: var(--ink-soft);
  opacity: 0.5;
}
.unknown-mark.big {
  font-size: 54px;
}
.codex-card h4 {
  margin: 2px 0 0;
  font-family: var(--serif);
  font-size: 14px;
}
.codex-count {
  margin: 2px 0 4px;
  font-size: 11px;
  color: var(--ink-soft);
}
.rarity {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(127, 168, 106, 0.18);
  color: var(--leaf-dark);
}
.rarity.r-稀有 {
  background: rgba(120, 160, 220, 0.2);
  color: #4a6fa5;
}
.rarity.r-史诗 {
  background: rgba(190, 130, 220, 0.2);
  color: #7c4a9c;
}
.rarity.r-限定 {
  background: rgba(217, 169, 74, 0.22);
  color: #9a7420;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab {
  border: none;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}
.tab.active {
  background: linear-gradient(180deg, #8fbd79, #5f8d54);
  color: #fff;
}
.tab-body.hidden {
  display: none;
}
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.shop-card {
  background: rgba(255, 255, 255, 0.88);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 4px 12px rgba(90, 70, 50, 0.12);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.shop-card.owned {
  opacity: 0.78;
}
.shop-art {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shop-art.big {
  font-size: 34px;
}
.shop-art svg {
  width: 52px;
  height: 52px;
}
.shop-card h4 {
  margin: 0;
  font-family: var(--serif);
  font-size: 14px;
}
.shop-card p {
  margin: 0;
  font-size: 11px;
  color: var(--ink-soft);
  min-height: 26px;
}
.shop-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.own {
  font-size: 11px;
  color: var(--leaf-dark);
}
.vase-skin-classic,
.vase-skin-blue,
.vase-skin-wood,
.vase-skin-glass {
  width: 46px;
  height: 52px;
  border-radius: 6px 6px 18px 18px;
  background: linear-gradient(160deg, #e6d3b6, #c3a982);
}
.vase-skin-blue {
  background: linear-gradient(160deg, #dce9f5, #b9cfe4);
}
.vase-skin-wood {
  background: linear-gradient(160deg, #d9b58a, #b0855a);
}
.vase-skin-glass {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.8), rgba(180, 205, 215, 0.6));
}

.settings-list {
  background: rgba(255, 255, 255, 0.8);
  border-radius: var(--radius);
  padding: 6px 14px;
  box-shadow: var(--shadow);
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px dashed rgba(139, 119, 96, 0.22);
  font-size: 14px;
  cursor: pointer;
}
.setting-row:last-child {
  border-bottom: none;
}
.setting-row input {
  width: 44px;
  height: 24px;
  accent-color: var(--leaf);
}
.about {
  margin-top: 14px;
  background: rgba(255, 255, 255, 0.75);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.7;
}
.about h3 {
  margin: 0 0 6px;
  font-family: var(--serif);
  color: var(--ink);
  font-size: 15px;
}
.about p {
  margin: 0 0 6px;
}

/* ----------------------------------------------------------- 弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(58, 46, 34, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 18px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
}
.modal {
  width: min(94vw, 420px);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--paper);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(40, 30, 20, 0.35);
  animation: popIn 0.25s cubic-bezier(0.22, 1.3, 0.36, 1);
}
@keyframes popIn {
  from {
    transform: scale(0.92);
    opacity: 0;
  }
}
.modal h2,
.modal h3 {
  font-family: var(--serif);
  margin: 0 0 8px;
}
.modal .btn {
  width: 100%;
  margin-top: 8px;
}
.result {
  text-align: center;
}
.result h2 {
  font-size: 22px;
  color: var(--leaf-dark);
}
.result.lose h2 {
  color: var(--rose);
}
.result-reason {
  color: var(--ink-soft);
  font-size: 13px;
  margin: 0 0 10px;
}
.result-stars {
  font-size: 30px;
  color: var(--gold);
  letter-spacing: 4px;
  margin-bottom: 10px;
}
.result-stats {
  list-style: none;
  margin: 0 0 14px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 14px;
  display: flex;
  justify-content: space-around;
}
.result-stats li {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--ink-soft);
}
.result-stats b {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink);
}
.result-note {
  font-size: 11px;
  color: var(--ink-soft);
  margin: 10px 0 0;
}
.pause {
  text-align: center;
}
.detail {
  text-align: center;
}
.detail-art {
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.detail-art svg {
  width: 104px;
  height: 104px;
}
.detail .latin {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 12px;
  margin: 0 0 4px;
}
.detail .phrase {
  font-family: var(--serif);
  color: var(--rose);
  margin: 0 0 10px;
}
.detail dl {
  display: flex;
  justify-content: space-around;
  margin: 0 0 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 12px;
}
.detail dt {
  font-size: 11px;
  color: var(--ink-soft);
}
.detail dd {
  margin: 2px 0 0;
  font-family: var(--serif);
  font-weight: 700;
}
.detail .grow {
  font-size: 12px;
  color: var(--ink-soft);
}

/* 广告面板 */
.ad-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 24, 18, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
}
.ad-card {
  background: var(--paper);
  border-radius: 20px;
  padding: 22px;
  width: min(90vw, 360px);
  text-align: center;
}
.ad-badge {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  border-radius: 6px;
  padding: 2px 10px;
  font-size: 11px;
  letter-spacing: 2px;
}
.ad-title {
  font-family: var(--serif);
  font-size: 18px;
  margin: 12px 0 4px;
}
.ad-note {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 12px;
}
.ad-timer {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.ad-card .btn {
  width: 100%;
  margin-top: 8px;
}

/* ----------------------------------------------------------- 无障碍 */
.cb-mode .fl-svg {
  position: relative;
}
.cb-mode .flower svg,
.cb-mode .soil-flower svg {
  outline: none;
}
.cb-marker {
  position: absolute;
  right: -2px;
  bottom: -2px;
  font-size: 9px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 4px;
  padding: 0 2px;
  color: var(--ink);
  line-height: 1.2;
}

@media (max-height: 620px) {
  .cell {
    max-width: 38px;
  }
  .soil {
    min-height: 78px;
    flex-basis: 17%;
  }
  .vase-body {
    min-height: clamp(80px, 24vh, 130px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
