
/* Smooth behaviors */
html { scroll-behavior: smooth; }

/* Generic transitions to soften interactions (limit to safe properties) */
*, *::before, *::after { transition: color .2s ease-in-out, background-color .2s ease-in-out, border-color .2s ease-in-out; will-change: auto; }

/* Buttons micro-interactions */
.btn {
  --interactive-highlight: rgba(24,144,255,0.32);
  transition: transform .2s cubic-bezier(0.4, 0, 0.2, 1),
             box-shadow .25s cubic-bezier(0.4, 0, 0.2, 1),
             background-color .2s ease-in-out,
             border-color .2s ease-in-out,
             opacity .2s ease-in-out;
  will-change: transform, box-shadow;
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: '';
  position: absolute;
  inset: -12%;
  border-radius: inherit;
  background: radial-gradient(circle, var(--interactive-highlight) 0%, rgba(255,255,255,0) 70%);
  opacity: 0;
  transform: scale(0.45);
  pointer-events: none;
  z-index: 0;
}
.btn:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}
.btn:active,
.btn.is-pressed {
  transform: scale(0.96) translateY(0);
}
.btn.is-click-animate::before {
  animation: interactive-click-flare .6s ease-out forwards;
}
.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}
.btn.is-loading {
  pointer-events: none;
  opacity: 0.8;
}
.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin .6s linear infinite;
  z-index: 2;
}
.btn > * {
  position: relative;
  z-index: 1;
}
.btn--primary { --interactive-highlight: rgba(24,144,255,0.5); }
.btn--danger { --interactive-highlight: rgba(255,77,79,0.5); }
.btn--ghost { --interactive-highlight: rgba(24,144,255,0.35); }

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* Ripple (ink) effect container */
.btn, .feature-card, .chip { position: relative; overflow: hidden; }
.ripple-wave { position: absolute; border-radius: 999px; transform: translate(-50%,-50%) scale(0); pointer-events: none; opacity: .25; animation: ripple-anim .45s ease-out forwards; background: currentColor; }
@keyframes ripple-anim { to { transform: translate(-50%,-50%) scale(1); opacity: 0; } }

/* Click flare for interactive surfaces */
.feature-card, .chip {
  --interactive-highlight: rgba(24,144,255,0.24);
}
.feature-card::before,
.chip::before {
  content: '';
  position: absolute;
  inset: -12%;
  border-radius: inherit;
  background: radial-gradient(circle, var(--interactive-highlight) 0%, rgba(255,255,255,0) 70%);
  opacity: 0;
  transform: scale(0.45);
  pointer-events: none;
  z-index: 0;
}
.feature-card.is-click-animate::before,
.chip.is-click-animate::before {
  animation: interactive-click-flare .6s ease-out forwards;
}

@keyframes interactive-click-flare {
  0% {
    opacity: 0.7;
    transform: scale(0.45);
  }
  60% {
    opacity: 0.35;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

/* Inputs focus/validation feedback */
.input {
  transition: border-color .25s cubic-bezier(0.4, 0, 0.2, 1),
             box-shadow .25s cubic-bezier(0.4, 0, 0.2, 1),
             background-color .2s ease-in-out,
             transform .2s ease-in-out;
}
.input:focus {
  transform: scale(1.01);
  outline: none;
}
.input.is-valid {
  border-color: #52c41a;
  box-shadow: 0 0 0 3px rgba(82,196,26,0.18);
  animation: input-success-pulse .4s ease-out;
}
.input.is-invalid {
  border-color: #ff4d4f;
  box-shadow: 0 0 0 3px rgba(255,77,79,0.18);
  animation: input-error-shake .4s ease-out;
}

@keyframes input-success-pulse {
  0%, 100% { transform: scale(1.01); }
  50% { transform: scale(1.02); }
}
@keyframes input-error-shake {
  0%, 100% { transform: translateX(0) scale(1.01); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px) scale(1.01); }
  20%, 40%, 60%, 80% { transform: translateX(4px) scale(1.01); }
}

/* Cards and menus show/hide softening */
.card { transition: box-shadow .25s ease-in-out, transform .25s ease-in-out, background-color .2s ease-in-out, border-color .2s ease-in-out; }
.card--enter { animation: fade-in .25s ease-in-out; }
.card--leave { animation: fade-out .2s ease-in-out; }

/* Page transitions: entering/leaving */
.page { will-change: opacity, transform; }
.page--active { animation: pageFadeIn 0.4s ease-out; }
.page--leaving { animation: slide-fade-out .22s ease-in-out; }

@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(4px); } }
@keyframes slide-fade-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(8px); } }
/* 统一的页面进入动画 - 应用于所有页面 */
@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hover/active unification for chips/feature-card */
.chip {
  transition: transform .18s cubic-bezier(0.4, 0, 0.2, 1),
             background-color .2s ease-in-out,
             border-color .2s ease-in-out;
  will-change: transform;
}
.chip:active { transform: scale(0.95); }
.feature-card {
  transition: transform .2s cubic-bezier(0.4, 0, 0.2, 1),
             box-shadow .25s cubic-bezier(0.4, 0, 0.2, 1),
             background-color .2s ease-in-out;
  will-change: transform, box-shadow;
}
.feature-card:hover {
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}
.feature-card:active,
.feature-card.is-pressed {
  transform: scale(0.97);
}

