/* ==========================================================================
   世界历史互动学习网站 · 设计系统
   复古羊皮纸 × 博物馆质感 × 现代卡片式
   ========================================================================== */

:root {
  --parchment: #f4ead2;
  --paper: #fdf8ec;
  --paper-2: #f7efd9;
  --ink: #33281a;
  --ink-soft: #6f5f45;
  --ink-faint: #9a8a6b;
  --line: #e0d0ac;
  --line-strong: #c9b586;
  --bronze: #8a6d3b;
  --bronze-dark: #6b5228;
  --deep: #22314e;
  --deep-2: #182338;
  --gold: #c9a227;
  --ok: #2e7d32;
  --ok-soft: #2e7d3218;
  --bad: #b3402e;
  --bad-soft: #b3402e14;
  --shadow: 0 2px 10px rgba(60, 44, 18, .10), 0 10px 30px rgba(60, 44, 18, .08);
  --shadow-lift: 0 4px 14px rgba(60, 44, 18, .16), 0 16px 44px rgba(60, 44, 18, .12);
  --radius: 14px;
  --radius-sm: 9px;
  --serif: "Noto Serif SC", "Source Han Serif SC", "STZhongsong", "SimSun", Georgia, serif;
  --sans: "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

/* 神话体系主题色 */
[data-theme="norse"]   { --uc: #4a7a9b; }
[data-theme="greek"]   { --uc: #3a6ea5; }
[data-theme="roman"]   { --uc: #7d5a8c; }
[data-theme="egypt"]   { --uc: #b08a2c; }
[data-theme="japan"]   { --uc: #b05568; }
[data-theme="celtic"]  { --uc: #3e7a52; }
[data-theme="india"]   { --uc: #c9622f; }
[data-theme="china"]   { --uc: #a63a3a; }
[data-theme="meso"]    { --uc: #2f8f7a; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  background-color: var(--parchment);
  background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(201, 162, 39, .10), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(138, 109, 59, .08), transparent 55%),
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(120, 90, 40, .012) 2px 4px);
  min-height: 100vh;
}

h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.3; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
a { color: var(--bronze-dark); }
img { max-width: 100%; }
button { font-family: inherit; }

::selection { background: rgba(201, 162, 39, .35); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--ink-soft); }
.small { font-size: .86rem; }
.center { text-align: center; }
.mt { margin-top: 22px; }
.mb0 { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   顶栏导航
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 90;
  background: linear-gradient(180deg, var(--deep-2), var(--deep));
  color: #f3ecd8;
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 4px 18px rgba(20, 28, 48, .25);
}
.topbar-in {
  max-width: 1120px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 14px; min-height: 58px; flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-weight: 700; font-size: 1.12rem;
  color: #f7f0da; text-decoration: none; letter-spacing: 1px; padding: 8px 0;
}
.brand .logo { font-size: 1.45rem; filter: drop-shadow(0 1px 0 rgba(0,0,0,.4)); }
.brand small { font-weight: 400; opacity: .72; font-size: .72rem; letter-spacing: 2px; display: block; line-height: 1; }
.nav-links { display: flex; gap: 2px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.nav-links a {
  color: #e8dfc4; text-decoration: none; font-size: .95rem;
  padding: 7px 12px; border-radius: 8px; transition: background .18s, color .18s;
}
.nav-links a:hover { background: rgba(255, 244, 214, .12); color: #fff; }
.nav-links a.active { background: var(--gold); color: #2c2410; font-weight: 600; }
.nav-pts {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(201, 162, 39, .16); border: 1px solid rgba(201, 162, 39, .5);
  color: #ffe9a8; border-radius: 999px; padding: 3px 12px; font-size: .85rem; white-space: nowrap;
}
.icon-btn {
  background: transparent; border: 1px solid rgba(232, 223, 196, .35);
  color: #e8dfc4; border-radius: 8px; padding: 5px 9px; cursor: pointer; font-size: .95rem;
  transition: background .18s;
}
.icon-btn:hover { background: rgba(255, 244, 214, .12); }
.hamburger { display: none; margin-left: auto; }

@media (max-width: 920px) {
  .hamburger { display: inline-block; }
  .nav-links {
    display: none; width: 100%; flex-direction: column; padding: 6px 0 12px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 12px; font-size: 1rem; }
}

/* --------------------------------------------------------------------------
   英雄区
   -------------------------------------------------------------------------- */
.hero {
  position: relative; color: #f8f2df; overflow: hidden;
  background: var(--deep-2); border-bottom: 3px solid var(--gold);
}
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .5; }
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20, 28, 48, .30), rgba(24, 35, 56, .78) 70%, rgba(24, 35, 56, .92));
}
.hero-in { position: relative; z-index: 2; padding: 64px 20px 56px; max-width: 1120px; margin: 0 auto; }
.hero h1 { font-size: clamp(1.9rem, 4.6vw, 3rem); letter-spacing: 2px; text-shadow: 0 2px 12px rgba(0,0,0,.45); }
.hero p { max-width: 640px; font-size: 1.05rem; color: #efe7cd; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
.hero .kicker {
  display: inline-block; font-size: .82rem; letter-spacing: 4px;
  border: 1px solid rgba(201, 162, 39, .65); color: #ffe9a8;
  padding: 4px 14px; border-radius: 999px; margin-bottom: 14px; background: rgba(34, 49, 78, .5);
}

/* --------------------------------------------------------------------------
   卡片 / 区块
   -------------------------------------------------------------------------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  position: relative;
}
.card.pad-lg { padding: 30px 34px; }
.section { padding: 34px 0 10px; }
.section > h2 {
  font-size: 1.55rem; display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
}
.section > h2 .orn { color: var(--bronze); font-size: 1.1rem; }
.section > h2::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------------
   按钮 / 徽章 chip
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  background: linear-gradient(180deg, var(--bronze), var(--bronze-dark));
  color: #fff8e6; border: 1px solid var(--bronze-dark);
  padding: 10px 22px; border-radius: 10px; font-size: 1rem; cursor: pointer;
  text-decoration: none; letter-spacing: 1px;
  box-shadow: 0 2px 0 rgba(90, 66, 30, .45), 0 6px 14px rgba(90, 66, 30, .22);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 0 rgba(90, 66, 30, .45), 0 10px 20px rgba(90, 66, 30, .26); filter: brightness(1.06); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.gold { background: linear-gradient(180deg, #d9b13a, #a8862a); border-color: #8a6d1f; color: #2c2410; }
.btn.ghost {
  background: transparent; color: var(--bronze-dark);
  border: 1.5px solid var(--line-strong); box-shadow: none;
}
.btn.ghost:hover { background: rgba(138, 109, 59, .08); }
.btn.small { padding: 6px 14px; font-size: .88rem; }
.btn.ok { background: linear-gradient(180deg, #3a9142, #2e7d32); border-color: #256a2a; }
.btn.danger { background: linear-gradient(180deg, #c25645, #a03a28); border-color: #83301f; }

.chip {
  display: inline-block; font-size: .8rem; padding: 2px 11px; border-radius: 999px;
  background: color-mix(in srgb, var(--uc, var(--bronze)) 12%, transparent);
  color: color-mix(in srgb, var(--uc, var(--bronze)) 80%, black);
  border: 1px solid color-mix(in srgb, var(--uc, var(--bronze)) 35%, transparent);
  white-space: nowrap;
}
.chip.plain { background: rgba(138, 109, 59, .10); color: var(--ink-soft); border-color: var(--line-strong); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* --------------------------------------------------------------------------
   进度条 / 圆环 / 统计
   -------------------------------------------------------------------------- */
.bar {
  height: 10px; border-radius: 999px; overflow: hidden;
  background: rgba(138, 109, 59, .16); border: 1px solid var(--line);
}
.bar > i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--uc, var(--bronze)), color-mix(in srgb, var(--uc, var(--bronze)) 60%, #c9a227));
  transition: width .6s ease;
}
.ring { position: relative; width: 116px; height: 116px; }
.ring svg { transform: rotate(-90deg); }
.ring .num {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-family: var(--serif);
}
.ring .num b { font-size: 1.7rem; }
.ring .num span { font-size: .78rem; color: var(--ink-soft); }

.stat {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  padding: 16px 10px;
}
.stat .ic { font-size: 1.7rem; }
.stat b { font-family: var(--serif); font-size: 1.45rem; }
.stat span { font-size: .84rem; color: var(--ink-soft); }

/* --------------------------------------------------------------------------
   单元卡片
   -------------------------------------------------------------------------- */
.unit-card {
  display: flex; flex-direction: column; overflow: hidden; padding: 0;
  transition: transform .2s, box-shadow .2s;
}
.unit-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.unit-card .cover { position: relative; height: 168px; overflow: hidden; background: var(--paper-2); }
.unit-card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.unit-card .cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, color-mix(in srgb, var(--uc) 55%, #241c0e));
}
.unit-card .u-num {
  position: absolute; left: 14px; top: 12px; z-index: 2;
  background: var(--gold); color: #2c2410; font-family: var(--serif); font-weight: 700;
  border-radius: 8px; padding: 2px 11px; font-size: .95rem; box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.unit-card .cover .u-title {
  position: absolute; left: 16px; right: 16px; bottom: 10px; z-index: 2; color: #fff;
  font-family: var(--serif); font-size: 1.18rem; font-weight: 700; text-shadow: 0 2px 8px rgba(0,0,0,.6);
}
.unit-card .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.unit-card .body p { font-size: .92rem; color: var(--ink-soft); margin: 0; }
.unit-card .meta { display: flex; justify-content: space-between; align-items: center; font-size: .84rem; color: var(--ink-faint); }
.unit-card .bar { height: 8px; }
.unit-mini {
  border: 1px solid var(--line); border-left: 4px solid var(--uc, var(--bronze));
  border-radius: 8px; padding: 8px 12px; background: var(--paper-2);
  display: flex; align-items: center; gap: 10px; font-size: .9rem;
}
.unit-mini .st { margin-left: auto; font-size: .8rem; color: var(--ink-faint); white-space: nowrap; }
.unit-mini a { color: var(--ink); text-decoration: none; }
.unit-mini a:hover { color: var(--uc); }
.unit-mini a { flex: 1; }

/* --------------------------------------------------------------------------
   课程正文
   -------------------------------------------------------------------------- */
.lesson-head { padding: 40px 0 6px; }
.lesson-head .crumb { font-size: .88rem; color: var(--ink-faint); margin-bottom: 10px; }
.lesson-head .crumb a { color: var(--ink-soft); }
.lesson-head h1 { font-size: clamp(1.6rem, 3.6vw, 2.3rem); }
.lesson-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.lead {
  font-family: var(--serif); font-size: 1.08rem; color: var(--ink-soft);
  border-left: 4px solid var(--uc, var(--bronze));
  padding: 6px 0 6px 16px; margin: 18px 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--uc, var(--bronze)) 7%, transparent), transparent);
}
.lesson-body { padding-bottom: 10px; }
.lesson-body section.block { margin: 26px 0; }
.lesson-body h2 { font-size: 1.34rem; display: flex; align-items: baseline; gap: 10px; }
.lesson-body h2::before {
  content: "§"; color: var(--uc, var(--bronze)); font-size: 1.1rem;
}
.lesson-body p { font-size: 1.02rem; text-align: justify; }
.lesson-body > section.block:first-of-type > p:first-of-type::first-letter {
  font-family: var(--serif); font-size: 2.6em; float: left;
  line-height: .9; padding: 4px 8px 0 0; color: var(--uc, var(--bronze)); font-weight: 700;
}
.fact {
  display: flex; gap: 12px; align-items: flex-start;
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 14%, var(--paper)), var(--paper));
  border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  padding: 14px 16px; margin: 16px 0; font-size: .96rem;
}
.fact .fi { font-size: 1.3rem; line-height: 1.4; }
.keypoints {
  background: color-mix(in srgb, var(--uc, var(--bronze)) 7%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--uc, var(--bronze)) 30%, var(--line));
  border-radius: var(--radius); padding: 18px 22px; margin: 22px 0;
}
.keypoints h3 { font-size: 1.1rem; color: var(--uc, var(--bronze-dark)); }
.keypoints ul { margin: 0; padding-left: 20px; }
.keypoints li { margin: 6px 0; }

