/* ============ 设计系统 ============ */
:root {
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #8b97a8;
  --brand: #3a6df0;
  --brand-2: #16235e;
  --brand-ink: #1c3aa0;
  --line: #e6eaf1;
  --danger: #ef4444;
  --gold: #f5a623;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 3px rgba(15,23,42,.06);
  --shadow: 0 8px 24px rgba(15,23,42,.08);
  --shadow-lg: 0 18px 44px rgba(15,23,42,.14);
  --nav-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-text-size-adjust: 100%; }
html, body {
  width: 100%; overflow-x: hidden; font-size: 16px; line-height: 1.5; min-height: 100vh;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: linear-gradient(180deg, #0b1a3a 0%, #0e2247 55%, #0a1730 100%);
  background-attachment: fixed; color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

#app {
  width: 100%; max-width: 480px; margin: 0 auto; padding: 12px 14px;
  padding-bottom: calc(var(--nav-h) + 24px);
  display: flex; flex-direction: column; gap: 14px;
}
.panel { display: flex; flex-direction: column; gap: 14px; }

/* ============ 顶部品牌头图 ============ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  max-width: 480px; margin: 0 auto; width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff; padding: 12px 16px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; flex: 0 0 auto; border-radius: 12px;
  background: rgba(255,255,255,.22); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
}
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: .5px; }
.brand-en { font-size: 12px; font-weight: 600; opacity: .8; letter-spacing: 1px; }
.brand-sub { font-size: 12px; opacity: .9; margin-top: 1px; }

/* ============ 底部 Tab 栏 ============ */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; margin: 0 auto;
  max-width: 480px; height: var(--nav-h); z-index: 30;
  display: flex; gap: 6px; padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 18px rgba(15,23,42,.07);
}
.nav-btn {
  flex: 1 1 0; border: none; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 6px 2px; border-radius: 12px; color: var(--muted);
  font-size: 13px; font-weight: 700; transition: background .15s ease, color .15s ease, transform .1s ease;
}
.nav-btn:active { transform: scale(.94); }
.nav-btn.active {
  color: var(--brand-ink); background: rgba(58,109,240,.10);
}

/* ============ 卡片 / 容器 ============ */
.hero-card {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff; border-radius: var(--radius-lg); padding: 18px 18px;
  box-shadow: var(--shadow);
}
.hero-card h1 { font-size: 20px; font-weight: 800; letter-spacing: .5px; }
.hero-sub { font-size: 13px; opacity: .92; margin-top: 4px; }

.form-card, .input-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow-sm);
}
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
input, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-size: 15px; background: var(--surface-2); color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease; font-family: inherit;
}
input:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(58,109,240,.16); background: #fff;
}
textarea { resize: none; }

/* ============ 按钮 ============ */
button {
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 15px; font-weight: 700; font-family: inherit;
  transition: transform .1s ease, box-shadow .15s ease, background .15s ease;
}
button:active { transform: scale(.97); }
.primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff; padding: 12px 16px; box-shadow: 0 6px 16px rgba(58,109,240,.28);
}
.primary:active { box-shadow: 0 3px 10px rgba(58,109,240,.28); }
.ghost {
  background: var(--surface); color: var(--ink-2); border: 1px solid var(--line);
  padding: 9px 12px; font-size: 13px; box-shadow: var(--shadow-sm);
}
.ghost:active { background: var(--surface-2); }
.ghost.danger { color: var(--danger); border-color: rgba(239,68,68,.3); }
.icon { background: var(--surface); border: 1px solid var(--line); font-size: 18px; padding: 10px 14px; box-shadow: var(--shadow-sm); }

