:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --primary: #2563eb;
  --line: #e5e7eb;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  position: relative;
}

/* 全站背景（与各 tab 页共用） */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("./素材/背景底图/底图1.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
  pointer-events: none;
  transform-origin: center center;
}

/* 首頁：底圖視覺放大（裁邊 zoom，仍鋪滿視窗） */
body.home-bg-active::before {
  transform: scale(1.25);
}

.app {
  min-height: 100vh;
  height: 100vh;
  height: 100dvh;
  display: grid;
  /* 底欄實際高度 ≥ min-height + 安全區，固定 58px 會擠壓或把欄位頂出視覺區 */
  grid-template-rows: 52px 1fr auto;
  position: relative;
  z-index: 1;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

.top-bar h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.content {
  overflow-y: auto;
  padding: 12px;
}

.page {
  display: none;
  min-height: 100%;
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
}

.page.active {
  display: block;
}

/* 非首页 tab：透出让底图可见（保持卡片区块可读） */
.page[data-page="discover"].active,
.page[data-page="message"].active {
  background: transparent;
  border-radius: 0;
}

/* 首页特殊样式 */
.page[data-page="home"].active {
  display: block;
  position: relative;
}

/* 非星空底圖時略減首頁卡片上內距，讓主標更靠上 */
body:not(.home-bg-active) .page[data-page="home"].active {
  padding-top: 8px;
}

body.home-bg-active .app {
  grid-template-rows: 52px 1fr auto;
}

body.home-bg-active .top-bar {
  background: transparent;
  border-bottom: none;
}

body.home-bg-active .top-bar h1 {
  opacity: 0;
}

/* 其他 tab：顶栏略透明以衔接底图 */
body:not(.home-bg-active) .top-bar {
  background: rgba(250, 246, 238, 0.88);
  backdrop-filter: blur(8px);
  border-bottom-color: rgba(200, 182, 155, 0.35);
}

/* 我的页：隐藏最上方白框（标题栏） */
body.mine-page-active .app {
  grid-template-rows: 0 1fr auto;
}

body.mine-page-active .top-bar {
  display: flex;
  height: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: transparent;
  border-bottom: none;
  backdrop-filter: none;
}

body.mine-page-active .content {
  padding-top: 0;
}

/* 「我的」底下子頁：不要外層白卡片 + content 留白，避免與板塊底圖「套兩層」 */
body.mine-subpage-view .content {
  padding: 0;
  background: transparent;
}

/* 「我的」子頁：無四格主底欄時僅頂欄 + 內容 */
body.mine-subpage-view:not(.main-tab-bar-visible) .app {
  grid-template-rows: 52px 1fr;
}

/* 「我的收藏」「智慧小记」：內容區內滾動，底部由 capsule／流星 欄佔位 */
body.mine-inner-nav-view .content {
  overflow: hidden;
  padding: 0;
}

body.mine-inner-nav-view .page.active[data-page="saved-stories"],
body.mine-inner-nav-view .page.active[data-page="wisdom-notes"] {
  flex: 1;
  min-height: 0;
  height: 100%;
}

body.home-bg-active .tab-bar {
  background: rgba(8, 24, 48, 0.62);
  border-top-color: rgba(255, 241, 199, 0.25);
  backdrop-filter: blur(2px);
}

body.home-bg-active .content {
  padding: 0;
}

body.home-bg-active .page[data-page="home"].active {
  background: transparent;
  border-radius: 0;
  padding: 0;
}

.page[data-page="home"] .home-shell {
  --home-serif:
    "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", "Songti SC", "STKaiti", "KaiTi", serif;
  --home-sans:
    "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  min-height: 100%;
  /* 頂部多留空：避免主標負 margin / drop-shadow 被 .content 捲動區裁切 */
  padding: calc(env(safe-area-inset-top) + 12px) 16px 14px;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.page[data-page="home"] .home-header {
  color: #122436;
}

/* 首頁主標：宋體感襯線 + 深藍炭黑漸層 + 細高光與暖色柔光（無字後裝飾底圖） */
.page[data-page="home"] .home-title-stage {
  display: flex;
  justify-content: center;
  margin-top: 0;
  margin-bottom: 0;
  padding: 10px 0 6px;
  text-align: center;
}

.page[data-page="home"] .home-title {
  margin: 0;
  padding: 0.06em 0.04em 0;
  font-family: var(--home-serif);
  font-size: clamp(40px, 11.8vw, 54px);
  font-weight: 600;
  letter-spacing: 0.38em;
  line-height: 1.22;
  background:
    linear-gradient(
      105deg,
      rgba(255, 255, 255, 0.42) 0%,
      rgba(255, 255, 255, 0) 18%
    ),
    linear-gradient(
      178deg,
      #5a6d88 0%,
      #3d4d66 14%,
      #283448 32%,
      #151d2c 52%,
      #0c1018 72%,
      #1a2436 100%
    );
  background-size: 55% 90%, 100% 100%;
  background-position: 8% 15%, 50% 50%;
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter:
    drop-shadow(0 0 1px rgba(255, 255, 255, 0.12))
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.08))
    drop-shadow(0 10px 28px rgba(0, 0, 0, 0.22))
    drop-shadow(0 0 32px rgba(255, 244, 220, 0.14))
    drop-shadow(0 0 56px rgba(255, 236, 200, 0.08));
}

@media (prefers-reduced-motion: reduce) {
  .page[data-page="home"] .home-title {
    filter:
      drop-shadow(0 1px 0 rgba(255, 255, 255, 0.06))
      drop-shadow(0 6px 16px rgba(0, 0, 0, 0.2))
      drop-shadow(0 0 24px rgba(255, 244, 220, 0.1));
  }
}

.page[data-page="home"] .home-meta {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1.5px solid rgba(186, 149, 79, 0.55);
  font-family: var(--home-sans);
  font-size: 12px;
  color: rgba(62, 52, 38, 0.78);
  letter-spacing: 0.1em;
  font-weight: 500;
}

.page[data-page="home"] .home-question {
  margin-top: 12px;
  margin-bottom: 0;
  font-family: var(--home-serif);
  font-size: clamp(17px, 5.2vw, 25px);
  line-height: 1.42;
  color: #1e3352;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.page[data-page="home"] .capsule-feature {
  margin-top: clamp(12px, 7vh, 44px);
  align-self: center;
}

.page[data-page="home"] .capsule-btn {
  position: relative;
  width: min(84vw, 336px);
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  aspect-ratio: auto;
}

/* 膠囊圖：上下緩動 + 光暈／粒子（偽元素） */
.page[data-page="home"] .capsule-thumb-float {
  position: relative;
  display: block;
  line-height: 0;
  animation: capsule-thumb-float 3.4s ease-in-out infinite;
  will-change: transform;
}

.page[data-page="home"] .capsule-thumb-float::before {
  content: "";
  position: absolute;
  inset: -18% -12% -14% -12%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse 42% 38% at 28% 32%,
      rgba(255, 236, 200, 0.55) 0%,
      transparent 62%
    ),
    radial-gradient(
      ellipse 36% 40% at 72% 58%,
      rgba(190, 220, 255, 0.42) 0%,
      transparent 58%
    ),
    radial-gradient(
      circle at 50% 88%,
      rgba(255, 248, 220, 0.28) 0%,
      transparent 45%
    );
  filter: blur(10px);
  opacity: 0.85;
  animation: capsule-ambient-glow 3.8s ease-in-out infinite alternate;
}

/* 光粒子：中心點在膠囊幾何中心，box-shadow 圍一圈包圍四周 */
.page[data-page="home"] .capsule-thumb-float::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  pointer-events: none;
  font-size: clamp(10px, 3.5vw, 18px);
  width: 0.15em;
  height: 0.15em;
  border-radius: 50%;
  background: transparent;
  transform: translate(-50%, -50%);
  /* 橢圓環繞（略高於寬，貼近膠囊外形）；blur+spread 做小光點 */
  box-shadow:
    0 -5.9em 0.15em 0.09em rgba(255, 252, 240, 0.92),
    2.15em -5.35em 0.12em 0.07em rgba(255, 236, 200, 0.88),
    4.35em -3.15em 0.14em 0.08em rgba(200, 224, 255, 0.9),
    5.85em 0 0.12em 0.075em rgba(255, 255, 255, 0.9),
    4.45em 3.35em 0.15em 0.07em rgba(186, 214, 255, 0.85),
    2.25em 5.45em 0.12em 0.08em rgba(255, 248, 215, 0.9),
    0 6.15em 0.14em 0.09em rgba(255, 240, 190, 0.88),
    -2.25em 5.45em 0.12em 0.07em rgba(255, 252, 245, 0.87),
    -4.45em 3.35em 0.15em 0.075em rgba(210, 230, 255, 0.82),
    -5.85em 0 0.12em 0.08em rgba(255, 255, 255, 0.88),
    -4.35em -3.15em 0.14em 0.07em rgba(255, 230, 175, 0.86),
    -2.15em -5.35em 0.12em 0.08em rgba(255, 250, 235, 0.9);
  filter: blur(0.35px);
  animation: capsule-sparkle 2.4s ease-in-out infinite;
}

.page[data-page="home"] .capsule-thumb {
  position: relative;
  z-index: 1;
  width: min(58vw, 238px);
  height: auto;
  filter: drop-shadow(0 14px 24px rgba(12, 24, 42, 0.3));
}

@keyframes capsule-thumb-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-12px);
  }
}

@keyframes capsule-ambient-glow {
  0% {
    opacity: 0.55;
    transform: scale(0.96) translateY(2px);
  }
  100% {
    opacity: 0.95;
    transform: scale(1.04) translateY(-2px);
  }
}

@keyframes capsule-sparkle {
  0%,
  100% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(0.92);
  }
  40% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.06);
  }
  70% {
    opacity: 0.62;
    transform: translate(-50%, -50%) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page[data-page="home"] .capsule-thumb-float {
    animation: none;
  }

  .page[data-page="home"] .capsule-thumb-float::before {
    animation: none;
  }

  .page[data-page="home"] .capsule-thumb-float::after {
    animation: none;
    opacity: 0.72;
    transform: translate(-50%, -50%) scale(1);
  }
}