figure.imgfig {
  margin: 20px 0; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  background: var(--paper-2);
}
figure.imgfig img { display: block; width: 100%; max-height: 430px; object-fit: cover; }
figure.imgfig figcaption {
  font-size: .8rem; color: var(--ink-faint); padding: 8px 14px;
  background: var(--paper); border-top: 1px dashed var(--line);
}

.sources { margin: 26px 0; }
.sources h3 { font-size: 1.05rem; color: var(--ink-soft); display: flex; gap: 8px; align-items: center; }
.sources ol { margin: 8px 0 0; padding-left: 22px; font-size: .9rem; color: var(--ink-soft); }
.sources li { margin: 5px 0; }
.lesson-foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border-top: 1px dashed var(--line-strong); padding-top: 18px; margin-top: 26px;
}

/* 已学完标记 */
.done-mark {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ok); font-weight: 600; font-size: .92rem;
}

/* --------------------------------------------------------------------------
   时间轴
   -------------------------------------------------------------------------- */
.tl-wrap { position: relative; padding: 10px 0; }
.tl-rail { position: absolute; left: 18px; top: 0; bottom: 0; width: 3px; background: linear-gradient(180deg, var(--line-strong), var(--gold), var(--line-strong)); border-radius: 3px; }
.tl-item { position: relative; padding: 0 0 22px 54px; }
.tl-item .dot {
  position: absolute; left: 9px; top: 6px; width: 21px; height: 21px; border-radius: 50%;
  background: var(--uc, var(--bronze)); border: 3px solid var(--paper);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--uc, var(--bronze)) 60%, transparent), 0 2px 6px rgba(0,0,0,.2);
}
.tl-item .year {
  font-family: var(--serif); font-weight: 700; font-size: 1.05rem; color: var(--uc, var(--bronze-dark));
}
.tl-item .card { padding: 14px 18px; cursor: pointer; transition: transform .18s, box-shadow .18s; }
.tl-item .card:hover { transform: translateX(4px); box-shadow: var(--shadow-lift); }
.tl-item .detail { display: none; margin-top: 8px; font-size: .94rem; color: var(--ink-soft); border-top: 1px dashed var(--line); padding-top: 8px; }
.tl-item.open .detail { display: block; }
@media (min-width: 860px) {
  .tl-rail { left: 50%; transform: translateX(-50%); }
  .tl-item { width: 50%; padding: 0 44px 26px 0; }
  .tl-item .dot { left: auto; right: -11px; }
  .tl-item:nth-child(even) { margin-left: 50%; padding: 0 0 26px 44px; }
  .tl-item:nth-child(even) .dot { right: auto; left: -11px; }
}
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 22px; }
.fchip {
  border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink-soft);
  border-radius: 999px; padding: 5px 14px; font-size: .86rem; cursor: pointer; transition: all .15s;
}
.fchip:hover { border-color: var(--bronze); color: var(--bronze-dark); }
.fchip.on { background: var(--deep); color: #ffe9a8; border-color: var(--deep); }

/* --------------------------------------------------------------------------
   地图页
   -------------------------------------------------------------------------- */
.map-stage { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.map-stage > img { display: block; width: 100%; }
.pin {
  position: absolute; transform: translate(-50%, -50%); z-index: 3;
  width: 26px; height: 26px; border-radius: 50% 50% 50% 4px;
  background: var(--uc, var(--bronze)); border: 2.5px solid #fff8e6;
  box-shadow: 0 3px 10px rgba(0,0,0,.35); cursor: pointer;
  transition: transform .15s; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 700; font-family: var(--serif);
}
.pin:hover { transform: translate(-50%, -50%) scale(1.25); z-index: 5; }
.pin.done { background: var(--ok); }
.pin.guess { background: var(--gold); }
.map-info { margin-top: 14px; }

/* --------------------------------------------------------------------------
   游戏与练习
   -------------------------------------------------------------------------- */
.game-card {
  display: flex; flex-direction: column; gap: 10px; overflow: hidden; padding: 0;
  transition: transform .2s, box-shadow .2s;
}
.game-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.game-card .gi {
  font-size: 2rem; text-align: center; padding: 22px 0 0;
}
.game-card .body { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.game-card h3 { margin: 0; font-size: 1.15rem; }
.game-card p { margin: 0; font-size: .9rem; color: var(--ink-soft); flex: 1; }
.game-card .hs { font-size: .84rem; color: var(--bronze-dark); }

.gbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--deep); color: #efe7cd; border-radius: var(--radius);
  padding: 10px 18px; margin-bottom: 16px; font-size: .92rem;
}
.gbar b { color: var(--gold); font-family: var(--serif); font-size: 1.05rem; }
.gbar .sp { flex: 1; }

.opt {
  display: block; width: 100%; text-align: left; margin: 8px 0; padding: 12px 16px;
  background: var(--paper); border: 1.5px solid var(--line-strong); border-radius: 10px;
  font-size: .98rem; cursor: pointer; transition: all .15s; color: var(--ink);
}
.opt:hover:not(:disabled) { border-color: var(--bronze); background: rgba(138, 109, 59, .06); transform: translateX(3px); }
.opt.sel { border-color: var(--bronze); background: rgba(201, 162, 39, .14); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt:disabled { cursor: default; opacity: .9; }
.opt .ol { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-strong); align-items: center; justify-content: center; margin-right: 10px; font-size: .82rem; flex: none; }
.opt.right .ol { background: var(--ok); color: #fff; border-color: var(--ok); }
.opt.wrong .ol { background: var(--bad); color: #fff; border-color: var(--bad); }

.feedback {
  border-radius: var(--radius); padding: 16px 20px; margin: 16px 0; display: none;
  border: 1.5px solid; animation: pop .25s ease;
}
.feedback.show { display: block; }
.feedback.good { background: var(--ok-soft); border-color: var(--ok); }
.feedback.bad { background: var(--bad-soft); border-color: var(--bad); }
.feedback .ft { font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.feedback.good .ft { color: var(--ok); }
.feedback.bad .ft { color: var(--bad); }
.feedback .ans { margin-top: 8px; font-size: .95rem; }
.feedback .exp { margin-top: 6px; font-size: .93rem; color: var(--ink-soft); }
.feedback .src { margin-top: 8px; font-size: .8rem; color: var(--ink-faint); border-top: 1px dashed var(--line); padding-top: 6px; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.seq-slot {
  min-height: 46px; border: 1.5px dashed var(--line-strong); border-radius: 10px;
  padding: 8px 12px; margin: 8px 0; display: flex; align-items: center; gap: 10px;
  background: var(--paper-2); font-size: .95rem;
}
.seq-slot .n {
  width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--deep); color: #ffe9a8;
  display: inline-flex; align-items: center; justify-content: center; font-size: .82rem; font-family: var(--serif);
}
.seq-bank { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.seq-bank .opt { width: auto; margin: 0; }
.seq-bank .opt.used { opacity: .45; text-decoration: line-through; }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
@media (max-width: 560px) { .match-grid { grid-template-columns: 1fr; } }
.match-col { display: flex; flex-direction: column; gap: 8px; }

.flip-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 560px; margin: 0 auto; }
@media (max-width: 560px) { .flip-grid { grid-template-columns: repeat(3, 1fr); } }
.flip {
  aspect-ratio: 3/4; perspective: 700px; cursor: pointer; border: none; background: none; padding: 0;
}
.flip .inner { position: relative; width: 100%; height: 100%; transition: transform .45s; transform-style: preserve-3d; }
.flip.open .inner, .flip.matched .inner { transform: rotateY(180deg); }
.flip .face {
  position: absolute; inset: 0; backface-visibility: hidden; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.flip .back {
  background: linear-gradient(145deg, var(--deep), var(--deep-2));
  border: 2px solid var(--gold); color: var(--gold); font-family: var(--serif); font-size: 1.5rem;
}
.flip .front {
  background: var(--paper); border: 2px solid var(--line-strong); transform: rotateY(180deg);
  font-size: 1.9rem; padding: 4px;
}
.flip .front small { font-size: .62rem; color: var(--ink-soft); text-align: center; line-height: 1.2; }
.flip.matched .front { border-color: var(--ok); background: var(--ok-soft); animation: pulse .5s; }
@keyframes pulse { 0% { transform: rotateY(180deg) scale(1); } 50% { transform: rotateY(180deg) scale(1.08); } 100% { transform: rotateY(180deg) scale(1); } }

.clue-box {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 16px; margin: 8px 0; display: flex; gap: 10px; font-size: .96rem;
}
.clue-box .cn { color: var(--gold); font-family: var(--serif); font-weight: 700; }

.big-num { font-family: var(--serif); font-size: 2.6rem; font-weight: 700; color: var(--bronze-dark); }

.review-item { border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: 8px; padding: 10px 14px; margin: 10px 0; background: var(--paper-2); font-size: .92rem; }
.review-item.good { border-left-color: var(--ok); }
.review-item.bad { border-left-color: var(--bad); }
.review-item .ra { margin: 4px 0; }
.review-item .re { color: var(--ink-soft); font-size: .88rem; }

/* --------------------------------------------------------------------------
   徽章
   -------------------------------------------------------------------------- */
.badge {
  text-align: center; padding: 18px 12px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--paper); transition: transform .18s;
}
.badge:hover { transform: translateY(-3px); }
.badge .bi { font-size: 2.2rem; filter: grayscale(1); opacity: .35; }
.badge.earned .bi { filter: none; opacity: 1; text-shadow: 0 2px 10px rgba(201, 162, 39, .5); }
.badge h4 { margin: 8px 0 2px; font-size: 1rem; }
.badge p { margin: 0; font-size: .8rem; color: var(--ink-faint); }
.badge.earned { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), var(--shadow); background: linear-gradient(160deg, #fdf6dd, var(--paper)); }

/* --------------------------------------------------------------------------
   表单 / 练习中心筛选
   -------------------------------------------------------------------------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 14px 0 20px; }
select, input[type="text"] {
  font-family: inherit; font-size: .95rem; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--line-strong); border-radius: 10px;
  padding: 8px 12px; outline: none;
}
select:focus, input:focus { border-color: var(--bronze); }

/* --------------------------------------------------------------------------
   弹窗 / 提示
   -------------------------------------------------------------------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(30, 22, 8, .55); z-index: 200;
  display: none; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--paper); border-radius: var(--radius); border-top: 4px solid var(--gold);
  max-width: 720px; width: 100%; max-height: 86vh; overflow: auto;
  padding: 26px 28px; box-shadow: var(--shadow-lift); animation: up .28s ease;
}
@keyframes up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { font-size: 1.3rem; }

#toast-box { position: fixed; right: 18px; bottom: 18px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--deep); color: #f3ecd8; border-left: 4px solid var(--gold);
  border-radius: 10px; padding: 12px 18px; font-size: .92rem; box-shadow: var(--shadow-lift);
  animation: slidein .3s ease; max-width: 320px;
}
.toast.ok { border-left-color: var(--ok); }
.toast.bad { border-left-color: var(--bad); }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 成就解锁彩带 */
.confetti { position: fixed; top: -12px; z-index: 400; font-size: 1.2rem; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(660deg); opacity: .6; } }

/* --------------------------------------------------------------------------
   滚动渐入
   -------------------------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .55s ease, transform .55s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* --------------------------------------------------------------------------
   页脚
   -------------------------------------------------------------------------- */
.footer {
  margin-top: 48px; background: var(--deep-2); color: #cabfa0;
  border-top: 3px solid var(--gold); padding: 26px 0 30px; font-size: .88rem;
}
.footer .wrap { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: center; }
.footer a { color: #ffe9a8; }

/* --------------------------------------------------------------------------
   首页每日一史 / 快捷入口
   -------------------------------------------------------------------------- */
.daily { display: flex; gap: 16px; align-items: stretch; }
.daily .di { font-size: 2.4rem; align-self: center; }
.daily .dt { font-family: var(--serif); font-weight: 700; color: var(--bronze-dark); }
@media (max-width: 620px) { .daily { flex-direction: column; } }
.quick {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--paper);
  text-decoration: none; color: var(--ink); transition: transform .18s, box-shadow .18s;
}
.quick:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.quick .qi { font-size: 1.6rem; }
.quick b { font-family: var(--serif); }
.quick span { display: block; font-size: .82rem; color: var(--ink-faint); }

/* 打印与无障碍 */
a:focus-visible, button:focus-visible, select:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ==========================================================================
   神话站扩展：人物卡 / 图鉴 / 交互式谱系图 / 对应表
   ========================================================================== */
.char-wall { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 980px) { .char-wall { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .char-wall { grid-template-columns: 1fr; } }
.char-card {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 6px; padding: 18px 12px 16px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper);
  transition: transform .18s, box-shadow .18s; position: relative;
}
.char-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.char-card .av {
  width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem; background: color-mix(in srgb, var(--uc) 14%, var(--paper));
  border: 2px solid color-mix(in srgb, var(--uc) 45%, transparent);
}
.char-card h4 { margin: 2px 0 0; font-size: 1.05rem; }
.char-card .role { font-size: .78rem; color: var(--ink-faint); }
.char-card .aka { font-size: .8rem; color: var(--ink-soft); }
.char-card .met { position: absolute; top: 8px; right: 10px; font-size: .8rem; color: var(--ok); }
.char-detail-head { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.char-detail-head .av {
  width: 72px; height: 72px; flex: none; border-radius: 50%; font-size: 2.2rem;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--uc) 14%, var(--paper));
  border: 2px solid color-mix(in srgb, var(--uc) 45%, transparent);
}
.rel-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px; margin: 6px 0;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 9px; font-size: .93rem;
}
.rel-row .rt {
  flex: none; font-size: .78rem; padding: 1px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--uc) 14%, transparent); color: var(--bronze-dark);
  border: 1px solid color-mix(in srgb, var(--uc) 35%, transparent);
}
.sym-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* 谱系图 */
.gen-stage {
  position: relative; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  touch-action: none; cursor: grab; min-height: 540px;
}
.gen-stage:active { cursor: grabbing; }
.gen-stage svg { display: block; }
.gen-node { cursor: pointer; }
.gen-node .box { transition: filter .15s; }
.gen-node:hover .box { filter: brightness(1.06) drop-shadow(0 3px 8px rgba(60,44,18,.25)); }
.gen-node.dim { opacity: .22; transition: opacity .25s; }
.gen-node .nname { font-family: var(--serif); font-weight: 700; fill: #33281a; }
.gen-node .nrole { fill: #6f5f45; }
.gen-edge { fill: none; stroke: #b9a06a; stroke-width: 2.2; transition: stroke .2s; }
.gen-edge.hot { stroke: var(--uc, #8a6d3b); stroke-width: 3.4; }
.gen-edge-label { font-size: 11px; fill: #8a6d3b; paint-order: stroke; stroke: #fdf8ec; stroke-width: 3px; }
.gen-level-band { fill: color-mix(in srgb, var(--uc, #8a6d3b) 5%, transparent); }
.gen-level-name { font-family: var(--serif); font-weight: 700; fill: #8a6d3b; font-size: 15px; letter-spacing: 2px; }
.gen-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; }
.gen-tip { font-size: .84rem; color: var(--ink-faint); }

/* 对应表 */
.pair-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.pair-table th, .pair-table td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; }
.pair-table th { background: color-mix(in srgb, var(--uc, #8a6d3b) 10%, var(--paper)); font-family: var(--serif); }
.pair-table tr:hover td { background: rgba(201, 162, 39, .07); }

/* 今日一神 */
.god-daily { display: flex; gap: 16px; align-items: center; }
.god-daily .av {
  width: 74px; height: 74px; flex: none; border-radius: 50%; font-size: 2.4rem;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--uc) 14%, var(--paper));
  border: 2px solid color-mix(in srgb, var(--uc) 45%, transparent);
}
@media (max-width: 620px) { .god-daily { flex-direction: column; text-align: center; } }
