:root {
  --bg: #fff7ef;
  --card: #ffffff;
  --ink: #3e2f28;
  --muted: #9a8578;
  --line: #f2e5d9;
  --peach: #ffb27a;
  --peach-deep: #ef8a4b;
  --pink: #ffd9dc;
  --green: #8fbf9f;
  --shadow: 0 10px 26px -14px rgba(120, 80, 50, 0.28);
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

body {
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
}

.app {
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------------- 加载态 ---------------- */

.boot {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  color: var(--muted);
}

.boot-cat {
  font-size: 40px;
}

.boot p {
  margin: 0;
  font-size: 14px;
}

.boot-hint {
  font-size: 12px !important;
  color: #b3a398;
  max-width: 260px;
  text-align: center;
  line-height: 1.5;
}

.boot .btn {
  margin-top: 6px;
}

/* ---------------- 主页场景 ---------------- */

.view-home {
  padding-bottom: 0;
}

.home {
  position: relative;
  height: 100vh;
  height: 100dvh;
  height: 100svh;
  overflow: hidden;
  background: linear-gradient(180deg, #fff4e6 0%, #ffe9d6 42%, #f8dcc4 100%);
}

.scene-sky {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: radial-gradient(120% 70% at 70% 0%, #fff9ec 0%, rgba(255, 249, 236, 0) 60%);
}

.scene-sun {
  position: absolute;
  top: 8%;
  right: 12%;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe2b8, #ffc98d);
  opacity: 0.75;
  filter: blur(1px);
}

.scene-hills {
  position: absolute;
  left: -10%;
  right: -10%;
  top: 40%;
  height: 34%;
  background:
    radial-gradient(90% 100% at 20% 100%, #f3d8bf 0%, rgba(243, 216, 191, 0) 70%),
    radial-gradient(80% 100% at 80% 100%, #f0d2b6 0%, rgba(240, 210, 182, 0) 70%);
}

.scene-floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 46%;
  background: linear-gradient(180deg, #f6ddc5 0%, #f0cba8 55%, #e9bd93 100%);
}

.scene-floor::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.16) 0 2px,
    rgba(255, 255, 255, 0) 2px 42px
  );
  opacity: 0.7;
}

.fab-col {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  left: 16px;
  display: grid;
  gap: 12px;
  z-index: 3;
}

.fab {
  width: 58px;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 0;
}

.fab-ico {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 21px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 20px -10px rgba(120, 80, 50, 0.45);
  backdrop-filter: blur(8px);
  transition: transform 0.18s ease;
}

.fab:active .fab-ico {
  transform: scale(0.94);
}

.fab span:last-child {
  font-size: 11px;
  color: #7d6353;
  letter-spacing: 0.04em;
}

.chip-points {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  right: 16px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 20px -12px rgba(120, 80, 50, 0.45);
  backdrop-filter: blur(8px);
  font-size: 13px;
}

.chip-points b {
  font-size: 15px;
}

.cat {
  position: absolute;
  width: 36vw;
  max-width: 156px;
  min-width: 118px;
  transform-origin: bottom center;
  transition:
    left 0.85s cubic-bezier(0.22, 0.8, 0.3, 1),
    top 0.85s cubic-bezier(0.22, 0.8, 0.3, 1);
  z-index: 2;
  pointer-events: none;
}

.cat-svg {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 12px 14px rgba(120, 80, 50, 0.18));
}

.cat.is-walking .cat-svg {
  animation: walk-bob 0.42s ease-in-out 2;
}

@keyframes walk-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

.cat-eyes {
  transform-box: fill-box;
  transform-origin: center;
  animation: blink 4.6s infinite;
}

@keyframes blink {
  0%,
  92%,
  100% {
    transform: scaleY(1);
  }
  95% {
    transform: scaleY(0.12);
  }
}

.scene-hint {
  position: absolute;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  margin: 0;
  font-size: 12px;
  color: #8a6f5d;
  background: rgba(255, 255, 255, 0.7);
  padding: 6px 14px;
  border-radius: 999px;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.scene-hint.is-hidden {
  opacity: 0;
}

/* ---------------- 底部导航 ---------------- */

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: rgba(255, 253, 250, 0.94);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}

.nav-item {
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 7px 0 5px;
  border-radius: 14px;
  color: var(--muted);
  transition: color 0.18s ease, background 0.18s ease;
}

.nav-ico {
  font-size: 18px;
  line-height: 1.2;
  filter: grayscale(0.5);
  transition: filter 0.18s ease, transform 0.18s ease;
}

.nav-label {
  font-size: 11px;
  letter-spacing: 0.03em;
}

.nav-item.is-active {
  color: var(--peach-deep);
}

.nav-item.is-active .nav-ico {
  filter: none;
  transform: translateY(-1px) scale(1.08);
}

/* ---------------- 通用页面 ---------------- */

.view {
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
  min-height: 100vh;
  min-height: 100dvh;
}

.page-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 18px 12px;
  background: linear-gradient(180deg, var(--bg) 70%, rgba(255, 247, 239, 0));
}

.page-head h1 {
  font-size: 19px;
  letter-spacing: -0.01em;
}

.page-back {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 20px;
  line-height: 1;
  display: grid;
  place-items: center;
  padding-bottom: 3px;
}

.page-note {
  margin: 0 18px 14px;
  font-size: 13px;
  color: var(--muted);
}

.panel {
  margin: 0 18px 14px;
  padding: 16px;
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.panel h2 {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  font-weight: 600;
}

/* ---------------- 按钮 ---------------- */

.btn {
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.14s ease, opacity 0.14s ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, #ffb27a, #f08a4b);
  color: #fff;
  box-shadow: 0 8px 16px -10px rgba(240, 138, 75, 0.9);
}

.btn-soft {
  background: #fff2e6;
  color: var(--peach-deep);
}

.btn-ghost {
  background: #f5f0eb;
  color: #b3a398;
}

.btn:disabled {
  opacity: 0.72;
  cursor: default;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* ---------------- 任务 ---------------- */

.task-list {
  list-style: none;
  margin: 0;
  padding: 0 18px;
  display: grid;
  gap: 12px;
}

.task {
  background: var(--card);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  border: 1px solid transparent;
}

.task.ready {
  border-color: #ffd7bb;
}

.task-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.task-check {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  border-radius: 50%;
  border: 1.5px solid #e6d7ca;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #fff;
}

.task-check.on {
  background: var(--green);
  border-color: var(--green);
}

.task-info h3 {
  font-size: 15px;
}

.task-info p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.task-reward {
  margin-left: auto;
  font-size: 13px;
  font-weight: 700;
  color: var(--peach-deep);
}

.task-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: #f4eae1;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffc79b, #f08a4b);
  transition: width 0.4s ease;
}

.task-progress {
  font-size: 11px;
  color: var(--muted);
  min-width: 34px;
  text-align: right;
}

/* ---------------- 装扮 ---------------- */

.breed-grid {
  list-style: none;
  margin: 0;
  padding: 0 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.breed {
  background: var(--card);
  border-radius: 18px;
  padding: 12px 12px 14px;
  box-shadow: var(--shadow);
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
  border: 2px solid transparent;
}

.breed.is-selected {
  border-color: #ffc79b;
  background: #fffaf4;
}

.breed.is-locked .breed-art {
  filter: grayscale(0.85) opacity(0.55);
}

.breed-art {
  width: 92px;
  height: 100px;
  display: grid;
  place-items: end center;
}

.breed-art .cat-svg {
  filter: none;
}

.breed h3 {
  font-size: 14px;
}

.breed p {
  margin: 0 0 6px;
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------------- 商城 ---------------- */

.balance-bar {
  margin: 0 18px 14px;
  padding: 12px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #fff1e2, #ffe3cb);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: #8a6a52;
}

.balance-bar b {
  font-size: 20px;
  color: var(--peach-deep);
}

.goods-list {
  list-style: none;
  margin: 0;
  padding: 0 18px;
  display: grid;
  gap: 12px;
}

.goods {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.goods.is-owned {
  opacity: 0.72;
}

.goods-ico {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 14px;
  background: #fff4e9;
  display: grid;
  place-items: center;
  font-size: 20px;
}

.goods-info {
  flex: 1;
  min-width: 0;
}

.goods-info h3 {
  font-size: 14.5px;
}

.goods-info p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* ---------------- 排行 ---------------- */

.rank-list {
  list-style: none;
  margin: 0;
  padding: 0 18px;
  display: grid;
  gap: 8px;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 16px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
}

.rank-row.is-me {
  background: linear-gradient(135deg, #fff6ec, #ffe9d6);
  border: 1px solid #ffd7bb;
}

.rank-medal {
  width: 30px;
  text-align: center;
  font-size: 17px;
}

.rank-no {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.rank-name {
  flex: 1;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rank-name em {
  font-style: normal;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--peach);
  color: #fff;
}

.rank-score {
  font-weight: 700;
  color: var(--peach-deep);
  font-variant-numeric: tabular-nums;
}

/* ---------------- 个人 ---------------- */

.me-card {
  margin: 0 18px 14px;
  padding: 18px;
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow);
  display: grid;
  justify-items: center;
  gap: 6px;
}

.me-art {
  width: 108px;
  height: 118px;
  display: grid;
  place-items: end center;
}

.me-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.me-name input {
  width: 128px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fffaf5;
  font: inherit;
  font-size: 15px;
  text-align: center;
  color: var(--ink);
  outline: none;
}

.me-name input:focus {
  border-color: var(--peach);
}

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

.stat-grid {
  margin: 0 18px 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat {
  background: var(--card);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 2px;
}

.stat span {
  font-size: 12px;
  color: var(--muted);
}

.stat b {
  font-size: 24px;
  color: var(--peach-deep);
  font-variant-numeric: tabular-nums;
}

.stat em {
  font-style: normal;
  font-size: 10.5px;
  color: #c0aea1;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #fff2e6;
  color: #b5764a;
}

.pill-empty {
  background: #f6f1ec;
  color: #b3a398;
}

.row-btn {
  width: 100%;
  text-align: left;
  padding: 10px 0;
  font-size: 14px;
  display: grid;
  gap: 2px;
  color: #c0554a;
}

.row-btn small {
  font-size: 11px;
  color: var(--muted);
}

.foot-note {
  margin: 4px 18px 24px;
  font-size: 11px;
  color: #c0aea1;
  text-align: center;
}

.foot-note a {
  color: inherit;
  text-decoration: none;
}

/* ---------------- 提示 ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  z-index: 50;
  padding: 10px 18px;
  border-radius: 999px;
  background: #3e2f28;
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: 0.22s ease;
  max-width: 82vw;
  text-align: center;
}

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

.toast[data-kind="ok"] {
  background: #4f8a67;
}

@media (min-width: 560px) {
  .home,
  .view {
    max-width: 480px;
    margin: 0 auto;
  }

  .nav {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 20px 20px 0 0;
  }
}
