/* ==========================================================================
   MediaTube — 移动端单页样式
   风格：深色影院（胶片颗粒底 + 洋红/琥珀对撞 + 等宽元数据）
   目标：手机浏览器（375–430px）；桌面访问时居中成手机宽度，不拉伸
   ========================================================================== */

/* ---------- 1. 变量 ---------- */
:root {
  --ink:        #0b0b0d;
  --ink-2:      #101014;
  --panel:      #16161b;
  --panel-hi:   #1d1d24;
  --line:       #26262e;
  --line-soft:  #1e1e25;

  --text:       #f4f1ec;
  --text-2:     #a8a5b0;
  --text-3:     #6f6d7a;

  --magenta:    #ff2d6f;
  --magenta-dk: #d11753;
  --amber:      #ffb020;
  --cyan:       #35e0d0;

  --font-display: "Bricolage Grotesque", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --font-body:    "IBM Plex Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius:     10px;
  --radius-lg:  14px;
  --header-h:   52px;
  --shell-max:  430px;
  --pad:        14px;
  --ease:       cubic-bezier(.22, .8, .3, 1);
}

/* ---------- 2. 重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* hidden 必须赢过下面那些 display:grid/flex */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.is-locked { overflow: hidden; }

img, video { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
p { margin: 0; }

:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--magenta); color: #fff; }

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

/* ---------- 3. 手机外壳 ---------- */
.phone {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--ink);
  background-image:
    radial-gradient(120vw 60vw at 20% -10%, rgba(255, 45, 111, .15), transparent 62%),
    radial-gradient(95vw 50vw at 95% 2%, rgba(255, 176, 32, .09), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
  background-blend-mode: normal, normal, overlay;
}

/* ---------- 5. 顶栏 ---------- */
.header {
  position: sticky; top: 0; z-index: 40;
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) var(--pad) 0;
  display: flex; align-items: center;
  background: rgba(11, 11, 13, .86);
  backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand__mark {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  border-radius: 8px;
  background: linear-gradient(140deg, var(--magenta), var(--magenta-dk) 55%, #7a0f36);
  box-shadow: 0 6px 16px -6px rgba(255, 45, 111, .85);
}
.brand__mark svg { width: 16px; height: 16px; color: #fff; }
.brand__word { font-family: var(--font-display); font-size: 18px; font-weight: 800; letter-spacing: -.03em; }
.brand__word b { color: var(--magenta); font-weight: 800; }

/* 语言切换：与平台落地页同名（.langswitch），做成顶栏右侧的一枚小胶囊 */
.langswitch {
  margin-left: auto;
  flex: none;
  min-height: 32px;
  padding: 5px 13px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .04em;
  transition: border-color .18s var(--ease), color .18s var(--ease), background .18s var(--ease);
}
.langswitch:hover { color: var(--text); border-color: var(--line-strong, #35353f); }
.langswitch:active { transform: scale(.97); }

/* ---------- 6. 主内容 ---------- */
.layout { padding: 14px var(--pad) 26px; outline: none; }

/* 分类：横向滑动 chips，原地切换不跳页 */
.rail { margin-bottom: 16px; }
.rail__list {
  display: flex; gap: 8px;
  overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: none;
  mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 22px), transparent 100%);
}
.rail__list::-webkit-scrollbar { display: none; }
.rail__item {
  display: inline-flex; align-items: center; gap: 7px;
  flex: none;
  padding: 7px 13px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 13px; color: var(--text-2);
  white-space: nowrap;
}
.rail__count { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }

/* ---------- 7. 头图推荐位（横向滚动） ---------- */
.hero {
  position: relative;
  margin: 0 calc(-1 * var(--pad)) 22px;
}
.hero__track {
  display: flex; gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 0 var(--pad) 2px;
  scroll-padding-left: var(--pad);
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.hero__track::-webkit-scrollbar { display: none; }

.hero__slide {
  position: relative;
  flex: 0 0 86%;
  aspect-ratio: 3 / 2;
  scroll-snap-align: center;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(155deg, var(--panel-hi), var(--ink-2) 72%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
  text-align: left;
  transition: transform .2s var(--ease);
}
.hero__slide:active { transform: scale(.985); }
/* 锁定的头图占位（访客端）：不可点 */
.hero__slide.is-locked { cursor: default; opacity: .85; }
.hero__slide.is-locked:active { transform: none; }
.hero__slide.is-locked .hero__slot-ico {
  background: rgba(255, 255, 255, .04);
  border-color: var(--line);
  color: var(--text-3);
}
.hero__slide img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero__slide .thumb-ph { position: absolute; inset: 0; display: grid; place-items: center; }

.hero__shade {
  position: absolute; inset: 0;
  background: linear-gradient(0deg, rgba(8, 8, 10, .92) 0%, rgba(8, 8, 10, .35) 42%, rgba(8, 8, 10, 0) 72%);
}
.hero__body {
  position: absolute; left: 14px; right: 60px; bottom: 13px;
  display: flex; flex-direction: column; gap: 6px;
}
.hero__title {
  font-family: var(--font-display); font-weight: 700; font-size: 19px; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .8);
}
.hero__meta {
  display: flex; gap: 10px;
  font-family: var(--font-mono); font-size: 11px; color: rgba(244, 241, 236, .72);
}
.hero__play {
  position: absolute; right: 13px; bottom: 13px;
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--magenta); color: #fff;
  box-shadow: 0 10px 24px -10px rgba(255, 45, 111, .95);
}
.hero__play svg { width: 16px; height: 16px; margin-left: 2px; }

.hero__slide--slot {
  border-style: dashed; border-color: #34343f;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.014) 0 12px, transparent 12px 24px),
    var(--ink-2);
  text-align: center;
}
.hero__slot-ico {
  width: 48px; height: 48px; border-radius: 14px;
  display: grid; place-items: center;
  background: rgba(255, 45, 111, .12);
  border: 1px solid rgba(255, 45, 111, .34);
  color: var(--magenta);
}
.hero__slot-ico svg { width: 23px; height: 23px; }
.hero__slot-title { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.hero__slot-hint { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3); }

.hero__dots { display: flex; justify-content: center; gap: 6px; margin-top: 11px; }
.hero__dot {
  width: 6px; height: 6px; padding: 0;
  border-radius: 99px; background: #3a3a45;
  transition: width .22s var(--ease), background .22s var(--ease);
}
.hero__dot.is-on { width: 18px; background: var(--magenta); }

/* ---------- 8. 板块 ---------- */
.section { margin-bottom: 28px; scroll-margin-top: calc(var(--header-h) + 12px); }
.section__head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 14px;
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}
.section__label {
  display: block;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--magenta); margin-bottom: 5px;
}
.section__title { font-size: 20px; }
.section__count {
  flex: none; padding: 5px 11px; border-radius: 99px;
  border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 11px; color: var(--text-3);
}

