/* ============ 基础 ============ */
* { box-sizing: border-box; }
:root {
  --blue: #2563eb; --blue-d: #1d4ed8; --blue-l: #eff4ff; --blue-xl: #f6f9ff;
  --ink: #1f2937; --ink-2: #4b5563; --muted: #9ca3af;
  --line: #e5e7eb; --bg: #f7f8fa; --ok: #16a34a; --warn: #d97706; --err: #dc2626;
  --radius: 12px; --shadow: 0 4px 20px rgba(30,64,175,.08);
}
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.6; font-size: 15px;
}
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 10px 18px; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 600;
  transition: .15s;
}
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-d); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============ 顶栏 ============ */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.topbar-inner { display: flex; align-items: center; height: 60px; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--blue); color: #fff;
  display: grid; place-items: center; font-weight: 800; }
.nav { display: flex; gap: 22px; margin-left: 12px; }
.nav a { color: var(--ink-2); font-weight: 600; font-size: 14px; padding: 4px 2px; }
.nav a.active, .nav a:hover { color: var(--blue); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.badge { font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 700; }
.badge-free { background: #fef3c7; color: #92400e; }
.badge-basic { background: #dbeafe; color: #1e40af; }
.badge-full { background: #dcfce7; color: #166534; }
.badge-ai { background: #ede9fe; color: #6d28d9; }

/* ============ 落地页 ============ */
.hero { background: linear-gradient(135deg, #eef4ff, #f6f9ff); padding: 64px 0 56px; }
.hero h1 { font-size: 40px; line-height: 1.25; margin: 0 0 14px; font-weight: 800; }
.hero h1 .hl { color: var(--blue); }
.hero p.sub { font-size: 18px; color: var(--ink-2); margin: 0 0 26px; max-width: 640px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.section { padding: 56px 0; }
.section h2 { font-size: 28px; text-align: center; margin: 0 0 8px; }
.section .sub { text-align: center; color: var(--muted); margin: 0 0 36px; }

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card.hover:hover { box-shadow: var(--shadow); transform: translateY(-2px); transition: .15s; }
.card .icon { font-size: 26px; }
.card h3 { margin: 10px 0 6px; font-size: 17px; }
.card p { margin: 0; color: var(--ink-2); font-size: 14px; }

.pain { background: #fff; }
.levels { background: var(--blue-xl); }
.level-card { position: relative; }
.level-card .lv-no { font-size: 13px; color: var(--blue); font-weight: 800; }
.stars { color: #f59e0b; letter-spacing: 2px; font-size: 13px; }
.level-card .lv-name { font-size: 18px; font-weight: 800; margin: 4px 0; }
.level-card .lv-val { color: var(--ink-2); font-size: 13px; min-height: 42px; }
.tag-soon { position: absolute; top: 14px; right: 14px; font-size: 11px; background: #e5e7eb; color: #6b7280; padding: 2px 8px; border-radius: 999px; }
.level-card.locked { opacity: .75; }

.cmp-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
.cmp-table th, .cmp-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: center; font-size: 14px; }
.cmp-table th:first-child, .cmp-table td:first-child { text-align: left; font-weight: 700; }
.cmp-table thead { background: var(--blue); color: #fff; }
.cmp-table tbody tr:nth-child(even) { background: #fafbff; }

/* 定价 */
.price-card { display: flex; flex-direction: column; border: 2px solid var(--line); border-radius: 16px; padding: 26px 22px; background: #fff; position: relative; }
.price-card.hot { border-color: var(--blue); box-shadow: var(--shadow); }
.price-card .hot-tag { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--blue); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 14px; border-radius: 999px; }
.price-card .p-name { font-size: 20px; font-weight: 800; }
.price-card .p-price { font-size: 34px; font-weight: 800; color: var(--blue); margin: 10px 0 2px; }
.price-card .p-price small { font-size: 14px; color: var(--muted); font-weight: 500; }
.price-card .p-tag { color: var(--ink-2); font-size: 13px; min-height: 36px; }
.price-card ul { list-style: none; padding: 0; margin: 16px 0; flex: 1; }
.price-card li { padding: 7px 0 7px 22px; position: relative; font-size: 14px; border-bottom: 1px dashed var(--line); }
.price-card li::before { content: "✓"; color: var(--ok); position: absolute; left: 0; font-weight: 800; }
.ai-card { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 20px; border: 2px dashed var(--blue); }
.ai-card .ai-info { text-align: left; }
.faq-item { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq-item summary { cursor: pointer; font-weight: 700; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item p { margin: 8px 0 0; color: var(--ink-2); }

/* ============ 关卡大厅 ============ */
.page-head { padding: 28px 0 8px; }
.page-head h1 { font-size: 26px; margin: 0; }
.hub-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 18px; }

/* ============ 练习 · 仿真 Excel 工作簿 ============ */
.xl-app { display: flex; flex-direction: column; height: calc(100vh - 61px); }

/* 顶部状态栏 */
.xl-statusbar {
  flex: none; height: 44px; display: flex; align-items: center; gap: 14px;
  padding: 0 14px; background: #fff; border-bottom: 1px solid var(--line);
}
.xs-left { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.xs-lv { font-weight: 800; font-size: 14px; white-space: nowrap; }
.xs-diff { font-size: 12px; color: var(--muted); white-space: nowrap; }
.xs-mid { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex: 1; justify-content: center; }
.xs-qt { font-weight: 800; font-size: 13px; color: var(--blue); white-space: nowrap; }
.xs-title { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xs-right { display: flex; align-items: center; gap: 8px; }
.xs-side-toggle { font-size: 14px; padding: 6px 10px; }

/* 主体两栏 */
.xl-main { flex: 1; display: flex; min-height: 0; }
.xl-main.side-hidden .xl-side { display: none; }

/* 左侧：网格区域（不包卡片，直接铺满） */
.xl-grid-area { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; background: #fff; }
.xl-fxbar { flex: none; position: relative; display: flex; align-items: stretch; background: #fff; border-bottom: 1px solid #d4d4d4; }
.xl-namebox {
  width: 92px; flex: none; display: flex; align-items: center; justify-content: center;
  font-family: ui-monospace, Consolas, monospace; font-size: 13px; font-weight: 700; color: var(--ink);
  border-right: 1px solid #d4d4d4; cursor: default; user-select: none;
}
.xl-fx {
  flex: none; display: flex; align-items: center; padding: 0 10px; font-size: 13px;
  font-style: italic; font-family: Georgia, serif; color: #666; border-right: 1px solid #d4d4d4; user-select: none;
}
#fx {
  flex: 1; border: none; outline: none; padding: 8px 10px; min-width: 0;
  font-family: ui-monospace, Consolas, monospace; font-size: 14px; color: var(--ink); background: #fff;
}
#fx:focus { background: #fffdf2; }

/* 网格滚动区 */
.xl-scroll { flex: 1; overflow: auto; position: relative; background: #fff; }
table.xl-sheet {
  border-collapse: separate; border-spacing: 0; table-layout: fixed;
  font-family: Calibri, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 13px;
}
.xl-sheet th, .xl-sheet td {
  border-right: 1px solid #e3e3e3; border-bottom: 1px solid #e3e3e3;
  padding: 0 5px; height: 24px; line-height: 24px; white-space: nowrap;
  overflow: hidden; text-align: left; font-weight: 400;
}
.xl-sheet td { cursor: cell; background: #fff; }
.xl-sheet thead th {
  position: sticky; top: 0; z-index: 5; background: #f0f0f0; color: #555;
  text-align: center; border-bottom: 1px solid #c9c9c9; border-right: 1px solid #d9d9d9;
  position: sticky; user-select: none;
}
.xl-sheet thead th.corner { left: 0; z-index: 6; }
.xl-sheet thead th.ch { position: relative; }
.xl-sheet thead th.ch.hl { background: #dff0e4; color: #1a6b40; }
.xl-sheet thead th.ch .rsz {
  position: absolute; right: -4px; top: 0; width: 8px; height: 100%;
  cursor: col-resize; z-index: 7;
}
.xl-sheet thead th.ch .rsz:hover { background: rgba(33,115,70,.35); }
.xl-sheet tbody th.rh {
  position: sticky; left: 0; z-index: 4; background: #f0f0f0; color: #555;
  text-align: center; border-right: 1px solid #d9d9d9; user-select: none; width: 42px;
}
.xl-sheet tbody th.rh.hl { background: #dff0e4; color: #1a6b40; }
/* 目标单元格 + 闪烁引导 */
.xl-sheet td.target { background: #fff8dc; }
@keyframes xflash { 0%, 100% { box-shadow: inset 0 0 0 0 rgba(245,158,11,0); } 50% { box-shadow: inset 0 0 0 3px #f59e0b; } }
.xl-sheet td.flash { animation: xflash .5s ease 4; }
.cell-err { color: #dc2626; font-weight: 700; }

/* 选中框 + 填充柄 + 编辑器（绝对定位覆盖层） */
.xl-selbox {
  position: absolute; display: none; pointer-events: none; z-index: 3;
  border: 2px solid #217346; background: rgba(33,115,70,.07);
}
.xl-selbox .xl-fill {
  position: absolute; right: -4px; bottom: -4px; width: 8px; height: 8px;
  background: #217346; border: 1px solid #fff; cursor: crosshair; pointer-events: auto;
}
.xl-editor {
  position: absolute; z-index: 8; border: 2px solid #217346; outline: none;
  padding: 0 4px; font-family: Calibri, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 13px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.18);
}

/* 底部提示条 */
.xl-hintbar {
  flex: none; padding: 5px 12px; font-size: 12px; color: var(--muted);
  background: #fafafa; border-top: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 右侧面板 */
.xl-side {
  width: 360px; flex: none; display: flex; flex-direction: column; gap: 12px;
  border-left: 1px solid var(--line); background: var(--bg); overflow-y: auto; padding: 12px;
}
.side-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex: none; }
.sc-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; font-weight: 700; font-size: 14px; cursor: pointer; background: #fbfcfe;
  border-bottom: 1px solid var(--line);
}
.side-card.folded .sc-head { border-bottom: none; }
.sc-fold { border: none; background: none; cursor: pointer; font-size: 12px; color: var(--muted); padding: 2px 4px; }
.side-card.folded .sc-body { display: none; }
.sc-body { padding: 12px; }
.fb-wait { font-size: 13px; color: var(--ink-2); background: var(--blue-xl); border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; }

/* 题目卡片内容（沿用） */
.pmeta { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.chip { font-size: 12px; background: var(--blue-l); color: var(--blue-d); padding: 3px 10px; border-radius: 999px; font-weight: 700; }
.scene { background: var(--blue-xl); border-left: 3px solid var(--blue); padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 10px; }
.task { font-size: 14px; font-weight: 600; }
.task .target { color: var(--blue-d); background: #fde68a; padding: 1px 6px; border-radius: 5px; font-weight: 800; }

/* 迷你 AI 对话 */
.chat-mini { height: 260px; padding: 10px; }
.chat-input-mini { margin-top: 8px; }
.chat-input-mini input { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.chat-input-mini input:focus { outline: none; border-color: var(--blue); }

/* 移动端 / 窄屏简化 */
@media (max-width: 1100px) {
  .xl-app { height: auto; }
  .xl-main { flex-direction: column; }
  .xl-scroll { height: 56vh; }
  .xl-side { width: 100%; border-left: none; border-top: 1px solid var(--line); }
  .xs-title { display: none; }
}

/* 自动补全（fx 栏下方） */
.xl-fxbar .ac-list {
  position: absolute; top: 100%; left: 132px; right: 0; z-index: 30;
  background: #fff; border: 1px solid var(--line); border-radius: 0 0 8px 8px;
  box-shadow: var(--shadow); max-height: 220px; overflow: auto;
}
.ac-item { padding: 7px 12px; cursor: pointer; font-family: ui-monospace, monospace; font-size: 13px; }
.ac-item:hover { background: var(--blue-l); }
.ac-item small { color: var(--muted); margin-left: 8px; font-family: sans-serif; }

.step-box { border: 1px dashed var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.step-box .step-title { font-weight: 700; margin-bottom: 8px; }
.opt-btn { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 9px 12px; margin-bottom: 8px; cursor: pointer; font-size: 14px; }
.opt-btn:hover { border-color: var(--blue); }
.opt-btn.right { background: #ecfdf5; border-color: #6ee7b7; }
.opt-btn.wrong { background: #fef2f2; border-color: #fca5a5; }
.step-hint { font-size: 13px; color: var(--ink-2); background: var(--blue-xl); padding: 8px 10px; border-radius: 8px; margin-top: 6px; }
.step-actions { display: flex; gap: 8px; margin-top: 10px; }

/* 反馈 */
.feedback { border-radius: 10px; padding: 14px; margin-top: 6px; }
.feedback.pass { background: #ecfdf5; border: 1px solid #6ee7b7; }
.feedback.pass-better { background: #fffbeb; border: 1px solid #fcd34d; }
.feedback.fail { background: #fef2f2; border: 1px solid #fca5a5; }
.fb-title { font-weight: 800; font-size: 16px; margin-bottom: 8px; }
.fb-msg { padding: 8px 0; border-top: 1px dashed rgba(0,0,0,.08); }
.fb-msg:first-of-type { border-top: none; }
.fb-msg .mt { font-weight: 700; }
.fb-msg.success .mt { color: var(--ok); }
.fb-msg.error .mt { color: var(--err); }
.fb-msg.warn .mt { color: var(--warn); }
.fb-msg.tip .mt { color: var(--blue); }
.ref-toggle { margin-top: 10px; }
.ref-box { margin-top: 10px; background: var(--blue-xl); border-radius: 8px; padding: 12px; }
.ref-box .rp { padding: 5px 0; border-bottom: 1px dashed var(--line); }
.ref-box .rp:last-child { border-bottom: none; }
.ref-box .rp b { font-family: ui-monospace, monospace; color: var(--blue-d); }
.ref-box .rp span { color: var(--ink-2); font-size: 13px; }
.kp-card { margin-top: 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 13px; }
.kp-card b { color: var(--blue-d); }

.qnav { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 8px; }
.qnav .qcount { font-weight: 700; font-size: 14px; }

/* 助教面板（右栏内嵌） */
.assist-mini { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.assist-mini .a-title { font-weight: 800; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }

/* ============ 智能助教整页 ============ */
.assist-page { max-width: 820px; margin: 0 auto; padding: 18px 0 40px; }
.chat { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; height: 60vh; overflow: auto; padding: 16px; }
.bubble { max-width: 80%; padding: 10px 14px; border-radius: 14px; margin-bottom: 12px; font-size: 14px; white-space: pre-wrap; }
.bubble.user { background: #eef2f7; margin-left: auto; border-bottom-right-radius: 4px; }
.bubble.bot { background: var(--blue-l); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 8px; margin-top: 12px; }
.chat-input textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-family: inherit; font-size: 14px; }
.quick-q { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.quick-q .q { font-size: 13px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; background: #fff; }
.quick-q .q:hover { border-color: var(--blue); color: var(--blue); }
.ai-limit { font-size: 12px; color: var(--muted); margin-top: 6px; text-align: right; }

/* ============ 我的 / 解锁 ============ */
.unlock-box { max-width: 460px; margin: 24px auto; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 14px; }
.field input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; letter-spacing: 1px; }
.ent-list { list-style: none; padding: 0; margin: 10px 0; }
.ent-list li { padding: 8px 0; border-bottom: 1px dashed var(--line); display: flex; justify-content: space-between; }
.wrong-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }

/* ============ 后台 ============ */
.admin { max-width: 960px; margin: 0 auto; padding: 18px 0 40px; }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; font-size: 13px; }
.admin-table th, .admin-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.admin-table th { background: #f1f5fb; }
.code-cell { font-family: ui-monospace, monospace; font-weight: 700; }
.stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin: 16px 0; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; text-align: center; }
.stat .n { font-size: 26px; font-weight: 800; color: var(--blue); }
.stat .l { font-size: 12px; color: var(--muted); }

/* ============ 弹层 / 提示 ============ */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { background: #fff; border-radius: 16px; max-width: 560px; width: 100%; padding: 24px; max-height: 88vh; overflow: auto; }
.modal h3 { margin: 0 0 12px; }
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .25s; z-index: 200; font-size: 14px; }
.toast.show { opacity: 1; }
.locked-note { text-align: center; color: var(--ink-2); padding: 30px 0; }
.locked-note .big { font-size: 40px; }
@media (max-width: 760px) { .grid-4, .grid-3, .hub-grid { grid-template-columns: 1fr; } .grid-2 { grid-template-columns: 1fr; } }
