:root {
  --bg: #ededed;
  --panel: #ffffff;
  --bubble-me: #95ec69;
  --bubble-them: #ffffff;
  --text: #111111;
  --muted: #999999;
  --link: #576b95;
  --border: #e5e5e5;
  --avatar-me: #7bed9f;
  --avatar-them: #c8d6e5;
  --maxw: 480px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.5;
}

.app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: #f7f7f7;
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  flex: 1;
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  text-align: center;
}

.topbar .back {
  color: var(--link);
  text-decoration: none;
  min-width: 48px;
}

.topbar .spacer { min-width: 48px; }

.topbar-action {
  min-width: 64px;
  margin: 0;
  padding: 4px 0;
  border: none;
  background: transparent;
  color: var(--link);
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  text-align: right;
  white-space: nowrap;
}

.topbar-action:active {
  opacity: 0.65;
}

.site-nicks {
  margin: 0;
  padding: 0 14px 10px;
  background: #f7f7f7;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.search-wrap { padding: 10px 14px 12px; background: #f7f7f7; }

.search-wrap input {
  width: 100%;
  border: none;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  font-size: 16px;
  outline: none;
}

.day-list, .segment-list, .search-results, .messages, .empty, .error {
  flex: 1;
}

.list-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 6px 16px;
  background: var(--bg);
}

.list-section-title {
  padding: 0;
  font-size: 13px;
  color: var(--muted);
  background: transparent;
}

.list-section > .list-section-title {
  padding: 10px 16px 6px;
}

.day-sort-btn {
  flex-shrink: 0;
  margin: 0;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--link);
  font: inherit;
  font-size: 12px;
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
}

.day-sort-btn:active {
  opacity: 0.7;
}

.day-item.segment-item .title {
  color: #1a1a1a;
}

.segment-badge {
  display: inline-block;
  margin-right: 4px;
  padding: 0 5px;
  border-radius: 3px;
  background: #ffe08a;
  color: #8a6d1d;
  font-size: 11px;
  font-weight: 500;
  vertical-align: middle;
}

.seg-banner {
  margin: 0 12px 8px;
  padding: 10px 12px;
  background: #fff8e6;
  border-radius: 8px;
  font-size: 13px;
  color: #666;
}

.seg-context-nav {
  padding-top: 12px;
  padding-bottom: 12px;
}

.seg-context-top {
  padding-bottom: 16px;
}

.seg-context-bottom {
  padding-top: 20px;
}

.msg-flash {
  animation: msg-flash 1.2s ease;
}

@keyframes msg-flash {
  0%,
  100% {
    background: transparent;
  }
  30% {
    background: rgba(149, 236, 105, 0.35);
  }
}

/* 从片段跳到完整记录时，接上位置的渐隐提示条 */
.seg-junction {
  margin: 6px -12px 10px;
  text-align: center;
  pointer-events: none;
}

.seg-junction-fade {
  height: 36px;
  background: linear-gradient(
    180deg,
    rgba(255, 196, 0, 0.72) 0%,
    rgba(255, 196, 0, 0.28) 45%,
    rgba(255, 196, 0, 0) 100%
  );
  animation: seg-junction-in 1.8s ease;
}

.seg-junction-label {
  display: inline-block;
  margin-top: -6px;
  padding: 3px 10px;
  border-radius: 10px;
  background: rgba(255, 196, 0, 0.95);
  color: #5c4700;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  animation: seg-junction-label-in 1.8s ease;
}

.row.msg-junction {
  position: relative;
}

.row.msg-junction::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -4px;
  bottom: -4px;
  border-radius: 6px;
  background: rgba(255, 196, 0, 0.12);
  pointer-events: none;
  animation: msg-flash 1.6s ease;
}

@keyframes seg-junction-in {
  0% {
    opacity: 0;
    transform: translateY(-6px);
  }
  20% {
    opacity: 1;
    transform: translateY(0);
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0.85;
  }
}

@keyframes seg-junction-label-in {
  0% {
    opacity: 0;
    transform: scale(0.92);
  }
  25% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 1;
  }
}

.day-item, .hit-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--panel);
  border-bottom: 1px solid #f0f0f0;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.day-item:hover, .hit-item:hover { background: #fafafa; }

.day-item .title, .hit-item .title {
  font-weight: 500;
  font-size: 17px;
}
.day-item .meta, .hit-item .meta {
  margin-top: 4px;
  font-size: 15px;
  color: var(--muted);
}
.chevron { color: #bbb; }

.messages { padding: 12px 12px 28px; }

.chat-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 56px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 16px;
}

.chat-loading-spin {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(0, 0, 0, 0.08);
  border-top-color: var(--link);
  border-radius: 50%;
  animation: chat-spin 0.75s linear infinite;
}

.chat-loading span {
  animation: chat-loading-pulse 1.2s ease-in-out infinite;
}

@keyframes chat-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes chat-loading-pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

body.page-leaving .app {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

/* 换天时禁止浏览器「滚动锚定」把视口粘在底部 */
html {
  overflow-anchor: none;
}
.messages,
.messages * {
  overflow-anchor: none;
}

.time-sep {
  text-align: center;
  margin: 14px 0 10px;
}

.time-sep span {
  display: inline-block;
  background: rgba(0, 0, 0, 0.08);
  color: #666;
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 4px;
}

.row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: flex-start;
  position: relative;
}

.row.me { flex-direction: row-reverse; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  background-color: var(--avatar-them);
}

.row.me .avatar { background-color: var(--avatar-me); }

.msg-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 70%;
  min-width: 0;
}

.row.me .msg-col {
  align-items: flex-end;
}

.msg-name {
  margin: 0 0 3px 2px;
  font-size: 12px;
  line-height: 1.2;
  color: #888;
}