/* ---------- 9. 卡片 ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }

.card { min-width: 0; animation: card-in .42s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); }
@keyframes card-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.card__link { display: block; width: 100%; padding: 0; text-align: left; }
.card__link:active { opacity: .82; }

.card__thumb {
  position: relative; display: block;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line-soft);
}
.card__thumb img { width: 100%; height: 100%; object-fit: cover; }

/* 占位视觉：编号 + 斜向条带，看上去是待填的槽位而不是破图 */
.thumb-ph {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background:
    repeating-linear-gradient(115deg, rgba(255,255,255,.028) 0 2px, transparent 2px 13px),
    linear-gradient(155deg, var(--panel-hi), var(--ink-2) 70%);
}
.thumb-ph::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(70% 90% at 78% 12%, var(--ph, rgba(255,45,111,.22)), transparent 70%);
}
.thumb-ph__code {
  position: relative;
  font-family: var(--font-mono); font-size: 13px; letter-spacing: .14em;
  color: rgba(255, 255, 255, .32);
  text-shadow: 0 2px 10px rgba(0, 0, 0, .6);
}

.card__dur {
  position: absolute; right: 6px; bottom: 6px;
  padding: 2px 6px; border-radius: 5px;
  background: rgba(0, 0, 0, .8);
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; color: #fff;
}
.card__badge {
  position: absolute; left: 6px; top: 6px;
  padding: 2px 7px; border-radius: 5px;
  background: var(--amber); color: #2a1a00;
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
}
/* 播放标：手机上没有 hover，直接用常驻小角标 */
.card__play {
  position: absolute; left: 6px; bottom: 6px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 45, 111, .92); color: #fff;
}
.card__play svg { width: 12px; height: 12px; margin-left: 1px; }

