/* ==========================================================================
   SQL Lab — 设计系统
   浅色：Apple 白（#F2F2F7 底 + 纯白卡片）
   深色：纯黑底 + #1C1C1E 卡片
   ========================================================================== */

:root {
  --bg: #f2f2f7;
  --bg-blur: rgba(242, 242, 247, 0.72);
  --card: #ffffff;
  --card-sub: #f7f7f9;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #9a9aa0;
  --line: rgba(0, 0, 0, 0.07);
  --line-strong: rgba(0, 0, 0, 0.13);
  --tag-bg: rgba(118, 118, 128, 0.09);
  --code-bg: #f6f6f8;
  --code-text: #2b2b30;
  --mask: rgba(242, 242, 247, 0.55);

  --blue: #0071e3;
  --blue-soft: rgba(0, 113, 227, 0.1);
  --purple: #7c5cff;
  --purple-soft: rgba(124, 92, 255, 0.1);
  --green: #248a3d;
  --green-soft: rgba(36, 138, 61, 0.1);
  --orange: #c93400;
  --orange-soft: rgba(255, 149, 0, 0.12);
  --red: #d70015;
  --red-soft: rgba(215, 0, 21, 0.08);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px -12px rgba(0, 0, 0, 0.14);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.04), 0 18px 44px -20px rgba(0, 0, 0, 0.22);
  --shadow-lg: 0 24px 70px -30px rgba(0, 0, 0, 0.35);

  --r-lg: 26px;
  --r-md: 18px;
  --r-sm: 13px;
  --ease: cubic-bezier(0.22, 0.9, 0.25, 1);

  --tab-h: 62px;
  --bar-h: calc(var(--tab-h) + env(safe-area-inset-bottom));
  color-scheme: light;
}

[data-theme='dark'] {
  --bg: #000000;
  --bg-blur: rgba(0, 0, 0, 0.68);
  --card: #1c1c1e;
  --card-sub: #242426;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #7c7c82;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --tag-bg: rgba(255, 255, 255, 0.08);
  --code-bg: #121214;
  --code-text: #e8e8ed;
  --mask: rgba(0, 0, 0, 0.55);

  --blue: #0a84ff;
  --blue-soft: rgba(10, 132, 255, 0.18);
  --purple: #a78bfa;
  --purple-soft: rgba(167, 139, 250, 0.16);
  --green: #30d158;
  --green-soft: rgba(48, 209, 88, 0.16);
  --orange: #ff9f0a;
  --orange-soft: rgba(255, 159, 10, 0.16);
  --red: #ff453a;
  --red-soft: rgba(255, 69, 58, 0.16);

  --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 24px -16px rgba(0, 0, 0, 0.9);
  --shadow-md: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 20px 50px -24px rgba(0, 0, 0, 0.9);
  --shadow-lg: 0 30px 80px -30px rgba(0, 0, 0, 0.95);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

svg {
  width: 20px;
  height: 20px;
  flex: none;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro SC', 'SF Pro Text', 'PingFang SC',
    'Helvetica Neue', 'Microsoft YaHei', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
  overflow-x: hidden;
}

button {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}

a {
  color: var(--blue);
  text-decoration: none;
}

::selection {
  background: var(--blue-soft);
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}

.app {
  min-height: 100dvh;
}

.page {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 0 16px calc(var(--tab-h) + 26px + env(safe-area-inset-bottom));
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 62px;
  margin: 0 -20px 6px;
  padding: 0 20px;
  background: var(--bg-blur);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  letter-spacing: -0.015em;
  font-size: 15.5px;
}

.brand-mark {
  width: 27px;
  height: 27px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, #0a84ff, #6f5bff);
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(10, 132, 255, 0.7);
}
.brand-mark svg {
  width: 15px;
  height: 15px;
}

.topbar-spacer {
  flex: 1;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--text-2);
  transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}
.icon-btn:hover {
  background: var(--tag-bg);
  color: var(--text);
}
.icon-btn:active {
  transform: scale(0.94);
}
.icon-btn svg {
  width: 19px;
  height: 19px;
}

