/* ============================================================
   题库页大改版 · Velora wobble-card 风格
   - Bento 首屏（统计 + 快捷开始）
   - 年份卡 3D 指针倾斜 + 聚光跟随 + 颗粒 + 扫光
   - 题目列表卡轻微 3D
   - 知识点跑马灯
   ============================================================ */

#page-tiku { position: relative; }

/* ---------- 1. Bento 首屏 ---------- */
.tk-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(240px, .7fr);
  gap: 18px;
  margin: 4px 0 16px;
  padding: 24px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background:
    radial-gradient(80% 120% at 8% -20%, color-mix(in srgb, var(--ramp-1) 22%, transparent), transparent 60%),
    radial-gradient(70% 110% at 100% 0%, color-mix(in srgb, var(--ramp-2) 14%, transparent), transparent 60%),
    color-mix(in srgb, var(--card) 82%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  overflow: hidden;
  transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .2s ease-out, box-shadow .3s;
  box-shadow: 0 20px 50px -34px color-mix(in srgb, var(--ramp-1) 45%, transparent);
  transform-style: preserve-3d;
}
.tk-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  opacity: .05; mix-blend-mode: overlay;
}
.tk-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 30%) var(--my, 20%),
    color-mix(in srgb, var(--ramp-2) 14%, transparent), transparent 70%);
  opacity: .9;
}
.tk-hero > * { position: relative; z-index: 1; transform: translateZ(26px); }

.tk-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 650; letter-spacing: .05em;
  color: var(--ink2);
}
.tk-eyebrow i {
  width: 7px; height: 7px; border-radius: 50%;
  background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .16);
}
.tk-title {
  margin: 12px 0 8px;
  font-size: clamp(26px, 3.2vw, 38px);
  line-height: 1.16; font-weight: 800; letter-spacing: -.035em;
  color: var(--ink);
}
.tk-title span {
  background: linear-gradient(108deg, var(--ramp-1), var(--ramp-2) 55%, var(--ramp-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tk-sub { margin: 0 0 16px; font-size: 13px; line-height: 1.7; color: var(--ink3); max-width: 420px; }

.tk-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.tk-stat {
  min-width: 74px; padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 58%, transparent);
  transform: translateZ(18px);
}
.tk-stat b {
  display: block; font-size: 19px; font-weight: 800; letter-spacing: -.02em;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.tk-stat span { font-size: 10.5px; color: var(--ink3); letter-spacing: .04em; }

/* 首屏右侧：快捷开始 */
.tk-hero-side {
  position: relative;
  display: flex; flex-direction: column; justify-content: flex-end;
  align-items: flex-start; gap: 8px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 46%, transparent);
  overflow: hidden;
  transform: translateZ(34px);
}
.tk-orbit {
  position: absolute; top: -60px; right: -50px;
  width: 210px; height: 210px; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--ramp-2) 30%, transparent);
}
.tk-orbit::before, .tk-orbit::after {
  content: ""; position: absolute; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--ramp-2) 18%, transparent);
}
.tk-orbit::before { inset: 26px; }
.tk-orbit::after { inset: 56px; background: radial-gradient(circle, color-mix(in srgb, var(--ramp-2) 30%, transparent), transparent 68%); }
.tk-go {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 7px;
  border: none; cursor: pointer;
  padding: 10px 16px; border-radius: 999px;
  font-family: inherit; font-size: 13px; font-weight: 700; color: #fff;
  background: linear-gradient(110deg, var(--ramp-1), var(--ramp-2) 60%, var(--ramp-3));
  background-size: 170% 100%;
  box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--ramp-1) 80%, transparent);
  animation: tkShine 5.5s ease-in-out infinite;
}
@keyframes tkShine { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.tk-go:active { transform: translateY(1px); }
.tk-go-note { position: relative; z-index: 1; font-size: 11px; color: var(--ink3); }

/* ---------- 2. 知识点跑马灯 ---------- */
.tk-marquee {
  position: relative;
  margin: 0 0 16px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.tk-track {
  display: inline-flex; gap: 26px; white-space: nowrap;
  animation: tkScroll 36s linear infinite;
  font-size: 12px; letter-spacing: .05em; color: var(--ink3);
}
.tk-track b { color: var(--ink2); font-weight: 650; }
.tk-track i { font-style: normal; color: color-mix(in srgb, var(--ramp-2) 70%, var(--ink3)); }
@keyframes tkScroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- 3. 年份 Bento 网格 + 3D 卡 ---------- */
#listWrap.tk-grid.year-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 2px;
}
#listWrap.tk-grid .ycell {
  position: relative;
  min-height: 106px;
  padding: 16px 16px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--tk-c, var(--ramp-2)) 16%, transparent), transparent 58%),
    color-mix(in srgb, var(--card) 88%, transparent);
  box-shadow: 0 14px 34px -26px rgba(0, 0, 0, .5);
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(0) scale(var(--s, 1));
  transform-style: preserve-3d;
  transition: transform .2s ease-out, box-shadow .3s, border-color .2s;
  overflow: hidden;
  will-change: transform;
}
#listWrap.tk-grid .ycell.tk-tilt {
  transition: transform .06s linear, box-shadow .3s, border-color .2s;
  border-color: color-mix(in srgb, var(--tk-c, var(--ramp-2)) 45%, var(--line));
  box-shadow:
    0 26px 60px -30px color-mix(in srgb, var(--tk-c, var(--ramp-2)) 55%, transparent),
    0 0 0 1px color-mix(in srgb, var(--tk-c, var(--ramp-2)) 26%, transparent);
}