/* Subtle lift on hover (desktop) */
@media (hover:hover) and (pointer:fine) {
  .btn:hover, .feature-card:hover { transform: translateY(-2px); }
}

/* Tabbar interactions */
.tabbar__item { transition: color .2s ease-in-out, background-color .2s ease-in-out; }
.tabbar__item:active { transform: scale(0.98); }

/* Reduce motion respect */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.page-container {
  flex: 1 1 auto;
  min-height: 0; /* allow child to shrink on mobile */
  padding: calc(12px + var(--safe-top)) 16px 12px 16px;
  padding-bottom: calc(var(--tabbar-height) + var(--safe-bottom) + 24px);
}
/* Ensure every page content has extra breathing room above the fixed tabbar */
.page { padding-bottom: calc(var(--tabbar-height) + var(--safe-bottom) + 16px); }

.page-title {
  font-size: 20px;
  font-weight: 700;
  margin: 4px 0 12px 0;
  text-align: center;
  width: 100%;
}

.muted { color: var(--color-text-muted); }
.text-success { color: #52c41a; }
.text-warning { color: #faad14; }

/* Cards and basic UI */
.card {
  background: var(--color-bg-elev);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
}
.card__title { font-size: 16px; margin: 0 0 6px 0; }
.card__desc { color: var(--color-text-muted); margin: 0 0 12px 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
}
.btn--primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.btn--danger { background: #ff4d4f; color: #fff; border-color: #ff4d4f; }
.btn--block { width: 100%; height: 44px; }
.btn--sm { height: 32px; padding: 0 10px; border-radius: 10px; }
.btn--ghost { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.shortcut {
  background: var(--color-primary-weak);
  color: var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

/* Page views */
.page {
  display: none;
}
.page--active {
  display: block;
  animation: pageFadeIn 0.4s ease-out;
}

@keyframes slide-fade-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Bottom Tab Bar */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--color-bg-elev);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  z-index: 100;
}

.tabbar__item {
  flex: 1 1 25%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--color-text-muted);
  position: relative;
  transition: color .3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.tabbar__item.is-active {
  color: var(--color-primary);
}
.tabbar__item.is-active::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--color-primary);
  border-radius: 2px 2px 0 0;
  animation: tabbar-indicator .3s cubic-bezier(0.4, 0, 0.2, 1);
}
.tabbar__icon {
  width: 22px;
  height: 22px;
  filter: none;
  transition: transform .25s cubic-bezier(0.4, 0, 0.2, 1);
  /* 图标颜色会通过 JavaScript 动态更新 */
}
.tabbar__item.is-active .tabbar__icon {
  transform: scale(1.1);
  /* 激活状态的图标颜色会通过 JavaScript 动态设置为主题色 */
  filter: var(--tabbar-icon-filter, none);
}
.tabbar__item:active .tabbar__icon {
  transform: scale(0.95);
}
.tabbar__item.is-active:active .tabbar__icon {
  transform: scale(1.05);
}

@keyframes tabbar-indicator {
  from {
    width: 0;
    opacity: 0;
  }
  to {
    width: 24px;
    opacity: 1;
  }
}
.tabbar__text { font-size: 12px; }

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
  .page { animation: none; }
}

/* Auth pages */
.auth-card {
  background: var(--color-bg-elev);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow-card);
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.auth-brand__logo { width: 28px; height: 28px; }
.auth-brand__name { font-weight: 700; font-size: 18px; }

