/* ============================================================
   排列三/排列五 数据分析系统 · 全局样式 v2（浅色主题）
   PC 优先设计 + ≤820px 移动端自适应（抽屉导航 / 单列 / 表格横滚）
   ============================================================ */
:root {
  --bg: #f2f5f9;
  --panel: #ffffff;
  --border: #e3e8ef;
  --border-strong: #d2dae4;
  --text: #1f2937;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --brand-grad: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  --danger: #dc2626;
  --warn-bg: #fef3c7;
  --warn-border: #f59e0b;
  --ok: #16a34a;
  --hit: #dc2626;
  --nb: #fde68a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .08);
  --shadow-hover: 0 6px 18px rgba(15, 23, 42, .10);
  --header-h: 96px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background:
    radial-gradient(1200px 300px at 50% -80px, #dbeafe 0%, transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  font-size: 14px; line-height: 1.65;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── 顶部免责声明条 ── */
.disclaimer-bar {
  background: var(--warn-bg); border-bottom: 1px solid var(--warn-border);
  color: #92400e; font-size: 12px; padding: 5px 16px; text-align: center;
}

/* ── 页头（PC） ── */
header.site {
  position: sticky; top: 0; z-index: 500;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .06);
}
.site-top {
  max-width: 1280px; margin: 0 auto; padding: 12px 20px 0;
  display: flex; align-items: center; gap: 12px;
}
.site-title {
  font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px;
  background: var(--brand-grad); -webkit-background-clip: text; background-clip: text;
  color: transparent; white-space: nowrap;
}
.site-title .sub {
  font-size: 11px; color: var(--muted); font-weight: 400;
  background: none; -webkit-text-fill-color: var(--muted);
  border: 1px solid var(--border); border-radius: 20px; padding: 1px 8px; white-space: nowrap;
}
.user-box { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.user-box .avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand-grad); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.user-box .uname { color: var(--text); font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-box .logout { color: var(--muted); font-size: 12.5px; border: 1px solid var(--border); border-radius: 8px; padding: 3px 10px; }
.user-box .logout:hover { color: var(--danger); border-color: #fecaca; background: #fef2f2; text-decoration: none; }

nav.tabs {
  max-width: 1280px; margin: 0 auto; padding: 6px 20px 0;
  display: flex; gap: 2px; flex-wrap: wrap;
}
nav.tabs a {
  padding: 8px 14px; margin-bottom: -1px; border-radius: 10px 10px 0 0;
  color: var(--muted); font-size: 14px; border-bottom: 2px solid transparent;
  transition: background .15s, color .15s;
}
nav.tabs a.active {
  color: var(--primary-dark); font-weight: 700;
  border-bottom-color: var(--primary); background: linear-gradient(180deg, transparent 60%, var(--primary-soft));
}
nav.tabs a:hover:not(.active) { background: #f1f5f9; color: var(--text); text-decoration: none; }

/* 汉堡按钮（仅移动端显示） */
.nav-toggle { display: none; }

main { max-width: 1280px; margin: 18px auto 0; padding: 0 20px 56px; }

/* ── 面板与卡片 ── */
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.panel h3 { margin: 0 0 14px; font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.panel h3::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--brand-grad); }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); transition: box-shadow .15s, transform .15s;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.card .label { font-size: 12px; color: var(--muted); }
.card .value { font-size: 22px; font-weight: 700; margin-top: 2px; }
.card .value.red { color: var(--danger); }
.card .value.green { color: var(--ok); }

.row { display: flex; gap: 16px; flex-wrap: wrap; }
.col { flex: 1; min-width: 320px; }
.chart { width: 100%; height: 360px; }
.chart.tall { height: 460px; }

/* ── 表格 ── */
.tbl-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
table.tbl th, table.tbl td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 6px 9px; text-align: center; vertical-align: middle; }
table.tbl th:last-child, table.tbl td:last-child { border-right: none; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl thead th { background: #f0f4f9; font-weight: 600; position: sticky; top: 0; }
table.tbl tbody tr:hover td { background: #f8fafc; }
.num-fixed { font-family: Consolas, "JetBrains Mono", monospace; font-weight: 600; letter-spacing: 2px; }
td.hit-red { background: #fee2e2 !important; color: var(--hit); font-weight: 700; }
td.nb-yellow { background: var(--nb); }

/* ── 表单 ── */
form.inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); }
input, select, textarea, button {
  font: inherit; padding: 7px 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
button.btn { background: var(--primary); color: #fff; border: none; cursor: pointer; font-weight: 600; padding: 8px 18px; box-shadow: var(--shadow); }
button.btn:hover { background: var(--primary-dark); }
button.btn.secondary { background: #eef2f7; color: var(--text); }
button.btn.danger { background: var(--danger); }
button.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: #fff; border: 1px solid var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: #f1f5f9; }

/* 数字选择器 */
.digit-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.digit-picker .dg {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); border-radius: 9px; cursor: pointer; user-select: none;
  background: #fff; font-weight: 700; transition: all .12s;
}
.digit-picker .dg:hover { border-color: var(--primary); }
.digit-picker .dg.on { background: var(--primary); color: #fff; border-color: var(--primary); transform: scale(1.05); }
.digit-picker .dg.on.kill { background: var(--danger); border-color: var(--danger); }
.picker-label { font-size: 12px; color: var(--muted); margin: 8px 0 3px; }

/* ── 结论框 / 提示 ── */
.verdict {
  background: var(--primary-soft); border: 1px solid #bfdbfe; border-left: 4px solid var(--primary);
  border-radius: 10px; padding: 12px 16px; margin-top: 12px; font-size: 13.5px;
}
.verdict.warn { background: var(--warn-bg); border-color: var(--warn-border); border-left-color: var(--warn-border); color: #92400e; }
.verdict.danger { background: #fee2e2; border-color: #fecaca; border-left-color: var(--danger); color: #991b1b; }

.notice { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.tag { display: inline-block; padding: 1px 9px; border-radius: 20px; font-size: 12px; background: #eef2f7; color: var(--muted); }
.tag.zu6 { background: #dbeafe; color: #1d4ed8; }
.tag.zu3 { background: #fef3c7; color: #92400e; }
.tag.baozi { background: #fee2e2; color: #991b1b; }
.tag.none { background: #fee2e2; color: #991b1b; }
.tag.weak { background: #fef3c7; color: #92400e; }
.tag.medium { background: #dbeafe; color: #1d4ed8; }
.tag.strong, .tag.ok { background: #dcfce7; color: #166534; }

/* ── 魔图矩阵 ── */
.motu-wrap { overflow-x: auto; }
table.motu-grid { border-collapse: collapse; margin: 0 auto; }
table.motu-grid td {
  width: 30px; height: 30px; min-width: 30px; text-align: center; border: 1px solid #eef1f5;
  font-family: Consolas, monospace; font-size: 13px; color: #94a3b8; background: #fff;
}
table.motu-grid td.hit { background: var(--hit); color: #fff; font-weight: 700; }
table.motu-grid td.nb { background: var(--nb); color: #92400e; font-weight: 600; }

/* ── 弹窗 ── */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px;
}
.modal {
  background: #fff; border-radius: 16px; max-width: 560px; width: 100%;
  padding: 24px 28px; box-shadow: 0 24px 64px rgba(0, 0, 0, .28);
  max-height: 86vh; overflow-y: auto;
}
.modal h2 { margin: 0 0 10px; font-size: 17px; }
.modal ul { padding-left: 20px; margin: 10px 0; }
.modal li { margin: 6px 0; font-size: 13.5px; color: #374151; }
.modal .actions { text-align: right; margin-top: 14px; }

/* ── 登录 / 注册页 ── */
.auth-shell {
  min-height: calc(100vh - 60px); display: flex; align-items: center; justify-content: center; padding: 24px 16px;
}
.auth-panel {
  width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: 0 12px 40px rgba(15, 23, 42, .12); overflow: hidden; margin: 24px auto;
}
.auth-panel .auth-head { background: var(--brand-grad); color: #fff; padding: 26px 24px 20px; text-align: center; }
.auth-panel .auth-head .logo { font-size: 34px; }
.auth-panel .auth-head h2 { margin: 6px 0 2px; font-size: 18px; }
.auth-panel .auth-head p { margin: 0; font-size: 12px; opacity: .8; }
.auth-panel .auth-body { padding: 22px 24px 26px; }
.auth-panel .field { margin-bottom: 14px; }
.auth-panel input { width: 100%; padding: 10px 12px; }
.auth-panel .btn { width: 100%; padding: 11px; font-size: 15px; margin-top: 4px; }

.muted { color: var(--muted); font-size: 12.5px; }
.mt { margin-top: 12px; }
.hidden { display: none !important; }
footer.site { text-align: center; color: var(--muted); font-size: 12px; padding: 18px 16px 24px; }

/* ============================================================
   移动端自适应（≤820px）
   ============================================================ */
@media (max-width: 820px) {
  .site-top { padding: 10px 12px 0; gap: 8px; }
  .site-title { font-size: 15px; }
  .site-title .sub { display: none; }
  .user-box .uname { display: none; }             /* 只留头像，省宽度 */
  .user-box .logout { padding: 3px 8px; }

  /* 汉堡按钮 */
  .nav-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
    width: 38px; height: 38px; padding: 8px; border: 1px solid var(--border);
    border-radius: 10px; background: #fff; cursor: pointer; flex: none;
  }
  .nav-toggle span { display: block; height: 2px; border-radius: 2px; background: var(--text); transition: transform .2s, opacity .2s; }
  .nav-toggle.on span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-toggle.on span:nth-child(2) { opacity: 0; }
  .nav-toggle.on span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  /* 抽屉导航：默认隐藏，点汉堡展开 */
  nav.tabs {
    display: none; flex-direction: column; gap: 0;
    padding: 4px 12px 12px; border-top: 1px dashed var(--border); margin-top: 8px;
  }
  nav.tabs.open { display: flex; }
  nav.tabs a {
    border-radius: 10px; border-bottom: none; padding: 11px 14px; font-size: 15px;
  }
  nav.tabs a.active { background: var(--primary-soft); color: var(--primary-dark); }

  main { margin-top: 12px; padding: 0 12px 48px; }
  .panel { padding: 14px; border-radius: 10px; }
  .grid-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card .value { font-size: 19px; }
  .col { min-width: 100%; }
  .chart { height: 300px; }
  .chart.tall { height: 380px; }

  /* 表格横向滚动（不换行，保持可读） */
  table.tbl { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  table.motu-grid td { width: 26px; height: 26px; min-width: 26px; font-size: 12px; }

  form.inline { gap: 8px; }
  form.inline .field { flex: 1 1 45%; min-width: 45%; }
  .digit-picker .dg { width: 40px; height: 40px; }        /* 触控目标加大 */
  .modal { padding: 18px; }
  .disclaimer-bar { font-size: 11px; padding: 4px 10px; }
}

/* 超窄屏（≤480px）：指标卡单列 */
@media (max-width: 480px) {
  .grid-cards { grid-template-columns: 1fr 1fr; }
  .site-title { font-size: 14px; }
}
