/* ==========================================================================
   星星任务站 Star Quest — 设计系统
   奶油底 / 圆角 24 / 3px 深色描边 / 柔和投影 / 大字号 / 移动端竖屏优先
   ========================================================================== */

:root {
  --cream: #fff8ec;
  --paper: #fffdf7;
  --ink: #3e3128;
  --ink-2: #7a6a5c;
  --ink-3: #a89887;
  --line: #3e3128;
  --sun: #ffc93c;
  --coral: #ff7a59;
  --sky: #4cc9f0;
  --grass: #7bd389;
  --grape: #a78bfa;
  --pink: #ff8fab;
  --sun-soft: #fff1c9;
  --coral-soft: #ffe3db;
  --sky-soft: #dff5fd;
  --grass-soft: #e4f8e6;
  --grape-soft: #eee7ff;
  --pink-soft: #ffe6ee;
  --radius: 24px;
  --radius-s: 16px;
  --shadow: 0 5px 0 rgba(62, 49, 40, 0.1), 0 12px 26px rgba(62, 49, 40, 0.08);
  --shadow-sm: 0 3px 0 rgba(62, 49, 40, 0.1);
  --tabbar-h: 76px;
  --font: "PingFang SC", "Yuanti SC", "Hiragino Maru Gothic ProN", "Hiragino Sans GB",
    "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(255, 201, 60, 0.18), transparent 42%),
    radial-gradient(circle at 88% 0%, rgba(76, 201, 240, 0.14), transparent 38%),
    radial-gradient(circle at 50% 110%, rgba(167, 139, 250, 0.12), transparent 46%);
  background-attachment: fixed;
  overflow-x: hidden;
}

body.no-scroll {
  overflow: hidden;
}

h1, h2, h3, p {
  margin: 0;
}

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

input {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   外壳
   -------------------------------------------------------------------------- */

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 2px 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.5px;
}

.brand .brand-emoji {
  font-size: 24px;
  line-height: 1;
}

.brand-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 1px;
}

.conn-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--paper);
  border: 2px solid rgba(62, 49, 40, 0.12);
}

.conn-dot i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--grass);
  box-shadow: 0 0 0 3px rgba(123, 211, 137, 0.22);
}

.conn-dot.offline i {
  background: var(--coral);
  box-shadow: 0 0 0 3px rgba(255, 122, 89, 0.2);
}

.conn-dot.saving i {
  background: var(--sun);
  box-shadow: 0 0 0 3px rgba(255, 201, 60, 0.25);
}

/* 离线条 */
.offline-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 4px;
  padding: 12px 14px;
  border-radius: var(--radius-s);
  background: var(--coral-soft);
  border: 2px solid var(--coral);
  color: #7a2f1d;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  animation: slide-down 0.28s ease-out;
}

.offline-bar .grow {
  flex: 1;
  min-width: 0;
}

.offline-bar button {
  flex: none;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  border: 2px solid #b84a30;
}

/* --------------------------------------------------------------------------
   页面切换
   -------------------------------------------------------------------------- */

.view {
  display: block;
  animation: view-in 0.26s ease-out;
}

.view > * + * {
  margin-top: 18px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 2px 0;
}

.page-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.page-sub {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-3);
}

/* --------------------------------------------------------------------------
   今天：余额 + 进度
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 18px;
  border-radius: var(--radius);
  border: 3px solid var(--line);
  background: linear-gradient(135deg, #fffdf7 0%, #fff0c8 100%);
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  z-index: 0;
  right: -40px;
  top: -50px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(255, 201, 60, 0.28);
  pointer-events: none;
}

.hero-left {
  position: relative;
  z-index: 2;
  min-width: 0;
}

.hero-hi {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink-2);
}

.balance-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 2px 0 -4px;
}

.balance-num {
  font-size: 62px;
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: -2px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.balance-star {
  font-size: 30px;
  line-height: 1;
}

.balance-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 1px;
}

.hero-ring {
  position: relative;
  z-index: 2;
  flex: none;
  width: 104px;
  height: 104px;
}

.hero-ring svg {
  display: block;
  transform: rotate(-90deg);
}

.hero-ring .ring-bg {
  fill: none;
  stroke: rgba(62, 49, 40, 0.1);
  stroke-width: 10;
}

.hero-ring .ring-fg {
  fill: none;
  stroke: var(--sun);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}

.hero-ring .ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 22px;
  line-height: 1.05;
}

.hero-ring .ring-text small {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 0.5px;
}

.today-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 2px solid rgba(62, 49, 40, 0.1);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
}

.today-strip .dot-sep {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ink-3);
}

/* --------------------------------------------------------------------------
   区块与卡片
   -------------------------------------------------------------------------- */

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
  margin-bottom: 10px;
}