.avatar {
  height: 34px;
  padding: 0 12px 0 5px;
  border-radius: 99px;
  background: var(--card);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 550;
  box-shadow: var(--shadow-sm);
  max-width: 150px;
}
.avatar span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.avatar i {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 650;
  color: #fff;
  background: linear-gradient(150deg, #6f5bff, #0a84ff);
  font-style: normal;
}

/* ---------------- 首页 ---------------- */
.hero {
  padding: 22px 0 18px;
  position: relative;
}
.hero::before {
  content: '';
  position: absolute;
  left: -80px;
  top: -120px;
  width: 380px;
  height: 300px;
  background: radial-gradient(circle, rgba(0, 113, 227, 0.16), transparent 65%);
  filter: blur(20px);
  pointer-events: none;
  z-index: -1;
}
[data-theme='dark'] .hero::before {
  background: radial-gradient(circle, rgba(10, 132, 255, 0.22), transparent 65%);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 550;
  color: var(--text-3);
  letter-spacing: 0.02em;
}
.hero h1 {
  margin: 0;
  font-size: clamp(27px, 5vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.028em;
  font-weight: 700;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, #0a84ff, #7c5cff 60%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p.sub {
  margin: 10px 0 0;
  color: var(--text-2);
  font-size: 15px;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  margin: 20px 0 26px;
}
.stat {
  background: var(--card);
  padding: 13px 14px;
}
.stat b {
  display: block;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.stat b small {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  margin-left: 2px;
}
.stat span {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}

.section-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.feature {
  position: relative;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px 22px 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 214px;
}
.feature::after {
  content: '';
  position: absolute;
  inset: auto -18% -52% auto;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--tint, transparent), transparent 70%);
  opacity: 0.18;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}
.feature:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
}
.feature:hover::after {
  opacity: 0.32;
}
.feature:active {
  transform: scale(0.988);
}

.feature-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  background: var(--tint-soft, var(--tag-bg));
  color: var(--tint, var(--blue));
  border: 1px solid var(--line);
}
.feature-icon svg {
  width: 23px;
  height: 23px;
}

.feature-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.feature h2 {
  margin: 0 0 5px;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.feature p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.5;
}
.feature-foot {
  margin-top: auto;
  display: flex;
  padding-top: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.mini-bar {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: var(--tag-bg);
  overflow: hidden;
}
.mini-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--tint, var(--blue));
  transition: width 0.5s var(--ease);
}
.feature-arrow {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--tag-bg);
  color: var(--text-2);
  transition: transform 0.25s var(--ease), background 0.25s var(--ease);
}
.feature:hover .feature-arrow {
  transform: translateX(2px);
  background: var(--tint-soft, var(--tag-bg));
  color: var(--tint, var(--blue));
}
.feature-arrow svg {
  width: 14px;
  height: 14px;
}

.hint-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 22px;
  padding: 15px 17px;
  border-radius: var(--r-md);
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.65;
}
.hint-card b {
  color: var(--text);
  font-weight: 600;
}
.hint-card .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  margin-top: 8px;
  flex: none;
  box-shadow: 0 0 0 4px var(--green-soft);
}

/* ---------------- 阅读卡片 ---------------- */
.reader-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 0 10px;
}
.reader-head .title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 9px;
}
.reader-head h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reader-head .counter {
  font-size: 12.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.reader-progress {
  height: 3px;
  border-radius: 99px;
  background: var(--tag-bg);
  overflow: hidden;
  margin-bottom: 18px;
}
.reader-progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--purple));
  border-radius: 99px;
  transition: width 0.45s var(--ease);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.k-card {
  position: relative;
  padding: 28px 30px 26px;
  min-height: 340px;
  animation: cardIn 0.4s var(--ease);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.k-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 7px;
  background: var(--tag-bg);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 550;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.chip.accent {
  background: var(--blue-soft);
  color: var(--blue);
}
.chip.purple {
  background: var(--purple-soft);
  color: var(--purple);
}
.chip.ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
}

.diff {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.diff i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line-strong);
}
.diff i.on {
  background: var(--orange);
}
.diff-label {
  margin-left: 4px;
  font-size: 11.5px;
  color: var(--text-3);
}

.k-title {
  margin: 0 0 12px;
  font-size: clamp(21px, 3vw, 27px);
  line-height: 1.3;
  font-weight: 680;
  letter-spacing: -0.028em;
}

.k-summary {
  margin: 0;
  font-size: 15.5px;
  color: var(--text-2);
  line-height: 1.68;
}

.k-divider {
  height: 1px;
  background: var(--line);
  margin: 22px 0;
}

.k-content {
  font-size: 15.5px;
  color: var(--text);
  line-height: 1.78;
  transition: filter 0.35s var(--ease), opacity 0.35s var(--ease);
}
.k-content p {
  margin: 0 0 12px;
}
.k-content p:last-child {
  margin-bottom: 0;
}

.k-hidden {
  filter: blur(6px);
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
  max-height: 260px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
}

.reveal {
  position: relative;
  margin-top: -54px;
  padding-top: 54px;
  text-align: center;
}
.reveal-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 20px;
  border-radius: 99px;
  background: var(--text);
  color: var(--bg);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
}
.reveal-btn:hover {
  transform: translateY(-1px);
}
.reveal-btn:active {
  transform: scale(0.97);
}
.reveal-btn svg {
  width: 15px;
  height: 15px;
}
.reveal-tip {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text-3);
}