.page[data-page="home"] .capsule-cta {
  width: min(72vw, 286px);
  height: 48px;
  border-radius: 999px;
  border: 1.5px solid rgba(214, 175, 96, 0.72);
  background: linear-gradient(180deg, #17345b 0%, #0f2240 100%);
  color: #f0e4c8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-family: var(--home-serif);
  letter-spacing: 0.14em;
  font-weight: 600;
}

.page[data-page="home"] .home-story-card {
  margin-top: 30px;
  margin-bottom: max(4px, env(safe-area-inset-bottom));
  border-radius: 14px;
  padding: 12px 12px 10px;
  background: rgba(248, 242, 230, 0.88);
  border: 1px solid rgba(226, 211, 178, 0.8);
  box-shadow: 0 10px 24px rgba(5, 14, 30, 0.12);
}

.page[data-page="home"] .home-story-card h3 {
  margin: 0;
  font-family: var(--home-sans);
  color: #8a6a3a;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.28em;
}

.page[data-page="home"] .story-title {
  margin-top: 8px;
  margin-bottom: 6px;
  font-family: var(--home-serif);
  color: #2a3d58;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.35;
}

.page[data-page="home"] .story-preview {
  margin: 0;
  font-family: var(--home-sans);
  color: #4a5568;
  font-size: 13px;
  line-height: 1.55;
  letter-spacing: 0.02em;
}

.page h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.page p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.page[data-page="mine"].active {
  padding: 0 0 16px;
  background: transparent;
  min-height: auto;
}

.page[data-page="mine"] .mine-shell {
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-family: "STKaiti", "Kaiti SC", "KaiTi", serif;
}

.page[data-page="mine"] .mine-hero-panel {
  position: relative;
  overflow: hidden;
  border-radius: 0;
  padding: 16px 12px 14px;
  text-align: center;
  background: transparent;
  border: none;
}

.page[data-page="mine"] .mine-hero-panel::before {
  display: none;
}

.page[data-page="mine"] .mine-hero-panel::after {
  display: none;
}

.page[data-page="mine"] .mine-hero-text {
  position: absolute;
  top: 16px;
  left: 6px;
  text-align: left;
  color: #f0e4cb;
  z-index: 2;
}

.page[data-page="mine"] .mine-hero-text h3 {
  margin: 0;
  font-size: 34px;
  line-height: 1.12;
  letter-spacing: 1.5px;
  font-family: "STZhongsong", "STSong", "SimSun", serif;
}

.page[data-page="mine"] .mine-hero-text p {
  margin-top: 8px;
  color: #d2b586;
  font-size: 13px;
  line-height: 1.55;
  letter-spacing: 0.04em;
}

.page[data-page="mine"] .mine-avatar {
  width: 86px;
  height: 86px;
  margin: 66px auto 14px;
  border-radius: 50%;
  border: 2px solid rgba(180, 138, 78, 0.62);
  background-color: #f6f0e2;
  background-image: url("./素材/思想家头像/马可·奥勒留头像.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 6px 14px rgba(20, 30, 48, 0.18);
  position: relative;
  z-index: 1;
}

.page[data-page="mine"] .mine-avatar::after {
  display: none;
}

.page[data-page="mine"] .mine-name {
  margin: 0;
  font-size: 38px;
  font-family: "STKaiti", "Kaiti SC", "KaiTi", serif;
  color: #213758;
  letter-spacing: 0.06em;
  line-height: 1.15;
}

.page[data-page="mine"] .mine-slogan {
  margin-top: 8px;
  font-size: 13px;
  color: #576b86;
  line-height: 1.55;
  letter-spacing: 0.05em;
}

.page[data-page="mine"] .mine-streak {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 22px;
  font-size: 12px;
  color: #6f5a37;
  position: relative;
  z-index: 1;
  line-height: 1.5;
  letter-spacing: 0.04em;
}

.page[data-page="mine"] .mine-card {
  border-radius: 14px;
  background: rgba(252, 248, 240, 0.92);
  border: 1px solid rgba(207, 187, 154, 0.58);
  box-shadow: 0 7px 16px rgba(12, 24, 41, 0.1);
  overflow: hidden;
}

.page[data-page="mine"] .mine-card-title {
  margin: 0;
  padding: 12px 14px 10px;
  font-size: 21px;
  font-family: "STKaiti", "Kaiti SC", "KaiTi", serif;
  color: #866839;
  border-bottom: 1px solid rgba(211, 193, 164, 0.5);
  letter-spacing: 0.06em;
  line-height: 1.35;
}

.page[data-page="mine"] .mine-archive-card {
  margin-top: -2px;
}

/* 「我的」頁：裝飾邊框（背景圖鋪滿，內容內縮避免遮擋花紋） */
.page[data-page="mine"] .mine-card-decor {
  border: none;
  box-shadow: none;
  background-color: rgba(252, 248, 240, 0.94);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  overflow: visible;
}

.page[data-page="mine"] .mine-card-decor .mine-card-title {
  border-bottom-color: transparent;
  padding-left: clamp(16px, 4.5vw, 26px);
  padding-right: clamp(16px, 4.5vw, 26px);
}

.page[data-page="mine"] .mine-card-decor--archive {
  background-image: url("./素材/装饰元素/边框3.png");
  padding: clamp(14px, 3.5vw, 22px) clamp(12px, 4vw, 26px)
    clamp(16px, 4vw, 26px);
}

.page[data-page="mine"] .mine-card-decor--archive .mine-stats-grid {
  padding-left: clamp(6px, 1.2vw, 10px);
  padding-right: clamp(6px, 1.2vw, 10px);
}

.page[data-page="mine"] .mine-card-decor--actions {
  background-image: url("./素材/装饰元素/边框2.png");
  padding: clamp(14px, 3.5vw, 22px) clamp(12px, 4vw, 26px)
    clamp(16px, 4vw, 26px);
}

.page[data-page="mine"] .mine-card-decor--actions .mine-row:first-of-type {
  border-top: none;
}

.page[data-page="mine"] .mine-card-decor--track {
  background-image: url("./素材/装饰元素/边框1.png");
  padding: clamp(14px, 3.5vw, 22px) clamp(12px, 4vw, 26px)
    clamp(16px, 4vw, 26px);
}

.page[data-page="mine"] .mine-card-decor--track .mine-track-desc {
  margin-left: clamp(2px, 1vw, 8px);
  margin-right: clamp(2px, 1vw, 8px);
}

.page[data-page="mine"] .mine-card-decor--track .mine-track-list {
  padding-right: clamp(8px, 2vw, 14px);
}

.page[data-page="mine"] .mine-archive-card .mine-card-title::before {
  content: "✦";
  margin-right: 8px;
  color: #b48a4e;
  font-size: 14px;
  vertical-align: 1px;
}

.page[data-page="mine"] .mine-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 8px 6px 10px;
}

.page[data-page="mine"] .mine-stat-item {
  padding: 12px 5px;
  text-align: center;
  border-right: 1px solid rgba(214, 197, 170, 0.42);
}

.page[data-page="mine"] .mine-stat-item:last-child {
  border-right: none;
}

.page[data-page="mine"] .mine-stat-item strong {
  display: block;
  font-size: 43px;
  line-height: 1.05;
  color: #243c5e;
  font-family: "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.page[data-page="mine"] .mine-stat-item span {
  display: block;
  margin-top: 7px;
  font-size: 12px;
  color: #7c6951;
  line-height: 1.45;
  letter-spacing: 0.05em;
}

.page[data-page="mine"] .mine-stat-item--calendar {
  cursor: pointer;
  font: inherit;
  color: inherit;
  width: 100%;
  margin: 0;
  border: none;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}

.page[data-page="mine"] .mine-stat-item--calendar:active {
  opacity: 0.92;
}

.page[data-page="mine"] .mine-row {
  width: 100%;
  border: none;
  background: transparent;
  display: grid;
  grid-template-columns: 24px 1fr 16px;
  align-items: center;
  column-gap: 11px;
  padding: 12px 12px;
  text-align: left;
  border-top: 1px solid rgba(217, 201, 176, 0.45);
  cursor: pointer;
}

.page[data-page="mine"] .mine-row:first-of-type {
  border-top: none;
}

.page[data-page="mine"] .mine-row:active {
  background: rgba(234, 223, 204, 0.35);
}

.page[data-page="mine"] .mine-row-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.page[data-page="mine"] .mine-row-main strong {
  font-size: 18px;
  color: #2d4467;
  font-family: "STKaiti", "Kaiti SC", "KaiTi", serif;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.04em;
}

.page[data-page="mine"] .mine-row-main small {
  font-size: 11px;
  color: #7f8695;
  line-height: 1.55;
  letter-spacing: 0.04em;
}

.page[data-page="mine"] .mine-row-arrow {
  font-size: 20px;
  line-height: 1;
  color: #9d8762;
  justify-self: end;
}

.page[data-page="mine"] .mine-row-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.page[data-page="mine"] .mine-row-icon-img {
  width: 180%;
  height: 180%;
  object-fit: contain;
  display: block;
}

.page[data-page="mine"] .mine-track-card {
  margin-top: 0;
}

.page[data-page="mine"] .mine-track-desc {
  margin: -2px 0 10px;
  padding: 0 4px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: #7e8490;
  letter-spacing: 0.03em;
}

.page[data-page="mine"] .mine-track-list {
  position: relative;
  padding: 8px 12px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.page[data-page="mine"] .mine-track-list::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 16px;
  bottom: 16px;
  width: 1px;
  background: rgba(184, 138, 78, 0.44);
}

.page[data-page="mine"] .mine-track-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  align-items: start;
  position: relative;
  padding-left: 16px;
}

.page[data-page="mine"] .mine-track-item::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b48a4e;
  box-shadow: 0 0 0 2px rgba(245, 239, 228, 0.92);
}

.page[data-page="mine"] .mine-track-day {
  font-size: 13px;
  color: #846e47;
  padding-top: 2px;
  line-height: 1.4;
  letter-spacing: 0.04em;
}

.page[data-page="mine"] .mine-track-main strong {
  display: block;
  font-size: 18px;
  color: #304869;
  font-family: "STKaiti", "Kaiti SC", "KaiTi", serif;
  line-height: 1.3;
  letter-spacing: 0.04em;
}

.page[data-page="mine"] .mine-track-main small {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  color: #7e8490;
  white-space: pre-line;
  word-break: break-word;
  line-height: 1.55;
  letter-spacing: 0.03em;
}

.page[data-page="mine"] .mine-track-expand-btn {
  align-self: center;
  margin: 4px auto 0;
  padding: 6px 18px;
  border: 1px solid rgba(180, 138, 78, 0.45);
  border-radius: 999px;
  background: rgba(252, 248, 240, 0.7);
  color: #846e47;
  font-size: 13px;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.page[data-page="mine"] .mine-track-expand-btn:active {
  opacity: 0.75;
}

@keyframes mine-track-item-reveal {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page[data-page="mine"] .mine-track-item--expand {
  animation: mine-track-item-reveal 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.page[data-page="mine"] .mine-service-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.page[data-page="mine"] .mine-service-item {
  border: none;
  background: transparent;
  border-right: 1px solid rgba(214, 197, 170, 0.58);
  padding: 14px 8px;
  font-size: 16px;
  color: #536175;
  line-height: 1.45;
  letter-spacing: 0.06em;
}

.page[data-page="mine"] .mine-service-item:last-child {
  border-right: none;
}

.page[data-page="mine"] a.mine-service-item {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
  cursor: pointer;
}

.capsule-btn {
  width: min(52vw, 210px);
  aspect-ratio: 1 / 1;
  border: none;
  border-radius: 999px;
  padding: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 28px rgba(13, 36, 72, 0.28);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  cursor: pointer;
  overflow: visible;
}

.capsule-btn:active {
  transform: scale(0.96);
}

.capsule-btn:hover {
  box-shadow: 0 14px 34px rgba(13, 36, 72, 0.34);
}

.capsule-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.2));
}

.capsule-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  overflow: hidden;
}

.capsule-overlay.active {
  display: block;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 16, 35, 0.5);
  opacity: 0;
  transition: opacity 0.48s ease;
}

.overlay-center {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  pointer-events: none;
}

/* 閱讀頁：紙條撐滿視窗高度，小故事區才能 flex 長到接近底欄按鈕 */
.capsule-overlay.show-page .overlay-center {
  align-items: stretch;
}

