/* ==========================================================================
   闪播 FlashCast — M3U8 在线播放器
   设计令牌 + 组件样式
   策略：深色为主（视频播放场景更沉浸），浅色可通过 prefers-color-scheme 适配
   ========================================================================== */

:root {
  /* 品牌色 */
  --brand-500: #4f8bf5;
  --brand-600: #6366f1;
  --brand-400: #818cf8;
  --cyan-500: #06b6d4;

  /* 表面色 */
  --bg: #0b1020;
  --bg-elevated: #121a2e;
  --bg-soft: #1a2338;
  --surface-border: rgba(255, 255, 255, 0.08);

  /* 文本色 */
  --text: #e8edf7;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  /* 功能色 */
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;

  /* 排版 */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", "Helvetica Neue", Arial,
    sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  /* 圆角与阴影 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.45);

  /* 布局 */
  --container: 1080px;
  --header-h: 68px;

  --gradient-brand: linear-gradient(135deg, var(--brand-600) 0%, var(--brand-500) 55%, var(--cyan-500) 100%);
}

/* 浅色主题适配 */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f8fc;
    --bg-elevated: #ffffff;
    --bg-soft: #eef2f9;
    --surface-border: rgba(15, 23, 42, 0.09);
    --text: #0f172a;
    --text-muted: #4b5563;
    --text-subtle: #64748b;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.1);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);
  }
}

/* --------------------------------------------------------------------------
   基础重置
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 背景柔光 */
  background-image:
    radial-gradient(900px 480px at 12% -8%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(760px 420px at 92% 4%, rgba(6, 182, 212, 0.14), transparent 62%);
  background-attachment: fixed;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--brand-400);
  text-decoration: none;
  transition: color 0.18s ease;
}

a:hover {
  color: var(--cyan-500);
}

h1,
h2,
h3,
h4 {
  margin: 0 0 0.5em;
  line-height: 1.28;
  font-weight: 700;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 1em;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: rgba(99, 102, 241, 0.14);
  color: var(--brand-400);
  padding: 0.15em 0.45em;
  border-radius: 6px;
}

/* 键盘可达性：焦点环清晰可见 */
:focus-visible {
  outline: 2px solid var(--brand-400);
  outline-offset: 3px;
  border-radius: 4px;
}

/* 跳转到主内容（屏幕阅读器 / 键盘用户） */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  background: var(--brand-600);
  color: #fff;
  padding: 12px 20px;
  border-radius: 0 0 var(--radius-md) 0;
  font-weight: 600;
}

.skip-link:focus {
  left: 0;
  color: #fff;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   布局容器
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

/* --------------------------------------------------------------------------
   顶部导航
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(11, 16, 32, 0.82);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--surface-border);
}

@media (prefers-color-scheme: light) {
  .site-header {
    background: rgba(255, 255, 255, 0.86);
  }
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.brand:hover {
  color: var(--text);
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

.brand-text small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-subtle);
  letter-spacing: 0.04em;
  line-height: 1.2;
  margin-top: 1px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-left: auto;
  list-style: none;
  padding: 0;
  margin-block: 0;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
  padding: 6px 2px;
  position: relative;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text);
}

.nav-links a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: var(--gradient-brand);
}

/* --------------------------------------------------------------------------
   Hero 区域
   -------------------------------------------------------------------------- */

.hero {
  padding: 64px 0 36px;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 15px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(99, 102, 241, 0.28);
  color: var(--brand-400);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 22px;
}

.eyebrow .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.22);
}

.hero h1 {
  font-size: clamp(30px, 5.4vw, 52px);
  font-weight: 800;
  margin-bottom: 18px;
}

