/* =========================================================
   AnyShort Clone — base.css
   设计系统 / 移动优先外壳 / 通用组件
   RTL 优先：全部使用逻辑属性（inline-start / inline-end），
   切到 LTR(中文/英文)时镜像自动正确。
   ========================================================= */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: #05040a;
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }
:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

/* ---------- tokens ---------- */
:root {
  --bg: #0B0A10;
  --bg-2: #100E18;
  --surface: #16131F;
  --surface-2: #1D1929;
  --line: rgba(255, 255, 255, .085);
  --line-strong: rgba(255, 255, 255, .16);

  --pink: #FF2E74;
  --purple: #8B3DFF;
  --gold: #FFC65C;
  --green: #3DDC97;
  --cyan: #38E1FF;

  --text: #F6F3FA;
  --text-dim: #A29CB5;
  --text-mute: #6E6880;

  --grad-brand: linear-gradient(135deg, #FF2E74 0%, #8B3DFF 100%);
  --grad-gold: linear-gradient(135deg, #FFD98A 0%, #FFA63D 100%);
  --grad-card: linear-gradient(180deg, rgba(22,19,31,0) 40%, rgba(11,10,16,.92) 100%);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  --shadow-card: 0 8px 26px -12px rgba(0, 0, 0, .9);
  --shadow-pop: 0 18px 48px -18px rgba(139, 61, 255, .55);
  --glow-pink: 0 0 22px -4px rgba(255, 46, 116, .75);

  --shell-w: 430px;
  --tabbar-h: 62px;
  --header-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  --font: 'Cairo', 'Sora', 'Segoe UI', 'Tahoma', 'PingFang SC',
          'Microsoft YaHei', 'Noto Sans Arabic', sans-serif;
  --font-num: 'Sora', 'Segoe UI', 'Cairo', sans-serif;
}

/* ---------- 桌面端手机框 ---------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(60% 45% at 18% 8%,  rgba(139, 61, 255, .30), transparent 70%),
    radial-gradient(55% 40% at 84% 12%, rgba(255, 46, 116, .22), transparent 70%),
    radial-gradient(70% 60% at 50% 110%, rgba(56, 225, 255, .10), transparent 70%),
    #05040a;
}

.app-shell {
  position: relative;
  width: 100%;
  max-width: var(--shell-w);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
}
@media (min-width: 720px) {
  .app-shell {
    min-height: 100dvh;
    box-shadow: 0 0 0 1px var(--line), 0 40px 120px -30px rgba(0, 0, 0, .95);
  }
  /* 桌面端顶部一条霓虹线，像真 App */
  .app-shell::before {
    content: '';
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: 2px;
    background: var(--grad-brand);
    opacity: .85;
    z-index: 60;
  }
}

/* ---------- 顶栏 ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding-inline: 16px;
  background: rgba(11, 10, 16, .82);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.app-header .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: .2px;
}
.brand-dot {
  width: 24px; height: 24px;
  border-radius: 8px;
  background: var(--grad-brand);
  display: grid; place-items: center;
  box-shadow: var(--glow-pink);
}
.brand-dot::after {
  content: '';
  border-inline-start: 7px solid #fff;
  border-block: 4.5px solid transparent;
  margin-inline-start: 2px;
}
.header-actions {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 金币药丸 */
.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding-inline: 10px 12px;
  border-radius: var(--r-pill);
  background: rgba(255, 198, 92, .12);
  border: 1px solid rgba(255, 198, 92, .35);
  color: var(--gold);
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}
.coin-pill .ic { font-size: 14px; }
.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  color: var(--text-dim);
  font-size: 18px;
  transition: background .18s, color .18s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
.icon-btn.is-on { color: var(--pink); }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--shell-w);
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding-block: 6px calc(6px + var(--safe-b));
  background: rgba(12, 11, 18, .92);
  backdrop-filter: blur(18px) saturate(150%);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding-block: 5px;
  color: var(--text-mute);
  font-size: 10.5px;
  font-weight: 600;
  position: relative;
  transition: color .18s;
}
.tabbar a .ic { font-size: 21px; line-height: 1; }
.tabbar a.active { color: var(--pink); }
.tabbar a.active::before {
  content: '';
  position: absolute;
  top: -7px;
  width: 22px; height: 3px;
  border-radius: 3px;
  background: var(--grad-brand);
  box-shadow: var(--glow-pink);
}

