/* ===== 拾题 · 设计系统 =====
   视觉基因取自两本教材封面：张宇1000题白底蓝字(#4080f8)、武忠祥正红(#f81028)。
   纸面白 + 张宇蓝为行动主色，武忠祥红留给「错题/批改/打卡印章」，绿给「掌握」。 */

:root {
  color-scheme: light;

  --paper: #f4f5f7;
  --card: #ffffff;
  --ink: #191c23;
  --ink-2: #565d6b;
  --ink-3: #9aa1ad;
  --line: #e3e7ee;
  --line-2: #d4d9e2;

  --blue: #2f63d0;
  --blue-deep: #20479c;
  --blue-soft: #e9f0fc;
  --blue-line: #bcd0f2;

  --red: #d73a2e;
  --red-soft: #fbeae8;

  --green: #2e9660;
  --green-soft: #e7f4ec;

  --amber: #c98a1b;
  --amber-soft: #faf0dd;

  --radius: 14px;
  --radius-sm: 10px;

  --shadow-card: 0 1px 2px rgba(25, 28, 35, 0.04), 0 4px 14px rgba(25, 28, 35, 0.05);
  --shadow-pop: 0 8px 30px rgba(25, 28, 35, 0.14);

  --font-mono: 'SF Mono', 'Cascadia Mono', Consolas, 'Roboto Mono', monospace;
}

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

html,
body,
#root {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family:
    -apple-system, 'PingFang SC', 'HarmonyOS Sans SC', 'MiSans', 'Noto Sans SC',
    'Microsoft YaHei', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

#root {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, p {
  margin: 0;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

input, select {
  font-family: inherit;
}

/* ---- 滚动条 ---- */
::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* ---- 通用卡片 ---- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

/* ---- 按钮 ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 18px;
  transition: transform 0.06s ease, background 0.15s ease;
  user-select: none;
}
.btn:active {
  transform: scale(0.97);
}
.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:disabled {
  background: #a9bce6;
}
.btn-soft {
  background: var(--blue-soft);
  color: var(--blue-deep);
}
.btn-ghost {
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--ink);
}
.btn-danger-soft {
  background: var(--red-soft);
  color: var(--red);
}

/* ---- 状态徽章 ---- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.5;
}
.chip-blue { background: var(--blue-soft); color: var(--blue-deep); }
.chip-red { background: var(--red-soft); color: var(--red); }
.chip-green { background: var(--green-soft); color: var(--green); }
.chip-amber { background: var(--amber-soft); color: var(--amber); }
.chip-gray { background: #eceef2; color: var(--ink-2); }

/* ---- 进度条 ---- */
.bar {
  height: 4px;
  border-radius: 999px;
  background: #e9ecf1;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--blue);
  transition: width 0.4s ease;
}

/* ---- 题号格（答题卡） ---- */
.numcell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  height: 40px;
  transition: transform 0.06s ease;
}
.numcell:active {
  transform: scale(0.93);
}
.numcell.ok {
  background: var(--green-soft);
  border-color: #b8dcc6;
  color: var(--green);
}
.numcell.wrong {
  background: var(--red-soft);
  border-color: #eec3bd;
  color: var(--red);
}
.numcell.doing {
  border-color: var(--blue-line);
  background: var(--blue-soft);
  color: var(--blue-deep);
}

/* ---- 印章 ---- */
.seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0;
  width: 84px;
  height: 84px;
  border: 2.5px solid var(--red);
  border-radius: 10px;
  color: var(--red);
  transform: rotate(-8deg);
  font-weight: 700;
  line-height: 1.25;
  opacity: 0.92;
  box-shadow: inset 0 0 0 1px rgba(215, 58, 46, 0.35);
}
.seal-anim {
  animation: sealIn 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
@keyframes sealIn {
  0% { transform: rotate(-8deg) scale(2.6); opacity: 0; }
  60% { transform: rotate(-8deg) scale(0.92); opacity: 1; }
  100% { transform: rotate(-8deg) scale(1); opacity: 0.92; }
}

/* ---- 底部标签栏 ---- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  max-width: 560px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 50;
}
.tabbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 9px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
}
.tabbar button.on {
  color: var(--blue);
}
.tabbar svg {
  display: block;
}

/* ---- 顶栏 ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(244, 245, 247, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.topbar h1 {
  font-size: 17px;
  font-weight: 700;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- 列表项 ---- */
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.row:first-child {
  border-radius: var(--radius) var(--radius) 0 0;
}
.row:last-child {
  border-radius: 0 0 var(--radius) var(--radius);
  border-bottom: none;
}
.row:only-child {
  border-radius: var(--radius);
  border-bottom: 1px solid transparent;
}
.row:active {
  background: #f7f9fc;
}

/* ---- 空状态 ---- */
.empty {
  padding: 56px 24px;
  text-align: center;
  color: var(--ink-3);
}
.empty .t {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
  margin-top: 12px;
}
.empty .d {
  font-size: 13px;
  margin-top: 4px;
  line-height: 1.6;
}

/* ---- 图片页 ---- */
.pageimg {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up {
  animation: fadeUp 0.3s ease both;
}

/* 平板：放宽内容宽度 */
@media (min-width: 768px) {
  #root {
    max-width: 720px;
  }
  .tabbar {
    max-width: 720px;
  }
}