/* 代码块 */
.code-block {
  margin: 16px 0 18px;
  border-radius: var(--r-md);
  background: var(--code-bg);
  border: 1px solid var(--line);
  overflow: hidden;
}
.code-block header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 600;
}
.code-block header i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
}
pre.code {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: 'SF Mono', 'JetBrains Mono', Menlo, Consolas, 'Courier New', monospace;
  font-size: 12.8px;
  line-height: 1.75;
  color: var(--code-text);
  tab-size: 2;
}
pre.code code {
  font: inherit;
}
.code-out {
  margin: 0;
  padding: 10px 16px 12px;
  border-top: 1px dashed var(--line-strong);
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.65;
  white-space: pre-wrap;
}

.callout {
  display: flex;
  gap: 11px;
  margin: 18px 0 0;
  padding: 13px 15px;
  border-radius: var(--r-sm);
  background: var(--orange-soft);
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text);
}
.callout .callout-icon {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--orange);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  margin-top: 1px;
}
.callout b {
  color: var(--orange);
  font-weight: 650;
}
.callout.info {
  background: var(--blue-soft);
}
.callout.info .callout-icon {
  background: var(--blue);
}
.callout.info b {
  color: var(--blue);
}

/* 卡片底部小工具 */
.k-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-3);
}
.k-foot .mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--tag-bg);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 550;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.k-foot .mini-btn:hover {
  background: var(--line-strong);
  color: var(--text);
}
.k-foot .mini-btn.on {
  background: var(--blue-soft);
  color: var(--blue);
}
.k-foot .mini-btn svg {
  width: 13px;
  height: 13px;
}
.k-foot .spacer {
  flex: 1;
}

/* 底部操作栏 */
.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 55%, transparent);
  pointer-events: none;
}
.action-inner {
  pointer-events: auto;
  width: 100%;
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px;
  border-radius: 22px;
  background: var(--bg-blur);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.nav-btn {
  flex: 1;
  height: 46px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  transition: background 0.18s var(--ease), transform 0.18s var(--ease);
}
.nav-btn:hover {
  background: var(--tag-bg);
}
.nav-btn:active {
  transform: scale(0.97);
}
.nav-btn svg {
  width: 17px;
  height: 17px;
}
.nav-btn[disabled] {
  opacity: 0.32;
  pointer-events: none;
}
.nav-btn.primary[disabled] {
  opacity: 1;
  background: var(--tag-bg);
  color: var(--text-3);
}
.nav-btn.primary {
  background: var(--text);
  color: var(--bg);
}
.nav-btn.primary:hover {
  opacity: 0.9;
}
.bar-btn {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--text-2);
  transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}
.bar-btn:hover {
  background: var(--tag-bg);
  color: var(--text);
}
.bar-btn:active {
  transform: scale(0.94);
}
.bar-btn.on {
  color: #ff9f0a;
}
.bar-btn svg {
  width: 20px;
  height: 20px;
}
.bar-sep {
  width: 1px;
  height: 24px;
  background: var(--line-strong);
  margin: 0 2px;
}
.order-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 11px;
  border-radius: 99px;
  background: var(--tag-bg);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}
.order-pill svg {
  width: 13px;
  height: 13px;
}
.order-pill:hover {
  color: var(--text);
}

/* ---------------- 通用控件 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 22px;
  border-radius: 15px;
  font-size: 15px;
  font-weight: 600;
  background: var(--text);
  color: var(--bg);
  transition: transform 0.18s var(--ease), opacity 0.18s var(--ease);
}
.btn:hover {
  opacity: 0.92;
}
.btn:active {
  transform: scale(0.985);
}
.btn.block {
  width: 100%;
}
.btn.ghost {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.btn.accent {
  background: linear-gradient(120deg, #0a84ff, #6f5bff);
  color: #fff;
  box-shadow: 0 10px 24px -12px rgba(10, 132, 255, 0.75);
}
.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}
.btn svg {
  width: 17px;
  height: 17px;
}

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--tag-bg);
}
.segmented button {
  flex: 1;
  height: 36px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text-2);
  transition: all 0.2s var(--ease);
  white-space: nowrap;
  padding: 0 8px;
}
.segmented button.active {
  background: var(--card);
  color: var(--text);
  font-weight: 620;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
[data-theme='dark'] .segmented button.active {
  background: #48484a;
}

.count-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.count-chips button {
  min-width: 62px;
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card-sub);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 550;
  transition: all 0.18s var(--ease);
}
.count-chips button:hover {
  border-color: var(--line-strong);
}
.count-chips button.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
  font-weight: 650;
}

.switch {
  position: relative;
  width: 48px;
  height: 29px;
  border-radius: 99px;
  background: var(--line-strong);
  transition: background 0.25s var(--ease);
  flex: none;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: transform 0.25s var(--ease);
}
.switch.on {
  background: #34c759;
}
.switch.on::after {
  transform: translateX(19px);
}

/* ---------------- 弹层 / 面板 ---------------- */
.sheet-layer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-layer[hidden] {
  display: none;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(3px);
  animation: fadeIn 0.25s var(--ease);
}
[data-theme='dark'] .sheet-backdrop {
  background: rgba(0, 0, 0, 0.6);
}
.sheet {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 12px calc(12px + env(safe-area-inset-bottom));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 8px 20px 20px;
  box-shadow: var(--shadow-lg);
  animation: sheetUp 0.35s var(--ease);
  max-height: 86dvh;
  overflow-y: auto;
}
@keyframes sheetUp {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.sheet-grip {
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: var(--line-strong);
  margin: 4px auto 14px;
}
.sheet h3 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.sheet .sheet-sub {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-2);
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}
.setting-row:first-of-type {
  border-top: none;
}
.setting-row .txt {
  flex: 1;
  min-width: 0;
}
.setting-row .txt b {
  display: block;
  font-size: 14.5px;
  font-weight: 550;
}
.setting-row .txt span {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
  display: block;
  margin-top: 2px;
}
.setting-group {
  padding: 4px 0 12px;
  border-top: 1px solid var(--line);
}
.setting-group > label {
  display: block;
  font-size: 12.5px;
  color: var(--text-3);
  margin: 10px 0 8px;
  font-weight: 550;
}