/* ============ 概览统计卡片 ============ */
.overview { display: flex; flex-direction: column; gap: 10px; }
.stats { display: flex; gap: 10px; }
.stat {
  flex: 1 1 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 8px; text-align: center; box-shadow: var(--shadow-sm);
}
.stat-num { font-size: 22px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat.done .stat-num { color: var(--brand); }
.stat.pending .stat-num { color: var(--gold); }
.stat.overdue .stat-num { color: var(--danger); }
.deadline-badge {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(135deg, rgba(58,109,240,.12), rgba(22,35,94,.12));
  color: var(--brand-ink); border: 1px solid rgba(58,109,240,.25);
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; font-weight: 600;
}

/* ============ 输入区 ============ */
.input-card { gap: 10px; }
.member-row { display: flex; flex-wrap: wrap; gap: 6px; }
.member-row button {
  padding: 6px 11px; font-size: 13px; font-weight: 600; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.btn-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.btn-row .icon { flex: 0 0 auto; }
.btn-row .primary { flex: 1 1 auto; }

/* ============ 列表 ============ */
.list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.list li {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-sm);
  animation: rise .25s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.rec-raw { font-size: 15px; color: var(--ink); line-height: 1.45; word-break: break-word; }
.rec-meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rec-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.rec-actions button { padding: 5px 10px; font-size: 12px; font-weight: 600; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag.pending { background: #fff4d6; color: #b6791a; }
.tag.done { background: #dbe7ff; color: var(--brand-ink); }
.tag.overdue { background: #fde2e2; color: #c0392b; }
.tag.unclassified { background: #eef1f6; color: var(--muted); }

/* ============ 报告区 ============ */
.report-area { display: flex; flex-wrap: wrap; gap: 8px; }
.report-box {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; font-size: 13px; white-space: pre-wrap; word-break: break-word;
  color: var(--ink-2); box-shadow: var(--shadow-sm); font-family: "SFMono-Regular", Consolas, monospace;
}

/* ============ 空状态 ============ */
.empty {
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
  color: var(--muted); text-align: center; padding: 28px 16px; display: flex; flex-direction: column; gap: 6px;
}
.empty .empty-ico { font-size: 32px; }
.empty .empty-tip { font-size: 13px; }

/* ============ 名片（会员卡质感） ============ */
.card-preview { margin-top: 4px; }
.honor-preview { max-width: 100%; max-height: 130px; border-radius: var(--radius-sm); align-self: flex-start; margin-top: 4px; }
.namecard {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #101a45 0%, var(--brand-2) 45%, var(--brand) 100%);
  color: #fff; border-radius: var(--radius-lg); padding: 18px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--shadow-lg);
}
.namecard::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(255,255,255,.18), rgba(255,255,255,0) 70%);
  border-radius: 50%;
}
.nc-top { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.nc-avatar {
  width: 52px; height: 52px; flex: 0 0 auto; border-radius: 14px;
  background: rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; box-shadow: inset 0 0 0 1px rgba(255,255,255,.4);
}
.nc-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nc-name { font-size: 20px; font-weight: 800; letter-spacing: .5px; }
.nc-role { font-size: 13px; opacity: .92; }
.nc-info { display: flex; flex-direction: column; gap: 7px; position: relative; z-index: 1; }
.nc-row { display: flex; font-size: 14px; gap: 8px; }
.nc-k { width: 64px; flex: 0 0 auto; opacity: .8; font-size: 13px; }
.nc-v { flex: 1 1 auto; word-break: break-word; font-weight: 600; }
.nc-honor { max-width: 84px; max-height: 84px; border-radius: 10px; align-self: flex-start; box-shadow: var(--shadow-sm); }
.nc-sum { position: relative; z-index: 1; background: rgba(255,255,255,.14); border-radius: 12px; padding: 10px 12px; }
.nc-sum .nc-k { width: auto; opacity: .9; font-weight: 700; margin-bottom: 4px; }
.nc-sum-list { margin: 2px 0 0 18px; font-size: 13px; }
.nc-sum-list li { list-style: disc; word-break: break-word; }

/* ============ 队友库 ============ */
.lib-add { display: flex; gap: 8px; }
.lib-add input { flex: 1 1 auto; }

/* ============ 匹配环形 + 三维明细 ============ */
.ring { position: relative; width: 64px; height: 64px; margin: 2px auto 10px; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring-bg { fill: none; stroke: rgba(15,23,42,.08); stroke-width: 6; }
.ring-fg { fill: none; stroke: var(--brand); stroke-width: 6; stroke-linecap: round;
  transition: stroke-dashoffset .5s ease; }
.ring-num {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums;
}

.exp-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 4px; box-shadow: var(--shadow-sm); }
.exp-title { font-size: 13px; color: var(--muted); margin-bottom: 8px; font-weight: 700; }
.exp-row { display: flex; align-items: center; font-size: 14px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.exp-row:last-child { border-bottom: none; }
.exp-mark { width: 20px; flex: 0 0 auto; text-align: center; font-weight: 800; }
.exp-label { flex: 1 1 auto; }
.exp-pts { flex: 0 0 auto; font-variant-numeric: tabular-nums; font-weight: 700; }
.exp-bar { flex: 0 0 auto; width: 60px; height: 6px; border-radius: 999px; background: var(--surface-2); margin-left: 10px; overflow: hidden; }
.exp-bar > i { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.exp-row.hit .exp-mark { color: var(--brand); }
.exp-row.hit .exp-pts { color: var(--brand); }
.exp-row.hit .exp-bar > i { background: var(--brand); }
.exp-row.miss { color: var(--muted); }
.exp-row.miss .exp-mark { color: #cfd6e0; }
.exp-row.miss .exp-bar > i { width: 0 !important; }

/* ============ 个人主页（星途页头 + 名片整合） ============ */
.card-home { display: flex; flex-direction: column; gap: 12px; }
.ph-hero {
  position: relative; overflow: hidden; border-radius: var(--radius-lg);
  background-size: cover; background-position: center;
  min-height: 150px; padding: 22px 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; color: #fff; box-shadow: var(--shadow-lg);
}
.ph-hero::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; bottom: 0;
  background: linear-gradient(180deg, rgba(10,18,45,.22), rgba(10,18,45,.58));
}
.ph-hero > * { position: relative; z-index: 1; }
.ph-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(255,255,255,.2); box-shadow: inset 0 0 0 2px rgba(255,255,255,.45);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800;
}
.ph-name { font-size: 22px; font-weight: 800; letter-spacing: .5px; }
.ph-sub { font-size: 13px; opacity: .92; }
.ph-chip {
  align-self: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 14px; font-size: 13px; color: var(--ink-2);
  box-shadow: var(--shadow-sm); max-width: 100%;
}
.card-actions { display: flex; gap: 8px; }
.card-actions .ghost, .card-actions .primary { flex: 1 1 0; }

/* ============ 顶栏右上：个人入口 chip ============ */
.nav-profile {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: rgba(255,255,255,.18); color: #fff;
  border: 1px solid rgba(255,255,255,.35); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; font-weight: 700; white-space: nowrap;
  transition: background .15s ease, transform .1s ease;
}
.nav-profile:active { transform: scale(.96); background: rgba(255,255,255,.28); }
.np-avatar {
  width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto;
  background: rgba(255,255,255,.28); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
}

/* ============ 登录/注册弹窗（壳） ============ */
.modal {
  position: fixed; inset: 0; z-index: 60; display: flex;
  align-items: center; justify-content: center; padding: 16px;
}
.modal-mask { position: absolute; inset: 0; background: rgba(8,15,35,.6); backdrop-filter: blur(2px); }
.modal-card {
  position: relative; width: 100%; max-width: 360px;
  background: var(--surface); border-radius: var(--radius-lg); padding: 22px 20px;
  box-shadow: var(--shadow-lg);
}
.modal-close {
  position: absolute; top: 8px; right: 12px; border: none; background: transparent;
  font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer;
}
.modal-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.modal-tab {
  flex: 1 1 0; padding: 10px; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 10px; font-weight: 700; color: var(--ink-2); cursor: pointer; font-size: 14px;
}
.modal-tab.active {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff; border-color: transparent;
}
.modal-form { display: flex; flex-direction: column; gap: 12px; }
.modal-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.auth-msg { font-size: 13px; color: var(--danger); min-height: 16px; }

/* ============ 个人主页：名片二维码 ============ */
.qr-box {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  box-shadow: var(--shadow-sm);
}
.qr-img {
  width: 168px; height: 168px; padding: 8px; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; line-height: 0;
}
.qr-img svg { width: 100%; height: 100%; display: block; }
.qr-cap { font-size: 13px; color: var(--muted); font-weight: 600; text-align: center; }

/* ============ 桌面端适配（≥768px）：星海上的玻璃舞台 ============ */
@media (min-width: 768px) {
  body { padding: 36px 16px 64px; }

  /* 顶栏 / 内容 / 底部导航 三块拼成一张无缝圆角玻璃卡 */
  .topbar {
    position: static; max-width: 1000px; margin: 0 auto;
    border-radius: 20px 20px 0 0; border: 1px solid rgba(255,255,255,.10);
    border-bottom: none;
  }
  #app {
    max-width: 1000px; margin: 0 auto; padding: 28px 28px 28px;
    gap: 18px;
    background: rgba(255,255,255,.045);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-left: 1px solid rgba(255,255,255,.10);
    border-right: 1px solid rgba(255,255,255,.10);
  }
  .nav {
    position: static; max-width: 1000px; margin: 0 auto;
    background: rgba(255,255,255,.10); backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,.10); border-top: none;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 24px 60px rgba(5,12,30,.45);
    padding: 8px; justify-content: center; gap: 10px;
  }
  .nav-btn { font-size: 14px; padding: 10px 26px; color: rgba(255,255,255,.72); }
  .nav-btn.active { background: rgba(58,109,240,.22); color: #fff; }

  /* 建组区：英雄语 + 表单 并排，像仪表盘 */
  #settings { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: stretch; }
  #settings .hero-card { margin-bottom: 0; }

  /* 概览统计横向铺开 */
  .overview .stats { gap: 14px; }
  .stat { flex: 1 1 0; }
}

/* ============ 小屏适配（375px 无横滚保障） ============ */
@media (max-width: 360px) {
  .stat-num { font-size: 19px; }
  .brand-name { font-size: 16px; }
}
