﻿/* ============================================================
   我们的小日子 —— 软糖风样式
   ============================================================ */

:root {
  --cream: #fff9f4;
  --cream-2: #fff3ec;
  --ink: #4b3b42;
  --ink-2: #6d5a62;
  --muted: #a3909a;
  --line: #f3e6e2;

  --rose: #ff8fa3;
  --rose-soft: #ffe1e6;
  --rose-deep: #f4708a;
  --peach: #ffb27d;
  --peach-soft: #ffeadb;
  --mint: #6fd3bf;
  --mint-soft: #d9f6ef;
  --lilac: #a48ff0;
  --lilac-soft: #e7e1ff;
  --butter: #ffd166;
  --butter-soft: #fff2cf;

  --shadow-s: 0 3px 10px rgba(214, 150, 160, 0.14);
  --shadow-m: 0 10px 26px rgba(214, 150, 160, 0.18);
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--ink);
  background: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 背景的软糖色块 */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  filter: blur(52px);
  opacity: 0.55;
  pointer-events: none;
}

body::before {
  width: 340px;
  height: 340px;
  top: -120px;
  right: -110px;
  background: radial-gradient(circle, #ffd3dc 0%, rgba(255, 211, 220, 0) 70%);
  animation: floaty 14s ease-in-out infinite;
}

body::after {
  width: 300px;
  height: 300px;
  bottom: -130px;
  left: -110px;
  background: radial-gradient(circle, #d9f6ef 0%, rgba(217, 246, 239, 0) 70%);
  animation: floaty 18s ease-in-out infinite reverse;
}

@keyframes floaty {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-16px, 18px, 0) scale(1.08);
  }
}

.app {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(190px + env(safe-area-inset-bottom));
}

/* ---------------- 通用 ---------------- */
button {
  font-family: inherit;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

input,
textarea {
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  transition: transform 0.18s var(--bounce), box-shadow 0.18s ease;
}

.btn:active {
  transform: scale(0.93);
}

.btn-primary {
  background: linear-gradient(135deg, #ff9db0 0%, #ff7f97 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(255, 127, 151, 0.36);
}

.btn-ghost {
  background: #fff;
  color: var(--ink-2);
  box-shadow: var(--shadow-s);
}

.btn-danger {
  background: #fff0f2;
  color: #e05a72;
}

.round-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  box-shadow: var(--shadow-s);
  font-size: 17px;
  transition: transform 0.2s var(--bounce);
}

.round-btn:active {
  transform: scale(0.88) rotate(-6deg);
}

/* ---------------- 首页 ---------------- */
.hero {
  padding: 6px 4px 18px;
}

.hero-day {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
}

.hero-title {
  margin: 8px 0 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1.2;
}

.hero-title span {
  background: linear-gradient(120deg, #ff8fa3, #a48ff0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--muted);
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow-s);
  font-size: 11.5px;
  color: var(--ink-2);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d9cfd3;
  transition: background 0.2s;
}
.dot.ok {
  background: #6fd3bf;
}
.dot.busy {
  background: #ffd166;
}
.dot.warn {
  background: #ffb27d;
}
.dot.err {
  background: #ff7f97;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  margin-top: 8px;
}

.tile {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 16px 15px 15px;
  border-radius: 26px;
  text-align: left;
  animation: pop 0.5s var(--bounce) both;
  transition: transform 0.22s var(--bounce), box-shadow 0.22s ease;
  box-shadow: var(--shadow-m);
}

.tile:nth-child(2) {
  animation-delay: 0.06s;
}
.tile:nth-child(3) {
  animation-delay: 0.12s;
}
.tile:nth-child(4) {
  animation-delay: 0.18s;
}

.tile:active {
  transform: scale(0.955) rotate(-1deg);
}

@keyframes pop {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.tile::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -34px;
  width: 94px;
  height: 94px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.42);
}

.tile-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin-bottom: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  font-size: 24px;
  box-shadow: 0 2px 8px rgba(180, 120, 130, 0.12);
}

