/* ══════════════════════════════════════════════════════════
   云龙软件入口 · 样式
   纯静态、零外部依赖（不引 CDN / 字体，图标全部内联 SVG）
   ══════════════════════════════════════════════════════════ */

:root {
  --bg:      #05070d;
  --bg-2:    #080d18;
  --line:    rgba(255, 255, 255, .10);
  --line-2:  rgba(255, 255, 255, .18);
  --text:    #eaf1ff;
  --muted:   #8ea3c4;
  --dim:     #5f7396;

  --brand:   #38bdf8;
  --brand-2: #6366f1;
  --brand-3: #22d3ee;
  --grad:    linear-gradient(120deg, #22d3ee 0%, #38bdf8 40%, #6366f1 100%);

  --r:    16px;
  --r-lg: 22px;
}

* { box-sizing: border-box; }

/* 关键：作者样式里的 display 会覆盖 UA 的 [hidden]{display:none}，
   而播放器各层都是 display:block/flex，必须显式兜底，否则三个层会叠在一起 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

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

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em; color: #a5d8ff;
  background: rgba(56, 189, 248, .12);
  border: 1px solid rgba(56, 189, 248, .24);
  padding: .1em .4em; border-radius: 5px;
}

/* ───────── 背景 ───────── */
.bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

.bg-aurora {
  position: absolute; inset: -30% -20%;
  background:
    radial-gradient(38% 46% at 26% 28%, rgba(34, 211, 238, .20), transparent 68%),
    radial-gradient(42% 50% at 74% 62%, rgba(99, 102, 241, .22), transparent 70%),
    radial-gradient(30% 34% at 54% 88%, rgba(56, 189, 248, .14), transparent 72%);
  filter: blur(28px);
  animation: drift 26s ease-in-out infinite alternate;
}
@keyframes drift {
  0%   { transform: translate3d(-2%, -1%, 0) scale(1); }
  100% { transform: translate3d(2%, 2%, 0) scale(1.08); }
}

.bg-grid {
  position: absolute; inset: 0; opacity: .5;
  background-image:
    linear-gradient(rgba(255,255,255,.030) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.030) 1px, transparent 1px);
  background-size: 58px 58px;
  -webkit-mask-image: radial-gradient(ellipse 74% 66% at 50% 44%, #000 22%, transparent 76%);
          mask-image: radial-gradient(ellipse 74% 66% at 50% 44%, #000 22%, transparent 76%);
}

.bg-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 92% 82% at 50% 46%, transparent 42%, rgba(0,0,0,.72) 100%);
}

/* ───────── 视图切换 ───────── */
.view {
  position: fixed; inset: 0; z-index: 1;
  display: flex; flex-direction: column;
  opacity: 0; visibility: hidden;
  transition: opacity .5s ease, transform .5s cubic-bezier(.22,.71,.24,1), visibility .5s;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.view-entry  { align-items: center; justify-content: center; }
.view-entry:not(.is-active)  { transform: scale(.97); }
.view-player:not(.is-active) { transform: translateY(14px); }
.view.is-active { opacity: 1; visibility: visible; transform: none; }

/* ═══════════ 入口页 ═══════════ */
.entry-box {
  position: relative;
  padding: 40px 28px max(40px, env(safe-area-inset-bottom));
  text-align: center;
  animation: rise .9s cubic-bezier(.22,.71,.24,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }

.entry-mark {
  width: 66px; height: 66px; margin: 0 auto 30px;
  border-radius: 20px;
  display: grid; place-items: center;
  color: #06121f;
  background: var(--grad);
  box-shadow: 0 18px 50px -14px rgba(56, 189, 248, .85), 0 0 0 1px rgba(255,255,255,.14) inset;
  animation: float 5.5s ease-in-out infinite;
}
.entry-mark svg { width: 34px; height: 34px; }
.entry-mark span {
  font-size: 32px; font-weight: 800; line-height: 1;
  letter-spacing: 0;
  /* 渐变字，与标题呼应 */
  background: linear-gradient(180deg, #ffffff 10%, #9fd4ff 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-7px) } }

.entry-title {
  margin: 0;
  font-size: clamp(60px, 15vw, 128px);
  font-weight: 800;
  letter-spacing: .12em;
  text-indent: .12em;               /* 抵消末字右侧字距，保持视觉居中 */
  line-height: 1.05;
  background: linear-gradient(180deg, #ffffff 8%, #a9d8ff 52%, #6ea8ff 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 0 32px rgba(56, 189, 248, .42));
  animation: glow 5s ease-in-out infinite;
}
@keyframes glow {
  0%,100% { filter: drop-shadow(0 0 26px rgba(56, 189, 248, .34)); }
  50%     { filter: drop-shadow(0 0 46px rgba(99, 102, 241, .58)); }
}

.entry-slogan {
  margin: 22px auto 0;
  max-width: 460px;
  color: var(--muted);
  font-size: clamp(14px, 1.6vw, 16px);
  letter-spacing: .02em;
}
.entry-slogan:empty { display: none; }

.enter-btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 12px;
  margin-top: 46px;
  padding: 17px 46px;
  border-radius: 999px;
  font-size: 18px; font-weight: 700; letter-spacing: .16em; text-indent: .16em;
  color: #04101d;
  background: var(--grad);
  box-shadow: 0 16px 44px -12px rgba(56, 189, 248, .9), 0 0 0 1px rgba(255,255,255,.16) inset;
  overflow: hidden;
  transition: transform .22s cubic-bezier(.22,.71,.24,1), box-shadow .3s;
}
.enter-btn svg { width: 21px; height: 21px; transition: transform .22s; }
.enter-btn::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.6), transparent);
  transform: skewX(-18deg);
  animation: shine 3.4s ease-in-out infinite;
}
@keyframes shine { 0%,58% { left: -60% } 88%,100% { left: 130% } }
.enter-btn:hover { transform: translateY(-3px); box-shadow: 0 24px 58px -12px rgba(56, 189, 248, 1); }
.enter-btn:hover svg { transform: translateX(4px); }
.enter-btn:active { transform: translateY(-1px) scale(.985); }

.entry-foot {
  margin: 34px 0 0;
  color: var(--dim);
  font-size: 13px;
  letter-spacing: .05em;
}
.entry-foot:empty { display: none; }

/* ═══════════ 播放页 ═══════════ */
.view-player { padding: 0 0 max(28px, env(safe-area-inset-bottom)); }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 14px;
  padding: max(14px, env(safe-area-inset-top)) 20px 14px;
  background: linear-gradient(180deg, rgba(5,7,13,.92), rgba(5,7,13,.55) 70%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.back-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px;                    /* 触摸目标下限（Android/iOS 人机指南） */
  padding: 9px 16px 9px 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255,255,255,.05);
  color: var(--muted); font-size: 14px;
  transition: color .18s, border-color .18s, background .18s;
}
.back-btn svg { width: 16px; height: 16px; }
.back-btn:hover { color: var(--text); border-color: var(--line-2); background: rgba(255,255,255,.09); }
.topbar-name { font-size: 15px; font-weight: 650; letter-spacing: .14em; color: var(--muted); }