.hero h1 .grad {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.hero .lead {
  font-size: clamp(15px, 2.2vw, 18px);
  color: var(--text-muted);
  max-width: 660px;
  margin: 0 auto 30px;
}

/* --------------------------------------------------------------------------
   播放器卡片
   -------------------------------------------------------------------------- */

.player-card {
  background: var(--bg-elevated);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.player-form {
  display: flex;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--surface-border);
}

.field-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.field-wrap .field-icon {
  position: absolute;
  left: 16px;
  width: 18px;
  height: 18px;
  color: var(--text-subtle);
  pointer-events: none;
}

.player-form input[type="url"],
.player-form input[type="text"] {
  width: 100%;
  height: 52px;
  padding: 0 16px 0 46px;
  font-family: var(--font-mono);
  font-size: 14.5px;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  -webkit-appearance: none;
  appearance: none;
}

.player-form input::placeholder {
  color: var(--text-subtle);
  font-family: var(--font-sans);
}

.player-form input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}

.btn-play {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 52px;
  padding: 0 26px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--gradient-brand);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
  box-shadow: 0 6px 18px rgba(79, 139, 245, 0.32);
}

.btn-play:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(79, 139, 245, 0.42);
  filter: brightness(1.06);
}

.btn-play:active {
  transform: translateY(0);
}

.btn-play:disabled {
  opacity: 0.62;
  cursor: not-allowed;
  transform: none;
}

.btn-play svg {
  width: 17px;
  height: 17px;
}

/* 视频舞台 */
.player-stage {
  position: relative;
  background: #000;
  aspect-ratio: 16 / 9;
  width: 100%;
}

.player-stage video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

/* 状态提示条 */
.player-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  font-size: 14px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border-top: 1px solid var(--surface-border);
  min-height: 46px;
}

.player-status[data-state="error"] {
  color: var(--danger);
}

.player-status[data-state="success"] {
  color: var(--success);
}

.player-status .status-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* 加载指示 */
.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(148, 163, 184, 0.3);
  border-top-color: var(--brand-400);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

/* --------------------------------------------------------------------------
   功能特性网格
   -------------------------------------------------------------------------- */

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(232px, 1fr));
  gap: 18px;
  margin-top: 34px;
  /* 使用 ul 承载语义，但视觉上不显示项目符号 */
  list-style: none;
  padding: 0;
}

.feature {
  padding: 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.feature:hover {
  transform: translateY(-3px);
  border-color: rgba(99, 102, 241, 0.4);
}

.feature-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(99, 102, 241, 0.16);
  color: var(--brand-400);
  margin-bottom: 14px;
}

.feature-icon svg {
  width: 20px;
  height: 20px;
}

.feature h3 {
  font-size: 16px;
  margin-bottom: 6px;
}

.feature p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

/* --------------------------------------------------------------------------
   内容区块
   -------------------------------------------------------------------------- */

.section {
  padding: 56px 0;
}

.section-head {
  text-align: center;
  margin-bottom: 34px;
}

.section-head h2 {
  font-size: clamp(23px, 3.4vw, 32px);
  margin-bottom: 10px;
}

.section-head p {
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto;
}

.content-card {
  background: var(--bg-elevated);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.content-card h2 {
  font-size: 22px;
  margin-bottom: 14px;
}

.content-card h3 {
  font-size: 17px;
  margin-top: 26px;
  margin-bottom: 10px;
}

.content-card p,
.content-card li {
  color: var(--text-muted);
  font-size: 15px;
}

.content-card ul {
  padding-left: 22px;
  margin: 0 0 1em;
}

.content-card li {
  margin-bottom: 7px;
}

/* FAQ 折叠面板 */
.faq-list {
  display: grid;
  gap: 12px;
}

.faq-item {
  background: var(--bg-elevated);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.18s ease;
}

.faq-item[open] {
  border-color: rgba(99, 102, 241, 0.42);
}

.faq-item summary {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15.5px;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "";
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--brand-400);
  border-bottom: 2px solid var(--brand-400);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
  transform: rotate(-135deg);
}

.faq-item summary:hover {
  color: var(--brand-400);
}

.faq-answer {
  padding: 0 20px 18px;
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
}

/* 嵌入代码块 */
.embed-box {
  margin-top: 18px;
  position: relative;
}

.embed-box pre {
  margin: 0;
  padding: 18px 20px;
  background: #060a16;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  color: #a5b4fc;
}

@media (prefers-color-scheme: light) {
  .embed-box pre {
    background: #0f172a;
  }
}

.embed-box code {
  background: none;
  padding: 0;
  color: inherit;
  white-space: pre;
}