.section-head h2 {
  font-size: 19px;
  font-weight: 900;
}

.section-head .hint {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-3);
}

.card {
  border-radius: var(--radius);
  border: 3px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

/* 任务卡 */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 84px;
  padding: 12px 14px;
  text-align: left;
  border-radius: var(--radius);
  border: 3px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, background 0.16s ease, box-shadow 0.12s ease;
}

.task-card:active {
  transform: scale(0.985);
}

.task-card .task-emoji {
  flex: none;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  font-size: 30px;
  line-height: 1;
  border-radius: 18px;
  background: var(--sun-soft);
  border: 2px solid rgba(62, 49, 40, 0.12);
}

.task-card .task-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-card .task-title {
  font-size: 19px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-card .task-meta {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-3);
}

.task-card .task-check {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px dashed rgba(62, 49, 40, 0.28);
  color: transparent;
  font-size: 22px;
  font-weight: 900;
  background: #fff;
  transition: all 0.16s ease;
}

.task-card.done {
  background: linear-gradient(135deg, #f4fdf2 0%, #e4f8e6 100%);
  border-color: #3f7a45;
}

.task-card.done .task-emoji {
  background: #fff;
}

.task-card.done .task-title {
  color: #2f6b37;
}

.task-card.done .task-meta {
  color: #4f8b57;
}

.task-card.done .task-check {
  border: 3px solid #2f6b37;
  background: var(--grass);
  color: #17351b;
}

.task-card.done .task-check::before {
  content: "✓";
}

/* 奖励卡 */
.reward-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reward-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 3px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.reward-card .reward-emoji {
  flex: none;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  font-size: 30px;
  line-height: 1;
  border-radius: 18px;
  background: var(--sky-soft);
  border: 2px solid rgba(62, 49, 40, 0.12);
}

.reward-card .reward-body {
  flex: 1;
  min-width: 0;
}

.reward-card .reward-title {
  font-size: 18px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 价格与「今日次数」分两行，避免窄屏把一个字挤到下一行 */
.reward-card .reward-meta {
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
}

.reward-card .reward-cost {
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
  color: var(--ink);
  white-space: nowrap;
}

.reward-card .reward-state {
  max-width: 100%;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reward-card .reward-state.warn {
  color: var(--coral);
}

.reward-card .btn-redeem {
  flex: none;
  min-width: 100px;
  min-height: 60px;
  padding: 0 16px;
  border-radius: 18px;
  border: 3px solid var(--line);
  background: var(--sun);
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.reward-card .btn-redeem:active {
  transform: translateY(2px);
}

.reward-card.disabled {
  opacity: 0.72;
}

.reward-card.disabled .btn-redeem {
  background: #efe4d2;
  color: var(--ink-3);
  border-color: rgba(62, 49, 40, 0.35);
  box-shadow: none;
  cursor: not-allowed;
}

.reward-card.can-afford .btn-redeem {
  background: var(--coral);
  color: #fff;
  border-color: #b84a30;
}

/* 今日已兑换 */
.redeemed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.redeemed-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-s);
  background: var(--paper);
  border: 2px dashed rgba(62, 49, 40, 0.2);
  font-size: 15px;
  font-weight: 700;
}

.redeemed-row .grow {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.redeemed-row button {
  flex: none;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 999px;
  border: 2px solid rgba(62, 49, 40, 0.25);
  background: #fff;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-2);
}

/* 空状态 */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 34px 22px;
  text-align: center;
  border-radius: var(--radius);
  border: 3px dashed rgba(62, 49, 40, 0.28);
  background: rgba(255, 253, 247, 0.75);
}

.empty .empty-emoji {
  font-size: 46px;
  line-height: 1;
}

.empty h3 {
  font-size: 18px;
  font-weight: 900;
}

.empty p {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  max-width: 260px;
}

.empty .btn {
  margin-top: 8px;
}

/* 骨架屏 */
.skeleton {
  border-radius: var(--radius);
  border: 3px solid rgba(62, 49, 40, 0.08);
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.6) 25%, #fff6e4 40%, rgba(255, 255, 255, 0.6) 60%);
  background-size: 300% 100%;
  animation: shimmer 1.4s infinite linear;
}

.skeleton.hero-sk {
  height: 152px;
}

.skeleton.card-sk {
  height: 84px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 56px;
  padding: 0 22px;
  border-radius: 18px;
  border: 3px solid var(--line);
  background: var(--paper);
  font-size: 17px;
  font-weight: 900;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s ease, filter 0.15s ease;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

.btn-primary {
  background: var(--sun);
}

.btn-coral {
  background: var(--coral);
  color: #fff;
  border-color: #b84a30;
}

.btn-grass {
  background: var(--grass);
  border-color: #3f7a45;
  color: #17351b;
}

.btn-ghost {
  background: #fff;
  border-color: rgba(62, 49, 40, 0.3);
  box-shadow: none;
  color: var(--ink-2);
}

.btn-danger {
  background: var(--pink-soft);
  border-color: var(--pink);
  color: #8f2545;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 48px;
  padding: 0 16px;
  font-size: 15px;
  border-radius: 14px;
  border-width: 2px;
}

.btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: 16px;
  border: 2px solid rgba(62, 49, 40, 0.22);
  background: #fff;
  font-size: 20px;
  line-height: 1;
}

.icon-btn.danger {
  border-color: var(--pink);
  background: var(--pink-soft);
}

/* --------------------------------------------------------------------------
   设置页
   -------------------------------------------------------------------------- */

.settings-section {
  padding: 16px;
  border-radius: var(--radius);
  border: 3px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.settings-section h2 {
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 4px;
}

.settings-section .sec-sub {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  margin-bottom: 12px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 8px 0;
}

.row + .row {
  border-top: 2px dashed rgba(62, 49, 40, 0.12);
}

.row .row-label {
  flex: 1;
  min-width: 0;
}

.row .row-label strong {
  display: block;
  font-size: 16px;
  font-weight: 800;
}

.row .row-label span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  word-break: break-all;
}

.row .row-value {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink-2);
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.switch {
  position: relative;
  width: 68px;
  height: 42px;
  flex: none;
  border-radius: 999px;
  border: 3px solid var(--line);
  background: #e8dcc9;
  transition: background 0.18s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--line);
  transition: transform 0.18s ease;
}

