:root {
  --color-primary: #8b1a1a;
  --color-primary-light: #c0392b;
  --color-primary-dark: #5c0a0a;
  --color-gold: #c9a84c;
  --color-gold-light: #f0d080;
  --color-bg: #fdf5f0;
  --color-bg-card: #ffffff;
  --color-bg-warm: #faf0e6;
  --color-text-primary: #2c1810;
  --color-text-secondary: #7a5c50;
  --color-text-muted: #b0958a;
  --color-border: #e8d5c8;
  --color-shadow: rgba(139, 26, 26, 0.045);
  --color-ink: #23110c;
  --color-jade: #1a6b5c;
  --safe-color: #6d1111;
  --safe-gradient: linear-gradient(150deg, #4b0505 0%, #8b1a1a 48%, #bc2a23 100%);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
view { display: block; }
html { background: var(--safe-color); }
body {
  margin: 0;
  background: var(--safe-color);
  color: var(--color-text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif;
  transition: background .28s ease;
}
button, input, textarea, select { font: inherit; }
button { border: 0; padding: 0; background: none; color: inherit; cursor: pointer; }

.phone-app {
  position: relative;
  width: min(100vw, 430px);
  min-height: 100dvh;
  margin: 0 auto;
  overflow-x: hidden;
  background: var(--color-bg);
  box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 24px 80px rgba(0,0,0,.35);
}
.phone-app::after {
  content: "";
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 45;
  width: min(100vw, 430px);
  height: env(safe-area-inset-top);
  pointer-events: none;
  background: var(--safe-gradient);
  transform: translateX(-50%);
  transition: background .28s ease;
}
.page { display: none; min-height: 100dvh; padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
.page.active {
  display: block;
  animation: page-enter .36s cubic-bezier(.2, .8, .2, 1);
}
@keyframes page-enter {
  from { opacity: .98; transform: translateY(18px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.container { min-height: 100dvh; background: var(--color-bg); }
.page-padding { padding-left: 16px; padding-right: 16px; }
.safe-bottom { height: calc(env(safe-area-inset-bottom) + 92px); }
.hidden { display: none !important; }

.card {
  background: var(--color-bg-card);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 10px var(--color-shadow);
}
.btn-primary {
  display: block;
  width: 100%;
  border-radius: 24px;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}
.btn-outline {
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
}

/* 首页 */
.home-hero { position: relative; height: 190px; overflow: hidden; }
.hero-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 50% 46%, rgba(240,208,128,.18), transparent 42%),
    linear-gradient(145deg, #5c0a0a 0%, #8b1a1a 48%, #b72b24 100%);
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,.04) 0 1px, transparent 1px 32px);
}
.hero-bg::before { content: none; }
.hero-content {
  position: relative;
  z-index: 1;
  display: grid;
  height: 100%;
  place-items: center;
  padding: calc(18px + env(safe-area-inset-top)) 20px 20px;
  color: #fff;
}
.hero-title-img {
  display: block;
  width: min(78%, 320px);
  max-height: 104px;
  object-fit: contain;
  padding: 0;
  border-radius: 0;
  background: transparent;
  filter: drop-shadow(0 5px 10px rgba(92,10,10,.28));
}
.hero-subtitle { margin-top: 4px; color: rgba(255,255,255,.75); font-size: 13px; letter-spacing: 2px; }
.hero-stats {
  display: flex; align-items: center; margin-top: 20px;
  padding: 12px 16px; border-radius: 10px; background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.1);
}
.stat-item { flex: 1; text-align: center; }
.stat-num { display: block; color: var(--color-gold-light); font-size: 22px; font-weight: 800; }
.stat-label { display: block; margin-top: 2px; color: rgba(255,255,255,.72); font-size: 11px; }
.stat-divider { width: 1px; height: 30px; background: rgba(255,255,255,.22); }
.section { margin-top: 20px; }
.section-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.section-title { display: block; margin-bottom: 10px; font-size: 16px; font-weight: 800; color: var(--color-text-primary); }
.section-sub { color: var(--color-text-muted); font-size: 12px; }
.daily-card {
  width: 100%; display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
  padding: 12px 14px; border-radius: 8px; background: #fff; box-shadow: 0 1px 6px var(--color-shadow);
}
.daily-left, .cc-left, .lb-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.daily-icon, .cc-icon {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 10px; background: var(--color-bg-warm); font-size: 24px;
}
.daily-name, .cc-title, .lb-title { display: block; font-size: 15px; font-weight: 700; color: var(--color-text-primary); }
.daily-desc, .cc-desc, .lb-desc { display: block; margin-top: 2px; color: var(--color-text-muted); font-size: 12px; }
.daily-badge, .cc-btn {
  flex-shrink: 0; padding: 5px 12px; border-radius: 15px; font-size: 12px; font-weight: 700;
}
.todo, .btn-todo { background: var(--color-primary); color: #fff; }
.done, .btn-done { background: rgba(39,174,96,.1); color: #1a7a40; }
.feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }
.feature-item {
  min-height: 94px; border-radius: 8px; padding: 14px 8px; text-align: center;
  background: #fff; box-shadow: 0 1px 6px var(--color-shadow);
}
.feature-icon {
  display: grid; place-items: center; width: 40px; height: 40px; margin: 0 auto 6px;
  border-radius: 10px; font-size: 20px;
}
.feature-icon.red { background: rgba(139,26,26,.08); }
.feature-icon.gold { background: rgba(201,168,76,.1); }
.feature-icon.blue { background: rgba(26,74,92,.08); }
.feature-icon.green { background: rgba(39,174,96,.08); }
.feature-icon.pink { background: rgba(192,57,43,.08); }
.feature-icon.purple { background: rgba(74,26,107,.08); }
.feature-name { display: block; color: #111; font-size: 16px; font-weight: 900; }
.feature-desc { display: block; margin-top: 2px; color: var(--color-text-muted); font-size: 10px; }
.progress-total { color: var(--color-primary); font-size: 12px; font-weight: 700; }
.progress-bar-bg { height: 4px; border-radius: 4px; background: var(--color-border); margin-bottom: 12px; }
.progress-bar-fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light)); }
.chapter-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.chapter-pill {
  width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--color-border);
  background: var(--color-bg-warm); color: var(--color-text-secondary); font-size: 12px; font-weight: 700;
}
.chapter-pill.finished { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* 学习列表 */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: linear-gradient(135deg, #6d1111 0%, #9b211d 58%, #c9a84c 140%);
  box-shadow: 0 5px 16px rgba(139,26,26,.16);
}
.tab-switch { display: flex; padding: 2px; border-radius: 12px; background: rgba(255,255,255,.16); }
.tab-item {
  padding: 6px 18px; border-radius: 10px; color: rgba(255,255,255,.82);
  font-size: 14px; font-weight: 600;
}
.tab-item.active { background: rgba(255,255,255,.95); color: var(--color-primary); }
.view-toggle {
  padding: 4px 10px; border: 1px solid rgba(255,255,255,.4); border-radius: 10px;
  color: #fff; background: rgba(255,255,255,.12); font-size: 13px;
}
.search-bar { padding-top: 10px; padding-bottom: 10px; }
.search-box {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--color-border);
  border-radius: 24px; background: #fff;
}
.search-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14px; }
.chapter-list { display: grid; gap: 10px; padding: 0 16px; }
.chapter-card {
  position: relative; display: flex; align-items: center; gap: 10px; margin-bottom: 0; padding: 12px;
  height: 112px;
  min-height: 112px;
  overflow: hidden; border-radius: 12px; background: #fff; box-shadow: 0 2px 8px var(--color-shadow);
}
.chapter-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--chapter-color, var(--color-primary)); opacity: .88; }
.chapter-num-wrap {
  display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 8px; border: 1px solid;
}
.chapter-num { font-size: 18px; font-weight: 900; }
.chapter-body { min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; align-self: stretch; }
.chapter-header-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.chapter-title-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 40px;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
}
.chapter-status { display: grid; place-items: center; flex: 0 0 auto; width: 20px; height: 20px; border: 1px solid var(--color-border); border-radius: 50%; font-size: 10px; }
.chapter-status.done { background: #27ae60; border-color: #27ae60; color: #fff; }
.chapter-meta { display: flex; gap: 4px; align-items: center; min-height: 16px; margin-top: 4px; overflow: hidden; font-size: 11px; white-space: nowrap; }
.chapter-period, .chapter-dot { color: var(--color-text-muted); }
.chapter-count { color: var(--color-primary); }
.chapter-tags { display: flex; flex-wrap: nowrap; gap: 4px; min-height: 18px; margin-top: 6px; overflow: hidden; }
.chapter-tag { flex: 0 1 auto; max-width: 31%; overflow: hidden; padding: 2px 7px; border-radius: 8px; background: var(--color-bg-warm); color: var(--color-text-secondary); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.arrow { align-self: center; color: var(--color-text-muted); font-size: 24px; }
.empty-result { display: grid; place-items: center; padding: 50px 0; gap: 10px; color: var(--color-text-muted); }
.empty-icon { font-size: 40px; }

.world-globe-wrap {
  padding: 0 16px 12px;
}

.world-globe-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(139,26,26,.1);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(92,10,10,.97), rgba(139,26,26,.95) 56%, rgba(35,17,12,.97)),
    radial-gradient(circle at 78% 18%, rgba(240,208,128,.18), transparent 34%);
  color: #fff;
  box-shadow: 0 12px 34px rgba(92,10,10,.18);
}

