/* dl.topworl.com 客户自助游戏下载页
 * 来源：handoff/node/public/app.css
 * 调整：去掉后台/登录页样式，静态资源统一走 /res 前缀
 */

:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.07);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }

/* ---------- 通用控件 ---------- */
.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  background: #eef2f7;
  color: var(--text);
  padding: 9px 14px;
  font-weight: 600;
  line-height: 1.2;
  transition: transform .08s ease, background .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: #fff; border-color: var(--line); }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { display: block; width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 客户页骨架 ---------- */
.customer-page {
  min-height: 100vh;
  background:
    radial-gradient(900px 400px at 50% -140px, #dbeafe 0%, rgba(219, 234, 254, 0) 65%),
    var(--bg);
}
#app { max-width: 760px; margin: 0 auto; min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 12px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid rgba(226, 232, 240, .8);
}
.topbar-main { min-width: 0; }
.brand { font-size: 18px; font-weight: 800; letter-spacing: .2px; }
.bar-name {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 62vw;
}
.company-footer {
  margin-top: 20px;
  padding: 12px 0 0;
  border-top: 1px solid #eef2f7;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.6;
}

.banner {
  margin: 12px 16px 0;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
}
.banner.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

.main { padding: 14px 16px calc(92px + env(safe-area-inset-bottom)); }
.view { animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ---------- 搜索 / 渠道概览 ---------- */
.search-wrap { position: relative; }
.search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  padding: 13px 15px;
  outline: none;
  box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
}
.search:focus { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.catalog-meta { margin: 9px 2px 2px; font-size: 12px; color: var(--muted); min-height: 18px; }
.source-summary {
  margin: 2px 2px 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  color: #1e40af;
  font-size: 12px;
  font-weight: 600;
}

/* ---------- 游戏列表 ---------- */
.list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.source-section { margin-top: 18px; }
.source-section:first-child { margin-top: 0; }
.source-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px 8px;
}
.source-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 750; }
.source-mark { width: 3px; height: 15px; border-radius: 2px; background: var(--primary); }
.source-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.source-section .list { margin-top: 0; }
.group-empty {
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: #fff;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
}
.group-more { margin-top: 10px; }
.game-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
}
.game-main { min-width: 0; flex: 1; }
.game-name {
  font-weight: 650;
  font-size: 15px;
  line-height: 1.35;
  word-break: break-word;
}
.game-sub { margin-top: 4px; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; }
.dot::before { content: "·"; margin-right: 6px; color: #cbd5e1; }
.game-card .btn { flex: 0 0 auto; }
.game-status {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
}
.game-status.downloaded { color: #15803d; background: #f0fdf4; border: 1px solid #bbf7d0; }
.game-status.downloading { color: #1d4ed8; background: #eff6ff; border: 1px solid #bfdbfe; }

.game-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 0;
  font-size: 13px;
  color: var(--muted);
}
.game-loading[hidden] { display: none; }
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #dbeafe;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty {
  margin: 34px auto 10px;
  padding: 26px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  background: #fff;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius);
}
.empty[hidden] { display: none; }

/* ---------- 底部 tab ---------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid rgba(226, 232, 240, .9);
}
.tab {
  position: relative;
  flex: 1;
  max-width: 240px;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 7px 10px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  font-size: 12px;
  font-weight: 600;
}
.tab.active { color: var(--primary); background: #eff6ff; }
.tab-icon { font-size: 17px; line-height: 1; }
.badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 34px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}
.badge[hidden] { display: none; }

/* ---------- 下载任务 ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 4px 2px 2px; }
.section-head h2 { font-size: 18px; font-weight: 750; }
.task-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.task-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.task-name { font-weight: 650; font-size: 15px; line-height: 1.35; word-break: break-word; }
.task-sub { margin-top: 4px; font-size: 12px; color: var(--muted); }
.status-pill {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  white-space: nowrap;
}
.status-pill.downloading { background: #eff6ff; color: #1d4ed8; }
.status-pill.completed { background: #f0fdf4; color: #15803d; }
.status-pill.failed { background: #fef2f2; color: #b91c1c; }
.status-pill.queued, .status-pill.submitted, .status-pill.paused { background: #fffbeb; color: #b45309; }
.progress { height: 8px; background: #eef2f7; border-radius: 999px; overflow: hidden; margin: 12px 0 8px; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, #60a5fa, #2563eb); border-radius: 999px; transition: width .35s ease; }
.task-card.completed .progress-bar { background: linear-gradient(90deg, #4ade80, #16a34a); }
.task-card.failed .progress-bar { background: #f87171; }
.task-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.task-meta b { color: #334155; font-weight: 650; }
.task-note { margin-top: 6px; font-size: 12px; color: #b45309; line-height: 1.5; word-break: break-word; }

/* ---------- 底部弹层 ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.sheet {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -18px 50px rgba(15, 23, 42, .18);
  animation: sheet-in .2s ease;
}
@keyframes sheet-in { from { transform: translateY(18px); opacity: .7; } to { transform: none; opacity: 1; } }
.sheet-handle { width: 40px; height: 4px; border-radius: 999px; background: #e2e8f0; margin: 4px auto 14px; }
.sheet-title { font-size: 17px; font-weight: 750; line-height: 1.4; word-break: break-word; }
.sheet-meta { margin-top: 5px; color: var(--muted); font-size: 13px; }
.sheet-section { margin-top: 18px; }
.sheet-label { font-size: 13px; font-weight: 700; color: #334155; margin-bottom: 8px; }
.disk-list { display: flex; flex-direction: column; gap: 8px; }
.disk-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
}
.disk-option.selected { border-color: #93c5fd; background: #eff6ff; }
.disk-option.disabled { opacity: .5; }
.disk-option input { accent-color: var(--primary); }
.disk-name { font-weight: 700; }
.disk-free { font-size: 12px; color: var(--muted); }
.server-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}
.server-info { min-width: 0; }
.server-name { font-size: 13px; font-weight: 700; }
.server-ip { font-size: 11px; color: var(--muted); }
.server-hint { margin: -2px 0 8px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.server-auto { max-width: 55%; text-align: right; font-size: 12px; font-weight: 700; color: #15803d; }
.server-auto.bad { color: #b91c1c; }
.sheet-actions { display: flex; gap: 10px; margin-top: 20px; }
.sheet-actions .btn { flex: 1; }
.warn-box { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; font-size: 13px; }
.status-box { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: #f8fafc; border: 1px solid var(--line); font-size: 13px; color: #334155; white-space: pre-wrap; word-break: break-word; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 80;
  max-width: min(86vw, 520px);
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, .92);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 12px 34px rgba(15, 23, 42, .24);
}
.toast[hidden] { display: none; }
.toast.error { background: rgba(153, 27, 27, .96); }

/* ---------- 入口页 / 错误页 ---------- */
.entry-page, .error-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(900px 420px at 50% -60px, #dbeafe 0%, #f8fafc 62%);
}
.entry-card, .error-card {
  width: min(440px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 30px 26px;
  box-shadow: var(--shadow);
  text-align: center;
}
.entry-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 26px;
  margin: 0 auto 18px;
}
.entry-card h1, .error-card h1 { font-size: 21px; margin: 0 0 8px; }
.entry-card p, .error-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; word-break: break-word; }
.entry-hint {
  margin-top: 22px;
  padding: 14px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  color: #475569;
  font-size: 13px;
  line-height: 1.7;
  text-align: left;
}
.entry-footer, .error-footer {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid #eef2f7;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.8;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
}
.error-code { display: inline-block; margin-bottom: 10px; font-size: 12px; font-weight: 700; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 999px; padding: 3px 10px; }

@media (min-width: 761px) {
  .tabbar { left: 50%; right: auto; transform: translateX(-50%); width: 760px; border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; }
  .toast { bottom: 96px; }
}