.switch.on {
  background: var(--grass);
}

.switch.on::after {
  transform: translateX(24px);
}

/* 分段控件（模式） */
.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.segmented button {
  min-height: 60px;
  padding: 6px 4px;
  border-radius: 16px;
  border: 3px solid rgba(62, 49, 40, 0.25);
  background: #fff;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.segmented button small {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
}

.segmented button.active {
  background: var(--sun);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.segmented button.active small {
  color: rgba(62, 49, 40, 0.62);
}

/* 输入框 */
.field {
  display: block;
  margin-bottom: 14px;
}

.field-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-2);
}

.field-help {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
}

.input {
  width: 100%;
  min-height: 56px;
  padding: 0 16px;
  border-radius: 16px;
  border: 3px solid rgba(62, 49, 40, 0.28);
  background: #fff;
  font-size: 18px;
  font-weight: 700;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
  border-color: var(--sky);
  box-shadow: 0 0 0 4px rgba(76, 201, 240, 0.18);
}

.input-emoji {
  text-align: center;
  font-size: 30px;
}

.emoji-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.emoji-chip {
  position: relative;
  width: 100%;
  min-height: 48px;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 16px;
  border: 2px solid rgba(62, 49, 40, 0.16);
  background: #fff;
  font-size: 25px;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.emoji-chip:active {
  transform: scale(0.93);
  background: var(--sun-soft);
}

.emoji-chip.selected {
  background: var(--sun);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.emoji-chip.selected::after {
  content: "✓";
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--grass);
  color: #17351b;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

@media (max-width: 360px) {
  .emoji-row {
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 7px;
  }
  .emoji-chip {
    min-height: 44px;
    font-size: 23px;
    border-radius: 14px;
  }
}

.field-error {
  margin: 2px 0 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--coral-soft);
  color: #8f2f18;
  font-size: 14px;
  font-weight: 700;
}

/* 设置列表项 */
.manage-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.manage-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 76px;
  padding: 8px 12px;
  border-radius: var(--radius-s);
  border: 2px solid rgba(62, 49, 40, 0.14);
  background: #fff;
}

