/* ==========================================================================
   六爻工具 — 视觉与版式
   宣纸、墨色、朱砂、青瓷。无外部字体与图片依赖。
   ========================================================================== */

:root {
  --paper: #f4eee3;
  --paper-2: #fbf7ef;
  --paper-3: #efe6d7;
  --white: #fffdf8;
  --ink: #1d2421;
  --ink-2: #3d4842;
  --muted: #737a74;
  --line: #d9cdbb;
  --line-2: #c9b9a2;
  --red: #9b332a;
  --red-2: #7d251f;
  --red-soft: #f2dfd9;
  --jade: #2f5b4d;
  --jade-soft: #e0ebe5;
  --gold: #98743a;
  --gold-soft: #f1e6cf;
  --blue: #355f78;
  --shadow-sm: 0 2px 8px rgba(55, 39, 20, .06);
  --shadow: 0 24px 60px -34px rgba(55, 39, 20, .42);
  --radius: 14px;
  --radius-sm: 9px;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --max: 1180px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 10% -8%, rgba(155, 51, 42, .075), transparent 34%),
    radial-gradient(circle at 92% 5%, rgba(47, 91, 77, .075), transparent 30%),
    repeating-linear-gradient(0deg, rgba(78, 58, 37, .018) 0, rgba(78, 58, 37, .018) 1px, transparent 1px, transparent 5px);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--red-soft); color: var(--red-2); }

a { color: var(--red-2); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--red); }

img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: .02em;
  color: var(--ink);
}

p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.35em; }
li { margin: .35em 0; }

:focus-visible {
  outline: 3px solid rgba(155, 51, 42, .34);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--ink);
  color: var(--white);
  padding: 8px 14px;
  border-radius: 6px;
  transition: top .2s;
}
.skip-link:focus { top: 12px; color: var(--white); }

.wrap {
  width: min(var(--max), calc(100% - 40px));
  margin-inline: auto;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Header ------------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(201, 185, 162, .7);
  background: rgba(244, 238, 227, .9);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 68px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  flex: 0 0 auto;
}
.brand:hover { color: var(--ink); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 5px;
  background: var(--red);
  color: #fff8ee;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22), 0 4px 12px rgba(125, 37, 31, .2);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.08; }
.brand-name { font-family: var(--serif); font-size: 20px; font-weight: 700; letter-spacing: .08em; }
.brand-sub { color: var(--muted); font-size: 10px; letter-spacing: .16em; margin-top: 4px; }

.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a {
  display: block;
  padding: 8px 11px;
  border-radius: 7px;
  color: var(--ink-2);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}
.site-nav a:hover { background: rgba(155, 51, 42, .07); color: var(--red-2); }
.site-nav a[aria-current="page"] { color: var(--red-2); font-weight: 700; background: rgba(155, 51, 42, .08); }
.header-cta { flex: 0 0 auto; }
.nav-toggle {
  display: none;
  width: 42px; height: 40px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font-size: 13px;
}

/* Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background .18s, color .18s, border-color .18s, transform .18s, box-shadow .18s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--red);
  border-color: var(--red);
  color: #fffaf2;
  box-shadow: 0 8px 22px -12px rgba(125, 37, 31, .8);
}
.btn-primary:hover { background: var(--red-2); border-color: var(--red-2); color: #fffaf2; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--paper-2); }
.btn-dark:hover { background: #000; color: var(--paper-2); }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--ink-2); }
.btn-ghost:hover { background: var(--paper-3); color: var(--ink); }
.btn-soft { background: var(--paper-3); border-color: transparent; color: var(--ink-2); }
.btn-soft:hover { background: #e7dccb; color: var(--ink); }
.btn-sm { min-height: 34px; padding: 6px 11px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }

/* Hero -------------------------------------------------------------------- */
.hero { position: relative; padding: 52px 0 26px; overflow: hidden; }
.hero::after {
  content: "易";
  position: absolute;
  right: 1%;
  top: -30px;
  z-index: -1;
  color: rgba(155, 51, 42, .05);
  font-family: var(--serif);
  font-size: clamp(160px, 24vw, 320px);
  line-height: 1;
  pointer-events: none;
}
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
  padding: 5px 10px;
  border: 1px solid rgba(155, 51, 42, .22);
  border-radius: 999px;
  background: rgba(255, 253, 248, .55);
  color: var(--red-2);
  font-size: 12px;
  letter-spacing: .08em;
}
.hero-kicker::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(155, 51, 42, .12);
}
.hero h1 {
  max-width: 900px;
  font-size: clamp(34px, 5.2vw, 58px);
  letter-spacing: .035em;
  line-height: 1.16;
}
.hero h1 em { font-style: normal; color: var(--red-2); }
.hero-lead {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--ink-2);
  font-size: clamp(15px, 1.5vw, 17px);
  line-height: 1.85;
}
.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, .6);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.4;
}
.chip strong { color: var(--ink); font-weight: 700; }
.chip-red { border-color: rgba(155, 51, 42, .25); background: var(--red-soft); color: var(--red-2); }
.chip-jade { border-color: rgba(47, 91, 77, .22); background: var(--jade-soft); color: var(--jade); }

