/* ================================================================
   物理量卡牌 · Cyberpunk / Precision Machinery
   - 去扫描线、去乱码、去 glitch
   - 保留：黑底、等宽字、装饰角线、发光细节、呼吸光点
   ================================================================ */

:root {
  --bg:           #050505;
  --bg-soft:      #0a0a0c;
  --panel:        #0c0c0e;
  --line:         #2a2a2e;
  --line-soft:    #1a1a1e;
  --line-bright:  #6a6a72;
  --ink:          #e9e9ec;
  --ink-dim:      #a8a8ae;
  --ink-faint:    #6a6a72;
  --ink-ghost:    #3a3a40;
  --accent:       #ffffff;

  /* 学科配色变量（在 .card 和 .category-card 上基于 --card-hue 计算） */
  --card-hue:     200;                     /* 默认：力学蓝青 */

  --fm-mono:  'JetBrains Mono', 'Courier New', ui-monospace, monospace;
  --fm-sans:  'Noto Sans SC', 'PingFang SC', system-ui, sans-serif;
  --fm-serif: 'Noto Serif SC', 'Songti SC', '宋体', serif;
}

/* 学科配色变量 —— 在卡牌元素上基于各自的 --card-hue 计算 */
.card,
.category-card,
.focus-card,
.focus-card-slot {
  --cat-color:    hsl(var(--card-hue), 75%, 65%);
  --cat-dim:      hsl(var(--card-hue), 50%, 45%);
  --cat-faint:    hsl(var(--card-hue), 40%, 30%);
  --cat-glow:     hsl(var(--card-hue), 80%, 70%);
  --cat-glow-soft:hsla(var(--card-hue), 80%, 70%, 0.15);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: var(--fm-mono);
  color: var(--ink);
  background-color: var(--bg);
  /* 深空底色：比原来稍亮，让星星更明显 */
  background-image:
    radial-gradient(ellipse at 50% 50%, #181820 0%, #08080c 45%, #030305 100%);
  padding: 0;
  height: 100vh;
  overflow: hidden;
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* CRT 扫描线覆盖层 —— 默认关闭，由 .fx-on 控制 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}

body.fx-on::after {
  opacity: 1;
  background:
    /* 水平扫描线 */
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
    /* RGB 色散微条纹 */
    linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
  background-size: 100% 2px, 3px 100%;
  animation: crtFlicker 7s infinite;
}

/* CRT 随机闪烁 —— 仪器受干扰感 */
@keyframes crtFlicker {
  0%, 100% { opacity: 1; }
  3%  { opacity: 0.96; }
  4%  { opacity: 1; }
  26% { opacity: 0.92; filter: brightness(1.02); }
  27% { opacity: 1; }
  69% { opacity: 0.94; }
  70% { opacity: 1; }
  96% { opacity: 0.88; filter: brightness(1.03); }
  97% { opacity: 1; }
}

/* 扫描线关闭时的淡出 */
body:not(.fx-on)::after {
  opacity: 0;
}

/* ============ 星空背景 ============ */
.starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ============ 分类物理语义背景 ============ */
.category-field {
  --field-hue: 200;
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.42;
  transition: opacity 0.6s ease;
}

.physics-field-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.95;
  mix-blend-mode: screen;
}

.category-field::before,
.category-field::after {
  content: '';
  position: absolute;
  inset: -12%;
  opacity: 0.55;
  mix-blend-mode: screen;
  transition: background 0.5s ease, transform 0.5s ease;
}

.field-home::before {
  background:
    radial-gradient(circle at 22% 28%, hsla(45, 80%, 70%, 0.14), transparent 20%),
    radial-gradient(circle at 76% 66%, hsla(200, 80%, 70%, 0.12), transparent 24%);
}

.field-home::after {
  background-image:
    linear-gradient(115deg, transparent 0 47%, hsla(200, 70%, 72%, 0.12) 48% 49%, transparent 50%),
    linear-gradient(65deg, transparent 0 48%, hsla(45, 70%, 72%, 0.10) 49% 50%, transparent 51%);
  background-size: 260px 180px, 220px 160px;
  animation: fieldDrift 28s linear infinite;
}

.field-mechanics::before {
  background-image:
    radial-gradient(ellipse at 20% 68%, transparent 0 18%, hsla(var(--field-hue), 80%, 72%, 0.22) 18.5% 19%, transparent 19.5%),
    radial-gradient(ellipse at 58% 42%, transparent 0 23%, hsla(var(--field-hue), 80%, 72%, 0.16) 23.5% 24%, transparent 24.5%),
    linear-gradient(115deg, transparent 0 47%, hsla(var(--field-hue), 80%, 72%, 0.18) 48% 49%, transparent 50%);
  background-size: 520px 260px, 620px 320px, 210px 210px;
  animation: fieldDrift 24s linear infinite;
}

.field-mechanics::after {
  background:
    linear-gradient(90deg, transparent 0 88%, hsla(var(--field-hue), 85%, 76%, 0.14) 89% 90%, transparent 91%),
    linear-gradient(0deg, transparent 0 90%, hsla(var(--field-hue), 80%, 74%, 0.08) 91% 92%, transparent 93%);
  background-size: 180px 120px;
}

.field-kinematics::before {
  background:
    repeating-linear-gradient(90deg, transparent 0 72px, hsla(var(--field-hue), 80%, 72%, 0.13) 73px 74px, transparent 75px 112px),
    linear-gradient(18deg, transparent 0 49%, hsla(var(--field-hue), 85%, 75%, 0.20) 49.5% 50.5%, transparent 51%);
  animation: fieldSlide 18s linear infinite;
}

.field-kinematics::after {
  background-image:
    radial-gradient(circle at 15% 65%, hsla(var(--field-hue), 90%, 78%, 0.20) 0 2px, transparent 3px),
    radial-gradient(circle at 36% 45%, hsla(var(--field-hue), 90%, 78%, 0.18) 0 2px, transparent 3px),
    radial-gradient(circle at 62% 58%, hsla(var(--field-hue), 90%, 78%, 0.18) 0 2px, transparent 3px);
  background-size: 360px 220px;
}

.field-electromagnetism::before {
  background-image:
    radial-gradient(ellipse at 28% 46%, transparent 0 11%, hsla(var(--field-hue), 85%, 75%, 0.24) 11.5% 12%, transparent 12.5% 18%, hsla(var(--field-hue), 85%, 75%, 0.16) 18.5% 19%, transparent 19.5%),
    radial-gradient(ellipse at 72% 58%, transparent 0 13%, hsla(var(--field-hue), 85%, 75%, 0.20) 13.5% 14%, transparent 14.5% 22%, hsla(var(--field-hue), 85%, 75%, 0.13) 22.5% 23%, transparent 23.5%);
  animation: fieldPulse 7s ease-in-out infinite;
}

.field-electromagnetism::after {
  background:
    repeating-radial-gradient(circle at 50% 50%, transparent 0 34px, hsla(var(--field-hue), 90%, 78%, 0.08) 35px 36px, transparent 37px 68px);
  animation: slowRotate 80s linear infinite;
}

.field-thermodynamics::before {
  background-image:
    radial-gradient(circle at 18% 28%, hsla(var(--field-hue), 95%, 72%, 0.20) 0 2px, transparent 3px),
    radial-gradient(circle at 42% 62%, hsla(var(--field-hue), 95%, 72%, 0.18) 0 2px, transparent 3px),
    radial-gradient(circle at 66% 34%, hsla(var(--field-hue), 95%, 72%, 0.16) 0 2px, transparent 3px),
    radial-gradient(circle at 82% 76%, hsla(var(--field-hue), 95%, 72%, 0.18) 0 2px, transparent 3px);
  background-size: 180px 150px;
  animation: thermalNoise 8s steps(8) infinite;
}

.field-thermodynamics::after {
  background: linear-gradient(125deg, transparent 0 42%, hsla(var(--field-hue), 95%, 70%, 0.10) 44% 46%, transparent 48% 100%);
  background-size: 260px 180px;
  animation: fieldSlide 22s linear infinite reverse;
}

.field-measure::before {
  background:
    repeating-linear-gradient(90deg, transparent 0 35px, hsla(var(--field-hue), 80%, 72%, 0.12) 36px 37px, transparent 38px 70px),
    repeating-linear-gradient(0deg, transparent 0 35px, hsla(var(--field-hue), 80%, 72%, 0.08) 36px 37px, transparent 38px 70px);
}

.field-measure::after {
  background:
    conic-gradient(from 0deg at 72% 34%, transparent 0 8deg, hsla(var(--field-hue), 80%, 72%, 0.14) 9deg 10deg, transparent 11deg 30deg);
  animation: slowRotate 70s linear infinite;
}

@keyframes fieldDrift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-80px, 40px, 0); }
}

@keyframes fieldSlide {
  from { background-position: 0 0; }
  to { background-position: 360px 0; }
}

@keyframes fieldPulse {
  0%, 100% { opacity: 0.42; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.04); }
}

@keyframes thermalNoise {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(18px, -10px); }
  40% { transform: translate(-10px, 16px); }
  60% { transform: translate(8px, 20px); }
  80% { transform: translate(-18px, -8px); }
}

/* ============ 背景网格 ============ */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.012) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 85%);
}

/* ============ 视窗四角 ============ */
.viewport-corner {
  position: fixed;
  width: 18px;
  height: 18px;
  z-index: 5;
  pointer-events: none;
  border-color: var(--line-bright);
}
.viewport-corner.tl { top: 18px;    left: 18px;   border-top: 1px solid; border-left: 1px solid; }
.viewport-corner.tr { top: 18px;    right: 18px;  border-top: 1px solid; border-right: 1px solid; }
.viewport-corner.bl { bottom: 18px; left: 18px;   border-bottom: 1px solid; border-left: 1px solid; }
.viewport-corner.br { bottom: 18px; right: 18px;  border-bottom: 1px solid; border-right: 1px solid; }

/* ============ 左侧纵向标题栏（固定） ============ */

.album-header {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 200px;
  z-index: 2;
  margin: 0;
  padding: 28px 12px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
  max-width: none;
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(10,10,12,0.92) 0%, rgba(5,5,6,0.92) 100%);
  backdrop-filter: blur(4px);
  overflow: visible;
}

/* 标题区外框 —— 精密仪器面板感 */
.album-header::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  pointer-events: none;
  z-index: 0;
}