.manage-row .m-emoji {
  flex: none;
  font-size: 26px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--sun-soft);
}

.manage-row .m-body {
  flex: 1;
  min-width: 0;
}

.manage-row .m-title {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.manage-row .m-meta {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-3);
}

.manage-row .m-actions {
  display: flex;
  gap: 6px;
  flex: none;
}

.manage-row .m-actions button {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  border: 2px solid rgba(62, 49, 40, 0.2);
  background: #fff;
  font-size: 17px;
  display: grid;
  place-items: center;
}

.manage-row .m-actions button.danger {
  border-color: var(--pink);
  background: var(--pink-soft);
}

/* 连接诊断 */
.diag-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.diag-item {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 8px 10px;
  border-radius: 12px;
  background: #fff9ef;
  border: 2px solid rgba(62, 49, 40, 0.08);
}

.diag-item .diag-label {
  flex: none;
  font-weight: 800;
}

.diag-item .diag-url {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-3);
}

.diag-item .diag-state {
  flex: none;
  font-weight: 800;
  font-size: 12px;
}

.diag-item.ok .diag-state {
  color: #2f7a3a;
}

.diag-item.bad .diag-state {
  color: var(--coral);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  background: var(--grass-soft);
  color: #2f6b37;
  border: 2px solid rgba(123, 211, 137, 0.6);
}

.status-pill.bad {
  background: var(--coral-soft);
  color: #8f2f18;
  border-color: rgba(255, 122, 89, 0.6);
}

.actions-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.actions-row .btn {
  flex: 1;
  min-width: 0;
  padding: 0 12px;
}

/* PIN 门禁 */
.pin-gate {
  padding: 22px 18px 24px;
  border-radius: var(--radius);
  border: 3px solid var(--line);
  background: linear-gradient(160deg, #fffdf7, #fff4d9);
  box-shadow: var(--shadow);
  text-align: center;
}

.pin-gate .pin-emoji {
  font-size: 40px;
  line-height: 1;
}

.pin-gate h2 {
  margin-top: 6px;
  font-size: 21px;
  font-weight: 900;
}

.pin-gate p {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}

.pin-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 44px;
  margin: 18px 0 6px;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(62, 49, 40, 0.35);
  background: transparent;
  transition: transform 0.12s ease, background 0.12s ease;
}

.pin-dot.filled {
  background: var(--ink);
  border-color: var(--ink);
  transform: scale(1.08);
}

.pin-hint {
  min-height: 20px;
  font-size: 13px;
  font-weight: 700;
  color: var(--coral);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.keypad button {
  min-height: 64px;
  border-radius: 18px;
  border: 3px solid var(--line);
  background: #fff;
  font-size: 26px;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s ease;
}

.keypad button:active {
  transform: translateY(2px);
  box-shadow: none;
}

.keypad button.fn {
  font-size: 18px;
  background: var(--sun-soft);
}

.keypad button.enter {
  background: var(--grass);
  border-color: #3f7a45;
  color: #17351b;
  font-size: 17px;
}

.pin-gate.shake {
  animation: shake 0.4s ease;
}

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

.tabbar {
  position: fixed;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(528px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 7px;
  border-radius: 26px;
  border: 3px solid var(--line);
  background: rgba(255, 253, 247, 0.96);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 24px rgba(62, 49, 40, 0.16);
  z-index: 40;
}

.tabbar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 58px;
  border-radius: 18px;
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-3);
  transition: background 0.15s ease, color 0.15s ease;
}