.btn-copy {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--surface-border);
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.btn-copy:hover {
  color: #fff;
  background: var(--brand-600);
  border-color: var(--brand-600);
}

.btn-copy svg {
  width: 13px;
  height: 13px;
}

/* 分享按钮 */
.social-share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

.social-share-label {
  font-size: 14px;
  color: var(--text-subtle);
  margin-right: 2px;
}

/* social-share.js 生成的图标按钮 */
.social-share .social-share-icon {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--bg-soft);
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  font-size: 17px;
  transition: all 0.18s ease;
}

.social-share .social-share-icon:hover {
  color: #fff;
  background: var(--brand-600);
  border-color: var(--brand-600);
  transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   分享弹层（social-share.js 使用）
   -------------------------------------------------------------------------- */

.social-share-pop {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--surface-border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-md) !important;
}

.social-share-pop .social-share-wechat-qrcode-title {
  color: var(--text) !important;
}

/* --------------------------------------------------------------------------
   页脚
   -------------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--surface-border);
  padding: 40px 0 32px;
  margin-top: 20px;
  background: rgba(0, 0, 0, 0.16);
}

@media (prefers-color-scheme: light) {
  .site-footer {
    background: rgba(15, 23, 42, 0.02);
  }
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 26px;
}

.footer-brand p {
  color: var(--text-subtle);
  font-size: 14px;
  max-width: 380px;
  margin: 12px 0 0;
}

.footer-links h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-subtle);
  margin-bottom: 12px;
}

.footer-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 8px;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 14px;
}

.footer-links a:hover {
  color: var(--brand-400);
}

.footer-bottom {
  padding-top: 22px;
  border-top: 1px solid var(--surface-border);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-subtle);
}

/* --------------------------------------------------------------------------
   嵌入页（player.html）
   -------------------------------------------------------------------------- */

.embed-page {
  background-image: none;
}

.embed-main {
  padding: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.embed-main .player-card {
  border-radius: 0;
  border-left: none;
  border-right: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.embed-main .player-stage {
  flex: 1;
  min-height: 260px;
  aspect-ratio: auto;
}

/* 嵌入页说明内容区：默认可见（利于搜索引擎抓取），被 iframe 嵌入时隐藏 */
.embed-seo-content {
  padding: 40px 0 48px;
  background: var(--bg);
}

.embed-seo-content h1 {
  font-size: clamp(24px, 3.6vw, 34px);
  margin-bottom: 14px;
}

.embed-seo-content h2 {
  font-size: 20px;
  margin: 28px 0 10px;
}

.embed-seo-content h3 {
  font-size: 16px;
  margin: 22px 0 8px;
}

.embed-seo-content p,
.embed-seo-content li {
  color: var(--text-muted);
  font-size: 15px;
}

.embed-seo-content ul {
  padding-left: 22px;
  margin: 0 0 1em;
}

.embed-seo-content li {
  margin-bottom: 7px;
}

.embed-seo-content .embed-box {
  margin-top: 14px;
}

.embed-seo-links {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--surface-border);
  font-size: 14px;
}

/* 被 iframe 嵌入时隐藏说明内容 */
.is-embedded .embed-seo-content {
  display: none;
}

/* --------------------------------------------------------------------------
   响应式
   -------------------------------------------------------------------------- */

@media (max-width: 720px) {
  .hero {
    padding: 40px 0 26px;
  }

  .player-form {
    flex-direction: column;
    padding: 14px;
  }

  .btn-play {
    width: 100%;
  }

  .content-card {
    padding: 20px;
  }

  .section {
    padding: 40px 0;
  }

  .nav-links {
    gap: 16px;
  }

  .nav-links a {
    font-size: 14px;
  }

  .brand-text small {
    display: none;
  }
}

@media (max-width: 480px) {
  .site-header .container {
    gap: 14px;
  }

  .nav-links {
    gap: 13px;
  }

  .brand {
    font-size: 16px;
  }
}

/* 尊重用户的减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 打印时隐藏无关元素 */
@media print {
  .site-header,
  .player-form,
  .features,
  .site-footer {
    display: none;
  }
}