.tile-name {
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.tile-sub {
  margin-top: 4px;
  font-size: 11.5px;
  opacity: 0.72;
}

.tile-count {
  position: absolute;
  right: 14px;
  bottom: 13px;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
}

.t-rose {
  background: linear-gradient(150deg, #ffd9e0 0%, #ffbccb 100%);
}
.t-mint {
  background: linear-gradient(150deg, #d8f6ef 0%, #aaeadd 100%);
}
.t-lilac {
  background: linear-gradient(150deg, #e9e3ff 0%, #cfc4ff 100%);
}
.t-butter {
  background: linear-gradient(150deg, #fff0cf 0%, #ffdd9e 100%);
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0 16px;
}

.topbar h1 {
  flex: 1;
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.topbar .spacer {
  flex: 1;
}

/* ---------------- 列表卡片 ---------------- */
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rcard {
  display: flex;
  gap: 13px;
  padding: 13px;
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow-m);
  animation: pop 0.4s var(--bounce) both;
  transition: transform 0.2s var(--bounce);
}

.rcard:active {
  transform: scale(0.98);
}

.thumb {
  flex: 0 0 auto;
  width: 74px;
  height: 74px;
  border-radius: 18px;
  object-fit: cover;
  background: var(--cream-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rcard-main {
  flex: 1;
  min-width: 0;
  padding: 2px 0;
}

.rcard-title {
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rcard-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip-mini {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--cream-2);
  font-size: 11px;
  color: var(--ink-2);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-mini.rose {
  background: var(--rose-soft);
  color: #c8556a;
}
.chip-mini.mint {
  background: var(--mint-soft);
  color: #2f8d7c;
}
.chip-mini.lilac {
  background: var(--lilac-soft);
  color: #6a55c4;
}

/* 空状态 */
.empty {
  padding: 56px 24px;
  text-align: center;
  color: var(--muted);
}

.empty-emoji {
  font-size: 44px;
  animation: floaty2 3.4s ease-in-out infinite;
}

@keyframes floaty2 {
  0%,
  100% {
    transform: translateY(0) rotate(-3deg);
  }
  50% {
    transform: translateY(-7px) rotate(3deg);
  }
}

.empty p {
  margin: 14px 0 0;
  font-size: 13.5px;
  line-height: 1.7;
}

/* ---------------- 物资 ---------------- */
.chips {
  display: flex;
  gap: 8px;
  margin: 0 -16px 14px;
  padding: 2px 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  padding: 7px 15px;
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow-s);
  font-size: 12.5px;
  color: var(--ink-2);
  transition: transform 0.2s var(--bounce);
}

.chip.on {
  background: linear-gradient(135deg, #ff9db0, #ff7f97);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 5px 14px rgba(255, 127, 151, 0.34);
}

.group-name {
  margin: 18px 6px 9px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink-2);
  letter-spacing: 1px;
}

.group-name em {
  margin-left: 7px;
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
  font-size: 10.5px;
}

.card {
  overflow: hidden;
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow-m);
}

.row {
  display: flex;
  align-items: center;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}

.row:last-child {
  border-bottom: 0;
}

.row-name {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  line-height: 1.4;
}

.row-note {
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--muted);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 2px;
}

.step {
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background: var(--rose-soft);
  color: #d1516a;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  transition: transform 0.16s var(--bounce), background 0.16s;
}

.step:active {
  transform: scale(0.82);
  background: #ffced6;
}

.qty {
  min-width: 58px;
  text-align: center;
  font-size: 15.5px;
  font-weight: 800;
  border-radius: 12px;
  padding: 4px 2px;
}

.qty i {
  margin-left: 2px;
  font-style: normal;
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
}

.edit-on .qty {
  background: var(--butter-soft);
}

/* ---------------- 表单 ---------------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-label {
  display: block;
  margin: 0 0 6px 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
}

.field-input,
.field-area {
  width: 100%;
  padding: 13px 15px;
  border-radius: 18px;
  border: 1.5px solid transparent;
  background: #fff;
  box-shadow: var(--shadow-s);
  font-size: 16px; /* 小于 16px 时 iOS 会自动放大页面 */
  line-height: 1.5;
  transition: border-color 0.2s, transform 0.2s var(--bounce);
}

.field-area {
  resize: vertical;
  min-height: 92px;
}

.field-input:focus,
.field-area:focus {
  outline: none;
  border-color: #ffc2cd;
  transform: scale(1.01);
}

.img-picker {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px;
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow-s);
}

.img-box {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  background: var(--cream-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  overflow: hidden;
  flex: 0 0 auto;
}

.img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.img-hint {
  flex: 1;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

/* ---------------- 弹层 ---------------- */
.mask {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 60;
  background: rgba(75, 59, 66, 0.34);
  display: flex;
  align-items: flex-end;
  backdrop-filter: blur(2px);
  animation: fade 0.2s ease both;
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.sheet {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 18px calc(22px + env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0;
  background: var(--cream);
  animation: rise 0.32s var(--bounce) both;
  max-height: 92vh;
  overflow-y: auto;
}

@keyframes rise {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.sheet-head {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.sheet-head h2 {
  flex: 1;
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.sheet-actions .btn {
  flex: 1;
  padding: 14px 0;
  font-size: 15px;
}

.detail-block {
  margin-bottom: 14px;
  padding: 15px 16px;
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-s);
}

.detail-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 1px;
}

.detail-text {
  margin-top: 7px;
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-link {
  color: #5b8def;
  word-break: break-all;
}

.detail-img {
  width: 100%;
  border-radius: 22px;
  display: block;
  margin-bottom: 14px;
  box-shadow: var(--shadow-m);
}

/* ---------------- 浮动按钮 ---------------- */
.fab {
  position: fixed;
  right: calc(50% - 260px + 18px);
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 30;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #fff;
  background: linear-gradient(135deg, #ff9db0, #ff7f97);
  box-shadow: 0 10px 24px rgba(255, 127, 151, 0.44);
  transition: transform 0.22s var(--bounce);
}

.fab:active {
  transform: scale(0.88) rotate(90deg);
}

@media (max-width: 556px) {
  .fab {
    right: 18px;
  }
}

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 90;
  max-width: 84vw;
  padding: 11px 18px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(75, 59, 66, 0.92);
  color: #fff;
  font-size: 12.5px;
  line-height: 1.5;
  text-align: center;
  animation: pop 0.28s var(--bounce) both;
}

/* ---------------- 杂项 ---------------- */
.footnote {
  padding: 22px 12px 4px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
  text-align: center;
}

.offline-bar {
  margin-top: 12px;
  padding: 11px 15px;
  border-radius: 18px;
  background: #fff4e3;
  color: #a4702a;
  font-size: 12px;
  line-height: 1.6;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
}

/* ---------------- 首页：最近记的 ---------------- */
.sec-title {
  margin: 24px 6px 11px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-2);
  letter-spacing: 0.5px;
}

.sec-title span {
  color: var(--rose);
}

.recent-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 10px;
  padding: 13px 15px;
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-s);
  text-align: left;
  transition: transform 0.2s var(--bounce);
}

.recent-row:active {
  transform: scale(0.975);
}

.recent-emoji {
  font-size: 19px;
  line-height: 1;
}

.recent-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-kind {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--cream-2);
  font-size: 10.5px;
  color: var(--muted);
}

.tip-card {
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow-s);
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
  text-align: center;
}

/* 选图用的 input：不能 display:none，否则部分移动端点不动 */
.file-input {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---------- 安卓 / 鸿蒙加固 ---------- */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* 关掉双击放大和 300ms 延迟，点按更跟手 */
.btn,
.chip,
.step,
.tile,
.recent-row,
.round-btn,
.fab,
.qty,
label.btn,
.sync-pill {
  touch-action: manipulation;
}

/* 安卓 WebView 里输入框要能选中、长按不触发系统菜单异常 */
input,
textarea {
  -webkit-user-select: text;
  user-select: text;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 18px;
}

/* ---------------- 看板娘 ---------------- */
.pet {
  position: fixed;
  right: -10px;
  bottom: calc(40px + env(safe-area-inset-bottom));
  z-index: 45;
  width: clamp(188px, 52vw, 300px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s var(--bounce);
}

/* 柔光遮罩：她身后的内容渐隐到背景色，不会糊成一团 */
.pet::before {
  content: "";
  position: absolute;
  right: -22%;
  bottom: -14%;
  width: 162%;
  height: 146%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    circle at 62% 66%,
    #fff9f4 0%,
    #fff9f4 34%,
    rgba(255, 249, 244, 0.97) 46%,
    rgba(255, 249, 244, 0.72) 60%,
    rgba(255, 249, 244, 0.28) 72%,
    rgba(255, 249, 244, 0) 84%
  );
}

.pet[hidden] {
  display: none !important;
}

.pet-stage {
  position: relative;
  animation: petFloat 4.8s ease-in-out infinite;
  transform-origin: 50% 90%;
}

@keyframes petFloat {
  0%, 100% { transform: translateY(0) rotate(-0.6deg); }
  50% { transform: translateY(-7px) rotate(0.6deg); }
}

.pet-img {
  width: 100%;
  height: auto;
  display: block;
  transform: scaleX(-1); /* 镜像：脸朝左 */
  filter: drop-shadow(0 10px 18px rgba(120, 90, 140, 0.22));
  user-select: none;
  -webkit-user-drag: none;
}

/* 平板上的字 */
.pet-screen {
  position: absolute;
  left: 7.8%;
  top: 65.4%;
  width: 39%;
  height: 19.5%;
  transform: rotate(3.6deg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4%;
  pointer-events: none;
}

.pet-screen span {
  color: #b7e5ff;
  font-size: 8px; /* 实际尺寸由 JS 按看板娘宽度算，见 sizePetText */
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  text-align: center;
  text-shadow: 0 0 6px rgba(110, 195, 255, 0.95), 0 0 16px rgba(80, 160, 255, 0.6);
  transition: opacity 0.18s ease;
}

.pet-screen span.swap {
  opacity: 0;
}

/* 摸摸的手 */
.pet-hand {
  position: absolute;
  left: 11%;
  top: -13%;
  width: 38%;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(80, 60, 70, 0.18));
  transform-origin: 80% 90%;
}

.pet-hand[hidden] {
  display: none !important;
}

.pet.is-pat .pet-stage {
  animation: petPat 0.5s var(--bounce);
}

@keyframes petPat {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(4px) scale(0.96, 1.03); }
  70% { transform: translateY(-3px) scale(1.03, 0.97); }
  100% { transform: translateY(0) scale(1); }
}

/* 点击热区：只覆盖角色本体，避免挡住列表滚动 */
.pet-hit {
  position: absolute;
  right: 2%;
  top: 6%;
  width: 58%;
  height: 88%;
  border-radius: 40% 40% 30% 30%;
  pointer-events: auto;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pet-hit:active {
  transform: scale(0.98);
}

/* 飘心 */
.pet-hearts {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.pet-heart {
  position: absolute;
  font-size: 14px;
  opacity: 0;
  animation: heartUp 1.1s ease-out forwards;
}

@keyframes heartUp {
  0% { opacity: 0; transform: translateY(0) scale(0.6); }
  25% { opacity: 1; transform: translateY(-10px) scale(1); }
  100% { opacity: 0; transform: translateY(-62px) scale(0.9); }
}

/* 小屏不再单独缩小：基础 clamp 已经按视口算好了 */

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding: 13px 16px;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-s);
  font-size: 13px;
  color: var(--ink-2);
}

.switch-row .chip {
  padding: 6px 16px;
  box-shadow: none;
}

/* ---------------- 米饭按钮 + 火控雷达 ---------------- */
.pet-rice {
  position: absolute;
  left: -6px;
  top: 6%;
  z-index: 3;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 5px 14px rgba(170, 130, 140, 0.3);
  font-size: 18px;
  line-height: 1;
  pointer-events: auto;
  transition: transform 0.2s var(--bounce), box-shadow 0.2s;
}

.pet-rice:active {
  transform: scale(0.84) rotate(-10deg);
  box-shadow: 0 2px 6px rgba(170, 130, 140, 0.3);
}

.pet-fx {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}

.rice-bowl {
  position: absolute;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 4px 7px rgba(120, 90, 60, 0.22));
  will-change: top;
}

.radar {
  position: absolute;
  transform: translate(-50%, -50%);
  color: #00ff08;
  font-family: "SF Mono", Menlo, Consolas, "Courier New", monospace;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s linear;
}

.radar.on {
  opacity: 1;
}

.radar i {
  position: absolute;
  display: block;
  background: #00ff08;
}

.radar .h {
  width: 30%;
  height: 2px;
}
.radar .v {
  width: 2px;
  height: 30%;
}

.radar .h.a { left: 0; top: 0; }
.radar .h.b { right: 0; top: 0; }
.radar .h.c { left: 0; bottom: 0; }
.radar .h.d { right: 0; bottom: 0; }
.radar .v.a { left: 0; top: 0; }
.radar .v.b { right: 0; top: 0; }
.radar .v.c { left: 0; bottom: 0; }
.radar .v.d { right: 0; bottom: 0; }

.radar .r-type {
  position: absolute;
  left: 50%;
  top: -20%;
  transform: translate(-50%, -100%);
  font-size: 1.35em;
  white-space: nowrap;
  letter-spacing: 1px;
}

.radar .r-num {
  position: absolute;
  font-size: 0.95em;
  white-space: nowrap;
  text-align: right;
}

.radar .r-dist {
  right: 100%;
  top: -6%;
  margin-right: 8%;
}

.radar .r-clo {
  right: 100%;
  bottom: -6%;
  margin-right: 8%;
}

.radar .r-alt {
  right: 2%;
  top: 104%;
}
.pet-rice img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  pointer-events: none;
}

/* ---------------- 铁盆 ---------------- */
.pet-pot {
  position: absolute;
  z-index: 4;
  height: auto;
  transform: translate(-50%, -86%) rotate(-4deg);
  transform-origin: 50% 80%;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  filter: drop-shadow(0 5px 9px rgba(70, 60, 60, 0.28));
  transition: width 0.25s var(--bounce), transform 0.25s var(--bounce);
  -webkit-user-select: none;
  user-select: none;
}

.pet-pot[hidden] {
  display: none !important;
}

.pet-pot.dragging {
  cursor: grabbing;
  transition: none;
  filter: drop-shadow(0 12px 16px rgba(70, 60, 60, 0.3));
}

.pet-pot.worn {
  z-index: 5;
}

/* ---------------- 米饭雨层（全屏） ---------------- */
.rice-layer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 46;
  pointer-events: none;
  overflow: hidden;
}

.rice-bowl {
  position: absolute;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 4px 8px rgba(120, 90, 60, 0.24));
  will-change: top;
}


