/* ===== 基础 ===== */
* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
body {
  font-family:-apple-system,"PingFang SC","Microsoft YaHei",sans-serif;
  background:linear-gradient(180deg,#eef4ff 0%,#f7f9fe 30%,#f4f6fb 100%);
  background-attachment:fixed;
  color:#334155;
  min-height:100vh;
}
.hidden { display:none !important; }
.page { max-width:640px; margin:0 auto; padding:18px 16px 40px; }

/* 顶部渐变主色 */
:root { --pri:#4a7dff; --pri-dark:#3a67d6; --pri-light:#e4edff; }

/* ===== 登录页 ===== */
#login-page { display:flex; align-items:center; justify-content:center; min-height:100vh; padding:24px; }
.login-wrap { width:100%; max-width:400px; text-align:center; }
.login-logo { width:78px; height:78px; margin:0 auto 20px; border-radius:22px;
  background:linear-gradient(135deg,#4a7dff,#7aa5ff); display:flex; align-items:center; justify-content:center;
  box-shadow:0 12px 30px rgba(74,125,255,.35); font-size:38px; }
.login-card { background:rgba(255,255,255,.92); backdrop-filter:blur(8px); border-radius:24px; padding:34px 26px;
  box-shadow:0 16px 44px rgba(74,125,255,.12); border:1px solid rgba(255,255,255,.8); }
.login-card h1 { font-size:27px; margin-bottom:6px; color:#1e2a45; letter-spacing:1px; }
.login-card .sub { color:#8a95ad; margin-bottom:26px; font-size:14px; }
.login-card input { width:100%; padding:15px; border:2px solid #e4e9f5; border-radius:14px; font-size:16px; text-align:center;
  background:#f8faff; transition:.2s; color:#334155; }
.login-card input:focus { outline:none; border-color:var(--pri); background:#fff; box-shadow:0 0 0 4px rgba(74,125,255,.12); }
.login-card .btn { margin-top:20px; width:100%; padding:15px; font-size:16px; border-radius:14px; letter-spacing:2px; }
.err { color:#e04848; font-size:13px; margin-top:14px; min-height:18px; }
.login-foot { margin-top:18px; font-size:12px; color:#b0b9ce; }

/* ===== 按钮 ===== */
.btn { padding:11px 18px; border:none; border-radius:12px; font-size:15px; cursor:pointer; transition:.18s; font-weight:500; }
.btn.primary { background:linear-gradient(135deg,var(--pri),#6a96ff); color:#fff; font-weight:600;
  box-shadow:0 6px 16px rgba(74,125,255,.28); }
.btn.primary:active { transform:translateY(1px); box-shadow:none; }
.btn.ghost { background:#fff; color:var(--pri-dark); border:1px solid #cfdfff; font-size:13px; }
.btn.ghost:active { background:var(--pri-light); }
.btn.danger { background:#fff0f0; color:#e04848; font-size:12px; padding:6px 12px; border:none; }
.btn.mini { font-size:12px; padding:6px 14px; border-radius:9px; }

/* ===== 顶栏 ===== */
.app-header { background:linear-gradient(135deg,var(--pri),#6a96ff); border-radius:18px; padding:18px 20px;
  display:flex; justify-content:space-between; align-items:center;
  box-shadow:0 12px 28px rgba(74,125,255,.24); margin-bottom:18px; color:#fff; }
.app-header .logo { font-size:21px; font-weight:700; letter-spacing:1px; display:flex; align-items:center; gap:8px; }
.app-header .logo .book { filter:drop-shadow(0 2px 4px rgba(0,0,0,.15)); }
.app-header .actions { display:flex; gap:8px; }
.app-header .btn.ghost { background:rgba(255,255,255,.18); color:#fff; border:none; backdrop-filter:blur(4px); }
.app-header .btn.ghost:active { background:rgba(255,255,255,.26); }

/* ===== 添加卡片 ===== */
.add-card { background:#fff; border-radius:18px; padding:18px; box-shadow:0 8px 24px rgba(30,42,69,.06);
  border:1px solid #eef2fb; }
.add-head { display:flex; justify-content:space-between; align-items:baseline; margin-bottom:12px; font-weight:700; font-size:16px; color:#1e2a45; }
.add-head .tip { font-weight:400; font-size:12px; color:#a9b3c8; }
.add-card textarea { width:100%; padding:13px; border:2px solid #e9eef9; border-radius:12px; font-size:15px; line-height:1.7; resize:vertical; min-height:66px;
  background:#fafcff; transition:.2s; color:#334155; font-family:inherit; }
.add-card textarea:focus { outline:none; border-color:var(--pri); background:#fff; box-shadow:0 0 0 4px rgba(74,125,255,.1); }
textarea.ans-input { margin-top:10px; min-height:50px; }
.upload-row { display:flex; gap:10px; margin-top:12px; }
.upload-btn { flex:1; text-align:center; padding:14px; border:2px dashed #b7cdff; border-radius:12px; color:var(--pri-dark); font-size:15px; cursor:pointer; background:#f6f9ff; transition:.2s; }
.upload-btn:active { background:var(--pri-light); }
.upload-btn input { display:none; }
#save-btn { flex:0 0 auto; }

/* 预览 */
.preview { display:flex; flex-wrap:wrap; gap:8px; margin-top:14px; }
.preview .pimg { position:relative; }
.preview img { width:72px; height:72px; object-fit:cover; border-radius:10px; border:2px solid #fff; box-shadow:0 2px 8px rgba(0,0,0,.1); }
.preview .del { position:absolute; top:-7px; right:-7px; width:22px; height:22px; border-radius:50%; background:#e04848; color:#fff; font-size:13px; line-height:22px; text-align:center; cursor:pointer; box-shadow:0 2px 6px rgba(0,0,0,.2); }

/* ===== 列表 ===== */
.list { margin-top:24px; }
.list-head { display:flex; justify-content:space-between; align-items:center; margin:0 4px 6px; font-weight:700; font-size:16px; color:#1e2a45; }
.list-head span { color:var(--pri); }
.sel-tip { margin:2px 4px 12px; font-size:12px; color:#93a0bb; }
.questions { display:flex; flex-direction:column; gap:12px; }
.q-card { background:#fff; border-radius:16px; padding:14px 16px; box-shadow:0 6px 18px rgba(30,42,69,.05); border:1px solid #eef2fb; transition:.18s; }
.q-card:active { transform:scale(.99); }
.q-top { display:flex; align-items:flex-start; gap:10px; }
.q-check { flex:0 0 auto; padding-top:5px; }
.q-check input { width:20px; height:20px; accent-color:var(--pri); }
.q-badge { flex:0 0 auto; min-width:30px; height:30px; padding:0 8px; border-radius:10px; background:linear-gradient(135deg,var(--pri),#6a96ff); color:#fff; font-weight:700; font-size:14px; display:flex; align-items:center; justify-content:center; box-shadow:0 4px 10px rgba(74,125,255,.3); }
.q-content { flex:1; font-size:15px; line-height:1.75; word-break:break-word; color:#334155; padding-top:3px; }
.q-answer { margin-top:10px; padding:8px 12px; background:#f0faf5; border-left:3px solid #3fbf8b; border-radius:8px; font-size:13px; color:#1f9d6d; word-break:break-word; white-space:pre-wrap; }
.q-note { margin-top:8px; padding:8px 12px; background:#fff7e8; border-radius:8px; font-size:13px; color:#a07414; }
.q-imgs { display:flex; flex-wrap:wrap; gap:6px; margin-top:10px; }
.q-imgs img { max-width:100%; border-radius:10px; border:1px solid #eef2fb; }
.q-imgs.one img { border-radius:12px; }
.q-bottom { display:flex; justify-content:space-between; align-items:center; margin-top:12px; padding-top:10px; border-top:1px dashed #eef2fb; }
.q-date { font-size:11px; color:#b0b9ce; }
.q-bottom .btn.danger:active { background:#ffdcdc; }

/* 空状态 */
.empty { text-align:center; color:#aab6cf; padding:50px 0; }
.empty .empty-icon { font-size:52px; margin-bottom:14px; opacity:.8; }
.empty .empty-t { font-size:16px; font-weight:600; color:#8a95ad; margin-bottom:6px; }
.empty .empty-s { font-size:13px; color:#bdc6da; }

/* toast */
#toast { position:fixed; left:50%; bottom:70px; transform:translateX(-50%); background:rgba(30,42,69,.85); color:#fff; padding:11px 24px; border-radius:22px; font-size:14px; opacity:0; pointer-events:none; transition:.3s; z-index:999; backdrop-filter:blur(6px); box-shadow:0 8px 24px rgba(0,0,0,.2); }
#toast.show { opacity:1; }
#toast.loading { background:rgba(30,42,69,.92); }

/* ===== 变式 ===== */
.v-wrap { margin-top:10px; background:#f7f9ff; border:1px solid #e3eafc; border-radius:12px; padding:10px 12px; }
.v-head { display:flex; justify-content:space-between; align-items:center; font-size:13px; font-weight:600; color:#4a5d86; }
.v-count { display:inline-flex; min-width:20px; height:20px; padding:0 6px; align-items:center; justify-content:center; background:linear-gradient(135deg,var(--pri),#6a96ff); color:#fff; border-radius:10px; font-size:11px; margin-left:4px; }
.v-boxtools { margin-top:8px; }
.v-item { display:flex; align-items:flex-start; gap:8px; background:#fff; border:1px solid #eef2fb; border-radius:10px; padding:8px 10px; margin-top:8px; }
.v-badge { flex:0 0 auto; background:#eef3ff; color:var(--pri); font-size:11px; font-weight:600; padding:2px 8px; border-radius:8px; }
.v-body { flex:1; }
.v-text { font-size:13px; line-height:1.6; color:#475569; word-break:break-word; }
.v-item .q-answer { margin-top:6px; padding:5px 8px; font-size:12px; }
.v-item .q-imgs { margin-top:6px; gap:5px; }
.v-item .q-imgs img { max-height:140px; }
.v-del { flex:0 0 auto; margin-left:auto; }
.v-input { margin-top:10px; display:flex; flex-direction:column; gap:8px; }
.v-input .v-content { border:1px solid #dde5f8; border-radius:10px; padding:8px 10px; font-size:13px; resize:vertical; font-family:inherit; color:#334155; min-height:52px; }
.v-input .v-file { font-size:12px; color:#7c8db0; }
.v-input .v-save { align-self:flex-start; }


/* ---- 删除按钮(主题 .del-q / 变式 .del-v) 共用红色样式 ---- */
.btn.del-q, .btn.del-v { background:#fff0f0; color:#e04848; font-size:12px; padding:6px 12px; border:none; }
.btn.del-q:active, .btn.del-v:active { background:#ffdcdc; }
.q-bottom .btn.del-q { }

/* ---- 变式勾选框 ---- */
.v-check { flex:0 0 auto; padding-top:4px; }
.v-check input { width:17px; height:17px; accent-color:var(--pri); }

/* ---- 变式录入：答案输入 + 配图按钮 ---- */
.v-answer { border:1px solid #dde5f8; border-radius:10px; padding:8px 10px; font-size:13px; resize:vertical; font-family:inherit; color:#334155; }
.v-input .v-upload { flex:1; text-align:center; padding:10px; border:2px dashed #b7cdff; border-radius:10px; color:var(--pri); font-size:13px; cursor:pointer; }
.v-input .v-upload input { display:none; }


/* ===== 行内编辑（主题 + 变式）===== */
.edit-fields { display:block; margin:4px 0; }
.edit-fields textarea {
  width:100%; box-sizing:border-box; border:1px solid #d0d5e0; border-radius:8px;
  padding:8px 10px; font-size:14px; font-family:inherit; resize:vertical; margin-bottom:6px; background:#fff;
}
.edit-fields textarea:focus { outline:none; border-color:#4a7dff; box-shadow:0 0 0 2px rgba(74,125,255,.12); }
.edit-fields .ef-actions { display:flex; gap:8px; }