/* Tool -------------------------------------------------------------------- */
.tool-section { padding: 12px 0 60px; }
.tool-shell {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.tool-shell::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--red), #c06a51 34%, var(--gold) 68%, var(--jade));
  opacity: .9;
}
.tool-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 27px 30px 22px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(250, 246, 238, .9), rgba(255, 253, 248, .7)),
    radial-gradient(circle at 88% 20%, rgba(47, 91, 77, .07), transparent 38%);
}
.tool-head h2 { font-size: clamp(24px, 3vw, 34px); }
.tool-head p { max-width: 720px; margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.tool-head-meta { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; min-width: 210px; }
.tool-grid { display: grid; grid-template-columns: 350px minmax(0, 1fr); }
.cast-panel {
  padding: 26px 26px 24px;
  border-right: 1px solid var(--line);
  background: var(--paper-2);
}
.board-panel { padding: 26px 28px 24px; min-width: 0; }
.board-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.board-head h3 { font-size: 22px; }
.board-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.progress {
  flex: 0 0 auto;
  min-width: 72px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
}

.field { margin-bottom: 17px; }
.field > label, .field > .label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}
.field > label span, .field > .label span { color: var(--muted); font-size: 11px; font-weight: 400; }
.field input[type="datetime-local"],
.field input[type="text"],
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.5;
  transition: border-color .18s, box-shadow .18s;
}
.field textarea { resize: vertical; min-height: 68px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(155, 51, 42, .12);
}
.field-hint { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.field-hint.error { color: var(--red-2); }
.inline-action {
  display: inline-flex;
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--red-2);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.counter { margin: 3px 0 0; color: var(--muted); font-size: 11px; text-align: right; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper-3);
}
.segmented button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}
.segmented button.active {
  background: var(--white);
  color: var(--red-2);
  box-shadow: var(--shadow-sm);
}