.bubble {
  max-width: 100%;
  padding: 9px 11px;
  border-radius: 4px;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.row.them .bubble { background: var(--bubble-them); }
.row.me .bubble { background: var(--bubble-me); }

.bubble-img {
  padding: 4px;
  background: transparent !important;
  box-shadow: none;
  max-width: 100%;
  /* 固定占位宽，避免图还没回来时宽度为 0 */
  width: min(220px, 70vw);
}

.chat-img {
  display: block;
  width: 100%;
  max-width: 220px;
  /* 加载前就占住高度；加载后 contain 填入，不再把下面对话顶跑 */
  aspect-ratio: 3 / 4;
  height: auto;
  object-fit: contain;
  object-position: center;
  background: #e4e4e4;
  border-radius: 4px;
  vertical-align: middle;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}

/* 全屏看图 */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  padding: 16px;
  cursor: zoom-out;
  -webkit-tap-highlight-color: transparent;
}

.img-lightbox[hidden] {
  display: none !important;
}

.img-lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 2px;
  cursor: zoom-out;
  user-select: none;
  -webkit-user-drag: none;
}

.img-lightbox-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

body.lightbox-open {
  overflow: hidden;
}

/* —— 首页入口 —— */
body[data-page="home"] {
  min-height: 100%;
  min-height: 100dvh;
}

.app.app-home {
  min-height: 100%;
  min-height: 100dvh;
  padding: 0 0 env(safe-area-inset-bottom, 0px);
  background: linear-gradient(180deg, #f3f6f4 0%, #ededed 42%, #e8ece9 100%);
}

.app-home > .topbar {
  flex-shrink: 0;
  position: relative;
}

.app-home > .home-gates {
  flex-shrink: 0;
  padding: 10px 12px 4px;
  gap: 10px;
}

.home-gates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px 14px 6px;
  perspective: 720px;
}

.home-gate {
  --gate-mx: 50%;
  --gate-my: 50%;
  --gate-rx: 0deg;
  --gate-ry: 0deg;
  position: relative;
  display: block;
  isolation: isolate;
  overflow: hidden;
  min-height: 92px;
  padding: 1px;
  text-decoration: none;
  color: inherit;
  border-radius: 16px;
  border: none;
  background: transparent;
  box-shadow: none;
  transform: translate3d(0, 0, 0) rotateX(var(--gate-rx)) rotateY(var(--gate-ry));
  transform-style: preserve-3d;
  transition:
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.35s ease;
  animation: home-gate-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  -webkit-tap-highlight-color: transparent;
}

.home-gate:nth-child(2) {
  animation-delay: 0.06s;
}

.home-gate:nth-child(3) {
  animation-delay: 0.12s;
}

.home-gate:nth-child(4) {
  animation-delay: 0.18s;
}

.home-gate:nth-child(5) {
  animation-delay: 0.24s;
}

.home-gate:nth-child(6) {
  animation-delay: 0.3s;
}