.player-body {
  width: 100%; max-width: 940px;
  margin: 0 auto;
  padding: 22px 20px 0;
}

.notice {
  margin: 0 0 16px;
  padding: 12px 16px;
  border: 1px solid rgba(56, 189, 248, .3);
  border-radius: 12px;
  background: rgba(56, 189, 248, .09);
  color: #bae6fd; font-size: 14px; line-height: 1.6;
}
.notice:empty { display: none; }

/* 观看提示：桌面隐藏，移动端竖屏显示（16:9 视频在竖屏只有 200px 高，
   引导用户点全屏能明显改善观看体验） */
.watch-hint {
  display: none;
  margin: 11px 0 0;
  text-align: center;
  color: var(--dim);
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: .02em;
}
.watch-hint svg {
  width: 13px; height: 13px;
  vertical-align: -2px; margin-right: 5px;
  opacity: .8;
}

/* ── 播放器 ── */
.stage { border-radius: var(--r-lg); }
.video-frame {
  position: relative;
  /* 宽高比默认 16:9；原片画面里烧了黑边时由 JS 覆盖成真实内容比例 */
  aspect-ratio: var(--video-ar, 16 / 9);
  /* 宽度同时受容器与「最大高度 × 比例」约束，
     这样竖屏视频在电脑上不会被拉成两千多像素高 */
  width: min(100%, calc(var(--video-maxh, 82vh) * var(--video-arn, 1.7778)));
  max-height: var(--video-maxh, 82vh);
  margin-inline: auto;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .95), 0 0 0 1px rgba(255,255,255,.03) inset;
}
.video-el { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border: 0; }
video.video-el { object-fit: contain; background: #000; }
/* 裁黑边：容器比例已设成真实内容比例，cover 正好把两侧黑边切掉；
   原生播放控件按容器尺寸渲染，不受影响 */
.video-frame.is-cropped video.video-el { object-fit: cover; }

.video-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  color: var(--dim); text-align: center; padding: 24px;
  background:
    radial-gradient(60% 60% at 50% 40%, rgba(56,189,248,.07), transparent 70%),
    #060a12;
}
.video-empty svg { width: 56px; height: 56px; opacity: .4; }
.video-empty b { color: var(--muted); font-size: 16px; font-weight: 600; }
.video-empty span { font-size: 13px; max-width: 420px; line-height: 1.7; }

.empty-action {
  margin-top: 4px;
  padding: 9px 22px;
  border: 1px solid rgba(56, 189, 248, .42);
  border-radius: 999px;
  background: rgba(56, 189, 248, .12);
  color: #bae6fd; font-size: 13.5px; font-weight: 600;
  transition: background .2s, border-color .2s, transform .2s;
}
.empty-action:hover {
  background: rgba(56, 189, 248, .2);
  border-color: rgba(56, 189, 248, .7);
  transform: translateY(-1px);
}

/* ── 下载 ── */
.dl { margin-top: 30px; text-align: center; }