.form-actions { display: grid; grid-template-columns: 1fr .82fr; gap: 8px; margin-top: 20px; }
.form-actions .btn { min-height: 46px; }
.form-note { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

.coin-tray {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 142px;
  margin-bottom: 16px;
  padding: 13px 14px 10px;
  border: 1px dashed var(--line-2);
  border-radius: 11px;
  background:
    radial-gradient(circle at 50% 38%, rgba(152, 116, 58, .14), transparent 56%),
    linear-gradient(180deg, rgba(255, 253, 248, .7), rgba(250, 246, 238, .9));
  overflow: hidden;
}
.coin-tray::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 47%;
  width: 230px;
  height: 100px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(152, 116, 58, .12), transparent 68%);
  pointer-events: none;
}
.coin-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 22px;
}
.coin-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: transform .35s ease;
}
.coin {
  position: relative;
  width: 58px;
  height: 58px;
  perspective: 520px;
  filter: drop-shadow(0 6px 7px rgba(79, 50, 16, .28));
  transition: transform .2s ease;
}
.coin-body {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .62s cubic-bezier(.2, .8, .25, 1);
  will-change: transform;
}
.coin-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.coin-face-back { transform: rotateY(180deg); }
.coin-face::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 255, 255, .52), rgba(255, 255, 255, 0) 43%, rgba(38, 26, 8, .08));
  mix-blend-mode: screen;
  pointer-events: none;
}
.coin-svg { display: block; width: 100%; height: 100%; }
.coin-state {
  min-width: 38px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--paper-3);
  color: var(--ink-2);
  font-size: 10px;
  line-height: 1.6;
  text-align: center;
  transition: background .2s, color .2s;
}
.coin-state.is-front { background: var(--jade-soft); color: var(--jade); }
.coin-state.is-back { background: var(--gold-soft); color: #6f4a14; }
.coin-tray.is-initial .coin-wrap:nth-child(1) { transform: translateY(3px) rotate(-4deg); }
.coin-tray.is-initial .coin-wrap:nth-child(2) { transform: translateY(-3px); }
.coin-tray.is-initial .coin-wrap:nth-child(3) { transform: translateY(3px) rotate(4deg); }
.coin-tray.is-initial .coin-body { transition: none; }
.coin.tossing { animation: coinToss .62s cubic-bezier(.22, .8, .3, 1); }
@keyframes coinToss {
  0% { transform: translateY(0) scale(1); }
  32% { transform: translateY(-24px) scale(1.035); }
  68% { transform: translateY(-8px) scale(.99); }
  100% { transform: translateY(0) scale(1); }
}
.coin-legend {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px 13px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}
.coin-legend span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(60, 40, 15, .18);
}
.legend-front { background: linear-gradient(135deg, #e6efdb, #9fb58a); }
.legend-back { background: linear-gradient(135deg, #f3ddb0, #c39a55); }
.coin-message {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 16px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}
.coin-tray.has-result .coin-message { color: var(--ink-2); }

.line-stack { display: grid; gap: 7px; }
.line-slot {
  display: grid;
  grid-template-columns: 52px minmax(82px, 1fr) minmax(100px, auto);
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  transition: border-color .2s, background .2s;
}
.line-slot.empty { border-style: dashed; background: rgba(250, 246, 238, .5); }
.line-slot.next { border-color: rgba(155, 51, 42, .55); background: #fffaf4; box-shadow: 0 0 0 3px rgba(155, 51, 42, .06); }
.line-slot.filled { animation: lineIn .28s ease-out; }
@keyframes lineIn { from { opacity: .35; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.line-label { color: var(--muted); font-size: 12px; white-space: nowrap; }
.line-slot.filled .line-label { color: var(--ink); font-weight: 700; }
.line-graphic-wrap { display: flex; align-items: center; gap: 5px; min-width: 0; }
.line-graphic { display: flex; flex-direction: column; gap: 3px; width: 74px; }
.line-graphic .hex-row { display: flex; gap: 6px; height: 5px; }
.line-graphic .hex-row i { display: block; height: 5px; border-radius: 1px; background: var(--ink); }
.line-graphic .hex-row.yang i { width: 100%; }
.line-graphic .hex-row.yin { justify-content: space-between; }
.line-graphic .hex-row.yin i { width: 43%; }
.line-graphic .hex-row:not(.yang):not(.yin) i { width: 43%; background: var(--line-2); opacity: .55; }
.line-graphic .moving-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red-2);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
}
.line-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 5px; }
.line-value { color: var(--muted); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--paper-3);
  color: var(--ink-2);
  font-size: 10px;
  line-height: 1.5;
  white-space: nowrap;
}
.tag-red { background: var(--red-soft); color: var(--red-2); }
.tag-jade { background: var(--jade-soft); color: var(--jade); }
.tag-gold { background: var(--gold-soft); color: #74541f; }
.tag-blue { background: #e2ebf1; color: #2e566e; }

.manual-panel { margin-top: 6px; padding-top: 14px; border-top: 1px dashed var(--line); }
.manual-panel[hidden] { display: none; }
.manual-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.manual-row { display: grid; grid-template-columns: 46px 1fr; align-items: center; gap: 8px; }
.manual-row label { color: var(--muted); font-size: 12px; }
.manual-row select { min-width: 0; padding: 7px 8px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--white); font-size: 12px; }
.manual-actions { display: flex; gap: 8px; margin-top: 12px; }
.manual-actions .btn { flex: 1; }

.board-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; }
.board-actions button { border: 0; background: transparent; color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.board-actions button:not(:disabled):hover { color: var(--red-2); }
.board-hint { margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

/* Result ------------------------------------------------------------------ */
.result { padding: 0 28px 30px; scroll-margin-top: 86px; }
.result[hidden] { display: none; }
.result-inner {
  margin-top: 26px;
  padding-top: 25px;
  border-top: 1px solid var(--line);
  animation: resultIn .3s ease-out;
}
@keyframes resultIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.result-head h2 { font-size: clamp(26px, 3.4vw, 38px); line-height: 1.2; }
.result-head h2 .arrow { display: inline-block; margin: 0 10px; color: var(--red); font-family: var(--sans); font-size: .58em; vertical-align: .14em; }
.result-head h2 .changed { color: var(--red-2); }
.result-sub { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.result-actions .btn { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin: 18px 0; }
.meta-item {
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-2);
}
.meta-item dt { color: var(--muted); font-size: 10px; letter-spacing: .05em; }
.meta-item dd { margin: 2px 0 0; color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.meta-item dd .sub { display: block; color: var(--muted); font-size: 10px; font-weight: 400; }
.chart-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .85fr); gap: 16px; align-items: start; }
.chart-card { border: 1px solid var(--line); border-radius: 11px; background: var(--white); overflow: hidden; }
.chart-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--paper-2); }
.chart-card-head h3 { font-size: 16px; }
.chart-card-head span { color: var(--muted); font-size: 10px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.hex-table { width: 100%; min-width: 660px; border-collapse: collapse; font-size: 12px; }
.hex-table caption { caption-side: top; padding: 8px 12px; color: var(--muted); font-size: 11px; text-align: left; }
.hex-table th, .hex-table td { padding: 9px 8px; border-bottom: 1px solid #ece3d5; text-align: center; vertical-align: middle; }
.hex-table th { background: #f6efe4; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .05em; white-space: nowrap; }
.hex-table tr:last-child td { border-bottom: 0; }
.hex-table tbody tr:hover { background: #fffcf6; }
.hex-table .line-cell { min-width: 102px; text-align: left; }
.hex-table .kin { display: inline-block; font-weight: 700; }
.hex-table .najia { color: var(--ink-2); font-family: var(--mono); font-size: 11px; }
.hex-table .fushen-text { color: var(--jade); font-size: 11px; line-height: 1.5; }
.hex-table .is-yong td { background: rgba(155, 51, 42, .045); }
.hex-table .role-tag { display: inline-block; margin-left: 3px; padding: 1px 4px; border-radius: 3px; background: var(--red-soft); color: var(--red-2); font-size: 9px; font-weight: 700; }
.hex-table .tiny-line { display: inline-flex; flex-direction: column; gap: 2px; width: 44px; vertical-align: middle; }
.hex-table .tiny-line .hex-row { display: flex; gap: 3px; height: 3px; }
.hex-table .tiny-line .hex-row i { display: block; height: 3px; background: var(--ink); border-radius: 1px; }
.hex-table .tiny-line .hex-row.yang i { width: 100%; }
.hex-table .tiny-line .hex-row.yin { justify-content: space-between; }
.hex-table .tiny-line .hex-row.yin i { width: 42%; }
.hex-table .moving-row .tiny-line i { background: var(--red-2); }
.hex-table .changed-cell { color: var(--red-2); }
.hex-table .empty-cell { color: #b9afa1; }
.markers { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
.markers .tag { font-size: 9px; padding: 1px 4px; }

.analysis-card { border: 1px solid var(--line); border-radius: 11px; background: var(--white); overflow: hidden; }
.analysis-head { padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--paper-2); }
.analysis-head h3 { font-size: 16px; }
.analysis-block { padding: 12px 14px; border-bottom: 1px solid #ece3d5; }
.analysis-block:last-child { border-bottom: 0; }
.analysis-block h4 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 5px; color: var(--red-2); font-family: var(--sans); font-size: 11px; letter-spacing: .08em; }
.analysis-block p { margin: 0; color: var(--ink-2); font-size: 12px; line-height: 1.7; }
.analysis-block p + p { margin-top: 5px; }
.analysis-block .big { color: var(--ink); font-family: var(--serif); font-size: 20px; font-weight: 700; }
.analysis-block ul { margin: 4px 0 0; padding-left: 16px; }
.analysis-block li { color: var(--ink-2); font-size: 11px; line-height: 1.65; }
.role-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.role-list span { padding: 2px 6px; border-radius: 4px; background: var(--paper-3); font-size: 10px; color: var(--ink-2); }
.analysis-notes { padding: 12px 14px; background: var(--paper-2); }
.analysis-notes h4 { margin: 0 0 6px; color: var(--ink-2); font-family: var(--sans); font-size: 11px; }
.analysis-notes ul { margin: 0; padding-left: 16px; }
.analysis-notes li { color: var(--muted); font-size: 10px; line-height: 1.6; }
.disclaimer-inline { margin: 12px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.interp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.interp-card { padding: 15px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper-2); }
.interp-card h3 { margin-bottom: 7px; font-size: 16px; }
.interp-card p { margin: 0; color: var(--ink-2); font-size: 12px; line-height: 1.75; }
.interp-card .classic { color: var(--ink); font-family: var(--serif); font-size: 15px; line-height: 1.8; }
.interp-card .btn { margin-top: 8px; }
.result-footer-note { margin: 14px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }

/* Sections ---------------------------------------------------------------- */
.section { padding: 58px 0; }
.section-tight { padding: 38px 0; }
.section-alt { background: rgba(251, 247, 239, .68); border-block: 1px solid rgba(217, 205, 187, .7); }
.section-head { max-width: 780px; margin-bottom: 28px; }
.section-head h2 { font-size: clamp(25px, 3.2vw, 36px); }
.section-head p { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.section-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.section-head-row .section-head { margin-bottom: 0; }
.section-link { flex: 0 0 auto; font-size: 13px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.info-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--white);
  box-shadow: var(--shadow-sm);
}
.info-card h3 { margin-bottom: 7px; font-size: 18px; }
.info-card p { margin: 0; color: var(--ink-2); font-size: 13px; line-height: 1.8; }
.info-card .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px; height: 27px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red-2);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}
.info-card .more { display: inline-flex; margin-top: 8px; font-size: 12px; }

.steps { counter-reset: step; display: grid; gap: 0; border-top: 1px solid var(--line); }
.step {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 18px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.step::before {
  counter-increment: step;
  content: "0" counter(step);
  color: var(--red);
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.2;
}
.step h3 { margin-bottom: 4px; font-size: 18px; }
.step p { margin: 0; color: var(--ink-2); font-size: 13px; line-height: 1.8; }

.content-table { width: 100%; border-collapse: collapse; background: var(--white); font-size: 13px; }
.content-table th, .content-table td { padding: 10px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.content-table th { background: var(--paper-2); color: var(--ink); font-size: 12px; font-weight: 700; }
.content-table tr:nth-child(even) td { background: rgba(250, 246, 238, .55); }

.callout {
  padding: 15px 17px;
  border-left: 3px solid var(--red);
  border-radius: 0 8px 8px 0;
  background: var(--red-soft);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.8;
}
.callout strong { color: var(--red-2); }
.callout-jade { border-left-color: var(--jade); background: var(--jade-soft); }
.callout-gold { border-left-color: var(--gold); background: var(--gold-soft); }

.hex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(142px, 1fr)); gap: 9px; }
.hex-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 70px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
  color: var(--ink);
  text-decoration: none;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.hex-card:hover { border-color: var(--line-2); color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.hex-card .hex-lines { flex: 0 0 30px; }
.hex-card .name { display: block; font-family: var(--serif); font-size: 15px; font-weight: 700; line-height: 1.3; }
.hex-card .meta { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.hex-card .no { flex: 0 0 auto; align-self: flex-start; color: var(--line-2); font-family: var(--mono); font-size: 10px; }

.hex-lines { display: inline-flex; flex-direction: column; gap: 3px; width: 30px; color: var(--ink); }
.hex-lines .hex-row { display: flex; gap: 3px; height: 3px; }
.hex-lines .hex-row i { display: block; height: 3px; background: currentColor; border-radius: 1px; }
.hex-lines .hex-row.yang i { width: 100%; }
.hex-lines .hex-row.yin { justify-content: space-between; }
.hex-lines .hex-row.yin i { width: 42%; }
.hex-lines.lg { width: 44px; }
.hex-lines.lg .hex-row { height: 4px; gap: 5px; }
.hex-lines.lg .hex-row i { height: 4px; }

.article-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.article-card {
  display: flex;
  flex-direction: column;
  min-height: 210px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--white);
  color: var(--ink);
  text-decoration: none;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.article-card:hover { border-color: var(--line-2); color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.article-card .tag { align-self: flex-start; margin-bottom: 12px; }
.article-card h3 { margin-bottom: 7px; font-size: 19px; line-height: 1.4; }
.article-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.75; }
.article-card .read { margin-top: auto; padding-top: 14px; color: var(--red-2); font-size: 12px; }

.faq-list { border-top: 1px solid var(--line); }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 2px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--red); font-family: var(--sans); font-size: 20px; font-weight: 400; }
.faq-item[open] summary::after { content: "−"; }
.faq-item .faq-answer { padding: 0 2px 18px; color: var(--ink-2); font-size: 13px; line-height: 1.85; }
.faq-item .faq-answer p:last-child { margin-bottom: 0; }

.source-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.source-list a { color: var(--ink-2); }

/* Article / prose --------------------------------------------------------- */
.page-hero { padding: 46px 0 28px; }
.page-hero h1 { max-width: 900px; font-size: clamp(30px, 4.4vw, 48px); line-height: 1.22; }
.page-hero .lead { max-width: 780px; margin: 14px 0 0; color: var(--ink-2); font-size: 15px; line-height: 1.85; }
.page-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 17px; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 17px; color: var(--muted); font-size: 12px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--red-2); }
.breadcrumb .sep { color: var(--line-2); }

.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 34px; align-items: start; padding-bottom: 64px; }
.prose { min-width: 0; }
.prose h2 { margin: 34px 0 12px; padding-top: 4px; font-size: clamp(23px, 2.8vw, 30px); }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: 24px 0 8px; font-size: 20px; }
.prose p { color: var(--ink-2); font-size: 15px; line-height: 1.95; }
.prose ul, .prose ol { color: var(--ink-2); font-size: 15px; line-height: 1.9; }
.prose blockquote {
  margin: 18px 0;
  padding: 14px 18px;
  border-left: 3px solid var(--red);
  background: var(--paper-2);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.9;
}
.prose .callout { margin: 18px 0; }
.prose .content-table { margin: 16px 0; }
.prose figure { margin: 20px 0; }
.prose figcaption { margin-top: 6px; color: var(--muted); font-size: 11px; text-align: center; }
.prose .toc {
  margin: 0 0 24px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper-2);
}
.prose .toc strong { display: block; margin-bottom: 6px; font-size: 12px; }
.prose .toc ol { margin: 0; padding-left: 18px; font-size: 13px; }
.prose .toc li { margin: 3px 0; }