@keyframes home-gate-in {
  from {
    opacity: 0;
    transform: translate3d(0, 14px, 0) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.home-gate-fx {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 0;
  background:
    radial-gradient(
      120px 80px at var(--gate-mx) var(--gate-my),
      rgba(255, 255, 255, 0.55),
      transparent 70%
    ),
    linear-gradient(145deg, #f8fbf9 0%, #eef5f1 48%, #e7efea 100%);
  transition: background 0.25s ease;
}

.home-gate-fx::before {
  content: "";
  position: absolute;
  inset: -55%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    transparent 62%,
    rgba(7, 193, 96, 0.55) 72%,
    rgba(34, 160, 120, 0.35) 78%,
    transparent 88%
  );
  animation: home-gate-spin 4.8s linear infinite;
  opacity: 0.55;
  will-change: transform;
}

.home-gate-fx::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 15px;
  background: inherit;
  background:
    radial-gradient(
      120px 80px at var(--gate-mx) var(--gate-my),
      rgba(255, 255, 255, 0.5),
      transparent 70%
    ),
    linear-gradient(145deg, #f8fbf9 0%, #eef5f1 48%, #e7efea 100%);
  z-index: 1;
}

.home-gate-archive .home-gate-fx::after {
  background:
    radial-gradient(
      130px 90px at var(--gate-mx) var(--gate-my),
      rgba(255, 255, 255, 0.58),
      transparent 68%
    ),
    linear-gradient(150deg, #f4faf6 0%, #e8f4ee 42%, #dceee4 100%);
}

.home-gate-novel .home-gate-fx::before {
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    transparent 60%,
    rgba(176, 122, 68, 0.55) 72%,
    rgba(120, 92, 58, 0.3) 80%,
    transparent 90%
  );
}

.home-gate-novel .home-gate-fx::after {
  background:
    radial-gradient(
      130px 90px at var(--gate-mx) var(--gate-my),
      rgba(255, 252, 246, 0.62),
      transparent 68%
    ),
    linear-gradient(150deg, #fbf7f1 0%, #f3ebe0 45%, #ebe0d2 100%);
}

@keyframes home-gate-spin {
  to {
    transform: rotate(360deg);
  }
}

.home-gate-shine {
  position: absolute;
  inset: 1px;
  border-radius: 15px;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.home-gate-shine::before {
  content: "";
  position: absolute;
  top: -30%;
  left: -40%;
  width: 45%;
  height: 160%;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255, 255, 255, 0.55) 48%,
    transparent 62%
  );
  transform: translateX(-120%) skewX(-18deg);
  animation: home-gate-sheen 5.2s ease-in-out infinite;
}

.home-gate:nth-child(2) .home-gate-shine::before {
  animation-delay: 1.2s;
}

.home-gate:nth-child(3) .home-gate-shine::before {
  animation-delay: 2.2s;
}

.home-gate:nth-child(4) .home-gate-shine::before {
  animation-delay: 3.1s;
}

.home-gate:nth-child(5) .home-gate-shine::before {
  animation-delay: 3.8s;
}

.home-gate:nth-child(6) .home-gate-shine::before {
  animation-delay: 4.5s;
}

@keyframes home-gate-sheen {
  0%,
  55% {
    transform: translateX(-140%) skewX(-18deg);
  }
  75%,
  100% {
    transform: translateX(320%) skewX(-18deg);
  }
}

.home-gate-orb {
  position: absolute;
  right: -18px;
  top: -22px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(
    circle at 35% 35%,
    rgba(7, 193, 96, 0.28),
    rgba(7, 193, 96, 0.04) 62%,
    transparent 72%
  );
  filter: blur(0.2px);
  animation: home-gate-orb 6s ease-in-out infinite;
}

.home-gate-novel .home-gate-orb {
  background: radial-gradient(
    circle at 35% 35%,
    rgba(176, 122, 68, 0.28),
    rgba(176, 122, 68, 0.05) 62%,
    transparent 72%
  );
  animation-delay: -2s;
}

.home-gate-test .home-gate-fx::before {
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    transparent 60%,
    rgba(47, 128, 168, 0.55) 72%,
    rgba(36, 98, 132, 0.3) 80%,
    transparent 90%
  );
}

.home-gate-test .home-gate-fx::after {
  background:
    radial-gradient(
      130px 90px at var(--gate-mx) var(--gate-my),
      rgba(255, 255, 255, 0.58),
      transparent 68%
    ),
    linear-gradient(150deg, #f3f8fb 0%, #e6f0f6 45%, #d7e7f0 100%);
}

.home-gate-test .home-gate-orb {
  background: radial-gradient(
    circle at 35% 35%,
    rgba(47, 128, 168, 0.28),
    rgba(47, 128, 168, 0.05) 62%,
    transparent 72%
  );
  animation-delay: -3.2s;
}

.home-gate-board .home-gate-fx::before {
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    transparent 60%,
    rgba(196, 98, 110, 0.55) 72%,
    rgba(150, 72, 84, 0.28) 80%,
    transparent 90%
  );
}

.home-gate-board .home-gate-fx::after {
  background:
    radial-gradient(
      130px 90px at var(--gate-mx) var(--gate-my),
      rgba(255, 252, 252, 0.6),
      transparent 68%
    ),
    linear-gradient(150deg, #fbf4f5 0%, #f4e6e8 45%, #edd9dc 100%);
}

.home-gate-board .home-gate-orb {
  background: radial-gradient(
    circle at 35% 35%,
    rgba(196, 98, 110, 0.26),
    rgba(196, 98, 110, 0.05) 62%,
    transparent 72%
  );
  animation-delay: -4.4s;
}

@keyframes home-gate-orb {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.85;
  }
  50% {
    transform: translate(-10px, 8px) scale(1.12);
    opacity: 1;
  }
}

.home-gate-body {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px 14px 14px;
  min-height: 90px;
}

.home-gate-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-bottom: 4px;
  border-radius: 9px;
  color: #1f8f55;
  background: rgba(7, 193, 96, 0.12);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), background 0.25s ease;
}

.home-gate-novel .home-gate-icon {
  color: #8a6234;
  background: rgba(176, 122, 68, 0.14);
}

.home-gate-test .home-gate-icon {
  color: #2a6f94;
  background: rgba(47, 128, 168, 0.14);
}

.home-gate-board .home-gate-icon {
  color: #a84d5a;
  background: rgba(196, 98, 110, 0.14);
}

.home-gate-title {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.25;
}

.home-gate-archive .home-gate-title {
  color: #163528;
}

.home-gate-novel .home-gate-title {
  color: #3a2a18;
}

.home-gate-test .home-gate-title {
  color: #1a3f54;
}

.home-gate-board .home-gate-title {
  color: #4a2430;
}

.home-gate-desc {
  font-size: 12px;
  color: #7a8a82;
  line-height: 1.4;
}

.home-gate-novel .home-gate-desc {
  color: #9a8770;
}

.home-gate-test .home-gate-desc {
  color: #6e8796;
}

.home-gate-board .home-gate-desc {
  color: #9a7580;
}

.home-gate-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 5;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #fa5151;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.home-gate-dot {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 5;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fa5151;
  border: 2px solid #fff;
  box-sizing: content-box;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.home-gate-dot[hidden] {
  display: none !important;
}

.home-gate:hover,
.home-gate:focus-visible {
  transform: translate3d(0, -2px, 0) rotateX(var(--gate-rx)) rotateY(var(--gate-ry));
  filter: brightness(1.02);
  outline: none;
}

.home-gate:hover .home-gate-icon,
.home-gate:focus-visible .home-gate-icon {
  transform: translateY(-1px) scale(1.06);
}

.home-gate:active {
  transform: scale(0.985) rotateX(0deg) rotateY(0deg);
  filter: none;
}

@media (prefers-reduced-motion: reduce) {
  .home-gate,
  .home-gate-fx::before,
  .home-gate-shine::before,
  .home-gate-orb {
    animation: none !important;
  }
  .home-gate {
    transform: none !important;
    transition: none;
  }
}