.dl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 11px;
  min-width: 260px;
  padding: 17px 40px;
  border-radius: 15px;
  font-size: 17px; font-weight: 700; letter-spacing: .04em;
  color: #04101d;
  background: var(--grad);
  box-shadow: 0 16px 44px -14px rgba(56, 189, 248, .9), 0 0 0 1px rgba(255,255,255,.16) inset;
  transition: transform .22s cubic-bezier(.22,.71,.24,1), box-shadow .3s, filter .3s;
}
.dl-btn svg { width: 22px; height: 22px; }
.dl-btn:hover { transform: translateY(-3px); box-shadow: 0 24px 56px -14px rgba(56, 189, 248, 1); }
.dl-btn:active { transform: translateY(-1px) scale(.99); }

.dl-btn.is-disabled {
  background: rgba(255,255,255,.06);
  color: var(--dim);
  box-shadow: none;
  border: 1px dashed var(--line-2);
  cursor: not-allowed;
  pointer-events: none;
}
.dl-meta { margin: 14px 0 0; color: var(--dim); font-size: 13.5px; letter-spacing: .03em; }
.dl-meta:empty { display: none; }
.dl-note { margin: 10px auto 0; max-width: 520px; color: var(--dim); font-size: 13px; line-height: 1.65; }
.dl-note:empty { display: none; }

/* ───────── 响应式 ───────── */
/* ══════════════════════════════════════════════════════════
   移动端适配 —— 主要观看场景
   ══════════════════════════════════════════════════════════ */

/* 去掉点击时的蓝色高亮，避免"点了没反应"的错觉 */
html, body { -webkit-tap-highlight-color: transparent; }

@media (max-width: 640px) {
  /* 播放器尽量占满宽度（14px → 10px） */
  .player-body { padding: 10px 10px 0; }
  .video-frame {
    border-radius: 14px;
    /* 竖屏录屏尽量大，同时让下方提示完整可见、下载按钮露出顶边，
       用户一眼就知道可以往下滑 —— 画面与引导兼顾 */
    --video-maxh: calc(100vh - 164px);
  }

  /* 下载按钮占满整行，触摸目标够大 */
  .dl { margin-top: 20px; }
  .dl-btn { width: 100%; min-width: 0; padding: 18px 22px; font-size: 17px; }
  .dl-meta { margin-top: 12px; font-size: 13.5px; }
  .dl-note { font-size: 13px; }

  /* 入口页：按钮更好按 */
  .enter-btn { padding: 17px 40px; font-size: 17.5px; }
  .entry-mark { width: 58px; height: 58px; margin-bottom: 24px; }
  .entry-slogan { font-size: 15px; }
  .entry-foot { font-size: 13px; }

  /* 顶栏触摸目标 ≥44px（原来只有 40px） */
  .back-btn { min-height: 44px; padding: 0 18px 0 14px; }

  /* 观看提示 */
  .watch-hint { display: block; }
}

/* 高瘦屏（竖屏手机）：内容垂直居中，避免下半屏一大片空白 */
@media (max-width: 640px) and (min-height: 680px) {
  .player-body { margin-top: auto; margin-bottom: auto; }
}

/* ── 横屏 / 矮视口：原先把播放器顶到 457px，下载按钮被挤出屏幕 ──
   这里按视口高度压缩播放器，保证「下载」永远在首屏可见 ── */
@media (orientation: landscape) and (max-height: 560px) {
  .topbar {
    padding-top: 8px; padding-bottom: 8px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .back-btn { min-height: 38px; padding: 0 14px 0 11px; font-size: 13.5px; }
  .topbar-name { font-size: 14px; }

  .player-body {
    padding: 4px 0 0;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    max-width: none;
  }

  .video-frame {
    /* 矮屏以高度为约束、由比例反推宽度：
       16:9 横屏视频铺满宽度；竖屏录屏则自动收窄，绝不撑爆屏幕 */
    aspect-ratio: var(--video-ar, 16 / 9);
    width: auto;
    max-width: 100%;
    height: calc(100vh - 168px);
    min-height: 120px;
    max-height: none;
  }

  .dl { margin-top: 12px; }
  .dl-btn { width: auto; min-width: 220px; padding: 12px 32px; font-size: 15.5px; border-radius: 12px; }
  .dl-meta { margin-top: 7px; font-size: 12.5px; }
  .dl-note { display: none; }            /* 横屏空间紧张，次要信息先让位 */
  .watch-hint { display: none; }
  .notice { margin-bottom: 8px; padding: 8px 12px; font-size: 13px; }
}

/* 刘海屏 / 圆角屏安全区（横屏时左右也要留） */
@supports (padding: max(0px)) {
  .topbar {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
  .player-body {
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }
  .entry-box {
    padding-left: max(28px, env(safe-area-inset-left));
    padding-right: max(28px, env(safe-area-inset-right));
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg-aurora, .entry-mark, .entry-title, .enter-btn::after { animation: none !important; }
  .view, .entry-box { animation: none !important; transition: none !important; }
}