/* ---------- 通用页容器 ---------- */
.page {
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px);
  animation: pageIn .28s ease-out;
}
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } }

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 16px 10px;
  font-size: 15px;
  font-weight: 800;
}
.section-title .bar {
  width: 3px; height: 15px;
  border-radius: 2px;
  background: var(--grad-brand);
}
.section-title .more {
  margin-inline-start: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mute);
}

/* ---------- chips / 分类 ---------- */
.chips {
  display: flex;
  gap: 8px;
  padding: 10px 16px 14px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  height: 31px;
  padding-inline: 14px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: .18s;
}
.chip.active {
  background: var(--grad-brand);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--glow-pink);
}

/* ---------- 卡片瀑布 ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-inline: 14px;
}
.v-card {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  transition: transform .22s cubic-bezier(.2, .8, .3, 1), border-color .22s;
  display: block;
}
.v-card:active { transform: scale(.972); }
.v-card:hover { border-color: var(--line-strong); }
.v-card .thumb {
  position: relative;
  aspect-ratio: 3 / 4;
  background: linear-gradient(135deg, #17131f, #0d0b13);
  overflow: hidden;
}
.v-card .thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .35s ease, transform .5s ease;
}
.v-card .thumb img.loaded { opacity: 1; }
.v-card:hover .thumb img { transform: scale(1.05); }
.v-card .thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--grad-card);
  pointer-events: none;
}
.v-card .play-badge {
  position: absolute;
  inset-block-end: 8px;
  inset-inline-start: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: rgba(0, 0, 0, .58);
  backdrop-filter: blur(6px);
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  direction: ltr;
}
.v-card .ep-badge {
  position: absolute;
  inset-block-start: 8px;
  inset-inline-end: 8px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 46, 116, .88);
  font-size: 10px;
  font-weight: 800;
  color: #fff;
}
.v-card .meta { padding: 8px 9px 10px; }
.v-card .name {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.9em;
}
.v-card .sub {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}
.v-card .tagline {
  color: var(--purple);
  font-weight: 700;
}

/* ---------- 骨架屏 ---------- */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07), transparent);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-grid;
  place-items: center;
  gap: 6px;
  height: 46px;
  padding-inline: 20px;
  border-radius: var(--r-pill);
  font-size: 14.5px;
  font-weight: 800;
  border: 1px solid transparent;
  transition: transform .16s, filter .2s, opacity .2s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--grad-brand); color: #fff; box-shadow: var(--shadow-pop); }