.home-marquee {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 12px 0;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid #f0d9a8;
  background: linear-gradient(90deg, #fff9ef 0%, #fff6e6 50%, #fff9ef 100%);
  overflow: hidden;
}

.home-marquee-tag {
  flex-shrink: 0;
  padding: 2px 7px;
  border-radius: 6px;
  background: #e8a23a;
  color: #fff;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.home-marquee-viewport {
  --mq-line: 22px;
  flex: 1;
  min-width: 0;
  height: var(--mq-line);
  overflow: hidden;
  mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
  -webkit-mask-image: linear-gradient(
    180deg,
    transparent,
    #000 18%,
    #000 82%,
    transparent
  );
}

.home-marquee-track {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  animation: home-marquee-scroll 36s linear infinite;
  will-change: transform;
}

.home-marquee-track:hover {
  animation-play-state: paused;
}

.home-marquee-item {
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--mq-line, 22px);
  flex-shrink: 0;
  font-size: 12.5px;
  color: #5c4a2e;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-marquee-item .nm {
  font-weight: 650;
  color: #3d2f18;
}

.home-marquee-item .amt {
  font-weight: 700;
  color: #c45c12;
}

@keyframes home-marquee-scroll {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-marquee-track {
    animation: none;
    transform: none;
  }
}

/* AI 入口卡片：通栏，左右与上方入口对齐 */
.home-gate-ai {
  grid-column: 1 / -1;
}

.home-gate-ai .home-gate-fx::before {
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    transparent 58%,
    rgba(45, 122, 110, 0.5) 70%,
    rgba(28, 90, 82, 0.26) 80%,
    transparent 90%
  );
}

.home-gate-ai .home-gate-fx::after {
  background:
    radial-gradient(
      140px 100px at var(--gate-mx, 50%) var(--gate-my, 40%),
      rgba(255, 255, 255, 0.55),
      transparent 68%
    ),
    linear-gradient(155deg, #f4faf8 0%, #e8f3ef 48%, #dcece7 100%);
}

.home-gate-ai .home-gate-orb {
  background: radial-gradient(
    circle at 35% 35%,
    rgba(45, 122, 110, 0.22),
    rgba(45, 122, 110, 0.05) 62%,
    transparent 72%
  );
}

.home-gate-ai .home-gate-icon {
  color: #2d7a6e;
  background: rgba(45, 122, 110, 0.14);
}

.home-gate-ai .home-gate-title {
  color: #1a3d36;
}

.home-gate-ai .home-gate-desc {
  color: #6e8a82;
}

/* 夫妻引导入口：通栏，位于许愿池上方 */
.home-gate-guide {
  grid-column: 1 / -1;
}

.home-gate-guide .home-gate-fx::before {
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    transparent 58%,
    rgba(176, 92, 108, 0.48) 70%,
    rgba(140, 68, 82, 0.24) 80%,
    transparent 90%
  );
}

.home-gate-guide .home-gate-fx::after {
  background:
    radial-gradient(
      140px 100px at var(--gate-mx, 50%) var(--gate-my, 40%),
      rgba(255, 248, 249, 0.58),
      transparent 68%
    ),
    linear-gradient(155deg, #fbf5f6 0%, #f3e4e7 48%, #ead5da 100%);
}

.home-gate-guide .home-gate-orb {
  background: radial-gradient(
    circle at 35% 35%,
    rgba(176, 92, 108, 0.22),
    rgba(176, 92, 108, 0.05) 62%,
    transparent 72%
  );
}

.home-gate-guide .home-gate-icon {
  color: #9a4f5d;
  background: rgba(176, 92, 108, 0.14);
}

.home-gate-guide .home-gate-title {
  color: #4a2430;
}

.home-gate-guide .home-gate-desc {
  color: #96707a;
}

/* 许愿池入口：通栏 */
.home-gate-wish {
  grid-column: 1 / -1;
}

.home-gate-wish .home-gate-fx::before {
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    transparent 58%,
    rgba(196, 120, 72, 0.5) 70%,
    rgba(150, 90, 48, 0.26) 80%,
    transparent 90%
  );
}

.home-gate-wish .home-gate-fx::after {
  background:
    radial-gradient(
      140px 100px at var(--gate-mx, 50%) var(--gate-my, 40%),
      rgba(255, 252, 246, 0.58),
      transparent 68%
    ),
    linear-gradient(155deg, #fbf6f0 0%, #f3e8dc 48%, #ead9c8 100%);
}

.home-gate-wish .home-gate-orb {
  background: radial-gradient(
    circle at 35% 35%,
    rgba(196, 120, 72, 0.24),
    rgba(196, 120, 72, 0.05) 62%,
    transparent 72%
  );
}

.home-gate-wish .home-gate-icon {
  color: #a86a3a;
  background: rgba(196, 120, 72, 0.14);
}

.home-gate-wish .home-gate-title {
  color: #4a2e18;
}

.home-gate-wish .home-gate-desc {
  color: #9a7a5e;
}

/* —— 许愿池 / 夫妻引导页 —— */
body[data-page="wish"],
body[data-page="guide"] {
  min-height: 100%;
  min-height: 100dvh;
  background: #f3efe9;
}

.app.app-wish {
  min-height: 100%;
  min-height: 100dvh;
  background: linear-gradient(180deg, #f7f1ea 0%, #efe8df 55%, #e8e0d6 100%);
}

.wish-page {
  padding: 12px 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wish-block {
  margin: 0;
  padding: 14px 14px 16px;
  border-radius: 14px;
  background: rgba(255, 250, 245, 0.92);
  border: 1px solid rgba(168, 106, 58, 0.14);
  box-shadow: 0 2px 10px rgba(74, 46, 24, 0.05);
}

.wish-block-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: #4a2e18;
}

.wish-block .wish-intro {
  margin-top: 0;
}

.wish-block .wish-form {
  margin-top: 10px;
}

.wish-block .wish-mine {
  margin-top: 14px;
}

.wish-block .wish-mine h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #4a2e18;
}

body.wish-modal-open {
  overflow: hidden;
}

.wish-ok {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.wish-ok[hidden] {
  display: none !important;
}

.wish-ok-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.wish-ok-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 300px;
  border-radius: 14px;
  background: #fffaf5;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
  padding: 22px 20px 16px;
  text-align: center;
}

.wish-ok-sheet h2 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #4a2e18;
}