/* 标题区四角标定线 */
.album-header::after {
  content: '';
  position: absolute;
  inset: 6px;
  pointer-events: none;
  z-index: 0;
  background:
    /* 左上 */
    linear-gradient(180deg, var(--line-bright) 0%, var(--line-bright) 14px, transparent 14px) 0 0 / 1px 100% no-repeat,
    linear-gradient(90deg,  var(--line-bright) 0%, var(--line-bright) 14px, transparent 14px) 0 0 / 100% 1px no-repeat,
    /* 右上 */
    linear-gradient(180deg, var(--line-bright) 0%, var(--line-bright) 14px, transparent 14px) 100% 0 / 1px 100% no-repeat,
    linear-gradient(270deg, var(--line-bright) 0%, var(--line-bright) 14px, transparent 14px) 100% 0 / 100% 1px no-repeat,
    /* 左下 */
    linear-gradient(0deg,   var(--line-bright) 0%, var(--line-bright) 14px, transparent 14px) 0 100% / 1px 100% no-repeat,
    linear-gradient(90deg,  var(--line-bright) 0%, var(--line-bright) 14px, transparent 14px) 0 100% / 100% 1px no-repeat,
    /* 右下 */
    linear-gradient(0deg,   var(--line-bright) 0%, var(--line-bright) 14px, transparent 14px) 100% 100% / 1px 100% no-repeat,
    linear-gradient(270deg, var(--line-bright) 0%, var(--line-bright) 14px, transparent 14px) 100% 100% / 100% 1px no-repeat;
  opacity: 0.7;
}

/* 标题区左侧竖向刻度尺 */
.header-ruler {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 180px;
  pointer-events: none;
  z-index: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
}
.header-ruler .hr-mark {
  width: 4px;
  height: 1px;
  background: var(--line-bright);
  opacity: 0.35;
}
.header-ruler .hr-mark.long {
  width: 8px;
  opacity: 0.6;
}

/* 标题区右侧竖向刻度尺 */
.header-ruler-right {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 180px;
  pointer-events: none;
  z-index: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
}
.header-ruler-right .hr-mark {
  width: 4px;
  height: 1px;
  background: var(--line-bright);
  opacity: 0.35;
}
.header-ruler-right .hr-mark.long {
  width: 8px;
  opacity: 0.6;
}

.header-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--ink-faint);
  font-size: 8.5px;
  letter-spacing: 0.28em;
  margin-bottom: 0;
  flex-shrink: 1;
  min-height: 0;
  max-height: 40vh;
  overflow: hidden;
}
.meta-line {
  flex: 0 0 auto;
  width: 1px;
  height: 32px;
  background: linear-gradient(180deg, transparent, var(--line-bright), transparent);
}
.meta-text {
  writing-mode: vertical-rl;
  white-space: nowrap;
  padding: 2px 0;
  letter-spacing: 0.32em;
}

/* 标题组：主标题 + 分隔线 + 副标题 横向排列 */
.title-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-shrink: 0;
  z-index: 1;
}

.album-title {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: var(--fm-serif);
  font-weight: 700;
  font-size: clamp(2rem, 2.8vw, 2.6rem);
  letter-spacing: 0.35em;
  margin: 0;
  padding: 0.35em 0 0;
  color: var(--accent);
  text-shadow:
    0 0 24px rgba(255, 255, 255, 0.25),
    0 0 48px rgba(255, 255, 255, 0.08);
  position: relative;
}

/* 标题与副标题之间的竖向分隔装饰 */
.title-separator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 100%;
  flex-shrink: 0;
}
.title-separator .ts-line {
  width: 1px;
  flex: 0 1 28px;
  background: linear-gradient(180deg, transparent, var(--line-bright), transparent);
  opacity: 0.5;
}
.title-separator .ts-diamond {
  width: 4px;
  height: 4px;
  background: var(--line-bright);
  transform: rotate(45deg);
  opacity: 0.5;
  flex-shrink: 0;
}

.album-sub {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: var(--fm-mono);
  font-weight: 300;
  font-size: 0.62rem;
  letter-spacing: 0.35em;
  color: var(--ink-dim);
  margin: 0;
  padding: 0.35em 0 0;
  position: relative;
}

/* 呼吸光点（不影响阅读的装饰） */
.pulse-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cat-color);
  box-shadow: 0 0 8px var(--cat-glow-soft);
  animation: pulseDot 2.6s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 0.35; box-shadow: 0 0 4px var(--cat-glow-soft); }
  50%      { opacity: 1;    box-shadow: 0 0 10px var(--cat-glow-soft); }
}

/* ============ 系统遥测面板 ============ */

.telemetry-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  margin-top: 8px;
  font-family: var(--fm-mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--ink-faint);
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: rgba(12,12,14, 0.6);
  backdrop-filter: blur(2px);
  width: 100%;
  max-width: 160px;
  position: relative;
}
.telemetry-panel::before {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(255,255,255,0.04);
  pointer-events: none;
}

.telemetry-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 8.5px;
  letter-spacing: 0.22em;
  color: var(--ink-dim);
  margin-bottom: 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
  width: 100%;
}
.telemetry-pulse {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cat-color);
  box-shadow: 0 0 6px var(--cat-glow-soft);
  animation: pulseDot 2.4s ease-in-out infinite;
}

.telemetry-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  line-height: 1.6;
}
.telemetry-label {
  color: var(--ink-ghost);
  font-size: 8px;
  letter-spacing: 0.18em;
}
.telemetry-val {
  color: var(--ink-dim);
  font-size: 9px;
  text-align: right;
}
.telemetry-bright {
  color: var(--ink);
  font-weight: 500;
  text-shadow: 0 0 4px rgba(255,255,255,0.15);
}
.telemetry-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
  margin: 3px 0;
}
.telemetry-status {
  color: var(--cat-color);
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 0.15em;
  text-shadow: 0 0 6px var(--cat-glow-soft);
  animation: pulseDot 3s ease-in-out infinite;
}

/* 遥测面板内嵌 FX 按钮 */
.telemetry-fx-btn {
  position: relative;
  width: 100%;
  margin-top: 6px;
  padding: 5px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-family: var(--fm-mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--line-soft);
  cursor: pointer;
  outline: none;
  transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}
.telemetry-fx-btn:hover {
  color: var(--cat-color);
  border-color: var(--cat-dim);
  background: rgba(255,255,255,0.04);
}
.telemetry-fx-btn[aria-pressed="true"] {
  color: var(--cat-color);
  border-color: var(--cat-dim);
  background: rgba(255,255,255,0.04);
}
.telemetry-fx-btn[aria-pressed="true"] .telemetry-fx-state {
  color: var(--cat-color);
  text-shadow: 0 0 6px var(--cat-glow-soft);
}
.telemetry-fx-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: inherit;
}
.telemetry-fx-label {
  flex: 1;
  text-align: left;
}
.telemetry-fx-state {
  font-size: 8px;
  letter-spacing: 0.15em;
  color: var(--ink-ghost);
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

/* ============ 卡片横向滚动区 ============ */

.card-grid {
  position: fixed;
  top: 0;
  left: 200px;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 56px;
  --edge-card-space: max(64px, calc((100vw - 200px - 340px) / 2));
  padding: 40px var(--edge-card-space);
  margin: 0;
  max-width: none;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: none;
  scroll-padding-inline: var(--edge-card-space);
  scroll-behavior: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--cat-dim) transparent;
  overscroll-behavior-x: contain;
  perspective: 1400px;
  transform-style: preserve-3d;
}

.card-grid.is-scrolling {
  scroll-snap-type: none;
}

.card-grid.deck-stack-mode {
  justify-content: center;
  overflow: hidden;
  scroll-snap-type: none;
  padding-inline: 40px;
  gap: 0;
}

.deck-field-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
  transition: opacity 0.35s ease;
}

.card-grid.deck-stack-mode .deck-field-canvas {
  opacity: 0.72;
}
.card-grid::before,
.card-grid::after {
  content: '';
  flex: 0 0 1px;
  height: 1px;
  pointer-events: none;
}
.card-grid::-webkit-scrollbar { height: 6px; }
.card-grid::-webkit-scrollbar-track { background: transparent; }
.card-grid::-webkit-scrollbar-thumb {
  background: var(--cat-dim);
  border-radius: 3px;
}

/* ============ 牌堆控制条 ============ */

.deck-controls {
  position: fixed;
  left: calc(200px + (100vw - 200px) / 2);
  bottom: 28px;
  z-index: 8;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(12,12,16,0.9), rgba(5,5,8,0.9));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    0 16px 40px rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
}

.deck-controls[hidden] {
  display: none;
}

.deck-btn {
  min-width: 66px;
  border: 1px solid var(--line-bright);
  background: rgba(255,255,255,0.025);
  color: var(--ink-dim);
  font-family: var(--fm-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  padding: 8px 10px 8px 12px;
  cursor: pointer;
}

.deck-btn:hover,
.deck-btn:focus-visible,
.deck-btn[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--cat-dim);
  outline: none;
  box-shadow: 0 0 18px var(--cat-glow-soft);
}

.deck-btn:disabled {
  cursor: default;
  opacity: 0.35;
  box-shadow: none;
}

.deck-mode-btn[aria-pressed="true"] {
  color: var(--cat-color);
}

.deck-counter {
  min-width: 72px;
  text-align: center;
  font-family: var(--fm-mono);
  color: var(--cat-color);
  font-size: 10px;
  letter-spacing: 0.16em;
}

/* ============ 卡牌结构 ============ */

.card {
  flex: 0 0 auto;
  width: 340px;
  aspect-ratio: 5 / 7;
  max-height: calc(100vh - 96px); /* 保证一屏装下整张卡片 */
  perspective: 1800px;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  scroll-snap-align: center;
  transform:
    perspective(1200px)
    rotateY(var(--track-tilt, 0deg))
    scale(var(--track-scale, 1));
  transform-origin: center center;
  transition:
    transform 0.12s linear,
    filter 0.12s linear,
    opacity 0.12s linear;
  filter: brightness(calc(0.74 + var(--track-depth, 0) * 0.34));
  opacity: calc(0.72 + var(--track-depth, 0) * 0.28);
}

.card-grid.is-scrolling .card {
  transition: none;
}

