/* 远程访问管理器 — 手机端样式
   设计前提：全程单手操作、拇指热区在下半屏、弱网、可能在地铁里用。
   所以：大按钮、大字号、不做悬停交互、进度条一定要能看清。 */

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1a1d21;
  --sub: #6b7280;
  --line: #e8eaed;
  --accent: #0a7cff;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 12px rgba(16, 24, 40, .05);
}

/* ---------------------------------------------------------------- 品牌 */

.brandmark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .12);
  flex-shrink: 0;
}

.wordmark {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .8px;
  color: #17233c;
  font-family: "Arial Black", "Helvetica Neue", Impact, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

/* ---------------------------------------------------------------- 顶栏 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(244, 245, 247, .92);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px calc(10px + env(safe-area-inset-top, 0)) ;
  padding-top: calc(12px + env(safe-area-inset-top, 0));
}

.topbar h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toprow {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 返回按钮：44px 触摸热区，左侧固定，避免用户找不到出口 */
.backbtn {
  width: 36px;
  height: 36px;
  margin-left: -8px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 26px;
  line-height: 1;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
  transition: background .12s;
}

.backbtn:active { background: rgba(0, 0, 0, .06); }

.iconbtn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 10px;
  font-size: 19px;
  color: var(--sub);
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.iconbtn:active { background: rgba(0, 0, 0, .06); }

.topbar .sub {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--sub);
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 14px calc(90px + env(safe-area-inset-bottom, 0));
}

/* ---------------------------------------------------------------- 卡片 */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--sub);
  margin: 0 0 10px;
  letter-spacing: .3px;
}

/* ---------------------------------------------------------------- 门户应用卡 */

.app-card {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 14px;
  margin-bottom: 11px;
  text-decoration: none;
  color: inherit;
  transition: transform .12s ease;
}

.app-card:active { transform: scale(.985); }

.app-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
  background: #eef2ff;
}

.app-main { flex: 1; min-width: 0; }

.app-name {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
}

.app-desc {
  font-size: 12.5px;
  color: var(--sub);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #cbd5e1;
}

.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.err { background: var(--err); }
/* 状态还没探测回来的占位（灰），别用绿色让人误以为已就绪 */
.dot.idle { background: #cbd5e1; }

.chev { color: #c4c9d4; font-size: 18px; flex-shrink: 0; }

/* ---------------------------------------------------------------- 搜索 */

.searchbar {
  display: flex;
  gap: 9px;
  margin-bottom: 13px;
}

.searchbar input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font-size: 16px;   /* iOS 上小于 16px 会触发聚焦缩放 */
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}

.searchbar input:focus { border-color: var(--accent); }

.btn {
  height: 46px;
  padding: 0 18px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity .15s;
}

.btn:active { opacity: .82; }
.btn:disabled { opacity: .45; cursor: default; }

.btn.ghost {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn.small { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }

/* ---------------------------------------------------------------- 书目 */

.book {
  display: flex;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.book:last-child { border-bottom: none; padding-bottom: 2px; }
.book:first-child { padding-top: 2px; }

.book-body { flex: 1; min-width: 0; }

/* 列表里的封面缩略图 */
.book-cover {
  width: 46px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  background: #eef0f3;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .14);
}

/* 详情弹层：封面 + 信息并排 */
.dtop {
  display: flex;
  gap: 14px;
  margin-bottom: 4px;
  align-items: flex-start;
}

.dcover {
  width: 92px;
  height: 128px;
  object-fit: cover;
  border-radius: 8px;
  background: #eef0f3;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(16, 24, 40, .16);
}

.dinfo { flex: 1; min-width: 0; }
.dinfo .meta-grid { margin-bottom: 0; }

.toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: #4b5261;
  line-height: 1.9;
}

.toc-list li {
  border-bottom: 1px dashed var(--line);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toc-list li:last-child { border-bottom: none; }

.book-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.38;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-meta {
  font-size: 12.5px;
  color: var(--sub);
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.book-intro {
  font-size: 12.5px;
  color: #8b93a1;
  margin-top: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-act { display: flex; align-items: center; flex-shrink: 0; }

/* ---------------------------------------------------------------- 队列 */

.queue-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -2px 20px rgba(16, 24, 40, .1);
  transform: translateY(calc(100% - 58px - env(safe-area-inset-bottom, 0)));
  transition: transform .26s cubic-bezier(.32, .72, 0, 1);
  max-height: 74vh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.queue-panel.open { transform: translateY(0); }

.queue-head {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.queue-head .grip {
  width: 34px;
  height: 4px;
  border-radius: 2px;
  background: #dfe3e8;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 7px;
}

.queue-head .label { font-weight: 600; font-size: 14.5px; }

.queue-head .count {
  font-size: 12px;
  color: var(--sub);
  background: #f1f3f6;
  border-radius: 20px;
  padding: 2px 9px;
}

.queue-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 14px;
  flex: 1;
}

.job {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.job:last-child { border-bottom: none; }

.job-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  justify-content: space-between;
}

.job-title {
  font-size: 14px;
  font-weight: 550;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.job-pct { font-size: 12.5px; color: var(--sub); flex-shrink: 0; font-variant-numeric: tabular-nums; }

.job-bar {
  height: 4px;
  border-radius: 2px;
  background: #eef0f3;
  margin-top: 8px;
  overflow: hidden;
}

.job-bar > i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transition: width .35s ease;
}

.job-msg { font-size: 12px; color: var(--sub); margin-top: 6px; display: flex; gap: 8px; align-items: center; }
.job-msg .sp { flex: 1; }
.job.err .job-bar > i { background: var(--err); }
.job.done .job-bar > i { background: var(--ok); }

.job-cancel {
  border: none;
  background: none;
  color: var(--sub);
  font-size: 12px;
  padding: 2px 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------------------------------------------------------------- 队列底部 */

.queue-foot {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.queue-foot .btn { width: 100%; }

/* ---------------------------------------------------------------- 详情弹层 */

.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .45);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade .18s ease;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  background: var(--card);
  width: 100%;
  max-width: 720px;
  max-height: 86vh;
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0);
  animation: slideUp .24s cubic-bezier(.32, .72, 0, 1);
}

@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.sheet-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 18px 16px 12px;
  flex-shrink: 0;
}

.sheet-title {
  flex: 1;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.38;
  letter-spacing: -.2px;
}

.sheet-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 16px;
  flex: 1;
}

.sheet-foot {
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0));
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  display: flex;
  gap: 10px;
}