.form { display: flex; flex-direction: column; gap: 10px; }
.form__row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.form__row--password { position: relative; grid-template-columns: 1fr auto; }
.form__row--code { grid-template-columns: 1fr auto; }
.form__label { grid-column: 1 / -1; font-size: 13px; color: var(--color-text-muted); }
.input {
  grid-column: 1 / 2;
  appearance: none;
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 10px;
}
.input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(24,144,255,0.15); }
.input-toggle { grid-column: 2 / 3; color: var(--color-primary); }
.input--sm { height: 36px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--color-text-muted); }
.form__error { grid-column: 1 / -1; color: #ff4d4f; font-size: 12px; min-height: 16px; }
.form__extras { display: flex; justify-content: flex-end; }
.form__footer { text-align: center; color: var(--color-text-muted); }
.link { color: var(--color-primary); text-decoration: none; }
.link:active { opacity: .8; }

.hidden { display: none !important; }

/* Home: Welcome banner */
.home-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin: 8px 0 16px 0;
  border-radius: var(--radius-md);
  background: var(--color-bg-elev);
  border: 1px solid var(--color-border);
}

.home-welcome__content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.home-welcome__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.home-welcome__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.home-welcome__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.home-welcome__greet {
  font-weight: 700;
  font-size: 16px;
  color: var(--color-text);
}

.home-welcome__sub {
  color: var(--color-text-muted);
  font-size: 13px;
}

.home-welcome__date {
  color: var(--color-text);
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Home: Carousel */
.home-carousel {
  margin: 12px 0; /* 只保留上下间距 */
  position: relative;
  /* 使用负边距延伸到页面边缘，消除左右空白，实现无缝显示 */
  margin-left: -16px;
  margin-right: -16px;
  width: calc(100% + 32px);
}

.carousel-container {
  position: relative;
  overflow: hidden;
  width: 100%;
  /* 移除所有圆角和内边距，实现无缝显示 */
  border-radius: 0;
  padding: 0;
  margin: 0;
}

.carousel-track {
  display: -webkit-box; /* 旧版 Safari */
  display: -webkit-flex; /* Safari 6.1+ */
  display: -ms-flexbox; /* IE 10 */
  display: flex;
  -webkit-flex-direction: row; /* 确保横向排列 */
  -ms-flex-direction: row;
  flex-direction: row;
  -webkit-flex-wrap: nowrap; /* 防止换行 */
  -ms-flex-wrap: nowrap;
  flex-wrap: nowrap;
  -webkit-box-orient: horizontal; /* 旧版webkit */
  -webkit-box-direction: normal; /* 旧版webkit */
  -webkit-transition: -webkit-transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  -ms-transition: -ms-transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  /* 确保无缝衔接，无间隙 */
  gap: 0;
  margin: 0;
  padding: 0;
  /* 确保横向排列，不换行 */
  white-space: nowrap;
  /* 防止换行 */
  word-wrap: normal;
  word-break: normal;
}

/* 微信浏览器特殊处理 - 使用绝对定位和显示/隐藏 */
.wechat-browser .carousel-track {
  position: relative;
  display: block !important;
  width: 100%;
  height: auto;
  min-height: 120px;
  /* 清除flex相关属性 */
  -webkit-box-orient: initial !important;
  -webkit-box-direction: initial !important;
  -webkit-flex-direction: initial !important;
  flex-direction: initial !important;
  -webkit-flex-wrap: initial !important;
  flex-wrap: initial !important;
}

.wechat-browser .carousel-slide {
  position: absolute !important;
  top: 0;
  left: 0;
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  opacity: 0;
  visibility: hidden;
  -webkit-transition: opacity 0.4s ease, visibility 0.4s ease;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  /* 清除flex相关属性 */
  display: flex !important;
  -webkit-box-flex: initial !important;
  -webkit-flex-grow: initial !important;
  flex-grow: initial !important;
  -webkit-flex-shrink: initial !important;
  flex-shrink: initial !important;
  -webkit-flex-basis: initial !important;
  flex-basis: initial !important;
}

.wechat-browser .carousel-slide.is-active {
  position: relative !important;
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 1;
}

.carousel-track:active {
  cursor: grabbing;
}

.carousel-slide {
  display: -webkit-box; /* 旧版 Safari */
  display: -webkit-flex; /* Safari 6.1+ */
  display: -ms-flexbox; /* IE 10 */
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
  /* 确保每个slide占据全宽，防止竖直排列 */
  min-width: 100%;
  width: 100%;
  max-width: 100%;
  -webkit-flex-shrink: 0;
  -ms-flex-negative: 0;
  flex-shrink: 0;
  -webkit-flex-basis: 100%;
  -ms-flex-preferred-size: 100%;
  flex-basis: 100%;
  -webkit-box-flex: 0; /* 旧版webkit */
  -ms-flex-positive: 0;
  flex-grow: 0;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  /* 确保无缝衔接 */
  overflow: hidden;
  position: relative;
  /* 消除任何可能的间隙 */
  line-height: 0;
  font-size: 0;
  /* 确保图片垂直居中显示 */
  background: var(--color-bg);
  /* 防止换行 */
  white-space: nowrap;
  /* 防止换行 */
  word-wrap: normal;
  word-break: normal;
  /* 确保横向排列 */
  float: none;
  clear: none;
}

/* 轮播图片样式 - 完整显示，不被裁剪 */
.carousel-image {
  width: 100%;
  height: auto; /* 高度自适应，保持图片比例 */
  max-height: 200px; /* 限制最大高度，避免图片过大 */
  min-height: 120px; /* 设置最小高度，确保可见 */
  object-fit: contain; /* 使用contain保持图片完整，不被裁剪 */
  object-position: center; /* 居中显示 */
  display: block;
  pointer-events: none; /* 防止图片拖拽 */
  user-select: none;
  -webkit-user-select: none;
  /* 移除所有边距和圆角，实现无缝 */
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  /* 确保图片之间完全无缝，消除任何可能的间隙 */
  vertical-align: top;
  line-height: 0;
  /* 确保图片紧贴容器边缘 */
  position: relative;
}

@media (min-width: 520px) {
  .carousel-image {
    max-height: 240px; /* 桌面端稍大一些 */
    min-height: 140px;
  }
}

@media (min-width: 768px) {
  .carousel-image {
    max-height: 280px; /* 大屏幕更大 */
    min-height: 160px;
  }
}

/* Home: Info/Quote Section */
.home-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin: 12px 0;
  background: var(--color-bg-elev);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  gap: 12px;
}