.card-grid.deck-stack-mode .card {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  scroll-snap-align: none;
  z-index: calc(2 + var(--deck-z));
  opacity: calc(1 - min(var(--deck-abs), 5) * 0.13);
  filter:
    brightness(calc(1.06 - min(var(--deck-abs), 5) * 0.08))
    saturate(calc(1.08 - min(var(--deck-abs), 5) * 0.04));
  transform:
    translate(-50%, -50%)
    translateX(calc(var(--deck-offset) * 18px))
    translateY(calc(min(var(--deck-abs), 5) * 10px))
    rotate(calc(var(--deck-offset) * 2.8deg))
    scale(calc(1 - min(var(--deck-abs), 5) * 0.035));
  transition:
    transform 0.42s cubic-bezier(0.2, 0.85, 0.2, 1),
    opacity 0.3s ease,
    filter 0.3s ease;
  pointer-events: none;
}

.card-grid.deck-stack-mode .card.is-deck-clone {
  display: none;
}

.card-grid.deck-stack-mode .card.is-deck-current {
  pointer-events: auto;
  opacity: 1;
  filter: brightness(1.16) saturate(1.08);
}

.card-grid.deck-stack-mode .card.is-deck-before {
  transform:
    translate(-50%, -50%)
    translateX(calc(-150px + max(var(--deck-offset), -4) * 10px))
    translateY(calc(min(var(--deck-abs), 5) * 9px))
    rotate(calc(-9deg + max(var(--deck-offset), -4) * 1.4deg))
    scale(calc(0.92 - min(var(--deck-abs), 5) * 0.025));
}

.card-grid.deck-stack-mode .card.is-deck-after {
  transform:
    translate(-50%, -50%)
    translateX(calc(min(var(--deck-offset), 5) * 20px))
    translateY(calc(min(var(--deck-abs), 5) * 10px))
    rotate(calc(min(var(--deck-offset), 5) * 3deg))
    scale(calc(1 - min(var(--deck-abs), 5) * 0.035));
}

.card-grid.deck-stack-mode .card.is-deck-current .card-face {
  border-color: var(--cat-color);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 90px var(--cat-glow-soft),
    0 30px 70px -18px rgba(0, 0, 0, 0.95),
    0 0 48px -10px var(--cat-glow-soft);
}

.card.is-center {
  z-index: 5;
  filter: brightness(1.16) saturate(1.08);
  opacity: 1;
}

.card.is-center .card-face {
  border-color: var(--cat-color);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 90px var(--cat-glow-soft),
    0 24px 56px -20px rgba(0, 0, 0, 0.95),
    0 0 36px -8px var(--cat-glow-soft);
}

.card.is-near-center .symbol-core {
  opacity: 0.9;
}
.card:focus-visible .card-inner {
  box-shadow: 0 0 0 2px rgba(255,255,255,0.6);
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.95s cubic-bezier(0.2, 0.85, 0.2, 1);
  will-change: transform;
}

.card.is-flipped .card-inner { transform: rotateY(180deg); }

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;

  display: flex;
  flex-direction: column;
  padding: 18px 20px;

  color: var(--ink);
  background:
    /* 金属拉丝质感：多层极细条纹 */
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 1px,
      rgba(255,255,255,0.008) 1px,
      rgba(255,255,255,0.008) 2px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 1px,
      rgba(255,255,255,0.005) 1px,
      rgba(255,255,255,0.005) 2px
    ),
    linear-gradient(180deg, #0d0d11 0%, #080809 55%, #050506 100%);
  border: 1px solid var(--cat-faint);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 -1px 0 rgba(255, 255, 255, 0.02),
    inset 0 0 60px rgba(255, 255, 255, 0.015),
    0 20px 50px -20px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(0, 0, 0, 0.6);
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

/* 金属蚀刻：内框细线 */
.card-face::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

/* 极淡网纹 + 光学眩光 */
.card-face::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: 0.6;
  mix-blend-mode: screen;
}

/* 光学眩光层：仅在卡牌未翻转时短暂闪烁一次 */
.card-face .sheen-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  background:
    linear-gradient(
      135deg,
      transparent 0%,
      transparent 35%,
      rgba(255, 255, 255, 0.04) 42%,
      rgba(255, 255, 255, 0.09) 50%,
      rgba(255, 255, 255, 0.04) 58%,
      transparent 65%,
      transparent 100%
    ),
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.03) 0%,
      transparent 8%,
      transparent 92%,
      rgba(255, 255, 255, 0.02) 100%
    );
}

/* 鼠标进入时触发一次扫光动画（仅未翻转的正面） */
@media (hover: hover) {
  .card:not(.is-flipped):hover .card-face .sheen-layer {
    animation: sheenFlash 5.0s ease-out forwards;
  }
}

@keyframes sheenFlash {
  0%   { opacity: 0; }
  30%  { opacity: 1; }
  100% { opacity: 0; }
}

.card-back { transform: rotateY(180deg); }

/* 悬浮：提亮描边 + 发光 */
@media (hover: hover) {
  .card:hover .card-face {
    border-color: var(--cat-dim);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.08),
      inset 0 0 80px var(--cat-glow-soft),
      0 20px 50px -20px rgba(0, 0, 0, 0.9),
      0 0 32px -6px var(--cat-glow-soft);
  }
  .card:hover .card-inner { transform: translateY(-4px); }
  .card.is-flipped:hover .card-inner { transform: translateY(-4px) rotateY(180deg); }
}

/* ============ 四角 L 形装饰 ============ */

.bracket {
  position: absolute;
  width: 16px;
  height: 16px;
  z-index: 3;
  pointer-events: none;
  border-color: var(--cat-dim);
  opacity: 0.85;
}
.bracket-tl { top: 10px;    left: 10px;   border-top: 1.5px solid; border-left: 1.5px solid; }
.bracket-tr { top: 10px;    right: 10px;  border-top: 1.5px solid; border-right: 1.5px solid; }
.bracket-bl { bottom: 10px; left: 10px;   border-bottom: 1.5px solid; border-left: 1.5px solid; }
.bracket-br { bottom: 10px; right: 10px;  border-bottom: 1.5px solid; border-right: 1.5px solid; }

/* ============ 顶部状态栏 ============ */

.card-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 10px;
  font-family: var(--fm-mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--cat-faint);
  position: relative;
  z-index: 2;
}
.head-code {
  color: var(--cat-color);
  font-weight: 500;
  padding: 2px 6px;
  border: 1px solid var(--cat-faint);
  background: rgba(255,255,255,0.02);
}
.head-dir {
  color: var(--ink-dim);
  text-align: left;
  padding-left: 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.head-page {
  font-family: var(--fm-mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: var(--ink-faint);
}

/* ============ 正面主体 ============ */

.card-body {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px 6px 10px;
  z-index: 2;
  overflow: hidden;
}

.ruler-slot {
  position: absolute;
  top: 22px;
  left: 2px;
  color: var(--ink-ghost);
  pointer-events: none;
}
.ruler { width: 10px; height: 210px; }

/* 右侧精密刻度 */
.right-scale-slot {
  position: absolute;
  top: 22px;
  right: 2px;
  pointer-events: none;
}
.right-scale { width: 12px; height: 200px; }

/* 精密圆环装饰 */
.precision-ring-slot {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 160px;
  height: 160px;
  pointer-events: none;
  opacity: 0.6;
  z-index: 0;
}
.precision-ring {
  width: 100%;
  height: 100%;
  animation: slowRotate 60s linear infinite;
}
/* 中心物理量符号（MathJax） */
.symbol-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: none;
  width: 190px;
  height: 190px;
  display: grid;
  place-items: center;
}
.symbol-mathjax {
  --symbol-color: #7dd3fc;
  position: relative;
  z-index: 3;
  color: var(--symbol-color);
  font-size: 2.4rem;
  line-height: 1;
  opacity: 0.85;
}
.symbol-mathjax mjx-container {
  color: var(--symbol-color) !important;
}
.symbol-mathjax mjx-container svg {
  filter: drop-shadow(0 0 6px var(--symbol-color));
}
@keyframes slowRotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.symbol-core {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 50%;
  color: var(--cat-color);
  opacity: 0.72;
}

.core-ring,
.core-line,
.core-vector {
  position: absolute;
  display: block;
  pointer-events: none;
}

.core-ring {
  inset: 24px;
  border: 1px solid hsla(var(--card-hue), 80%, 72%, 0.24);
  border-radius: 50%;
  box-shadow: 0 0 20px hsla(var(--card-hue), 80%, 70%, 0.10);
}

.core-ring-b {
  inset: 48px;
  opacity: 0.72;
  animation: corePulse 4s ease-in-out infinite;
}

.core-line {
  left: 26px;
  right: 26px;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, hsla(var(--card-hue), 85%, 75%, 0.62), transparent);
  transform-origin: 50% 50%;
}

.core-line-b { transform: rotate(90deg); opacity: 0.55; }

.core-vector {
  width: 62px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cat-color));
  top: 52%;
  left: 64%;
  transform-origin: left center;
  filter: drop-shadow(0 0 6px hsla(var(--card-hue), 80%, 70%, 0.35));
}

.core-vector::after {
  content: '';
  position: absolute;
  right: -1px;
  top: -4px;
  width: 8px;
  height: 8px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg);
}

.core-vector-b {
  left: 16%;
  top: 38%;
  opacity: 0.45;
  transform: rotate(180deg) scaleX(0.72);
}

.core-dots span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 3px;
  margin: -1.5px;
  border-radius: 50%;
  background: var(--cat-color);
  box-shadow: 0 0 8px hsla(var(--card-hue), 85%, 72%, 0.55);
  transform:
    rotate(calc(var(--i) * 30deg))
    translateX(78px);
}

.symbol-core-flow .core-vector-a,
.symbol-core-flow .core-vector-b,
.symbol-core-path .core-vector-a,
.symbol-core-accelerate .core-vector-a {
  animation: vectorFlow 2.2s ease-in-out infinite;
}

.symbol-core-accelerate .core-dots span {
  animation: accelDots 1.8s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.08s);
}

.symbol-core-field .core-line-a { transform: rotate(28deg); }
.symbol-core-field .core-line-b { transform: rotate(-28deg); }
.symbol-core-field .core-ring-a,
.symbol-core-field .core-ring-b,
.symbol-core-pulse .core-ring-a,
.symbol-core-pulse .core-ring-b {
  animation: corePulse 3s ease-in-out infinite;
}