.capsule-video-wrap {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.capsule-overlay.video-open .capsule-video-wrap {
  opacity: 1;
  pointer-events: auto;
}

.capsule-overlay.show-page .capsule-video-wrap {
  opacity: 0;
  pointer-events: none;
}

/* ── 動畫期間浮現的哲學家引言 ── */
.capsule-anim-quote {
  position: absolute;
  inset: 0;
  z-index: 32;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 18% 22%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2s cubic-bezier(0.22, 1, 0.36, 1);
}

.capsule-overlay.anim-quote-visible .capsule-anim-quote {
  opacity: 1;
}

/* 進入紙條頁時立即隱藏 */
.capsule-overlay.show-page .capsule-anim-quote {
  opacity: 0;
  transition: none;
}

.capsule-anim-quote-text {
  margin: 0;
  font-family: "STKaiti", "Kaiti SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: clamp(17px, 5.2vw, 26px);
  line-height: 2;
  letter-spacing: 0.1em;
  color: rgba(28, 20, 10, 0.88);
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  white-space: pre-line;
}

/* 外層負責動效與陰影；鋪滿視窗，內層 img 再以 object-fit: cover 填滿 */
.capsule-video-frame {
  box-sizing: border-box;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: auto;
  background: transparent;
  opacity: 0;
  transform: scale(0.92) translateY(12px);
  filter: drop-shadow(0 28px 56px rgba(5, 14, 32, 0.42));
  transition:
    opacity 0.52s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.55s ease;
}

.capsule-overlay.video-open .capsule-video-frame {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.capsule-video {
  box-sizing: border-box;
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center center;
  background: transparent;
  background-color: transparent;
}

.capsule-overlay.video-open .overlay-capsule {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.capsule-overlay.video-open .overlay-note {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.overlay-capsule {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(74vw, 350px);
  aspect-ratio: 1 / 1;
  overflow: visible;
  box-shadow: none;
  transform: translate(-50%, -50%) scale(0.62);
  transition:
    transform 0.55s cubic-bezier(0.2, 0.9, 0.2, 1),
    opacity 0.25s ease;
}

.capsule-artwork {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 14px 26px rgba(0, 0, 0, 0.34));
  transition: transform 0.45s ease;
}

.capsule-scroll {
  position: absolute;
  left: 47%;
  bottom: 27%;
  width: 34%;
  height: 56%;
  transform: translate(-50%, 8%) scale(0.45);
  transform-origin: bottom center;
  opacity: 0;
  transition:
    transform 0.6s cubic-bezier(0.2, 0.9, 0.2, 1),
    opacity 0.28s ease;
}

.scroll-roll {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 64%;
  height: 44%;
  border-radius: 24px;
  transform: translateX(-50%);
  background: radial-gradient(circle at 35% 35%, #f6f0e4 0%, #d7c7af 100%);
  border: 1px solid rgba(140, 110, 76, 0.4);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.2);
}

.scroll-paper-tip {
  position: absolute;
  left: 50%;
  bottom: 30%;
  width: 40%;
  height: 8%;
  border-radius: 4px 4px 0 0;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #f8f3e7 0%, #e8dcc7 100%);
  border: 1px solid rgba(155, 126, 88, 0.28);
  border-bottom: none;
  transition: height 0.45s ease;
}

.overlay-note {
  position: relative;
  z-index: 1;
  width: min(78vw, 288px);
  height: min(42vh, 246px);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(180deg, #fffdf8 0%, #f3ede2 100%);
  border: 1px solid rgba(196, 174, 145, 0.55);
  box-shadow:
    0 22px 52px rgba(8, 16, 30, 0.36),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  opacity: 0;
  transform: translateY(10px) scale(0.45);
  transform-origin: 50% 18%;
  transition:
    transform 0.76s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.45s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.note-string {
  position: absolute;
  top: 2px;
  width: 82px;
  height: 2px;
  background: linear-gradient(90deg, #a06a33, #c58b46);
  transform-origin: center;
  transition:
    transform 0.45s ease,
    opacity 0.3s ease;
}

.note-string-left {
  left: calc(50% - 82px);
}

.note-string-right {
  left: 50%;
}

.note-knot {
  position: absolute;
  top: -7px;
  left: 50%;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #eac489 0%, #b67a36 80%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transition:
    transform 0.35s ease,
    opacity 0.3s ease;
}

.capsule-overlay.active .overlay-backdrop {
  opacity: 1;
}

.capsule-overlay.release-knot .overlay-capsule {
  transform: translate(-50%, -50%) scale(0.72);
}

.capsule-overlay.release-knot .capsule-artwork {
  transform: rotate(-4deg) translateY(-4px);
}

.capsule-overlay.release-knot .overlay-note {
  opacity: 1;
  transform: translateY(0) scale(0.46);
}

.capsule-overlay.release-knot .note-string-left {
  transform: translateX(-20px) rotate(-18deg);
}

.capsule-overlay.release-knot .note-string-right {
  transform: translateX(20px) rotate(18deg);
}

.capsule-overlay.release-knot .note-knot {
  transform: translateY(-10px) scale(0.6);
  opacity: 0;
}

.capsule-overlay.pull-scroll .capsule-scroll {
  opacity: 1;
  transform: translate(-50%, -46%) scale(1);
}

.capsule-overlay.pull-scroll .scroll-paper-tip {
  height: 46%;
}

.capsule-overlay.unfold-paper .overlay-capsule {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.95);
}

.capsule-overlay.unfold-paper .overlay-note {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 0;
  border: none;
  padding: 14px 14px calc(12px + env(safe-area-inset-bottom));
  transform: translateY(0) scale(1);
  background-image: url("./素材/背景底图/底图1.png");
  background-size: 130%;
  background-position: center;
  background-repeat: no-repeat;
}

.capsule-overlay.show-page .overlay-backdrop {
  opacity: 0;
}

.capsule-overlay.show-page .overlay-note {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  padding: 14px 14px calc(10px + env(safe-area-inset-bottom));
}

.capsule-overlay.show-page .note-date {
  align-self: flex-end;
  flex-shrink: 0;
}

.note-date {
  align-self: flex-end;
  width: 84px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(11, 31, 67, 0.78);
  color: #f6f7fb;
  border-radius: 3px;
  text-align: center;
  padding: 6px 0 7px;
}

.note-date strong {
  display: block;
  font-size: 28px;
  line-height: 1;
  font-weight: 500;
}

.note-date span {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.3px;
}

#capsule-note-time {
  margin-top: 2px;
  font-size: 10px;
  opacity: 0.92;
}

.wisdom-card {
  width: 100%;
  min-height: clamp(158px, 24vh, 210px);
  flex-shrink: 0;
  border-radius: 14px;
  padding: 16px 14px;
  background-image: url("./素材/思想家头像/亚里士多德.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid rgba(220, 200, 166, 0.45);
  display: flex;
  align-items: center;
}

.wisdom-quote {
  margin: 0;
  max-width: 56%;
  color: #efe8dd;
  font-size: clamp(19px, 4.8vw, 30px);
  line-height: 1.75;
  letter-spacing: 0.8px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  white-space: pre-line;
}

.wisdom-story {
  position: relative;
  width: 100%;
  flex: 1 1 0;
  min-height: clamp(220px, 30vh, 380px);
  border-radius: 12px;
  padding: 12px 14px 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.capsule-overlay.show-page .wisdom-story {
  /* 固定高度：不隨內容長短變化，超出文字在框內捲動 */
  flex: none;
  height: clamp(420px, 38vh, 520px);
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
  /* 加大內距讓文字與裝飾框邊緣保持距離 */
  padding: 20px 20px 20px 24px;
  overflow: hidden;
  isolation: isolate;
}

.capsule-overlay.show-page .wisdom-story-toolbar {
  padding-top: 2px;
  padding-left: 4px;
  margin-bottom: 6px;
}

.wisdom-story::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("./素材/装饰元素/边框3.png");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.95;
  pointer-events: none;
}

.wisdom-story > * {
  position: relative;
  z-index: 1;
}

.wisdom-story-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.wisdom-story-toolbar h3 {
  margin:0;
  font-size: 20px;
  color: #38445b;
  font-weight: 500;
}

.capsule-insight-trigger {
  flex-shrink: 0;
  border: none;
  background: transparent;
  padding: 2px;
  border-radius: 10px;
  cursor: pointer;
  line-height: 0;
  opacity: 0.92;
}

.capsule-insight-trigger:focus-visible {
  outline: 2px solid rgba(74, 123, 198, 0.65);
  outline-offset: 2px;
}

.capsule-insight-trigger:active {
  opacity: 0.75;
}

.capsule-insight-trigger img {
  display: block;
  width: clamp(36px, 9vw, 44px);
  height: clamp(36px, 9vw, 44px);
  object-fit: contain;
}

.capsule-insight-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.capsule-insight-modal[hidden] {
  display: none !important;
}

.capsule-insight-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.capsule-insight-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  max-height: min(72vh, 520px);
  display: flex;
  flex-direction: column;
  background: #fffdf8;
  border-radius: 14px;
  border: 1px solid rgba(170, 155, 131, 0.35);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.capsule-insight-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(223, 214, 195, 0.85);
}

.capsule-insight-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #38445b;
}

.capsule-insight-close {
  border: none;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
  padding: 0 4px;
}

.capsule-insight-body {
  padding: 14px 16px 18px;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.65;
  color: #454d5a;
  -webkit-overflow-scrolling: touch;
}

.wisdom-story p {
  margin: 0;
  color: #454d5a;
  font-size: clamp(14px, 3.5vw, 16px);
  line-height: 1.58;
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 6px;
  -webkit-overflow-scrolling: touch;
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
  touch-action: pan-y;
}

.wisdom-story p::-webkit-scrollbar {
  width: 6px;
}

.wisdom-story p::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(120, 126, 138, 0.38);
}

.wisdom-story p::selection {
  background: rgba(74, 123, 198, 0.26);
  color: #1f2a3d;
}

.capsule-story-select-confirm {
  position: absolute;
  right: 14px;
  bottom: 10px;
  z-index: 2;
  border: none;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
  background: #2563eb;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.capsule-story-select-confirm:active {
  opacity: 0.88;
}

.note-actions {
  width: 100%;
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.note-actions > button:not(.capsule-skip-series-btn) {
  flex: 1 1 0;
  min-width: 0;
}

.capsule-skip-series-btn {
  width: 100%;
  flex: 0 0 100%;
  background: rgba(220, 90, 80, 0.08) !important;
  border-color: rgba(200, 80, 70, 0.35) !important;
  color: #b03a30 !important;
  font-size: 13px !important;
}

/* 閱讀頁底欄：flex-shrink 0 確保按鈕不被壓縮，margin-top 控制框底與按鈕距離 */
.capsule-overlay.show-page .note-actions {
  flex-shrink: 0;
  margin-top: 0;
  padding-bottom: 4px;
}

.note-actions button {
  border: 1px solid rgba(170, 155, 131, 0.45);
  background: rgba(251, 246, 236, 0.5);
  border-radius: 999px;
  padding: 8px 0;
  font-size: 14px;
  color: #59616e;
}

.close-note {
  position: absolute;
  top: 14px;
  left: 14px;
  border: 1px solid rgba(223, 214, 195, 0.82);
  background: rgba(255, 253, 247, 0.92);
  color: #5a6069;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  z-index: 2;
}

.meteor-setting {
  margin-top: 20px;
  padding: 14px;
  border: 1px solid #e8ebf0;
  border-radius: 12px;
  background: #fafbff;
}

.meteor-setting h3 {
  margin: 0;
  font-size: 17px;
}

.setting-desc {
  margin: 8px 0 12px;
  font-size: 13px;
  color: #6b7280;
}

.setting-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: #374151;
}

.setting-select {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  background: #ffffff;
}

.time-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.time-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: 10px;
}

.time-item span {
  font-size: 13px;
  color: #4b5563;
}

.time-item input[type="time"] {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 14px;
  background: #ffffff;
}

.save-settings {
  margin-top: 14px;
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  color: #ffffff;
  background: #2563eb;
}

.test-settings {
  margin-top: 8px;
  width: 100%;
  border: 1px solid #dbe4f3;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  color: #334155;
  background: #ffffff;
}

.setting-status {
  min-height: 20px;
  margin: 8px 0 0;
  font-size: 13px;
  color: #475569;
}

.setting-next {
  margin: 6px 0 0;
  font-size: 12px;
  color: #64748b;
}

.meteor-layer {
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  overflow: hidden;
  display: none;
}

.meteor-layer.active {
  display: block;
  pointer-events: auto;
  /* 低於智慧膠囊全層(30)：產品策略為「關閉膠囊後才播流星」，不在膠囊之上疊放 */
  z-index: 25;
}

.meteor-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 18, 32, 0.78);
  opacity: 0;
  transition: opacity 0.35s ease;
  backdrop-filter: blur(3px);
}