.wish-ok-sheet p {
  margin: 0 0 16px;
  font-size: 14px;
  color: #7a5a3e;
  line-height: 1.5;
}

.wish-ok-btn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: #a86a3a;
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
}

.wish-ok-btn:active {
  opacity: 0.9;
}

body.ai-confirm-open {
  overflow: hidden;
}

.ai-confirm {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.ai-confirm[hidden] {
  display: none !important;
}

.ai-confirm-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.ai-confirm-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 300px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  padding: 20px 18px 14px;
  text-align: center;
}

.ai-confirm-sheet h2 {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 650;
  color: #222;
}

.ai-confirm-sheet p {
  margin: 0 0 18px;
  font-size: 14px;
  color: #555;
  line-height: 1.55;
}

.ai-confirm-actions {
  display: flex;
  gap: 10px;
}

.ai-confirm-actions button {
  flex: 1;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.ai-confirm-ok {
  border: none;
  background: #07c160;
  color: #fff;
}

.ai-confirm-cancel {
  border: 1px solid #ddd;
  background: #fff;
  color: #333;
}

.ai-confirm-ok:active,
.ai-confirm-cancel:active {
  opacity: 0.9;
}

.wish-intro {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(168, 106, 58, 0.16);
  font-size: 13px;
  line-height: 1.55;
  color: #6a5340;
}

.wish-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(168, 106, 58, 0.14);
  box-shadow: 0 1px 3px rgba(74, 46, 24, 0.04);
}

.wish-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wish-label {
  font-size: 13px;
  font-weight: 650;
  color: #4a2e18;
}

.wish-label em {
  font-style: normal;
  color: #c45c12;
  margin-left: 2px;
}

.wish-form input,
.wish-form textarea {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #e0d4c6;
  border-radius: 10px;
  background: #fff;
  color: #222;
  font: inherit;
  font-size: 15px;
  line-height: 1.45;
  resize: vertical;
  -webkit-appearance: none;
  appearance: none;
}

.wish-form input:focus,
.wish-form textarea:focus {
  outline: none;
  border-color: #c4884a;
  box-shadow: 0 0 0 3px rgba(196, 136, 74, 0.18);
}

.wish-form-err {
  margin: 0;
  font-size: 13px;
  color: #c0392b;
}

.wish-form-err.is-ok {
  color: #2d7a6e;
}

.wish-submit {
  margin-top: 4px;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #c4884a 0%, #a86a3a 100%);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
}

.wish-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.wish-submit:active:not(:disabled) {
  opacity: 0.9;
}

.wish-mine {
  margin-top: 18px;
}

.wish-mine h2 {
  margin: 0 0 10px;
  font-size: 15px;
  color: #4a2e18;
}

.wish-card {
  margin-bottom: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(168, 106, 58, 0.12);
}

.wish-card-empty {
  text-align: center;
  color: #9a7a5e;
  font-size: 13px;
}

.wish-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12px;
  color: #9a7a5e;
}

.wish-card-top strong {
  color: #4a2e18;
  font-size: 14px;
}

.wish-card-line {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.5;
  color: #333;
  word-break: break-word;
}

.wish-card-line:last-child {
  margin-bottom: 0;
}

.wish-card-line em {
  font-style: normal;
  display: inline-block;
  min-width: 2.5em;
  margin-right: 6px;
  color: #a86a3a;
  font-weight: 650;
}

/* —— AI 独立页 —— */
html:has(body[data-page="ai"]),
body[data-page="ai"] {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

body[data-page="ai"] {
  position: fixed;
  inset: 0;
  width: 100%;
  touch-action: manipulation;
}

.app.app-ai {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 100%;
  max-width: var(--maxw);
  min-height: 0;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #ededed;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.app-ai > .topbar {
  flex-shrink: 0;
}

.ai-page-summary {
  flex-shrink: 0;
  margin: 0;
  padding: 8px 14px;
  font-size: 12px;
  line-height: 1.4;
  color: #6e8a82;
  background: #f4faf8;
  border-bottom: 1px solid #e2ebe7;
  word-break: break-word;
}

.ai-roleplay-root,
.ai-panel {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.ai-panel {
  background: #fff;
}

.ai-dock-msgs {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px 14px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.novel-list {
  flex: 1;
  background: #fff;
}

.novel-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--border);
}

.novel-item:active {
  background: #f5f5f5;
}

.novel-item .title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
}

.novel-item .meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.novel-item .preview {
  margin-top: 6px;
  font-size: 13px;
  color: #666;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.novel-item .chevron {
  flex-shrink: 0;
  color: #ccc;
  font-size: 20px;
  line-height: 1.2;
  margin-top: 2px;
}

.novel-body {
  flex: 1;
  padding: 18px 18px 40px;
  background: #fafafa;
  line-height: 1.85;
  font-size: 16px;
  color: #222;
}

.novel-read-head {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.novel-read-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  line-height: 1.35;
}

