/* 法考每日一题 · 刷题网站样式 */
:root {
  --primary: #2b5ce6;
  --primary-dark: #1e46b8;
  --primary-light: #eaf0ff;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2733;
  --text-2: #5b6675;
  --text-3: #99a3b1;
  --border: #e5e9f0;
  --green: #16a34a;
  --green-bg: #eafaf0;
  --red: #dc2626;
  --red-bg: #fdeeee;
  --amber: #d97706;
  --amber-bg: #fdf5e7;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 35, 70, 0.07), 0 4px 16px rgba(20, 35, 70, 0.05);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  padding-bottom: 70px;
}
button { font-family: inherit; cursor: pointer; }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 960px; margin: 0 auto; padding: 0 16px;
  height: 58px; display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; cursor: pointer; }
.brand small { display: block; font-weight: 400; font-size: 11px; color: var(--text-3); line-height: 1.2; }
.logo {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, #2b5ce6, #5a83f2);
  color: #fff; font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.nav-desktop { display: flex; gap: 4px; margin-left: 8px; }
.nav-desktop button {
  border: 0; background: none; padding: 8px 14px; border-radius: 9px;
  font-size: 14px; color: var(--text-2);
}
.nav-desktop button:hover { background: var(--primary-light); color: var(--primary); }
.nav-desktop button.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.topbar-right { margin-left: auto; }
.total-info { font-size: 12px; color: var(--text-3); }

/* ===== 布局 ===== */
.container { max-width: 960px; margin: 0 auto; padding: 20px 16px 40px; }
.page { display: none; }
.page.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
.section-title { font-size: 17px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.section-title .sub { font-size: 12px; font-weight: 400; color: var(--text-3); }

/* ===== 筛选栏 ===== */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.filter-bar select, .filter-bar input[type="date"], .filter-bar input[type="search"] {
  border: 1px solid var(--border); border-radius: 9px; background: #fff;
  padding: 8px 10px; font-size: 13px; color: var(--text); font-family: inherit;
  outline: none;
}
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--primary); }
.filter-bar input[type="search"] { flex: 1; min-width: 160px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  border: 1px solid var(--border); background: #fff; color: var(--text-2);
  border-radius: 999px; padding: 5px 14px; font-size: 13px;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.filter-result { font-size: 12px; color: var(--text-3); margin-bottom: 12px; }
.btn-reset { border: 0; background: none; color: var(--primary); font-size: 12px; }

/* ===== 题目列表 ===== */
.q-item {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; margin-bottom: 12px; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
  border-left: 4px solid transparent;
}
.q-item:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(20,35,70,.1); }
.q-item.done-right { border-left-color: var(--green); }
.q-item.done-wrong { border-left-color: var(--red); }
.q-item .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; align-items: center; }
.q-item .stem { font-size: 14px; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tag {
  display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 999px;
  background: var(--primary-light); color: var(--primary); font-weight: 500;
}
.tag.t-type-multi { background: var(--amber-bg); color: var(--amber); }
.tag.t-type-single { background: var(--green-bg); color: var(--green); }
.tag.t-date { background: #f0f2f6; color: var(--text-2); }
.tag.t-teacher { background: #efe9fd; color: #7c3aed; }
.tag.t-status-right { background: var(--green-bg); color: var(--green); }
.tag.t-status-wrong { background: var(--red-bg); color: var(--red); }

/* ===== 每日一题页 ===== */
.daily-hero {
  background: linear-gradient(135deg, #2b5ce6 0%, #5a83f2 60%, #7b9cf5 100%);
  color: #fff; border-radius: var(--radius); padding: 24px; margin-bottom: 16px;
}
.daily-hero h2 { font-size: 20px; margin-bottom: 4px; }
.daily-hero .date { font-size: 13px; opacity: .85; }
.daily-hero .streak { margin-top: 12px; font-size: 13px; background: rgba(255,255,255,.16); display: inline-block; padding: 4px 12px; border-radius: 999px; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.calendar .day-label { text-align: center; font-size: 11px; color: var(--text-3); padding: 4px 0; }
.cal-cell {
  aspect-ratio: 1; border-radius: 8px; font-size: 12px; border: 0; background: #f0f2f6; color: var(--text-3);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.cal-cell.has-q { background: var(--primary-light); color: var(--primary); font-weight: 600; cursor: pointer; }
.cal-cell.has-q:hover { background: var(--primary); color: #fff; }
.cal-cell.done { background: var(--green-bg); color: var(--green); }
.cal-cell.done::after { content: "✓"; position: absolute; bottom: 1px; right: 4px; font-size: 8px; }
.cal-cell.today { outline: 2px solid var(--primary); outline-offset: 1px; }
.cal-cell.empty { background: transparent; }
.cal-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cal-nav button { border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: 4px 12px; font-size: 13px; color: var(--text-2); }
.cal-nav .month { font-weight: 700; font-size: 15px; }

/* ===== 做题模态 ===== */
.modal-mask {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 25, 50, .45); backdrop-filter: blur(3px);
  align-items: flex-start; justify-content: center; padding: 24px 12px; overflow-y: auto;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 640px;
  padding: 22px; position: relative; margin: auto 0;
  animation: pop .2s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.quiz-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; padding-right: 30px; }
.close-x {
  position: absolute; top: 14px; right: 16px; border: 0; background: #f0f2f6;
  width: 30px; height: 30px; border-radius: 50%; font-size: 15px; color: var(--text-2);
}
.close-x:hover { background: var(--red-bg); color: var(--red); }
.quiz-stem { font-size: 15px; font-weight: 500; margin-bottom: 16px; }
.quiz-stem .num { color: var(--primary); font-weight: 700; }
.opt {
  display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left;
  border: 1.5px solid var(--border); background: #fff; border-radius: 11px;
  padding: 11px 13px; font-size: 14px; margin-bottom: 9px; color: var(--text);
  transition: all .12s ease; line-height: 1.55;
}
.opt:hover { border-color: var(--primary); background: var(--primary-light); }
.opt .k {
  flex: none; width: 24px; height: 24px; border-radius: 50%; font-size: 13px; font-weight: 600;
  background: #f0f2f6; color: var(--text-2); display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.opt.sel { border-color: var(--primary); background: var(--primary-light); }
.opt.sel .k { background: var(--primary); color: #fff; }
.opt.right { border-color: var(--green); background: var(--green-bg); }
.opt.right .k { background: var(--green); color: #fff; }
.opt.wrong { border-color: var(--red); background: var(--red-bg); }
.opt.wrong .k { background: var(--red); color: #fff; }
.opt:disabled { cursor: default; }
.quiz-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.btn {
  border: 0; border-radius: 10px; padding: 10px 20px; font-size: 14px; font-weight: 600;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.btn-ghost { background: #f0f2f6; color: var(--text-2); }
.btn-ghost:hover { background: #e5e9f0; }
.result-banner { border-radius: 11px; padding: 12px 15px; font-size: 14px; font-weight: 600; margin-top: 14px; }
.result-banner.ok { background: var(--green-bg); color: var(--green); }
.result-banner.no { background: var(--red-bg); color: var(--red); }
.analysis-box { margin-top: 14px; background: #f8f9fc; border: 1px solid var(--border); border-radius: 11px; padding: 14px 16px; }
.analysis-box h4 { font-size: 13px; color: var(--primary); margin-bottom: 6px; }
.analysis-box p { font-size: 13.5px; color: var(--text-2); white-space: pre-wrap; }
.analysis-box a { color: var(--primary); font-size: 13px; }
.quiz-nav { display: flex; justify-content: space-between; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.quiz-nav button { border: 0; background: none; color: var(--primary); font-size: 13px; font-weight: 600; }
.quiz-nav button:disabled { color: var(--text-3); cursor: not-allowed; }

/* ===== 统计页 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-box { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; text-align: center; }
.stat-box .v { font-size: 26px; font-weight: 800; color: var(--primary); }
.stat-box .l { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 13px; }
.bar-row .name { width: 110px; flex: none; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.bar-row .track { flex: 1; height: 9px; background: #f0f2f6; border-radius: 999px; overflow: hidden; }
.bar-row .fill { height: 100%; background: linear-gradient(90deg, #2b5ce6, #5a83f2); border-radius: 999px; }
.bar-row .val { width: 66px; flex: none; font-size: 12px; color: var(--text-3); }

/* ===== 空状态 ===== */
.empty { text-align: center; padding: 44px 16px; color: var(--text-3); }
.empty .ico { font-size: 40px; margin-bottom: 8px; }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(16px);
  background: rgba(30, 40, 60, .92); color: #fff; font-size: 13px;
  border-radius: 999px; padding: 9px 20px; opacity: 0; pointer-events: none;
  transition: all .25s ease; z-index: 200; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

/* ===== 移动端 ===== */
.nav-mobile { display: none; }
@media (max-width: 720px) {
  .nav-desktop { display: none; }
  .topbar-right { display: flex; align-items: center; gap: 10px; }
  .total-info { display: none; }
  .nav-mobile {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: rgba(255,255,255,.95); backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .nav-mobile .inner { display: flex; }
  .nav-mobile button {
    flex: 1; border: 0; background: none; padding: 7px 0 6px; font-size: 11px; color: var(--text-3);
    display: flex; flex-direction: column; align-items: center; gap: 1px;
  }
  .nav-mobile button .ic { font-size: 19px; }
  .nav-mobile button.active { color: var(--primary); font-weight: 600; }
  .container { padding: 14px 12px 30px; }
  .card { padding: 16px; }
  .bar-row .name { width: 84px; font-size: 12px; }
  .modal { padding: 18px 16px; }
}

/* ===== 登录 / 注册 门控 ===== */
.auth-gate {
  display: none;
  position: fixed; inset: 0; z-index: 300;
  background: rgba(15, 25, 50, .42); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
  padding: 24px 16px; overflow-y: auto;
}
.auth-gate.show { display: flex; animation: fadeIn .2s ease; }
.auth-card {
  background: #fff; border-radius: 18px; width: 100%; max-width: 380px;
  padding: 26px 24px; box-shadow: 0 12px 40px rgba(20, 35, 70, .18);
  animation: pop .22s ease;
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.auth-brand .logo {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, #2b5ce6, #5a83f2); color: #fff;
  font-size: 20px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.auth-brand-text { font-weight: 700; font-size: 16px; }
.auth-brand-text small { display: block; font-weight: 400; font-size: 11px; color: var(--text-3); }
.auth-tabs { display: flex; gap: 6px; background: #f0f2f6; border-radius: 10px; padding: 4px; margin-bottom: 18px; }
.auth-tabs button {
  flex: 1; border: 0; background: none; padding: 9px 0; border-radius: 8px;
  font-size: 14px; color: var(--text-2); font-weight: 600;
}
.auth-tabs button.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); }
.auth-form { display: block; }
.auth-form[hidden] { display: none; }
.auth-form label { display: block; font-size: 13px; color: var(--text-2); margin: 12px 0 6px; font-weight: 600; }
.auth-form input {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 13px; font-size: 14px; color: var(--text); font-family: inherit; outline: none;
  transition: border-color .12s ease;
}
.auth-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.auth-error { min-height: 18px; margin: 10px 0 4px; font-size: 12.5px; color: var(--red); }
.auth-submit { width: 100%; margin-top: 6px; padding: 12px; font-size: 15px; }
.auth-submit:disabled { opacity: .6; cursor: not-allowed; }
.auth-hint { text-align: center; font-size: 12.5px; color: var(--text-3); margin-top: 14px; }
.auth-hint a { color: var(--primary); font-weight: 600; text-decoration: none; }

/* 顶栏用户区 */
.user-area { display: inline-flex; align-items: center; gap: 8px; }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #2b5ce6, #5a83f2); color: #fff;
  font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.user-name { font-size: 13px; color: var(--text-2); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-logout {
  border: 1px solid var(--border); background: #fff; color: var(--text-2);
  border-radius: 8px; padding: 4px 12px; font-size: 12px;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }
