/* 引信对决 · 运营后台设计系统
 *
 * 配色跟小游戏同一套（米白 + 深棕 + 暖橙），但**不照搬手机的厚度**：
 *   手机端一屏 4~6 个控件，2px 描边 + 硬投影有手工感；
 *   后台一屏 50+ 个控件，同样的处理会变成一堆黑框（像线框图）。
 *
 * 所以这里：浅描边 + 柔和阴影 + 小圆角，
 * 只把「纸的性格」留给主按钮和导航选中态。
 */
:root {
  --bg: #f7f1e3;
  --surface: #fffdf8;
  --surface-2: #faf5ea;

  --ink: #3b2f24;
  --ink-soft: #6b5c48;
  --ink-dim: #8a7a64;

  --line: #e6dcc9;
  --line-strong: #d9cbb6;

  --accent: #d9662f;
  --primary: #f5a05e;
  --primary-hover: #f7ad70;
  --gold: #c9922b;
  --ok: #2f9e7a;
  --bad: #d94f3d;

  --shadow: 0 1px 2px rgba(59, 47, 36, .05), 0 3px 10px rgba(59, 47, 36, .05);
  --shadow-lift: 0 2px 4px rgba(59, 47, 36, .06), 0 10px 26px rgba(59, 47, 36, .10);
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
.hide { display: none !important; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.side {
  width: 208px; flex: 0 0 208px; background: var(--surface);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  padding: 16px 18px 14px; font-weight: 800; font-size: 15px; letter-spacing: .3px;
  border-bottom: 1px solid var(--line); color: var(--ink);
}
.brand small { display: block; font-weight: 400; font-size: 11px; color: var(--ink-dim); margin-top: 2px; }
.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--ink-soft); font-size: 13.5px; margin-bottom: 2px; text-decoration: none;
  transition: background .12s, color .12s;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a.on {
  background: #fdeee0; color: var(--ink); font-weight: 700;
}
.nav a.on::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 2px; background: var(--accent);
}
.nav .ico { width: 16px; text-align: center; opacity: .7; font-size: 13px; }
.nav a.on .ico { opacity: 1; }
.side-foot { padding: 12px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-dim); }
.side-foot .row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.side-foot button { flex: 1; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 13px 24px;
  border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 15px; margin: 0; font-weight: 800; }
.topbar .sub { font-size: 12px; color: var(--ink-dim); }
.spacer { flex: 1; }
.view { padding: 20px 24px 60px; flex: 1; }

/* ---------- 通用控件 ---------- */
button, select, input[type=text], input[type=password], input[type=number], textarea {
  font-family: inherit; font-size: 13px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 7px 13px; outline: none;
  transition: border-color .12s, background .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--ink-dim); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(217, 102, 47, .12); }