.novel-read-head .meta {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.novel-body > p {
  margin: 0 0 1.05em;
  text-align: justify;
  word-break: break-word;
}

.ai-dock-hint {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 8px;
}

.ai-msg {
  display: flex;
  margin-bottom: 10px;
}

.ai-msg-user {
  justify-content: flex-end;
}

.ai-msg-assistant {
  justify-content: flex-start;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.ai-bubble {
  max-width: 85%;
  padding: 8px 11px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
}

.ai-msg-user .ai-bubble {
  background: var(--bubble-me);
}

.ai-msg-assistant .ai-bubble {
  background: #f0f0f0;
}

.ai-msg-thinking .ai-bubble {
  color: var(--muted);
}

.ai-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 92%;
  width: 100%;
}

.ai-option-btn {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  color: #222;
  cursor: pointer;
}

.ai-option-btn:hover:not(:disabled) {
  border-color: #07c160;
  background: #f3fbf6;
}

.ai-option-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.ai-option-btn.ai-option-picked {
  opacity: 1;
  border-color: #07c160;
  background: #eafff2;
}

.ai-option-key {
  flex: 0 0 auto;
  min-width: 1.2em;
  font-weight: 700;
  color: #07c160;
}

.ai-option-text {
  flex: 1;
  word-break: break-word;
}

.ai-dock-form {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: #fafafa;
}

.ai-dock-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  outline: none;
  background: #fff;
  -webkit-appearance: none;
  appearance: none;
}

.ai-dock-form button {
  flex-shrink: 0;
  border: none;
  border-radius: 8px;
  padding: 0 16px;
  background: #07c160;
  color: #fff;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.ai-dock-form button:disabled {
  opacity: 0.55;
  cursor: default;
}

.qq-face,
.apple-face {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  vertical-align: text-bottom;
  margin: 0 1px;
  display: inline-block;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}

.qq-sticker {
  display: inline-block;
  padding: 1px 6px;
  margin: 0 2px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
  color: #576b95;
  font-size: 13px;
  line-height: 1.4;
  vertical-align: baseline;
}

.day-nav {
  padding: 28px 16px 40px;
  text-align: center;
}

.day-nav-btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 8px;
  background: #fff;
  color: var(--link);
  text-decoration: none;
  font-size: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.day-nav-btn:active {
  opacity: 0.75;
}

.day-nav-end {
  color: var(--muted);
  font-size: 13px;
}

.empty, .error {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.test-page {
  padding: 12px 14px 24px;
}

.test-kouling-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 14px;
}

.test-kouling-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 16px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff7f0 0%, #ffffff 55%);
  box-shadow: 0 2px 10px rgba(192, 57, 43, 0.1);
  border: 1px solid #f2d2c4;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.test-kouling-card:active {
  transform: scale(0.985);
  background: #fff3ea;
}

.test-kouling-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.test-kouling-label {
  font-size: 16px;
  font-weight: 700;
  color: #a33b2b;
}

.test-kouling-hint {
  font-size: 12px;
  color: #b08a7a;
}

.test-kouling-num {
  flex-shrink: 0;
  min-width: 2.5em;
  padding: 8px 14px;
  border-radius: 999px;
  background: #c0392b;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  text-align: center;
  box-shadow: 0 2px 6px rgba(192, 57, 43, 0.28);
}

.test-kouling-num.is-copied {
  background: #07c160;
  box-shadow: 0 2px 6px rgba(7, 193, 96, 0.28);
}

.test-page .page-soon {
  min-height: 32vh;
  padding: 48px 16px;
}

.page-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40vh;
  padding: 64px 24px;
}

.page-soon p {
  margin: 0;
  font-size: 16px;
  color: #444;
}

.page-soon-sub {
  font-size: 13px !important;
  color: var(--muted) !important;
}

/* —— 留言板 —— */
/* iOS：锁死视口，避免聚焦输入框时整页放大 / 被键盘顶变形 */
html:has(body[data-page="board"]),
body[data-page="board"] {
  width: 100%;
  height: var(--board-vh, 100%);
  height: var(--board-vh, 100dvh);
  max-height: var(--board-vh, 100dvh);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
}

body[data-page="board"] {
  position: fixed;
  inset: 0;
}

.app.app-board {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 100%;
  max-width: var(--maxw);
  min-height: 0;
  height: calc(var(--board-vh, 100dvh) - var(--board-kb, 0px));
  max-height: calc(var(--board-vh, 100dvh) - var(--board-kb, 0px));
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: #ededed;
  transition: height 0.12s ease-out, max-height 0.12s ease-out;
}

.app-board > .topbar {
  flex-shrink: 0;
}

.board-panel {
  flex: 1 1 0;
  min-height: 0;
  max-height: 100%;
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: #ededed;
}

.board-panel.is-active {
  display: flex;
}

.board-msgs,
.board-near-list,
.board-inbox {
  flex: 1 1 0;
  min-height: 0;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.board-inbox {
  background: #fff;
}

.board-inbox-empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.board-inbox-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: none;
  border-bottom: 1px solid #f0f0f0;
  background: #fff;
  text-align: left;
  font: inherit;
  cursor: pointer;
  color: inherit;
}

.board-inbox-item:active {
  background: #f5f5f5;
}

.board-inbox-item.is-pinned {
  background: #fafcfb;
}

.board-inbox-avatar {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #07c160;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 650;
}

.board-inbox-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fa5151;
  border: 2px solid #fff;
  box-sizing: content-box;
}

.board-inbox-item.is-unread .board-inbox-name {
  font-weight: 700;
  color: #111;
}

.board-inbox-preview.is-unread {
  color: #333;
  font-weight: 600;
}

.board-inbox-badge {
  flex-shrink: 0;
  align-self: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #fa5151;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.board-inbox-item:not(.is-pinned) .board-inbox-avatar {
  background: #6aa8c9;
}

.board-inbox-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.board-inbox-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.board-inbox-name {
  font-size: 16px;
  font-weight: 600;
  color: #111;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.board-inbox-tag {
  font-size: 10px;
  font-weight: 650;
  color: #07c160;
  background: #eafff2;
  border: 1px solid #b7ebc8;
  border-radius: 4px;
  padding: 0 4px;
  line-height: 1.5;
}

