:root {
  color-scheme: light;
  /* 强调 */
  --cyan: #22d3ee;
  --cyan-deep: #0891b2;
  --violet: #818cf8;
  --magenta: #f472b6;
  /* 文字 */
  --ink: #1e293b;
  --ink-strong: #0f172a;
  --muted: #64748b;
  /* 背景与面板 */
  --bg-1: #eef2fb;
  --bg-2: #f5f7fc;
  --panel: #ffffff;
  --line: #e6eaf2;
  --field: #fbfcfe;
  /* 语义（保留含义，换现代表达） */
  --ok: #10b981;
  --ok-soft: rgba(16, 185, 129, 0.09);
  --ok-line: #34d399;
  --err: #e11d48;
  --err-soft: #fff1f3;
  --err-line: #fecdd3;
  --warn: #f59e0b;
  --warn-soft: #fffbeb;
  --warn-line: #fde68a;
  /* 暗色答案面板 */
  --dark: #0f172a;
  --dark-ink: #cbd5e1;
  --dark-accent: #67e8f9;
  /* 形状 */
  --r-card: 18px;
  --r-ctrl: 12px;
  --r-chip: 8px;
  --shadow: 0 18px 44px rgba(30, 41, 59, 0.10);
  --shadow-sm: 0 6px 18px rgba(30, 41, 59, 0.06);
  --ring: 0 0 0 3px rgba(34, 211, 238, 0.16);
  --neon: linear-gradient(90deg, #22d3ee, #818cf8, #f472b6);
  --font: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  color: var(--ink);
  font-family: var(--font);
  letter-spacing: 0;
}

/* 背景角落光晕：纯伪元素，零 DOM */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(640px 300px at 95% -6%, rgba(34, 211, 238, 0.16), transparent 60%),
    radial-gradient(560px 280px at 2% 3%, rgba(244, 114, 182, 0.13), transparent 60%);
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  background: rgba(255, 255, 255, 0.66);
  backdrop-filter: blur(8px);
  border-right: 1px solid var(--line);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #fff;
  box-shadow: 0 10px 22px rgba(34, 211, 238, 0.4);
}

.brand-mark svg {
  width: 28px;
  height: 28px;
}

.brand-mark path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.parent-panel h3,
.done-panel h3 {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 800;
  background: linear-gradient(90deg, var(--cyan-deep), #7c3aed);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.3px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  position: relative;
  border: 0;
  width: 100%;
  background: transparent;
  color: var(--muted);
  border-radius: var(--r-ctrl);
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 14px;
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  transition: background 0.16s, color 0.16s, box-shadow 0.16s;
}

.nav-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 4px;
  height: 22px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--cyan), var(--violet));
  transition: transform 0.16s;
}

.nav-item:hover {
  background: rgba(34, 211, 238, 0.08);
  color: var(--ink-strong);
}

.nav-item.active {
  background: #fff;
  color: var(--cyan-deep);
  box-shadow: var(--shadow-sm);
}

.nav-item.active::before {
  transform: translateY(-50%) scaleY(1);
}

.nav-item:disabled {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  cursor: default;
  opacity: 0.64;
}

.icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: currentColor;
}

.icon svg {
  width: 20px;
  height: 20px;
}

.icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.ghost-button,
.secondary-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: var(--r-ctrl);
  min-height: 48px;
  padding: 0 14px;
  font-weight: 700;
  transition: border-color 0.15s, box-shadow 0.15s, color 0.15s;
}

.ghost-button:hover,
.secondary-button:hover {
  border-color: var(--cyan);
  color: var(--cyan-deep);
  box-shadow: var(--ring);
}