.btn-gold { background: var(--grad-gold); color: #3a2500; box-shadow: 0 10px 30px -12px rgba(255, 166, 61, .9); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text-dim); }
.btn-block { display: grid; width: 100%; }
.btn[disabled] { opacity: .42; filter: grayscale(.5); pointer-events: none; }

/* ---------- 面板 / 列表 ---------- */
.panel {
  margin: 12px 14px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 15px;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row .ic-wrap {
  width: 38px; height: 38px;
  flex: 0 0 auto;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 18px;
  background: var(--surface-2);
}
.row .body { flex: 1; min-width: 0; }
.row .title { font-size: 13.5px; font-weight: 700; }
.row .desc { font-size: 11.5px; color: var(--text-mute); margin-top: 2px; }
.row .tail {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  direction: ltr;
}
.chev { color: var(--text-mute); font-size: 16px; }

/* ---------- toast ---------- */
.toast-layer {
  position: fixed;
  inset-inline: 0;
  inset-block-end: calc(var(--tabbar-h) + 26px);
  z-index: 200;
  display: grid;
  justify-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  max-width: 88%;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  background: rgba(24, 20, 34, .96);
  border: 1px solid var(--line-strong);
  box-shadow: 0 14px 40px -14px #000;
  font-size: 13px;
  font-weight: 700;
  animation: toastIn .24s ease-out;
  display: flex; align-items: center; gap: 8px;
}
.toast.out { animation: toastOut .22s ease-in forwards; }
.toast.good { border-color: rgba(61, 220, 151, .4); color: #d8ffee; }
.toast.gold { border-color: rgba(255, 198, 92, .45); color: #ffeccb; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px) scale(.97); } }

/* ---------- 金币飘字 ---------- */
.coin-fly {
  position: fixed;
  z-index: 210;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 900;
  font-size: 17px;
  color: var(--gold);
  text-shadow: 0 0 14px rgba(255, 198, 92, .85);
  pointer-events: none;
  animation: flyUp 1.15s cubic-bezier(.2, .7, .3, 1) forwards;
  direction: ltr;
}
@keyframes flyUp {
  0%   { opacity: 0; transform: translateY(6px) scale(.8); }
  18%  { opacity: 1; transform: translateY(-4px) scale(1.06); }
  100% { opacity: 0; transform: translateY(-62px) scale(1); }
}

/* ---------- 空态 ---------- */
.empty {
  padding: 56px 24px;
  display: grid;
  justify-items: center;
  gap: 10px;
  color: var(--text-mute);
  text-align: center;
}
.empty .big { font-size: 40px; opacity: .5; }
.empty .t { font-size: 13.5px; font-weight: 700; color: var(--text-dim); }
.empty .s { font-size: 12px; }

/* ---------- 数字 ---------- */
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }

/* ---------- LTR 模式下的图标镜像修正 ---------- */
html[dir="ltr"] .flip-rtl { transform: scaleX(-1); }
html[dir="rtl"] .flip-ltr { transform: scaleX(-1); }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 0; height: 0; }
.scroll-y { overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ---------- SVG 图标统一尺寸（随父级 font-size） ---------- */
.ic { width: 1em; height: 1em; display: inline-block; vertical-align: -0.14em; flex: 0 0 auto; }
.tabbar a .ic, .coin-pill .ic, .icon-btn .ic { display: block; }
.coin-pill .ic { width: 15px; height: 15px; }

/* ---------- 底部弹出层 ---------- */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(4, 3, 8, .68);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn .18s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } }
.sheet {
  width: 100%;
  max-width: var(--shell-w);
  background: var(--bg-2);
  border-top: 1px solid var(--line-strong);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 8px 0 calc(14px + var(--safe-b));
  animation: sheetUp .26s cubic-bezier(.2, .9, .3, 1);
  max-height: 82dvh;
  overflow-y: auto;
}
@keyframes sheetUp { from { transform: translateY(100%); } }
.sheet-grip {
  width: 38px; height: 4px;
  border-radius: 4px;
  background: var(--line-strong);
  margin: 4px auto 10px;
}
.sheet-title {
  padding: 4px 18px 10px;
  font-size: 14px;
  font-weight: 800;
}
.lang-row { width: 100%; text-align: start; border-bottom: 1px solid var(--line); }
.lang-row.on { background: rgba(255, 46, 116, .07); }
.lang-row .ic-wrap { font-size: 11px; font-weight: 900; letter-spacing: .5px; }

/* ---------- 语言切换器 ---------- */
.lang-switch {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
}
.lang-switch button {
  padding: 4px 9px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 800;
  color: var(--text-mute);
  transition: .18s;
}
.lang-switch button.active {
  background: var(--grad-brand);
  color: #fff;
}

/* ---------- 下载推广弹窗 ---------- */
.dl-mask {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(4, 3, 8, .72);
  backdrop-filter: blur(4px);
  animation: fadeIn .18s ease-out;
}
.dl-card {
  position: relative;
  width: 100%;
  max-width: 330px;
  padding: 26px 22px 16px;
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, #1A1626 0%, #12101B 100%);
  border: 1px solid var(--line-strong);
  box-shadow: 0 30px 80px -24px rgba(0, 0, 0, .95), 0 0 42px -18px rgba(255, 46, 116, .8);
  text-align: center;
  animation: dlPop .26s cubic-bezier(.2, .9, .3, 1.1);
}
@keyframes dlPop { from { opacity: 0; transform: translateY(14px) scale(.94); } }
.dl-close {
  position: absolute;
  inset-block-start: 10px;
  inset-inline-end: 10px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  color: var(--text-mute);
  font-size: 15px;
  transition: background .18s, color .18s;
}
.dl-close:hover { background: rgba(255, 255, 255, .07); color: var(--text); }
.dl-icon {
  width: 64px; height: 64px;
  margin: 2px auto 14px;
  border-radius: 18px;
  background: var(--grad-brand);
  display: grid; place-items: center;
  box-shadow: var(--glow-pink), 0 16px 34px -14px rgba(139, 61, 255, .95);
}
.dl-icon::after {
  content: '';
  border-inline-start: 16px solid #fff;
  border-block: 10px solid transparent;
  margin-inline-start: 4px;
}
.dl-title { font-size: 18px; font-weight: 900; }
.dl-desc {
  margin-top: 7px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-dim);
}
.dl-points {
  margin: 14px 0 16px;
  display: grid;
  gap: 7px;
}
.dl-points li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-align: start;
}
.dl-points .ic { color: var(--green); font-size: 14px; }
.dl-later {
  width: 100%;
  margin-top: 4px;
  padding: 9px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-mute);
}
.dl-later:hover { color: var(--text-dim); }