.symbol-core-magnetic .core-ring-a {
  border-style: dashed;
  animation: slowRotate 18s linear infinite;
}

.symbol-core-magnetic .core-ring-b {
  border-style: dashed;
  animation: slowRotate 13s linear infinite reverse;
}

.symbol-core-disorder .core-dots span,
.symbol-core-thermal .core-dots span,
.symbol-core-collide .core-dots span {
  animation: disorderDots 2.8s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.12s);
}

.symbol-core-orbit .core-dots {
  position: absolute;
  inset: 0;
  animation: slowRotate 6s linear infinite;
}

.symbol-core-expand .core-ring-a,
.symbol-core-expand .core-ring-b {
  animation: expandRing 3.4s ease-in-out infinite;
}

.symbol-core-measure .core-ring {
  border-radius: 2px;
  animation: none;
}

@keyframes corePulse {
  0%, 100% { transform: scale(0.86); opacity: 0.32; }
  50% { transform: scale(1.1); opacity: 0.82; }
}

@keyframes vectorFlow {
  0%, 100% { transform: translateX(-14px) scaleX(0.76); opacity: 0.32; }
  50% { transform: translateX(8px) scaleX(1.18); opacity: 0.82; }
}

@keyframes accelDots {
  0% { opacity: 0.2; transform: rotate(calc(var(--i) * 30deg)) translateX(42px); }
  100% { opacity: 0.95; transform: rotate(calc(var(--i) * 30deg)) translateX(82px); }
}

@keyframes disorderDots {
  0%, 100% { opacity: 0.38; transform: rotate(calc(var(--i) * 30deg)) translateX(36px); }
  50% { opacity: 0.92; transform: rotate(calc(var(--i) * 47deg)) translateX(calc(44px + var(--i) * 3px)); }
}

@keyframes expandRing {
  0% { transform: scale(0.55); opacity: 0; }
  45% { opacity: 0.75; }
  100% { transform: scale(1.24); opacity: 0; }
}

@keyframes cat-glow-pulse {
  0%, 100% {
    opacity: 0.85;
    box-shadow:
      inset 0 0 40px var(--cat-glow-soft),
      0 0 36px -4px var(--cat-glow-soft),
      0 0 72px -16px var(--cat-glow-soft);
  }
  50% {
    opacity: 1;
    box-shadow:
      inset 0 0 56px var(--cat-glow-soft),
      0 0 48px -2px var(--cat-glow-soft),
      0 0 96px -12px var(--cat-glow-soft);
  }
}

/* 分类标签 */
.category-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 0;
  z-index: 2;
}
.category-badge .cat-line {
  flex: 0 1 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cat-dim), transparent);
}
.category-badge .cat-text {
  font-family: var(--fm-mono);
  font-size: 8px;
  letter-spacing: 0.35em;
  color: var(--cat-color);
  padding-left: 0.35em;
  white-space: nowrap;
  text-shadow: 0 0 6px var(--cat-glow-soft);
}

/* 底部装饰线 */
.front-decor-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 4px;
  z-index: 2;
}
.decor-diamond {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--cat-dim);
  transform: rotate(45deg);
  opacity: 0.6;
  box-shadow: 0 0 4px var(--cat-glow-soft);
}
.decor-dots {
  font-family: var(--fm-mono);
  font-size: 8px;
  letter-spacing: 0.15em;
  color: var(--cat-faint);
  opacity: 0.5;
}

.title-block {
  text-align: center;
  margin-top: 6px;
  margin-bottom: auto; /* 将引言区域往卡片下半部推 */
  z-index: 2;
}

.card-title {
  font-family: var(--fm-serif);
  font-weight: 700;
  font-size: 3.6rem;
  line-height: 1;
  margin: 0 0 14px;
  letter-spacing: 0.25em;
  padding-left: 0.25em;
  color: var(--accent);
  text-shadow:
    0 0 14px rgba(255, 255, 255, 0.25),
    0 0 30px rgba(255, 255, 255, 0.08);
}

.title-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 80%;
  margin: 0 auto;
}
.title-rule .rule-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cat-dim), transparent);
}
.title-en {
  font-family: var(--fm-mono);
  font-weight: 400;
  font-size: 0.82rem;
  letter-spacing: 0.4em;
  color: var(--ink-dim);
  padding-left: 0.4em;
  white-space: nowrap;
}

/* 正面引言：斜体 + 左侧彩条 + 轻度辉光强调 */
.epigraphs {
  list-style: none;
  padding: 0 14px;
  margin: 0 0 14px; /* 不再用 auto 居中，直接沉到底部装饰之上 */
  z-index: 2;
}
.epigraphs li {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0 10px 10px;
  border-bottom: 1px dashed var(--cat-faint);
  font-family: var(--fm-serif);
  font-style: italic;      /* 斜体强调 */
  font-weight: 500;
  font-size: 1.02rem;
  letter-spacing: 0.14em;
  color: var(--ink);
  line-height: 1.75;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.12);
}
.epigraphs li::before {
  /* 左侧竖向彩条，配合学科色 */
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: linear-gradient(180deg, transparent, var(--cat-dim), transparent);
  box-shadow: 0 0 6px var(--cat-glow-soft);
  opacity: 0.8;
}
.epigraphs li:last-child { border-bottom: none; }
.epigraphs .prefix {
  font-family: var(--fm-mono);
  font-style: normal;       /* 前缀保持端正，和文本形成对比 */
  color: var(--cat-color);
  font-size: 0.9rem;
  flex-shrink: 0;
  text-shadow: 0 0 6px var(--cat-glow-soft);
}
.epigraphs .epi-text {
  flex: 1;
  display: inline-block;
  /* 为中文字态无真正斜体时，补一个轻微倾斜效果 */
  transform: skewX(-5deg);
  transform-origin: left center;
}

/* ============ 底部栏 ============ */

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 8px 2px;
  font-family: var(--fm-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--ink-faint);
  border-top: 1px solid var(--cat-faint);
  position: relative;
  z-index: 2;
}
.foot-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.foot-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}
.action-hint {
  color: var(--ink-dim);
  transition: color 0.3s, text-shadow 0.3s;
}
.card:hover .action-hint {
  color: var(--cat-color);
  text-shadow: 0 0 6px var(--cat-glow-soft);
}

.focus-trigger {
  position: relative;
  z-index: 6;
  flex: 0 0 auto;
  border: 1px solid var(--cat-faint);
  background: rgba(255, 255, 255, 0.025);
  color: var(--cat-color);
  font-family: var(--fm-mono);
  font-size: 8px;
  line-height: 1;
  letter-spacing: 0.18em;
  padding: 5px 7px 5px 8px;
  cursor: pointer;
}

.focus-trigger:hover,
.focus-trigger:focus-visible {
  border-color: var(--cat-dim);
  color: var(--accent);
  outline: none;
  box-shadow: 0 0 12px var(--cat-glow-soft);
}

/* ============ 背面 ============ */

.back-body {
  padding: 14px 4px 4px;
}

.back-titlebar {
  text-align: center;
  margin-bottom: 10px;
}
.back-heading {
  font-family: var(--fm-serif);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.25em;
  margin: 0 0 10px;
  padding-left: 0.25em;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.25);
}
.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.divider .d-line {
  width: 44px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cat-dim), transparent);
}
.divider .d-dot {
  width: 4px;
  height: 4px;
  background: var(--cat-color);
  box-shadow: 0 0 6px var(--cat-glow-soft);
  transform: rotate(45deg);
}

.back-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--cat-dim) transparent;
  mask-image: linear-gradient(180deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
}
.back-scroll::-webkit-scrollbar { width: 4px; }
.back-scroll::-webkit-scrollbar-thumb {
  background: var(--cat-dim);
  border-radius: 2px;
}

.note-paragraph {
  font-family: var(--fm-serif);
  font-size: 0.82rem;
  line-height: 1.95;
  color: var(--ink);
  margin: 0 0 0.85em;
  text-align: justify;
  text-indent: 2em;
  letter-spacing: 0.04em;
}
.note-paragraph:last-child { margin-bottom: 0; }

.note-paragraph em {
  font-style: normal;
  font-weight: 700;
  color: var(--cat-color);
  letter-spacing: 0.05em;
  text-shadow: 0 0 6px var(--cat-glow-soft);
  padding: 0 0.05em;
}
.note-paragraph q {
  font-style: italic;
  color: var(--ink-dim);
  quotes: '“' '”' '‘' '’';
}
.note-paragraph q::before { content: open-quote; }
.note-paragraph q::after  { content: close-quote; }

.note-paragraph .var {
  font-family: var(--fm-mono);
  font-style: italic;
  font-weight: 700;
  color: var(--cat-color);
  padding: 0 0.12em;
  text-shadow: 0 0 6px var(--cat-glow-soft);
}

/* ============ 标签行 ============ */

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  flex: 1;
  min-width: 0;
}
.sys-tag {
  font-family: var(--fm-mono);
  font-size: 8.5px;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  border: 1px solid var(--cat-faint);
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.015);
  white-space: nowrap;
  transition: color 0.3s, border-color 0.3s;
}
.card:hover .sys-tag {
  color: var(--accent);
  border-color: var(--cat-dim);
}
.back-foot {
  gap: 10px;
  flex-wrap: wrap;
}
.focus-trigger-back {
  margin-left: auto;
}
.end-hint { flex-shrink: 0; }

/* ============ 聚焦阅读层 ============ */

.focus-lock {
  overflow: hidden;
}

.focus-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 32px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.28s ease;
}

.focus-overlay.is-open {
  pointer-events: auto;
  opacity: 1;
}

.focus-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, hsla(var(--card-hue, 200), 80%, 68%, 0.12), transparent 42%),
    rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
}

.focus-panel {
  position: relative;
  width: min(980px, calc(100vw - 64px));
  max-height: min(820px, calc(100vh - 64px));
  display: flex;
  z-index: 1;
}

.focus-close {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-bright);
  background: #09090c;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.focus-close:hover,
.focus-close:focus-visible {
  outline: none;
  color: var(--cat-color);
  border-color: var(--cat-dim);
}

.focus-card-slot {
  width: 100%;
}

.focus-card {
  position: relative;
  overflow: hidden;
  max-height: min(820px, calc(100vh - 64px));
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  gap: 18px 28px;
  padding: 28px 32px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.035), transparent 18%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.012) 0 1px, transparent 1px 3px),
    #09090c;
  border: 1px solid var(--cat-faint);
  box-shadow:
    inset 0 0 80px hsla(var(--card-hue), 80%, 70%, 0.08),
    0 30px 80px rgba(0, 0, 0, 0.65),
    0 0 40px -18px var(--cat-glow);
  transform: translateY(14px) scale(0.98);
  transition: transform 0.32s cubic-bezier(0.2, 0.85, 0.2, 1);
}

.focus-overlay.is-open .focus-card {
  transform: translateY(0) scale(1);
}

.focus-card::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -20%;
  height: 22%;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, hsla(var(--card-hue), 90%, 75%, 0.18), transparent);
  animation: focusScan 3.8s ease-in-out infinite;
}

.focus-head {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--cat-faint);
  font-family: var(--fm-mono);
  color: var(--ink-dim);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
}

.focus-head strong {
  text-align: center;
  color: var(--accent);
  font-family: var(--fm-serif);
  font-size: 1.55rem;
  letter-spacing: 0.28em;
  padding-left: 0.28em;
}

.focus-symbol {
  grid-column: 1;
  grid-row: 2;
  min-height: 300px;
  display: grid;
  align-content: center;
  justify-items: center;
  border-right: 1px solid var(--cat-faint);
}

.focus-symbol .symbol-mathjax {
  font-size: 4.2rem;
}

.focus-symbol small {
  margin-top: 18px;
  color: var(--cat-color);
  font-family: var(--fm-mono);
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-align: center;
}

.focus-content {
  grid-column: 2;
  grid-row: 2;
  min-height: 0;
  overflow-y: auto;
  padding: 0 12px 0 0;
  scrollbar-width: thin;
  scrollbar-color: var(--cat-dim) transparent;
}

.focus-content h2 {
  margin: 0 0 18px;
  font-family: var(--fm-serif);
  font-size: 1.35rem;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.focus-content p {
  margin: 0 0 1.05em;
  font-family: var(--fm-serif);
  font-size: 1.03rem;
  line-height: 2.05;
  letter-spacing: 0.04em;
  text-align: justify;
  text-indent: 2em;
}

.focus-content em,
.focus-content .var {
  color: var(--cat-color);
  font-style: normal;
  font-weight: 700;
  text-shadow: 0 0 8px var(--cat-glow-soft);
}

.focus-content q {
  color: var(--ink-dim);
  font-style: italic;
}

.focus-tags {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--cat-faint);
}

.focus-tags span {
  border: 1px solid var(--cat-faint);
  color: var(--ink-dim);
  padding: 4px 8px;
  font-family: var(--fm-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
}

@keyframes focusScan {
  0% { transform: translateY(0); opacity: 0; }
  18% { opacity: 1; }
  70% { opacity: 0.7; }
  100% { transform: translateY(620%); opacity: 0; }
}

/* ============ 页脚：隐藏（布局改为单屏横排后不再显示） ============ */

.album-footer {
  display: none;
}
.foot-line {
  flex: 0 1 200px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-bright), transparent);
}

/* ============ 返回按钮 ============ */

.back-btn {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px 8px 14px;
  font-family: var(--fm-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--ink-dim);
  background:
    linear-gradient(180deg, rgba(16,16,20,0.95) 0%, rgba(10,10,14,0.95) 100%);
  border: 1px solid var(--cat-faint);
  cursor: pointer;
  outline: none;
  transition: color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
  /* 内框线 */
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    inset 0 -1px 0 rgba(255,255,255,0.02),
    0 4px 20px -4px rgba(0,0,0,0.8);
}
.back-btn::before {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(255,255,255,0.05);
  pointer-events: none;
}

/* 四角 L 形装饰 */
.back-btn::after {
  content: '';
  position: absolute;
  inset: -2px;
  pointer-events: none;
  background:
    /* 左上 */
    linear-gradient(180deg, var(--cat-dim) 0%, var(--cat-dim) 8px, transparent 8px) 0 0 / 1px 100% no-repeat,
    linear-gradient(90deg,  var(--cat-dim) 0%, var(--cat-dim) 8px, transparent 8px) 0 0 / 100% 1px no-repeat,
    /* 右上 */
    linear-gradient(180deg, var(--cat-dim) 0%, var(--cat-dim) 8px, transparent 8px) 100% 0 / 1px 100% no-repeat,
    linear-gradient(270deg, var(--cat-dim) 0%, var(--cat-dim) 8px, transparent 8px) 100% 0 / 100% 1px no-repeat,
    /* 左下 */
    linear-gradient(0deg,   var(--cat-dim) 0%, var(--cat-dim) 8px, transparent 8px) 0 100% / 1px 100% no-repeat,
    linear-gradient(90deg,  var(--cat-dim) 0%, var(--cat-dim) 8px, transparent 8px) 0 100% / 100% 1px no-repeat,
    /* 右下 */
    linear-gradient(0deg,   var(--cat-dim) 0%, var(--cat-dim) 8px, transparent 8px) 100% 100% / 1px 100% no-repeat,
    linear-gradient(270deg, var(--cat-dim) 0%, var(--cat-dim) 8px, transparent 8px) 100% 100% / 100% 1px no-repeat;
  opacity: 0.5;
  transition: opacity 0.35s ease;
}

.back-btn:hover {
  color: var(--cat-color);
  border-color: var(--cat-dim);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    inset 0 0 30px var(--cat-glow-soft),
    0 4px 24px -4px rgba(0,0,0,0.8),
    0 0 24px -6px var(--cat-glow-soft);
}
.back-btn:hover::after {
  opacity: 0.9;
}
.back-btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(255,255,255,0.4);
}

/* 箭头 SVG */
.back-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: var(--ink-faint);
  transition: color 0.35s ease, filter 0.35s ease;
}
.back-btn:hover .back-arrow {
  color: var(--cat-color);
  filter: drop-shadow(0 0 4px var(--cat-glow-soft));
}

/* 文字标签 */
.back-label {
  font-weight: 500;
  padding-top: 1px;
}

/* 底部扫描轨道装饰 */
.back-track {
  position: absolute;
  bottom: -4px;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cat-dim), transparent);
  opacity: 0.3;
  transition: opacity 0.35s ease;
}
.back-btn:hover .back-track {
  opacity: 0.7;
}

/* 呼吸光点 */
.back-pulse {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cat-color);
  box-shadow: 0 0 6px var(--cat-glow-soft);
  opacity: 0.4;
  animation: backPulse 2.4s ease-in-out infinite;
}
@keyframes backPulse {
  0%, 100% { opacity: 0.25; box-shadow: 0 0 3px var(--cat-glow-soft); }
  50%      { opacity: 0.7;  box-shadow: 0 0 8px var(--cat-glow-soft); }
}
.back-btn:hover .back-pulse {
  opacity: 0.9;
  animation-duration: 1.2s;
}

/* ============ 特效切换按钮 ============ */

.fx-btn {
  position: relative;
  z-index: 3;
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 8px;
  font-family: var(--fm-mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
  background:
    linear-gradient(180deg, rgba(16,16,20,0.9) 0%, rgba(10,10,14,0.9) 100%);
  border: 1px solid var(--line);
  cursor: pointer;
  outline: none;
  transition: color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    inset 0 -1px 0 rgba(255,255,255,0.02),
    0 4px 16px -4px rgba(0,0,0,0.8);
}
.fx-btn::before {
  content: '';
  position: absolute;
  inset: 2px;
  border: 1px solid rgba(255,255,255,0.05);
  pointer-events: none;
}

/* 四角 L 形装饰 */
.fx-btn::after {
  content: '';
  position: absolute;
  inset: -2px;
  pointer-events: none;
  background:
    linear-gradient(180deg, var(--line-bright) 0%, var(--line-bright) 6px, transparent 6px) 0 0 / 1px 100% no-repeat,
    linear-gradient(90deg,  var(--line-bright) 0%, var(--line-bright) 6px, transparent 6px) 0 0 / 100% 1px no-repeat,
    linear-gradient(180deg, var(--line-bright) 0%, var(--line-bright) 6px, transparent 6px) 100% 0 / 1px 100% no-repeat,
    linear-gradient(270deg, var(--line-bright) 0%, var(--line-bright) 6px, transparent 6px) 100% 0 / 100% 1px no-repeat,
    linear-gradient(0deg,   var(--line-bright) 0%, var(--line-bright) 6px, transparent 6px) 0 100% / 1px 100% no-repeat,
    linear-gradient(90deg,  var(--line-bright) 0%, var(--line-bright) 6px, transparent 6px) 0 100% / 100% 1px no-repeat,
    linear-gradient(0deg,   var(--line-bright) 0%, var(--line-bright) 6px, transparent 6px) 100% 100% / 1px 100% no-repeat,
    linear-gradient(270deg, var(--line-bright) 0%, var(--line-bright) 6px, transparent 6px) 100% 100% / 100% 1px no-repeat;
  opacity: 0.4;
  transition: opacity 0.35s ease;
}

.fx-btn:hover {
  color: var(--cat-color);
  border-color: var(--cat-dim);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    inset 0 0 20px var(--cat-glow-soft),
    0 4px 20px -4px rgba(0,0,0,0.8),
    0 0 16px -4px var(--cat-glow-soft);
}
.fx-btn:hover::after {
  opacity: 0.8;
}
.fx-btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(255,255,255,0.4);
}

/* 激活状态（特效开启时） */
.fx-btn[aria-pressed="true"] {
  color: var(--cat-color);
  border-color: var(--cat-dim);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    inset 0 0 24px var(--cat-glow-soft),
    0 4px 20px -4px rgba(0,0,0,0.8),
    0 0 20px -4px var(--cat-glow-soft);
}
.fx-btn[aria-pressed="true"]::after {
  opacity: 0.9;
}
.fx-btn[aria-pressed="true"] .fx-pulse {
  opacity: 0.9;
  animation-duration: 1.2s;
}
.fx-btn[aria-pressed="true"] .fx-track {
  opacity: 0.6;
}

/* 闪电图标 */
.fx-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--ink-faint);
  transition: color 0.35s ease, filter 0.35s ease;
}
.fx-btn:hover .fx-icon,
.fx-btn[aria-pressed="true"] .fx-icon {
  color: var(--cat-color);
  filter: drop-shadow(0 0 4px var(--cat-glow-soft));
}