.meteor-layer.active .meteor-backdrop {
  opacity: 1;
}

.meteor-field {
  position: absolute;
  inset: 0;
}

.meteor-comet-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.meteor-shower-video-host .meteor-shower-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  pointer-events: none;
}

.meteor-streak {
  position: absolute;
  width: var(--meteor-width, 220px);
  height: var(--meteor-height, 5px);
  top: var(--meteor-top, 20vh);
  left: var(--meteor-left, 110%);
  opacity: 0;
  transform-origin: left center;
  transform: rotate(var(--meteor-angle, -58deg));
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 1) 0%,
    rgba(255, 255, 255, 0.98) 22%,
    rgba(230, 248, 255, 0.72) 42%,
    rgba(200, 230, 255, 0.38) 62%,
    rgba(255, 255, 255, 0) 100%
  );
  box-shadow:
    0 0 10px 2px rgba(255, 255, 255, 0.55),
    0 0 22px 6px rgba(186, 220, 255, 0.45);
  animation: meteor-fly var(--meteor-duration, 2s) ease-out
    var(--meteor-delay, 0s) 1 forwards;
}

.meteor-streak::after {
  content: "";
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 1);
  box-shadow:
    0 0 10px 5px rgba(220, 245, 255, 1),
    0 0 22px 10px rgba(180, 220, 255, 0.65),
    0 0 36px 14px rgba(140, 200, 255, 0.35);
}

.meteor-hero {
  background: linear-gradient(
    90deg,
    rgba(255, 252, 235, 1) 0%,
    rgba(255, 230, 140, 0.99) 18%,
    rgba(255, 200, 80, 0.82) 38%,
    rgba(255, 180, 60, 0.42) 58%,
    rgba(255, 160, 40, 0) 100%
  );
  filter: brightness(1.38) saturate(1.18);
  box-shadow:
    0 0 28px rgba(255, 220, 140, 0.7),
    0 0 56px rgba(255, 195, 90, 0.45),
    0 0 88px rgba(255, 170, 60, 0.28);
  animation: meteor-fly var(--meteor-duration, 3.4s) linear
    var(--meteor-delay, 0s) 1 forwards;
}

.meteor-hero::after {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 35% 35%,
    #fffef5 0%,
    #ffe566 45%,
    #ffb020 100%
  );
  box-shadow:
    0 0 12px 6px rgba(255, 240, 200, 1),
    0 0 28px 14px rgba(255, 200, 80, 0.9),
    0 0 52px 22px rgba(255, 170, 40, 0.55);
}

@keyframes meteor-fly {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(var(--meteor-angle, -58deg));
  }
  8% {
    opacity: 1;
  }
  88% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
    transform: translate(
        calc(-1 * var(--meteor-distance-x, 110vw)),
        var(--meteor-distance-y, 130vh)
      )
      rotate(var(--meteor-angle, -58deg));
  }
}

/* 智慧流星：中央草書金句 + 斷開式金色虛線（無框） */
.meteor-quote {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 600px);
  padding: 0 20px;
  box-sizing: border-box;
  visibility: hidden;
  pointer-events: none;
  cursor: pointer;
  isolation: isolate;
}

.meteor-layer.show-note .meteor-quote {
  visibility: visible;
  pointer-events: auto;
}

.meteor-quote-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.35rem;
  width: 100%;
}

.meteor-quote-block {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

/* 上下各一排「斷開」金線：多段 + 虛線 */
.meteor-quote-lines {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(0.55rem, 3vw, 1.1rem);
  width: 100%;
  max-width: 94%;
}

.meteor-quote-seg {
  display: block;
  height: 0;
  border: none;
  border-top: 1px dashed rgba(230, 200, 130, 0.82);
  box-shadow:
    0 0 5px rgba(255, 220, 150, 0.35),
    0 0 14px rgba(255, 185, 80, 0.22);
  flex: 1 1 auto;
  min-width: 2.5rem;
  max-width: 30%;
}

.meteor-quote-lines--bottom .meteor-quote-seg--short {
  max-width: 18%;
  min-width: 2rem;
  opacity: 0.75;
}

.meteor-quote-lines--bottom .meteor-quote-seg--long {
  max-width: 42%;
}

.meteor-layer.show-note .meteor-quote-seg {
  animation: meteor-gold-line-pulse 2.55s ease-in-out infinite;
}

@keyframes meteor-gold-line-pulse {
  0%,
  100% {
    opacity: 0.42;
    filter: brightness(0.82);
    border-top-color: rgba(200, 168, 95, 0.55);
  }

  50% {
    opacity: 1;
    filter: brightness(1.35);
    border-top-color: rgba(255, 236, 190, 0.95);
  }
}

.meteor-quote-inner {
  position: relative;
  padding: 0.25rem 0.15rem;
  min-height: 5.5rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.meteor-note-text {
  position: relative;
  z-index: 1;
  margin: 0;
  overflow: visible;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  align-content: center;
  gap: 0.06em 0.02em;
  font-family:
    "STKaiti",
    "Kaiti SC",
    "KaiTi",
    "BiauKai",
    "DFKai-SB",
    "FangSong",
    "STFangSong",
    "Noto Serif SC",
    serif;
  font-size: clamp(1.65rem, 6.2vw, 2.15rem);
  font-weight: 400;
  line-height: 1.75;
  text-align: center;
  letter-spacing: 0.12em;
  color: #ffe97a;
  width: 100%;
  text-shadow:
    0 0 4px  rgba(255, 255, 180, 0.9),
    0 0 14px rgba(255, 210, 80, 0.85),
    0 0 30px rgba(255, 170, 40, 0.65),
    0 0 55px rgba(200, 120, 20, 0.42),
    0 0 90px rgba(140, 80, 0, 0.22);
}

.meteor-layer.show-note .meteor-note-text {
  animation: meteor-text-glow-pulse 2.55s ease-in-out infinite;
}

@keyframes meteor-text-glow-pulse {
  0%,
  100% {
    text-shadow:
      0 0 3px rgba(255, 252, 200, 0.75),
      0 0 10px rgba(255, 205, 75, 0.68),
      0 0 22px rgba(255, 165, 40, 0.48),
      0 0 42px rgba(185, 115, 25, 0.28);
  }

  50% {
    text-shadow:
      0 0 5px rgba(255, 255, 220, 0.95),
      0 0 16px rgba(255, 220, 110, 0.92),
      0 0 34px rgba(255, 175, 55, 0.72),
      0 0 62px rgba(200, 125, 30, 0.45),
      0 0 88px rgba(120, 70, 10, 0.2);
  }
}

/* 初始狀態：暗、模糊、略下移 */
.meteor-quote-char {
  position: relative;
  display: inline-block;
  opacity: 0;
  transform: translate3d(0, 0.14em, 0);
  filter: blur(6px);
  color: rgba(255, 200, 60, 0.15);
  text-shadow: none;
  will-change: transform, opacity, filter, color, text-shadow;
}

/* 逐字迸發：金色光粒子（與字浮現節奏對齊） */
.meteor-layer.show-note .meteor-quote-char:not(.meteor-quote-char--nos)::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 3px;
  margin: -1.5px 0 0 -1.5px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
  background: transparent;
  box-shadow:
    0 -15px 3px 0 rgba(255, 248, 210, 0.95),
    11px -11px 2px 0 rgba(255, 228, 150, 0.92),
    16px 0 2px 0 rgba(255, 205, 95, 0.88),
    11px 11px 2px 0 rgba(255, 190, 75, 0.85),
    0 15px 2px 0 rgba(255, 215, 120, 0.82),
    -11px 11px 2px 0 rgba(255, 235, 175, 0.88),
    -16px 0 2px 0 rgba(255, 240, 195, 0.9),
    -11px -11px 2px 0 rgba(255, 220, 130, 0.9),
    0 -24px 4px -1px rgba(255, 185, 60, 0.55),
    19px -19px 4px -1px rgba(255, 175, 50, 0.48),
    24px 0 4px -1px rgba(255, 165, 45, 0.45),
    19px 19px 4px -1px rgba(255, 195, 80, 0.42),
    0 24px 4px -1px rgba(255, 200, 90, 0.45),
    -19px 19px 4px -1px rgba(255, 210, 110, 0.48),
    -24px 0 4px -1px rgba(255, 225, 150, 0.5),
    -19px -19px 4px -1px rgba(255, 215, 100, 0.52);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.12);
  transform-origin: center center;
  animation: meteor-char-gold-sparks 0.62s cubic-bezier(0.22, 0.82, 0.35, 1) forwards;
  animation-delay: calc(var(--char-i, 0) * 0.038s + 0.48s);
}

@keyframes meteor-char-gold-sparks {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.08);
    filter: blur(0);
  }

  14% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.72);
    filter: blur(0.5px);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.45);
    filter: blur(2px);
  }
}

/* show-note 後才觸發逐字動畫 */
.meteor-layer.show-note .meteor-quote-char {
  animation: meteor-char-gold-emerge 1.3s cubic-bezier(0.16, 0.04, 0.22, 1) forwards;
  animation-delay: calc(var(--char-i, 0) * 0.038s);
}

@keyframes meteor-char-gold-emerge {
  0% {
    opacity: 0;
    transform: translate3d(0, 0.14em, 0);
    filter: blur(6px);
    color: rgba(255, 195, 50, 0.12);
    text-shadow: none;
  }

  /* 字從霧中探出，暖橙先亮 */
  38% {
    opacity: 0.82;
    transform: translate3d(0, 0.02em, 0);
    filter: blur(1.5px);
    color: #ffcc44;
    text-shadow:
      0 0 6px  rgba(255, 240, 140, 0.95),
      0 0 20px rgba(255, 190, 60,  0.8),
      0 0 42px rgba(220, 130, 20,  0.55);
  }

  /* 穩定落地，深金色帶燃燒暈 */
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    filter: blur(0);
    color: #ffe97a;
    text-shadow:
      0 0 3px  rgba(255, 255, 200, 0.92),
      0 0 12px rgba(255, 210, 80,  0.88),
      0 0 28px rgba(255, 165, 35,  0.68),
      0 0 52px rgba(195, 110, 10,  0.44),
      0 0 80px rgba(130,  70,  0,  0.24);
  }
}

.close-meteor {
  flex-shrink: 0;
  margin: 0;
  padding: 11px 28px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 95, 0.55);
  background: rgba(12, 22, 42, 0.88);
  color: rgba(255, 244, 220, 0.92);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  line-height: 1.45;
  cursor: pointer;
  box-shadow:
    0 0 0 1px rgba(255, 236, 200, 0.12) inset,
    0 4px 18px rgba(0, 0, 0, 0.35);
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-focus-ring-color: transparent;
  outline: none;
  outline-offset: 0;
}