/* ---------------- 刷题 ---------------- */
.setup-card {
  padding: 22px;
  margin-bottom: 14px;
}
.setup-card > h3 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 650;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
}
.setup-card > h3 span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
}
.setup-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.section-pick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.section-pick button {
  text-align: left;
  padding: 12px 14px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--card-sub);
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1.4;
  transition: all 0.18s var(--ease);
}
.section-pick button small {
  display: block;
  font-size: 11.5px;
  color: var(--text-3);
  font-weight: 500;
  margin-top: 2px;
}
.section-pick button.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}
.section-pick button.active small {
  color: var(--blue);
  opacity: 0.8;
}

.quiz-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0 12px;
}
.quiz-top .qcount {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.quiz-top .qcount span {
  color: var(--text-3);
  font-weight: 500;
}
.timer {
  font-size: 12.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  padding: 4px 9px;
  border-radius: 7px;
  background: var(--tag-bg);
}

.q-card {
  padding: 26px 28px 24px;
}
.q-stem {
  margin: 12px 0 22px;
  font-size: clamp(17px, 2.2vw, 20px);
  line-height: 1.55;
  font-weight: 620;
  letter-spacing: -0.015em;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px 15px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--card-sub);
  font-size: 14.5px;
  line-height: 1.6;
  transition: all 0.18s var(--ease);
  color: var(--text);
}
.option:hover:not(.locked) {
  border-color: var(--line-strong);
  background: var(--card);
  transform: translateY(-1px);
}
.option .letter {
  flex: none;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--tag-bg);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
  transition: all 0.18s var(--ease);
  margin-top: 1px;
}
.option .txt {
  flex: 1;
  min-width: 0;
  font-family: 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.option.picked {
  border-color: var(--blue);
  background: var(--blue-soft);
}
.option.correct {
  border-color: rgba(36, 138, 61, 0.55);
  background: var(--green-soft);
}
.option.correct .letter {
  background: var(--green);
  color: #fff;
}
.option.wrong {
  border-color: rgba(215, 0, 21, 0.45);
  background: var(--red-soft);
}
.option.wrong .letter {
  background: var(--red);
  color: #fff;
}
.option.locked {
  cursor: default;
}

.explain {
  margin-top: 18px;
  padding: 16px 17px;
  border-radius: 15px;
  background: var(--card-sub);
  border: 1px solid var(--line);
  animation: cardIn 0.32s var(--ease);
}
.explain .ex-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 7px;
}
.explain .ex-head .badge {
  height: 22px;
  padding: 0 9px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 650;
}
.explain .badge.ok {
  background: var(--green-soft);
  color: var(--green);
}
.explain .badge.no {
  background: var(--red-soft);
  color: var(--red);
}
.explain p {
  margin: 0;
  font-size: 13.8px;
  line-height: 1.75;
  color: var(--text-2);
}
.explain .ex-topic {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 结果页 */
.result-wrap {
  padding: 30px 0 0;
  text-align: center;
}
.ring {
  width: 168px;
  height: 168px;
  margin: 6px auto 4px;
  position: relative;
}
.ring svg {
  transform: rotate(-90deg);
  width: 168px;
  height: 168px;
}
.ring .ring-val {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0;
}
.ring .ring-val b {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.ring .ring-val b small {
  font-size: 17px;
  font-weight: 600;
  margin-left: 1px;
}
.ring .ring-val span {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 6px;
}
.result-title {
  margin: 14px 0 4px;
  font-size: 25px;
  font-weight: 680;
  letter-spacing: -0.03em;
}
.result-sub {
  margin: 0 0 24px;
  color: var(--text-2);
  font-size: 14px;
}
.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 20px;
}
.result-stats > div {
  background: var(--card);
  padding: 14px 8px;
}
.result-stats b {
  display: block;
  font-size: 20px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.result-stats span {
  font-size: 12px;
  color: var(--text-3);
}
.result-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

/* 错题本 */
.wrong-item {
  padding: 20px 22px;
  margin-bottom: 12px;
}
.wrong-item .w-stem {
  font-size: 15px;
  font-weight: 570;
  line-height: 1.6;
  margin: 10px 0 0;
}
.wrong-item .w-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 12px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--blue);
}
.wrong-item .w-body {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line-strong);
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text-2);
  animation: cardIn 0.28s var(--ease);
}
.wrong-item .w-body .ans {
  margin-bottom: 6px;
  color: var(--text);
}
.wrong-item .w-body .ans b {
  color: var(--green);
  font-weight: 650;
}
.w-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.tiny-btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 9px;
  background: var(--tag-bg);
  font-size: 12px;
  font-weight: 550;
  color: var(--text-2);
  transition: all 0.18s var(--ease);
}
.tiny-btn:hover {
  color: var(--text);
  background: var(--line-strong);
}
.tiny-btn.danger:hover {
  color: var(--red);
  background: var(--red-soft);
}

/* 空状态 */
.empty {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-2);
}
.empty .ico {
  width: 62px;
  height: 62px;
  margin: 0 auto 16px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text-3);
  box-shadow: var(--shadow-sm);
}
.empty .ico svg {
  width: 26px;
  height: 26px;
}
.empty h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--text);
  font-weight: 620;
}
.empty p {
  margin: 0 auto;
  font-size: 13.5px;
  max-width: 300px;
  line-height: 1.65;
}

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-wrap::before,
.login-wrap::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  pointer-events: none;
}
.login-wrap::before {
  width: 420px;
  height: 420px;
  background: rgba(10, 132, 255, 0.28);
  top: -140px;
  left: -120px;
}
.login-wrap::after {
  width: 380px;
  height: 380px;
  background: rgba(124, 92, 255, 0.24);
  bottom: -160px;
  right: -120px;
}
.login-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 34px 30px 30px;
  box-shadow: var(--shadow-lg);
  animation: cardIn 0.5s var(--ease);
}
.login-logo {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(150deg, #0a84ff, #6f5bff);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 12px 26px -12px rgba(10, 132, 255, 0.9);
  margin-bottom: 18px;
}
.login-logo svg {
  width: 26px;
  height: 26px;
}
.login-card h1 {
  margin: 0 0 6px;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.login-card p {
  margin: 0 0 24px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.6;
}
.field {
  position: relative;
  margin-bottom: 12px;
}
.field input {
  width: 100%;
  height: 52px;
  padding: 0 15px;
  border-radius: 14px;
  border: 1.5px solid var(--line-strong);
  background: var(--card-sub);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
.field input::placeholder {
  color: var(--text-3);
}
.field input:focus {
  border-color: var(--blue);
  background: var(--card);
  box-shadow: 0 0 0 4px var(--blue-soft);
}
.login-note {
  display: flex;
  gap: 8px;
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.6;
}
.login-note svg {
  width: 14px;
  height: 14px;
  flex: none;
  margin-top: 2px;
}
.form-error {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--red);
  min-height: 17px;
}

/* Toast */
.toast-layer {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bar-h) + 26px);
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 99px;
  background: rgba(28, 28, 30, 0.92);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
  animation: toastIn 0.28s var(--ease);
  max-width: 86vw;
}
[data-theme='dark'] .toast {
  background: rgba(245, 245, 247, 0.94);
  color: #1d1d1f;
}
.toast svg {
  width: 14px;
  height: 14px;
  flex: none;
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.toast.out {
  animation: toastOut 0.25s var(--ease) forwards;
}
@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-6px) scale(0.96);
  }
}

/* 骨架屏 */
.skeleton {
  border-radius: var(--r-lg);
  background: linear-gradient(100deg, var(--card) 30%, var(--card-sub) 50%, var(--card) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.4s infinite linear;
  border: 1px solid var(--line);
}
@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}
.sk-line {
  height: 14px;
  border-radius: 7px;
  background: var(--tag-bg);
  margin-bottom: 12px;
}

/* 页面切换动画 */
.page-enter {
  animation: pageIn 0.32s var(--ease);
}
@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* SQL 语法高亮 */
.t-kw {
  color: #0a5fbf;
  font-weight: 600;
}
.t-str {
  color: #0a7d43;
}
.t-num {
  color: #b35a00;
}
.t-com {
  color: var(--text-3);
  font-style: italic;
}
[data-theme='dark'] .t-kw {
  color: #7cb8ff;
}
[data-theme='dark'] .t-str {
  color: #7ee2a8;
}
[data-theme='dark'] .t-num {
  color: #ffb86c;
}

.order-pill.on {
  background: var(--blue-soft);
  color: var(--blue);
}

.tiny-btn svg,
.w-toggle svg,
.ex-topic svg {
  width: 13px;
  height: 13px;
  flex: none;
}
.tiny-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.w-toggle svg {
  transition: transform 0.22s var(--ease);
}
.w-toggle.open svg {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ==========================================================================
   移动端优先布局层
   基础 = 手机 App（单列、底部 Tab）；>=700px 放宽内容栏；>=900px Tab 变左侧竖栏
   ========================================================================== */

/* 顶栏 —— iOS 导航栏 */
.topbar {
  height: 54px;
  margin: 0 -16px 2px;
  padding: 0 16px;
  gap: 4px;
}
.brand {
  font-size: 15px;
  gap: 8px;
}
.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
}
.avatar {
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
  background: transparent;
  border: none;
  box-shadow: none;
  gap: 0;
  margin-left: 2px;
}
.avatar i {
  width: 32px;
  height: 32px;
  font-size: 13px;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

/* 首页 Hero */
.hero {
  padding: 12px 0 16px;
}
.hero::before {
  width: 260px;
  height: 210px;
  left: -72px;
  top: -96px;
}
.eyebrow {
  font-size: 12px;
  margin-bottom: 6px;
}
.hero h1 {
  font-size: 24px;
  line-height: 1.3;
}
.hero p.sub {
  font-size: 13.5px;
  margin-top: 6px;
}

/* 数据条 */
.stat-strip {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-radius: 18px;
  margin: 2px 0 20px;
}
.stat {
  padding: 12px 14px;
}
.stat b {
  font-size: 19px;
}
.stat span {
  font-size: 11.5px;
  margin-top: 1px;
  display: block;
}

.section-label {
  margin: 0 0 10px;
  font-size: 12px;
}
.section-label span {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

/* 模块入口：纵向列表 */
.feature-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.feature {
  min-height: 0;
  padding: 14px;
  border-radius: 20px;
  flex-direction: row;
  align-items: center;
  gap: 13px;
}
.feature::after {
  display: none;
}
.feature:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
  border-color: var(--line);
}
.feature:active {
  transform: scale(0.99);
}
.feature-icon {
  margin: 0;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  flex: none;
}
.feature-icon svg {
  width: 22px;
  height: 22px;
}
.feature-body {
  gap: 0;
}
.feature-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.feature-title {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.015em;
}
.feature-num {
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.feature-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-2);
}
.feature-foot {
  padding-top: 9px;
  margin-top: 9px;
  gap: 8px;
}
.mini-bar {
  height: 3px;
}
.feature-arrow {
  position: static;
  margin-left: 0;
  width: 18px;
  height: 18px;
  background: transparent;
  color: var(--text-3);
}
.feature-arrow svg {
  width: 16px;
  height: 16px;
}
.feature:hover .feature-arrow {
  transform: none;
  background: transparent;
  color: var(--text-3);
}

.hint-card {
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: 16px;
  font-size: 12.5px;
  line-height: 1.62;
  gap: 10px;
}

/* ---------------- 底部 Tab ---------------- */
.icon-btn.accent-soft {
  background: var(--blue-soft);
  color: var(--blue);
}
.icon-btn.accent-soft:hover {
  background: var(--blue-soft);
  color: var(--blue);
}
.rail-brand {
  display: none;
}
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--bg-blur);
  border-top: 1px solid var(--line);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 50px;
  border-radius: 14px;
  color: var(--text-3);
  transition: color 0.18s var(--ease), background 0.18s var(--ease), transform 0.18s var(--ease);
}
.tab-ico {
  display: grid;
  place-items: center;
  height: 24px;
}
.tab-ico svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.7;
}
.tab-label {
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: 0.01em;
}
.tab.active {
  color: var(--blue);
}
.tab.active .tab-ico svg {
  stroke-width: 2.1;
}
.tab:active {
  transform: scale(0.94);
}