.board-inbox-time {
  flex-shrink: 0;
  font-size: 12px;
  color: #aaa;
}

.board-inbox-preview {
  font-size: 13px;
  color: #999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-back {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--link);
  font: inherit;
  font-size: 16px;
  padding: 0;
  min-width: 48px;
  text-align: left;
  cursor: pointer;
}

.board-msgs {
  padding: 12px 12px 16px;
}

.board-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
}

.board-row-me {
  justify-content: flex-end;
}

.board-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #c8d6e5;
  color: #334;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 650;
}

.board-avatar-me {
  background: #7bed9f;
  color: #163528;
}

.board-bubble-wrap {
  max-width: 72%;
  min-width: 0;
}

.board-row-me .board-bubble-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.board-name {
  font-size: 12px;
  color: #888;
  margin: 0 0 4px 2px;
}

.board-bubble {
  display: inline-block;
  padding: 9px 11px;
  border-radius: 8px;
  background: #fff;
  font-size: 16px;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.03);
}

.board-row-me .board-bubble {
  background: var(--bubble-me);
}

.board-time {
  margin-top: 4px;
  font-size: 11px;
  color: #aaa;
}

.board-near-list {
  padding: 12px 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background:
    radial-gradient(120px 80px at 12% 0%, rgba(196, 98, 110, 0.08), transparent 70%),
    radial-gradient(140px 90px at 100% 8%, rgba(47, 128, 168, 0.08), transparent 72%),
    #f3f1ef;
}

