:root {
  --ink: #2a1f2e;
  --bg: #fdf0dc;
  --paper: #fffaf0;
  --accent: #ff7b8a;
  --accent-dark: #e05a6b;
  --gold: #ffd166;
}

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

html, body { height: 100%; overflow: hidden; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background: #e7d3bd;
  background-image: radial-gradient(#d8bfa3 1.5px, transparent 1.5px);
  background-size: 16px 16px;
  display: flex;
  justify-content: center;
}

button { font: inherit; color: inherit; }

#app {
  width: 100%;
  max-width: 430px;
  height: 100%;
  min-height: 0;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  border-left: 3px solid var(--ink);
  border-right: 3px solid var(--ink);
}

.hidden { display: none !important; }

.screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 14px;
  gap: 12px;
}

#main { height: 100vh; height: 100dvh; min-height: 520px; justify-content: center; }

canvas { image-rendering: pixelated; image-rendering: crisp-edges; }

/* ---------- 通用按钮 ---------- */
.btn {
  font-weight: 700;
  border: 3px solid var(--ink);
  background: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
  transition: transform .05s, box-shadow .05s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.small { padding: 5px 10px; font-size: 13px; box-shadow: 0 3px 0 var(--ink); border-width: 2px; }
.btn.block { display: block; width: 100%; margin-top: 12px; }
.btn.poor { background: #c9b8b8; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.chip {
  font-weight: 700;
  font-size: 14px;
  border: 2px solid var(--ink);
  background: #fff;
  border-radius: 999px;
  padding: 5px 10px;
  box-shadow: 0 2px 0 var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.chip:disabled { opacity: .6; cursor: default; }
.coins { background: var(--gold); cursor: default; }

.link-btn {
  background: none;
  border: none;
  color: #a0707a;
  text-decoration: underline;
  cursor: pointer;
  align-self: center;
  font-size: 13px;
}

/* ---------- 捏人界面 ---------- */
#creator.screen {
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}
.creator-head { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.creator-head h1 { font-size: 20px; }
.creator-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 4px;
}

.creator-preview {
  border: 3px solid var(--ink);
  border-radius: 14px;
  display: flex;
  justify-content: center;
  padding: 8px 0 0;
  box-shadow: 0 4px 0 var(--ink);
}
.creator-preview canvas { width: 216px; height: 216px; }

.field {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}
.field input {
  flex: 1;
  font: inherit;
  font-weight: 700;
  padding: 8px 12px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  outline: none;
}
.field input:focus { border-color: var(--accent-dark); }

#creatorOptions { display: flex; flex-direction: column; gap: 10px; }
.opt-row { display: flex; align-items: flex-start; gap: 10px; }
.opt-label { font-weight: 700; width: 36px; flex-shrink: 0; padding-top: 4px; }
.opt-list { display: flex; flex-wrap: wrap; gap: 6px; }

.swatch {
  width: 30px;
  height: 30px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  cursor: pointer;
}
.swatch.selected { outline: 3px solid var(--accent); outline-offset: 2px; }

.chip-opt {
  border: 2px solid var(--ink);
  background: #fff;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.chip-opt.selected { background: var(--gold); }

.creator-actions { display: flex; gap: 10px; margin-top: 4px; flex-shrink: 0; }
.creator-actions .btn { flex: 1; }

/* ---------- 顶栏 ---------- */
.topbar { display: flex; align-items: center; gap: 6px; }
.profile { flex: 1; min-width: 0; }
.pname { font-size: 18px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plevel {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 0;
  background: none;
  border: none;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: inherit;
  cursor: pointer;
}
.xpbar {
  flex: 1;
  max-width: 90px;
  height: 8px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
}
#xpFill { height: 100%; width: 0; background: #9b6bd6; transition: width .3s; }

/* ---------- 属性条 ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 10px; }
.stat { display: flex; align-items: center; gap: 6px; }
.stat-icon { font-size: 18px; width: 22px; text-align: center; }
.stat-bar {
  flex: 1;
  height: 14px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
}
.stat-fill {
  height: 100%;
  transition: width .4s;
  background-image: linear-gradient(rgba(255,255,255,.35) 0 40%, transparent 40%);
}
.stat-val { font-size: 12px; font-weight: 800; width: 24px; text-align: right; }
.stat.low .stat-bar { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { border-color: #e04848; } }

/* ---------- 房间 / 场景 ---------- */
.room {
  position: relative;
  flex: 1;
  min-height: 300px;
  max-height: 480px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 0 var(--ink);
}

.room { background: #2a1f2e; }
.room-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 100%;
  image-rendering: pixelated;
  pointer-events: none;
}

.decor { position: absolute; inset: 0; pointer-events: none; }
.decor span { position: absolute; line-height: 1; filter: drop-shadow(2px 2px 0 rgba(42,31,46,.25)); }

.night-overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 12, 60, .22);
  opacity: 0;
  transition: opacity .6s;
  pointer-events: none;
}
.room.night .night-overlay { opacity: 1; }

.char-wrap {
  position: absolute;
  left: 50%;
  bottom: 4%;
  transform: translateX(-50%);
  width: 200px;
  height: 200px;
}
.char-wrap canvas {
  position: relative;
  z-index: 2;
  width: 200px;
  height: 200px;
  image-rendering: pixelated;
  cursor: pointer;
  animation: bob 1.4s steps(1) infinite;
}
.room.night .char-wrap canvas { animation-duration: 3s; }
.char-wrap.walking canvas { animation-duration: .4s; }
@keyframes bob {
  0% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.shadow {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  width: 96px;
  height: 12px;
  background: rgba(42,31,46,.22);
  border-radius: 50%;
}

.bubble {
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  width: max-content;
  max-width: 86%;
  box-sizing: border-box;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  box-shadow: 0 3px 0 var(--ink);
  animation: pop .2s ease-out;
}
.bubble::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: var(--tail, 50%);
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: var(--ink);
}
@keyframes pop { from { transform: translateX(-50%) scale(.6); opacity: 0; } }

.fx { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.float {
  position: absolute;
  font-size: 26px;
  font-weight: 800;
  transform: translate(-50%, 0);
  animation: floatUp 1.4s ease-out forwards;
  text-shadow: 2px 2px 0 #fff;
}
.float.heart { color: #f06292; }
.float.zzz { color: #fff; font-size: 22px; text-shadow: 2px 2px 0 var(--ink); }
.float.food { font-size: 40px; animation: toMouth 1.2s ease-in forwards; }
@keyframes floatUp {
  from { opacity: 1; transform: translate(-50%, 0); }
  to { opacity: 0; transform: translate(-50%, -70px); }
}
@keyframes toMouth {
  0% { opacity: 0; transform: translate(-50%, -60px) scale(1.2); }
  30% { opacity: 1; }
  80% { opacity: 1; transform: translate(-50%, 10px) scale(.6); }
  100% { opacity: 0; transform: translate(-50%, 10px) scale(.2); }
}

/* ---------- 操作栏 ---------- */
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 0 4px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
}
.action:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.action:disabled { opacity: .45; cursor: not-allowed; }
.a-icon { font-size: 22px; }
.a-label { font-size: 12px; font-weight: 800; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(42,31,46,.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  width: 100%;
  max-width: 430px;
  max-height: 80vh;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  animation: slideUp .22s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); } }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 3px dashed #e3cdb5;
}
.sheet-head h2 { font-size: 18px; }
.close {
  width: 32px;
  height: 32px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}
.sheet-body { overflow-y: auto; padding: 12px 14px 24px; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab {
  flex: 1;
  padding: 6px 0;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.tab.active { background: var(--gold); box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.card {
  position: relative;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
  text-align: center;
}
.card.selected { background: #fff1b8; outline: 3px solid var(--accent); outline-offset: 1px; }
.card.owned { background: #f3f0ea; }
.card canvas { width: 72px; height: 72px; }
.card-icon { font-size: 38px; height: 72px; display: flex; align-items: center; justify-content: center; }
.card-name { font-weight: 800; font-size: 14px; }
.card-sub { font-size: 11px; color: #7a6a70; min-height: 14px; }
.badge {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 12px;
  font-weight: 800;
  background: var(--gold);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 0 6px;
}
.scene-thumb {
  width: 72px;
  height: 72px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  object-fit: cover;
  image-rendering: pixelated;
}

.shop-coins { font-weight: 700; margin-bottom: 10px; }
.ward-preview { display: flex; justify-content: center; margin-bottom: 10px; }
.ward-preview canvas { width: 144px; height: 144px; }

.empty { text-align: center; padding: 30px 0 10px; color: #7a6a70; font-weight: 700; line-height: 1.8; }
.empty.small { padding: 14px 0 0; font-size: 13px; }
.hint { font-size: 13px; color: #7a6a70; margin-bottom: 12px; }

.hint.center { text-align: center; margin: 10px 0 0; }

/* ---------- 步数条 ---------- */
.steps-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 6px 10px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
}
.ss-icon { font-size: 22px; }
.steps-strip.walking .ss-icon { animation: bob .5s steps(1) infinite; }
.ss-info { flex: 1; min-width: 0; }
.ss-top { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-top b { font-size: 16px; }
.ss-goal { color: #7a6a70; font-size: 12px; }
.ss-bar {
  height: 8px;
  margin-top: 3px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: #f3ece2;
  overflow: hidden;
}
#stepFill { height: 100%; width: 0; background: #ff9f43; transition: width .4s; }
.ss-coins {
  font-weight: 800;
  font-size: 12px;
  background: #fff7d6;
  border: 2px dashed #d9b84a;
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}

/* ---------- 运动面板 ---------- */
.sport-hero {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
}
.sport-num { font-size: 40px; font-weight: 900; line-height: 1.1; }
.sport-sub { font-size: 13px; color: #7a6a70; font-weight: 700; }
.sport-kcal { font-size: 13px; color: #4fa3d9; font-weight: 800; margin-top: 4px; }
.sport-src { font-size: 12px; color: #8a7f8e; margin-top: 4px; }
.sport-src.warn { color: #d9822b; font-weight: 700; }
.ms-track {
  position: relative;
  height: 14px;
  margin: 14px 4px 10px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: #f3ece2;
}
.ms-fill { height: 100%; background: #ff9f43; border-radius: 3px; }
.ms-track i {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%) rotate(45deg);
  background: #fff;
  border: 2px solid var(--ink);
}
.ms-track i.on { background: var(--gold); }
.ms-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ms {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  padding: 6px 2px;
  border: 2px dashed #d9c6b0;
  border-radius: 10px;
  color: #9a8a90;
}
.ms span { font-size: 11px; }
.ms.done { border: 2px solid var(--ink); background: #fff1b8; color: var(--ink); }
.settle {
  margin-top: 12px;
  padding: 8px;
  border: 2px dashed #d9b84a;
  border-radius: 10px;
  background: #fff7d6;
  font-size: 14px;
  font-weight: 700;
}

.sec-title { font-size: 15px; margin: 16px 0 8px; }
.src-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 8px;
}
.src-info { flex: 1; min-width: 180px; }
.src-info .hint { margin: 2px 0 0; font-size: 12px; }
.manual { display: flex; gap: 6px; }
.manual input {
  width: 96px;
  font: inherit;
  font-weight: 700;
  padding: 4px 8px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  outline: none;
}

.week {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 10px;
}
.wk { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wk-num { font-size: 10px; font-weight: 700; color: #7a6a70; }
.wk-col {
  width: 18px;
  height: 80px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: #f3ece2;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.wk-fill { width: 100%; background: #ffb46b; }
.wk-fill.done { background: #5fbf6a; }
.wk-day { font-size: 12px; font-weight: 800; }

/* ---------- AI 生成形象 ---------- */
.creator-preview { position: relative; }
.photo-thumb {
  position: absolute;
  left: 10px;
  bottom: 10px;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 3px 0 var(--ink);
}
.ai-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 250, 240, .82);
  border-radius: 11px;
  font-weight: 800;
}
.ai-loading span { font-size: 32px; animation: bob .6s steps(1) infinite; }
.ai-box { display: flex; flex-direction: column; gap: 4px; }
.ai-btn { background: #c9b6ff; width: 100%; }
.ai-note { font-size: 12px; color: #7a6a70; text-align: center; }
.ai-note.error { color: #d64545; font-weight: 700; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 10px;
  max-width: 90vw;
  text-align: center;
}
.toast.show { animation: toastIn .25s ease-out; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -10px); } }

/* ---------- 房间状态标签 ---------- */
.room-chips {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  cursor: pointer;
}
.rchip {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  background: rgba(255, 255, 255, .92);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.rchip.dim { color: #9a8a90; border-style: dashed; }

/* ---------- 窗户与真实天气 ---------- */
.window {
  position: absolute;
  border: 4px solid #8d6346;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 3px 0 rgba(42, 31, 46, .25);
}
.window::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background:
    linear-gradient(#8d6346, #8d6346) center / 4px 100% no-repeat,
    linear-gradient(#8d6346, #8d6346) center / 100% 4px no-repeat;
}
.wx { position: absolute; pointer-events: none; overflow: hidden; }
.wx.pane { inset: 0; }
.wx.open { left: 0; right: 0; top: 0; height: 62%; }

.wx.pane.day.clear  { background: linear-gradient(#6fc0ff, #c9ecff); }
.wx.pane.day.cloudy { background: linear-gradient(#9aa9bb, #d0d8e1); }
.wx.pane.day.fog    { background: linear-gradient(#c3c7ce, #e6e7ea); }
.wx.pane.day.rain   { background: linear-gradient(#62789a, #97a8bf); }
.wx.pane.day.snow   { background: linear-gradient(#aebfd6, #e8eef6); }
.wx.pane.day.storm  { background: linear-gradient(#3f4a63, #6f7990); }
.wx.pane.night {
  background:
    radial-gradient(#fff 1px, transparent 1.5px) 0 0 / 18px 16px,
    linear-gradient(#141b3d, #2e2b5f);
}
.wx.pane.night.rain, .wx.pane.night.storm, .wx.pane.night.cloudy { background: linear-gradient(#1c2238, #3a4060); }

.wx.open.cloudy { background: rgba(110, 120, 140, .3); }
.wx.open.fog { background: rgba(240, 240, 245, .55); }
.wx.open.rain { background: rgba(70, 90, 120, .35); }
.wx.open.storm { background: rgba(40, 45, 70, .5); }
.wx.open.snow { background: rgba(220, 230, 245, .3); }
.wx.open.night { background-color: rgba(15, 20, 60, .5); }

/* 太阳 / 月亮 */
.wx.day.clear::after, .wx.night::after {
  content: "";
  position: absolute;
  top: 10%;
  left: 12%;
  width: 18px;
  height: 18px;
  background: #ffd166;
  box-shadow: 0 0 0 3px rgba(255, 209, 102, .4);
}
.wx.open.day.clear::after { width: 34px; height: 34px; }
.wx.night::after { background: #fff6c8; box-shadow: none; border-radius: 50%; }
.wx.night.rain::after, .wx.night.storm::after, .wx.night.cloudy::after, .wx.night.fog::after { display: none; }

/* 雨、雪 */
.wx.rain::before, .wx.storm::before, .wx.snow::before {
  content: "";
  position: absolute;
  inset: -40px 0 0 0;
  z-index: 1;
}
.wx.rain::before, .wx.storm::before {
  background-image:
    radial-gradient(1px 5px at 50% 50%, rgba(220, 235, 255, .95) 99%, transparent 100%),
    radial-gradient(1px 4px at 50% 50%, rgba(220, 235, 255, .7) 99%, transparent 100%);
  background-size: 14px 22px, 19px 26px;
  background-position: 0 0, 7px 11px;
  animation: rain .45s linear infinite;
}
.wx.snow::before {
  background-image:
    radial-gradient(1.5px 1.5px at 50% 50%, #fff 99%, transparent 100%),
    radial-gradient(1px 1px at 50% 50%, #fff 99%, transparent 100%);
  background-size: 20px 20px, 13px 15px;
  background-position: 0 0, 6px 8px;
  animation: snow 3s linear infinite;
}
@keyframes rain { to { background-position: 0 22px, 7px 37px; } }
@keyframes snow { to { background-position: 4px 20px, 2px 23px; } }
.wx.storm::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #fff;
  opacity: 0;
  animation: flash 5s steps(1) infinite;
}
@keyframes flash { 0%, 91%, 95%, 100% { opacity: 0; } 92%, 96% { opacity: .7; } }

/* ---------- 今日状态面板 ---------- */
.sec-title.first { margin-top: 0; }
.mood-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.mood-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
  font-size: 12px;
  font-weight: 800;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
}
.mood-btn span { font-size: 26px; }
.mood-btn.selected { background: #fff1b8; outline: 3px solid var(--accent); outline-offset: 1px; }
.note-row { margin-top: 8px; }
.note-row input, .manual.grow input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  outline: none;
}
.manual { align-items: center; }
.manual.grow { flex: 1; }
.manual input[type="time"] { width: 92px; }
.city-results { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.city-opt {
  text-align: left;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fffaf0;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* ---------- 像素日记 ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head b { font-size: 16px; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-week span { text-align: center; font-size: 12px; font-weight: 800; color: #7a6a70; }
.cal-grid { margin-top: 4px; }
.dcell {
  position: relative;
  aspect-ratio: 1;
  border: 2px dashed #e0cfbb;
  border-radius: 6px;
  background: #fffaf0;
  padding: 0;
  overflow: hidden;
}
.dcell.blank { border: none; background: none; }
.dcell.has { border: 2px solid var(--ink); cursor: pointer; }
.dcell.today { outline: 3px solid var(--accent); outline-offset: 1px; }
.dcell canvas { width: 100%; height: 100%; display: block; }
.dnum {
  position: absolute;
  top: 1px;
  left: 3px;
  font-size: 10px;
  font-weight: 800;
  color: #b9a894;
}
.dcell.has .dnum { color: #fff; text-shadow: 1px 1px 0 var(--ink); }
.dmood { position: absolute; right: 1px; bottom: 0; font-size: 12px; }
.cal-sum { text-align: center; font-size: 13px; margin-top: 12px; font-weight: 700; }
.poster { margin-top: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.poster img { width: 100%; border: 3px solid var(--ink); border-radius: 8px; image-rendering: pixelated; }
.poster a { text-decoration: none; }

.diary-day { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 10px; }
.diary-date { font-weight: 800; font-size: 16px; }
.diary-day canvas { width: 240px; height: 240px; border: 3px solid var(--ink); border-radius: 10px; }
.diary-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.diary-text {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 12px 14px;
  line-height: 1.8;
  font-size: 14px;
  width: 100%;
  background-image: repeating-linear-gradient(transparent 0 24px, #f1e4d3 24px 25px);
  background-position: 0 10px;
}

/* ---------- 像素地图 ---------- */
.map-stats { text-align: center; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.map-wrap { position: relative; display: flex; justify-content: center; }
.map-wrap canvas {
  width: 100%;
  max-width: 330px;
  aspect-ratio: 1;
  border: 3px solid var(--ink);
  border-radius: 10px;
}
.map-here, .map-empty {
  position: absolute;
  font-weight: 800;
  color: #fff;
  text-shadow: 1px 1px 0 var(--ink);
}
.map-here { top: 8px; left: 50%; transform: translateX(-50%); font-size: 13px; }
.map-empty { top: 50%; transform: translateY(-50%); text-align: center; line-height: 1.8; font-size: 14px; }

/* ---------- 纪念墙：白墙 + 顶光，空白拼图是墙上的刻线，点亮的拼图是嵌进去的彩色块 ---------- */
.puzzle-wall {
  margin-top: 4px;
  padding: 14px 10px 10px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background:
    radial-gradient(ellipse 70% 45% at 50% 0%, rgba(255, 250, 235, .95), transparent 70%),
    linear-gradient(#ebe6de, #d9d2c7);
  box-shadow: inset 0 -18px 24px -18px rgba(42, 31, 46, .35);
}
.pz-stats { text-align: center; font-size: 13px; margin-bottom: 10px; }
.pz-country { margin-bottom: 16px; }
.pz-head { display: flex; align-items: center; gap: 6px; margin: 0 4px 6px; }
.pz-head small { margin-left: auto; color: var(--ink-soft, #6b5d6e); font-weight: 700; }
.pz-emblem { font-size: 20px; }
.puzzle { display: block; max-width: 100%; height: auto; margin: 0 auto; overflow: visible; }
.pz path { fill: #f8f5ef; stroke: #b9afa2; stroke-width: 1.2; stroke-linejoin: round; }
.pz.lit path { stroke: #2a1f2e; stroke-width: 2; }
.pz.lit { filter: drop-shadow(1px 3px 0 rgba(42, 31, 46, .35)); cursor: pointer; }
.pz[data-piece]:not(.lit) { cursor: pointer; }
.pz text { text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.pz-icon { font-size: 28px; }
.pz-q { font-size: 20px; font-weight: 800; fill: #cfc6b8; }
.pz-name { font-size: 10px; font-weight: 800; fill: #fff; paint-order: stroke; stroke: #2a1f2e; stroke-width: 2.5px; }
.pz-name.dim { fill: #b3a898; stroke: none; }
.pz.pop { transform-box: fill-box; transform-origin: center; animation: pz-pop .7s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes pz-pop {
  0% { transform: translateY(-30px) scale(1.25) rotate(-8deg); opacity: 0; }
  100% { transform: none; opacity: 1; }
}
.pz-sub { font-weight: 800; font-size: 13px; margin: 6px 4px; }
.pz-todos { display: flex; flex-wrap: wrap; gap: 4px 2px; justify-content: center; }
.pz-todo { display: flex; flex-direction: column; align-items: center; width: 64px; cursor: pointer; }
.pz-todo path { fill: #f8f5ef; stroke: #b9afa2; stroke-width: 2; }
.pz-todo text { text-anchor: middle; dominant-baseline: middle; font-size: 30px; opacity: .45; filter: grayscale(1); }
.pz-todo small { font-size: 10px; color: #8a7d70; font-weight: 700; text-align: center; }

/* ---------- 更多菜单 / 小组件 ---------- */
.menu { display: flex; flex-direction: column; gap: 8px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 10px 12px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
}
.menu-item > span { font-size: 24px; }
a.menu-item { color: inherit; text-decoration: none; font: inherit; }
.menu-item small { display: block; font-size: 12px; color: #7a6a70; font-weight: 400; }

.widget-previews { display: flex; gap: 10px; justify-content: center; align-items: flex-end; margin: 12px 0; flex-wrap: wrap; }
.wprev { border: none; border-radius: 22px; box-shadow: 0 4px 14px rgba(42, 31, 46, .25); background: transparent; }
.wprev.small { width: 158px; height: 158px; }
.wprev.medium { width: 330px; height: 158px; max-width: 100%; }
.note-box {
  margin-top: 14px;
  padding: 10px 12px;
  border: 2px dashed #d9c6b0;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.7;
}
.note-box p { color: #7a6a70; margin-top: 4px; }

.wish-btn {
  position: absolute;
  top: 2px;
  left: 6px;
  z-index: 1;
  background: none;
  border: none;
  font-size: 18px;
  color: #c9a6ad;
  cursor: pointer;
}
.wish-btn.on { color: #f06292; }
.card-del {
  position: absolute;
  top: 4px;
  right: 6px;
  z-index: 1;
  background: none;
  border: none;
  font-size: 14px;
  color: #b9a3ab;
  cursor: pointer;
}

/* ---------- 专注 / 成长 ---------- */
.action.on { background: #ffe1e4; }
.focus-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 4;
  font-size: 13px;
  font-weight: 800;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 3px 10px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.float.xp { color: #9b6bd6; font-size: 20px; }
#focusLeft { font-variant-numeric: tabular-nums; margin: 6px 0; }
.growth-today {
  margin: 12px 0 4px;
  padding: 10px 12px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  font-size: 14px;
}
.growth-today .hint { margin: 2px 0 0; font-size: 12px; }

.prof {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-top: 8px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
}
.prof.done { background: #fff7d6; }
.prof-icon { font-size: 28px; }
.prof-info { flex: 1; min-width: 0; }
.prof-info small { display: block; font-size: 12px; color: #7a6a70; margin-top: 2px; }
.prof-bar {
  height: 10px;
  margin-top: 4px;
  border: 2px solid var(--ink);
  border-radius: 5px;
  background: #f3ece2;
  overflow: hidden;
}
.prof-bar i { display: block; height: 100%; background: #9b6bd6; }
.card.locked { opacity: .55; }

.lv-hero { text-align: center; padding: 12px; background: #fff; border: 3px solid var(--ink); border-radius: 14px; }
.lv-big { font-size: 34px; font-weight: 900; }
.lv-hero small { display: block; margin-top: 4px; font-size: 12px; color: #7a6a70; }
.xp-rows { display: flex; flex-direction: column; gap: 6px; }
.xp-row {
  display: grid;
  grid-template-columns: 28px 64px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 10px;
  font-size: 13px;
}
.xp-row span { font-size: 20px; }
.xp-row em { font-style: normal; font-size: 12px; color: #7a6a70; }
.xp-row i { font-style: normal; font-weight: 800; color: #9b6bd6; }
.xp-rows + .hint { margin-top: 8px; }

.road { display: flex; flex-direction: column; gap: 6px; }
.road-lv {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border: 2px dashed #d9c6b0;
  border-radius: 10px;
  color: #9a8a90;
}
.road-lv.on { border: 2px solid var(--ink); background: #fff; color: var(--ink); }
.road-tag { font-weight: 900; width: 44px; flex-shrink: 0; }
.road-perks { font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.road-perks span, .perk span { margin-right: 6px; }

.lvup { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; }
.lvup canvas { width: 144px; height: 144px; }
.perks { display: flex; flex-direction: column; gap: 6px; }
.perk { padding: 8px 10px; background: #fff; border: 2px solid var(--ink); border-radius: 10px; font-size: 14px; font-weight: 700; }

.frame-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; font-weight: 800; }
.frame-row .chip-opt { font-size: 12px; padding: 3px 8px; }
.frame-row .chip-opt:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 明信片 ---------- */
.postcard {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 8px auto 0;
  border: 3px solid var(--ink);
  border-radius: 6px;
  image-rendering: pixelated;
  box-shadow: 0 4px 0 var(--ink);
}
.postcard-back {
  max-width: 360px;
  margin: 12px auto 0;
  padding: 12px 14px;
  background: #fffaf0;
  border: 3px solid var(--ink);
  border-radius: 6px;
  line-height: 1.8;
  font-size: 14px;
  background-image: repeating-linear-gradient(transparent 0 24px, #f1e4d3 24px 25px);
}
.pc-sign { text-align: right; font-size: 12px; color: #7a6a70; }
.pc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pc-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0;
  background: none;
  border: none;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.pc-item canvas { width: 100%; border: 2px solid var(--ink); border-radius: 4px; image-rendering: pixelated; }

/* ---------- 等级称号 / 满级 ---------- */
#titleIcon { font-style: normal; }
#xpFill.max { background: linear-gradient(90deg, #ffd166, #ff9ad5, #9ad0ff); }
.lv-title { margin-top: 2px; font-size: 15px; font-weight: 800; }
.max-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 12px;
  vertical-align: middle;
  color: var(--ink);
  background: var(--gold);
  border: 2px solid var(--ink);
  border-radius: 6px;
}
.credit { margin-top: 6px; font-size: 11px; color: #a0939a; text-align: right; }
.menu-item.current { background: #fff1b8; }

/* ---------- 好友 ---------- */
#friendsBtn { position: relative; }
#friendsBtn.dot::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.social-intro { padding: 14px; margin-bottom: 12px; text-align: center; background: #fff; border: 3px solid var(--ink); border-radius: 14px; }
.social-intro .big-icon { font-size: 44px; }
.social-intro ul { margin: 10px 0; padding: 0; list-style: none; text-align: left; font-size: 14px; line-height: 2; }
.social-intro .hint { margin: 0; text-align: left; }
.my-code {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--gold);
  border: 3px solid var(--ink);
  border-radius: 12px;
}
.my-code > div { flex: 1; }
.my-code small { display: block; font-size: 12px; }
.my-code b { font-size: 24px; letter-spacing: 4px; font-family: ui-monospace, Consolas, monospace; }
.add-row { display: flex; gap: 8px; margin: 10px 0; }
.add-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  border: 2px solid var(--ink);
  border-radius: 8px;
}
.hint.error { color: #c0392b; }
.friend-list, .board, .feed { display: flex; flex-direction: column; gap: 8px; }
.friend-row, .board-row, .feed-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
}
.friend-row canvas { width: 48px; height: 48px; image-rendering: pixelated; }
.friend-info { flex: 1; min-width: 0; }
.friend-info b, .friend-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-info small { font-size: 12px; color: #7a6a70; }
.board-kinds { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.board-row.me { background: #fff1b8; }
.board-row .rank { width: 26px; text-align: center; font-weight: 900; font-size: 16px; }
.board-row canvas { width: 32px; height: 32px; image-rendering: pixelated; }
.board-row b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row small { font-weight: 400; color: #7a6a70; }
.board-row .val { font-weight: 800; }
.feed-row { justify-content: space-between; font-size: 14px; }
.feed-row small { flex: none; font-size: 11px; color: #a0939a; }

.friend-room { flex: none; height: 260px; min-height: 0; margin: 10px 0; }
.friend-room .char-wrap, .friend-room .char-wrap canvas { width: 180px; height: 180px; }
.friend-room .char-wrap canvas { cursor: default; }
.home-info { text-align: center; }
.home-info b { display: block; font-size: 17px; }
.home-info small { font-size: 12px; color: #7a6a70; }
.home-actions { display: flex; gap: 10px; margin: 12px 0; }
.home-actions .btn { flex: 1; }
/* ---------- 称号 ---------- */
.pname { cursor: pointer; display: flex; align-items: center; min-width: 0; }
.pname-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 9em; flex-shrink: 0; }
.pname .honor-tag { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.honor-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
  color: #6b3fa0;
  background: #f1e6ff;
  border: 2px solid #9b6bd6;
  border-radius: 999px;
}
.honor-none { width: 100%; margin: 8px 0; font-weight: 700; }
.honor-list { display: flex; flex-direction: column; gap: 8px; }
.honor {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  text-align: left;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.honor.locked { background: #f3f0ea; }
.honor.locked .honor-icon { filter: grayscale(1); opacity: .5; }
.honor.selected { background: #fff1b8; outline: 3px solid var(--accent); outline-offset: 1px; }
.honor-icon { font-size: 28px; width: 34px; text-align: center; }
.honor-info { flex: 1; min-width: 0; }
.honor-info small { display: block; font-size: 12px; color: #7a6a70; margin-top: 2px; }
.honor-info .honor-date { color: #4f9a5a; }
.honor-on { font-size: 20px; font-weight: 800; color: var(--accent-dark); }

/* ---------- 皮肤稀有度 ---------- */
.tier-tag {
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  border-radius: 6px;
  background: #4f8fd9;
}
.card.tier-rare { background: linear-gradient(#eef5ff, #fff); }
.card.tier-epic { background: linear-gradient(#f4ebff, #fff); border-color: #7d4fd0; }
.card.tier-epic .tier-tag { background: #9b6bd6; }
.card.tier-legend { background: linear-gradient(#fff3c4, #fff); border-color: #c99400; box-shadow: 0 3px 0 #c99400, 0 0 10px rgba(242, 201, 76, .7); }
.card.tier-legend .tier-tag { background: linear-gradient(90deg, #f2a541, #e0a800); }
.card.tier-plus { background: linear-gradient(#e6fbff, #fff); border-color: #2fb5d0; }
.card.tier-plus .tier-tag { background: linear-gradient(90deg, #4fa3d9, #9b6bd6); }

/* ---------- 会员 ---------- */
.plus-hero { text-align: center; margin: 4px 0 12px; }
.plus-hero b { display: block; margin-top: 4px; font-size: 16px; }
.plus-perks { display: flex; flex-direction: column; gap: 6px; }
.plus-perks .perk { display: flex; gap: 10px; align-items: center; }
.plus-perks .perk span { font-size: 22px; }
.plus-perks .perk small { display: block; font-weight: 400; font-size: 12px; color: #7a6a70; }
.paywall-reason { margin-bottom: 8px; padding: 8px 10px; font-size: 13px; font-weight: 800; text-align: center; background: #fff4d6; border: 2px solid var(--ink); border-radius: 10px; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 8px; }
.plan { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; font: inherit; background: #fff; border: 2px solid var(--ink); border-radius: 12px; cursor: pointer; }
.plan.picked { background: #eaf4ff; box-shadow: 0 0 0 3px #4fa3d9; }
.plan .plan-price { font-size: 15px; font-weight: 800; }
.plan small { font-size: 11px; color: #7a6a70; }
.plan .plan-trial { color: #2e8b57; font-weight: 800; }
.paywall .btn.block + .btn.block { margin-top: 6px; }
.paywall > .hint { margin-top: 10px; }
.paywall a.btn { display: block; text-align: center; text-decoration: none; color: inherit; }

.rp-card { margin-top: 10px; padding: 10px; background: #fff; border: 2px solid var(--ink); border-radius: 12px; }
.rp-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.rp-head small { font-size: 12px; color: #7a6a70; text-align: right; }
.rp-chart { display: flex; align-items: flex-end; gap: 2px; height: 80px; margin-top: 8px; }
.rp-col { flex: 1; height: 100%; display: flex; align-items: flex-end; background: #f5efe6; border-radius: 3px; }
.rp-col i { display: block; width: 100%; min-height: 0; border-radius: 3px; }
.rp-axis { display: flex; justify-content: space-between; font-size: 11px; color: #7a6a70; margin-top: 2px; }
.rp-moods { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; font-weight: 800; }

.cloud h3 { margin: 14px 0 4px; font-size: 15px; }
.cloud h3:first-of-type { margin-top: 2px; }
.cloud .input { display: block; width: 100%; box-sizing: border-box; margin: 6px 0; padding: 8px 10px; font: inherit; letter-spacing: 1px; text-transform: uppercase; border: 2px solid var(--ink); border-radius: 10px; }
.check-row { display: flex; align-items: center; gap: 6px; margin: 8px 0; font-size: 14px; font-weight: 700; }
.restore-key { margin: 6px 0; font: 800 18px/1.3 ui-monospace, Consolas, monospace; letter-spacing: 1px; user-select: all; }

.guide { text-align: center; }
.guide .big-icon { font-size: 52px; margin: 6px 0; }
.guide h3 { margin: 4px 0 8px; font-size: 18px; }
.guide p { margin: 0 auto; max-width: 300px; line-height: 1.6; color: #5a4a50; }
.guide-dots { display: flex; justify-content: center; gap: 6px; margin: 16px 0 12px; }
.guide-dots i { width: 8px; height: 8px; border-radius: 50%; background: #d8cfc4; }
.guide-dots i.on { background: var(--ink); }
.guide-nav { display: flex; gap: 8px; }
.guide-nav .btn { flex: 1; }

.plus-badge { display: inline-block; margin-top: 6px; padding: 2px 10px; font-size: 12px; font-weight: 800; color: #fff; background: linear-gradient(90deg, #4fa3d9, #9b6bd6); border-radius: 999px; }

.safety-row { display: flex; justify-content: center; gap: 18px; margin-top: 14px; }
.safety-row .link-btn { font-size: 12px; }
.menu-item.danger b { color: #c0392b; }
.req-dot { font-size: 13px; }

/* ---------- 亲密度 / 关系 / 送礼 ---------- */
.bond-card { margin-top: 10px; padding: 10px 12px; background: #fff0f3; border: 3px solid var(--ink); border-radius: 12px; }
.bond-top { display: flex; align-items: center; gap: 10px; }
.bond-icon { font-size: 30px; }
.bond-info b { display: block; }
.bond-info small { font-size: 12px; color: #7a6a70; }
.bond-card .prof-bar i { background: var(--accent); }
.bond-card .btn.block { margin-top: 10px; }
.bond-card .link-btn { display: block; margin: 8px auto 0; font-size: 12px; }
.paywall #plusRedeem { display: block; margin: 10px auto 0; font-size: 12px; opacity: 0.7; }
.bond-req { margin-top: 10px; font-size: 14px; font-weight: 700; text-align: center; }
.bond-req .row2 { margin-top: 8px; }
.label-grid { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.label-grid .chip-opt:disabled { opacity: .5; cursor: not-allowed; }
.label-grid small { font-size: 11px; font-weight: 400; }
.sec-title small { font-size: 12px; font-weight: 700; color: #7a6a70; margin-left: 4px; }
.gift-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.gift-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 2px;
  font: inherit;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 2px 0 var(--ink);
  cursor: pointer;
}
.gift-btn span { font-size: 24px; }
.gift-btn small { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ---------- 吃了什么 ---------- */
.row2 { display: flex; gap: 8px; justify-content: center; }
.row2 .btn { flex: 1; }
.energy-card { padding: 12px; background: #fff; border: 3px solid var(--ink); border-radius: 14px; margin-bottom: 12px; }
.en-row { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; margin-bottom: 6px; }
.en-row span { width: 64px; flex: none; }
.en-row b { width: 52px; text-align: right; font-size: 15px; }
.en-bar { flex: 1; height: 14px; background: #f3ece4; border: 2px solid var(--ink); border-radius: 4px; overflow: hidden; }
.en-bar i { display: block; height: 100%; transition: width .4s; background-image: linear-gradient(rgba(255,255,255,.35) 0 40%, transparent 40%); }
.en-bar i.in { background-color: #f2a541; }
.en-bar i.out { background-color: #4fa3d9; }
.en-bar i.all { background-color: #7d6bd6; }
.en-sum { text-align: center; font-size: 14px; margin-top: 8px; }
.en-fun { text-align: center; font-size: 13px; color: #7a6a70; margin-top: 2px; }
.en-note { text-align: center; font-size: 11px; color: #7a6a70; margin-top: 4px; line-height: 1.4; }
.energy-card .link-btn { display: block; margin: 8px auto 0; font-size: 12px; }
.body-form { padding: 10px; margin-bottom: 12px; background: #fff; border: 3px solid var(--ink); border-radius: 14px; }
.bf-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.bf-row > span { font-size: 13px; font-weight: 800; width: 42px; }
.bf-row label { flex: 1; min-width: 72px; font-size: 12px; font-weight: 800; color: #7a6a70; }
.bf-row input {
  display: block;
  width: 100%;
  margin-top: 2px;
  padding: 6px 8px;
  font: inherit;
  font-weight: 800;
  border: 2px solid var(--ink);
  border-radius: 8px;
}
.meal-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.meal-tabs .chip-opt { flex: 1; padding: 5px 2px; font-size: 13px; }
.food-search {
  display: block;
  width: 100%;
  margin: 8px 0;
  padding: 8px 10px;
  font: inherit;
  font-weight: 700;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: #fff;
}
.food-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.food-cats[hidden] { display: none; }
.food-cats .chip-opt { padding: 4px 8px; font-size: 12px; }
.food-cats.regions { padding-bottom: 8px; border-bottom: 2px dashed #e6d6c4; }
.food-pick { padding: 12px; margin-bottom: 12px; background: #fff; border: 3px solid var(--ink); border-radius: 14px; }
.fp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.fp-icon { font-size: 36px; }
.fp-head b { display: block; }
.fp-head small { color: #7a6a70; font-size: 12px; }
.fp-units { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.fp-qty { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 8px 0; font-size: 20px; }
.fp-qty input { width: 100px; padding: 6px 8px; font: inherit; font-weight: 800; border: 2px solid var(--ink); border-radius: 8px; text-align: center; }
.fp-total { text-align: center; font-size: 22px; margin: 8px 0 12px; }
.fp-total small { display: block; font-size: 13px; color: #4fa3d9; }
.manual-box { margin: 10px 0 4px; }
.manual-box summary { cursor: pointer; font-size: 13px; font-weight: 800; color: #7a6a70; }
.manual-row { display: flex; gap: 6px; margin: 10px 0; }
.manual-row input, .pend-row input {
  min-width: 0;
  padding: 6px 8px;
  font: inherit;
  font-weight: 700;
  border: 2px solid var(--ink);
  border-radius: 8px;
}
.manual-row input:first-child { flex: 1; }
.manual-row input[type="number"] { width: 72px; }
.food-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
.food-grid .card { padding: 6px 4px; box-shadow: 0 2px 0 var(--ink); border-width: 2px; }
.food-grid .card-icon { font-size: 28px; height: 36px; }
.food-grid .card-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.food-grid .card-sub { font-size: 11px; }
.meal-pending { padding: 10px; background: #fff; border: 3px solid var(--ink); border-radius: 14px; }
.meal-photo { display: block; max-width: 100%; max-height: 180px; margin: 0 auto 8px; border-radius: 8px; border: 2px solid var(--ink); }
.pend-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.pend-row { display: flex; align-items: center; gap: 6px; }
.pend-row .p-icon { font-size: 22px; }
.pend-row b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pend-row input { width: 72px; }
.pend-row small { font-size: 11px; color: #7a6a70; }
.x-btn { flex: none; width: 26px; height: 26px; padding: 0; font: inherit; font-size: 12px; background: #fff; border: 2px solid var(--ink); border-radius: 50%; cursor: pointer; }
.meal-group { margin-bottom: 10px; padding: 8px 10px; background: #fff; border: 3px solid var(--ink); border-radius: 12px; }
.mg-head { display: flex; justify-content: space-between; font-weight: 800; margin-bottom: 4px; }
.mg-head small { font-size: 12px; color: #7a6a70; }
.meal-row { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 14px; }
.meal-row > span { font-size: 20px; }
.meal-row b { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; overflow: hidden; }
.meal-row .mn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meal-row .amt { flex: none; font-size: 11px; color: #7a6a70; }
.meal-row small { font-size: 11px; color: #4fa3d9; font-weight: 700; }
.meal-row em { font-style: normal; font-weight: 800; width: 44px; text-align: right; }

/* ---------- 布置小屋 ---------- */
.room-edit {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 4;
  width: 36px;
  height: 36px;
  font-size: 18px;
  background: rgba(255, 255, 255, .92);
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 2px 0 var(--ink);
  cursor: pointer;
}
.room.editing .room-edit, .room.editing .room-chips, .room.editing .focus-badge { display: none; }
.room.editing { outline: 3px dashed var(--accent); outline-offset: -8px; }
.room.editing .char-wrap { opacity: .35; pointer-events: none; }
.room.editing .decor span[data-id] {
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  user-select: none;
  border-radius: 6px;
  outline: 2px dashed rgba(42, 31, 46, .35);
}
.room.editing .decor span.sel { outline: 3px solid var(--accent); background: rgba(255, 255, 255, .35); z-index: 3; }
.room-tools { padding: 10px; background: var(--paper); border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink); }
.rt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 700; }
.rt-sel { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.rt-sel b { flex: 1; min-width: 80px; }
.rt-tip { margin-top: 8px; font-size: 12px; color: #7a6a70; }
.rt-label { margin-top: 10px; font-size: 12px; font-weight: 800; }
.rt-tray { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 2px; }
.rt-item { flex: none; width: 44px; height: 44px; font-size: 26px; background: #fff; border: 2px solid var(--ink); border-radius: 10px; cursor: pointer; }
.rt-empty { font-size: 12px; color: #7a6a70; }

/* ---------- 专注空间 ---------- */
.focus-zone {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(18px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  color: #f4e9d8;
  background:
    radial-gradient(1px 1px at 18% 14%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 72% 9%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 86% 22%, #fff5 50%, transparent 51%),
    radial-gradient(1px 1px at 33% 30%, #fff4 50%, transparent 51%),
    radial-gradient(ellipse at 50% 62%, #3b3150 0%, #1d1b34 46%, #0f1021 100%);
  animation: fzIn .5s ease-out;
  overflow: hidden;
  user-select: none;
}
@keyframes fzIn { from { opacity: 0; } }
.fz-top { width: 100%; max-width: 420px; display: flex; align-items: center; justify-content: space-between; }
.fz-label { font-size: 14px; font-weight: 800; color: #cfc3e6; letter-spacing: .5px; }
.fz-ghost {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #cfc3e6;
  background: transparent;
  border: 1.5px solid #ffffff33;
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
}
.fz-time {
  margin-top: 6vh;
  font-size: 68px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #fff3dc;
  text-shadow: 0 0 24px #ffb86b55;
}
.fz-bar { width: min(260px, 70vw); height: 6px; margin-top: 14px; border-radius: 999px; background: #ffffff1a; overflow: hidden; }
.fz-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #ffcf7a, #ff9a6b); transition: width 1s linear; }
.fz-stage { position: relative; flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; min-height: 240px; }
.fz-desk { position: relative; width: min(270px, 72vw); aspect-ratio: 1; }
/* 台灯在左上，光从那里散开；closest-side 保证渐变在盒子边缘正好消失 */
.fz-glow {
  position: absolute;
  left: -45%;
  top: -40%;
  width: 170%;
  height: 160%;
  background: radial-gradient(closest-side at 40% 50%, #ffc77a50 0%, #ffb06018 50%, transparent 100%);
  animation: fzBreath 5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes fzBreath { 50% { opacity: .7; } }
/* 深色衣服、黑头发在暗背景上会和描边一起消失，加一圈暖色轮廓光 */
#fzCanvas {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 1.5px #ffe9c8) drop-shadow(0 0 12px #ffb86b40);
}
.fz-fx { position: absolute; inset: 0; pointer-events: none; }
.fz-fx span { position: absolute; top: 4%; font-size: 26px; animation: fzPop 2.2s ease-out forwards; }
@keyframes fzPop {
  from { opacity: 0; transform: translateY(10px) scale(.6); }
  20% { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-40px); }
}
.fz-quote { min-height: 22px; font-size: 15px; font-weight: 700; color: #d9cdee; text-align: center; transition: opacity .4s; }
.fz-bottom { width: 100%; max-width: 360px; margin-top: 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.fz-stop {
  font: inherit;
  font-weight: 800;
  font-size: 15px;
  width: 100%;
  padding: 11px;
  color: #e9dcf5;
  background: #ffffff10;
  border: 1.5px solid #ffffff30;
  border-radius: 12px;
  cursor: pointer;
}
.fz-stop.armed { color: #fff; background: #d6454566; border-color: #ff8a8a; }
.fz-stop.primary { color: var(--ink); background: #ffcf7a; border: 3px solid var(--ink); box-shadow: 0 4px 0 #00000066; }
.fz-hint { font-size: 12px; color: #9d93b5; text-align: center; }
.fz-xp { font-size: 18px; font-weight: 900; color: #ffd98a; }
.focus-zone.done .fz-time { font-size: 48px; }
.focus-zone.done .fz-ghost { visibility: hidden; }
.focus-zone.done .fz-glow { background: radial-gradient(closest-side at 50% 50%, #ffd98a5c 0%, #ffb06024 50%, transparent 100%); }
@media (prefers-reduced-motion: reduce) {
  .fz-glow, .focus-zone { animation: none; }
}

/* 睡觉空间：深蓝夜空和月亮，床头小夜灯一点暖光 */
.sleep-zone {
  background:
    radial-gradient(circle at 82% 11%, #fff6d6 0 22px, #fff6d633 23px, transparent 60px),
    radial-gradient(1px 1px at 14% 12%, #fff9 50%, transparent 51%),
    radial-gradient(1px 1px at 38% 7%, #fff7 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 60% 18%, #fff6 50%, transparent 51%),
    radial-gradient(1px 1px at 24% 27%, #fff5 50%, transparent 51%),
    radial-gradient(1px 1px at 70% 30%, #fff5 50%, transparent 51%),
    radial-gradient(ellipse at 50% 66%, #26305a 0%, #141a3a 48%, #080b1e 100%);
}
.sleep-zone .fz-time { font-size: 56px; color: #e6ecff; text-shadow: 0 0 24px #8fa6ff55; }
.sz-since { margin-top: 10px; font-size: 13px; font-weight: 700; color: #a9b3dc; min-height: 18px; }
.sz-bed { position: relative; width: min(250px, 64vw); aspect-ratio: 13 / 15; }
.sz-bed::before {
  content: '';
  position: absolute;
  right: -30%;
  top: -25%;
  width: 80%;
  height: 70%;
  background: radial-gradient(closest-side, #ffd98a40 0%, #ffb06014 55%, transparent 100%);
  animation: fzBreath 6s ease-in-out infinite;
  pointer-events: none;
}
#szCanvas {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 1.5px #c9d4ff88) drop-shadow(0 8px 18px #00000066);
}
.sz-fx { position: absolute; inset: 0; pointer-events: none; }
.sz-fx span {
  position: absolute;
  top: 6%;
  font-weight: 900;
  color: #cfd8ff;
  text-shadow: 0 0 8px #8fa6ff;
  animation: szFloat 3s ease-out forwards;
}
@keyframes szFloat {
  from { opacity: 0; transform: translate(0, 10px) scale(.6); }
  25% { opacity: 1; }
  to { opacity: 0; transform: translate(26px, -60px) scale(1.1); }
}
.sleep-zone .fz-quote { margin-top: 6px; color: #c3cbea; }
.sleep-zone .fz-hint { color: #8e97bd; }
@media (prefers-reduced-motion: reduce) {
  .sz-bed::before, .sz-fx span { animation: none; }
}
