/* ==================== 基础重置 ==================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

body {
  font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', system-ui, sans-serif;
  background: #f9fafb;
  color: #111827;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}

img, video {
  -webkit-touch-callout: none;
  user-select: none;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input { font: inherit; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ==================== 布局 ==================== */
.page-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.page-center-content {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.text-center { text-align: center; }

/* ==================== 加载动画 ==================== */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #22c55e;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

.spinner-white {
  border-color: rgba(255,255,255,0.3);
  border-top-color: #fff;
}

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

.loading-text {
  color: #9ca3af;
  font-size: 14px;
  text-align: center;
}

/* ==================== 主布局 ==================== */
.app-shell {
  min-height: 100vh;
  background: #f9fafb;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  border-bottom: 1px solid #f3f4f6;
  padding-top: env(safe-area-inset-top);
}

.header-inner {
  max-width: 512px;
  margin: 0 auto;
  padding: 0 16px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.header-name {
  font-size: 12px;
  color: #6b7280;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-logout {
  font-size: 12px;
  color: #9ca3af;
  white-space: nowrap;
  transition: color 0.2s;
}

.header-logout:hover { color: #ef4444; }

.app-main {
  max-width: 512px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ==================== 登录页 ==================== */
.login-card {
  width: 100%;
  max-width: 384px;
  margin: 0 16px;
  padding: 24px 32px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  text-align: center;
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 14px;
  color: #9ca3af;
  margin-bottom: 32px;
}

.login-body { padding: 32px 0; }

.login-icon-wrap {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #f0fdf4;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wechat-icon { width: 32px; height: 32px; color: #22c55e; }

.btn-wechat {
  width: 100%;
  padding: 12px 24px;
  background: #22c55e;
  color: #fff;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  transition: background 0.2s;
}

.btn-wechat:active { background: #16a34a; }

.btn-green {
  padding: 8px 24px;
  background: #22c55e;
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  transition: background 0.2s;
}

.btn-green:hover { background: #16a34a; }

.login-error {
  color: #ef4444;
  font-size: 12px;
  margin-top: 8px;
  min-height: 18px;
}

.login-loading-text { color: #6b7280; font-size: 14px; margin-top: 16px; }
.login-hint-title { font-size: 16px; font-weight: 500; color: #1f2937; margin-bottom: 8px; }
.login-hint-text { font-size: 14px; color: #9ca3af; line-height: 1.6; }

/* ==================== 回调页 ==================== */
.callback-text { color: #6b7280; font-size: 15px; }
.error-text { color: #ef4444; font-size: 18px; margin-bottom: 8px; }
.error-detail { color: #9ca3af; font-size: 14px; margin-bottom: 16px; }

/* ==================== 首页 ==================== */
.home-emoji { font-size: 48px; margin-bottom: 16px; }
.home-title { font-size: 20px; font-weight: 700; color: #1f2937; margin-bottom: 8px; }
.home-hint { font-size: 14px; color: #9ca3af; }

/* ==================== 分享落地页 ==================== */
.share-landing {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.redirecting { text-align: center; color: #fff; }
.redirecting p { font-size: 15px; opacity: 0.9; }

/* ==================== 视频播放页 ==================== */
.video-container {
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  margin: 0 -16px;
}

@media (min-width: 640px) {
  .video-container { margin: 0; border-radius: 12px; }
}

.video-wrapper { position: relative; }

.video-el {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
}

.live-video { pointer-events: none; }

.live-tag-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  border-radius: 9999px;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.live-hint-text { font-size: 12px; color: #9ca3af; }

.live-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  cursor: pointer;
  z-index: 10;
}

.live-play-btn {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.6);
  border-radius: 50%;
  color: #fff;
  transition: transform 0.2s, background 0.2s;
}

.live-play-btn:active {
  transform: scale(0.92);
  background: rgba(255,255,255,0.35);
}

.live-overlay-text { color: #fff; font-size: 14px; margin-top: 12px; }

.live-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(0,0,0,0.85);
}

.live-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  border-radius: 4px;
}

.live-btn:active { background: rgba(255,255,255,0.15); }

.live-spacer { flex: 1; }

.live-start-time { font-size: 14px; color: #3b82f6; margin-top: 8px; }

.info-card {
  margin-top: 16px;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  border: 1px solid #f3f4f6;
}

.video-title { font-size: 18px; font-weight: 700; color: #111827; }
.video-desc { font-size: 14px; color: #6b7280; margin-top: 8px; }

/* ==================== 评论 ==================== */
.section-title { font-size: 14px; font-weight: 500; color: #374151; margin-bottom: 12px; }

.comment-input-row { display: flex; gap: 8px; margin-bottom: 16px; }

.comment-input {
  flex: 1;
  padding: 8px 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  color: #111827;
  outline: none;
  transition: border-color 0.2s;
}

.comment-input::placeholder { color: #9ca3af; }
.comment-input:focus { border-color: #60a5fa; }

.btn-send {
  padding: 8px 16px;
  background: #3b82f6;
  color: #fff;
  font-size: 14px;
  border-radius: 8px;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-send:active { background: #2563eb; }

.comment-submitted {
  padding: 8px 12px;
  background: #fefce8;
  color: #a16207;
  font-size: 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.comments-empty { text-align: center; padding: 16px 0; color: #9ca3af; font-size: 14px; }
.comments-list { display: flex; flex-direction: column; gap: 12px; }

.comment-item { display: flex; gap: 8px; }

.comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #dbeafe;
  color: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}

.comment-body { flex: 1; min-width: 0; }
.comment-meta { display: flex; align-items: baseline; gap: 8px; }
.comment-name { font-size: 14px; font-weight: 500; color: #1f2937; }
.comment-time { font-size: 12px; color: #9ca3af; }
.comment-content { font-size: 14px; color: #4b5563; margin-top: 2px; word-break: break-all; }