.close-meteor::-moz-focus-inner {
  border: 0;
}

.close-meteor:hover,
.close-meteor:focus-visible {
  border-color: rgba(236, 210, 150, 0.85);
  color: #fffdf6;
  background: rgba(18, 32, 58, 0.92);
  outline: none;
}

.close-meteor:active {
  transform: scale(0.98);
}

@media (prefers-reduced-motion: reduce) {
  .meteor-layer.show-note .meteor-quote-seg {
    animation: none;
    opacity: 0.75;
    filter: none;
  }

  .meteor-layer.show-note .meteor-note-text {
    animation: none;
  }

  .meteor-layer.show-note .meteor-quote-char {
    animation: none;
    opacity: 1;
    transform: none;
    filter: none;
    color: #ffe97a;
  }

  .meteor-layer.show-note .meteor-quote-char::after {
    display: none;
  }
}

.tab-bar {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  min-height: 66px;
}

body.main-tab-bar-visible .tab-bar {
  display: grid;
}

.tab {
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 2px 8px;
}

.tab-icon {
  width: 31px;
  height: 31px;
  object-fit: contain;
  flex-shrink: 0;
}

.tab-label {
  line-height: 1.1;
}

.tab.active {
  color: var(--primary);
  font-weight: 600;
}

body.home-bg-active .tab {
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

body.home-bg-active .tab.active {
  color: #ffffff;
  font-weight: 700;
}

/* 蘋果：牛頓式瞬間 — 沉墜、靜默、靈光乍現 */
.apple-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 24;
  /* 苹果掉落动画不透明度：越接近 1 越实。
     WebP 已是真透明，預設 1；如想讓蘋果融入暗色場景，可在父層覆寫此變數。 */
  --apple-drop-video-opacity: 1;
}

.apple-veil {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 120% 90% at 50% 42%,
    rgba(25, 35, 70, 0.35) 0%,
    rgba(4, 8, 22, 0.72) 55%,
    rgba(2, 4, 14, 0.88) 100%
  );
  animation: apple-veil-mood 2.85s ease-in-out forwards;
}

@keyframes apple-veil-mood {
  0% {
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  68% {
    opacity: 1;
  }
  78% {
    opacity: 0.38;
  }
  88% {
    opacity: 0.72;
  }
  100% {
    opacity: 0.55;
  }
}

.apple-enlighten-bloom {
  position: absolute;
  left: 50%;
  top: 56%;
  width: min(120vw, 520px);
  height: min(120vw, 520px);
  margin-left: calc(min(120vw, 520px) / -2);
  margin-top: calc(min(120vw, 520px) / -2);
  border-radius: 50%;
  background: radial-gradient(
    circle at 45% 42%,
    rgba(255, 255, 250, 0.95) 0%,
    rgba(255, 235, 180, 0.45) 18%,
    rgba(255, 200, 120, 0.22) 38%,
    rgba(180, 140, 255, 0.08) 58%,
    transparent 72%
  );
  filter: blur(2px);
  transform: scale(0);
  opacity: 0;
  animation: apple-enlighten-bloom 1.35s cubic-bezier(0.22, 1, 0.36, 1) 1.78s
    forwards;
  z-index: 25;
}

@keyframes apple-enlighten-bloom {
  0% {
    transform: scale(0.05);
    opacity: 0;
    filter: blur(8px);
  }
  28% {
    opacity: 1;
    filter: blur(1px);
  }
  100% {
    transform: scale(2.4);
    opacity: 0;
    filter: blur(12px);
  }
}

.apple-rays {
  position: absolute;
  left: 50%;
  top: 56%;
  width: 220vmin;
  height: 220vmin;
  margin-left: -110vmin;
  margin-top: -110vmin;
  background: repeating-conic-gradient(
    from 0deg at 50% 50%,
    transparent 0deg 10deg,
    rgba(255, 252, 235, 0.14) 10deg 11deg
  );
  opacity: 0;
  animation: apple-rays-flash 1.1s ease-out 1.76s forwards;
  z-index: 25;
}

@keyframes apple-rays-flash {
  0% {
    opacity: 0;
    transform: scale(0.15) rotate(-6deg);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(0.55) rotate(4deg);
  }
}

.apple-rings {
  position: absolute;
  left: 50%;
  top: 56%;
  width: 0;
  height: 0;
  z-index: 26;
}

.apple-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 230, 190, 0.55);
  box-shadow:
    0 0 20px rgba(255, 220, 160, 0.35),
    inset 0 0 12px rgba(255, 255, 255, 0.15);
  opacity: 0;
  animation: apple-ring-expand 1.15s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(1.72s + var(--ring-i, 0) * 0.1s);
}

@keyframes apple-ring-expand {
  0% {
    transform: scale(0.2);
    opacity: 0.9;
  }
  100% {
    transform: scale(14);
    opacity: 0;
  }
}

.apple-sparkles {
  position: absolute;
  left: 50%;
  top: 56%;
  width: 0;
  height: 0;
  z-index: 27;
}

.apple-spark {
  position: absolute;
  left: 0;
  top: 0;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 1) 0%,
    rgba(255, 230, 160, 0.6) 45%,
    transparent 70%
  );
  opacity: 0;
  transform: rotate(var(--spark-angle, 0deg)) translateY(0);
  animation: apple-spark-fly 0.85s cubic-bezier(0.22, 1, 0.36, 1) 1.8s forwards;
}

@keyframes apple-spark-fly {
  0% {
    opacity: 0;
    transform: rotate(var(--spark-angle, 0deg)) translateY(0) scale(0.2);
  }
  25% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: rotate(var(--spark-angle, 0deg))
      translateY(calc(-1 * min(28vw, 140px))) scale(0.6);
  }
}

.apple-drop {
  position: absolute;
  top: 0;
  font-size: clamp(52px, 14vw, 72px);
  z-index: 28;
  transform: translate(-50%, -18vh) rotate(-6deg);
  animation: apple-fall-philosophy 1.95s cubic-bezier(0.33, 0.67, 0.28, 1)
    forwards;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.35));
}

.apple-drop--video {
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  transform: none;
  animation: none;
  font-size: 0;
  filter: none;
}

.apple-drop-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  opacity: var(--apple-drop-video-opacity, 0.9);
  pointer-events: none;
}

.apple-body {
  position: relative;
  display: inline-block;
}

.apple-body::before {
  content: "";
  position: absolute;
  top: 12%;
  left: 25%;
  width: 30%;
  height: 20%;
  background: radial-gradient(
    ellipse at 50% 50%,
    rgba(255, 255, 255, 0.85) 0%,
    transparent 70%
  );
  border-radius: 50%;
  z-index: 1;
}

.apple-body::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 8px;
  background: #6b4226;
  border-radius: 0 0 2px 2px;
}

@keyframes apple-fall-philosophy {
  0% {
    transform: translate(-50%, -18vh) rotate(-8deg);
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.25)) brightness(1);
  }
  52% {
    transform: translate(-50%, 44vh) translateX(6px) rotate(5deg);
    filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.3)) brightness(1);
  }
  72% {
    transform: translate(-50%, 54.5vh) translateX(-3px) rotate(11deg);
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.45)) brightness(0.92);
  }
  78% {
    transform: translate(-50%, 52.8vh) rotate(9deg);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5)) brightness(1.08);
  }
  84% {
    transform: translate(-50%, 54.2vh) rotate(10deg);
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.4)) brightness(1);
  }
  100% {
    transform: translate(-50%, 53.5vh) rotate(9deg);
    filter: drop-shadow(0 5px 14px rgba(0, 0, 0, 0.42)) brightness(1);
  }
}

.apple-idea {
  position: absolute;
  top: 56%;
  transform: translate(-50%, -50%) scale(0);
  font-size: clamp(44px, 12vw, 64px);
  z-index: 30;
  opacity: 0;
  animation: apple-idea-enlighten 1.05s cubic-bezier(0.34, 1.56, 0.64, 1) 1.82s
    forwards;
  filter: drop-shadow(0 0 24px rgba(255, 220, 140, 0.9));
}

.apple-idea-aura {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120%;
  height: 120%;
  margin: -60% 0 0 -60%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(255, 235, 160, 0.35) 35%,
    rgba(255, 200, 100, 0.12) 55%,
    transparent 70%
  );
  transform: scale(0);
  animation: apple-idea-aura-pop 0.9s ease-out 1.8s forwards;
  pointer-events: none;
}

.apple-idea-bulb {
  position: relative;
  z-index: 1;
  display: inline-block;
}

@keyframes apple-idea-aura-pop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

@keyframes apple-idea-enlighten {
  0% {
    transform: translate(-50%, -50%) scale(0) rotate(-18deg);
    opacity: 0;
    filter: drop-shadow(0 0 0 transparent) blur(6px);
  }
  45% {
    transform: translate(-50%, -50%) scale(1.15) rotate(4deg);
    opacity: 1;
    filter: drop-shadow(0 0 36px rgba(255, 230, 160, 1)) blur(0);
  }
  70% {
    transform: translate(-50%, -50%) scale(0.96) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
    opacity: 1;
    filter: drop-shadow(0 0 20px rgba(255, 210, 130, 0.85));
  }
}

/* 智慧流星子页 */
.wisdom-notes-meteor-hint {
  margin: 0 0 16px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  border-radius: 10px;
  border: 1px dashed var(--line);
  background: rgba(252, 249, 242, 0.75);
}

.meteor-note-actions {
  width: 100%;
  max-width: min(92vw, 600px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 10px;
  box-sizing: border-box;
  justify-items: center;
  -webkit-tap-highlight-color: transparent;
}

/* 勿讓按鈕撐滿整欄：格線上拉滿的 button 在部分瀏覽器會畫「矩形」焦點環，看起來像淡藍框包住藥丸 */
.meteor-note-actions button {
  justify-self: center;
  width: auto;
  min-width: min(36vw, 9.5rem);
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(230, 200, 130, 0.55);
  background: rgba(30, 22, 10, 0.42);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  color: #f8ecd4;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-focus-ring-color: transparent;
  outline: none;
  outline-offset: 0;
}

.meteor-note-actions button::-moz-focus-inner {
  border: 0;
}

.meteor-note-actions button:focus,
.meteor-note-actions button:focus-visible {
  outline: none;
  box-shadow: none;
}

.meteor-note-actions button:active {
  opacity: 0.9;
}

/* 流星對話內所有按鈕：再壓一層，避免 WebView／系統瀏覽器仍畫預設焦點框 */
#meteor-note.meteor-quote .meteor-note-actions button,
#meteor-note.meteor-quote .close-meteor {
  -webkit-tap-highlight-color: transparent;
  -webkit-focus-ring-color: transparent;
}

#meteor-note.meteor-quote .meteor-note-actions button:focus,
#meteor-note.meteor-quote .meteor-note-actions button:focus-visible,
#meteor-note.meteor-quote .close-meteor:focus,
#meteor-note.meteor-quote .close-meteor:focus-visible {
  outline: none;
}

.page[data-page="my-capsules"].active,
.page[data-page="saved-stories"].active,
.page[data-page="wisdom-notes"].active,
.page[data-page="meteor"].active {
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  min-height: auto;
}

