/* HTLB PWA - Custom Styles */

/* Safe area insets */
.safe-top {
  height: env(safe-area-inset-top, 0px);
}
.safe-bottom {
  height: env(safe-area-inset-bottom, 0px);
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

/* Body base */
body {
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Hide scrollbar but keep functionality */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Evidence badges */
.evidence-a {
  background-color: #dcfce7;
  color: #166534;
}
.dark .evidence-a {
  background-color: #14532d;
  color: #bbf7d0;
}
.evidence-b {
  background-color: #fef3c7;
  color: #92400e;
}
.dark .evidence-b {
  background-color: #78350f;
  color: #fde68a;
}
.evidence-c {
  background-color: #fee2e2;
  color: #991b1b;
}
.dark .evidence-c {
  background-color: #7f1d1d;
  color: #fecaca;
}

/* Collapsible transitions */
.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}
.collapsible-content.open {
  max-height: 5000px;
  transition: max-height 0.5s ease-in;
}

/* Card press effect */
.press-effect {
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.press-effect:active {
  transform: scale(0.98);
}

/* Page transition */
.page-fade-enter {
  animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Search highlight */
mark.hl {
  background-color: #fef08a;
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}
.dark mark.hl {
  background-color: #854d0e;
  color: #fef9c3;
}

/* Line clamp utilities */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Shimmer animation for loading */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.dark .skeleton {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
}

/* Tab active indicator */
.tab-btn.active {
  color: rgb(59 130 246) !important;
}
@media (prefers-color-scheme: dark) {
  .tab-btn.active {
    color: rgb(96 165 250) !important;
  }
}

/* Hide header on scroll down */
#topbar.hidden-header {
  transform: translateY(-100%);
}

/* Link styling in content */
.content-link {
  color: #2d5795;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.dark .content-link {
  color: #93c5fd;
}

/* Prose-like text */
.prose-text p {
  margin-bottom: 1em;
  line-height: 1.7;
}
.prose-text p:last-child {
  margin-bottom: 0;
}

/* 正文字号三档（作用于详情页阅读内容：说人话 + 折叠正文） */
:root {
  --reading-font: 17px;
}
html.fs-s {
  --reading-font: 15px;
}
html.fs-m {
  --reading-font: 17px;
}
html.fs-l {
  --reading-font: 19px;
}
.reading-text {
  font-size: var(--reading-font);
  line-height: 1.75;
}
.reading-text-sm {
  font-size: calc(var(--reading-font) - 2px);
  line-height: 1.7;
}

/* 字体大小菜单项 */
.font-size-opt .fs-check {
  font-weight: 700;
}

/* 小游戏「人生预算」交互反馈 */
.game-card {
  -webkit-tap-highlight-color: transparent;
}
.game-card:active:not([disabled]) {
  transform: scale(0.975);
}
.game-card-picked {
  border-color: #3d70b2 !important;
  box-shadow: 0 0 0 3px rgba(61, 112, 178, 0.18);
  transform: scale(0.985);
}
@keyframes gameScorePop {
  0% { transform: scale(0.8); opacity: 0.4; }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
.game-score-pop {
  animation: gameScorePop 0.32s ease-out;
}