.home-info__icon {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.info-icon {
  width: 24px;
  height: 24px;
  opacity: 0.8;
}

.info-label {
  font-size: 13px;
  color: var(--color-primary);
  font-weight: 500;
}

.home-info__quote {
  flex: 1;
  text-align: right;
  overflow: hidden;
  height: 21px; /* 一行文字的高度 */
  position: relative;
}

.quote-carousel {
  position: relative;
  height: 21px; /* 固定高度，确保只显示一行 */
  overflow: hidden;
  width: 100%;
}

.quote-carousel__container {
  position: relative;
  will-change: transform; /* 优化动画性能 */
  -webkit-transform: translateZ(0); /* 开启硬件加速 */
  transform: translateZ(0);
}

.quote-text {
  font-size: 14px;
  color: var(--color-text);
  margin: 0;
  line-height: 21px; /* 与高度一致 */
  height: 21px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

/* 微信浏览器特殊处理 */
.wechat-browser .quote-carousel {
  height: 21px;
  overflow: hidden;
}

.wechat-browser .quote-carousel__container {
  transition: transform 0.5s ease-in-out;
}

/* Home: Schedule Section */
.home-schedule {
  margin-top: 16px;
}

.schedule-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  position: relative;
}

.schedule-title__text {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
}

.schedule-title__underline {
  flex: 1;
  height: 2px;
  background: var(--color-primary);
  opacity: 0.3;
  border-radius: 1px;
}

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.schedule-item {
  background: var(--color-bg-elev);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.schedule-item:active {
  transform: scale(0.98);
}

.schedule-item__content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.schedule-item__title {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text);
}

.schedule-item__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.schedule-item__time {
  display: flex;
  align-items: center;
  gap: 4px;
}

.schedule-item__time::before {
  content: '🕐';
  font-size: 14px;
}

.schedule-item__location {
  display: flex;
  align-items: center;
  gap: 4px;
}

.schedule-item__location::before {
  content: '📍';
  font-size: 14px;
}

/* Poster card styles */
.poster-card {
  background: var(--color-bg-elev);
  border-radius: 16px;
  padding: 20px 18px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  text-align: center;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--color-border);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.poster-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, currentColor, transparent);
}

.poster-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.poster-card__icon {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
}

.poster-card__title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 10px 0;
  color: var(--color-text);
}

.poster-card__content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text-muted);
  margin: 0 0 12px 0;
}

.poster-card__tip {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(0,0,0,0.04);
  color: var(--color-text);
  display: inline-block;
}

/* Poster card color themes */
.poster-card--blue {
  background: linear-gradient(135deg, rgba(24,144,255,0.08) 0%, rgba(24,144,255,0.03) 100%);
  border-color: rgba(24,144,255,0.2);
}

.poster-card--blue::before {
  background: linear-gradient(90deg, #1890ff, rgba(24,144,255,0.3));
}

.poster-card--blue .poster-card__title {
  color: #1890ff;
}

.poster-card--green {
  background: linear-gradient(135deg, rgba(82,196,26,0.08) 0%, rgba(82,196,26,0.03) 100%);
  border-color: rgba(82,196,26,0.2);
}

.poster-card--green::before {
  background: linear-gradient(90deg, #52c41a, rgba(82,196,26,0.3));
}

.poster-card--green .poster-card__title {
  color: #52c41a;
}

.poster-card--orange {
  background: linear-gradient(135deg, rgba(250,173,20,0.08) 0%, rgba(250,173,20,0.03) 100%);
  border-color: rgba(250,173,20,0.2);
}

.poster-card--orange::before {
  background: linear-gradient(90deg, #faad14, rgba(250,173,20,0.3));
}

.poster-card--orange .poster-card__title {
  color: #faad14;
}

.poster-card--purple {
  background: linear-gradient(135deg, rgba(114,46,209,0.08) 0%, rgba(114,46,209,0.03) 100%);
  border-color: rgba(114,46,209,0.2);
}

.poster-card--purple::before {
  background: linear-gradient(90deg, #722ed1, rgba(114,46,209,0.3));
}

.poster-card--purple .poster-card__title {
  color: #722ed1;
}

.poster-card--teal {
  background: linear-gradient(135deg, rgba(19,194,194,0.08) 0%, rgba(19,194,194,0.03) 100%);
  border-color: rgba(19,194,194,0.2);
}

.poster-card--teal::before {
  background: linear-gradient(90deg, #13c2c2, rgba(19,194,194,0.3));
}

.poster-card--teal .poster-card__title {
  color: #13c2c2;
}

/* Carousel indicators */
.carousel-indicators {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 0 8px;
}

.carousel-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: var(--color-border);
  padding: 0;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.carousel-indicator.is-active {
  background: var(--color-primary);
  width: 24px;
  border-radius: 4px;
}

.carousel-indicator:hover {
  background: var(--color-primary);
  opacity: 0.7;
}

.carousel-indicator:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* 移除轮播控制按钮 - 使用滑动和自动播放 */

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .poster-card {
    background: var(--color-bg-elev);
  }

  .carousel-btn {
    background: rgba(20,23,32,0.9);
    border-color: var(--color-border);
  }
}

/* ============================================
   AI Chat Interface Styles - Modern Chat Window
   ============================================ */

/* Chat welcome screen */
.chat-welcome {
  animation: fade-in 0.3s ease-in-out;
}

/* Chat container */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--tabbar-height) - var(--safe-top) - var(--safe-bottom) - 100px);
  min-height: 400px;
  max-height: 700px;
  position: relative;
  margin-top: 8px;
  background: var(--color-bg);
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.05);
  /* 移动端优化：使用动态视口高度 */
  transition: height 0.3s ease, max-height 0.3s ease;
}

/* 移动端键盘弹出时的容器调整 */
@media (max-width: 768px) {
  .chat-container.keyboard-visible {
    height: calc(100vh - var(--tabbar-height) - var(--safe-top) - 200px) !important;
    max-height: calc(100vh - var(--tabbar-height) - var(--safe-top) - 200px) !important;
  }
}

/* Chat messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(to bottom,
    rgba(245, 247, 250, 0.5) 0%,
    rgba(245, 247, 250, 0.3) 50%,
    rgba(245, 247, 250, 0.1) 100%);
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* Chat message wrapper */
.chat-message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 85%;
  animation: message-slide-in 0.3s ease-out;
  word-wrap: break-word;
  word-break: break-word;
  margin-bottom: 4px;
}

@keyframes message-slide-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* User message (right aligned) */
.chat-message--user {
  align-self: flex-end;
  flex-direction: row-reverse;
  margin-left: auto;
}