/* 吃完冒的泡泡 */
.pet-bubble {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.95), rgba(175, 222, 255, 0.5));
  border: 1px solid rgba(255, 255, 255, 0.85);
  opacity: 0;
  animation: bubbleUp 1.4s ease-out forwards;
}

@keyframes bubbleUp {
  0% { opacity: 0; transform: translateY(0) scale(0.5); }
  20% { opacity: 1; transform: translateY(-8px) scale(1); }
  100% { opacity: 0; transform: translateY(-84px) scale(1.25); }
}

/* ---------------- 自言自语气泡 ---------------- */
.pet-thought {
  position: absolute;
  left: -14%;
  bottom: 96%;
  z-index: 8;
  max-width: 196px;
  padding: 10px 14px;
  border-radius: 18px 18px 18px 6px;
  background: #fffdfa;
  box-shadow: 0 8px 22px rgba(150, 120, 130, 0.24);
  font-size: 12.5px;
  line-height: 1.5;
  color: #4b3b42;
  animation: pop 0.32s var(--bounce) both;
}

.pet-thought::after {
  content: "";
  position: absolute;
  left: 10px;
  bottom: -7px;
  width: 12px;
  height: 12px;
  background: #fffdfa;
  border-radius: 0 0 3px 0;
  transform: rotate(45deg);
  box-shadow: 4px 4px 12px rgba(150, 120, 130, 0.16);
}

.pet-thought[hidden] {
  display: none !important;
}