/* ---------------- 阅读卡片 ---------------- */
.reader-page {
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
.reader-head {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  padding: 8px 0 6px;
  gap: 8px;
}
.reader-head .title {
  min-width: 0;
}
.kind-switch {
  width: 100%;
  max-width: 340px;
  justify-self: center;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 13px;
  background: var(--tag-bg);
}
.kind-switch button {
  flex: 1;
  height: 33px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  transition: all 0.2s var(--ease);
  white-space: nowrap;
  padding: 0 4px;
}
.kind-switch button.active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
[data-theme='dark'] .kind-switch button.active {
  background: #48484a;
}
.reader-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 2px 8px;
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.reader-meta .counter {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reader-meta-gap {
  flex: 1;
}
.reader-meta .order-pill {
  height: 30px;
  padding: 0 10px;
  font-size: 11.5px;
  background: var(--tag-bg);
}
.reader-progress {
  margin-bottom: 12px;
}
.k-card {
  padding: 20px 18px 18px;
  border-radius: 22px;
  min-height: 0;
}
.k-meta {
  gap: 6px;
  margin-bottom: 12px;
}
.k-title {
  font-size: 21px;
  line-height: 1.32;
  margin-bottom: 8px;
}
.k-summary {
  font-size: 14px;
  line-height: 1.65;
}
.k-divider {
  margin: 16px 0;
}
.k-content {
  font-size: 15px;
  line-height: 1.78;
}
.k-content p {
  margin-bottom: 11px;
}
.code-block {
  position: relative;
  margin: 14px 0 16px;
  border-radius: 14px;
}
.code-block::after {
  content: '';
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 26px;
  border-radius: 0 13px 13px 0;
  background: linear-gradient(to right, transparent, var(--code-bg) 70%);
  pointer-events: none;
}
pre.code {
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 480px) {
  pre.code {
    font-size: 11.6px;
  }
}
pre.code {
  padding: 12px 13px;
  font-size: 12.2px;
  line-height: 1.72;
}
.code-out {
  padding: 9px 13px 11px;
  font-size: 11.5px;
}
.callout {
  padding: 12px 13px;
  font-size: 13px;
  border-radius: 12px;
}
.k-foot {
  margin-top: 18px;
  padding-top: 14px;
}
.k-hidden {
  max-height: 220px;
}
.reveal {
  margin-top: -50px;
  padding-top: 50px;
}
.reveal-btn {
  height: 44px;
  padding: 0 22px;
  font-size: 14px;
}

/* 底部操作栏 */
.action-bar {
  padding: 8px 14px calc(10px + env(safe-area-inset-bottom));
}
.action-inner {
  max-width: 520px;
  padding: 6px;
  gap: 6px;
  border-radius: 22px;
}
.nav-btn {
  height: 46px;
  border-radius: 17px;
  font-size: 14px;
}
.nav-btn.primary {
  flex: 1.5;
}
.bar-btn {
  width: 48px;
  height: 46px;
  border-radius: 17px;
}

/* ---------------- 刷题设置 ---------------- */
.nav-head {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 16px 0 12px;
}
.nav-title {
  flex: 1;
  min-width: 0;
}
.nav-title h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.nav-title span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-3);
}
.setup-card {
  padding: 15px 15px 16px;
  border-radius: 20px;
  margin-bottom: 11px;
}
.setup-card > h3 {
  font-size: 13px;
  margin-bottom: 11px;
}
.segmented {
  border-radius: 13px;
}
.segmented button {
  height: 38px;
  font-size: 13px;
  border-radius: 10px;
  padding: 0 4px;
}
.count-chips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}
.count-chips button {
  min-width: 0;
  height: 42px;
  padding: 0;
  font-size: 13px;
  border-radius: 12px;
}
.section-pick {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.section-pick button {
  padding: 11px 12px;
  font-size: 13px;
  border-radius: 12px;
}
.login-note {
  font-size: 11.5px;
}
.sticky-cta {
  position: sticky;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
  z-index: 30;
  margin: 6px -16px 0;
  padding: 10px 16px 12px;
  background: var(--bg);
}
.entry-row {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin-top: 14px;
  border-radius: 20px;
  text-align: left;
}
.entry-row .feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}
.entry-row-main {
  flex: 1;
  min-width: 0;
}
.entry-row-main b {
  display: block;
  font-size: 14.5px;
  font-weight: 650;
}
.entry-row-main span {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  color: var(--text-2);
}
.entry-row > svg {
  color: var(--text-3);
  width: 16px;
  height: 16px;
}

/* 答题页 */
.quiz-page {
  padding-bottom: calc(86px + env(safe-area-inset-bottom));
}
.quiz-top {
  padding: 8px 0 10px;
  gap: 6px;
}
.quiz-top .qcount {
  font-size: 13px;
}
.quiz-top .qcount span {
  font-size: 12px;
}
.timer {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 8px;
}
.timer.ok {
  color: var(--green);
  background: var(--green-soft);
}
.q-card {
  padding: 16px 15px 18px;
  border-radius: 22px;
}
.q-stem {
  font-size: 17px;
  line-height: 1.55;
  margin: 10px 0 16px;
}
.option {
  padding: 12px;
  gap: 10px;
  border-radius: 14px;
  font-size: 14px;
}
.option .letter {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-size: 12px;
}
.option .txt {
  font-size: 12.5px;
}
.explain {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
}
.explain p {
  font-size: 13px;
}