.page[data-page="saved-stories"].active,
.page[data-page="wisdom-notes"].active {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.mine-subpage-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.mine-subpage-panels {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 與首頁 .tab-bar 同構：底欄網格 + 圖標上、文字下 */
.mine-inner-tabbar {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  min-height: 66px;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card);
  border-top: 1px solid var(--line);
}

.mine-inner-tab {
  margin: 0;
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 2px 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
}

.mine-inner-tab.is-active {
  color: var(--primary);
  font-weight: 600;
}

.wisdom-notes-page-card {
  margin: 0;
  padding: 0 max(10px, env(safe-area-inset-left)) 20px
    max(10px, env(safe-area-inset-right));
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.wisdom-notes-compose {
  position: relative;
  margin: 38px 0 18px;
  padding: 0;
  border: 1px solid rgba(214, 197, 170, 0.45);
  border-radius: 14px;
  background: rgba(252, 249, 242, 0.94);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

.wisdom-notes-compose-body {
  position: relative;
  z-index: 1;
  padding: 16px;
}

.wisdom-notes-compose-quill {
  position: absolute;
  z-index: 2;
  right: max(10px, 2vw);
  top: -40px;
  width: 48px;
  height: 58px;
  pointer-events: none;
  filter: drop-shadow(0 3px 6px rgba(15, 23, 42, 0.12));
  transform: rotate(-18deg);
  transform-origin: 65% 92%;
  opacity: 0.92;
  animation: wisdom-quill-write 4.5s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .wisdom-notes-compose-quill {
    animation: none;
  }
}

@keyframes wisdom-quill-write {
  0%,
  100% {
    transform: rotate(-18deg) translate(0, 0);
  }
  40% {
    transform: rotate(-14deg) translate(-2px, 2px);
  }
  65% {
    transform: rotate(-19deg) translate(1px, 0);
  }
}

.wisdom-notes-quill-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.wisdom-notes-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.wisdom-notes-compose .wisdom-notes-label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text);
  margin-bottom: 8px;
}

.wisdom-note-input {
  width: 100%;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  font-family: inherit;
  resize: vertical;
  min-height: 88px;
  box-sizing: border-box;
  color: #000000;
}

.wisdom-notes-compose .wisdom-note-input {
  min-height: 88px;
  padding: 10px 12px;
  line-height: 1.5;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  background-image: none;
  box-shadow: none;
}

.wisdom-notes-compose .wisdom-note-save-btn {
  box-shadow: none;
}

.wisdom-note-save-btn {
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  background: var(--primary);
  cursor: pointer;
}

.wisdom-note-save-btn:active {
  opacity: 0.9;
}

.wisdom-notes-list-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.wisdom-notes-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.wisdom-notes-empty {
  padding: 18px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  border-radius: 10px;
  border: 1px dashed var(--line);
}

.wisdom-note-item {
  position: relative;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.wisdom-note-item--with-source {
  padding-bottom: 44px;
}

.wisdom-note-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.wisdom-note-item-time {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
}

.wisdom-note-item-delete {
  flex-shrink: 0;
  margin: 0;
  padding: 4px 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #b45309;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.wisdom-note-item-delete:active {
  opacity: 0.7;
}

.wisdom-note-item-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: #000000;
  font-weight: 600;
  white-space: pre-wrap;
  word-break: break-word;
}

.wisdom-note-source-excerpt {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 12px;
  line-height: 1.5;
  color: #a3a3a3;
  font-weight: 400;
  white-space: pre-wrap;
  word-break: break-word;
}

.wisdom-note-source-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  -webkit-tap-highlight-color: transparent;
}

.wisdom-note-source-btn img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

.wisdom-note-source-btn:active {
  opacity: 0.82;
}

/* 膠囊／流星小記彈窗（須高於播放中的 .meteor-layer.active，否則無法輸入） */
.capsule-note-composer-layer {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) 16px
    max(12px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

.capsule-note-composer-layer.is-open {
  display: flex;
}

.capsule-note-composer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(2px);
}

.capsule-note-composer-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 360px);
  max-height: min(85vh, 520px);
  overflow: auto;
  padding: 18px 16px 16px;
  border-radius: 14px;
  background: #fffdf8;
  border: 1px solid rgba(200, 182, 155, 0.45);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
}

.capsule-note-composer-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.capsule-note-composer-hint {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.capsule-note-composer-input {
  width: 100%;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  font-family: inherit;
  resize: vertical;
  min-height: 120px;
  box-sizing: border-box;
  background: #ffffff;
  color: #000000;
}

.capsule-note-composer-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.capsule-note-composer-cancel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
}

.capsule-note-composer-save {
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  background: var(--primary);
  cursor: pointer;
}

.saved-stories-page-card {
  margin: 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.saved-stories-list {
  margin: 0;
  padding: 0 max(10px, env(safe-area-inset-left)) 20px
    max(10px, env(safe-area-inset-right));
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.saved-stories-empty {
  padding: 18px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  border-radius: 10px;
  border: 1px dashed var(--line);
}

.saved-stories-item {
  padding: 14px 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.saved-stories-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.saved-stories-item-meta {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.saved-stories-item-delete {
  flex-shrink: 0;
  margin: 0;
  padding: 4px 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #b45309;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.saved-stories-item-delete:active {
  opacity: 0.7;
}

.saved-stories-item-title {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px;
  line-height: 1.35;
}

.saved-stories-block-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.35px;
  color: var(--muted);
  margin: 10px 0 6px;
}

.saved-stories-block-label:first-of-type {
  margin-top: 0;
}

.saved-stories-quote {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #475569;
}

.saved-stories-story {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: #334155;
}

.my-capsules-back-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 6px 8px 2px max(4px, env(safe-area-inset-left));
  margin: 0;
  background: transparent;
}

.my-capsules-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.my-capsules-back:active {
  opacity: 0.65;
}

.my-capsules-back-icon {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.my-capsules-page-card {
  margin: 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.my-capsules-list {
  margin: 0;
  padding: 0 max(10px, env(safe-area-inset-left)) 20px
    max(10px, env(safe-area-inset-right));
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.my-capsules-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(24px, 6.5vw, 34px) clamp(22px, 7vw, 40px)
    clamp(46px, 10vw, 56px);
  border-radius: 14px;
  border: none;
  background-color: transparent;
  background-image: url("./素材/组件底图/板块2.png");
  background-position: center;
  /* 整張板塊圖即外框視覺，鋪滿 li 邊界 */
  background-size: 100% 100%;
  background-repeat: no-repeat;
  box-shadow: none;
  overflow: hidden;
}

.my-capsules-item-body {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(34em, 100%);
  margin: 0 auto;
  padding: 4px 2px clamp(8px, 2vh, 14px);
  text-align: center;
}

.my-capsules-story-link {
  position: absolute;
  left: 50%;
  bottom: clamp(26px, 6vw, 40px);
  transform: translateX(-50%);
  z-index: 2;
  font-size: 12px;
  font-weight: 500;
  color: #b8860b;
  text-shadow: 0 0 6px rgba(255, 252, 245, 0.9);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.my-capsules-story-link:active {
  opacity: 0.75;
}

.my-capsules-date {
  display: block;
  font-size: 12px;
  color: #475569;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.my-capsules-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 10px;
  line-height: 1.35;
}

.my-capsules-quote-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: #64748b;
  margin-bottom: 6px;
}

.my-capsules-quote {
  margin: 0;
  font-size: 13px;
  color: #334155;
  line-height: 1.6;
}

.my-capsules-empty {
  padding: 18px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  border-radius: 10px;
  border: 1px dashed var(--line);
}

.my-capsules-item-missing {
  border-style: dashed;
}

.my-capsules-missing-msg {
  margin: 8px 0 0;
  font-size: 13px;
  color: #64748b;
  line-height: 1.55;
}

/* 我的膠囊 · 故事浮窗 */
#wisdom-note-source-modal {
  z-index: 86;
}

.my-capsules-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) 16px
    max(12px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

.my-capsules-modal.is-open {
  display: flex;
}

.my-capsules-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(2px);
}

.my-capsules-modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 400px);
  max-height: min(78vh, 620px);
  margin: 0 auto;
  padding: 16px 16px calc(14px + env(safe-area-inset-bottom));
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.my-capsules-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 10px;
  cursor: pointer;
}

.my-capsules-modal-title {
  margin: 0 56px 10px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.my-capsules-modal-section-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--muted);
}

.my-capsules-modal-story {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 14px;
  line-height: 1.65;
  color: #334155;
}

/* 智慧小記「查看原文」彈窗：引用片段用淺灰，與標題／一般故事區分 */
#wisdom-note-source-excerpt.my-capsules-modal-story {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  color: #a3a3a3;
  font-weight: 400;
  white-space: pre-wrap;
  word-break: break-word;
}

.subpage-toolbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 12px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.subpage-back {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 15px;
  font-weight: 500;
  padding: 8px 10px;
  cursor: pointer;
}

a.subpage-back {
  text-decoration: none;
  display: inline-block;
}

.subpage-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

/* 智慧流星設定：與智慧小記等子頁一致的米紙底、金線意、深藍字 */
.meteor-page-card {
  margin: 0 max(12px, env(safe-area-inset-left)) 24px
    max(12px, env(safe-area-inset-right));
  padding: 18px 16px 20px;
  background: rgba(252, 249, 242, 0.96);
  border: 1px solid rgba(214, 197, 170, 0.5);
  border-radius: 16px;
  box-shadow:
    0 2px 12px rgba(15, 23, 42, 0.06),
    0 0 0 1px rgba(255, 255, 255, 0.45) inset;
}

.page[data-page="meteor"] .group-desc {
  margin: 0 0 18px;
  padding-bottom: 16px;
  border-bottom: 1px dashed rgba(186, 149, 79, 0.38);
  font-family: "STKaiti", "Kaiti SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  line-height: 1.65;
  color: rgba(62, 54, 42, 0.82);
  letter-spacing: 0.04em;
}

.page[data-page="meteor"] .setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  flex-wrap: wrap;
}

.page[data-page="meteor"] .setting-item .setting-label {
  flex: 1 1 40%;
  min-width: 7em;
}

.page[data-page="meteor"] .setting-item label,
.page[data-page="meteor"] .setting-label {
  font-family: "STKaiti", "Kaiti SC", "PingFang SC", sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #2a3548;
  letter-spacing: 0.06em;
}

.page[data-page="meteor"] .setting-select {
  flex: 1 1 48%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid rgba(200, 182, 155, 0.75);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  color: #1e293b;
  background: rgba(255, 253, 248, 0.98);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65) inset;
}

.page[data-page="meteor"] .time-list {
  display: grid;
  gap: 10px;
  margin: 4px 0 18px;
  padding-bottom: 16px;
  border-bottom: 1px dashed rgba(186, 149, 79, 0.35);
}

.page[data-page="meteor"] .time-item {
  display: grid;
  grid-template-columns: minmax(4.5rem, auto) 1fr;
  align-items: center;
  gap: 10px;
}

.page[data-page="meteor"] .time-item span {
  font-family: "STKaiti", "Kaiti SC", "PingFang SC", sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: rgba(42, 53, 72, 0.88);
  letter-spacing: 0.04em;
}

.page[data-page="meteor"] .time-item input[type="time"] {
  width: 100%;
  border: 1px solid rgba(200, 182, 155, 0.75);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: #1e293b;
  background: rgba(255, 253, 248, 0.98);
  box-sizing: border-box;
}

.page[data-page="meteor"] .setting-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

@media (min-width: 380px) {
  .page[data-page="meteor"] .setting-actions {
    flex-direction: row;
    align-items: stretch;
  }
}