.fx-label {
  font-weight: 500;
  padding-top: 1px;
}

/* 底部扫描轨道 */
.fx-track {
  position: absolute;
  bottom: -3px;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cat-dim), transparent);
  opacity: 0.25;
  transition: opacity 0.35s ease;
}
.fx-btn:hover .fx-track {
  opacity: 0.55;
}

/* 呼吸光点 */
.fx-pulse {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--cat-color);
  box-shadow: 0 0 5px var(--cat-glow-soft);
  opacity: 0.3;
  animation: backPulse 2.4s ease-in-out infinite;
}

/* ============ 分类卡牌（Category Card） ============ */

.category-card {
  flex: 0 0 auto;
  width: 340px;
  aspect-ratio: 5 / 6;
  position: relative;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  scroll-snap-align: center;
  transform:
    perspective(1200px)
    rotateY(var(--track-tilt, 0deg))
    scale(var(--track-scale, 1));
  transform-origin: center center;
  transition:
    transform 0.12s linear,
    filter 0.12s linear,
    opacity 0.12s linear;
  filter: brightness(calc(0.76 + var(--track-depth, 0) * 0.32));
  opacity: calc(0.74 + var(--track-depth, 0) * 0.26);
}

.card-grid.is-scrolling .category-card {
  transition: none;
}

.category-card:focus-visible .cat-card-face {
  box-shadow: 0 0 0 2px rgba(255,255,255,0.6);
}

.category-card.is-center {
  z-index: 5;
  filter: brightness(1.16) saturate(1.08);
  opacity: 1;
}

.category-card.is-center .cat-card-face {
  border-color: var(--cat-color);
  box-shadow:
    inset 0 0 56px var(--cat-glow-soft),
    0 28px 70px -30px rgba(0, 0, 0, 0.9),
    0 0 44px -10px var(--cat-glow-soft);
}

/* ---- 堆叠层：暗示内含多张卡牌 ---- */
.cat-card-stack {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.cat-stack-layer {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, #0a0a0e 0%, #060607 55%, #030304 100%);
  opacity: 0.5;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.cat-stack-1 {
  transform: translate(6px, 4px) rotate(1.5deg);
  opacity: 0.35;
}
.cat-stack-2 {
  transform: translate(11px, 7px) rotate(3deg);
  opacity: 0.2;
}

/* ---- 主面板 ---- */
.cat-card-face {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 1;

  display: flex;
  flex-direction: column;
  padding: 18px 20px;

  color: var(--ink);
  background:
    /* 极淡同心圆标定线 —— 光学仪器校准底板质感 */
    repeating-radial-gradient(
      circle at 50% 50%,
      transparent 0px,
      transparent 19px,
      rgba(255,255,255,0.024) 19px,
      rgba(255,255,255,0.024) 20px
    ),
    /* 细密蓝图网格 */
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 7px,
      rgba(255,255,255,0.018) 7px,
      rgba(255,255,255,0.018) 8px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 7px,
      rgba(255,255,255,0.018) 7px,
      rgba(255,255,255,0.018) 8px
    ),
    /* 金属拉丝质感 */
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 1px,
      rgba(255,255,255,0.008) 1px,
      rgba(255,255,255,0.008) 2px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 1px,
      rgba(255,255,255,0.005) 1px,
      rgba(255,255,255,0.005) 2px
    ),
    linear-gradient(180deg, #0d0d11 0%, #080809 55%, #050506 100%);
  border: 1.5px solid var(--cat-faint);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 -1px 0 rgba(255, 255, 255, 0.02),
    inset 0 0 60px rgba(255, 255, 255, 0.015),
    0 20px 50px -20px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(0, 0, 0, 0.6);
  transition: border-color 0.35s ease, box-shadow 0.35s ease, transform 0.35s ease;
}

.cat-card-face::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  pointer-events: none;
  transition: border-color 0.35s ease;
}

.cat-card-face::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: 0.6;
  mix-blend-mode: screen;
}

/* 边缘色光溢出层 —— 默认极淡，hover 时增强 */
.cat-card-face .cat-edge-glow {
  position: absolute;
  inset: -1px;
  pointer-events: none;
  z-index: -1;
  border-radius: inherit;
  background: transparent;
  box-shadow:
    inset 0 0 24px var(--cat-glow-soft),
    0 0 20px -8px var(--cat-glow-soft);
  opacity: 0.3;
  transition: opacity 0.5s ease, box-shadow 0.5s ease;
}

/* ---- Hover 效果 ---- */
@media (hover: hover) {
  .category-card:hover .cat-card-face {
    border-color: var(--cat-dim);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.06),
      inset 0 0 50px var(--cat-glow-soft),
      0 20px 50px -20px rgba(0, 0, 0, 0.9),
      0 0 20px -8px var(--cat-glow-soft);
    transform: translateY(-6px);
  }

  .category-card:hover .cat-card-face::before {
    border-color: rgba(255, 255, 255, 0.09);
  }

  .category-card:hover .cat-edge-glow {
    opacity: 0.7;
    box-shadow:
      inset 0 0 32px var(--cat-glow-soft),
      0 0 24px -6px var(--cat-glow-soft),
      0 0 48px -16px var(--cat-glow-soft);
    animation: cat-glow-pulse 2.4s ease-in-out infinite;
  }

  .category-card:hover .cat-stack-1 {
    transform: translate(9px, 6px) rotate(2deg);
    opacity: 0.45;
  }
  .category-card:hover .cat-stack-2 {
    transform: translate(16px, 10px) rotate(4deg);
    opacity: 0.28;
  }

  .category-card:hover .cat-corner {
    border-color: var(--cat-dim);
    opacity: 0.9;
    filter: drop-shadow(0 0 2px var(--cat-glow-soft));
  }

  .category-card:hover .action-hint {
    color: var(--cat-dim);
    text-shadow: 0 0 4px var(--cat-glow-soft);
  }
}

/* ---- 四角双线刻度装饰 ---- */
.cat-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  z-index: 3;
  pointer-events: none;
  border-color: var(--cat-dim);
  opacity: 0.7;
  transition: border-color 0.35s ease, opacity 0.35s ease;
}

.cat-corner-tl {
  top: 10px; left: 10px;
  border-top: 2px solid;
  border-left: 2px solid;
}
.cat-corner-tl::after {
  content: '';
  position: absolute;
  top: 4px; left: 4px;
  width: 6px; height: 6px;
  border-top: 1.5px solid;
  border-left: 1.5px solid;
  border-color: inherit;
  opacity: 0.6;
}

.cat-corner-tr {
  top: 10px; right: 10px;
  border-top: 2px solid;
  border-right: 2px solid;
}
.cat-corner-tr::after {
  content: '';
  position: absolute;
  top: 4px; right: 4px;
  width: 6px; height: 6px;
  border-top: 1.5px solid;
  border-right: 1.5px solid;
  border-color: inherit;
  opacity: 0.6;
}

.cat-corner-bl {
  bottom: 10px; left: 10px;
  border-bottom: 2px solid;
  border-left: 2px solid;
}
.cat-corner-bl::after {
  content: '';
  position: absolute;
  bottom: 4px; left: 4px;
  width: 6px; height: 6px;
  border-bottom: 1.5px solid;
  border-left: 1.5px solid;
  border-color: inherit;
  opacity: 0.6;
}

.cat-corner-br {
  bottom: 10px; right: 10px;
  border-bottom: 2px solid;
  border-right: 2px solid;
}
.cat-corner-br::after {
  content: '';
  position: absolute;
  bottom: 4px; right: 4px;
  width: 6px; height: 6px;
  border-bottom: 1.5px solid;
  border-right: 1.5px solid;
  border-color: inherit;
  opacity: 0.6;
}

/* ---- 中央标定十字线（精密仪器瞄准质感） ---- */
.cat-reticle {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.25;
  transition: opacity 0.35s ease;
}
.category-card:hover .cat-reticle {
  opacity: 0.4;
}
.category-card:hover .reticle-ring-outer,
.category-card:hover .reticle-ring-inner {
  border-color: var(--cat-faint);
}
.category-card:hover .reticle-arm,
.category-card:hover .reticle-tick {
  background: var(--cat-faint);
}
.category-card:hover .reticle-center {
  background: var(--cat-dim);
  box-shadow: 0 0 4px var(--cat-glow-soft);
}

/* ---- 精密准星系统 ---- */
.reticle-ring-outer {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 56px;
  height: 56px;
  border: 1px solid var(--cat-faint);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.5;
}
.reticle-ring-outer::before {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid var(--cat-faint);
  border-radius: 50%;
  opacity: 0.4;
}

.reticle-ring-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  border: 1px solid var(--cat-faint);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.6;
}

.reticle-cross {
  position: absolute;
  inset: 0;
}
.reticle-arm {
  position: absolute;
  background: var(--cat-faint);
}
.reticle-arm-n {
  top: 24%;
  left: 50%;
  width: 1px;
  height: 24%;
  transform: translateX(-50%);
}
.reticle-arm-s {
  bottom: 24%;
  left: 50%;
  width: 1px;
  height: 24%;
  transform: translateX(-50%);
}
.reticle-arm-e {
  top: 50%;
  right: 26%;
  width: 24%;
  height: 1px;
  transform: translateY(-50%);
}
.reticle-arm-w {
  top: 50%;
  left: 26%;
  width: 24%;
  height: 1px;
  transform: translateY(-50%);
}

.reticle-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 3px;
  background: var(--cat-color);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 4px var(--cat-glow-soft);
}

.reticle-ticks {
  position: absolute;
  inset: 0;
}
.reticle-tick {
  position: absolute;
  width: 4px;
  height: 1px;
  background: var(--cat-faint);
}
.reticle-tick-n {
  top: 24%;
  left: 50%;
  transform: translateX(-50%);
}
.reticle-tick-s {
  bottom: 24%;
  left: 50%;
  transform: translateX(-50%);
}
.reticle-tick-e {
  top: 50%;
  right: 26%;
  transform: translateY(-50%) rotate(90deg);
}
.reticle-tick-w {
  top: 50%;
  left: 26%;
  transform: translateY(-50%) rotate(90deg);
}