.world-globe-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0 36%, rgba(255,255,255,.16) 48%, transparent 62% 100%);
  transform: translateX(-100%);
  animation: globe-sheen 5.2s ease-in-out infinite;
  pointer-events: none;
}

.globe-copy {
  position: relative;
  z-index: 2;
  padding: 14px 14px 0;
}

.globe-copy span {
  display: block;
  color: var(--color-gold-light);
  font-size: 11px;
  font-weight: 900;
}

.globe-copy strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  line-height: 1.35;
}

.globe-stage {
  position: relative;
  height: 196px;
  margin-top: -4px;
}

.globe-orb {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 176px;
  height: 176px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,.82), rgba(255,255,255,.18) 12%, transparent 18%),
    radial-gradient(circle at 54% 50%, rgba(240,208,128,.3), transparent 53%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.24) 0 1px, transparent 1px 18px),
    repeating-linear-gradient(0deg, rgba(255,255,255,.16) 0 1px, transparent 1px 22px),
    linear-gradient(145deg, #1a3a5c, #1a6b5c 48%, #8b6914);
  box-shadow:
    inset -26px -20px 34px rgba(0,0,0,.34),
    inset 16px 12px 24px rgba(255,255,255,.18),
    0 18px 36px rgba(0,0,0,.26),
    0 0 0 8px rgba(255,255,255,.05);
  animation: globe-drift 8s ease-in-out infinite;
}

.globe-orb::before,
.globe-orb::after {
  content: "";
  position: absolute;
  inset: 13px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%;
  pointer-events: none;
}

.globe-orb::after {
  inset: 2px 54px;
  border-color: rgba(255,255,255,.26);
}

.globe-hotspot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 3;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  min-width: 18px;
  padding: 0;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 50%;
  background: rgba(255,248,236,.92);
  color: var(--color-primary-dark);
  font-size: 0;
  font-weight: 900;
  box-shadow: 0 0 0 4px rgba(240,208,128,.16), 0 8px 16px rgba(0,0,0,.16);
}

.globe-hotspot::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--color-gold);
  opacity: .8;
  animation: hotspot-pulse 1.9s ease-in-out infinite;
}

.globe-hotspot span {
  display: none;
}

.globe-chip-row {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 12px 14px;
  scrollbar-width: none;
}