.card__meta { display: block; padding: 8px 2px 0; }
.card__title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 13.5px; font-weight: 600; line-height: 1.42;
}
/* 元信息单行：上传者超长就省略，不换行撕裂文字 */
.card__sub {
  display: flex; align-items: center; gap: 0 6px;
  margin-top: 5px;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-3);
  min-width: 0;
}
.card__sub em {
  font-style: normal; color: var(--text-2);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card__sub span { flex: none; white-space: nowrap; }

/* 上传位卡片 */
.card__slot {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 1.5px dashed #34343f;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.014) 0 12px, transparent 12px 24px),
    var(--ink-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  transition: border-color .2s var(--ease), transform .12s var(--ease);
}
.card__slot:active { transform: scale(.98); border-color: rgba(255, 45, 111, .55); }
/* 锁定的占位（访客端）：不可点，视觉上更安静 */
.card__slot.is-locked {
  cursor: default;
  border-style: dashed;
  border-color: var(--line);
  opacity: .78;
}
.card__slot.is-locked:active { transform: none; border-color: var(--line); }
.card__slot.is-locked .card__slot-ico {
  background: rgba(255, 255, 255, .04);
  border-color: var(--line);
  color: var(--text-3);
}
.card__slot-ico {
  width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center;
  background: rgba(255, 45, 111, .12);
  border: 1px solid rgba(255, 45, 111, .34);
  color: var(--magenta);
}
.card__slot-ico svg { width: 18px; height: 18px; }
.card__slot-title { font-size: 13px; font-weight: 600; color: var(--text-2); }
.card__slot-hint { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }

/* ---------- 10. 信息弹层（底部弹出） ---------- */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.sheet__backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, .68);
  backdrop-filter: blur(3px);
  animation: fade-in .2s var(--ease) both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.sheet__panel {
  position: relative;
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  max-height: 88vh;
  max-height: 88dvh;
  display: flex; flex-direction: column;
  background: var(--ink-2);
  border-radius: 18px 18px 0 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  overflow: hidden;
  animation: sheet-up .28s var(--ease) both;
}
@keyframes sheet-up { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }

.sheet__head {
  position: relative;
  flex: none;
  padding: 18px 16px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.sheet__head::before {  /* 拖拽提示条 */
  content: "";
  position: absolute; left: 50%; top: 7px; transform: translateX(-50%);
  width: 34px; height: 4px; border-radius: 99px;
  background: #34343f;
}
.sheet__heading {
  font-size: 15px; font-weight: 600; line-height: 1.4;
  padding-right: 44px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sheet__close {
  position: absolute; right: 12px; top: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .07); color: var(--text-2);
}
.sheet__close:active { background: rgba(255, 255, 255, .13); color: var(--text); }
.sheet__close svg { width: 16px; height: 16px; }

.sheet__scroll {
  overflow-y: auto;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
}

.sheet__player { position: relative; aspect-ratio: 16 / 9; background: #000; }
.sheet__player video, .sheet__player iframe { width: 100%; height: 100%; border: 0; background: #000; }
.sheet__empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 20px; text-align: center;
  background:
    repeating-linear-gradient(115deg, rgba(255,255,255,.02) 0 2px, transparent 2px 15px),
    radial-gradient(60% 70% at 50% 40%, #1a1a21, #0a0a0c 75%);
  color: var(--text-2);
}
.sheet__empty svg { width: 30px; height: 30px; color: var(--text-3); }
.sheet__empty b { font-family: var(--font-display); font-size: 16px; color: var(--text); }
.sheet__empty span { font-size: 12px; color: var(--text-3); max-width: 260px; }

.sheet__body { padding: 13px 16px 0; }
.sheet__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3);
}
.sheet__meta svg { width: 14px; height: 14px; }
.sheet__meta .dot { color: #45444f; }
.sheet__desc {
  margin-top: 12px; font-size: 13.5px; color: var(--text-2); line-height: 1.7; white-space: pre-line;
}
.tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.tag {
  padding: 4px 11px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--panel);
  font-size: 12px; color: var(--text-2);
}

/* ---------- 11. 空态 / 提示条 ---------- */
.empty {
  display: grid; place-items: center; gap: 10px;
  padding: 52px 20px; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--radius-lg);
  background: var(--ink-2);
}
.empty svg { width: 30px; height: 30px; color: var(--text-3); }
.empty h3 { font-size: 17px; }
.empty p { font-size: 13px; color: var(--text-3); max-width: 300px; }

.toast-wrap {
  position: fixed; z-index: 200;
  left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  width: min(94vw, 400px);
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(22, 22, 27, .97);
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 34px -16px rgba(0, 0, 0, .95);
  font-size: 13px;
  animation: toast-in .3s var(--ease) both;
}
.toast svg { width: 16px; height: 16px; flex: none; color: var(--cyan); }
.toast--warn svg { color: var(--amber); }
.toast.is-out { animation: toast-out .26s var(--ease) both; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(.97); } }

/* ---------- 12. 页脚 ---------- */
.footer {
  padding: 20px var(--pad) 26px;
  border-top: 1px solid var(--line-soft);
  background: var(--ink-2);
}
.footer__legal { font-size: 11.5px; color: var(--text-3); line-height: 1.7; }
.footer__bottom {
  display: flex; flex-direction: column; gap: 3px;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3);
}

/* ---------- 13. 桌面访问：居中成手机宽度 ---------- */
@media (min-width: 520px) {
  body {
    background: #08080a;
    background-image:
      radial-gradient(60vw 60vw at 50% 0%, rgba(255, 45, 111, .07), transparent 70%),
      radial-gradient(50vw 50vw at 50% 100%, rgba(53, 224, 208, .05), transparent 70%);
    padding: 24px 0;
  }
  .phone {
    height: calc(100dvh - 48px);
    min-height: 0;
    overflow-y: auto;
    border-radius: 22px;
    border: 1px solid var(--line);
    box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .95), 0 0 0 6px rgba(255, 255, 255, .02);
  }
  /* 外壳内的固定元素改成绝对定位，避免溢出手机框 */
  .sheet { position: absolute; }
  .toast-wrap { position: absolute; }
  .sheet__panel { max-height: 88%; }
}
@media (min-width: 900px) {
  .phone { box-shadow: 0 50px 110px -45px rgba(255, 45, 111, .3), 0 40px 90px -50px rgba(0, 0, 0, .95), 0 0 0 6px rgba(255, 255, 255, .02); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}