/* ---- 顶部栏 ---- */
.cat-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 12px 10px;
  font-family: var(--fm-mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--cat-faint);
  position: relative;
  z-index: 2;
}

.cat-head-code {
  color: var(--cat-color);
  font-weight: 500;
  padding: 2px 6px;
  border: 1px solid var(--cat-faint);
  background: rgba(255,255,255,0.02);
}

.cat-head-count {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.count-num {
  font-family: var(--fm-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--cat-color);
  text-shadow: 0 0 8px var(--cat-glow-soft);
}

.count-label {
  font-size: 8px;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
}

/* ---- 主体 ---- */
.cat-card-body {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 18px 10px 14px 18px;
  z-index: 2;
  overflow: visible;
  gap: 16px;
}

/* 左侧学科色竖条 */
.cat-color-strip {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.color-bar {
  width: 3px;
  height: 60px;
  background: linear-gradient(180deg, transparent, var(--cat-dim), transparent);
  box-shadow: 0 0 8px var(--cat-glow-soft);
  border-radius: 1px;
}

.color-dots {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.color-dots span {
  width: 3px;
  height: 3px;
  background: var(--cat-faint);
  border-radius: 50%;
}

/* 标题区（纵向布局） */
.cat-title-block {
  text-align: center;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0;
  position: relative;
}

.cat-title {
  font-family: var(--fm-serif);
  font-weight: 700;
  font-size: 2.4rem;
  line-height: 1.3;
  margin: 0;
  letter-spacing: 0.35em;
  padding-left: 0.35em;
  color: var(--accent);
  text-shadow:
    0 0 14px rgba(255, 255, 255, 0.25),
    0 0 30px rgba(255, 255, 255, 0.08);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  white-space: nowrap;
}

/* 英文名 */
.cat-en-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 0;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.cat-en-label {
  font-family: var(--fm-mono);
  font-size: 7px;
  letter-spacing: 0.3em;
  color: var(--ink-ghost);
}

.cat-en-name {
  font-family: var(--fm-mono);
  font-weight: 400;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  padding-left: 0.25em;
  color: var(--cat-dim);
}

/* 迷你预览卡片 */
.cat-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 0;
}

.preview-thumb {
  width: 28px;
  height: 36px;
  border: 1px solid var(--cat-faint);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 60%),
    hsla(var(--card-hue), 30%, 10%, 0.25);
  border-radius: 2px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-thumb::before {
  content: '';
  position: absolute;
  inset: 2px;
  border: 1px solid rgba(255,255,255,0.04);
}
.preview-thumb::after {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(255,255,255,0.025);
}
.preview-thumb:nth-child(2) {
  border-color: var(--cat-faint);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.025) 0%, transparent 60%),
    hsla(var(--card-hue), 30%, 12%, 0.3);
}

.preview-symbol {
  --symbol-color: var(--cat-color);
  color: var(--symbol-color);
  font-size: 10px;
  line-height: 1;
  z-index: 1;
}
.preview-symbol mjx-container {
  color: var(--symbol-color) !important;
  font-size: 10px !important;
}
.preview-symbol mjx-container svg {
  filter: drop-shadow(0 0 3px var(--symbol-color));
}

/* ---- 底部栏 ---- */
.cat-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 8px 2px;
  font-family: var(--fm-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--ink-faint);
  border-top: 1px solid var(--cat-faint);
  position: relative;
  z-index: 2;
}

.cat-foot-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ---- 按下状态 ---- */
.category-card:active .cat-card-face {
  transform: translateY(-2px);
  transition-duration: 0.1s;
}

/* ============ 响应式 ============ */