/* 聚光 + 颗粒 */
#listWrap.tk-grid .ycell::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 0%),
    color-mix(in srgb, var(--tk-c, var(--ramp-2)) 26%, transparent), transparent 65%);
  opacity: 0; transition: opacity .25s;
}
#listWrap.tk-grid .ycell.tk-tilt::before { opacity: 1; }
#listWrap.tk-grid .ycell::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
  opacity: .05; mix-blend-mode: overlay;
}

#listWrap.tk-grid .ycell b {
  display: block;
  font-size: 24px; font-weight: 800; letter-spacing: -.03em;
  color: var(--ink);
  transform: translateZ(24px);
}
#listWrap.tk-grid .ycell > span {
  display: block; margin-top: 3px;
  font-size: 11px; color: var(--ink3);
  transform: translateZ(14px);
}
#listWrap.tk-grid .ybar { margin-top: 10px; height: 4px; background: color-mix(in srgb, var(--line2) 80%, transparent); }
#listWrap.tk-grid .ybar em {
  background: linear-gradient(90deg, var(--tk-c, var(--ramp-1)), var(--ramp-2));
  box-shadow: 0 0 8px color-mix(in srgb, var(--tk-c, var(--ramp-1)) 55%, transparent);
}
#listWrap.tk-grid .ycell .tk-badge {
  position: absolute; top: 12px; right: 12px;
  font-style: normal; font-size: 9.5px; font-weight: 700; letter-spacing: .08em;
  padding: 3px 7px; border-radius: 999px;
  color: var(--tk-c, var(--ramp-1));
  background: color-mix(in srgb, var(--tk-c, var(--ramp-1)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--tk-c, var(--ramp-1)) 30%, transparent);
  transform: translateZ(20px);
}

/* 前两年：Bento 加大卡 */
#listWrap.tk-grid .ycell[data-y="2025"],
#listWrap.tk-grid .ycell[data-y="2024"] {
  grid-column: span 2;
  min-height: 132px;
  padding: 18px 20px 16px;
}
#listWrap.tk-grid .ycell[data-y="2025"] b { font-size: 34px; }
#listWrap.tk-grid .ycell[data-y="2024"] b { font-size: 30px; }
#listWrap.tk-grid .ycell[data-y="2025"] {
  background:
    radial-gradient(120% 130% at 0% 0%, color-mix(in srgb, var(--ramp-1) 30%, transparent), transparent 62%),
    radial-gradient(90% 120% at 100% 100%, color-mix(in srgb, var(--ramp-3) 16%, transparent), transparent 60%),
    color-mix(in srgb, var(--card) 86%, transparent);
}
#listWrap.tk-grid .ycell[data-y="2025"]::before,
#listWrap.tk-grid .ycell[data-y="2024"]::before { opacity: .5; }

/* ---------- 4. 题目列表卡：轻微 3D ---------- */
#listWrap.list .qcard {
  position: relative;
  transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .18s ease-out, border-color .18s, box-shadow .25s;
  will-change: transform;
  overflow: hidden;
}
#listWrap.list .qcard.tk-tilt {
  transition: transform .06s linear, border-color .18s, box-shadow .25s;
  border-color: color-mix(in srgb, var(--ramp-2) 38%, var(--line)) !important;
}
#listWrap.list .qcard::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--ramp-2) 12%, transparent), transparent 65%);
  opacity: 0; transition: opacity .25s;
}
#listWrap.list .qcard.tk-tilt::after { opacity: 1; }

/* 列表模式下隐藏 Bento 首屏 */
#page-tiku.tk-listview .tk-hero,
#page-tiku.tk-listview .tk-marquee { display: none; }

/* 入场动画 */
@media (prefers-reduced-motion: no-preference) {
  #listWrap.tk-grid .ycell {
    animation: tkIn .45s cubic-bezier(.22,.7,0,1) both;
    animation-delay: calc(var(--i, 0) * 28ms);
  }
  @keyframes tkIn {
    from { opacity: 0; transform: translateY(10px) scale(.985); }
    to { opacity: 1; transform: none; }
  }
}

/* ---------- 5. 响应式 ---------- */
@media (max-width: 1100px) {
  #listWrap.tk-grid.year-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .tk-hero { grid-template-columns: 1fr; padding: 20px; }
  .tk-hero-side { display: none; }
}
@media (max-width: 620px) {
  #listWrap.tk-grid.year-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #listWrap.tk-grid .ycell { min-height: 96px; padding: 13px 13px 12px; }
  #listWrap.tk-grid .ycell b { font-size: 21px; }
  #listWrap.tk-grid .ycell[data-y="2025"] b { font-size: 28px; }
  #listWrap.tk-grid .ycell[data-y="2024"] b { font-size: 25px; }
  .tk-hero { border-radius: 18px; margin-bottom: 12px; }
  .tk-title { font-size: 25px; }
  .tk-marquee { margin-bottom: 12px; }
}

/* 触屏/无 hover：关闭 3D 变换，避免卡顿 */
@media (hover: none), (pointer: coarse) {
  .tk-hero,
  #listWrap.tk-grid .ycell,
  #listWrap.list .qcard { transform: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .tk-hero, #listWrap.tk-grid .ycell, #listWrap.list .qcard { transform: none !important; }
  .tk-track { animation: none; }
  #listWrap.tk-grid .ycell { animation: none !important; }
}