.sheet-foot .btn { flex: 1; }

.meta-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px 14px;
  font-size: 13.5px;
  margin-bottom: 16px;
}

.meta-grid dt { color: var(--sub); white-space: nowrap; }
.meta-grid dd { margin: 0; color: var(--text); word-break: break-word; }

.section-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sub);
  letter-spacing: .3px;
  margin: 18px 0 8px;
}

.intro-text {
  font-size: 14px;
  line-height: 1.72;
  color: #3b4250;
  white-space: pre-wrap;
}

.loading-line {
  font-size: 13px;
  color: var(--sub);
  padding: 14px 0;
}

/* 提示条里的行内链接（比如"自动登录 →"） */
.inline-link {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- 空态 / 提示 */

.empty {
  text-align: center;
  color: var(--sub);
  padding: 46px 20px;
  font-size: 14px;
  line-height: 1.7;
}

.empty .big { font-size: 34px; margin-bottom: 10px; opacity: .55; }

.notice {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.55;
  margin-bottom: 12px;
}

.notice.warn { background: #fff8ed; color: #8a5300; border: 1px solid #fdeac8; }
.notice.err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.notice.info { background: #eff6ff; color: #1e40af; border: 1px solid #dbeafe; }

/* ---------------------------------------------------------------- 配对页 */

.pair-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  max-width: 420px;
  margin: 0 auto;
}

.pair-logo {
  width: 104px;
  height: 104px;
  border-radius: 23px;
  object-fit: cover;
  align-self: center;
  margin-bottom: 18px;
  box-shadow: 0 6px 24px rgba(16, 24, 40, .13);
}

.pair-brand {
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 2.2px;
  color: #17233c;
  font-family: "Arial Black", "Helvetica Neue", Impact, sans-serif;
  margin: 0 0 8px;
}

.pair-wrap h2 { font-size: 17px; margin: 0 0 6px; text-align: center; font-weight: 600; color: var(--sub); }
.pair-wrap p { color: var(--sub); font-size: 13.5px; margin: 0 0 26px; text-align: center; line-height: 1.6; }

.pin-input {
  width: 100%;
  height: 60px;
  text-align: center;
  font-size: 30px;
  letter-spacing: 11px;
  font-weight: 600;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  outline: none;
  font-variant-numeric: tabular-nums;
  padding-left: 11px;   /* 抵消最后一个字后面的间距，视觉居中 */
}

.pin-input:focus { border-color: var(--accent); }

.pair-wrap .btn { width: 100%; margin-top: 14px; height: 50px; font-size: 16px; }
.pair-err { color: var(--err); font-size: 13.5px; margin-top: 12px; min-height: 20px; text-align: center; }

/* ---------------------------------------------------------------- 骨架 */

.skeleton {
  background: linear-gradient(90deg, #eef0f3 25%, #f6f7f9 50%, #eef0f3 75%);
  background-size: 200% 100%;
  animation: sk 1.3s infinite;
  border-radius: 8px;
  height: 14px;
}

@keyframes sk {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.hidden { display: none !important; }

/* ================================================================
   电脑端适配
   手机上是竖排单列（用户认可，不动）；屏幕一宽就变成两列，
   并把内容区放宽，避免中间一条窄带、两边大片留白。
   ================================================================ */

@media (min-width: 900px) {
  .wrap {
    max-width: 1040px;
    padding: 26px 28px 110px;
  }

  /* 顶栏文字跟内容区左边对齐，不再紧贴窗口左边 */
  .topbar {
    padding-left: max(28px, calc((100% - 1040px) / 2 + 28px));
    padding-right: max(28px, calc((100% - 1040px) / 2 + 28px));
  }

  /* 应用列表：两列 */
  #apps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  #apps .app-card { margin-bottom: 0; }

  /* 队列抽屉：桌面端不要铺满全屏，居中一条，别把整块屏幕顶起来 */
  .queue-panel {
    left: 50%;
    right: auto;
    width: min(720px, 100% - 56px);
    transform: translateX(-50%) translateY(calc(100% - 58px - env(safe-area-inset-bottom, 0)));
    border-radius: 18px 18px 0 0;
  }

  .queue-panel.open { transform: translateX(-50%) translateY(0); }

  /* 详情弹层在桌面上更像一个对话框，而不是底部抽屉 */
  .sheet-mask { align-items: center; }

  .sheet {
    border-radius: 18px;
    max-height: 82vh;
    box-shadow: 0 24px 64px rgba(16, 24, 40, .22);
  }

  /* 搜索结果在桌面上也更宽松些 */
  .book-title { font-size: 15.5px; }
  .searchbar input { height: 48px; }
}