.article-aside { position: sticky; top: 88px; display: grid; gap: 14px; }
.aside-card { padding: 17px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); }
.aside-card h2, .aside-card h3 { margin: 0 0 8px; font-size: 16px; }
.aside-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.aside-card ul { margin: 0; padding-left: 16px; }
.aside-card li { margin: 5px 0; font-size: 12px; }
.aside-card .btn { margin-top: 10px; }

/* Hex detail -------------------------------------------------------------- */
.hex-detail-head { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 28px; align-items: center; padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); box-shadow: var(--shadow-sm); }
.hex-emblem { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 150px; border-right: 1px solid var(--line); }
.hex-emblem .symbol { color: var(--red-2); font-family: "Segoe UI Symbol", "Apple Symbols", var(--serif); font-size: 58px; line-height: 1; }
.hex-emblem .no { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.hex-detail-title h1 { font-size: clamp(30px, 4vw, 44px); }
.hex-detail-title .sub { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.hex-detail-title .keywords { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.hex-structure { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.hex-structure div { padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper-2); }
.hex-structure dt { color: var(--muted); font-size: 10px; }
.hex-structure dd { margin: 1px 0 0; font-size: 13px; font-weight: 700; }
.clas-table .najia { font-family: var(--mono); font-size: 12px; }
.hex-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.hex-nav a { display: flex; flex-direction: column; padding: 13px 15px; border: 1px solid var(--line); border-radius: 9px; background: var(--white); text-decoration: none; }
.hex-nav a:hover { border-color: var(--line-2); }
.hex-nav .dir { color: var(--muted); font-size: 10px; }
.hex-nav .name { color: var(--ink); font-family: var(--serif); font-size: 18px; font-weight: 700; }
.hex-nav .next { text-align: right; }
.related-hex { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.related-hex a { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); text-decoration: none; }
.related-hex .label { color: var(--muted); font-size: 10px; }
.related-hex .name { display: block; color: var(--ink); font-family: var(--serif); font-size: 14px; font-weight: 700; }

/* 64 index ---------------------------------------------------------------- */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper-2); }
.filter-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.filter-tabs button { padding: 5px 9px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--ink-2); font-size: 12px; }
.filter-tabs button:hover { background: var(--paper-3); }
.filter-tabs button.active { background: var(--red); color: #fff; }
.filter-search { display: flex; align-items: center; gap: 6px; }
.filter-search input { width: 190px; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--white); font-size: 12px; }
.hex-grid.all .hex-card { min-height: 78px; }
.empty-state { padding: 30px; border: 1px dashed var(--line-2); border-radius: 10px; color: var(--muted); text-align: center; font-size: 13px; }

