/* 学习空间 · 样式（移动端优先，微信内浏览体验为主） */
:root {
  --brand: #4f7df3;
  --brand-dark: #3a63d0;
  --brand-soft: #eaf0ff;
  --accent: #ff9f43;
  --green: #2fbf71;
  --red: #f2545b;
  --ink: #1f2430;
  --ink-2: #5b647a;
  --ink-3: #8b93a7;
  --line: #e8ebf2;
  --bg: #f5f7fc;
  --card: #ffffff;
  --radius: 18px;
  --shadow: 0 6px 20px rgba(31, 36, 48, 0.07);
  --shadow-lg: 0 12px 32px rgba(31, 36, 48, 0.12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }

.wrap { max-width: 680px; margin: 0 auto; padding: 18px 16px 96px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(245, 247, 252, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 680px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
}
.topbar .back {
  width: 34px; height: 34px; border-radius: 50%; border: none; background: #fff;
  box-shadow: var(--shadow); font-size: 17px; cursor: pointer; color: var(--ink);
}
.topbar h1 { font-size: 16px; margin: 0; flex: 1; font-weight: 600; }
.topbar .right { font-size: 13px; color: var(--ink-3); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px;
}
.card h2 { font-size: 16px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--ink-3); font-size: 13px; }
.center { text-align: center; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 999px; padding: 12px 22px;
  font-size: 15px; font-weight: 600; font-family: inherit;
  background: var(--brand); color: #fff; cursor: pointer;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--brand); box-shadow: inset 0 0 0 1.5px var(--brand); }
.btn.gray { background: #eef1f7; color: var(--ink-2); }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.sm { padding: 8px 16px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- 登录页 ---------- */
.hero { text-align: center; padding: 56px 0 26px; }
.hero .logo {
  width: 84px; height: 84px; border-radius: 24px; margin: 0 auto 16px;
  background: linear-gradient(135deg, #5b8def, #8ab6ff);
  display: flex; align-items: center; justify-content: center; font-size: 42px;
  box-shadow: var(--shadow-lg);
}
.hero h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: 1px; }
.hero p { color: var(--ink-2); margin: 0; font-size: 14px; }
.login-box { margin-top: 20px; }
.wechat-btn { background: #07c160; }
.wechat-btn.is-disabled { background: #9fd9b6; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 12px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }

/* ---------- 表单 ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }
input[type="text"], select {
  width: 100%; padding: 12px 14px; font-size: 15px; font-family: inherit;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fbfcfe; color: var(--ink);
  outline: none; transition: border-color .15s;
}
input[type="text"]:focus, select:focus { border-color: var(--brand); background: #fff; }

.avatar-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.avatar-grid button {
  width: 48px; height: 48px; border-radius: 14px; border: 2px solid transparent;
  background: #f4f6fb; font-size: 24px; cursor: pointer; line-height: 1;
}
.avatar-grid button.on { border-color: var(--brand); background: var(--brand-soft); }

.grade-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grade-grid button {
  padding: 14px 0; border-radius: 14px; border: 1.5px solid var(--line);
  background: #fff; font-size: 15px; font-weight: 600; color: var(--ink-2); cursor: pointer; font-family: inherit;
}
.grade-grid button.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- 学习空间首页 ---------- */
.space-header {
  display: flex; align-items: center; gap: 14px; margin-bottom: 16px;
  background: linear-gradient(135deg, #5b8def, #7fa8ff 60%, #9fc0ff);
  border-radius: 22px; padding: 20px; color: #fff; box-shadow: var(--shadow-lg);
}
.space-header .face {
  width: 56px; height: 56px; border-radius: 18px; background: rgba(255,255,255,.22);
  display: flex; align-items: center; justify-content: center; font-size: 30px; flex: 0 0 auto;
}
.space-header .info { flex: 1; min-width: 0; }
.space-header h2 { margin: 0; font-size: 19px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-header p { margin: 2px 0 0; font-size: 13px; opacity: .9; }

.subject-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.subject {
  display: block; border-radius: 20px; padding: 20px 16px; color: #fff;
  box-shadow: var(--shadow); cursor: pointer; transition: transform .12s;
}
.subject:active { transform: scale(.98); }
.subject .ico { font-size: 30px; }
.subject h3 { margin: 8px 0 2px; font-size: 19px; }
.subject p { margin: 0; font-size: 12px; opacity: .92; }
.subject.chinese { background: linear-gradient(135deg, #ff8f6b, #ff6b6b); }
.subject.math { background: linear-gradient(135deg, #4f9cf9, #4f7df3); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.stats .item { background: #f7f9fe; border-radius: 14px; padding: 12px 6px; }
.stats .num { font-size: 22px; font-weight: 700; color: var(--brand-dark); }
.stats .lbl { font-size: 12px; color: var(--ink-3); }

/* ---------- 题目区 ---------- */
.q-card {
  background: linear-gradient(160deg, #ffffff, #f7faff);
  border-radius: 20px; padding: 22px; box-shadow: var(--shadow);
  border: 1px solid #eef2fb; margin-bottom: 14px;
}
.q-tag {
  display: inline-block; font-size: 11px; padding: 3px 10px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; margin-bottom: 12px;
}
.q-tag.local { background: #fff3e2; color: #b87333; }
.q-text { font-size: 19px; line-height: 1.8; font-weight: 600; white-space: pre-wrap; word-break: break-word; }
.q-answer {
  margin-top: 16px; padding: 14px; border-radius: 14px; background: #f2fbf5;
  border-left: 4px solid var(--green); font-size: 15px; white-space: pre-wrap; word-break: break-word;
}
.q-answer .k { color: var(--green); font-weight: 700; }
.q-jiexi { margin-top: 10px; font-size: 14px; color: var(--ink-2); white-space: pre-wrap; }
.q-jiexi b { color: var(--ink); }

/* ---------- 选项卡 ---------- */
.tabs {
  display: flex; gap: 6px; background: #eef1f8; padding: 5px; border-radius: 14px; margin-bottom: 16px;
}
.tabs button {
  flex: 1; border: none; background: transparent; padding: 9px 4px; border-radius: 10px;
  font-size: 14px; font-family: inherit; color: var(--ink-2); cursor: pointer; font-weight: 600;
}
.tabs button.on { background: #fff; color: var(--brand-dark); box-shadow: var(--shadow); }
.panel { display: none; }
.panel.on { display: block; }

/* ---------- 生字卡 ---------- */
.zi-card {
  background: #fff; border-radius: 20px; box-shadow: var(--shadow); padding: 26px; text-align: center;
  cursor: pointer; min-height: 250px; display: flex; flex-direction: column; justify-content: center;
}
.zi-card .zi { font-size: 96px; line-height: 1.1; font-weight: 600; font-family: "KaiTi", "STKaiti", "PingFang SC", serif; }
.zi-card .pinyin { font-size: 20px; color: var(--brand); letter-spacing: 2px; margin-top: 6px; }
.zi-card .hint { font-size: 13px; color: var(--ink-3); margin-top: 18px; }
.zi-detail { margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.zi-detail b { color: var(--ink); }

/* ---------- 练习（选择题） ---------- */
.options { display: grid; gap: 10px; margin-top: 16px; }
.options button {
  text-align: left; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line);
  background: #fff; font-size: 16px; font-family: inherit; cursor: pointer; color: var(--ink);
  transition: background .12s, border-color .12s;
}
.options button:active { background: #f5f8ff; }
.options button.right { border-color: var(--green); background: #eefaf3; color: #1d8a52; font-weight: 700; }
.options button.wrong { border-color: var(--red); background: #fdeef0; color: #c0343b; font-weight: 700; }
.options button:disabled { cursor: default; }

.feedback { margin-top: 14px; font-size: 15px; font-weight: 600; min-height: 22px; }
.feedback.ok { color: var(--green); }
.feedback.no { color: var(--red); }

/* ---------- 口算 ---------- */
.oral {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.oral .row {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 14px 12px; text-align: center;
}
.oral .expr { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.oral input {
  width: 100%; padding: 9px; font-size: 17px; text-align: center; font-family: inherit;
  border: 1.5px solid var(--line); border-radius: 10px; outline: none;
}
.oral input:focus { border-color: var(--brand); }
.oral .row.ok input { border-color: var(--green); background: #f0fbf5; }
.oral .row.no input { border-color: var(--red); background: #fdf1f2; }

/* ---------- 错题本 ---------- */
.wrong-item { border-bottom: 1px solid var(--line); padding: 14px 0; }
.wrong-item:last-child { border-bottom: none; }
.wrong-item .t { font-size: 15px; font-weight: 600; margin-bottom: 6px; white-space: pre-wrap; }
.wrong-item .a { font-size: 14px; color: #1d8a52; white-space: pre-wrap; }
.wrong-item .do { margin-top: 8px; display: flex; gap: 8px; }
.wrong-item.got { opacity: .55; }

/* ---------- 杂项 ---------- */
.empty { text-align: center; color: var(--ink-3); padding: 34px 0; font-size: 14px; }
.empty .big { font-size: 40px; display: block; margin-bottom: 8px; }
.loading { text-align: center; color: var(--ink-3); padding: 40px 0; font-size: 14px; }

#toast {
  position: fixed; left: 50%; bottom: 42px; transform: translate(-50%, 20px);
  background: rgba(31, 36, 48, .92); color: #fff; padding: 11px 20px; border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .22s; z-index: 99; max-width: 82vw; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.footer-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(255,255,255,.95); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  display: flex; padding: 6px 0 max(6px, env(safe-area-inset-bottom));
}
.footer-nav a {
  flex: 1; text-align: center; font-size: 11px; color: var(--ink-3); padding: 4px 0;
}
.footer-nav a .i { display: block; font-size: 20px; line-height: 1.2; }
.footer-nav a.on { color: var(--brand); font-weight: 700; }

.notice {
  background: #fff8e8; border: 1px solid #ffe3ad; color: #9a6b17;
  border-radius: 14px; padding: 12px 14px; font-size: 13px; margin-bottom: 14px;
}

/* ---------- 题库切换（普通题 / 奥数题） ---------- */
.seg { display: flex; gap: 8px; margin-bottom: 14px; }
.seg button {
  flex: 1; border: 1.5px solid var(--line); background: #fff; border-radius: 14px;
  padding: 10px 8px; font-size: 14px; font-weight: 600; font-family: inherit;
  color: var(--ink-2); cursor: pointer;
}
.seg button.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.seg button .cnt { font-size: 11px; opacity: .7; margin-left: 5px; font-weight: 400; }

/* ---------- 奥数题的信息 ---------- */
.q-tag.olympiad { background: #efe8ff; color: #6b46c1; }
.q-tag.diff { background: #fff1e6; color: #c05621; margin-left: 6px; }
.q-origin { font-size: 12px; color: var(--ink-3); margin-bottom: 10px; }
.q-know { margin-top: 12px; font-size: 12px; color: var(--ink-3); }
.verdict { font-size: 15px; font-weight: 700; margin-top: 14px; }
.verdict.ok { color: var(--green); }
.verdict.no { color: var(--red); }

/* ---------- 帮我做题 ---------- */
.upload {
  border: 2px dashed #c9d4ea; border-radius: 16px; background: #fafbff;
  padding: 22px 16px; text-align: center; cursor: pointer;
}
.upload.disabled { opacity: .55; }
.upload .up-ico { font-size: 30px; }
.upload .up-main { font-size: 15px; font-weight: 600; margin: 6px 0 2px; }
#upload-preview img {
  max-width: 100%; max-height: 320px; border-radius: 12px; display: block; margin: 0 auto 10px;
  box-shadow: var(--shadow);
}

textarea {
  width: 100%; padding: 12px 14px; font-size: 15px; font-family: inherit; line-height: 1.7;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fbfcfe; color: var(--ink);
  outline: none; resize: vertical; transition: border-color .15s;
}
textarea:focus { border-color: var(--brand); background: #fff; }

.answer {
  font-size: 15px; line-height: 1.85; white-space: pre-wrap; word-break: break-word; margin-top: 6px;
}
.answer .sec { display: inline-block; color: var(--brand-dark); font-weight: 700; margin-top: 8px; }
.answer .cursor { color: var(--ink-3); }
.ans-preview {
  white-space: pre-wrap; font-size: 13px; color: var(--ink-2); background: #f7f9fe;
  border-radius: 12px; padding: 12px; margin-top: 8px; max-height: 340px; overflow: auto;
}

/* 首页第三个入口：整行宽卡片 */
.subject.wide { display: block; text-align: left; }
.subject.solve { background: linear-gradient(135deg, #8b6cf6, #6f5bd8); }

/* ===== 备案号（工信部要求首页底部标注并链接）===== */
.beian { text-align: center; font-size: 12px; color: var(--ink-3); margin: 16px 0 88px; }
.beian a { color: inherit; text-decoration: none; }
.beian a:hover { text-decoration: underline; }