.main-area {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.date-label {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 7px;
  letter-spacing: 0.3px;
}

.topbar h2 {
  font-size: 28px;
  line-height: 1.15;
  font-weight: 900;
  color: var(--ink-strong);
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.checkin-card {
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.checkin-q {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 800;
  color: var(--ink-strong);
}

.checkin-q-sub {
  margin-top: 16px;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
}

.checkin-q-sub span {
  font-weight: 600;
}

.checkin-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.checkin-chip,
.post-chip {
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s, color 0.15s;
}

.checkin-chip:hover,
.checkin-chip:focus-visible,
.post-chip:hover,
.post-chip:focus-visible {
  border-color: var(--cyan);
  box-shadow: var(--ring);
  outline: none;
}

.checkin-chip.active,
.post-chip.active {
  background: linear-gradient(135deg, var(--cyan), var(--cyan-deep));
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.checkin-chip.ghost.active {
  background: linear-gradient(135deg, var(--violet), var(--magenta));
  box-shadow: var(--shadow-sm);
}

.checkin-skip {
  min-height: 44px;
  margin-top: 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 4px 0;
}

.checkin-skip:hover,
.checkin-skip:focus-visible {
  color: var(--cyan-deep);
  outline: none;
}

.checkin-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.checkin-summary span {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink-strong);
  font-variant-numeric: tabular-nums;
}

.checkin-redo {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  border-radius: var(--r-ctrl);
  min-height: 44px;
  padding: 0 16px;
  font-weight: 700;
}

.checkin-redo:hover,
.checkin-redo:focus-visible {
  border-color: var(--cyan);
  color: var(--cyan-deep);
  box-shadow: var(--ring);
  outline: none;
}

.status-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

/* 共享面板基底 */
.checkin-card,
.status-tile,
.parent-panel,
.study-card,
.paper-panel,
.paper-question-card,
.done-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}

.status-tile {
  position: relative;
  min-height: 78px;
  padding: 16px 16px 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.status-tile::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--cyan), var(--violet));
}

.status-tile:nth-child(2)::before {
  background: linear-gradient(180deg, var(--violet), var(--magenta));
}

.status-tile span,
.answer-block span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.status-tile strong {
  font-size: 28px;
  line-height: 1;
  font-weight: 900;
  color: var(--ink-strong);
  font-variant-numeric: tabular-nums;
}

.study-card {
  position: relative;
  min-height: 410px;
  padding: 26px 24px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  grid-template-rows: auto 1fr auto auto;
  gap: 18px 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* 卡片顶部霓虹条（学习卡 + 真题卡） */
.study-card::before,
.paper-question-card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: var(--neon);
}

.card-meta {
  grid-column: 1 / 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: var(--r-chip);
  background: rgba(129, 140, 248, 0.14);
  color: #4f46e5;
  font-size: 13px;
  font-weight: 700;
}

.card-meta span:first-child {
  background: rgba(34, 211, 238, 0.14);
  color: var(--cyan-deep);
}

.card-visual {
  grid-column: 2 / 3;
  grid-row: 1 / 4;
  align-self: start;
  min-height: 180px;
  max-height: 360px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctrl);
  background: #fff;
  display: block;
  overflow: hidden;
}

.card-visual img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: contain;
}

.study-card.no-visual {
  grid-template-columns: minmax(0, 1fr);
}

.prompt-block {
  grid-column: 1 / 2;
  min-height: 150px;
}

#cardPrompt {
  margin: 0;
  max-width: 780px;
  font-size: 30px;
  line-height: 1.45;
  font-weight: 800;
  color: var(--ink-strong);
}

.choice-list {
  margin-top: 22px;
  display: grid;
  gap: 10px;
}

/* choice-option：字母在文本里（"A. xxx"），无独立 badge → 整体卡片化 */
.choice-option {
  position: relative;
  border: 1px solid var(--line);
  background: var(--field);
  border-radius: var(--r-ctrl);
  min-height: 48px;
  padding: 12px 14px 12px 16px;
  text-align: left;
  color: var(--ink);
  line-height: 1.4;
  font-size: 16px;
  font-weight: 600;
  transition: border-color 0.16s, box-shadow 0.16s, transform 0.16s, background 0.16s;
}

.choice-option:hover {
  border-color: var(--cyan);
  box-shadow: var(--ring);
  transform: translateX(3px);
}

.choice-option:disabled {
  cursor: default;
}

.choice-option:disabled:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--line);
}

.choice-option.selected {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 1px var(--cyan);
}

.choice-option.correct {
  background: var(--ok-soft);
  border-color: var(--ok-line);
  color: #0f5132;
}

.choice-option.wrong {
  background: var(--err-soft);
  border-color: var(--err-line);
  color: #9f1239;
}

.answer-block {
  grid-column: 1 / 2;
  position: relative;
  padding: 16px 16px 16px 19px;
  background: var(--dark);
  border-radius: var(--r-ctrl);
  overflow: hidden;
}

.answer-block::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}

.answer-block span {
  color: var(--dark-accent);
  font-weight: 800;
  letter-spacing: 1px;
}

.answer-block p {
  margin: 8px 0 0;
  color: var(--dark-ink);
  font-size: 18px;
  line-height: 1.6;
}

.card-controls {
  grid-column: 1 / 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.study-card.no-visual .card-controls {
  grid-column: 1;
}

.primary-button,
.rating {
  border: 0;
  border-radius: var(--r-ctrl);
  min-height: 48px;
  padding: 0 18px;
  color: #fff;
  font-weight: 800;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s, background 0.15s;
}

.primary-button {
  background: linear-gradient(135deg, var(--cyan), var(--cyan-deep));
  box-shadow: 0 8px 16px rgba(8, 145, 178, 0.35);
}

.primary-button:hover {
  filter: brightness(1.07);
  transform: translateY(-2px);
}

.rating-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.rating {
  background: #fff;
  border: 1px solid transparent;
}

.rating:hover {
  transform: translateY(-2px);
}

.rating.again {
  background: var(--err-soft);
  border-color: var(--err-line);
  color: var(--err);
}

.rating.again:hover {
  background: var(--err);
  color: #fff;
  box-shadow: 0 8px 16px rgba(225, 29, 72, 0.3);
}

.rating.hard {
  background: var(--warn-soft);
  border-color: var(--warn-line);
  color: #b45309;
}

.rating.hard:hover {
  background: var(--warn);
  color: #fff;
  box-shadow: 0 8px 16px rgba(245, 158, 11, 0.3);
}

.rating.good {
  background: linear-gradient(135deg, var(--cyan), var(--cyan-deep));
  color: #fff;
  box-shadow: 0 8px 16px rgba(8, 145, 178, 0.35);
}

.rating.good:hover {
  filter: brightness(1.07);
}

.done-panel {
  min-height: 320px;
  padding: 34px 22px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 10px;
  box-shadow: var(--shadow);
}

.done-icon {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--cyan), var(--ok));
  box-shadow: 0 10px 24px rgba(16, 185, 129, 0.35);
}

.done-icon svg {
  width: 46px;
  height: 46px;
}

.done-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.done-panel h3 {
  font-size: 26px;
  color: var(--ink-strong);
}

.done-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.post-feedback {
  margin-top: 8px;
  display: grid;
  gap: 12px;
  justify-items: center;
}

.post-feedback-q {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.post-feedback-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.post-feedback .checkin-skip {
  margin-top: 0;
}

.done-panel .post-feedback-thanks {
  margin: 8px 0 0;
  color: var(--ink-strong);
  font-size: 17px;
  font-weight: 700;
}

.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--r-ctrl);
  font-weight: 700;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s, background 0.15s;
}

.filter:hover {
  border-color: var(--cyan);
  color: var(--cyan-deep);
}

.filter.active {
  background: linear-gradient(135deg, var(--cyan), var(--cyan-deep));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 14px rgba(8, 145, 178, 0.3);
}

.paper-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.paper-panel {
  padding: 18px;
  display: grid;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.paper-select {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.paper-select select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink);
  border-radius: var(--r-ctrl);
  min-height: 44px;
  padding: 0 10px;
  outline: none;
  font-weight: 700;
}

.paper-select select:focus {
  border-color: var(--cyan);
  box-shadow: var(--ring);
}

.paper-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mini-stat {
  position: relative;
  min-height: 72px;
  padding: 12px 10px 12px 13px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--r-ctrl);
  overflow: hidden;
}

.mini-stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--cyan), var(--violet));
}

.mini-stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mini-stat strong {
  font-size: 20px;
  line-height: 1;
  font-weight: 900;
  color: var(--ink-strong);
}

.paper-question-card {
  position: relative;
  min-height: 460px;
  padding: 26px 24px 24px;
  display: grid;
  gap: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.paper-question-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.paper-question-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  background: rgba(34, 211, 238, 0.12);
  color: var(--cyan-deep);
  border-radius: 999px;
}

.paper-question {
  margin: 0;
  color: var(--ink-strong);
  font-size: 26px;
  line-height: 1.55;
  font-weight: 800;
}

.image-hint {
  margin: 0;
  padding: 12px 14px;
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  border-radius: var(--r-ctrl);
  color: #92600c;
  line-height: 1.5;
  font-size: 14px;
}

.paper-source-image {
  margin: 0;
  max-height: min(58vh, 520px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-ctrl);
  background: #fff;
  padding: 10px;
}

.paper-source-image img {
  display: block;
  width: 100%;
  height: auto;
}

.paper-options {
  display: grid;
  gap: 10px;
}

.paper-option {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  background: var(--field);
  border-radius: var(--r-ctrl);
  padding: 10px 14px;
  text-align: left;
  color: var(--ink);
  transition: border-color 0.16s, box-shadow 0.16s, transform 0.16s, background 0.16s;
}

.paper-option:hover {
  border-color: var(--cyan);
  box-shadow: var(--ring);
  transform: translateX(3px);
}

.paper-option:disabled {
  cursor: default;
}

.paper-option:disabled:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--line);
}

.paper-option span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef2f9;
  color: #475569;
  font-size: 14px;
  font-weight: 800;
  transition: background 0.16s, color 0.16s;
}

.paper-option:hover:not(:disabled) span {
  background: var(--cyan);
  color: #fff;
}

.paper-option strong {
  min-width: 0;
  font-size: 16px;
  line-height: 1.45;
  font-weight: 600;
}

.paper-option.correct {
  background: var(--ok-soft);
  border-color: var(--ok-line);
}

.paper-option.correct span {
  background: var(--ok);
  color: #fff;
}

.paper-option.wrong {
  background: var(--err-soft);
  border-color: var(--err-line);
}

.paper-option.wrong span {
  background: var(--err);
  color: #fff;
}

.paper-option.selected {
  box-shadow: inset 0 0 0 2px var(--ok);
}

.paper-answer-panel {
  position: relative;
  padding: 16px 16px 16px 19px;
  background: var(--dark);
  border-radius: var(--r-ctrl);
  overflow: hidden;
}

.paper-answer-panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}

.paper-answer-panel[data-status="correct"]::before {
  background: var(--ok-line);
  box-shadow: 0 0 12px var(--ok);
}

.paper-answer-panel[data-status="wrong"]::before,
.paper-answer-panel[data-status="unsure"]::before {
  background: var(--warn);
  box-shadow: 0 0 12px var(--warn);
}

.paper-answer-panel span {
  color: var(--dark-accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.paper-answer-panel[data-status="wrong"] span,
.paper-answer-panel[data-status="unsure"] span {
  color: var(--warn-line);
}

.paper-answer-panel p {
  margin: 8px 0 0;
  color: var(--dark-ink);
  font-size: 17px;
  line-height: 1.6;
}

.paper-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.paper-done-panel {
  grid-column: 2 / 3;
}

.library-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.library-item {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 16px 16px 16px 19px;
  display: grid;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.library-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--cyan), var(--violet));
  opacity: 0.85;
}

.library-item h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink-strong);
}

.library-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.library-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.library-tags span {
  font-size: 12px;
  color: #4f46e5;
  background: rgba(129, 140, 248, 0.14);
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 600;
}

.parent-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

#parentView {
  width: 100%;
  max-width: 600px;
  margin-inline: auto;
}

.parent-panel {
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.parent-panel h3 {
  font-size: 18px;
  margin-bottom: 14px;
  color: var(--ink-strong);
}

.wide-panel {
  grid-column: 1 / -1;
}

.parent-headline {
  margin: 0;
  color: var(--ink-strong);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.6;
}

.parent-trend {
  margin: 0;
  color: var(--ink-strong);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

.parent-trend-note,
.parent-script-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.parent-script-note {
  margin-bottom: 16px;
}

.script-list {
  display: grid;
  gap: 12px;
}

.script-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctrl);
  background: var(--field);
}

.script-card.highlight {
  border-color: var(--cyan);
  background: var(--panel);
  box-shadow: var(--ring);
}

.script-match {
  width: fit-content;
  margin: 0;
  padding: 4px 8px;
  border-radius: var(--r-chip);
  background: var(--bg-1);
  color: var(--cyan-deep);
  font-size: 13px;
  font-weight: 800;
}

.script-when,
.script-say,
.script-dont {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
}

.script-when {
  color: var(--ink-strong);
  font-weight: 800;
}

.script-say span,
.script-dont span {
  display: inline-block;
  min-width: 52px;
  margin-right: 8px;
  padding: 4px 8px;
  border-radius: var(--r-chip);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.script-say span {
  background: var(--ok-soft);
  color: var(--ink-strong);
}

.script-dont span {
  background: var(--bg-1);
  color: var(--muted);
}

/* 安全支持入口：始终可见、低饱和，不做警报式表达。 */
.crisis-entry {
  width: auto;
  align-self: flex-start;
  margin-top: auto;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--r-ctrl);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  transition: border-color 0.16s, color 0.16s, background 0.16s, box-shadow 0.16s;
}

.crisis-entry:hover,
.crisis-entry:focus-visible {
  border-color: rgba(129, 140, 248, 0.72);
  background: rgba(129, 140, 248, 0.08);
  color: #4f46e5;
  box-shadow: var(--ring);
  outline: 0;
}

.crisis-entry > span {
  color: var(--violet);
  font-size: 17px;
  font-weight: 500;
}

.crisis-entry + .sidebar-footer {
  margin-top: 0;
}

/* 命中安全红线时只劝停并递出支持资源，不再显示学习动作。 */
.crisis-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid rgba(129, 140, 248, 0.35);
  border-radius: var(--r-card);
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.08), rgba(129, 140, 248, 0.10));
}

.crisis-banner p {
  margin: 0;
  color: var(--ink-strong);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.6;
}

.crisis-banner-link {
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: #4f46e5;
  font-size: 13px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.crisis-banner-link:focus-visible {
  border-radius: var(--r-chip);
  box-shadow: var(--ring);
  outline: 0;
}

.crisis-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
}

.crisis-dialog {
  width: min(440px, 100%);
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--warn-line);
  border-radius: var(--r-card);
  background: linear-gradient(180deg, var(--warn-soft), var(--panel) 56%);
  box-shadow: var(--shadow);
}

.crisis-dialog h3,
.crisis-dialog p {
  margin: 0;
}

.crisis-dialog h3 {
  color: var(--ink-strong);
  font-size: 24px;
}

.crisis-dialog p {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
}

.crisis-note {
  color: var(--muted) !important;
  font-size: 13px !important;
}

.crisis-lines {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.crisis-lines li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctrl);
  background: rgba(255, 255, 255, 0.72);
}

.crisis-lines strong {
  color: var(--ink-strong);
  font-size: 15px;
}

.crisis-lines a {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--ink-strong);
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
  text-decoration-color: var(--cyan-deep);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.site-footer {
  margin-top: 8px;
  padding: 14px 4px 4px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  border-top: 1px solid var(--line);
}

/* ============ 完成页的安静入口（亮区，不用暗区令牌） ============ */
.collection-hint {
  margin-top: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-ctrl);
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  transition: color 0.16s, background 0.16s;
}

.collection-hint:hover,
.collection-hint:focus-visible {
  color: var(--ink-strong);
  background: rgba(129, 140, 248, 0.08);
}

.collection-hint:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

/* ============ 光之柜 · 暗区（夜空收藏馆） ============
   所有 --col-* 与衬线字体只在 .collection-scope 内定义/使用，主学习流零改动。
   P5 护栏：夜空 + 活物微光 + 描金（每屏 ≤2 处），locked = 神秘剪影而非失败态；不用投影，用内描金线 + 光晕。 */
.collection-scope {
  --col-bg: #0b1020;
  --col-panel: #141b30;
  --col-panel-up: #1c2542;
  --col-line: #2b3656;
  --col-ink: #d2dcf0;
  --col-muted: #8593b5;
  --col-locked: #1a2238;
  --col-glow-cool: #67e8f9;
  --col-glow-warm: #c7a3ff;
  --col-glow-mile: #f9a8d4;
  --col-gold: #c9a86a;
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", "SimSun", serif;
  max-width: 600px;
  margin: 0 auto;
  padding: 24px 16px 16px;
  border-radius: var(--r-card);
  border: 1px solid var(--col-line);
  background:
    radial-gradient(420px 220px at 50% -8%, rgba(103, 232, 249, 0.10), transparent 70%),
    var(--col-bg);
  color: var(--col-ink);
  display: grid;
  gap: 16px;
}

.collection-scope p {
  margin: 0;
}

.collection-scope .col-caption {
  font-family: var(--font-serif);
  font-size: 15px;
  letter-spacing: 4px;
  text-align: center;
  color: var(--col-gold);
  font-variant-numeric: tabular-nums;
}

.collection-scope .col-fresh {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.7;
  letter-spacing: 1px;
  text-align: center;
  color: var(--col-ink);
}

.collection-scope .col-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.collection-scope .col-slot {
  aspect-ratio: 1 / 1.12;
  border-radius: 14px;
  border: 1px solid var(--col-line);
  background: var(--col-panel);
  box-shadow: inset 0 0 0 1px rgba(201, 168, 106, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 8px;
  text-align: center;
}

.collection-scope .col-orb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--col-ink);
}

.collection-scope .col-orb svg {
  width: 34px;
  height: 34px;
}

.collection-scope .col-orb path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.collection-scope .col-slot.lit {
  background: var(--col-panel-up);
}

.collection-scope .col-slot.cool .col-orb {
  color: #eafcff;
  background: radial-gradient(circle, rgba(103, 232, 249, 0.42) 0%, rgba(103, 232, 249, 0.12) 55%, rgba(103, 232, 249, 0) 75%);
  box-shadow: 0 0 18px -3px rgba(103, 232, 249, 0.42);
}

.collection-scope .col-slot.warm .col-orb {
  color: #f4ecff;
  background: radial-gradient(circle, rgba(199, 163, 255, 0.42) 0%, rgba(199, 163, 255, 0.12) 55%, rgba(199, 163, 255, 0) 75%);
  box-shadow: 0 0 18px -3px rgba(199, 163, 255, 0.42);
}

.collection-scope .col-slot.mile .col-orb {
  color: #fff1f7;
  background: radial-gradient(circle, rgba(249, 168, 212, 0.40) 0%, rgba(249, 168, 212, 0.12) 55%, rgba(249, 168, 212, 0) 75%);
  box-shadow: 0 0 18px -3px rgba(249, 168, 212, 0.40);
}

.collection-scope .col-name {
  font-family: var(--font-serif);
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--col-ink);
}

.collection-scope .col-story {
  font-size: 13px;
  line-height: 1.5;
  color: var(--col-muted);
}

.collection-scope .col-slot.locked {
  background: var(--col-locked);
}

.collection-scope .col-slot.locked .col-orb {
  background: radial-gradient(circle, rgba(43, 54, 86, 0.9) 30%, rgba(26, 34, 56, 0) 72%);
  color: var(--col-muted);
}

.collection-scope .col-slot.locked .col-orb svg {
  opacity: 0.38;
  filter: blur(1.2px);
}

.collection-scope .col-slot.locked .col-name {
  color: var(--col-muted);
}

/* 点亮：一次柔和辉光，≤600ms、不循环、无音效 */
@keyframes col-glow-in {
  from {
    opacity: 0.35;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.collection-scope .col-slot.just-lit .col-orb {
  animation: col-glow-in 0.6s ease-out 1;
}

@media (prefers-reduced-motion: reduce) {
  .collection-scope .col-slot.just-lit .col-orb {
    animation: none;
  }
}

.collection-scope .col-next {
  margin-top: 4px;
  font-size: 15px;
  text-align: center;
  color: var(--col-muted);
  font-variant-numeric: tabular-nums;
}

.collection-scope .col-foot {
  font-size: 13px;
  letter-spacing: 1px;
  text-align: center;
  color: var(--col-muted);
}

.collection-scope .col-foot em {
  font-style: normal;
  color: var(--col-gold);
}

.collection-scope .col-collapsed {
  font-size: 15px;
  line-height: 1.7;
  text-align: center;
  color: var(--col-muted);
  padding: 16px 0;
}

.collection-scope .col-toggle {
  justify-self: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--col-line);
  background: transparent;
  color: var(--col-muted);
  font-size: 15px;
  transition: color 0.16s, border-color 0.16s;
}

.collection-scope .col-toggle:hover,
.collection-scope .col-toggle:focus-visible {
  color: var(--col-ink);
  border-color: var(--col-muted);
}

.collection-scope .col-toggle:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

@media (min-width: 640px) {
  .collection-scope .col-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    gap: 12px;
  }

  .brand {
    justify-content: flex-start;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-item {
    justify-content: center;
    min-height: 44px;
    padding: 0 8px;
  }

  .nav-item::before {
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  .crisis-entry {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 4;
    margin: 0;
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow-sm);
  }

  .main-area {
    padding: 18px 14px 24px;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar h2 {
    font-size: 24px;
  }

  .parent-grid,
  .library-list,
  .paper-grid {
    grid-template-columns: 1fr;
  }

  .paper-done-panel {
    grid-column: 1;
  }

  .study-card {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 20px 18px 18px;
  }

  .card-visual {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
    max-height: 340px;
  }

  .prompt-block,
  .answer-block,
  .card-controls {
    grid-column: 1;
  }

  .prompt-block {
    min-height: auto;
  }

  #cardPrompt {
    font-size: 23px;
  }

  .paper-question-card {
    min-height: auto;
    padding: 20px 18px 18px;
  }

  .paper-source-image {
    max-height: none;
  }

  .paper-question {
    font-size: 22px;
  }

  .paper-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .paper-actions .primary-button,
  .paper-actions .secondary-button {
    width: 100%;
  }

  .card-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .rating-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .primary-button,
  .rating {
    width: 100%;
    padding: 0 10px;
  }
}

@media (max-width: 420px) {
  .brand h1 {
    font-size: 16px;
  }

  .brand p,
  .date-label {
    font-size: 12px;
  }

  /* 五项导航在手机宽度只留文字：13px 下限 + nowrap，不让「光之柜」折行 */
  .nav-item {
    font-size: 13px;
    gap: 4px;
    padding: 0 4px;
    white-space: nowrap;
  }

  .nav-item .icon {
    display: none;
  }

  .status-tile {
    min-height: 68px;
  }

  .status-tile strong {
    font-size: 24px;
  }

  #cardPrompt {
    font-size: 21px;
  }

  .paper-question {
    font-size: 20px;
  }

  .paper-question-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .paper-option {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .paper-option span {
    width: 28px;
    height: 28px;
  }

  .answer-block p {
    font-size: 16px;
  }
}
