/* openDt哔哩 —— 应用内直接看 B 站
 * 内容区是哔哩哔哩官方移动站，本文件只负责外壳（顶栏/底栏/面板）。
 */
:root {
  --brand: #00a1d6;
  --brand-2: #23b5e8;
  --pink: #fb7299;
  --bg: #f4f7fa;
  --card: #ffffff;
  --fg: #1f2430;
  --sub: #8b93a1;
  --line: #e8edf3;
  --danger: #e11d48;
  --ok: #16a34a;
  --top: 54px;
  --bottom: calc(58px + env(safe-area-inset-bottom));
  --radius: 14px;
  --shadow: 0 6px 20px rgba(31, 36, 48, .06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 15px; line-height: 1.6;
  overflow: hidden;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ---------- 微信提示条 ---------- */
.wx-bar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 70;
  background: #fff8e6; color: #8a6d1a; border-bottom: 1px solid #ffe9a8;
  padding: 7px 14px; font-size: 12px; line-height: 1.5;
}
.wx-bar b { display: block; color: #b45309; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: var(--top);
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { font-size: 17px; font-weight: 900; white-space: nowrap; letter-spacing: .2px; }
.brand span {
  background: linear-gradient(135deg, var(--brand), var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent; margin-left: 1px;
}
.tb-search {
  flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0;
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 12px; color: var(--sub); font-size: 13px; text-align: left;
}
.tb-search-ph { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-btn {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; font-size: 15px; color: var(--fg);
}

/* ---------- 内容舞台 ---------- */
.stage {
  position: fixed; left: 0; right: 0;
  top: calc(var(--top) + env(safe-area-inset-top));
  bottom: var(--bottom);
  background: #fff;
  overflow: hidden;
}
.stage iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.stage-loading {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: #fff; color: var(--sub); font-size: 13px;
  transition: opacity .25s;
}
.stage-loading.gone { opacity: 0; pointer-events: none; }
.stage-fallback {
  position: absolute; inset: 0; z-index: 4;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: #fff; color: var(--sub); font-size: 13.5px; text-align: center; padding: 24px;
}

/* ---------- 我的（原生页） ---------- */
.page {
  position: fixed; left: 0; right: 0;
  top: calc(var(--top) + env(safe-area-inset-top));
  bottom: var(--bottom);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 12px 12px 24px;
  background: var(--bg);
}
@media (min-width: 720px) { .page { max-width: 680px; margin: 0 auto; left: 0; right: 0; } }
.mine-head {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #e6f7ff, #fff0f5);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 14px;
}
.mine-avatar {
  width: 52px; height: 52px; border-radius: 16px; font-size: 26px;
  background: linear-gradient(135deg, var(--brand), var(--pink));
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.mine-info { flex: 1; min-width: 0; }
.mine-info b { display: block; font-size: 16px; }
.mine-info span { font-size: 12px; color: var(--sub); }
.mine-badge {
  flex: 0 0 auto; font-size: 11px; font-weight: 700; color: var(--ok);
  background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 999px; padding: 4px 10px;
}
.mine-sec { margin-top: 16px; }
.mine-title { font-size: 14px; font-weight: 800; margin-bottom: 8px; }
.mine-tip { font-size: 11.5px; color: var(--sub); font-weight: 400; margin-left: 6px; }
.mine-item {
  display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 14px; font-size: 14px; margin-bottom: 8px; text-align: left; color: var(--fg);
}
.mi-val { font-size: 12px; color: var(--sub); flex: 0 0 auto; }
.mi-val.ok { color: var(--ok); }
.mine-foot { text-align: center; font-size: 11.5px; color: var(--sub); margin-top: 24px; line-height: 1.9; }

/* 搜索记录 */
.hist-list { display: flex; flex-direction: column; gap: 8px; }
.hist-empty { font-size: 12.5px; color: var(--sub); padding: 4px 2px; }
.hist-row {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  font-size: 13px;
}
.hist-row span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-row i { font-style: normal; color: var(--sub); font-size: 12px; }
.hist-x {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  border: none; background: var(--bg); color: var(--sub); font-size: 12px;
}

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: var(--bottom);
  display: flex; align-items: stretch;
  background: rgba(255, 255, 255, .97); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; border: none; background: none; padding: 6px 0 4px;
  font-size: 11.5px; color: var(--sub); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.tab-ico { font-size: 19px; line-height: 1; }
.tab.on { color: var(--brand); font-weight: 700; }

/* ---------- 沉浸模式 ---------- */
body.immersive .topbar,
body.immersive .tabbar { display: none; }
body.immersive .stage { top: 0; bottom: 0; }
body.immersive .page { top: 0; bottom: 0; }

/* ---------- 面板 ---------- */
.layer {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(15, 20, 28, .5); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 90dvh; overflow-y: auto;
  background: #fff; border-radius: 18px 18px 0 0;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  animation: rise .24s ease-out;
}
@keyframes rise { from { transform: translateY(28px); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; font-size: 16px;
  position: sticky; top: 0; background: #fff; z-index: 2;
  border-bottom: 1px solid var(--line);
}
.sheet-head span { width: 44px; }
.link-btn { border: none; background: none; color: var(--brand); font-size: 14px; font-weight: 700; width: 44px; text-align: left; padding: 0; }

/* AI 面板 */
.ai-body { padding: 14px 16px 4px; }
.ai-hint { font-size: 12.5px; color: var(--sub); margin: 0 0 10px; line-height: 1.7; }
.ai-body textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 14px;
  padding: 12px 14px; font-size: 14.5px; line-height: 1.6; resize: none; outline: none;
  background: #fff; color: var(--fg); margin-bottom: 10px;
}
.ai-body textarea:focus { border-color: var(--brand); }
.btn {
  width: 100%; border: none; border-radius: 14px; padding: 13px 0;
  font-size: 15px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 20px rgba(0, 161, 214, .26);
}
.btn.ghost { background: #fff; color: var(--brand); border: 1.5px solid rgba(0, 161, 214, .4); box-shadow: none; }
.btn.ghost.danger { color: var(--danger); border-color: rgba(225, 29, 72, .35); }
.ai-go { background: linear-gradient(135deg, var(--pink), #ff8fab); box-shadow: 0 8px 20px rgba(251, 114, 153, .3); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-chips { margin: 12px 0 4px; }
.ai-chips:empty { margin: 0; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 8px 14px; font-size: 13px; color: var(--fg);
}
.chip.hot {
  border-color: rgba(0, 161, 214, .4); color: var(--brand); font-weight: 700;
  background: rgba(0, 161, 214, .08);
}
.ai-quick { margin-top: 16px; }
.ai-quick-title { font-size: 12.5px; color: var(--sub); margin-bottom: 8px; }
.ai-note { font-size: 11.5px; color: var(--sub); line-height: 1.8; margin: 16px 0 0; }

/* 说明 */
.help-body { padding-bottom: 8px; }
.help-item { margin-bottom: 14px; }
.help-item b { display: block; font-size: 13.5px; margin-bottom: 3px; }
.help-item span { font-size: 12.5px; color: #4b5563; line-height: 1.8; }

/* 设置 */
.set-sec { padding: 14px 16px 4px; }
.set-title { font-size: 14px; font-weight: 800; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.key-state { font-size: 11px; font-weight: 700; color: var(--sub); background: var(--bg); border-radius: 999px; padding: 2px 8px; }
.key-state.ok { color: var(--ok); background: #f0fdf4; }
.set-sec input, .set-sec select {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 11px 12px; font-size: 14px; outline: none; margin-bottom: 8px; background: #fff; color: var(--fg);
}
.set-sec input:focus { border-color: var(--brand); }
.set-btns { display: flex; gap: 8px; }
.set-btns .btn { font-size: 13.5px; padding: 11px 0; }
.set-msg { font-size: 12px; color: var(--sub); margin: 8px 0 0; line-height: 1.7; word-break: break-all; }
.set-msg.ok { color: var(--ok); }
.set-msg.err { color: var(--danger); }
.set-tip { font-size: 11.5px; color: var(--sub); line-height: 1.8; margin: 8px 0 0; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--bottom) + 16px); transform: translateX(-50%);
  background: rgba(20, 26, 34, .93); color: #fff; font-size: 13px; line-height: 1.6;
  border-radius: 12px; padding: 10px 16px; max-width: 86vw; z-index: 130;
  text-align: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.toast.err { background: rgba(190, 24, 60, .94); }