/* Footer ------------------------------------------------------------------ */
.site-footer { margin-top: 20px; background: #202824; color: #cfd6cf; }
.footer-main { display: grid; grid-template-columns: 1.4fr .7fr .7fr .8fr; gap: 30px; padding: 44px 0 30px; }
.footer-brand .brand-name { color: #f1e8d9; }
.footer-brand .brand-sub { color: #9fa9a1; }
.footer-brand p { max-width: 350px; margin: 13px 0 0; color: #9fa9a1; font-size: 12px; line-height: 1.8; }
.footer-col h2 { margin: 0 0 10px; color: #f1e8d9; font-family: var(--sans); font-size: 12px; letter-spacing: .08em; }
.footer-col ul { margin: 0; padding: 0; list-style: none; }
.footer-col li { margin: 6px 0; }
.footer-col a { color: #b7c0b8; font-size: 12px; text-decoration: none; }
.footer-col a:hover { color: #fff; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 14px 0 22px; border-top: 1px solid rgba(255, 255, 255, .1); color: #8f9a91; font-size: 11px; }
.footer-bottom p { margin: 0; }
.footer-disclaimer { color: #7f8a81; font-size: 10px; }

/* Toast ------------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 100;
  transform: translate(-50%, 16px);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper-2);
  font-size: 13px;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Responsive -------------------------------------------------------------- */
@media (max-width: 1050px) {
  .site-nav a { padding: 8px 8px; font-size: 13px; }
  .tool-grid { grid-template-columns: 320px minmax(0, 1fr); }
  .chart-layout { grid-template-columns: minmax(0, 1fr); }
  .analysis-card { display: grid; grid-template-columns: 1fr 1fr; }
  .analysis-head, .analysis-notes { grid-column: 1 / -1; }
  .analysis-block { border-bottom: 1px solid #ece3d5; }
  .article-layout { grid-template-columns: minmax(0, 1fr) 260px; gap: 24px; }
}

@media (max-width: 880px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .site-nav {
    position: absolute;
    left: 20px;
    right: 20px;
    top: 68px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--white);
    box-shadow: var(--shadow);
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 10px 12px; font-size: 14px; }
  .header-cta { display: none; }
  .hero { padding-top: 38px; }
  .tool-grid { grid-template-columns: 1fr; }
  .cast-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .tool-head { flex-direction: column; }
  .tool-head-meta { justify-content: flex-start; }
  .result-head { flex-direction: column; }
  .result-actions { justify-content: flex-start; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-main { grid-template-columns: 1.2fr 1fr 1fr; }
  .footer-col:last-child { grid-column: 1 / -1; }
  .article-layout { grid-template-columns: 1fr; }
  .article-aside { position: static; grid-template-columns: 1fr 1fr; }
  .hex-detail-head { grid-template-columns: 120px minmax(0, 1fr); gap: 18px; }
  .hex-structure { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analysis-card { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  .wrap { width: calc(100% - 28px); }
  .header-inner { height: 62px; }
  .brand-name { font-size: 18px; }
  .brand-mark { width: 34px; height: 34px; font-size: 21px; }
  .brand-sub { display: none; }
  .site-nav { top: 62px; left: 14px; right: 14px; }
  .hero { padding: 30px 0 20px; }
  .hero h1 { font-size: clamp(30px, 9vw, 42px); }
  .hero-lead { font-size: 14px; }
  .tool-head { padding: 22px 18px 18px; }
  .cast-panel, .board-panel { padding: 20px 16px; }
  .result { padding: 0 16px 22px; }
  .tool-shell { border-radius: 13px; }
  .result-head h2 { font-size: 27px; }
  .result-head h2 .arrow { margin: 0 6px; }
  .meta-grid { grid-template-columns: 1fr 1fr; }
  .interp-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4, .article-grid { grid-template-columns: 1fr; }
  .section { padding: 42px 0; }
  .section-head-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .step { grid-template-columns: 44px 1fr; gap: 12px; }
  .step::before { font-size: 21px; }
  .manual-grid { grid-template-columns: 1fr; }
  .line-slot { grid-template-columns: 42px minmax(0, 1fr) auto; min-height: 56px; gap: 8px; padding: 7px 9px; }
  .line-slot .line-meta { justify-content: flex-end; }
  .line-graphic { width: 62px; }
  .footer-main { grid-template-columns: 1fr 1fr; gap: 22px; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-col:last-child { grid-column: 1 / -1; }
  .hex-detail-head { grid-template-columns: 1fr; gap: 14px; }
  .hex-emblem { min-height: 0; padding-bottom: 14px; border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; justify-content: flex-start; gap: 12px; }
  .hex-emblem .symbol { font-size: 42px; }
  .related-hex { grid-template-columns: 1fr; }
  .hex-nav { grid-template-columns: 1fr; }
  .article-aside { grid-template-columns: 1fr; }
  .filter-search { width: 100%; }
  .filter-search input { width: 100%; }
  .hex-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hex-card { min-height: 68px; padding: 9px; gap: 8px; }
  .hex-card .name { font-size: 14px; }
  .hex-grid.all .hex-card { min-height: 70px; }
  .content-table { display: block; overflow-x: auto; }
  .content-table th, .content-table td { min-width: 92px; }
}

@media print {
  .site-header, .site-footer, .cast-panel, .board-panel, .result-actions, .tool-head, .hero, .section, .breadcrumb, .toast { display: none !important; }
  body { background: #fff; }
  .tool-shell { border: 0; box-shadow: none; }
  .result { display: block !important; padding: 0; }
  .result[hidden] { display: none !important; }
  .chart-layout { display: block; }
  .analysis-card { margin-top: 12px; }
  .hex-table { min-width: 0; font-size: 10px; }
  .hex-table th, .hex-table td { padding: 4px; }
  a { color: #000; text-decoration: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* 补充：文章术语表、代码与筛选状态 */
.prose code, .method code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--paper-3);
  color: var(--red-2);
  font-family: var(--mono);
  font-size: .9em;
}
.term-list { margin: 16px 0 24px; }
.term-list dt {
  margin-top: 14px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
}
.term-list dd { margin: 3px 0 0; color: var(--ink-2); font-size: 14px; line-height: 1.85; }
.hex-card[hidden] { display: none !important; }
.filter-tabs button:focus-visible, .filter-search input:focus-visible { outline-offset: 2px; }
.prose .related-hex { margin-top: 10px; }
.prose .related-hex a { text-decoration: none; }
.prose .hex-nav a { text-decoration: none; }
.prose blockquote p { margin: 0; }
.palace-table { margin-top: 4px; }
.table-scroll-hint { display: none; }
@media (max-width: 720px) {
  .table-scroll-hint { display: inline; color: var(--red-2); }
  .chart-card-head > span { font-size: 9px; }
}

/* 防止网格子项被长表格/长文本撑破窄屏 */
.grid-2 > *, .grid-3 > *, .grid-4 > *, .article-grid > *,
.article-layout > *, .footer-main > *, .hex-detail-head > *,
.analysis-card > *, .chart-layout > *, .steps, .step > div { min-width: 0; }
.step { grid-template-columns: 58px minmax(0, 1fr); }
.content-table { max-width: 100%; }
@media (max-width: 640px) {
  .step { grid-template-columns: 44px minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .field input[type="datetime-local"],
  .field input[type="text"],
  .field select,
  .field textarea,
  .manual-row select { font-size: 16px; }
}

/* Screenshot modal ------------------------------------------------------- */
body.modal-open { overflow: hidden; }
.image-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 24, 22, .68);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}
.image-modal-panel {
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--paper-2);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .55);
}
.image-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}
.image-modal-head h2 { font-size: 20px; }
.image-modal-close {
  width: 34px; height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper-2);
  color: var(--ink-2);
  font-size: 22px;
  line-height: 1;
}
.image-modal-close:hover { background: var(--paper-3); }
.image-modal-note {
  margin: 0;
  padding: 10px 18px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.image-modal-preview {
  min-height: 0;
  margin: 12px 18px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  overflow: auto;
  text-align: center;
}
.image-modal-preview img {
  display: block;
  max-width: 100%;
  max-height: 58vh;
  margin: 0 auto;
  border-radius: 4px;
}
.image-modal-actions { display: flex; gap: 8px; padding: 0 18px 4px; }
.image-modal-hint { margin: 0; padding: 4px 18px 16px; color: var(--muted); font-size: 11px; }
@media (max-width: 640px) {
  .image-modal { padding: 12px; }
  .image-modal-panel { max-height: calc(100vh - 24px); }
  .image-modal-preview { margin: 10px 12px; }
  .image-modal-preview img { max-height: 54vh; }
  .image-modal-actions { padding: 0 12px 4px; }
  .image-modal-actions .btn { flex: 1; }
  .image-modal-hint { padding: 4px 12px 14px; }
}

/* Initial coin refinement */
.coin-tray.is-initial .coin-state {
  opacity: 0;
  visibility: hidden;
}
.coin-state {
  transition: background .2s, color .2s, opacity .25s, visibility .25s;
}
.legend-coin { gap: 6px !important; }
.mini-coin {
  display: inline-block;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 2px 2px rgba(79, 50, 16, .22));
}
.mini-coin .coin-svg { display: block; width: 100%; height: 100%; }

/* Guaranteed final face rendering, independent of 3D backface support */
.coin-face-idle { visibility: hidden; }
.coin.settled[data-face="idle"] .coin-face-idle { visibility: visible; }
.coin.settled[data-face="idle"] .coin-face-front,
.coin.settled[data-face="idle"] .coin-face-back { visibility: hidden; }
.coin.settled[data-face="front"] .coin-face-idle,
.coin.settled[data-face="front"] .coin-face-back { visibility: hidden; }
.coin.settled[data-face="back"] .coin-face-idle,
.coin.settled[data-face="back"] .coin-face-front { visibility: hidden; }
.coin.settled[data-face="front"] .coin-face-front { transform: rotateY(0deg); }
.coin.settled[data-face="back"] .coin-face-back { transform: rotateY(0deg); }