.globe-chip-row::-webkit-scrollbar { display: none; }

.globe-chip {
  flex: 0 0 112px;
  padding: 8px 9px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 10px;
  background: rgba(255,255,255,.1);
  color: #fff;
  text-align: left;
}

.globe-chip b {
  display: block;
  color: var(--color-gold-light);
  font-size: 12px;
}

.globe-chip span {
  display: block;
  margin-top: 2px;
  color: rgba(255,255,255,.74);
  font-size: 10px;
  line-height: 1.35;
}

.globe-hotspot:active {
  transform: translate(-50%, -50%) scale(.94);
}

@keyframes globe-drift {
  0%, 100% { transform: translate(-50%, -50%) rotate(-3deg); }
  50% { transform: translate(-50%, -52%) rotate(4deg); }
}

@keyframes hotspot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240,208,128,.48); opacity: .8; }
  60% { box-shadow: 0 0 0 9px rgba(240,208,128,0); opacity: .18; }
}

@keyframes globe-sheen {
  0%, 48% { transform: translateX(-110%); opacity: 0; }
  58% { opacity: 1; }
  82%, 100% { transform: translateX(110%); opacity: 0; }
}

/* 详情 */
.chapter-hero {
  display: flex; align-items: center; gap: 14px; padding: calc(20px + env(safe-area-inset-top)) 16px 24px;
  color: #fff; background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
}
.back-btn { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; font-size: 28px; }
.hero-num { min-width: 40px; color: rgba(255,255,255,.25); font-size: 36px; font-weight: 900; }
.hero-right { flex: 1; }
.hero-title-small { color: #fff; font-size: 18px; font-weight: 900; line-height: 1.3; }
.hero-sub { margin-top: 3px; color: rgba(255,255,255,.8); font-size: 12px; }
.hero-period { margin-top: 2px; color: rgba(255,255,255,.65); font-size: 11px; }
.toolbar { display: flex; gap: 6px; align-items: center; padding-top: 10px; padding-bottom: 10px; background: #fff; border-bottom: 1px solid var(--color-border); }
.toolbar, .bottom-finish { display: none; }
.tool-btn { padding: 5px 12px; border-radius: 10px; background: var(--color-bg-warm); color: var(--color-text-secondary); font-size: 12px; }
.tool-btn.active { background: var(--color-primary); color: #fff; font-weight: 700; }
.finish-btn { margin-left: auto; padding: 5px 12px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-bg-warm); color: var(--color-text-secondary); font-size: 12px; }
.finish-btn.done { border-color: #27ae60; background: rgba(39,174,96,.1); color: #1a7a40; }
.kp-list { padding: 10px 16px 0; }
.lesson-note {
  display: grid;
  gap: 12px;
}
.note-block {
  padding: 14px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 6px var(--color-shadow);
}
.note-block h3 {
  margin: 0 0 8px;
  color: var(--color-primary);
  font-size: 16px;
}
.note-block p {
  margin: 0;
  color: var(--color-text-primary);
  font-size: 14px;
  line-height: 1.8;
}
.note-block ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: var(--color-text-primary);
  font-size: 14px;
  line-height: 1.75;
}
.note-block li::marker {
  color: var(--color-gold);
}
.kp-card { margin-bottom: 8px; overflow: hidden; border-radius: 10px; background: #fff; box-shadow: 0 2px 8px var(--color-shadow); }
.kp-header { display: flex; align-items: center; justify-content: space-between; padding: 12px; }
.kp-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kp-level { width: 3px; height: 20px; border-radius: 2px; flex-shrink: 0; }
.level-1 { background: #27ae60; } .level-2 { background: var(--color-gold); } .level-3 { background: var(--color-primary); }
.kp-title { font-size: 15px; font-weight: 700; }
.star-mark { color: var(--color-gold); margin-right: 2px; }
.kp-expand-icon { color: var(--color-text-muted); font-size: 20px; transition: transform .2s; }
.kp-card.expanded .kp-expand-icon { transform: rotate(90deg); }
.kp-content { display: none; padding: 12px; border-top: 1px solid var(--color-border); background: var(--color-bg-warm); }
.kp-card.expanded .kp-content { display: block; }
.kp-text { white-space: pre-wrap; color: var(--color-text-primary); font-size: 14px; line-height: 1.8; }
.kp-actions { display: flex; gap: 8px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--color-border); }
.kp-action-btn { padding: 5px 12px; border: 1px solid var(--color-border); border-radius: 10px; background: #fff; color: var(--color-primary); font-size: 12px; }
.bottom-finish { padding-top: 10px; padding-bottom: 20px; }
.finish-card { border-radius: 12px; padding: 18px 16px; background: #fff; text-align: center; box-shadow: 0 2px 8px var(--color-shadow); }
.finish-text { display: block; margin-bottom: 12px; color: var(--color-text-muted); font-size: 13px; }
.finish-next { margin-top: 10px; color: var(--color-primary); font-size: 13px; }

/* 时间轴 */
.filter-bar, .chapter-picker, .ai-tabs { background: #fff; border-bottom: 1px solid var(--color-border); padding-top: 8px; padding-bottom: 8px; overflow-x: auto; }
.page-return {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
  color: #fff;
  box-shadow: 0 4px 14px rgba(139,26,26,.16);
}
.page-return button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-size: 26px;
  line-height: 1;
}
.page-return span {
  color: var(--color-gold-light);
  font-size: 13px;
  font-weight: 800;
}
.filter-tags, .picker-tabs, .prompt-tags { display: flex; gap: 6px; white-space: nowrap; }
.filter-tag, .picker-tab, .prompt-tag {
  flex: 0 0 auto; padding: 5px 14px; border: 1px solid var(--color-border); border-radius: 16px;
  background: var(--color-bg-warm); color: var(--color-text-secondary); font-size: 12px;
}
.filter-tag.active, .picker-tab.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; font-weight: 700; }
.timeline-scroll { padding: 0 16px; }
.era-block { margin-top: 20px; }
.era-header { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.era-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--color-primary); }
.era-title { padding: 3px 10px; border-radius: 10px; background: rgba(139,26,26,.06); color: var(--color-primary); font-size: 13px; font-weight: 800; }
.era-line { flex: 1; height: 1px; background: var(--color-border); }
.event-row { display: flex; }
.timeline-col { display: flex; flex-direction: column; align-items: center; width: 24px; padding-top: 12px; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-border); border: 2px solid #fff; z-index: 1; }
.timeline-dot.key-dot { width: 10px; height: 10px; background: var(--color-gold); }
.timeline-line { flex: 1; width: 1px; min-height: 20px; background: var(--color-border); }
.event-body { flex: 1; padding: 0 0 12px 8px; }
.event-time { margin-bottom: 4px; color: var(--color-text-muted); font-size: 11px; font-weight: 700; }
.event-card { padding: 10px 12px; border-radius: 8px; background: #fff; box-shadow: 0 2px 8px var(--color-shadow); }
.key-event .event-card { border-left: 2px solid var(--color-gold); background: linear-gradient(135deg, #fffbf0, #fff); }
.event-title { font-size: 14px; font-weight: 700; line-height: 1.4; }
.event-desc { display: none; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--color-border); color: var(--color-text-secondary); font-size: 12px; line-height: 1.7; }
.event-row.expanded .event-desc { display: block; }
.event-tags { display: flex; justify-content: space-between; margin-top: 6px; }
.event-tag { padding: 2px 7px; border-radius: 8px; font-size: 10px; }
.tag-china { background: rgba(139,26,26,.08); color: var(--color-primary); }
.tag-world { background: rgba(26,74,92,.08); color: #1a3a5c; }
.event-chapter { color: var(--color-primary); font-size: 11px; }

/* 思维导图 */
.mindmap-header {
  margin: 10px 16px; padding: 14px 16px; border-left: 3px solid var(--mm-color, var(--color-primary));
  border-radius: 0 8px 8px 0; background: #fff;
}
.mm-chapter-num { color: var(--mm-color, var(--color-primary)); font-size: 11px; font-weight: 800; }
.mm-chapter-title { margin-top: 2px; font-size: 17px; font-weight: 900; }
.mm-chapter-period { margin-top: 2px; color: var(--color-text-muted); font-size: 11px; }
.mm-scroll { padding-bottom: 8px; }
.mindmap-board {
  position: relative;
  height: 520px;
  margin: 0 16px 12px;
  overflow: hidden;
  border: 1px solid rgba(139,26,26,.12);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.96), rgba(255,248,238,.96)),
    radial-gradient(circle at 50% 52%, rgba(201,168,76,.13), transparent 32%);
  box-shadow: 0 2px 10px var(--color-shadow);
}
.mind-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.mind-lines path {
  fill: none;
  stroke: var(--mm-color, var(--color-primary));
  stroke-width: .42;
  stroke-linecap: round;
  opacity: .32;
}
.mind-center {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  display: grid;
  width: 150px;
  min-height: 84px;
  place-items: center;
  padding: 12px 14px;
  transform: translate(-50%, -50%);
  border-radius: 14px;
  background: linear-gradient(135deg, var(--mm-color, var(--color-primary)), #b72b24);
  color: #fff;
  text-align: center;
  box-shadow: 0 12px 28px rgba(139,26,26,.22);
}
.mind-center-kicker {
  color: var(--color-gold-light);
  font-size: 11px;
  font-weight: 800;
}
.mind-center strong {
  display: block;
  margin-top: 3px;
  font-size: 14px;
  line-height: 1.35;
}
.mind-bubble {
  position: absolute;
  z-index: 1;
  width: calc((100% - 50px) / 2);
  height: 148px;
  padding: 11px 12px;
  overflow: hidden;
  border: 1px solid rgba(139,26,26,.13);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(139,26,26,.055);
}
.mind-bubble.top-left { left: 14px; top: 24px; }
.mind-bubble.top-right { right: 14px; top: 24px; }
.mind-bubble.bottom-left { left: 14px; bottom: 24px; }
.mind-bubble.bottom-right { right: 14px; bottom: 24px; }
.mind-bubble h3 {
  margin: 0 0 6px;
  color: var(--mm-color, var(--color-primary));
  font-size: 14px;
  font-weight: 900;
}
.mind-bubble ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.mind-bubble li {
  position: relative;
  padding-left: 11px;
  color: var(--color-text-secondary);
  font-size: 11px;
  line-height: 1.45;
}
.mind-bubble li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .65em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-gold);
}
.mindmap-notes { display: none; }

/* 刷题 */
.quiz-title { margin-top: 20px; }
.quiz-tabs { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; }
.quiz-card h2 { margin: 8px 0 12px; font-size: 17px; line-height: 1.45; }
.quiz-meta { display: flex; gap: 6px; }
.quiz-meta span { padding: 3px 8px; border-radius: 10px; background: rgba(139,26,26,.08); color: var(--color-primary); font-size: 11px; font-weight: 700; }
.options { display: grid; gap: 8px; }
.option { display: flex; gap: 8px; padding: 10px; border-radius: 10px; background: var(--color-bg-warm); font-size: 14px; text-align: left; }
.option input { margin-top: 3px; }
.question-origin { margin-top: 12px; }
.origin-box {
  border: 1px solid rgba(139,26,26,.12);
  border-radius: 10px;
  background: rgba(139,26,26,.035);
  overflow: hidden;
}
.origin-box summary {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 900;
  list-style: none;
}
.origin-box summary::-webkit-details-marker { display: none; }
.origin-box summary::after {
  content: "⌄";
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(139,26,26,.08);
  color: var(--color-primary);
  font-size: 12px;
}
.origin-box[open] summary::after { content: "⌃"; }
.origin-box summary b {
  color: var(--color-text-primary);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.origin-body {
  padding: 0 12px 12px;
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.65;
}
.origin-text {
  white-space: pre-wrap;
  color: var(--color-text-primary);
}
.origin-images { display: grid; gap: 10px; margin-top: 10px; }
.origin-figure {
  margin: 0;
  padding: 6px;
  border-radius: 8px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(139,26,26,.08);
}
.origin-figure img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 6px;
}
.origin-figure figcaption {
  margin-top: 5px;
  color: var(--color-text-secondary);
  font-size: 11px;
  text-align: center;
}
.quiz-actions { display: grid; grid-template-columns: 1fr 1fr 42px; gap: 8px; margin-top: 12px; }
.star-btn { border-radius: 50%; background: var(--color-bg-warm); color: var(--color-primary); font-weight: 900; }
.feedback { min-height: 22px; color: #1a7a40; font-size: 13px; font-weight: 700; }
#wrongBook { display: grid; gap: 8px; }
.wrong-item { padding: 10px; border-radius: 10px; background: var(--color-bg-warm); color: var(--color-text-secondary); font-size: 13px; }
.wrong-item strong { display: block; color: var(--color-text-primary); }

/* 打卡 */
.checkin-hero {
  display: flex; align-items: center; justify-content: center; gap: 30px;
  padding: calc(24px + env(safe-area-inset-top)) 20px 24px; color: #fff;
  background: linear-gradient(135deg, #5c0a0a, #8b1a1a);
  text-align: center;
}
.streak-num, .total-num { color: var(--color-gold-light); font-size: 40px; font-weight: 900; line-height: 1; }
.streak-label, .total-label, .total-unit { margin-top: 4px; color: rgba(255,255,255,.75); font-size: 12px; }
.hero-divider { width: 1px; height: 50px; background: rgba(255,255,255,.22); }
.calendar-section { margin: 16px; }
.calendar-header { display: flex; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-size: 16px; font-weight: 800; }
.cal-today { color: var(--color-text-muted); font-size: 11px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-weekday, .cal-day { text-align: center; font-size: 12px; padding: 5px 0; border-radius: 6px; }
.cal-weekday { color: var(--color-text-muted); }
.cal-day.today { background: var(--color-primary); color: #fff; font-weight: 800; }
.cal-day.checked { color: var(--color-primary); font-weight: 700; }
.cal-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--color-gold); margin: 1px auto 0; }
.check-title, .stat-title { margin: 16px 0 10px; }
.checkin-card {
  display: flex; align-items: center; justify-content: space-between; width: 100%; margin-bottom: 10px;
  padding: 14px; border-radius: 10px; background: #fff; box-shadow: 0 2px 8px var(--color-shadow);
}
.btn-outline { background: transparent; }
.week-stats {
  display: flex; align-items: flex-end; gap: 4px; padding: 12px 10px 10px;
  border-radius: 10px; background: #fff; box-shadow: 0 2px 8px var(--color-shadow);
}
.week-day-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.week-bar-wrap { display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 60px; }
.week-bar { width: 16px; min-height: 4px; border-radius: 2px 2px 0 0; background: var(--color-gold); }
.week-min { color: var(--color-text-muted); font-size: 9px; }
.week-label { color: var(--color-text-secondary); font-size: 11px; }
.today-label { color: var(--color-primary); font-weight: 800; }
.leaderboard-entry {
  display: flex; align-items: center; justify-content: space-between; margin: 12px 16px 0; padding: 14px;
  border-radius: 10px; background: #fff; box-shadow: 0 2px 8px var(--color-shadow);
}
.lb-icon { font-size: 24px; }
.lb-arrow { color: var(--color-text-muted); font-size: 24px; }

/* AI */
.ai-container { display: flex; min-height: 100dvh; flex-direction: column; padding-bottom: 88px; }
.ai-tabs { display: flex; gap: 6px; }
.ai-tab { flex: 1; padding: 7px 4px; border-radius: 8px; background: var(--color-bg-warm); color: var(--color-text-secondary); font-size: 12px; }
.ai-tab.active { background: var(--color-primary); color: #fff; font-weight: 700; }
.chat-scroll { flex: 1; padding: 0 12px; }
.welcome-msg { text-align: center; padding: 30px 10px 10px; }
.ai-avatar-big { font-size: 50px; margin-bottom: 10px; }
.welcome-title { margin-bottom: 6px; font-size: 18px; font-weight: 800; }
.welcome-desc { margin-bottom: 14px; color: var(--color-text-muted); font-size: 13px; }
.welcome-features { display: grid; gap: 6px; text-align: left; }
.wf-item { width: 100%; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: 8px; background: #fff; font-size: 13px; box-shadow: 0 2px 8px var(--color-shadow); text-align: left; }
.ai-history-card {
  margin: 8px 4px 12px;
  padding: 10px;
  border: 1px solid rgba(139,26,26,.1);
  border-radius: 10px;
  background: rgba(255,255,255,.86);
  box-shadow: 0 2px 8px var(--color-shadow);
}
.ai-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 900;
}
.ai-history-head button {
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--color-bg-warm);
  color: var(--color-text-muted);
  font-size: 11px;
}
.ai-history-list { display: grid; gap: 6px; }
.ai-history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--color-bg-warm);
  text-align: left;
}
.ai-history-item span {
  overflow: hidden;
  color: var(--color-text-primary);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-history-item b {
  color: var(--color-text-muted);
  font-size: 10px;
}
.ai-history-empty { color: var(--color-text-muted); font-size: 12px; }
.msg-row { display: flex; align-items: flex-end; gap: 6px; margin: 10px 0; }
.user-row { flex-direction: row-reverse; }
.msg-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; font-size: 10px; font-weight: 800; }
.user-avatar { background: var(--color-primary); color: #fff; }
.ai-avatar-sm { background: rgba(139,26,26,.1); color: var(--color-primary); }
.msg-bubble { max-width: 76%; padding: 10px 12px; border-radius: 10px; font-size: 14px; line-height: 1.7; }
.user-bubble { background: var(--color-primary); color: #fff; border-bottom-right-radius: 2px; }
.ai-bubble { background: #fff; border-bottom-left-radius: 2px; box-shadow: 0 2px 8px var(--color-shadow); }
.ai-bubble.typing { white-space: pre-wrap; }
.ai-bubble.typing::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  background: var(--color-primary);
  vertical-align: -2px;
  animation: ai-caret 1s steps(1) infinite;
}
@keyframes ai-caret {
  50% { opacity: 0; }
}
.ai-answer { display: grid; gap: 9px; }
.ai-answer section { display: grid; gap: 4px; }
.ai-answer b { color: var(--color-primary); font-size: 13px; }
.ai-answer p { margin: 0; }
.ai-answer ul { margin: 0; padding-left: 18px; }
.ai-source {
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(139,26,26,.06);
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.5;
}
.ai-source a { color: var(--color-primary); font-weight: 800; text-decoration: none; }
.quick-prompts { padding-top: 6px; padding-bottom: 6px; background: #fff; border-top: 1px solid var(--color-border); overflow-x: auto; }
.input-bar {
  position: fixed; left: 50%; bottom: 0; z-index: 30; display: flex; align-items: flex-end; gap: 8px;
  width: min(100vw, 430px); padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-border); background: #fff; transform: translateX(-50%);
}
.page[data-page="ai"] .input-bar {
  bottom: calc(66px + env(safe-area-inset-bottom));
}
.input-area {
  flex: 1; min-height: 36px; max-height: 100px; padding: 8px 10px; border: 1px solid var(--color-border);
  border-radius: 10px; background: var(--color-bg-warm); color: var(--color-text-primary); resize: none; outline: none;
}
.send-btn { width: 48px; height: 36px; border-radius: 10px; background: var(--color-border); color: #fff; font-size: 13px; }
.send-btn.active { background: var(--color-primary); }

/* 底部导航 */
.tabbar {
  position: fixed; left: 50%; bottom: 0; z-index: 25; display: grid; grid-template-columns: repeat(5, 1fr);
  width: min(100vw, 430px); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(232,213,200,.9); background: rgba(253,245,240,.96);
  box-shadow: 0 -8px 24px rgba(139,26,26,.08); transform: translateX(-50%); backdrop-filter: blur(16px);
}
.tabbar { grid-template-columns: repeat(4, 1fr); }
.tabbar button { display: grid; place-items: center; gap: 2px; min-height: 52px; border-radius: 14px; color: #9e8878; }
.tabbar span { display: grid; place-items: center; height: 20px; font-size: 15px; }
.tabbar b { font-size: 11px; }
.tabbar button.active { background: rgba(139,26,26,.06); color: var(--color-primary); }
.phone-app[data-current="detail"] .tabbar {
  display: none;
}

@media (min-width: 431px) {
  .phone-app { min-height: 932px; }
}

/* 炫酷交互层 */
:root {
  --color-ink: #17100d;
  --color-jade: #1a6b5c;
  --color-night: #1a2638;
}

.phone-app {
  isolation: isolate;
  background:
    linear-gradient(180deg, #fdf5f0 0%, #fff8f1 42%, #f8e9dd 100%);
}

.phone-app::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  width: min(100vw, 430px);
  margin: 0 auto;
  pointer-events: none;
  background-image:
    linear-gradient(90deg, rgba(139,26,26,.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(139,26,26,.025) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: .55;
}

.container {
  background:
    linear-gradient(180deg, rgba(253,245,240,.96), rgba(255,248,241,.96));
}

.phone-app.switching .page.active {
  animation: page-pop .34s cubic-bezier(.16,.9,.22,1);
}

@keyframes page-pop {
  from { opacity: .86; transform: translateY(20px) scale(.98); filter: blur(5px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.home-hero {
  height: 210px;
  border-bottom: 1px solid rgba(240,208,128,.26);
}

.hero-bg {
  background:
    linear-gradient(115deg, rgba(240,208,128,.18) 0 1px, transparent 1px 22px),
    linear-gradient(150deg, #4b0505 0%, #8b1a1a 45%, #bc2a23 72%, #6d1111 100%);
  background-size: auto, 180% 180%;
  animation: palace-red-flow 8s ease-in-out infinite alternate;
}

.hero-bg::after {
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,.055) 0 1px, transparent 1px 30px),
    repeating-linear-gradient(0deg, rgba(0,0,0,.05) 0 1px, transparent 1px 18px);
  mix-blend-mode: soft-light;
}

.hero-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 18%, rgba(255,230,170,.18) 42%, transparent 62%);
  transform: translateX(-70%);
  animation: hero-sweep 4.8s ease-in-out infinite;
}

@keyframes palace-red-flow {
  from { background-position: 0 0, 0% 50%; }
  to { background-position: 0 0, 100% 50%; }
}

@keyframes hero-sweep {
  0%, 38% { transform: translateX(-75%); opacity: 0; }
  50% { opacity: 1; }
  76%, 100% { transform: translateX(80%); opacity: 0; }
}

.hero-title-img {
  width: min(82%, 330px);
  filter:
    drop-shadow(0 7px 12px rgba(0,0,0,.26))
    drop-shadow(0 0 1px rgba(240,208,128,.28));
  animation: title-float 4.2s ease-in-out infinite;
}

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

.section-title {
  letter-spacing: .04em;
}

.feature-item,
.daily-card,
.chapter-card,
.event-card,
.note-block,
.quiz-card,
#wrongBookCard,
.mind-focus-card {
  border: 1px solid rgba(139,26,26,.075);
}

.feature-item,
.daily-card,
.chapter-card,
.event-card,
.filter-tag,
.picker-tab,
.tabbar button,
.mind-bubble,
.sheet-link,
.mind-focus-link,
.globe-hotspot,
.globe-chip {
  transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s, border-color .22s, background .22s;
}

.feature-item {
  position: relative;
  overflow: hidden;
  min-height: 100px;
}

.feature-item::after,
.chapter-card::after,
.daily-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0 34%, rgba(255,255,255,.58) 48%, transparent 62% 100%);
  transform: translateX(-120%);
  opacity: 0;
  pointer-events: none;
}

.feature-item:active,
.daily-card:active,
.chapter-card:active,
.event-card:active,
.mind-bubble:active,
.tabbar button:active,
.globe-hotspot:active,
.globe-chip:active {
  transform: scale(.975);
}

.globe-hotspot:active {
  transform: translate(-50%, -50%) scale(.94);
}

.feature-item.tap-flash::after,
.chapter-card.tap-flash::after,
.daily-card.tap-flash::after {
  animation: card-sheen .62s ease;
}

@keyframes card-sheen {
  0% { transform: translateX(-120%); opacity: 0; }
  18% { opacity: 1; }
  100% { transform: translateX(120%); opacity: 0; }
}

.feature-icon {
  background: linear-gradient(135deg, rgba(139,26,26,.09), rgba(240,208,128,.18));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.7), 0 6px 16px rgba(139,26,26,.06);
}

.feature-name {
  color: var(--color-ink);
}

.top-bar,
.filter-bar,
.chapter-picker,
.ai-tabs {
  position: sticky;
  top: 0;
  z-index: 7;
  background: rgba(255,255,255,.84);
  backdrop-filter: blur(18px);
}

.tab-item.active,
.filter-tag.active,
.picker-tab.active {
  box-shadow: 0 8px 18px rgba(139,26,26,.14);
}

.chapter-card {
  transform-origin: center;
}

.chapter-card:nth-child(odd) {
  background: linear-gradient(135deg, #fff 0%, #fff8f0 100%);
}

.chapter-card:hover,
.feature-item:hover,
.event-card:hover {
  box-shadow: 0 9px 24px rgba(139,26,26,.09);
}

.page-return {
  background:
    linear-gradient(90deg, rgba(240,208,128,.16), transparent 42%),
    linear-gradient(135deg, #4b0505, #8b1a1a 58%, #b52a23);
}

.timeline-scroll {
  padding-top: 4px;
}

.era-block {
  animation: rise-in .35s ease both;
}

.event-row {
  cursor: pointer;
}

.timeline-dot.key-dot {
  box-shadow: 0 0 0 5px rgba(201,168,76,.16), 0 0 18px rgba(201,168,76,.35);
}

.event-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(139,26,26,.08);
}

.event-card::after {
  content: "点开";
  position: absolute;
  right: 10px;
  top: 10px;
  color: rgba(139,26,26,.42);
  font-size: 10px;
  font-weight: 800;
}

.event-row.expanded .event-desc {
  display: none;
}

.mindmap-board {
  background:
    linear-gradient(135deg, rgba(255,255,255,.94), rgba(255,247,237,.96)),
    linear-gradient(90deg, rgba(139,26,26,.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(139,26,26,.035) 1px, transparent 1px);
  background-size: auto, 28px 28px, 28px 28px;
}

.mind-lines path {
  stroke-dasharray: 86;
  stroke-dashoffset: 86;
  animation: line-draw .9s ease forwards;
}

@keyframes line-draw {
  to { stroke-dashoffset: 0; }
}

.mind-center {
  box-shadow: 0 14px 30px rgba(139,26,26,.24), 0 0 0 7px rgba(139,26,26,.07);
}

.mind-center::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 1px solid rgba(201,168,76,.32);
  border-radius: 18px;
  animation: center-pulse 2.8s ease-in-out infinite;
}

@keyframes center-pulse {
  0%, 100% { transform: scale(.98); opacity: .3; }
  50% { transform: scale(1.04); opacity: .8; }
}

.mind-bubble {
  text-align: left;
}

.mind-bubble.active {
  border-color: rgba(139,26,26,.42);
  box-shadow: 0 10px 24px rgba(139,26,26,.12), inset 0 0 0 1px rgba(201,168,76,.28);
  transform: translateY(-3px);
}

.mind-bubble.active h3 {
  color: #6d1111;
}

.mindmap-focus {
  margin-bottom: 12px;
}

.mind-focus-card {
  padding: 13px 14px;
  border-radius: 10px;
  background:
    linear-gradient(135deg, #fff, #fff8ef);
  box-shadow: 0 4px 14px rgba(139,26,26,.07);
}

.mind-focus-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mind-focus-kicker {
  color: var(--color-gold);
  font-size: 11px;
  font-weight: 900;
}

.mind-focus-card h3 {
  margin: 2px 0 8px;
  color: var(--color-primary);
  font-size: 16px;
}

.mind-focus-card ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 17px;
  font-size: 13px;
  line-height: 1.65;
}

.mind-focus-link,
.sheet-link {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--color-primary), #b72b24);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.mind-focus-link {
  width: auto;
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.tabbar {
  border-top: 1px solid rgba(139,26,26,.08);
  background: rgba(255,248,241,.88);
}

.tabbar button.active {
  background: linear-gradient(180deg, rgba(139,26,26,.1), rgba(201,168,76,.12));
  box-shadow: inset 0 0 0 1px rgba(139,26,26,.08);
}

.tabbar button.active span {
  transform: translateY(-1px);
}

.event-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  align-items: end;
  width: min(100vw, 430px);
  margin: 0 auto;
}

.event-sheet.hidden {
  display: none;
}

.sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(23,16,13,.42);
  backdrop-filter: blur(8px);
}

.sheet-panel {
  position: relative;
  z-index: 1;
  max-height: 82dvh;
  overflow: auto;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  background:
    linear-gradient(135deg, rgba(255,255,255,.98), rgba(255,246,236,.98));
  box-shadow: 0 -18px 50px rgba(0,0,0,.22);
  animation: sheet-up .28s cubic-bezier(.18,.9,.24,1);
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-close {
  position: absolute;
  right: 14px;
  top: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(139,26,26,.08);
  color: var(--color-primary);
  font-size: 22px;
}

.sheet-kicker {
  color: var(--color-gold);
  font-size: 12px;
  font-weight: 900;
}

.sheet-panel h2 {
  margin: 4px 42px 4px 0;
  color: var(--color-ink);
  font-size: 22px;
  line-height: 1.25;
}

.sheet-time {
  display: inline-grid;
  margin: 3px 0 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(139,26,26,.08);
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 800;
}

.sheet-body {
  display: grid;
  gap: 10px;
}

.sheet-block {
  padding: 12px;
  border: 1px solid rgba(139,26,26,.08);
  border-radius: 10px;
  background: rgba(255,255,255,.72);
}

.sheet-block h3 {
  margin: 0 0 6px;
  color: var(--color-primary);
  font-size: 14px;
}

.sheet-block p,
.sheet-block li {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.75;
}

.sheet-block ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 16px;
}

.sheet-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sheet-keywords span {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(26,107,92,.08);
  color: var(--color-jade);
  font-size: 12px;
  font-weight: 800;
}

.sheet-link {
  position: sticky;
  bottom: 0;
  margin-top: 2px;
  box-shadow: 0 -8px 18px rgba(255,248,241,.9), 0 8px 18px rgba(139,26,26,.14);
}

.keyword-list {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 0 !important;
  list-style: none;
}

.keyword-token {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(139,26,26,.16);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(139,26,26,.08), rgba(201,168,76,.12));
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 4px 12px rgba(139,26,26,.055);
}

.keyword-token::after {
  content: "›";
  margin-left: 5px;
  color: var(--color-gold);
  font-size: 15px;
  line-height: 1;
}

.keyword-mini {
  display: inline;
  color: var(--color-primary);
  font-size: inherit;
  font-weight: 900;
  line-height: inherit;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(201,168,76,.65);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.sheet-keywords .keyword-mini {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(26,107,92,.08);
  color: var(--color-jade);
  font-size: 12px;
  text-decoration: none;
}

.mind-bubble {
  cursor: pointer;
}

.mind-bubble .keyword-mini {
  font-size: 11px;
}

.keyword-panel {
  background:
    radial-gradient(circle at 88% 0%, rgba(201,168,76,.16), transparent 28%),
    linear-gradient(135deg, rgba(255,255,255,.98), rgba(255,246,236,.98));
}

.keyword-source {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(26,107,92,.12);
  border-radius: 10px;
  background: rgba(26,107,92,.055);
  color: var(--color-jade);
  font-size: 12px;
  font-weight: 900;
}

.keyword-source a {
  min-width: 0;
  overflow: hidden;
  color: var(--color-primary);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.keyword-related {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(201,168,76,.1);
}

.keyword-related > span {
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 900;
}

.keyword-question-block {
  background: linear-gradient(135deg, rgba(255,255,255,.9), rgba(255,250,242,.9));
}

.keyword-question {
  display: grid;
  gap: 5px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid rgba(139,26,26,.09);
  border-radius: 10px;
  background: #fff;
}

.keyword-question-meta {
  color: var(--color-gold);
  font-size: 11px;
  font-weight: 900;
}

.keyword-question strong {
  color: var(--color-ink);
  font-size: 13px;
  line-height: 1.55;
}

.keyword-question p,
.keyword-empty {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.7;
}

.keyword-question .origin-box {
  margin-top: 4px;
}

.keyword-question .origin-figure img {
  max-height: 220px;
}

.upload-hint {
  padding: 10px 12px;
  border: 1px dashed rgba(139,26,26,.18);
  border-radius: 10px;
  background: rgba(139,26,26,.045);
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.6;
}

.tap-flash {
  animation: tap-glow .42s ease;
}

@keyframes tap-glow {
  0% { filter: brightness(1); }
  35% { filter: brightness(1.08); }
  100% { filter: brightness(1); }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* iPhone 灵动岛/状态栏颜色衔接 */
.hero-title-img {
  width: min(88%, 368px);
  max-height: 118px;
  mix-blend-mode: normal;
  filter:
    drop-shadow(0 8px 13px rgba(0,0,0,.2));
}

.top-bar {
  padding-top: calc(10px + env(safe-area-inset-top));
  background: linear-gradient(135deg, #6d1111 0%, #9b211d 58%, #c9a84c 140%);
  border-bottom: 1px solid rgba(240,208,128,.18);
  box-shadow: 0 6px 18px rgba(139,26,26,.18);
  backdrop-filter: none;
}

.top-bar .tab-switch {
  background: rgba(255,255,255,.16);
}

.top-bar .tab-item {
  color: rgba(255,255,255,.82);
}

.top-bar .tab-item.active {
  background: rgba(255,255,255,.96);
  color: var(--color-primary);
}

.top-bar .view-toggle {
  border-color: rgba(255,255,255,.44);
  background: rgba(255,255,255,.12);
  color: #fff;
}

.page[data-page="quiz"] > .container {
  padding-top: calc(18px + env(safe-area-inset-top));
  background:
    linear-gradient(180deg, rgba(248,233,221,.98), rgba(255,248,241,.96));
}

.page[data-page="quiz"] .quiz-title {
  margin-top: 0;
}

.ai-tabs {
  padding-top: calc(8px + env(safe-area-inset-top));
  background: linear-gradient(135deg, #5c0a0a, #8b1a1a);
  border-bottom-color: rgba(240,208,128,.18);
  backdrop-filter: none;
}

.ai-tabs .ai-tab {
  background: rgba(255,255,255,.13);
  color: rgba(255,255,255,.84);
}

.ai-tabs .ai-tab.active {
  background: rgba(255,255,255,.96);
  color: var(--color-primary);
}

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