.tabbar button .tab-emoji {
  font-size: 22px;
  line-height: 1;
  filter: grayscale(0.35);
  transition: filter 0.15s ease, transform 0.15s ease;
}

.tabbar button.active {
  background: var(--sun-soft);
  color: var(--ink);
}

.tabbar button.active .tab-emoji {
  filter: none;
  transform: scale(1.08);
}

/* --------------------------------------------------------------------------
   弹层
   -------------------------------------------------------------------------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  background: rgba(48, 36, 26, 0.34);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sheet-backdrop.in {
  opacity: 1;
}

.sheet {
  width: min(528px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  padding: 10px 18px 18px;
  border-radius: 28px;
  border: 3px solid var(--line);
  background: var(--paper);
  box-shadow: 0 18px 40px rgba(48, 36, 26, 0.3);
  transform: translateY(18px);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.sheet-backdrop.in .sheet {
  transform: none;
}

.sheet-grab {
  width: 44px;
  height: 5px;
  margin: 4px auto 12px;
  border-radius: 999px;
  background: rgba(62, 49, 40, 0.16);
}

.sheet-title {
  font-size: 22px;
  font-weight: 900;
}

.sheet-sub {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}

.sheet-text {
  margin: 10px 0 4px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--ink-2);
}

.sheet-body {
  margin-top: 12px;
}

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

.sheet-foot .btn {
  flex: 1;
  min-width: 0;
  padding: 0 12px;
}

/* Toast */
#toast-root {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 26px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(520px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  max-width: 100%;
  padding: 12px 18px;
  border-radius: 999px;
  border: 3px solid var(--line);
  background: var(--paper);
  font-size: 15px;
  font-weight: 800;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.in {
  opacity: 1;
  transform: none;
}

.toast-error {
  background: var(--coral-soft);
  border-color: var(--coral);
  color: #8f2f18;
}

.toast-good {
  background: var(--grass-soft);
  border-color: var(--grass);
  color: #2f6b37;
}

/* --------------------------------------------------------------------------
   动效层
   -------------------------------------------------------------------------- */

#fx-root {
  position: fixed;
  inset: 0;
  z-index: 110;
  pointer-events: none;
}

.fly-star {
  position: absolute;
  font-size: 24px;
  line-height: 1;
  will-change: transform, opacity;
}

.celebrate {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(48, 36, 26, 0.28);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: auto;
}

.celebrate.in {
  opacity: 1;
}

.celebrate-burst {
  text-align: center;
  padding: 24px 30px;
  border-radius: 28px;
  border: 3px solid var(--line);
  background: var(--paper);
  box-shadow: 0 18px 40px rgba(48, 36, 26, 0.3);
  animation: pop-in 0.42s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.celebrate-emoji {
  display: block;
  font-size: 56px;
  line-height: 1;
  margin-bottom: 6px;
}

.celebrate-burst h2 {
  font-size: 24px;
  font-weight: 900;
}

.celebrate-burst p {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-2);
}

.confetti {
  position: absolute;
  font-size: 22px;
  line-height: 1;
}

/* --------------------------------------------------------------------------
   动画
   -------------------------------------------------------------------------- */

@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

@keyframes shimmer {
  from { background-position: 120% 0; }
  to { background-position: -20% 0; }
}

@keyframes pop-in {
  from { transform: scale(0.86); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  50% { transform: translateX(7px); }
  75% { transform: translateX(-4px); }
}

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

.bob {
  animation: float-bob 2.6s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   小屏与无障碍
   -------------------------------------------------------------------------- */

@media (max-width: 360px) {
  .balance-num { font-size: 54px; }
  .hero-ring { width: 90px; height: 90px; }
  .reward-card .btn-redeem { min-width: 84px; padding: 0 12px; font-size: 15px; }
  .task-card .task-emoji { width: 50px; height: 50px; font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .view { animation: none; }
}