.board-near-empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.board-near-card {
  position: relative;
  margin: 0;
  border: none;
  background: transparent;
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.board-near-shell {
  position: relative;
  display: flex;
  align-items: stretch;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow:
    0 8px 22px rgba(60, 40, 30, 0.06),
    0 1px 0 rgba(255, 255, 255, 0.7) inset;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.board-near-card:active .board-near-shell {
  transform: scale(0.985);
}

.board-near-body {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  display: flex;
  padding: 14px 14px 12px;
}

.board-near-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.board-near-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.board-near-name {
  font-size: 15px;
  font-weight: 700;
  color: #2b2420;
  letter-spacing: 0.02em;
}

.board-near-city {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 650;
  color: #7a6550;
}

.board-near-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: #9a8770;
}

.board-near-text {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: #3a322c;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: none;
}

.board-near-card.is-open .board-near-text {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.board-near-expand {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 650;
  color: #2f80a8;
}

.board-near-card.is-open .board-near-expand {
  color: #9a8770;
}

.board-near-foot {
  display: none;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(60, 40, 30, 0.08);
}

.board-near-card.is-open .board-near-foot {
  display: block;
}

.board-near-add {
  display: block;
  width: 100%;
  margin: 0;
  padding: 9px 12px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #2f80a8, #246284);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(36, 98, 132, 0.22);
}

.board-near-add:disabled {
  opacity: 0.7;
  cursor: default;
}

.board-near-card.tone-1 .board-near-shell {
  background: linear-gradient(145deg, #fff8f4 0%, #f7e7df 55%, #efd8cf 100%);
}

.board-near-card.tone-2 .board-near-shell {
  background: linear-gradient(145deg, #f7fbff 0%, #e5f0f7 55%, #d7e7f0 100%);
}

.board-near-card.tone-2 .board-near-city {
  color: #2a6f94;
}

.board-near-card.tone-3 .board-near-shell {
  background: linear-gradient(145deg, #fbf7f1 0%, #f1e6d4 55%, #e8d8c0 100%);
}

.board-near-card.tone-4 .board-near-shell {
  background: linear-gradient(145deg, #f8fbf9 0%, #e8f4ee 55%, #d8ebe2 100%);
}

.board-near-card.tone-4 .board-near-city {
  color: #1f8f55;
}

.board-near-card.tone-5 .board-near-shell {
  background: linear-gradient(145deg, #fcf5f8 0%, #f3e0e8 55%, #e9cedb 100%);
}

.board-near-card.tone-5 .board-near-city {
  color: #a84d7a;
}

@media (prefers-reduced-motion: reduce) {
  .board-near-shell {
    transition: none !important;
  }
}

.board-composer {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #f7f7f7;
  border-top: 1px solid var(--border);
}

.board-composer input {
  flex: 1;
  min-width: 0;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 9px 11px;
  font: inherit;
  /* ≥16px：阻止 iOS Safari 聚焦时自动放大页面 */
  font-size: 16px;
  background: #fff;
  -webkit-appearance: none;
  appearance: none;
}

.board-composer button {
  flex-shrink: 0;
  border: none;
  border-radius: 8px;
  padding: 0 14px;
  background: #07c160;
  color: #fff;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.board-composer button:active {
  opacity: 0.85;
}

.board-tabs {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--border);
  background: #fafafa;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.board-near-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.board-near-action-btn {
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 1px solid #07c160;
  border-radius: 8px;
  background: #fff;
  color: #07c160;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.board-near-action-btn:active {
  opacity: 0.75;
  background: #eafff2;
}

body.board-publish-open {
  overflow: hidden;
}

.board-publish {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.board-publish[hidden] {
  display: none !important;
}

.board-publish-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.board-publish-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 340px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  padding: 18px 16px 14px;
}

.board-publish-sheet h2 {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 650;
  color: #222;
  text-align: center;
}

.board-publish-sheet textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 120px;
  margin: 0 0 8px;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  resize: vertical;
  color: #222;
  background: #fff;
}

.board-publish-err {
  margin: 0 0 8px;
  font-size: 13px;
  color: #c0392b;
  text-align: center;
}

.board-publish-actions {
  display: flex;
  gap: 10px;
}

.board-publish-actions button {
  flex: 1;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.board-publish-ok {
  border: none;
  background: #07c160;
  color: #fff;
}

.board-publish-cancel {
  border: 1px solid #ddd;
  background: #fff;
  color: #333;
}

.board-publish-ok:active,
.board-publish-cancel:active {
  opacity: 0.9;
}

.board-publish-ok:disabled {
  opacity: 0.6;
  cursor: default;
}

.board-toast {
  position: fixed;
  left: 50%;
  top: 42%;
  z-index: 60;
  transform: translate(-50%, -50%);
  max-width: min(80vw, 280px);
  padding: 12px 18px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.board-toast.is-in {
  opacity: 1;
}

.board-toast.is-out {
  opacity: 0;
}

.board-toast[hidden] {
  display: none !important;
}

body.board-manage-open {
  overflow: hidden;
}

.board-manage {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.board-manage[hidden] {
  display: none !important;
}

.board-manage-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.board-manage-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  max-height: min(72vh, 560px);
  border-radius: 16px 16px 0 0;
  background: #fff;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.board-manage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.board-manage-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  color: #222;
}

.board-manage-close {
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #888;
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.board-manage-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px 16px;
}

.board-manage-empty {
  padding: 40px 12px;
  text-align: center;
  color: #999;
  font-size: 14px;
}

.board-manage-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 8px;
  padding: 10px 12px;
  border: 1px solid #eee;
  border-radius: 10px;
  background: #fafafa;
}

.board-manage-item:last-child {
  margin-bottom: 0;
}

.board-manage-body {
  flex: 1;
  min-width: 0;
}

.board-manage-time {
  display: block;
  margin: 0 0 4px;
  font-size: 12px;
  color: #999;
}

.board-manage-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  white-space: pre-wrap;
  word-break: break-word;
}

.board-manage-del {
  flex-shrink: 0;
  margin: 0;
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: #ffe8e8;
  color: #c0392b;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.board-manage-del:active {
  opacity: 0.85;
}

.board-manage-del:disabled {
  opacity: 0.55;
  cursor: default;
}

.board-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin: 0;
  padding: 8px 6px 10px;
  border: none;
  background: transparent;
  color: #888;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.board-tab-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 22px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #fa5151;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.board-tab-ico {
  display: flex;
  color: inherit;
}

.board-tab.is-active {
  color: #07c160;
}

.error a { color: var(--link); }

/* —— 本地编辑（仅 edit-server 启用时） —— */
.edit-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: #e67e22;
  padding: 2px 8px;
  border-radius: 10px;
  pointer-events: none;
  white-space: nowrap;
}

.edit-btn {
  flex-shrink: 0;
  align-self: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
  color: #888;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.55;
}

.edit-btn:hover,
.edit-btn:focus {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
  color: #333;
}

.edit-menu {
  position: fixed;
  z-index: 40;
  min-width: 140px;
  padding: 4px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.edit-menu[hidden] {
  display: none !important;
}

.edit-menu button {
  border: none;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  color: #111;
}

.edit-menu button:hover {
  background: #f5f5f5;
}

.edit-menu .edit-danger {
  color: #c0392b;
}

.edit-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.edit-modal[hidden] {
  display: none !important;
}

.edit-modal-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.edit-modal-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

.edit-field {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.edit-field select,
.edit-field input,
.edit-field textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}

.edit-field textarea {
  resize: vertical;
  min-height: 100px;
}

.edit-faces-wrap {
  margin: 0 0 10px;
}

.edit-faces-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.edit-faces-tab {
  margin: 0;
  padding: 5px 10px;
  border: 1px solid #ddd;
  border-radius: 999px;
  background: #fff;
  color: #666;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.edit-faces-tab.is-active {
  border-color: #07c160;
  background: #eafff2;
  color: #07c160;
  font-weight: 650;
}

.edit-faces {
  display: none;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
  max-height: 148px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fafafa;
}

.edit-faces.is-active {
  display: grid;
}

.edit-face-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  margin: 0;
  padding: 2px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.edit-face-btn:hover,
.edit-face-btn:focus-visible {
  background: #e8f8ef;
  outline: none;
}

.edit-face-btn img {
  width: 24px;
  height: 24px;
  display: block;
  pointer-events: none;
}

.edit-tg-emoji {
  font-size: 22px;
  line-height: 1;
  pointer-events: none;
}

.edit-face-btn-apple img {
  width: 26px;
  height: 26px;
}

.edit-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.edit-modal-actions button {
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}

.edit-cancel {
  background: #f0f0f0;
  color: #333;
}

.edit-save {
  background: #07c160;
  color: #fff;
}

/* —— 访问口令门禁 —— */
body.auth-locked .app {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.45);
}

.auth-gate-card {
  width: 100%;
  max-width: 340px;
  background: #fff;
  border-radius: 12px;
  padding: 22px 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.auth-gate-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.auth-gate-hint {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.auth-gate-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  margin-bottom: 10px;
}

.auth-gate-error {
  color: #c0392b;
  font-size: 13px;
  margin: 0 0 10px;
}

.auth-gate-btn {
  width: 100%;
  border: none;
  border-radius: 8px;
  padding: 10px;
  background: #07c160;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

.auth-gate-btn:disabled {
  opacity: 0.6;
}

.track-wrong-host {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 90;
  background: #fff7e6;
  border: 1px solid #f0c36d;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #5c4800;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
}

.track-wrong-host strong {
  display: block;
  margin-bottom: 4px;
}

.track-wrong-host a {
  display: inline-block;
  margin-top: 6px;
  color: #07c160;
  word-break: break-all;
}