.chat-message--user .chat-message__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.chat-message--user .chat-message__content {
  background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
  color: #ffffff;
  border-radius: 18px 18px 4px 18px;
  padding: 10px 14px;
  box-shadow: 0 2px 12px rgba(24, 144, 255, 0.25);
  position: relative;
  max-width: 100%;
}

.chat-message--user .chat-message__content::after {
  content: '';
  position: absolute;
  right: -6px;
  bottom: 12px;
  width: 0;
  height: 0;
  border: 6px solid transparent;
  border-left-color: #1890ff;
  border-right: none;
}

/* AI message (left aligned) */
.chat-message--ai {
  align-self: flex-start;
  flex-direction: row;
  margin-right: auto;
}

.chat-message--ai .chat-message__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(245, 87, 108, 0.3);
}

.chat-message--ai .chat-message__content {
  background: #ffffff;
  color: var(--color-text);
  border: none;
  border-radius: 18px 18px 18px 4px;
  padding: 10px 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.08);
  position: relative;
  max-width: 100%;
}

.chat-message--ai .chat-message__content::before {
  content: '';
  position: absolute;
  left: -6px;
  bottom: 12px;
  width: 0;
  height: 0;
  border: 6px solid transparent;
  border-right-color: #ffffff;
  border-left: none;
}

/* Message content */
.chat-message__content {
  line-height: 1.5;
  font-size: 15px;
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-word;
}

/* Message wrapper for content and time */
.chat-message__wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Message time */
.chat-message__time {
  font-size: 11px;
  color: var(--color-text-muted);
  padding: 0 8px;
  align-self: flex-end;
  opacity: 0.7;
}

.chat-message--user .chat-message__time {
  align-self: flex-end;
}

.chat-message--ai .chat-message__time {
  align-self: flex-start;
}

/* Loading indicator */
.chat-loading {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: #ffffff;
  border-radius: 18px 18px 18px 4px;
  max-width: 70px;
  align-self: flex-start;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-left: 44px;
}

.chat-loading__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-muted);
  animation: loading-bounce 1.4s infinite ease-in-out both;
}

.chat-loading__dot:nth-child(1) {
  animation-delay: -0.32s;
}

.chat-loading__dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes loading-bounce {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Error message */
.chat-message--error {
  align-self: flex-start;
  flex-direction: row;
}

.chat-message--error .chat-message__avatar {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
}

.chat-message--error .chat-message__content {
  background: #fff1f0;
  border: 1px solid #ffccc7;
  color: #ff4d4f;
}

.chat-message--error .chat-message__content::before {
  border-right-color: #fff1f0;
}

/* Chat input area */
.chat-input-area {
  padding: 12px 16px;
  padding-bottom: calc(12px + var(--safe-bottom));
  background: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  position: sticky;
  bottom: 0;
  z-index: 10;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.04);
  /* 移动端键盘弹出时，确保输入区域在键盘上方 */
  position: -webkit-sticky;
  position: sticky;
}

/* 移动端键盘弹出时的优化 */
@supports (height: 100dvh) {
  .chat-input-area {
    padding-bottom: calc(12px + env(keyboard-inset-height, var(--safe-bottom)));
  }
}

.chat-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f7fa;
  border: 1px solid transparent;
  border-radius: 24px;
  padding: 4px 4px 4px 8px;
  transition: all 0.2s ease;
  min-height: 44px;
}

.chat-input-wrapper:focus-within {
  background: #ffffff;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 15px;
  color: var(--color-text);
  padding: 10px 8px;
  min-height: 36px;
  max-height: 120px;
  resize: none;
  line-height: 1.5;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

.chat-input::placeholder {
  color: var(--color-text-muted);
}

.chat-input[readonly] {
  cursor: default;
  /* readonly 状态下仍然可以显示文本，只是不能编辑 */
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
  box-shadow: 0 2px 8px rgba(24, 144, 255, 0.3);
  margin-left: 0;
}

.chat-send-btn:hover:not(:disabled) {
  background: #40a9ff;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(24, 144, 255, 0.4);
}

.chat-send-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.chat-send-btn:disabled {
  background: #d9d9d9;
  color: #ffffff;
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
}

.chat-send-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* Voice input button */
.chat-voice-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-muted);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
  margin-right: 0;
}

.chat-voice-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-primary);
  transform: scale(1.05);
}