@media (max-width: 720px) {
  .album-header { width: 160px; padding: 40px 8px 20px; }
  .album-header::before { inset: 8px; }
  .album-header::after { inset: 4px; }
  .header-ruler, .header-ruler-right { display: none; }
  .card-grid {
    left: 160px;
    --edge-card-space: max(32px, calc((100vw - 160px - 340px) / 2));
    padding: 24px var(--edge-card-space);
    gap: 32px;
  }
  .title-group { gap: 10px; }
  .album-title { font-size: 1.6rem; letter-spacing: 0.28em; }
  .album-sub { font-size: 0.52rem; letter-spacing: 0.28em; }
  .title-separator .ts-line { flex-basis: 20px; }
  .decor-control { display: none; }
  .deck-controls {
    left: calc(160px + (100vw - 160px) / 2);
    bottom: 18px;
  }
  .focus-panel { width: min(720px, calc(100vw - 32px)); }
  .focus-card {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .focus-symbol {
    grid-column: 1;
    grid-row: auto;
    min-height: 140px;
    border-right: 0;
    border-bottom: 1px solid var(--cat-faint);
    padding-bottom: 14px;
  }
  .focus-content {
    grid-column: 1;
    grid-row: auto;
  }
}

@media (max-width: 480px) {
  :root {
    --mobile-header-height: 88px;
    --mobile-card-width: min(84vw, 330px);
    --mobile-card-gap: 18px;
    --mobile-edge-card-space: max(22px, calc((100vw - var(--mobile-card-width)) / 2 - 18px));
    --mobile-card-center-y: 46%;
    --mobile-focus-head-height: 92px;
  }

  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  body {
    min-height: 100dvh;
  }

  .album-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    width: 100%;
    height: var(--mobile-header-height);
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 10px;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
    border-right: none;
    border-bottom: 1px solid var(--line-soft);
    overflow: hidden;
  }
  .album-header::before,
  .album-header::after { display: none; }
  .header-ruler, .header-ruler-right { display: none; }
  .title-group {
    flex-direction: row;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
    justify-content: center;
  }
  .album-title,
  .album-sub,
  .meta-text { writing-mode: horizontal-tb; }
  .album-title {
    font-size: clamp(1.05rem, 5vw, 1.5rem);
    letter-spacing: 0.12em;
    padding-left: 0.12em;
    white-space: nowrap;
  }
  .album-sub {
    max-width: 34vw;
    font-size: 0.52rem;
    letter-spacing: 0.12em;
    padding-left: 0.12em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .title-separator {
    flex-direction: column;
    gap: 4px;
  }
  .title-separator .ts-line {
    flex-basis: 16px;
    width: 1px;
  }
  .card-grid {
    position: fixed;
    top: var(--mobile-header-height);
    right: 0;
    bottom: 0;
    left: 0;
    --edge-card-space: var(--mobile-edge-card-space);
    padding: 18px var(--edge-card-space) calc(74px + env(safe-area-inset-bottom));
    gap: var(--mobile-card-gap);
    align-items: center;
    overflow-x: hidden;
    overflow-y: hidden;
    scroll-snap-type: none;
    scroll-padding-inline: calc((100vw - var(--mobile-card-width)) / 2);
    scroll-behavior: auto;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  .card-grid.is-scrolling {
    scroll-snap-type: none;
  }
  .card-grid.is-scrolling .card,
  .card-grid.is-scrolling .category-card {
    --track-scale: 1;
    --track-tilt: 0deg;
    --track-depth: 0.5;
    transform: perspective(1200px) rotateY(0deg) scale(1);
    filter: brightness(0.94);
    opacity: 0.9;
    transition: none;
  }
  .card-grid.is-scrolling .card.is-center,
  .card-grid.is-scrolling .category-card.is-center {
    filter: brightness(0.94);
    opacity: 0.9;
  }
  .card-grid.has-flipped-card {
    touch-action: pan-y;
  }
  .card-grid.deck-stack-mode {
    top: var(--mobile-header-height);
    min-height: auto;
    padding: 18px 14px calc(84px + env(safe-area-inset-bottom));
  }
  .card {
    width: var(--mobile-card-width);
    max-height: calc(100dvh - var(--mobile-header-height) - 104px);
  }
  .category-card {
    width: var(--mobile-card-width);
    max-height: calc(100dvh - var(--mobile-header-height) - 90px);
  }
  .card-grid.mobile-discrete-track {
    justify-content: center;
    gap: 0;
    perspective: 1200px;
    touch-action: pan-x;
  }
  .card-grid.mobile-discrete-track .deck-field-canvas {
    display: none;
  }
  .card-grid.mobile-discrete-track .card,
  .card-grid.mobile-discrete-track .category-card {
    position: absolute;
    left: 50%;
    top: var(--mobile-card-center-y);
    margin: 0;
    transform: translate(-50%, -50%) scale(0.82);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    filter: brightness(0.72);
    transition:
      transform 0.28s cubic-bezier(0.2, 0.85, 0.2, 1),
      opacity 0.22s ease,
      filter 0.22s ease;
  }
  .card-grid.mobile-discrete-track .card[data-mobile-pos="current"],
  .card-grid.mobile-discrete-track .category-card[data-mobile-pos="current"] {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    filter: brightness(1.12) saturate(1.06);
    z-index: 4;
  }
  .card-grid.mobile-discrete-track .card[data-mobile-pos="prev"],
  .card-grid.mobile-discrete-track .category-card[data-mobile-pos="prev"] {
    transform: translate(calc(-50% - 72vw), -50%) scale(0.86) rotateY(8deg);
    opacity: 0.48;
    visibility: visible;
    filter: brightness(0.78);
    z-index: 2;
  }
  .card-grid.mobile-discrete-track .card[data-mobile-pos="next"],
  .card-grid.mobile-discrete-track .category-card[data-mobile-pos="next"] {
    transform: translate(calc(-50% + 72vw), -50%) scale(0.86) rotateY(-8deg);
    opacity: 0.48;
    visibility: visible;
    filter: brightness(0.78);
    z-index: 2;
  }
  .card-grid.mobile-discrete-track.mobile-discrete-dragging .card,
  .card-grid.mobile-discrete-track.mobile-discrete-dragging .category-card {
    transition-duration: 0.12s;
  }
  .card-grid.deck-stack-mode .card {
    width: min(86vw, 320px);
    max-height: calc(100dvh - var(--mobile-header-height) - 112px);
  }
  .card-grid.deck-stack-mode .deck-field-canvas {
    opacity: 0.42;
  }
  .card-grid.deck-stack-mode .card.is-deck-before {
    transform:
      translate(-50%, -50%)
      translateX(calc(-54px + max(var(--deck-offset), -3) * 5px))
      translateY(calc(min(var(--deck-abs), 4) * 7px))
      rotate(calc(-5deg + max(var(--deck-offset), -3) * 0.8deg))
      scale(calc(0.95 - min(var(--deck-abs), 4) * 0.018));
  }
  .card-grid.deck-stack-mode .card.is-deck-after {
    transform:
      translate(-50%, -50%)
      translateX(calc(min(var(--deck-offset), 4) * 12px))
      translateY(calc(min(var(--deck-abs), 4) * 8px))
      rotate(calc(min(var(--deck-offset), 4) * 1.4deg))
      scale(calc(1 - min(var(--deck-abs), 4) * 0.024));
  }
  .deck-controls {
    left: 50%;
    bottom: calc(10px + env(safe-area-inset-bottom));
    gap: 6px;
    padding: 6px;
    max-width: calc(100vw - 20px);
  }
  .deck-btn {
    min-width: 56px;
    font-size: 9px;
    padding: 7px 8px 7px 10px;
  }
  .deck-counter {
    min-width: 62px;
    font-size: 9px;
  }
  .card-face { padding: 15px 16px; }
  .card-title { font-size: clamp(2.6rem, 14vw, 3.4rem); }
  .card-foot,
  .cat-card-foot {
    font-size: 8px;
    letter-spacing: 0.12em;
  }
  .card.is-flipped {
    touch-action: pan-y;
  }
  .card .card-inner {
    transform-style: flat;
    transition: none;
    will-change: auto;
  }
  .card.is-flipped .card-inner {
    transform: none;
  }
  .card .card-back {
    transform: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
  .card.is-flipped .card-front {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
  .card.is-flipped .card-back {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 5;
    -webkit-backface-visibility: visible;
    backface-visibility: visible;
  }
  .card.is-flipped .back-scroll {
    touch-action: pan-y;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    mask-image: none;
    -webkit-mask-image: none;
    contain: content;
  }
  .card.is-flipped .card-back,
  .card.is-flipped .back-body {
    min-height: 0;
  }
  .symbol-center {
    width: 160px;
    height: 160px;
  }
  .symbol-core { transform: scale(0.9); }
  .focus-overlay {
    padding: 0;
    align-items: stretch;
    place-items: stretch;
    background: rgba(0, 0, 0, 0.72);
  }
  .focus-panel {
    width: 100vw;
    max-height: 100dvh;
    height: 100dvh;
  }
  .focus-close {
    top: calc(10px + env(safe-area-inset-top));
    right: 12px;
    width: 38px;
    height: 38px;
  }
  .focus-card-slot {
    min-height: 0;
  }
  .focus-card {
    width: 100%;
    min-height: 100dvh;
    max-height: 100dvh;
    padding: calc(50px + env(safe-area-inset-top)) 18px calc(20px + env(safe-area-inset-bottom));
    border-radius: 0;
    border: 1px solid var(--cat-faint);
    border-left: 0;
    border-right: 0;
    background:
      repeating-linear-gradient(0deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 5px),
      linear-gradient(180deg, rgba(14, 14, 19, 0.98), rgba(5, 5, 8, 0.99));
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.08),
      inset 0 0 34px rgba(255,255,255,0.025),
      0 0 0 1px rgba(0,0,0,0.8);
    transform: translateY(18px) scale(0.985);
    transition: transform 0.22s ease, opacity 0.22s ease;
  }
  .focus-card::before {
    top: calc(18px + env(safe-area-inset-top));
    left: 14px;
    right: 14px;
    height: 1px;
    background:
      linear-gradient(90deg, transparent, var(--cat-dim), transparent);
    opacity: 0.85;
  }
  .focus-card::after {
    content: '';
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    height: 1px;
    pointer-events: none;
    background:
      linear-gradient(90deg, transparent, var(--cat-faint), transparent);
  }
  .focus-head {
    position: relative;
    padding: 8px 12px 10px;
    border: 1px solid var(--cat-faint);
    background:
      linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.012));
    box-shadow: inset 0 0 18px rgba(255,255,255,0.025);
  }
  .focus-head::before,
  .focus-head::after {
    content: '';
    position: absolute;
    top: -1px;
    width: 18px;
    height: 18px;
    border-top: 2px solid var(--cat-dim);
    pointer-events: none;
  }
  .focus-head::before {
    left: -1px;
    border-left: 2px solid var(--cat-dim);
  }
  .focus-head::after {
    right: -1px;
    border-right: 2px solid var(--cat-dim);
  }
  .focus-head {
    grid-template-columns: 1fr;
    gap: 5px;
    text-align: left;
    border-right: 0;
  }
  .focus-head span {
    font-size: 0.58rem;
    letter-spacing: 0.12em;
  }
  .focus-head strong {
    font-size: 1rem;
    letter-spacing: 0.16em;
  }
  .focus-symbol {
    position: absolute;
    top: calc(50px + env(safe-area-inset-top));
    right: 18px;
    width: 34%;
    height: var(--mobile-focus-head-height);
    min-height: 0;
    margin: 0;
    border: 1px solid var(--cat-faint);
    background: rgba(255,255,255,0.012);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  .focus-symbol::before,
  .focus-symbol::after {
    content: '';
    position: absolute;
    left: 16px;
    right: 16px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--cat-faint), transparent);
    pointer-events: none;
  }
  .focus-symbol::before { top: 8px; }
  .focus-symbol::after { bottom: 8px; }
  .focus-symbol span {
    transform: scale(0.82);
  }
  .focus-symbol small {
    margin-top: 2px;
    font-size: 0.56rem;
    letter-spacing: 0.18em;
  }
  .focus-card {
    padding-top: calc(50px + env(safe-area-inset-top));
  }
  .focus-head {
    width: calc(66% + 1px);
    height: var(--mobile-focus-head-height);
    min-height: 0;
    align-content: center;
  }
  .focus-content p {
    font-size: 0.95rem;
    line-height: 1.95;
  }
  .focus-content {
    min-height: 0;
    margin-top: 10px;
    padding: 8px 8px 0;
    border-top: 1px solid var(--cat-faint);
    background: transparent;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .focus-tags {
    padding-top: 10px;
    border-top: 1px solid var(--cat-faint);
  }

  /* 移动端：遥测面板隐藏 */
  .telemetry-panel { display: none; }
}

@media (max-width: 480px) and (prefers-reduced-motion: reduce) {
  .starfield,
  .physics-field-canvas,
  .deck-field-canvas {
    opacity: 0.18 !important;
  }

  .card,
  .category-card,
  .card-face,
  .focus-card {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ============ 分类卡 → 物理量卡 过渡动画（数据流扫描线） ============ */

/* ---- 扫描线消散覆盖层 ---- */
.scanline-overlay {
  border-radius: 2px;
}

/* 扫描线光束 */
.scanline-beam {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    hsl(var(--scan-hue, 200), 85%, 75%) 15%,
    hsl(var(--scan-hue, 200), 90%, 90%) 50%,
    hsl(var(--scan-hue, 200), 85%, 75%) 85%,
    transparent 100%
  );
  box-shadow:
    0 0 6px hsla(var(--scan-hue, 200), 85%, 75%, 0.9),
    0 0 20px hsla(var(--scan-hue, 200), 85%, 75%, 0.5),
    0 0 40px hsla(var(--scan-hue, 200), 85%, 75%, 0.2);
  animation: scanSweep 0.45s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  z-index: 2;
}

@keyframes scanSweep {
  0% { top: 0; opacity: 1; }
  80% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* 二进制数据流字符层 */
.scanline-data {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}
.scanline-data span {
  position: absolute;
  font-family: var(--fm-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  color: hsl(var(--scan-hue, 200), 75%, 70%);
  text-shadow:
    0 0 4px hsla(var(--scan-hue, 200), 80%, 70%, 0.7),
    0 0 12px hsla(var(--scan-hue, 200), 80%, 70%, 0.3);
  opacity: 0;
  animation: bitFlicker 0.35s ease forwards;
}

@keyframes bitFlicker {
  0% { opacity: 0; transform: scale(0.8); }
  25% { opacity: 1; transform: scale(1); }
  60% { opacity: 0.7; }
  100% { opacity: 0; transform: scale(1.1); }
}

/* 垂直光条层 */
.scanline-bars {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
}
.scan-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 1px;
  background: linear-gradient(180deg,
    transparent 0%,
    hsla(var(--scan-hue, 200), 70%, 55%, 0.15) 20%,
    hsla(var(--scan-hue, 200), 80%, 72%, 0.55) 50%,
    hsla(var(--scan-hue, 200), 70%, 55%, 0.15) 80%,
    transparent 100%
  );
  box-shadow:
    inset 0 0 2px hsla(var(--scan-hue, 200), 80%, 70%, 0.4),
    0 0 6px hsla(var(--scan-hue, 200), 80%, 70%, 0.25),
    0 0 16px hsla(var(--scan-hue, 200), 80%, 70%, 0.1);
  animation: barDissolve 0.35s cubic-bezier(0.3, 0, 0.2, 1) forwards;
}

@keyframes barDissolve {
  0% {
    opacity: 0;
    transform: scaleY(0.3);
  }
  45% {
    opacity: 1;
    transform: scaleY(1);
  }
  100% {
    opacity: 0;
    transform: scaleY(1.08);
  }
}

/* ---- 物理量卡牌扫描线重建入场 ---- */
.card-scan-enter {
  opacity: 0;
  transform: translateX(50px);
}

.card-scan-enter .card-face {
  clip-path: inset(0 100% 0 0);
}

.card-scan-active {
  opacity: 1;
  transform: translateX(0);
  transition:
    opacity 0.3s cubic-bezier(0.2, 0.85, 0.2, 1) var(--scan-delay, 0s),
    transform 0.3s cubic-bezier(0.2, 0.85, 0.2, 1) var(--scan-delay, 0s);
}

.card-scan-active .card-face {
  clip-path: inset(0 0% 0 0);
  transition: clip-path 0.35s cubic-bezier(0.4, 0, 0.2, 1) var(--scan-delay, 0s);
}

/* 入场时卡牌边框闪烁学科色 */
.card-scan-active .card-face::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid hsla(var(--scan-hue, 200), 80%, 70%, 0.5);
  opacity: 0;
  animation: borderFlash 0.5s ease var(--scan-delay, 0s) forwards;
  pointer-events: none;
  z-index: 5;
}

@keyframes borderFlash {
  0% { opacity: 0.8; }
  50% { opacity: 0.4; }
  100% { opacity: 0; }
}