.page[data-page="meteor"] .save-settings {
  flex: 1;
  min-height: 46px;
  border: none;
  border-radius: 12px;
  padding: 11px 14px;
  font-family: "STKaiti", "Kaiti SC", "PingFang SC", sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #fffef8;
  background: linear-gradient(165deg, #2d4a7c 0%, #1e3a5f 45%, #152a45 100%);
  box-shadow:
    0 2px 10px rgba(15, 35, 62, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  cursor: pointer;
}

.page[data-page="meteor"] .save-settings:active {
  opacity: 0.92;
  transform: scale(0.99);
}

.page[data-page="meteor"] .test-settings {
  flex: 1;
  min-height: 46px;
  border: 1px solid rgba(186, 149, 79, 0.55);
  border-radius: 12px;
  padding: 11px 14px;
  font-family: "STKaiti", "Kaiti SC", "PingFang SC", sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #3d3428;
  background: rgba(255, 251, 240, 0.95);
  box-shadow: 0 1px 4px rgba(62, 48, 28, 0.08);
  cursor: pointer;
}

.page[data-page="meteor"] .test-settings:active {
  opacity: 0.92;
  transform: scale(0.99);
}

.page[data-page="meteor"] .setting-status {
  min-height: 20px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(214, 197, 170, 0.35);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(62, 72, 88, 0.9);
}

.page[data-page="meteor"] .setting-next {
  margin: 8px 0 0;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(100, 90, 72, 0.78);
  letter-spacing: 0.02em;
}

/* 累计登录 · 日历浮层 */
.login-calendar-modal {
  z-index: 72;
}

.login-calendar-modal-panel {
  width: min(100%, 360px);
  max-height: min(85vh, 520px);
}

.login-cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 48px 10px 0;
}

.login-cal-nav-btn {
  flex: 0 0 40px;
  height: 40px;
  border: 1px solid rgba(217, 201, 176, 0.65);
  border-radius: 10px;
  background: rgba(255, 252, 246, 0.9);
  color: #243c5e;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.login-cal-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.login-cal-month-label {
  flex: 1;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.login-cal-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.login-cal-legend-icon {
  display: block;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(36, 60, 94, 0.15));
}

.login-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 6px;
  padding: 0 2px;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-align: center;
}

.login-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  padding: 2px 0 4px;
}

.login-cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 44px;
  padding: 4px 2px 5px;
  border-radius: 10px;
  background: rgba(248, 246, 241, 0.85);
  border: 1px solid rgba(214, 197, 170, 0.35);
  box-sizing: border-box;
}

.login-cal-day--empty {
  min-height: 44px;
  background: transparent;
  border-color: transparent;
}

.login-cal-day--today {
  border-color: rgba(180, 138, 78, 0.65);
  box-shadow: 0 0 0 1px rgba(180, 138, 78, 0.25);
}

.login-cal-day-num {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  line-height: 1.2;
}

.login-cal-day--visited .login-cal-day-num {
  color: #243c5e;
}

.login-cal-day-icon {
  display: block;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(36, 60, 94, 0.2));
}

.login-cal-day--visited {
  background: linear-gradient(
    160deg,
    rgba(255, 251, 235, 0.95),
    rgba(232, 244, 252, 0.75)
  );
  border-color: rgba(180, 138, 78, 0.45);
}

.page[data-page="about-us"] .about-us-content {
  margin: 24px 16px;
  padding: 16px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  font-size: 15px;
  color: var(--text);
}

/* ==========================================================================
   哲学星盘（发现页）—— 全屏沉浸式宇宙场景
   ========================================================================== */

/* ── 发现页激活：消除布局内边距，星图铺满可用空间 ── */
body.discover-page-active .content {
  padding: 0;
  overflow: hidden;
}

body.discover-page-active .page[data-page="discover"].active {
  height: 100%;
  padding: 0;
  min-height: unset;
}