.chat-voice-btn:active {
  transform: scale(0.95);
}

.chat-voice-btn.is-recording {
  background: #ff4d4f;
  color: #ffffff;
  animation: voice-pulse 1.5s ease-in-out infinite;
}

.chat-voice-btn.is-recording svg {
  animation: voice-icon-pulse 0.6s ease-in-out infinite;
}

@keyframes voice-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 77, 79, 0.7);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(255, 77, 79, 0);
  }
}

@keyframes voice-icon-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.chat-voice-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* Triage header adjustments for chat page */
#page-ai-chat .triage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

#page-ai-chat .triage-header .page-title {
  flex: 1;
  margin: 0;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .chat-message {
    max-width: 85%;
  }

  .chat-container {
    height: calc(100vh - var(--tabbar-height) - var(--safe-top) - var(--safe-bottom) - 80px);
    min-height: 350px;
    max-height: none;
  }

  .chat-messages {
    padding: 12px;
  }

  .chat-input-area {
    padding: 10px 12px;
    padding-bottom: calc(10px + var(--safe-bottom));
  }

  .chat-input-wrapper {
    padding: 4px 4px 4px 6px;
    gap: 6px;
  }

  .chat-voice-btn,
  .chat-send-btn {
    width: 32px;
    height: 32px;
  }

  .chat-voice-btn svg {
    width: 18px;
    height: 18px;
  }

  .chat-send-btn svg {
    width: 16px;
    height: 16px;
  }

  .chat-input {
    padding: 8px 6px;
    font-size: 14px;
    min-height: 32px;
  }

  /* 移动端键盘弹出时的优化 */
  .chat-container.keyboard-visible {
    height: calc(100vh - var(--tabbar-height) - var(--safe-top) - 200px) !important;
    max-height: calc(100vh - var(--tabbar-height) - var(--safe-top) - 200px) !important;
  }

  /* 键盘弹出时，确保输入区域在键盘上方可见 */
  .chat-container.keyboard-visible .chat-input-area {
    position: sticky;
    bottom: 0;
    z-index: 100;
    background: #ffffff;
  }

  /* 使用 visual viewport 时，输入区域自动在键盘上方 */
  @supports (height: 100dvh) {
    .chat-container.keyboard-visible .chat-input-area {
      position: sticky;
      bottom: 0;
      z-index: 100;
    }
  }
}

/* Dark mode adjustments for chat */
@media (prefers-color-scheme: dark) {
  .chat-container {
    background: var(--color-bg);
  }

  .chat-messages {
    background: linear-gradient(to bottom,
      rgba(15, 17, 21, 0.5) 0%,
      rgba(15, 17, 21, 0.3) 50%,
      rgba(15, 17, 21, 0.1) 100%);
  }

  .chat-message--ai .chat-message__content {
    background: var(--color-bg-elev);
    color: var(--color-text);
  }

  .chat-message--ai .chat-message__content::before {
    border-right-color: var(--color-bg-elev);
  }

  .chat-input-area {
    background: var(--color-bg);
    border-top-color: var(--color-border);
  }

  .chat-input-wrapper {
    background: var(--color-bg-elev);
    border-color: var(--color-border);
  }

  .chat-input-wrapper:focus-within {
    background: var(--color-bg-elev);
  }

  .chat-loading {
    background: var(--color-bg-elev);
  }
}

[data-theme="dark"] .chat-container {
  background: var(--color-bg);
}

[data-theme="dark"] .chat-messages {
  background: linear-gradient(to bottom,
    rgba(15, 17, 21, 0.5) 0%,
    rgba(15, 17, 21, 0.3) 50%,
    rgba(15, 17, 21, 0.1) 100%);
}

[data-theme="dark"] .chat-message--ai .chat-message__content {
  background: var(--color-bg-elev);
  color: var(--color-text);
}

[data-theme="dark"] .chat-message--ai .chat-message__content::before {
  border-right-color: var(--color-bg-elev);
}

[data-theme="dark"] .chat-input-area {
  background: var(--color-bg);
  border-top-color: var(--color-border);
}

[data-theme="dark"] .chat-input-wrapper {
  background: var(--color-bg-elev);
  border-color: var(--color-border);
}

[data-theme="dark"] .chat-input-wrapper:focus-within {
  background: var(--color-bg-elev);
}

[data-theme="dark"] .chat-loading {
  background: var(--color-bg-elev);
}