/* 结果页 */
.result-wrap {
  padding: 22px 0 0;
}
.result-title {
  font-size: 22px;
}
.result-sub {
  font-size: 13px;
  margin-bottom: 20px;
}
.result-stats > div {
  padding: 13px 6px;
}
.result-stats b {
  font-size: 19px;
}

/* 错题本 */
.wrong-item {
  padding: 16px;
  border-radius: 20px;
  margin-bottom: 10px;
}
.wrong-item .w-stem {
  font-size: 14.5px;
  margin-top: 9px;
}

/* ---------------- 我的 ---------------- */
.profile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 2px 18px;
}
.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(150deg, #6f5bff, #0a84ff);
  box-shadow: 0 12px 24px -14px rgba(10, 132, 255, 0.9);
  flex: none;
}
.profile-main h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 680;
  letter-spacing: -0.02em;
}
.profile-main p {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--text-2);
}
.panel {
  padding: 2px 15px;
  border-radius: 20px;
  margin-bottom: 18px;
}
.panel .segmented {
  margin: 12px 0;
}
.panel .setting-row {
  padding: 13px 0;
}
.panel .setting-row .txt b {
  font-size: 14px;
}
.panel .setting-row .txt span {
  font-size: 11.5px;
}
.row-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 15px 0;
  font-size: 15px;
  font-weight: 550;
  color: var(--red);
}
.row-btn svg {
  width: 16px;
  height: 16px;
  color: var(--text-3);
}
.me-note {
  margin: 0;
  padding: 0 2px;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--text-3);
}

/* 登录 */
.login-wrap {
  padding: 20px;
}
.login-card {
  border-radius: 26px;
  padding: 30px 22px 26px;
}
.login-card h1 {
  font-size: 23px;
}
.login-card p {
  font-size: 13.5px;
  margin-bottom: 20px;
}
.field input {
  height: 50px;
  font-size: 16px;
}

/* ---------------- 平板 / 桌面 ---------------- */
@media (min-width: 700px) {
  .page {
    max-width: 660px;
    padding-left: 24px;
    padding-right: 24px;
  }
  .topbar {
    height: 62px;
    margin: 0 -24px 2px;
    padding: 0 24px;
  }
  .hero h1 {
    font-size: 29px;
  }
  .hero p.sub {
    font-size: 14.5px;
  }
  .stat-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .k-card {
    padding: 26px 26px 22px;
  }
  .k-title {
    font-size: 23px;
  }
  .k-content {
    font-size: 15.5px;
  }
  .q-card {
    padding: 22px 22px 20px;
  }
  .q-stem {
    font-size: 18.5px;
  }
  .sticky-cta {
    margin: 6px -24px 0;
    padding: 10px 24px 12px;
  }
  .reader-page,
  .quiz-page {
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }
}

/* 平板：Tab 收起为悬浮胶囊，避免四项被拉得过散 */
@media (min-width: 700px) and (max-width: 899px) {
  .tabbar {
    left: 50%;
    right: auto;
    bottom: calc(14px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: 440px;
    max-width: calc(100% - 32px);
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow-md);
  }
  .page {
    padding-bottom: calc(var(--tab-h) + 48px + env(safe-area-inset-bottom));
  }
  .sticky-cta {
    bottom: calc(var(--tab-h) + 22px + env(safe-area-inset-bottom));
  }
}

/* 桌面：Tab 变成左侧竖栏，内容居中 */
@media (min-width: 900px) {
  .app.with-tabs {
    padding-left: 96px;
  }
  .tabbar {
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: 96px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 0 10px;
    border-top: none;
    border-right: 1px solid var(--line);
  }
  .tab {
    width: 100%;
    height: 66px;
    border-radius: 16px;
    gap: 5px;
  }
  .tab:hover {
    background: var(--tag-bg);
  }
  .tab.active {
    background: var(--blue-soft);
  }
  .tab.active:hover {
    background: var(--blue-soft);
  }
  .tab-ico svg {
    width: 23px;
    height: 23px;
  }
  .tab-label {
    font-size: 11px;
  }
  .rail-brand {
    display: grid;
    position: absolute;
    top: 26px;
    left: 50%;
    transform: translateX(-50%);
    width: 38px;
    height: 38px;
    border-radius: 12px;
    place-items: center;
    color: #fff;
    background: linear-gradient(150deg, #0a84ff, #6f5bff);
    box-shadow: 0 10px 20px -10px rgba(10, 132, 255, 0.9);
  }
  .rail-brand svg {
    width: 20px;
    height: 20px;
  }
}
