﻿/* ─────────────  基础  ───────────── */
:root {
  --ink: #3a2f31;
  --ink-soft: #8d7b78;
  --ink-faint: #b3a3a0;
  --line: rgba(58, 47, 49, 0.10);
  --card: #fffdfa;
  --accent: #d98a76;
  --accent-2: #c96f63;
  --danger: #b6544c;
  --radius: 20px;
  --font: "PingFang SC", "HarmonyOS Sans SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(120% 75% at 12% 0%, #fff7f0 0%, rgba(255, 247, 240, 0) 55%),
    radial-gradient(100% 65% at 92% 6%, #f8e2da 0%, rgba(248, 226, 218, 0) 62%),
    linear-gradient(165deg, #f9ede4 0%, #ecdbd1 55%, #e4d0c5 100%);
  display: grid;
  place-items: center;
  padding: 22px 16px;
}

button { font: inherit; color: inherit; }

/* ─────────────  手机壳  ───────────── */
.stage {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.phone {
  position: relative;
  width: 100%;
  height: min(820px, calc(100vh - 92px));
  height: min(820px, calc(100dvh - 92px));
  min-height: 460px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 34px;
  background: linear-gradient(180deg, #fffdfb 0%, #fdf7f2 100%);
  box-shadow:
    0 34px 80px -34px rgba(88, 52, 44, 0.55),
    0 3px 12px rgba(88, 52, 44, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.75),
    0 0 0 8px rgba(255, 255, 255, 0.30);
}

.hint {
  margin: 0;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: rgba(88, 60, 54, 0.55);
}

/* ─────────────  顶栏  ───────────── */
.top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 11px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.55));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.who {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
  border-radius: 12px;
  transition: opacity 0.15s;
}
.who:active { opacity: 0.6; }

.ava {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background-color: #c8806d;
  background-image: linear-gradient(145deg, rgba(255, 255, 255, 0.30), rgba(0, 0, 0, 0.14));
  box-shadow: 0 4px 10px -4px rgba(80, 50, 44, 0.5);
  letter-spacing: 0.02em;
  user-select: none;
}

.ava.sm { width: 28px; height: 28px; font-size: 12px; }
.ava.lg { width: 46px; height: 46px; font-size: 19px; }

.who-text { display: flex; flex-direction: column; min-width: 0; }
.name { font-size: 15px; font-weight: 600; letter-spacing: 0.01em; }
.status {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 5px;
}
.status .dot { width: 5px; height: 5px; border-radius: 50%; background: #83bd90; transition: background 0.3s; }
.status .dot.off { background: #bfaeaa; }

.icon-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 12.5px;
  color: #6d5a56;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}
.icon-btn:hover { background: #fff; }
.icon-btn:active { transform: scale(0.96); }
.icon-btn.ghost { background: none; border-color: transparent; color: var(--ink-soft); padding: 6px 8px; }

/* ─────────────  消息流  ───────────── */
.feed {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  padding: 16px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.feed::-webkit-scrollbar { display: none; }

.row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: pop 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.row.me { justify-content: flex-end; }

@keyframes pop {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}

.bubble {
  max-width: 76%;
  padding: 9px 13px;
  border-radius: 17px;
  font-size: 14.5px;
  line-height: 1.62;
  letter-spacing: 0.01em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #fff;
  border: 1px solid rgba(58, 47, 49, 0.055);
  box-shadow: 0 2px 10px -5px rgba(88, 52, 44, 0.30);
  cursor: pointer;
}
.row.them .bubble { border-bottom-left-radius: 5px; }
.row.me .bubble {
  background: linear-gradient(135deg, #e6a08c, #cf7b70);
  color: #fff;
  border-color: transparent;
  border-bottom-right-radius: 5px;
  box-shadow: 0 8px 18px -10px rgba(201, 111, 99, 0.95);
}

.row.selected .bubble {
  outline: 2px solid rgba(201, 111, 99, 0.40);
  outline-offset: 2px;
}

/* 气泡里的引用块 */
.bubble .quote {
  margin-bottom: 6px;
  padding: 3px 0 3px 8px;
  border-left: 2px solid rgba(58, 47, 49, 0.16);
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink-soft);
}
.bubble .quote .qname {
  display: block;
  font-weight: 600;
  color: #a8665c;
}
.bubble .quote .qtext {
  display: block;
  max-width: 230px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.row.me .bubble .quote {
  border-left-color: rgba(255, 255, 255, 0.55);
  color: rgba(255, 255, 255, 0.88);
}
.row.me .bubble .quote .qname { color: #fff; }

/* 自己消息下面的「已读」 */
.receipt {
  align-self: flex-end;
  margin: -5px 4px 0;
  font-size: 10.5px;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}
.receipt:empty { display: none; }
.receipt.on { animation: pop 0.2s ease; }

.sep {
  align-self: center;
  margin: 8px 0 2px;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 10.5px;
  color: var(--ink-faint);
  background: rgba(58, 47, 49, 0.045);
}

.meta {
  align-self: center;
  font-size: 10.5px;
  color: var(--ink-faint);
  margin: 1px 0 2px;
}

.dots { display: flex; align-items: center; gap: 4px; padding: 12px 14px; }
.dots i {
  width: 5px; height: 5px; border-radius: 50%;
  background: #c9b7b1;
  animation: blink 1.15s infinite;
}
.dots i:nth-child(2) { animation-delay: 0.18s; }
.dots i:nth-child(3) { animation-delay: 0.36s; }
@keyframes blink {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

/* ─────────────  输入区  ───────────── */
.composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.compose-quote {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 11px;
  border-radius: 12px;
  border-left: 3px solid var(--accent);
  background: rgba(58, 47, 49, 0.05);
  font-size: 11.5px;
  color: var(--ink-soft);
  animation: pop 0.18s ease;
}
.cq-mark {
  flex: none;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--accent-2);
}
.cq-body { flex: 1; min-width: 0; display: flex; gap: 6px; align-items: baseline; overflow: hidden; }
.cq-name { flex: none; font-weight: 600; color: #a8665c; }
.cq-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cq-close {
  flex: none;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink-faint);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.cq-close:hover { background: rgba(58, 47, 49, 0.08); color: var(--ink); }

.input-wrap {
  flex: 1;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.input-wrap:focus-within {
  border-color: #dfa691;
  box-shadow: 0 0 0 3px rgba(217, 138, 118, 0.14);
}

#input {
  display: block;
  width: 100%;
  max-height: 92px;
  padding: 5px 0;
  border: 0;
  outline: 0;
  resize: none;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 14.5px;
  line-height: 1.5;
}
#input::placeholder { color: #b9a8a3; }

.send {
  flex: none;
  padding: 10px 17px;
  border: 0;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #e29a86, #cd7468);
  box-shadow: 0 8px 18px -10px rgba(201, 111, 99, 0.95);
  transition: transform 0.12s, opacity 0.2s, filter 0.2s;
}
.send:active { transform: scale(0.96); }
.send:disabled { opacity: 0.4; cursor: default; box-shadow: none; }

/* ─────────────  浮层 / 抽屉  ───────────── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(58, 40, 38, 0.30);
  backdrop-filter: blur(3px);
  animation: fade 0.2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 21;
  transform: translateX(-50%);
  width: min(420px, 100%);
  max-height: 84vh;
  max-height: 84dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 26px 26px 0 0;
  background: #fffdfb;
  box-shadow: 0 -22px 55px -24px rgba(60, 35, 30, 0.5);
  animation: up 0.28s cubic-bezier(0.2, 0.85, 0.2, 1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@keyframes up { from { transform: translate(-50%, 18px); opacity: 0.4; } to { transform: translate(-50%, 0); opacity: 1; } }

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--line);
}
.sheet-head h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.sheet-head h2 span { color: var(--accent-2); }

.sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sheet-body > * { flex: 0 0 auto; }

.tip { margin: 0; font-size: 11.5px; line-height: 1.6; color: var(--ink-soft); }

.sheet-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  margin-top: 2px;
  border-top: 1px solid var(--line);
}

/* 角色列表 */
.char-list { display: flex; flex-direction: column; gap: 8px; }
.char-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.char-item:hover { border-color: #e5c3b6; }
.char-item:active { transform: scale(0.99); }
.char-item.on { border-color: #dda48f; box-shadow: 0 0 0 3px rgba(217, 138, 118, 0.12); }
.char-item .info { flex: 1; min-width: 0; }
.char-item .cname { display: block; font-size: 14.5px; font-weight: 600; }
.char-item .ctag { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ink-soft); }
.char-item .badge {
  flex: none;
  padding: 3px 8px;
  border-radius: 9px;
  font-size: 10.5px;
  color: #a8665c;
  background: rgba(217, 138, 118, 0.13);
}

/* 字卡列表 */
.card-list { display: flex; flex-direction: column; gap: 8px; }
.card-row {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.card-row .txt {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #4a3d3f;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-row .txt em { font-style: normal; color: var(--accent-2); }
.card-row .rowfoot {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.tag {
  padding: 2px 7px;
  border-radius: 8px;
  font-size: 10.5px;
  color: #7b6864;
  background: rgba(58, 47, 49, 0.05);
}
.tag.trig { color: #a8665c; background: rgba(217, 138, 118, 0.13); }
.tag.once { color: #8a6a2f; background: rgba(208, 160, 94, 0.16); }
.card-row .ops { margin-left: auto; display: flex; gap: 4px; }
.mini {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 11px;
  color: var(--ink-soft);
  cursor: pointer;
}
.mini:hover { background: #fdf3ee; color: var(--accent-2); border-color: #e5c3b6; }
.mini.danger:hover { color: var(--danger); border-color: #e6bcb8; background: #fdf2f1; }

/* 表单 */
.card-form {
  border: 1px dashed rgba(58, 47, 49, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
  overflow: hidden;
}
.card-form summary {
  padding: 11px 13px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #a8665c;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}
.card-form summary::-webkit-details-marker { display: none; }
.card-form summary:hover { background: rgba(217, 138, 118, 0.07); }
.card-form[open] summary { border-bottom: 1px dashed rgba(58, 47, 49, 0.12); }

.card-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}
.card-form textarea,
.card-form input[type="text"],
.card-form input[type="number"],
.card-form select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  color: inherit;
  outline: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card-form textarea { resize: vertical; min-height: 60px; line-height: 1.6; }
.card-form textarea:focus,
.card-form input:focus,
.card-form select:focus { border-color: #dfa691; box-shadow: 0 0 0 3px rgba(217, 138, 118, 0.12); }

.form-row { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.form-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--ink-soft);
}
.form-row label.chk { flex-direction: row; align-items: center; gap: 5px; padding-bottom: 9px; font-size: 12px; }
.form-row input[type="number"] { width: 74px; }
.form-row label.chk input { accent-color: var(--accent-2); }
.form-actions { display: flex; gap: 8px; margin-left: auto; }

.btn {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 12.5px;
  color: #6d5a56;
  cursor: pointer;
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
}
.btn:hover { background: #fdf6f2; border-color: #e5c3b6; }
.btn:active { transform: scale(0.97); }
.btn.primary {
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  background: linear-gradient(135deg, #e29a86, #cd7468);
  box-shadow: 0 8px 16px -10px rgba(201, 111, 99, 0.9);
}
.btn.ghost { background: none; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: #fdf2f1; border-color: #e6bcb8; }

/* 提示条 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 30;
  transform: translate(-50%, 12px);
  padding: 9px 16px;
  border-radius: 99px;
  font-size: 12.5px;
  color: #fff;
  background: rgba(52, 38, 36, 0.90);
  box-shadow: 0 12px 30px -14px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ─────────────  小屏  ───────────── */
@media (max-width: 480px) {
  body { padding: 0; display: block; }
  .stage { width: 100%; gap: 0; }
  .phone {
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
  .hint { display: none; }
  .sheet { width: 100%; }
}

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

/* ─────────────  来电 / 通话  ───────────── */
.call {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 54px 26px calc(46px + env(safe-area-inset-bottom, 0px));
  color: #fff;
  background: linear-gradient(165deg, #313b47 0%, #232b34 55%, #191f26 100%);
  animation: callIn 0.28s cubic-bezier(0.2, 0.85, 0.2, 1);
}
.call::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(62% 38% at 50% 10%, rgba(111, 158, 201, 0.42), transparent 70%);
}
@keyframes callIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.call-top { position: relative; z-index: 1; }
.call-state {
  font-size: 12px;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.62);
}

.call-body {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.call-ava {
  width: 96px;
  height: 96px;
  font-size: 36px;
  position: relative;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.9);
}
.call.ringing .call-ava::after {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  animation: callPulse 1.9s ease-out infinite;
}
@keyframes callPulse {
  0% { transform: scale(0.92); opacity: 0.75; }
  100% { transform: scale(1.35); opacity: 0; }
}

.call-name {
  margin-top: 22px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.call-sub {
  margin-top: 8px;
  font-size: 12.5px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.62);
}
.call-timer {
  margin-top: 14px;
  font-size: 16px;
  letter-spacing: 0.16em;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.85);
}

.call-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 64px;
}
.call-btn {
  width: 74px;
  height: 74px;
  border: 0;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #fff;
  cursor: pointer;
  transition: transform 0.12s, filter 0.15s;
}
.call-btn:active { transform: scale(0.94); }
.call-btn.decline { background: #8d6f6c; }
.call-btn.accept { background: #63a877; box-shadow: 0 12px 28px -14px rgba(99, 168, 119, 0.9); }
.call-btn.hangup { background: #c0584f; box-shadow: 0 12px 28px -14px rgba(192, 88, 79, 0.9); }
.call-btn:hover { filter: brightness(1.08); }
/* 系统消息：未接来电、通话结束 */
.row.sys {
  justify-content: center;
  padding: 2px 0;
}
.sys-text {
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 11px;
  color: #9a8884;
  background: rgba(58, 47, 49, 0.055);
  letter-spacing: 0.02em;
}

/* 接通后的浮窗 */
.call-mini {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 14;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 9px;
  border-radius: 16px;
  background: linear-gradient(150deg, #313b47, #1e252d);
  color: #fff;
  box-shadow: 0 16px 34px -16px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.06);
  cursor: grab;
  touch-action: none;
  user-select: none;
  animation: pop 0.2s ease;
}
.call-mini.dragging { cursor: grabbing; }
.mini-ava {
  width: 30px;
  height: 30px;
  font-size: 13px;
  box-shadow: none;
}
.mini-info { display: flex; flex-direction: column; line-height: 1.25; padding-right: 2px; }
.mini-name { font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; }
.mini-timer {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.62);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}
.mini-hangup {
  flex: none;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: #c0584f;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  transition: filter 0.15s, transform 0.12s;
}
.mini-hangup:hover { filter: brightness(1.1); }
.mini-hangup:active { transform: scale(0.92); }

/* 顶栏的打电话按钮 */
.icon-btn.round {
  width: 34px;
  height: 34px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
}

/* 他那边消息下面的「已读」 */
.receipt.them {
  align-self: flex-start;
  margin-left: 38px;
}

/* ─────────────  语音消息  ───────────── */
.mic {
  flex: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: #7b6864;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.12s;
}
.mic:hover { background: #fdf3ee; color: var(--accent-2); }
.mic:active { transform: scale(0.94); }
.mic.recording {
  background: linear-gradient(135deg, #e08a80, #c9605a);
  border-color: transparent;
  color: #fff;
  animation: recPulse 1.3s ease-in-out infinite;
}
@keyframes recPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 96, 90, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(201, 96, 90, 0.14); }
}

.rec-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 12px;
  background: rgba(201, 96, 90, 0.08);
  font-size: 11.5px;
  color: #9d5b55;
}
.rec-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c9605a;
  animation: blink 1.1s infinite;
}
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.rec-hint { flex: 1; color: #a98f8b; }
.rec-cancel {
  border: 0;
  background: none;
  color: #9d5b55;
  font-size: 11.5px;
  cursor: pointer;
  text-decoration: underline;
}

/* 气泡里的语音条 */
.voice {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 118px;
}
.vplay {
  flex: none;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: rgba(58, 47, 49, 0.08);
  color: #6d5a56;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.row.me .vplay { background: rgba(255, 255, 255, 0.28); color: #fff; }
.vplay:hover { filter: brightness(1.15); }

.vbars { display: flex; align-items: center; gap: 3px; height: 20px; }
.vbars i {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: rgba(58, 47, 49, 0.22);
  height: 6px;
}
.row.me .vbars i { background: rgba(255, 255, 255, 0.55); }
.vbars i:nth-child(2n) { height: 13px; }
.vbars i:nth-child(3n) { height: 9px; }
.vbars i:nth-child(4n) { height: 17px; }
.vbars i:nth-child(5n) { height: 5px; }
.voice.playing .vbars i { animation: vbar 0.9s ease-in-out infinite; }
.voice.playing .vbars i:nth-child(2n) { animation-delay: 0.12s; }
.voice.playing .vbars i:nth-child(3n) { animation-delay: 0.24s; }
@keyframes vbar {
  0%, 100% { transform: scaleY(0.7); }
  50% { transform: scaleY(1.25); }
}

.vdur {
  flex: none;
  font-size: 11px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.row.me .vdur { color: rgba(255, 255, 255, 0.8); }

.vtext {
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px dashed rgba(58, 47, 49, 0.16);
  font-size: 12.5px;
  line-height: 1.55;
  color: #6f5d5a;
  white-space: pre-wrap;
}
.row.me .vtext {
  border-top-color: rgba(255, 255, 255, 0.35);
  color: rgba(255, 255, 255, 0.92);
}
.vtext.empty { color: var(--ink-faint); font-style: italic; }

/* iOS 上输入框字号小于 16px 会自动放大页面，这里兜一下 */
@media (max-width: 480px) {
  #input { font-size: 16px; }
}

/* 刘海屏 / 灵动岛：全屏时给顶部留出安全区 */
@media (max-width: 480px) {
  .top { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
  .call { padding-top: calc(54px + env(safe-area-inset-top, 0px)); }
  .call-mini { top: max(8px, env(safe-area-inset-top, 0px)); }
}

.vplay:disabled { opacity: 0.4; cursor: default; }


/* ═════════════ 主题皮肤 ═════════════ */
:root {
  --page-1: #fbf3ec;
  --page-2: #ecdbd1;
  --page-3: #e4d0c5;
  --glow-1: #fff7f0;
  --glow-2: #f8e2da;
  --phone-a: #fffdfb;
  --phone-b: #fdf7f2;
  --top-bg: rgba(255, 255, 255, 0.86);
  --bubble-bg: #fff;
  --bubble-ink: #3a2f31;
  --bubble-line: rgba(58, 47, 49, 0.055);
  --me-a: #e6a08c;
  --me-b: #cf7b70;
  --me-ink: #fff;
  --composer-bg: rgba(255, 255, 255, 0.78);
  --input-bg: #fff;
  --sheet-bg: #fffdfb;
  --surface: #fff;
  --chip: rgba(58, 47, 49, 0.05);
  --bubble-shadow: 0 2px 10px -5px rgba(88, 52, 44, 0.30);
  --me-shadow: 0 8px 18px -10px rgba(201, 111, 99, 0.95);
  --phone-shadow: 0 34px 80px -34px rgba(88, 52, 44, 0.55), 0 3px 12px rgba(88, 52, 44, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.75), 0 0 0 8px rgba(255, 255, 255, 0.30);
}

/* 薄荷苏打 */
body[data-theme="mint"] {
  --ink: #31423c;
  --ink-soft: #7b918a;
  --ink-faint: #a9bdb6;
  --line: rgba(49, 66, 60, 0.10);
  --accent: #6cbfa3;
  --accent-2: #4e9c83;
  --page-1: #eefaf5;
  --page-2: #dcefe6;
  --page-3: #cfe6da;
  --glow-1: #f7fffb;
  --glow-2: #dcf3e9;
  --phone-a: #ffffff;
  --phone-b: #f5fcf9;
  --top-bg: rgba(255, 255, 255, 0.88);
  --bubble-bg: #ffffff;
  --bubble-ink: #31423c;
  --bubble-line: rgba(49, 66, 60, 0.07);
  --me-a: #7ecdb2;
  --me-b: #4fa98c;
  --composer-bg: rgba(255, 255, 255, 0.82);
  --sheet-bg: #fbfffd;
  --chip: rgba(49, 66, 60, 0.05);
  --bubble-shadow: 0 2px 10px -5px rgba(40, 80, 66, 0.28);
  --me-shadow: 0 8px 18px -10px rgba(79, 169, 140, 0.90);
  --phone-shadow: 0 34px 80px -34px rgba(44, 86, 70, 0.45), 0 3px 12px rgba(44, 86, 70, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.8), 0 0 0 8px rgba(255, 255, 255, 0.35);
}

/* 草莓牛奶 */
body[data-theme="strawberry"] {
  --ink: #4a3038;
  --ink-soft: #a1808c;
  --ink-faint: #c9acb7;
  --line: rgba(74, 48, 56, 0.10);
  --accent: #f08ba8;
  --accent-2: #d96a8c;
  --page-1: #fff1f5;
  --page-2: #ffe0ea;
  --page-3: #f8d2df;
  --glow-1: #fff8fb;
  --glow-2: #ffe4ee;
  --phone-a: #fffafc;
  --phone-b: #fff3f7;
  --top-bg: rgba(255, 255, 255, 0.88);
  --bubble-bg: #ffffff;
  --bubble-ink: #4a3038;
  --bubble-line: rgba(217, 106, 140, 0.14);
  --me-a: #f7a7c0;
  --me-b: #e77d9f;
  --composer-bg: rgba(255, 255, 255, 0.82);
  --sheet-bg: #fffafc;
  --chip: rgba(217, 106, 140, 0.08);
  --bubble-shadow: 0 2px 10px -5px rgba(160, 90, 110, 0.28);
  --me-shadow: 0 8px 18px -10px rgba(231, 125, 159, 0.90);
  --phone-shadow: 0 34px 80px -34px rgba(150, 80, 105, 0.42), 0 3px 12px rgba(150, 80, 105, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.8), 0 0 0 8px rgba(255, 255, 255, 0.35);
}

/* 葡萄夜色 */
body[data-theme="night"] {
  --ink: #f0eaff;
  --ink-soft: #b4a8cc;
  --ink-faint: #8d81a6;
  --line: rgba(240, 234, 255, 0.12);
  --accent: #b49bf0;
  --accent-2: #cbb6ff;
  --page-1: #241f33;
  --page-2: #1c1828;
  --page-3: #15111f;
  --glow-1: #3a2f57;
  --glow-2: #2c2442;
  --phone-a: #2a2438;
  --phone-b: #211c2e;
  --top-bg: rgba(42, 36, 56, 0.86);
  --bubble-bg: #37304a;
  --bubble-ink: #f1ecff;
  --bubble-line: rgba(255, 255, 255, 0.06);
  --me-a: #8f7ae0;
  --me-b: #6b57bb;
  --composer-bg: rgba(42, 36, 56, 0.86);
  --input-bg: #332b44;
  --sheet-bg: #2a2438;
  --surface: #332b44;
  --chip: rgba(255, 255, 255, 0.08);
  --bubble-shadow: 0 2px 10px -5px rgba(0, 0, 0, 0.5);
  --me-shadow: 0 8px 18px -10px rgba(107, 87, 187, 0.9);
  --phone-shadow: 0 34px 80px -34px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 0 0 8px rgba(255, 255, 255, 0.04);
}

body {
  background:
    radial-gradient(120% 75% at 12% 0%, var(--glow-1) 0%, rgba(255, 255, 255, 0) 55%),
    radial-gradient(100% 65% at 92% 6%, var(--glow-2) 0%, rgba(255, 255, 255, 0) 62%),
    linear-gradient(165deg, var(--page-1) 0%, var(--page-2) 55%, var(--page-3) 100%);
}

.phone {
  background: linear-gradient(180deg, var(--phone-a) 0%, var(--phone-b) 100%);
  box-shadow: var(--phone-shadow);
}

.top { background: var(--top-bg); }

.bubble {
  background: var(--bubble-bg);
  color: var(--bubble-ink);
  border-color: var(--bubble-line);
  box-shadow: var(--bubble-shadow);
}

.row.me .bubble {
  background: linear-gradient(135deg, var(--me-a), var(--me-b));
  color: var(--me-ink);
  box-shadow: var(--me-shadow);
}

.composer { background: var(--composer-bg); }
.input-wrap { background: var(--input-bg); }
#input::placeholder { color: var(--ink-faint); }

.sheet { background: var(--sheet-bg); }
.char-item, .card-row, .mini, .icon-btn, .mic { background: var(--surface); }
.btn { background: var(--surface); }

.sep, .sys-text, .tag { background: var(--chip); }
.bubble .quote { border-left-color: var(--line); color: var(--ink-soft); }
.cq-close:hover { background: var(--chip); }
.rec-bar { background: var(--chip); }

body[data-theme="night"] .call-mini { background: linear-gradient(150deg, #3b3350, #2a2438); }
body[data-theme="night"] .vplay { background: rgba(255, 255, 255, 0.12); color: #f0eaff; }
body[data-theme="night"] .vbars i { background: rgba(255, 255, 255, 0.30); }
body[data-theme="night"] .vtext { border-top-color: var(--line); color: var(--ink-soft); }
body[data-theme="night"] .row.me .vtext { border-top-color: rgba(255, 255, 255, 0.35); color: rgba(255, 255, 255, 0.92); }
body[data-theme="night"] .emoji, body[data-theme="night"] .hint { color: rgba(240, 234, 255, 0.55); }

/* 主题选择 */
.theme-block { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.theme-block h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.theme-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.theme-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, transform 0.12s;
}
.theme-item:active { transform: scale(0.98); }
.theme-item.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(217, 138, 118, 0.12); }
.theme-dot {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.theme-dot.cream { background: linear-gradient(140deg, #fdf1e6, #e6a08c); }
.theme-dot.mint { background: linear-gradient(140deg, #e6fbf2, #6cbfa3); }
.theme-dot.strawberry { background: linear-gradient(140deg, #ffe6ee, #f08ba8); }
.theme-dot.night { background: linear-gradient(140deg, #4b3f6b, #211c2e); }

/* 主题细节：按钮、引用名、输入框等跟着主色走 */
.send, .btn.primary {
  background: linear-gradient(135deg, var(--me-a), var(--me-b));
  box-shadow: var(--me-shadow);
}
.quote .qname, .cq-name, .tag.trig { color: var(--accent-2); }
.badge { color: var(--accent-2); background: var(--chip); }
.tag { color: var(--ink-soft); }
.mic { color: var(--ink-soft); }
.mic:hover { background: var(--chip); color: var(--accent-2); }
.rec-bar { color: var(--accent-2); }
.rec-hint { color: var(--ink-soft); }
.rec-cancel { color: var(--accent-2); }
.theme-item.on { box-shadow: 0 0 0 3px var(--chip); }
.card-form textarea,
.card-form input[type="text"],
.card-form input[type="number"],
.card-form select { background: var(--input-bg); color: var(--ink); }
body[data-theme="night"] .card-row .txt { color: var(--ink); }
body[data-theme="night"] .card-form { background: rgba(255, 255, 255, 0.04); }
body[data-theme="night"] .card-form summary:hover { background: rgba(255, 255, 255, 0.06); }
body[data-theme="night"] .mini:hover { background: rgba(255, 255, 255, 0.08); }

.bubble .quote .qname { color: var(--accent-2); }


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

/* 头像设置 */
.avatar-block { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.avatar-block h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.avatar-row { display: flex; align-items: center; gap: 12px; }
.avatar-actions { display: flex; flex-direction: column; gap: 6px; }
.avatar-actions .btn { padding: 7px 12px; font-size: 12px; }

/* 拍一拍 */
.poke-block { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.poke-block h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.poke-row { display: flex; gap: 8px; }
.poke-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  color: var(--ink-soft);
}
.poke-field input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  outline: 0;
}
.poke-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--chip); }
#btnPoke { align-self: flex-start; }

/* 系统消息里的拍一拍 */
.row.sys.poke .sys-text {
  color: var(--accent-2);
  background: var(--chip);
  font-size: 11.5px;
}

/* 双击拍头像：别触发双击缩放 */
.ava { touch-action: manipulation; }

/* 拼字卡概率 */
.splice-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  font-size: 12px;
  color: var(--ink-soft);
}
.splice-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent-2);
  min-width: 60px;
}
.splice-row b {
  min-width: 38px;
  text-align: right;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
}

/* 提醒开关 */
.notify-block { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.notify-block h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.switch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
}
.switch-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-2);
}

/* 设置面板：分页 + 音色 */
.tabs {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab.on {
  background: linear-gradient(135deg, var(--me-a), var(--me-b));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
.panel { display: flex; flex-direction: column; gap: 12px; }

.sound-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--ink-soft);
}
.sound-row input[type="range"] {
  flex: 1;
  min-width: 60px;
  accent-color: var(--accent-2);
}
.sound-row b {
  min-width: 38px;
  text-align: right;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
}
.sound-row select {
  flex: 1;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
}
.verb-line { display: flex; gap: 6px; }
.verb-line input:first-child { max-width: 54px; text-align: center; }

.card-search {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  outline: 0;
}
.card-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--chip); }


/* ───────────── 主页 / 经期 ───────────── */
.view { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.back-btn { font-size: 22px; line-height: 1; padding: 0 2px; color: var(--ink-soft); }

.home-top { padding: 28px 20px 12px; }
.home-date { font-size: 11.5px; letter-spacing: 0.1em; color: var(--ink-soft); }
.home-title { margin: 8px 0 0; font-size: 27px; font-weight: 600; letter-spacing: 0.02em; }

.home-list { padding: 10px 16px; display: flex; flex-direction: column; gap: 10px; }
.home-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--bubble-shadow);
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s;
}
.home-card:active { transform: scale(0.985); }
.hc-icon {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}
.hc-icon.chat { background: linear-gradient(135deg, #f0a8bd, #d96f92); }
.hc-icon.period { background: linear-gradient(135deg, #f2b6c6, #cf6e86); }
.hc-icon.gear { background: linear-gradient(135deg, #b9a8e6, #8f76cc); }
.hc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hc-main b { font-size: 15px; }
.hc-main small { font-size: 11.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hc-arrow { color: var(--ink-faint); font-size: 18px; }
.home-hint { margin-top: auto; padding: 18px; text-align: center; font-size: 11px; color: var(--ink-faint); }

.sub-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--top-bg);
  backdrop-filter: blur(12px);
}
.sub-top h2 { flex: 1; margin: 0; font-size: 15.5px; font-weight: 600; text-align: center; }
.sub-spacer { width: 34px; }

.period-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.period-summary { display: flex; gap: 8px; }
.period-summary > div {
  flex: 1;
  padding: 12px 6px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.period-summary b { font-size: 18px; color: var(--accent-2); }
.period-summary small { font-size: 10.5px; color: var(--ink-soft); }
.period-status { text-align: center; font-size: 12px; color: var(--ink-soft); }

.cal { padding: 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-head b { font-size: 13px; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-week span { text-align: center; font-size: 10.5px; color: var(--ink-faint); padding: 4px 0; }
.cal-cell {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  font-size: 12px;
  border-radius: 10px;
  color: var(--ink);
  position: relative;
}
.cal-cell.mute { color: var(--ink-faint); opacity: 0.35; }
.cal-cell.done { background: linear-gradient(135deg, #f3a7bd, #d96f92); color: #fff; font-weight: 600; }
.cal-cell.pred { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent-2); }
.cal-cell.today::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-2);
}
.cal-legend { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 10.5px; color: var(--ink-soft); flex-wrap: wrap; }
.cal-legend .dot { width: 9px; height: 9px; display: inline-block; margin-left: 6px; }
.cal-legend .dot:first-child { margin-left: 0; }
.dot.done { background: #e88aa6; border-radius: 3px; }
.dot.pred { box-shadow: inset 0 0 0 1.5px var(--accent); border-radius: 50%; }
.dot.today { background: var(--accent-2); border-radius: 50%; }

.period-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.period-form label { display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; color: var(--ink-soft); }
.period-form input {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.period-list { display: flex; flex-direction: column; gap: 8px; }
.period-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  font-size: 12.5px;
}
.period-item .pi-main { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.period-item small { color: var(--ink-soft); font-size: 11px; }
.pi-del { border: 0; background: none; color: var(--danger); font-size: 11.5px; cursor: pointer; }

/* ───────────── 塔罗 / 掷筊 ───────────── */
.hc-icon.tarot { background: linear-gradient(135deg, #8d7bd6, #5d4a9c); }
.hc-icon.cups { background: linear-gradient(135deg, #d9a45b, #a9722c); }

.seg {
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: 13px;
  background: var(--chip);
}
.seg-btn {
  flex: 1;
  padding: 8px 6px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.seg-btn.on {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.tarot-body, .cups-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tarot-body textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  resize: none;
  outline: 0;
}

.tarot-cards { display: flex; gap: 8px; justify-content: center; min-height: 150px; }
.tcard {
  width: 92px;
  height: 148px;
  perspective: 700px;
  flex: none;
}
.tcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.3, 0.8, 0.3, 1);
}
.tcard.flipped .tcard-inner { transform: rotateY(180deg); }
.tcard-back, .tcard-front {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.tcard-back {
  background: linear-gradient(145deg, #6b5bb0, #3a2f63);
  color: #efe8ff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 26px;
}
.tcard-back::after {
  content: '✦';
  opacity: 0.55;
  font-size: 13px;
  margin-top: 6px;
}
.tcard-front {
  transform: rotateY(180deg);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 8px 6px;
  gap: 4px;
}
.tcard-front b { font-size: 13px; }
.tcard-front small { font-size: 10px; color: var(--ink-soft); line-height: 1.3; }
.tcard-front .rev { color: var(--danger); font-size: 10px; }
.tcard-front .num { font-size: 11px; color: var(--accent-2); }

.tarot-result { font-size: 12.5px; line-height: 1.65; color: var(--ink); }
.tarot-result .verdict {
  font-size: 19px;
  font-weight: 700;
  color: var(--accent-2);
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}
.tarot-result .pos { margin-top: 8px; }
.tarot-result .pos b { color: var(--accent-2); margin-right: 4px; }
.tarot-result .empty { color: var(--ink-faint); font-size: 12px; text-align: center; padding: 10px 0; }

.cups-tip { margin: 0; text-align: center; font-size: 12px; line-height: 1.7; color: var(--ink-soft); }
.cups-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 30px 0 18px;
  perspective: 800px;
}
.cup {
  width: 96px;
  height: 96px;
  transform-style: preserve-3d;
}
.cup-face {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 45%),
    linear-gradient(160deg, #f0d7ab, #c99a5f);
  box-shadow: inset 0 -6px 12px rgba(120, 70, 20, 0.35), 0 8px 16px rgba(80, 40, 10, 0.18);
  border: 1px solid rgba(150, 100, 40, 0.35);
  position: relative;
}
.cup-face::after {
  content: '';
  position: absolute;
  left: 18%;
  right: 18%;
  top: 46%;
  height: 3px;
  border-radius: 2px;
  background: rgba(120, 80, 30, 0.45);
}
.cup[data-side="round"] .cup-face {
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 45%),
    linear-gradient(160deg, #b98347, #8a5a26);
}
.cup[data-side="round"] .cup-face::after { opacity: 0; }

@keyframes cup-toss {
  0%   { transform: translateY(0) rotateX(0deg) rotateZ(0deg); }
  30%  { transform: translateY(-120px) rotateX(420deg) rotateZ(18deg); }
  62%  { transform: translateY(-30px) rotateX(700deg) rotateZ(-10deg); }
  80%  { transform: translateY(-58px) rotateX(calc(720deg + var(--final))) rotateZ(6deg); }
  100% { transform: translateY(0) rotateX(calc(720deg + var(--final))) rotateZ(0deg); }
}
.cup.tossing .cup-face { animation: cup-toss 1.25s cubic-bezier(0.22, 0.9, 0.28, 1) forwards; }

.cups-result { text-align: center; font-size: 12.5px; line-height: 1.7; color: var(--ink-soft); }
.cups-result .name { font-size: 22px; font-weight: 700; color: var(--accent-2); letter-spacing: 0.12em; }
.cups-result .verdict { font-size: 13px; margin: 2px 0 6px; }

/* 圣杯质感微调 */
.cups-stage { position: relative; }
.cups-stage::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 10px;
  width: 210px;
  height: 18px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(120, 80, 40, 0.22), rgba(120, 80, 40, 0) 70%);
  filter: blur(2px);
  pointer-events: none;
}
.cup { filter: drop-shadow(0 6px 10px rgba(90, 55, 20, 0.18)); }
.cups-result { animation: fade-up 0.35s ease both; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 圣杯：新月形木块，两面不同 */
.cup { position: relative; }
.cup-half {
  position: absolute;
  inset: 0;
  display: block;
  backface-visibility: hidden;
}
.cup-half svg { width: 100%; height: 100%; overflow: visible; }
/* 渐变由 SVG 提供，这里不再设 fill */
/* 渐变由 SVG 提供 */
.cup-half .rim { fill: none; stroke: rgba(255, 248, 232, 0.8); stroke-width: 1.6; stroke-linecap: round; }
.cup-half .gloss { fill: rgba(255, 255, 255, 0.28); }
.cup-half .edge { stroke: rgba(60, 35, 10, 0.25); stroke-width: 0.8; }
.cup-half.round .grain { display: none; }
.cup-half.round { transform: rotateX(180deg); }

@keyframes cup-toss {
  0%   { transform: translateY(0) rotateX(0deg) rotateZ(0deg); }
  30%  { transform: translateY(-122px) rotateX(420deg) rotateZ(16deg); }
  62%  { transform: translateY(-26px) rotateX(700deg) rotateZ(-9deg); }
  80%  { transform: translateY(-56px) rotateX(calc(720deg + var(--final, 0deg))) rotateZ(5deg); }
  100% { transform: translateY(0) rotateX(calc(720deg + var(--final, 0deg))) rotateZ(0deg); }
}
.cup.tossing { animation: cup-toss 1.25s cubic-bezier(0.22, 0.9, 0.28, 1) forwards; }

/* ───────────── ins 风装饰 ───────────── */
:root {
  --deco-1: #f7d6c6;
  --deco-2: #e6d9f7;
  --deco-3: #d98a76;
}
body[data-theme="mint"] { --deco-1: #c9e9d8; --deco-2: #d7e9ff; --deco-3: #4e9c83; }
body[data-theme="strawberry"] { --deco-1: #ffd0e1; --deco-2: #e2d8ff; --deco-3: #d96a8c; }
body[data-theme="night"] { --deco-1: #4b3b73; --deco-2: #2b4a52; --deco-3: #b49bf0; }

.deco {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.phone > .view { position: relative; z-index: 1; }

.d-blob { position: absolute; border-radius: 50%; filter: blur(30px); }
.d-blob.b1 { width: 240px; height: 240px; top: -80px; right: -90px; background: var(--deco-1); opacity: 0.6; }
.d-blob.b2 { width: 280px; height: 280px; bottom: -100px; left: -120px; background: var(--deco-2); opacity: 0.5; }

.d-doodle {
  position: absolute;
  font-size: 16px;
  line-height: 1;
  color: var(--deco-3);
  opacity: 0.45;
  animation: drift 9s ease-in-out infinite;
}
.d-doodle.d1 { top: 108px; left: 22px; animation-delay: -1s; }
.d-doodle.d2 { top: 168px; right: 26px; font-size: 14px; animation-delay: -3.4s; }
.d-doodle.d3 { bottom: 220px; right: 32px; font-size: 15px; animation-delay: -5.2s; }
.d-doodle.d4 { bottom: 150px; left: 26px; font-size: 13px; animation-delay: -2.2s; }
.d-doodle.d5 { top: 250px; left: 44px; font-size: 15px; opacity: 0.3; animation-delay: -4.1s; }

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

.d-grain {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}
body[data-theme="night"] .d-grain { opacity: 0.07; mix-blend-mode: screen; }

/* 未读角标 */
.hc-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff7ea8, #ee4a80);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  box-shadow: 0 3px 8px rgba(238, 74, 128, 0.35);
  flex: none;
}

/* 主页小装饰 */
.home-date {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}
.home-title {
  position: relative;
  display: inline-block;
}
.home-title::after {
  content: '';
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: -4px;
  height: 6px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--deco-1), var(--deco-2));
  opacity: 0.7;
}
.home-card { position: relative; }
.home-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(120deg, var(--deco-1), transparent 46%);
  opacity: 0.14;
  pointer-events: none;
}
.home-card > * { position: relative; }

/* 再补两笔装订感 */
.d-ring {
  position: absolute;
  top: 74px;
  right: -34px;
  width: 128px;
  height: 128px;
  border: 1.5px dashed var(--deco-3);
  border-radius: 50%;
  opacity: 0.22;
  transform: rotate(-12deg);
  animation: spin-slow 40s linear infinite;
}
@keyframes spin-slow { to { transform: rotate(348deg); } }
.d-doodle { opacity: 0.55; font-size: 18px; }
.d-doodle.d4, .d-doodle.d5 { opacity: 0.4; }
.home-card:first-child::after {
  content: '';
  position: absolute;
  top: -7px;
  left: 50%;
  width: 62px;
  height: 14px;
  margin-left: -31px;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--deco-1) 0 6px, rgba(255, 255, 255, 0.55) 6px 12px);
  opacity: 0.65;
  transform: rotate(-2.5deg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* 塔罗牌面 */
.tcard-front { padding: 0; overflow: hidden; justify-content: flex-end; }
.tcard-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tcard-img.reversed { transform: rotate(180deg); }
.tcard-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  z-index: 1;
}
.tcard-tag {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
}
.tcard-tag.rev { background: rgba(190, 60, 70, 0.85); }

/* 掷筊落地 */
.impact-ring {
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: 46px;
  height: 16px;
  margin-left: -23px;
  border-radius: 50%;
  border: 2px solid rgba(160, 105, 45, 0.55);
  opacity: 0;
  pointer-events: none;
}
.cups-stage.impact .impact-ring { animation: impact-ring 0.6s ease-out; }
@keyframes impact-ring {
  0% { opacity: 0.85; transform: scale(0.5); }
  100% { opacity: 0; transform: scale(2.4); }
}
.cups-stage.shake { animation: cup-shake 0.32s ease-in-out; }
@keyframes cup-shake {
  0%, 100% { transform: translate(0, 0); }
  30% { transform: translate(2px, -2px); }
  60% { transform: translate(-2px, 1px); }
  80% { transform: translate(1px, -1px); }
}

/* 塔罗牌面排版 */
.tarot-cards { display: flex; gap: 10px; justify-content: center; align-items: flex-start; }
.tcard-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
#tarotCards.single .tcard { width: 152px; height: 267px; }
.tcard-cap { font-size: 10px; color: var(--ink-soft); letter-spacing: 0.02em; }
.tcard-cap i { font-style: normal; }
.tcard-cap i.rev { color: var(--danger); }

/* 圣杯质感 */
.cup { width: 104px; height: 104px; }
.cup-half svg { filter: drop-shadow(0 3px 4px rgba(120, 80, 30, 0.18)); }
.cup-half.flat .wood { stroke: rgba(120, 80, 40, 0.35); stroke-width: 0.8; }
.cup-half.round .wood { stroke: rgba(80, 45, 10, 0.4); stroke-width: 0.8; }

/* 次级控件降低存在感：不抢主内容，仍可读 */
.tab { opacity: 0.72; transition: opacity 0.15s; }
.tab.on { opacity: 1; }
.seg-btn { opacity: 0.62; transition: opacity 0.15s; }
.seg-btn.on { opacity: 1; }
.btn.ghost { opacity: 0.76; transition: opacity 0.15s; }
.btn.ghost:hover, .btn.ghost:active { opacity: 1; }
.icon-btn.ghost { opacity: 0.6; }
.theme-item { opacity: 0.8; }
.theme-item.on { opacity: 1; }
.card-tools .btn { opacity: 0.7; }
.pi-del { opacity: 0.7; }
.hc-arrow { opacity: 0.55; }
.back-btn { opacity: 0.6; }
.card-row .card-edit { opacity: 0.65; }
.chk, .switch-row { opacity: 0.92; }

/* ───────────── 游戏 ───────────── */
.hc-icon.games { background: linear-gradient(135deg, #8fc3e8, #5b8fc4); }

.game-lobby { flex: 1; overflow-y: auto; padding: 14px 16px 26px; display: flex; flex-direction: column; gap: 10px; }
.game-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--bubble-shadow);
  cursor: pointer;
  text-align: left;
}
.g-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--chip); font-size: 19px; flex: none; }
.g-main { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.g-main b { font-size: 14px; }
.g-main small { font-size: 11px; color: var(--ink-soft); }
.g-arrow { color: var(--ink-faint); font-size: 17px; opacity: 0.6; }

.game-top { display: flex; align-items: center; gap: 8px; padding: 12px 16px 6px; }
.turn {
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--ink-soft);
  white-space: nowrap;
}
.turn.me { background: rgba(240, 139, 168, 0.22); color: var(--accent-2); font-weight: 600; }
.turn.them { background: rgba(160, 140, 220, 0.2); color: #7d5ca8; }
.turn.done { background: var(--chip); color: var(--ink-soft); }
.game-hud { flex: 1; text-align: right; font-size: 11.5px; color: var(--ink-soft); }
.game-stage { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 16px 0; }
.game-msg { padding: 10px 16px 20px; font-size: 12px; line-height: 1.6; color: var(--ink-soft); min-height: 22px; }

.mine-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 3px; }
.mine-cell {
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.mine-cell.open { background: var(--chip); cursor: default; }
.mine-cell.boom { background: #ffd5de; }
.mine-cell[data-n="1"] { color: #5b8fc4; }
.mine-cell[data-n="2"] { color: #5f9c78; }
.mine-cell[data-n="3"] { color: #c9705f; }
.mine-cell[data-n="4"] { color: #8a6bbf; }

.sudoku-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  gap: 0;
}
.sud-cell {
  aspect-ratio: 1 / 1;
  border: 0;
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.sud-cell.fixed { background: rgba(0, 0, 0, 0.04); color: var(--ink); font-weight: 700; }
.sud-cell.sel { background: rgba(240, 139, 168, 0.28); }
.sud-cell.br { border-right: 2px solid var(--accent); }
.sud-cell:nth-child(9n) { border-right: 0; }
.sud-cell:nth-child(n+73) { border-bottom: 0; }
.sud-cell.bb { border-bottom: 2px solid var(--accent); }
.sud-pad { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; margin-top: 10px; }
.sud-num {
  padding: 8px 0;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.match-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.match-cell {
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  transition: transform 0.12s;
}
.match-cell:active { transform: scale(0.94); }
.match-cell.dead { background: transparent; box-shadow: inset 0 0 0 1px var(--line); cursor: default; }

.link-grid { display: grid; gap: 3px; }
.link-cell {
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.link-cell.empty { visibility: hidden; }
.link-cell.sel { background: rgba(240, 139, 168, 0.3); border-color: var(--accent); }

.brk-canvas { width: 100%; border-radius: 14px; background: var(--surface); touch-action: none; display: block; }

/* ───────────── 游戏动效 / 难度 ───────────── */
.diff-bar {
  display: flex;
  gap: 6px;
  padding: 8px 16px 0;
}
.diff-btn {
  flex: 1;
  padding: 7px 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s, transform 0.1s;
}
.diff-btn.on {
  opacity: 1;
  font-weight: 600;
  color: var(--accent-2);
  border-color: var(--accent);
  background: rgba(240, 139, 168, 0.14);
}
.diff-btn:active, .game-card:active, .sud-num:active, .mine-cell:active, .link-cell:active, .match-cell:active {
  transform: scale(0.95);
}

.game-stage { position: relative; }

@keyframes cell-pop {
  0% { transform: scale(0.72); opacity: 0.25; }
  60% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.mine-cell.pop, .sud-cell.pop { animation: cell-pop 0.28s ease-out; }

@keyframes shake-x {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-4px); }
  45% { transform: translateX(4px); }
  68% { transform: translateX(-2px); }
  84% { transform: translateX(2px); }
}
.mine-grid.shake, .sudoku-grid.shake, .brk-canvas.shake { animation: shake-x 0.32s ease-in-out; }

@keyframes boom-flash {
  0% { background: #ffb9c8; transform: scale(0.9); }
  60% { background: #ffd5de; transform: scale(1.05); }
  100% { background: #ffe9ee; transform: scale(1); }
}
.mine-cell.boom { animation: boom-flash 0.5s ease-out; }

@keyframes clear-out {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.15) rotate(12deg); opacity: 0; }
}
.match-cell.clearing { animation: clear-out 0.19s ease-in forwards; }

@keyframes drop-in {
  0% { transform: translateY(-18px); opacity: 0.35; }
  70% { transform: translateY(3px); opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}
.match-cell.drop { animation: drop-in 0.3s ease-out; }

.link-line {
  position: absolute;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: 0 50%;
  pointer-events: none;
  z-index: 4;
  animation: line-fade 0.46s ease-out forwards;
  box-shadow: 0 0 8px rgba(240, 139, 168, 0.6);
}
@keyframes line-fade {
  0% { opacity: 0; transform-origin: 0 50%; }
  20% { opacity: 1; }
  100% { opacity: 0; }
}

.turn.me { animation: turn-glow 2.4s ease-in-out infinite; }
@keyframes turn-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 139, 168, 0.35); }
  50% { box-shadow: 0 0 0 5px rgba(240, 139, 168, 0); }
}
.turn.them::after {
  content: '…';
  display: inline-block;
  width: 10px;
  animation: dots 1.2s steps(3, end) infinite;
  overflow: hidden;
  vertical-align: bottom;
}
@keyframes dots {
  0% { width: 0; }
  100% { width: 10px; }
}

/* 胜利提示 & 横屏打砖块 */
.brk-hint { margin: 8px 0 0; text-align: center; font-size: 11px; color: var(--ink-faint); }
.brk-canvas { max-height: 62vh; }

.game-win {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(60, 40, 55, 0.26);
  backdrop-filter: blur(3px);
  z-index: 30;
}
.gw-card {
  position: relative;
  width: 100%;
  max-width: 300px;
  padding: 22px 20px 18px;
  border-radius: 22px;
  background: var(--surface);
  text-align: center;
  box-shadow: 0 18px 50px rgba(90, 50, 70, 0.25);
  transform: scale(0.9);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.2, 1.3, 0.4, 1), opacity 0.2s;
  overflow: hidden;
}
.game-win.show .gw-card { transform: scale(1); opacity: 1; }
.gw-emoji { font-size: 40px; line-height: 1; animation: gw-pop 0.5s ease-out; }
@keyframes gw-pop {
  0% { transform: scale(0.4); }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.gw-card h3 { margin: 10px 0 6px; font-size: 18px; }
.gw-card p { margin: 0 0 16px; font-size: 12.5px; line-height: 1.65; color: var(--ink-soft); }
.gw-actions { display: flex; gap: 8px; }
.gw-actions .btn { flex: 1; }

.confetti {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  opacity: 0.9;
  animation: confetti-fall 1.5s ease-in forwards;
  pointer-events: none;
}
@keyframes confetti-fall {
  to { transform: translateY(360px) rotate(540deg); opacity: 0; }
}

/* ───────────── 天气 / 备忘录 ───────────── */
.hc-icon.weather { background: linear-gradient(135deg, #9fd0f0, #5f9fd0); }
.hc-icon.memo { background: linear-gradient(135deg, #f5c98a, #d99a4e); }

.weather-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.weather-card {
  padding: 22px 18px;
  border-radius: 22px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.95), rgba(255, 240, 246, 0.55));
  border: 1px solid var(--line);
  text-align: center;
  box-shadow: var(--bubble-shadow);
}
.w-city { font-size: 13px; color: var(--ink-soft); letter-spacing: 0.04em; }
.w-main { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 8px 0 2px; }
.w-emoji { font-size: 46px; line-height: 1; }
.w-temp { font-size: 54px; font-weight: 300; letter-spacing: -2px; }
.w-desc { font-size: 14px; color: var(--ink); }
.w-range { margin-top: 8px; font-size: 12px; color: var(--ink-soft); }
.weather-line {
  margin: 0;
  padding: 13px 15px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px dashed var(--line);
  font-size: 13px;
  line-height: 1.7;
}

.memo-body { flex: 1; overflow-y: auto; padding: 14px 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.memo-add { display: flex; gap: 8px; }
.memo-add input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  outline: 0;
}
.memo-list { display: flex; flex-direction: column; gap: 8px; }
.memo-item {
  display: flex;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 4px 10px rgba(90, 60, 70, 0.04);
}
.memo-item.mine { background: rgba(240, 139, 168, 0.1); }
.memo-main { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.memo-main p { margin: 0; font-size: 13.5px; line-height: 1.5; word-break: break-word; }
.memo-main small { font-size: 10.5px; color: var(--ink-soft); }

/* 打砖块：竖屏提示 */
.brk-rotate {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  background: var(--surface);
  border-radius: 16px;
  z-index: 5;
  text-align: center;
}
.brk-rotate .rot-icon { font-size: 46px; animation: rot-hint 2s ease-in-out infinite; }
@keyframes rot-hint {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(90deg); }
}
.brk-rotate p { margin: 0; font-size: 13px; color: var(--ink-soft); line-height: 1.7; }
@media (orientation: portrait) {
  .brk-rotate { display: flex; }
  .game-stage.allow-portrait .brk-rotate { display: none; }
}