/* ── 顶部导航栏：玻璃磨砂深空质感 ── */
body.discover-page-active .top-bar {
  background: rgba(6, 10, 28, 0.52);
  border-bottom: 1px solid rgba(232, 196, 137, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.4s ease, border-color 0.4s ease;
}

body.discover-page-active .top-bar h1 {
  color: rgba(232, 196, 137, 0.72);
  letter-spacing: 0.1em;
  font-weight: 500;
  font-size: 15px;
}

/* ── 底部 Tab 栏：融入宇宙背景 ── */
body.discover-page-active .tab-bar {
  background: rgba(6, 10, 28, 0.80);
  border-top: 1px solid rgba(232, 196, 137, 0.13);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: background 0.4s ease;
}

/* ── 发现页 section：零内边距，flex 撑满 content 区 ── */
.page[data-page="discover"] {
  display: none;
  background: transparent;
  border-radius: 0;
  padding: 0;
}

.page[data-page="discover"].active {
  display: flex;
  flex-direction: column;
}

/* ── 星图舞台：铺满整个发现页，无边框圆角 ── */
.starmap-stage {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 0;
  background: #060a1c;
  overflow: hidden;
  isolation: isolate;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.starmap-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* ── 叠加标题（左上角，漂浮于画布上方）── */
.starmap-overlay-header {
  position: absolute;
  top: 18px;
  left: 20px;
  z-index: 3;
  pointer-events: none;
  user-select: none;
}

.starmap-eyebrow {
  margin: 0 0 2px;
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(232, 196, 137, 0.42);
  font-weight: 500;
}

.starmap-title {
  margin: 0 0 3px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(243, 214, 138, 0.80);
  text-shadow: 0 0 20px rgba(232, 196, 137, 0.30);
}

.starmap-subtitle {
  margin: 0;
  font-size: 11px;
  color: rgba(149, 162, 194, 0.55);
  letter-spacing: 0.04em;
}

/* ── 信息卡片 ── */
.starmap-card {
  position: absolute;
  left: 0;
  top: 0;
  width: min(260px, 72%);
  padding: 12px 14px 14px;
  background: rgba(7, 12, 28, 0.93);
  border: 1px solid rgba(232, 196, 137, 0.48);
  border-radius: 12px;
  color: #f3e6c7;
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.70),
    inset 0 0 0 1px rgba(255, 222, 158, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  transform-origin: top left;
  transition:
    opacity 0.22s ease,
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 4;
  font-size: 13px;
  line-height: 1.55;
}

.starmap-card.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  /* 保持 none，避免挡住 canvas 上的拖拽与点击 */
  pointer-events: none;
}

.starmap-card-period {
  margin: 0 0 4px;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(232, 196, 137, 0.70);
}

.starmap-card-name {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
  color: #f8e3a8;
  letter-spacing: 0.04em;
}

.starmap-card-idea {
  margin: 0 0 10px;
  color: rgba(243, 230, 199, 0.92);
}

.starmap-card-quote {
  margin: 0;
  padding: 8px 10px;
  border-left: 2px solid rgba(232, 196, 137, 0.52);
  background: rgba(255, 222, 158, 0.05);
  border-radius: 0 8px 8px 0;
  color: #f6e9c6;
  font-style: italic;
  font-size: 12.5px;
  line-height: 1.6;
}

/* ── 桌面端 ── */
@media (min-width: 720px) {
  .starmap-title {
    font-size: 22px;
  }
  .starmap-card {
    width: 300px;
    font-size: 13.5px;
  }
  .starmap-card-name {
    font-size: 19px;
  }
}

/* ── 移动端小屏 ── */
@media (max-width: 380px) {
  .starmap-card {
    width: min(240px, 80%);
    font-size: 12px;
    padding: 10px 12px 12px;
  }
  .starmap-card-name {
    font-size: 15px;
  }
}

/* ── 减少动画偏好 ── */
@media (prefers-reduced-motion: reduce) {
  /* Three.js 动画在 JS 层按需降速 */
}

/* ==========================================================================
   对话页 —— 思想家半身照轮播
   ========================================================================== */

body.dialog-page-active .content {
  padding: 0;
  overflow: hidden;
}

body.dialog-page-active .page[data-page="message"].active {
  height: 100%;
  padding: 0;
  min-height: unset;
}

body.dialog-page-active .top-bar {
  background: rgba(6, 10, 28, 0.52);
  border-bottom: 1px solid rgba(232, 196, 137, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.dialog-page-active .top-bar h1 {
  color: rgba(232, 196, 137, 0.72);
  letter-spacing: 0.1em;
  font-weight: 500;
  font-size: 15px;
}

body.dialog-page-active .tab-bar {
  background: rgba(6, 10, 28, 0.8);
  border-top: 1px solid rgba(232, 196, 137, 0.13);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.page[data-page="message"] {
  display: none;
  background: transparent;
  border-radius: 0;
  padding: 0;
}

.page[data-page="message"].active {
  display: flex;
  flex-direction: column;
}

.dialog-stage {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  isolation: isolate;
  background: radial-gradient(
      ellipse 120% 80% at 50% 18%,
      rgba(48, 62, 98, 0.55) 0%,
      transparent 58%
    ),
    linear-gradient(180deg, #0a1024 0%, #060a1c 48%, #0c1228 100%);
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.dialog-stars-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.dialog-header {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  padding: 12px 20px 4px;
  text-align: center;
  pointer-events: none;
}

.dialog-eyebrow {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(232, 196, 137, 0.45);
}

.dialog-hint {
  margin: 6px 0 0;
  font-size: 13px;
  color: rgba(232, 220, 196, 0.62);
  line-height: 1.5;
}

.dialog-carousel {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
}

.dialog-track {
  position: relative;
  width: min(100%, 420px);
  height: min(72vh, 560px);
  margin: 0 auto;
  perspective: 1200px;
}

.dialog-slide {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(78vw, 300px);
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition:
    transform 0.42s cubic-bezier(0.22, 0.9, 0.32, 1),
    opacity 0.38s ease,
    filter 0.38s ease;
  will-change: transform, opacity;
  cursor: default;
  pointer-events: none;
}

.dialog-slide[data-state="active"] {
  z-index: 5;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  filter: none;
  pointer-events: auto;
  cursor: default;
}

.dialog-slide[data-state="prev"] {
  z-index: 2;
  opacity: 0.42;
  transform: translate(calc(-50% - 38%), -50%) scale(0.78);
  filter: brightness(0.72) saturate(0.85);
  pointer-events: auto;
  cursor: pointer;
}

.dialog-slide[data-state="next"] {
  z-index: 2;
  opacity: 0.42;
  transform: translate(calc(-50% + 38%), -50%) scale(0.78);
  filter: brightness(0.72) saturate(0.85);
  pointer-events: auto;
  cursor: pointer;
}

.dialog-slide[data-state="far-prev"],
.dialog-slide[data-state="far-next"] {
  z-index: 1;
  opacity: 0.18;
  transform: translate(-50%, -50%) scale(0.62);
  filter: brightness(0.55) blur(1px);
}

.dialog-slide[data-state="far-prev"] {
  transform: translate(calc(-50% - 52%), -50%) scale(0.62);
}

.dialog-slide[data-state="far-next"] {
  transform: translate(calc(-50% + 52%), -50%) scale(0.62);
}

/* 金色流光沿边框划行（SVG path + JS Web Animations API） */
.dialog-portrait-wrap {
  position: relative;
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  filter: drop-shadow(0 18px 42px rgba(0, 0, 0, 0.45));
}

.dialog-slide[data-state="active"] .dialog-portrait-wrap {
  filter: drop-shadow(0 12px 32px rgba(0, 0, 0, 0.5));
}

.dialog-border-sweep {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.dialog-slide[data-state="active"] .dialog-border-sweep {
  opacity: 1;
}

.dialog-border-track {
  stroke: rgba(232, 196, 137, 0.38);
  stroke-width: 1;
}

.dialog-border-light {
  stroke: #fff5dc;
  stroke-width: 1.5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 3px rgba(255, 228, 160, 0.95))
    drop-shadow(0 0 8px rgba(232, 196, 137, 0.55));
}

.dialog-portrait {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  max-height: min(52vh, 380px);
  object-fit: contain;
  object-position: center bottom;
  pointer-events: none;
}

.dialog-slide[data-state="active"] .dialog-portrait {
  filter: drop-shadow(0 0 18px rgba(232, 196, 137, 0.35));
}

.dialog-meta {
  margin-top: 14px;
  padding: 0 8px;
  transition: opacity 0.35s ease;
}

.dialog-slide:not([data-state="active"]) .dialog-meta {
  opacity: 0.55;
}

.dialog-name {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(255, 248, 235, 0.96);
}

.dialog-slide[data-state="active"] .dialog-name {
  color: #fff6e8;
  text-shadow: 0 0 24px rgba(232, 196, 137, 0.35);
}

.dialog-origin {
  margin: 0 0 4px;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(232, 220, 196, 0.78);
}

.dialog-school {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.06em;
  color: rgba(232, 196, 137, 0.72);
}

@media (max-width: 380px) {
  .dialog-slide {
    width: min(84vw, 280px);
  }

  .dialog-name {
    font-size: 20px;
  }

  .dialog-slide[data-state="prev"] {
    transform: translate(calc(-50% - 34%), -50%) scale(0.74);
  }

  .dialog-slide[data-state="next"] {
    transform: translate(calc(-50% + 34%), -50%) scale(0.74);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dialog-slide {
    transition: none;
  }

  .dialog-border-light {
    opacity: 0.85;
  }
}

/* 「开始对话」按钮（carousel 轮播页，仅 active 可见） */
.dialog-start-btn {
  display: none;
  margin-top: 16px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 22px;
  border: 1px solid rgba(232, 196, 137, 0.7);
  border-radius: 100px;
  background: rgba(232, 196, 137, 0.1);
  color: rgba(255, 246, 232, 0.92);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.22s, border-color 0.22s, transform 0.15s;
  backdrop-filter: blur(8px);
}

.dialog-slide[data-state="active"] .dialog-start-btn {
  display: flex;
}

.dialog-start-btn:hover,
.dialog-start-btn:active {
  background: rgba(232, 196, 137, 0.22);
  border-color: rgba(255, 224, 160, 0.9);
  transform: translateY(-1px);
}

.dialog-start-btn svg {
  flex-shrink: 0;
  color: rgba(255, 210, 130, 0.9);
}

/* ==========================================================================
   哲学家智能体对话页（philosopher-chat）
   ========================================================================== */

body.philosopher-chat-active .top-bar {
  display: none;
}

body.philosopher-chat-active .app {
  grid-template-rows: 0 1fr;
}

body.philosopher-chat-active .content {
  padding: 0;
  overflow: hidden;
  background: transparent;
}

.page[data-page="philosopher-chat"] {
  display: none;
  background: transparent;
  padding: 0;
}

.page[data-page="philosopher-chat"].active {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ── 整体布局壳 ── */
.pchat-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: linear-gradient(180deg, #0d1630 0%, #060a1c 55%, #0c1228 100%);
  overflow: hidden;
  position: relative;
}

/* ── 顶部信息栏 ── */
.pchat-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(8, 14, 36, 0.85);
  border-bottom: 1px solid rgba(232, 196, 137, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  z-index: 10;
}

.pchat-back-btn,
.pchat-clear-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(232, 196, 137, 0.8);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.pchat-back-btn:active,
.pchat-clear-btn:active {
  background: rgba(232, 196, 137, 0.15);
  color: #ffe8a8;
}

.pchat-header-center {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.pchat-header-avatar-wrap {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid rgba(232, 196, 137, 0.5);
  background: rgba(255, 240, 210, 0.06);
}

.pchat-header-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.pchat-header-text {
  min-width: 0;
}

.pchat-header-name {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 246, 232, 0.96);
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pchat-header-period {
  margin: 2px 0 0;
  font-size: 11px;
  color: rgba(232, 196, 137, 0.6);
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 核心思想标签条 ── */
.pchat-ideas {
  flex-shrink: 0;
  display: flex;
  gap: 6px;
  padding: 8px 14px;
  overflow-x: auto;
  scrollbar-width: none;
  background: rgba(6, 10, 28, 0.6);
  border-bottom: 1px solid rgba(232, 196, 137, 0.08);
}

.pchat-ideas::-webkit-scrollbar {
  display: none;
}

.pchat-idea-tag {
  flex-shrink: 0;
  padding: 3px 9px;
  border-radius: 100px;
  border: 1px solid rgba(232, 196, 137, 0.35);
  background: rgba(232, 196, 137, 0.07);
  font-size: 11px;
  color: rgba(232, 196, 137, 0.8);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* ── 消息区 ── */
.pchat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 196, 137, 0.18) transparent;
}

.pchat-messages::-webkit-scrollbar {
  width: 3px;
}

.pchat-messages::-webkit-scrollbar-thumb {
  background: rgba(232, 196, 137, 0.22);
  border-radius: 2px;
}

/* ── 单条消息行 ── */
.pchat-msg-wrap {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: pchat-msg-in 0.28s cubic-bezier(0.2, 0.9, 0.4, 1) both;
}

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

.pchat-msg-wrap--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.pchat-msg-wrap--assistant {
  align-self: flex-start;
}

.pchat-msg-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 1px solid rgba(232, 196, 137, 0.3);
  margin-top: 2px;
}

/* ── 气泡 ── */
.pchat-bubble {
  position: relative;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.7;
  max-width: 100%;
}

.pchat-bubble--user {
  background: rgba(232, 196, 137, 0.13);
  border: 1px solid rgba(232, 196, 137, 0.3);
  color: rgba(255, 246, 232, 0.92);
  border-bottom-right-radius: 4px;
}

.pchat-bubble--assistant {
  background: rgba(255, 248, 235, 0.06);
  border: 1px solid rgba(232, 196, 137, 0.16);
  color: rgba(235, 228, 212, 0.94);
  border-bottom-left-radius: 4px;
}

.pchat-bubble-text {
  margin: 0;
}

.pchat-bubble-text p {
  margin: 0 0 0.7em;
}

.pchat-bubble-text p:last-child {
  margin-bottom: 0;
}

.pchat-bubble-text strong {
  color: rgba(255, 224, 160, 0.95);
  font-weight: 600;
}

.pchat-bubble-text em {
  color: rgba(232, 210, 170, 0.9);
  font-style: italic;
}

/* ── 收藏按钮 ── */
.pchat-bubble-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(232, 196, 137, 0.1);
}

.pchat-save-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid rgba(232, 196, 137, 0.25);
  border-radius: 100px;
  background: transparent;
  color: rgba(232, 196, 137, 0.55);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.pchat-save-btn:hover {
  color: rgba(255, 216, 120, 0.9);
  border-color: rgba(232, 196, 137, 0.55);
  background: rgba(232, 196, 137, 0.08);
}

.pchat-save-btn--saved {
  color: rgba(255, 210, 100, 0.9) !important;
  border-color: rgba(255, 210, 100, 0.55) !important;
}

/* ── 打字动画 ── */
.pchat-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  background: rgba(255, 248, 235, 0.06);
  border: 1px solid rgba(232, 196, 137, 0.16);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.pchat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(232, 196, 137, 0.6);
  animation: pchat-dot-bounce 1.2s ease-in-out infinite;
}

.pchat-typing span:nth-child(2) {
  animation-delay: 0.18s;
}

.pchat-typing span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes pchat-dot-bounce {
  0%, 80%, 100% {
    transform: scale(0.65);
    opacity: 0.45;
  }
  40% {
    transform: scale(1.1);
    opacity: 1;
  }
}

/* ── 推荐问题 ── */
.pchat-suggestions-wrap {
  flex-shrink: 0;
  padding: 6px 14px 2px;
}

.pchat-suggestions {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.pchat-suggestions::-webkit-scrollbar {
  display: none;
}

.pchat-sq-btn {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 100px;
  border: 1px solid rgba(232, 196, 137, 0.32);
  background: rgba(232, 196, 137, 0.06);
  color: rgba(232, 210, 175, 0.88);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s;
}

.pchat-sq-btn:hover,
.pchat-sq-btn:active {
  background: rgba(232, 196, 137, 0.15);
  border-color: rgba(232, 196, 137, 0.65);
}

/* ── 输入区 ── */
.pchat-input-row {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 14px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: rgba(8, 14, 36, 0.8);
  border-top: 1px solid rgba(232, 196, 137, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.pchat-input {
  flex: 1;
  min-height: 38px;
  max-height: 120px;
  padding: 9px 12px;
  border-radius: 18px;
  border: 1px solid rgba(232, 196, 137, 0.28);
  background: rgba(255, 248, 235, 0.06);
  color: rgba(255, 246, 232, 0.92);
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, background 0.2s;
}

.pchat-input::placeholder {
  color: rgba(180, 165, 140, 0.45);
}

.pchat-input:focus {
  border-color: rgba(232, 196, 137, 0.55);
  background: rgba(255, 248, 235, 0.09);
}

.pchat-send-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(232, 196, 137, 0.22);
  color: rgba(255, 230, 170, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.pchat-send-btn:not(:disabled):hover {
  background: rgba(232, 196, 137, 0.38);
}

.pchat-send-btn:not(:disabled):active {
  transform: scale(0.92);
}

.pchat-send-btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

/* ── 收藏 Toast ── */
.pchat-toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%) translateY(12px);
  padding: 8px 18px;
  border-radius: 100px;
  background: rgba(20, 30, 60, 0.92);
  border: 1px solid rgba(232, 196, 137, 0.35);
  color: rgba(255, 236, 180, 0.95);
  font-size: 13px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 9999;
  white-space: nowrap;
  backdrop-filter: blur(10px);
}

.pchat-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 380px) {
  .pchat-bubble {
    font-size: 13px;
  }
  .pchat-header-name {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pchat-msg-wrap {
    animation: none;
  }
  .pchat-typing span {
    animation: none;
    opacity: 0.7;
  }
}

/* —— 独立设置页 settings.html —— */
html.settings-standalone-html,
html.settings-standalone-html body.settings-standalone-body {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

.settings-standalone-root {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.settings-standalone-main {
  flex: 1;
  padding: 12px 0 32px;
  padding-bottom: max(32px, env(safe-area-inset-bottom));
}

.settings-capsule-card .settings-section-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.settings-hint {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.settings-radio-group {
  margin: 0;
  padding: 0;
  border: none;
}

.settings-radio-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  cursor: pointer;
}

.settings-radio-row:last-of-type {
  margin-bottom: 0;
}

.settings-radio-row input {
  margin-top: 3px;
  flex-shrink: 0;
}

.settings-actions {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed rgba(186, 149, 79, 0.35);
}

.settings-actions .settings-reset-btn {
  width: 100%;
  margin: 0;
  border: 1px solid rgba(214, 197, 170, 0.65);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 14px;
  color: #4a5568;
  background: rgba(255, 253, 247, 0.95);
  cursor: pointer;
}

.settings-actions .settings-reset-btn:active {
  opacity: 0.92;
}

.settings-status {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  min-height: 1.5em;
}