button { cursor: pointer; font-weight: 600; background: var(--surface); }
button:hover { background: var(--surface-2); border-color: #c9b89f; }
button:active { background: #f3ece0; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary {
  background: var(--primary); border-color: var(--primary);
  color: #3a2410; font-weight: 800;
  box-shadow: 0 1px 2px rgba(59, 47, 36, .10);
}
button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
button.danger { color: var(--bad); border-color: #e9c3bd; }
button.danger:hover { background: #fdf1ef; border-color: var(--bad); }
button.sm { padding: 3px 10px; font-size: 12px; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; color: var(--ink-soft); font-weight: 600; }

/* ---------- 卡片 / 面板 ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.panel h2 { font-size: 14px; margin: 0 0 12px; font-weight: 800; }
.panel h2 span { font-weight: 400; font-size: 12px; color: var(--ink-dim); margin-left: 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.card .k { font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; font-weight: 600; }
.card .v { font-size: 25px; font-weight: 800; letter-spacing: .3px; }
.card .s { font-size: 11px; color: var(--ink-dim); margin-top: 4px; }

/* ---------- 表格 ---------- */
/* 不加外框：外框 + 面板边框会变成双层黑框 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-weight: 700; color: var(--ink-soft); font-size: 12px;
  padding: 9px 12px; border-bottom: 1px solid var(--line-strong);
  background: var(--surface-2); white-space: nowrap;
}
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fdf8ef; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { color: var(--ink-dim); font-size: 13px; padding: 26px 0; text-align: center; }

/* 表格里的操作按钮：去掉边框噪音，只在 hover 时显形 */
td .btnrow button { border-color: transparent; background: transparent; color: var(--ink-soft); }
td .btnrow button:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
td .btnrow button.primary { background: var(--primary); border-color: var(--primary); color: #3a2410; }
td .btnrow button.danger { color: var(--bad); }
td .btnrow button.danger:hover { background: #fdf1ef; border-color: #e9c3bd; }

/* ---------- 徽标 ---------- */
.tag {
  display: inline-block; padding: 1px 9px; border-radius: 6px;
  font-size: 11.5px; border: 1px solid var(--line-strong); color: var(--ink-soft);
  background: var(--surface); font-weight: 600;
}
.tag.ok { color: #1f7a5c; border-color: #b9e0d1; background: #eef8f4; }
.tag.warn { color: #96701a; border-color: #ecd6a8; background: #fdf6e6; }
.tag.bad { color: #b03a2b; border-color: #eec4bd; background: #fdf1ef; }
.tag.info { color: #2d6ba8; border-color: #c3d8ea; background: #eef4fa; }

/* ---------- 进度条 ---------- */
.barwrap { background: #efe6d6; border-radius: 999px; height: 6px; width: 100%; overflow: hidden; }
.bar { height: 6px; border-radius: 999px; background: var(--primary); min-width: 2px; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 12.5px; color: var(--ink-soft); }
.pager .spacer { flex: 1; }

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(59, 47, 36, .38); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  width: 100%; max-width: 560px; max-height: 86vh; overflow: auto;
  box-shadow: var(--shadow-lift);
}
.modal.wide { max-width: 860px; }
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px;
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 800; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- 提示 ---------- */
#toasts { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 9px 18px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lift); animation: toastIn .2s ease;
}
.toast.bad { border-color: #e9c3bd; color: var(--bad); }
.toast.ok { border-color: #b9e0d1; color: var(--ok); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 26px; box-shadow: var(--shadow-lift);
}
.login-card h1 { font-size: 18px; margin: 0 0 4px; font-weight: 800; }
.login-card p { margin: 0 0 20px; font-size: 12px; color: var(--ink-dim); }
.login-card input { width: 100%; margin-bottom: 12px; padding: 10px 13px; }
.login-card button { width: 100%; padding: 11px; }

/* ---------- 详情键值 ---------- */
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; font-size: 13px; }
.kv .k { color: var(--ink-soft); font-weight: 600; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.dim { color: var(--ink-soft); }
.bad { color: var(--bad); }
.ok { color: var(--ok); }
.warn { color: var(--gold); }

/* 关卡列表里的「道具出场」列：五项权重挤一格 */
.pool { display:flex; flex-wrap:wrap; gap:2px; }
.pool-it {
  display:inline-block; padding:0 4px; border-radius:4px; font-size:10.5px; line-height:1.5; white-space:nowrap;
  border:1px solid #e2d7c2; background:#faf5e8; color:#3b2f24; font-variant-numeric:tabular-nums;
}
.pool-it.off { color:#c2b6a0; border-color:#ece3d2; background:#fbf7ee; text-decoration:line-through; }
.pool-it.def { color:#a89a83; border-style:dashed; }
/* 关卡列表列多（14 列），必须 fixed：否则浏览器会把「操作」压成竖排。
   宽度加起来约 1380，超出容器时由 .table-wrap 横向滚动。 */
.lv-table { table-layout: fixed; min-width: 1560px; }
.lv-table th, .lv-table td { padding-left: 8px; padding-right: 8px; }
.lv-table td .btnrow { flex-wrap: nowrap; }
/* 关卡列表里的「章节」下拉：全局 select 是 padding:7px 13px（高约 32px），
   行内把 height 压到 26px 会把文字上下裁掉，所以这里显式给 padding/line-height。 */
.lv-table select.ch-sel {
  height: 26px;
  padding: 0 20px 0 7px;
  font-size: 12px;
  line-height: 24px;
  width: 100%;
  max-width: 138px;
}

/* 关卡分析表：劝退关整行淡红，通过率数字着色 */
.la-table { table-layout: fixed; min-width: 900px; }
.la-table td.bad, .la-table td .bad { color: #c0392b; }
.la-table tr.row-bad td { background: #fdf3f1; }

/* ---------- BI 数据看板 ---------- */
.bi-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1100px) { .bi-cards { grid-template-columns: repeat(2, 1fr); } }
.bi-card {
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 12px 14px; box-shadow: 0 2px 0 rgba(59,47,36,.06);
}
.bi-card-label { font-size: 12px; color: var(--ink-dim); }
.bi-card-value { font-size: 24px; font-weight: 800; line-height: 1.35; letter-spacing: .5px; }
.bi-card-delta { font-size: 12px; color: var(--ink-dim); min-height: 16px; }
.bi-card-delta .up { color: #2f9e7a; font-weight: 700; }
.bi-card-delta .down { color: #c0392b; font-weight: 700; }

.bi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bi-grid .bi-wide { grid-column: 1 / -1; }
@media (max-width: 1100px) { .bi-grid { grid-template-columns: 1fr; } }
.bi-chart { width: 100%; height: 300px; }
