/* ── 主题分析页 ── */

#screen-themes.screen.screen-page {
  background-color: #1a0814;
  background-image:
    linear-gradient(
      180deg,
      rgba(26, 8, 20, 0.06) 0%,
      rgba(26, 8, 20, 0.16) 55%,
      rgba(26, 8, 20, 0.28) 100%
    ),
    url('../images/theme-bg.png') center top / cover no-repeat;
}

/* 固定背景层（Art Deco 金线暗纹） */
.theme-bg-layer {
  position: fixed !important;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(430px, 100%);
  z-index: 0;
  pointer-events: none;
  background: url('../images/theme-bg.png') center top / cover no-repeat;
}

.theme-bg-veil {
  position: fixed !important;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(430px, 100%);
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(26, 8, 20, 0.08) 0%,
    rgba(26, 8, 20, 0.18) 55%,
    rgba(26, 8, 20, 0.32) 100%
  );
}

#screen-themes.screen-page::before {
  display: none;
}

#screen-themes {
  isolation: isolate;
}

#screen-themes > .theme-topbar,
#screen-themes > .theme-tabs-bar,
#screen-themes > .theme-page-body {
  position: relative;
  z-index: 1;
}

#screen-themes .theme-topbar {
  position: sticky;
  z-index: 30;
  background: rgba(26, 10, 22, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom-color: rgba(212, 175, 55, 0.18);
}

/* 主题索引：一页横滑 */
#screen-themes .theme-tabs-bar {
  position: sticky;
  top: calc(52px + env(safe-area-inset-top, 0px));
  z-index: 25;
  padding: 10px 0 12px;
  background: rgba(30, 12, 26, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(212, 175, 55, 0.14);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.theme-tabs,
.theme-tabs-scroll {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 12px 6px;
  scroll-padding-inline: 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.theme-tabs::-webkit-scrollbar,
.theme-tabs-scroll::-webkit-scrollbar {
  display: none;
}

.theme-tab {
  position: relative;
  flex: 0 0 auto;
  min-width: 72px;
  max-width: 88px;
  padding: 8px 10px 12px;
  border: none;
  cursor: pointer;
  color: rgba(214, 204, 188, 0.72);
  font-size: 10px;
  font-family: 'Noto Serif SC', serif;
  transition: transform 0.2s ease, color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  background: transparent;
  border-radius: 8px;
  box-shadow: none;
}

.theme-tab__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.theme-tab__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: var(--tab-accent, #c0392b);
  opacity: 0.45;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.theme-tab__icon svg {
  width: 18px;
  height: 18px;
}

.theme-tab__text {
  line-height: 1.25;
  text-align: center;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.theme-tab.active {
  color: #faf6ee;
  transform: scale(1.03);
  background: color-mix(in srgb, var(--tab-accent, #c0392b) 12%, transparent);
  box-shadow: none;
}

.theme-tab.active .theme-tab__icon {
  opacity: 1;
}

.theme-tab.active .theme-tab__underline {
  opacity: 1;
  transform: scaleX(1);
}

.theme-tab__underline {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--tab-accent, #c0392b);
  opacity: 0;
  transform: scaleX(0.85);
  transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

.theme-tab:active:not(.active) {
  transform: scale(0.97);
}

.theme-page-body {
  --theme-primary: #c0392b;
  position: relative;
  z-index: 1;
  padding: 14px 16px 40px 22px;
}

.theme-page-body::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 12px;
  bottom: 32px;
  width: 3px;
  border-radius: 2px;
  background: var(--theme-primary);
  transition: background-color 0.3s ease;
  pointer-events: none;
}

/* 主题面板 */
.theme-panel {
  border-radius: 18px;
  border: 1px solid rgba(212, 175, 55, 0.22);
  background: linear-gradient(165deg, rgba(36, 16, 32, 0.62), rgba(22, 10, 20, 0.78));
  padding: 18px 16px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 12px 32px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.theme-panel__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--theme-accent, #c0392b) 18%, transparent);
}

.theme-panel__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--theme-accent, #c9a84c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--theme-accent, #c9a84c) 35%, transparent);
  color: var(--theme-accent, #c9a84c);
}

.theme-panel__icon svg {
  width: 20px;
  height: 20px;
}

.theme-panel__title {
  font-size: 17px;
  font-weight: 600;
  color: #f5f0e8;
  letter-spacing: 0.04em;
}

.theme-panel__intro {
  font-size: 13px;
  color: rgba(214, 204, 188, 0.82);
  line-height: 1.8;
  margin-bottom: 14px;
}

/* 引用卡片 */
.theme-quote {
  margin: 0 0 16px;
  padding: 14px 16px 14px 18px;
  border-left: 4px solid var(--theme-accent, var(--theme-primary, #c0392b));
  border-radius: 0 12px 12px 0;
  background: color-mix(in srgb, var(--theme-accent, var(--theme-primary, #c0392b)) 8%, transparent);
  box-shadow: inset 0 0 24px color-mix(in srgb, var(--theme-accent, var(--theme-primary, #c0392b)) 4%, transparent);
  transition: border-color 0.3s ease, background 0.3s ease;
}

.theme-quote p {
  margin: 0;
  font-style: italic;
  font-size: 13px;
  line-height: 1.75;
  color: rgba(232, 212, 170, 0.92);
}

/* 关键词高亮 */
.theme-kw,
mark.theme-kw {
  background: color-mix(in srgb, var(--theme-accent, var(--theme-primary, #c0392b)) 12%, transparent);
  color: var(--theme-accent, var(--theme-primary, #c0392b));
  padding: 0 3px;
  border-radius: 3px;
  font-style: normal;
  font-weight: 500;
}

.theme-inline-quote {
  font-style: italic;
  color: rgba(232, 212, 170, 0.88);
}

/* 人物分析卡片 */
.theme-char-card {
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--char-tint, #8a8090) 22%, transparent);
  background: color-mix(in srgb, var(--char-tint, #8a8090) 5%, rgba(18, 8, 16, 0.55));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.theme-char-card:last-child {
  margin-bottom: 0;
}

.theme-char-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid #fff;
  box-shadow:
    0 0 0 2px var(--char-accent, #8a8090),
    0 4px 14px rgba(0, 0, 0, 0.35);
}

.theme-char-name {
  font-weight: 600;
  color: #f5f0e8;
  font-size: 14px;
  margin-bottom: 6px;
}

.theme-char-text {
  color: rgba(200, 192, 180, 0.88);
  font-size: 12px;
  line-height: 1.72;
}

/* 深色主题色：文字提亮，避免与背景融在一起 */
#screen-themes[data-theme="death"] .theme-panel__title,
#screen-themes[data-theme="death"] .theme-panel__intro,
#screen-themes[data-theme="death"] .theme-char-name,
#screen-themes[data-theme="death"] .theme-char-text,
#screen-themes[data-theme="death"] .theme-quote p,
#screen-themes[data-theme="death"] .theme-quote__text,
#screen-themes[data-theme="death"] mark.theme-kw,
#screen-themes[data-theme="modernity"] .theme-panel__title,
#screen-themes[data-theme="modernity"] .theme-panel__intro,
#screen-themes[data-theme="modernity"] .theme-char-name,
#screen-themes[data-theme="modernity"] .theme-char-text,
#screen-themes[data-theme="modernity"] .theme-quote p,
#screen-themes[data-theme="modernity"] .theme-quote__text,
#screen-themes[data-theme="modernity"] mark.theme-kw {
  color: var(--color-parchment);
}
