@font-face {
  font-family: "MasaFont-Regular";
  src:
    url("https://cdn.jsdelivr.net/gh/max32002/masafont@2.1/webfont/MasaFont-Regular.woff2") format("woff2"),
    url("https://cdn.jsdelivr.net/gh/max32002/masafont@2.1/webfont/MasaFont-Regular.woff") format("woff");
  font-display: swap;
}

:root {
  --bg-top: #e1dfd7;
  --bg-bottom: #d3d0c7;
  --ink-main: #1f1f1d;
  --ink-sub: #4a4a45;
  --card: rgba(246, 244, 238, 0.92);
  --line: #a8a59c;
  --accent-soft: #ddd9d0;
  --ok: #2f2f2f;
  --warn: #5a2020;
  --shadow: rgba(32, 30, 24, 0.2);
  --font-display: "MasaFont-Regular", "Source Han Serif TC", "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --font-display-en: "Palatino Linotype", "Book Antiqua", Palatino, "Times New Roman", Times, Georgia, serif;
  --font-body: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Source Han Sans TC", sans-serif;
  --font-ui: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Source Han Sans TC", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink-main);
  background-color: #d8d4ca;
  background:
    linear-gradient(180deg, rgba(238, 235, 226, 0.7), rgba(214, 209, 197, 0.78)),
    url("/background_texture.webp") center/920px 920px repeat;
  font-family: var(--font-body);
  line-height: 1.76;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.14;
  background: url("/hexagram_motif_watermark.webp") center/980px 980px repeat;
  mix-blend-mode: darken;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.18;
  background:
    radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.09) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.02));
  mix-blend-mode: multiply;
}

.frame {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 14px 40px;
  transition: filter 0.35s ease;
}

body.ritual-active .frame {
  filter: saturate(0.86) contrast(1.04);
}

.cinematic-overlay {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
}

.fx-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.fx-canvas.active {
  opacity: 1;
}

.cinematic-overlay .mist {
  position: absolute;
  filter: blur(18px);
  opacity: 0;
}

.cinematic-overlay .mist-a {
  width: 64vw;
  height: 34vh;
  top: 22%;
  left: -8%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.22) 0%, transparent 72%);
}

.cinematic-overlay .mist-b {
  width: 56vw;
  height: 30vh;
  top: 52%;
  right: -6%;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.18) 0%, transparent 72%);
}

.cinematic-overlay .ritual-chant {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  color: rgba(20, 20, 20, 0.84);
  letter-spacing: 0.46em;
  font-size: 1.08rem;
  font-family: var(--font-display);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.45);
  opacity: 0;
}

.cinematic-overlay.play {
  animation: overlayFade 1.2s ease forwards;
}

.cinematic-overlay.play .mist-a {
  animation: mistA 1.2s ease forwards;
}

.cinematic-overlay.play .mist-b {
  animation: mistB 1.2s ease forwards;
}

.cinematic-overlay.play .ritual-chant {
  animation: chantIn 0.92s ease 0.1s forwards;
}

.hero {
  margin-bottom: 22px;
  border-radius: 20px;
  border: 1px solid rgba(123, 118, 108, 0.8);
  padding: 28px 28px 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 24px 44px rgba(22, 20, 17, 0.24);
  background:
    linear-gradient(140deg, rgba(38, 35, 32, 0.9), rgba(66, 62, 54, 0.9)),
    url("/hero_panel_texture.webp") center/cover no-repeat;
  color: #f5f2eb;
  animation: heroRise 0.56s ease;
  text-align: center;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.3;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.16)),
    url("/hexagram_motif_watermark.webp") center/900px 900px repeat;
  mix-blend-mode: screen;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.14;
  background: radial-gradient(80% 60% at 50% 8%, rgba(255, 255, 255, 0.16), transparent 72%);
}

.hero > * {
  position: relative;
  z-index: 1;
}

.lang-switch {
  position: absolute;
  right: 18px;
  top: 14px;
  z-index: 2;
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.lang-btn {
  min-width: 44px;
  height: 32px;
  border-radius: 999px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  color: rgba(243, 240, 232, 0.9);
  background: transparent;
  font-size: 0.9rem;
  font-weight: 700;
}

.lang-btn.is-active {
  background: rgba(255, 255, 255, 0.88);
  color: #292521;
  border-color: rgba(255, 255, 255, 0.92);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 3.6vw, 3rem);
  letter-spacing: 0.1em;
  font-family: var(--font-display);
  font-weight: 700;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}

.hero-subtitle {
  margin: 10px 0 0;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
  color: rgba(242, 242, 237, 0.9);
  font-size: 1.03rem;
  line-height: 1.65;
}

.hero-actions {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.hero-actions.is-hidden {
  display: none;
}


button {
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  padding: 10px 16px;
  transition: transform 0.12s ease, opacity 0.2s ease, filter 0.18s ease;
}

button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:disabled { opacity: 0.72; cursor: wait; transform: none; }

.btn-primary {
  background: linear-gradient(180deg, #464038, #353029);
  color: #f5f2eb;
  font-size: 1.08rem;
  padding: 14px 26px;
  min-width: 220px;
  box-shadow:
    0 0 0 1px rgba(255, 241, 214, 0.32),
    0 9px 18px rgba(18, 16, 14, 0.3);
  border: 1px solid rgba(88, 82, 72, 0.82);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.28);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #514b42, #3d372f);
  box-shadow:
    0 0 0 2px rgba(255, 241, 214, 0.46),
    0 12px 22px rgba(18, 16, 14, 0.34);
  filter: none;
}

.btn-primary:active {
  background: linear-gradient(180deg, #3f3931, #302b24);
}

.btn-primary:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px rgba(255, 241, 214, 0.52),
    0 12px 22px rgba(18, 16, 14, 0.34);
}

.btn-secondary-action {
  min-width: 0;
  background: linear-gradient(180deg, #575048, #48423a);
  border-color: rgba(110, 101, 88, 0.72);
  box-shadow:
    0 0 0 1px rgba(255, 245, 221, 0.16),
    0 4px 10px rgba(18, 16, 14, 0.14);
  font-size: 0.96rem;
  letter-spacing: 0.06em;
}

.btn-secondary-action:hover {
  background: linear-gradient(180deg, #625a50, #4f483f);
  box-shadow:
    0 0 0 1px rgba(255, 245, 221, 0.22),
    0 6px 12px rgba(18, 16, 14, 0.18);
}

.btn-secondary-action:active {
  background: linear-gradient(180deg, #4d473f, #3f3a33);
}

.board-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-ritual {
  background: linear-gradient(180deg, #232323, #0e0e0e);
  color: #f2f2f2;
  font-size: 1.05rem;
  padding: 13px 24px;
  min-width: 196px;
  border: 1px solid #303030;
  letter-spacing: 0.08em;
}

.status {
  min-height: 0;
  margin: 0;
  color: var(--ink-sub);
  font-size: 0.9rem;
  text-align: center;
}

.status.error { color: var(--warn); }
.status.ok { color: var(--ok); }
.muted { color: var(--ink-sub); }

.cooldown-card .body {
  display: grid;
  place-items: center;
}

.cooldown-wrap {
  width: min(100%, 760px);
  text-align: center;
  display: grid;
  gap: 10px;
}

.cooldown-figure {
  width: min(100%, 620px);
  justify-self: center;
  border-radius: 12px;
  border: 1px solid rgba(120, 109, 88, 0.66);
  background: rgba(248, 244, 233, 0.82);
  box-shadow: 0 10px 20px rgba(25, 22, 18, 0.16);
}

.cooldown-message {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 1.06rem;
  color: #2f2920;
  line-height: 1.8;
}

.cooldown-actions {
  margin-top: 8px;
  display: flex;
  justify-content: center;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.board-frame {
  max-width: 960px;
}

.board-compose {
  display: grid;
  gap: 10px;
}

.board-input {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  border: 1px solid rgba(133, 126, 113, 0.65);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: var(--font-body);
  background: rgba(252, 250, 244, 0.9);
  color: #2b2822;
}

.board-compose-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.board-note {
  color: #5a5448;
  font-size: 0.9rem;
}

.board-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.board-item {
  border: 1px solid rgba(137, 129, 114, 0.45);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.28);
}

.board-item.is-system {
  border-color: rgba(121, 86, 57, 0.54);
  background: rgba(250, 242, 227, 0.45);
}

.board-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.board-author {
  font-family: var(--font-ui);
  font-weight: 700;
  color: #2a251e;
}

.board-time {
  font-size: 0.85rem;
  color: #655d50;
}

.board-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.card {
  grid-column: span 12;
  border: 1px solid rgba(146, 141, 129, 0.72);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(249, 247, 240, 0.94), rgba(241, 238, 228, 0.94)),
    url("/background_texture.webp") center/760px 760px repeat;
  padding: 16px;
  box-shadow: 0 14px 26px rgba(38, 34, 28, 0.16);
  animation: rise 0.34s ease;
  position: relative;
  overflow: hidden;
}

.ben-card {
  border-color: rgba(140, 124, 96, 0.72);
  background:
    linear-gradient(180deg, rgba(247, 242, 230, 0.91), rgba(238, 232, 218, 0.94)),
    url("/present_bengua_panel.webp") center/cover no-repeat,
    url("/background_texture.webp") center/760px 760px repeat;
}

.zhi-card {
  border-color: rgba(109, 126, 142, 0.72);
  background:
    linear-gradient(180deg, rgba(240, 244, 245, 0.9), rgba(229, 236, 238, 0.94)),
    url("/future_biangua_panel.webp") center/cover no-repeat,
    url("/background_texture.webp") center/760px 760px repeat;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.11;
  background: url("/hexagram_motif_watermark.webp") center/760px 760px repeat;
}

.ben-card::before {
  opacity: 0.09;
}

.zhi-card::before {
  opacity: 0.15;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background: radial-gradient(160px 46px at 12% 12%, rgba(0, 0, 0, 0.1), transparent 70%);
}

.ben-card::after,
.zhi-card::after {
  opacity: 0.12;
  background:
    url("/ornamental_frame.webp") center/101% 101% no-repeat,
    radial-gradient(160px 46px at 12% 12%, rgba(0, 0, 0, 0.1), transparent 70%);
}

.ben-card h2 {
  color: #2e2719;
  border-bottom-color: rgba(140, 124, 96, 0.5);
}

.zhi-card h2 {
  color: #1f2a34;
  border-bottom-color: rgba(109, 126, 142, 0.45);
}

.card.reveal {
  opacity: 0;
  transform: translateY(8px);
  animation: revealUp 0.5s ease forwards;
}

.card.scroll-open {
  transform-origin: top center;
  animation-name: scrollOpen;
  animation-duration: 0.56s;
  animation-timing-function: cubic-bezier(0.16, 0.95, 0.22, 1);
  animation-fill-mode: forwards;
}

.body-transition {
  animation: bwToWarm 0.8s ease;
}

.card h2 {
  margin: 0 0 10px;
  font-size: 1.25rem;
  color: #131313;
  border-bottom: 1px solid #cfcfcf;
  padding-bottom: 5px;
  letter-spacing: 0.08em;
  font-family: var(--font-display);
  text-align: center;
  text-shadow: 0 0.7px 0 rgba(255, 255, 255, 0.5);
}

.card h2.has-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.card-title-toggle {
  border: 1px solid rgba(107, 98, 83, 0.55);
  background: rgba(248, 244, 235, 0.86);
  color: #2f2a22;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  font-family: var(--font-ui);
}

.card-title-toggle.is-open {
  background: rgba(241, 233, 218, 0.95);
  border-color: rgba(120, 95, 63, 0.62);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.card.half .body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.card.half .body p {
  width: min(100%, 560px);
}

.card-topic {
  margin: 2px 0 4px;
}

.card-topic strong {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.card-head-block .card-topic {
  text-align: center;
}

.card-head-block .gua-name-line,
.card-head-block .gua-name-display {
  text-align: center;
  display: block;
}

.gua-number-line {
  font-family: var(--font-body);
  font-size: 1.03rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.gua-name-line {
  font-size: 1.8rem;
  line-height: 1.1;
}

.card-head-block {
  width: min(100%, 640px);
}

.hex-flip {
  width: min(100%, 640px);
  min-height: clamp(480px, 64vw, 940px);
  position: relative;
  perspective: 1400px;
  transform-style: preserve-3d;
  cursor: pointer;
  outline: none;
}

.hex-flip:focus-visible {
  box-shadow: 0 0 0 2px rgba(42, 41, 37, 0.45);
  border-radius: 12px;
}

.flip-face {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  padding: 10px 10px 14px;
  backface-visibility: hidden;
  transition: transform 0.62s cubic-bezier(0.2, 0.75, 0.2, 1);
  border: 1px solid rgba(125, 120, 110, 0.36);
}

.flip-front {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
  background: rgba(255, 255, 255, 0.28);
}

.flip-back {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transform: rotateY(180deg);
  overflow: auto;
  text-align: left;
  background: rgba(255, 255, 255, 0.2);
}

.hex-flip.is-flipped .flip-front {
  transform: rotateY(180deg);
}

.hex-flip.is-flipped .flip-back {
  transform: rotateY(360deg);
}

.flip-hint {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: #504a42;
  letter-spacing: 0.06em;
}

.flip-toggle-btn {
  align-self: center;
  border: 1px solid rgba(107, 98, 83, 0.55);
  background: rgba(248, 244, 235, 0.86);
  color: #2f2a22;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.flip-hint-back {
  margin-top: auto;
}

.flip-pages {
  width: 100%;
}

.flip-page {
  display: none;
}

.flip-page.is-active {
  display: block;
}

.flip-page-actions {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}

.flip-page-btn {
  border: 1px solid rgba(107, 98, 83, 0.55);
  background: rgba(248, 244, 235, 0.86);
  color: #2f2a22;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.flip-page-btn:hover {
  background: rgba(243, 236, 224, 0.95);
}

.poem-text {
  line-height: 1.9;
}

.gua-figure {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: visible;
}

.gua-figure-image {
  width: min(100%, 560px);
  max-width: 100%;
  max-height: min(72vh, 980px);
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid rgba(120, 109, 88, 0.72);
  background: rgba(243, 238, 227, 0.86);
  padding: 10px;
  box-shadow:
    0 0 0 3px rgba(226, 216, 197, 0.8),
    0 12px 26px rgba(22, 20, 17, 0.2);
}

.card.focus-card .hex-flip {
  min-height: min(var(--focus-flip-height, 760px), 92vh);
  height: min(var(--focus-flip-height, 760px), 92vh);
}

.card.focus-card .gua-figure-image {
  width: auto;
  max-width: 100%;
  max-height: calc(min(var(--focus-flip-height, 760px), 92vh) - 170px);
}

.gua-figure-image.hidden {
  display: none;
}

.gua-figure-fallback {
  display: none;
}

.gua-figure-fallback.visible {
  display: block;
}

.reading-sections {
  width: min(100%, 640px);
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.reading-section {
  border: 1px solid rgba(138, 132, 122, 0.42);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.28);
  text-align: left;
}

.reading-section h3 {
  margin: 0 0 6px;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  color: #2c2a25;
  text-align: center;
}

.reading-section-title {
  display: block;
  width: 100%;
  text-align: center !important;
  font-weight: 700;
}

.reading-section--collapsible .reading-fold {
  width: 100%;
}

.reading-fold-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
}

.reading-fold-summary::-webkit-details-marker {
  display: none;
}

.reading-fold-summary::before {
  content: "▸";
  color: #5d554b;
  font-size: 0.86rem;
  transition: transform 0.2s ease;
}

.reading-fold[open] .reading-fold-summary::before {
  transform: rotate(90deg);
}

.reading-section--collapsible .reading-content {
  margin-top: 8px;
}

.reading-content p {
  margin: 0;
  width: 100%;
}

.reading-section--center-brief .reading-content,
.reading-section--center-brief .reading-content p,
.reading-section--center-brief .poem-text {
  text-align: center;
}

.reading-empty {
  color: #77736b;
}

.alt-lens-body {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.alt-lens-item {
  border: 1px solid rgba(138, 132, 122, 0.35);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.22);
}

.alt-lens-title {
  margin: 0 0 4px;
  font-weight: 700;
}

.alt-lens-copy,
.alt-lens-note,
.alt-lens-diff,
.alt-lens-direction {
  margin: 0;
}

.alt-lens-note {
  margin-top: 4px;
  font-size: 0.9rem;
  color: #5f574d;
}

.alt-lens-diff {
  margin-top: 4px;
  font-size: 0.88rem;
  color: #6b6358;
}

.alt-lens-direction {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(138, 132, 122, 0.32);
}

.list {
  margin: 0;
  padding-left: 20px;
  width: 100%;
  text-align: left;
}

.line-transition-wrap {
  width: 100%;
}

.line-transition-hint {
  margin: 0 0 6px;
  font-size: 0.82rem;
  color: #5e574c;
  letter-spacing: 0.03em;
}

.line-transition-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.line-transition-item {
  display: grid;
  grid-template-columns: 26px 56px 1fr;
  align-items: start;
  gap: 8px;
  border: 1px solid rgba(129, 120, 102, 0.3);
  border-radius: 8px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.26);
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.line-transition-order {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid rgba(104, 94, 78, 0.34);
  font-size: 0.72rem;
  color: #4f4638;
}

.line-transition-yao {
  font-family: var(--font-ui);
  font-size: 0.86rem;
  color: #332b1f;
}

.line-transition-text {
  font-size: 0.9rem;
  line-height: 1.6;
}

.line-transition-item.is-hovering {
  border-color: rgba(137, 55, 39, 0.5);
  background: rgba(250, 238, 230, 0.72);
}

.wide { grid-column: span 12; }
.half { grid-column: span 6; }

.card.ben-card {
  grid-column: span 12;
}

.focus-slot {
  display: grid;
}

.card.focus-card .body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.card.focus-card h2 {
  font-family: var(--font-ui);
  letter-spacing: 0.03em;
  font-weight: 700;
}

.card.focus-card .body p {
  width: min(100%, 760px);
}

.relation-toggle-card .body {
  display: grid;
  place-items: center;
}

.relation-toggle-wrap {
  width: min(100%, 640px);
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
}

.relation-toggle-copy {
  margin: 0;
  color: #4a4235;
  letter-spacing: 0.03em;
}

.relation-toggle-btn {
  min-width: 240px;
}

.relation-map-card.is-hidden {
  display: none;
}

.guide-card .body {
  width: min(100%, 900px);
  margin: 0 auto;
}

.guide-wrap {
  display: grid;
  gap: 8px;
}

.guide-preview {
  margin: 0;
  color: #433a31;
  font-size: 0.95rem;
}

.guide-fold {
  border: 1px solid rgba(120, 103, 83, 0.36);
  border-radius: 10px;
  background: rgba(247, 243, 234, 0.72);
  padding: 6px 12px 8px;
}

.guide-fold summary {
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 700;
  color: #3b3127;
  letter-spacing: 0.02em;
}

.guide-fold[open] summary {
  margin-bottom: 6px;
}

.guide-expanded {
  display: grid;
  gap: 10px;
}

.guide-section h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  color: #392f25;
}

.guide-copy {
  margin: 0 0 6px;
  color: #433a31;
}

.guide-list {
  margin: 0;
  padding-left: 1.2rem;
  color: #3f372f;
}

.guide-list li + li {
  margin-top: 4px;
}

.guide-item {
  margin-bottom: 6px;
}

.guide-item-main {
  margin: 0;
}

.guide-item-proof {
  margin: 2px 0 0;
  color: #5a4d3f;
  font-size: 0.9rem;
}

.reading-flow-intro {
  margin: 0 0 8px;
  text-align: center;
  color: #41372c;
}

.reading-flow-note {
  margin: 8px 0 0;
  text-align: center;
  font-size: 0.9rem;
  color: #5a4c3e;
}

.reading-flow-map {
  width: min(100%, 980px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.flow-step-card {
  min-height: 116px;
  padding: 8px 10px 10px;
  display: grid;
  gap: 4px;
  align-content: start;
}

.flow-step-no {
  display: inline-flex;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  color: #2d241b;
  background: rgba(181, 151, 112, 0.34);
  border: 1px solid rgba(132, 96, 62, 0.36);
}

.flow-step-title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 700;
  color: #32291f;
}

.flow-step-desc {
  margin: 0;
  font-size: 0.84rem;
  color: #544739;
  line-height: 1.45;
}

.relation-struct-intro {
  margin: 0 0 8px;
  text-align: center;
  color: #4b4135;
}

.relation-struct-fold {
  border: 1px solid rgba(127, 111, 90, 0.34);
  border-radius: 10px;
  background: rgba(246, 241, 231, 0.62);
  padding: 8px 10px 10px;
}

.relation-struct-fold summary {
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 700;
  color: #3b3127;
}

.relation-struct-fold[open] summary {
  margin-bottom: 6px;
}

.relation-struct-content {
  display: grid;
  gap: 6px;
}

.relation-map {
  width: min(100%, 980px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas:
    ". zhi ."
    "cuo ben zong"
    ". hu .";
  gap: 12px;
  align-items: stretch;
}

.relation-card {
  appearance: none;
  width: 100%;
  border: 1px solid rgba(128, 118, 102, 0.46);
  border-radius: 12px;
  background: rgba(248, 245, 236, 0.72);
  padding: 10px 10px 12px;
  text-align: center;
  box-shadow: 0 10px 18px rgba(35, 31, 26, 0.1);
  transform: none;
}

.relation-card:hover {
  transform: none;
  border-color: rgba(120, 100, 72, 0.62);
}

.relation-card.is-active {
  border-color: rgba(130, 74, 54, 0.72);
  background: rgba(248, 238, 226, 0.86);
  box-shadow:
    0 0 0 2px rgba(160, 113, 88, 0.26),
    0 10px 18px rgba(35, 31, 26, 0.16);
}

.relation-zhi { grid-area: zhi; }
.relation-hu { grid-area: hu; }
.relation-ben { grid-area: ben; }
.relation-cuo { grid-area: cuo; }
.relation-zong { grid-area: zong; }

.relation-ben {
  border-color: rgba(138, 117, 86, 0.6);
  background: rgba(247, 241, 229, 0.84);
}

.card.hu-card {
  border-color: rgba(95, 122, 127, 0.6);
}

.card.cuo-card {
  border-color: rgba(140, 96, 86, 0.62);
}

.card.zong-card {
  border-color: rgba(102, 113, 139, 0.62);
}

.relation-heading {
  margin: 0;
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  text-align: center;
}

.relation-tag {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  color: #5a4d3d;
}

.relation-sep {
  color: #7b6f5c;
}

.relation-role {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: #6a5e4b;
  letter-spacing: 0.02em;
}

.relation-title {
  margin: 4px 0 0;
  display: flex;
  width: 100%;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.relation-title .gua-number-line {
  font-size: 0.98rem;
}

.relation-title .gua-name-line {
  font-size: clamp(1.35rem, 2vw, 1.6rem);
  line-height: 1.08;
}

html[lang="en"] .relation-title .gua-name-line {
  font-family: var(--font-display-en);
  font-size: clamp(1.02rem, 1.35vw, 1.18rem);
  line-height: 1.06;
  letter-spacing: 0.02em;
}

html[lang="en"] .gua-name-line,
html[lang="en"] .gua-name-display {
  font-family: var(--font-display-en);
  font-size: clamp(1.45rem, 2.2vw, 1.62rem);
  letter-spacing: 0.02em;
}

.relation-phrase {
  margin: 6px 0 0;
  font-size: 0.84rem;
  color: #4d4437;
}

.relation-hex .hexagram-visual {
  margin: 8px auto;
  min-width: 0;
  padding: 8px 10px;
}

.relation-hex .hex-line-row {
  margin: 3px 0;
}

.relation-hex .hex-line {
  width: 84px;
}

.relation-hex .hex-line.yang .solid {
  width: 78px;
  height: 8px;
}

.relation-hex .hex-line.yin {
  gap: 8px;
}

.relation-hex .hex-line.yin .part {
  width: 35px;
  height: 8px;
}

.relation-hover-panel {
  width: min(100%, 760px);
  margin: 10px auto 4px;
  padding: 10px 12px;
  border: 1px solid rgba(126, 103, 72, 0.42);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(245, 241, 233, 0.95), rgba(238, 232, 221, 0.95)),
    url("/background_texture.webp") center/720px 720px repeat;
  box-shadow:
    inset 0 0 0 1px rgba(156, 121, 91, 0.22),
    0 8px 18px rgba(35, 31, 26, 0.12);
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.relation-hover-panel.is-preview {
  border-color: rgba(129, 80, 56, 0.62);
  box-shadow:
    0 0 0 1px rgba(157, 108, 82, 0.22),
    0 10px 20px rgba(35, 31, 26, 0.14);
}

.relation-hover-hint {
  margin: 0;
  text-align: center;
  font-size: 0.88rem;
  color: #3f372e;
  line-height: 1.6;
  letter-spacing: 0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mbti-contrast-card .body {
  width: min(100%, 980px);
  margin: 0 auto;
  display: grid;
  gap: 10px;
}

.mbti-map-fold {
  border: 1px solid rgba(127, 111, 90, 0.34);
  border-radius: 10px;
  background: rgba(246, 241, 231, 0.62);
  padding: 8px 10px 10px;
}

.mbti-map-fold summary {
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 700;
  color: #3b3127;
}

.mbti-map-fold[open] summary {
  margin-bottom: 8px;
}

.mbti-map-content {
  display: grid;
  gap: 10px;
}

.mbti-map-intro {
  margin: 0;
  text-align: center;
  color: #4b4136;
  white-space: pre-line;
}

.mbti-map-hover-panel {
  width: min(100%, 860px);
  margin: 0 auto;
  padding: 10px 12px;
  border: 1px solid rgba(126, 103, 72, 0.38);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(245, 241, 233, 0.95), rgba(238, 232, 221, 0.95)),
    url("/background_texture.webp") center/720px 720px repeat;
  box-shadow:
    inset 0 0 0 1px rgba(156, 121, 91, 0.16),
    0 8px 16px rgba(35, 31, 26, 0.1);
}

.mbti-map-summary {
  margin: 0;
  text-align: center;
  font-family: var(--font-ui);
  font-weight: 700;
  color: #372f24;
}

.mbti-map-detail {
  margin-top: 6px;
  display: grid;
  gap: 4px;
}

.mbti-map-detail-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mbti-map-detail p {
  margin: 0;
  text-align: center;
  font-size: 0.88rem;
  color: #453b2e;
}

.mbti-map-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.mbti-map-legend .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(120, 105, 82, 0.34);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.8rem;
  color: #4f4334;
  background: rgba(255, 250, 241, 0.78);
}

.mbti-map-legend .legend-item::before {
  content: "";
  width: 16px;
  height: 0;
  border-top: 2px solid rgba(120, 100, 72, 0.5);
}

.mbti-map-legend .legend-value::before {
  border-top-color: rgba(160, 96, 71, 0.78);
}

.mbti-map-legend .legend-tempo::before {
  border-top-color: rgba(70, 106, 140, 0.78);
}

.mbti-map-canvas {
  width: min(100%, 860px);
  margin: 0 auto;
  border: 1px solid rgba(127, 111, 90, 0.32);
  border-radius: 12px;
  padding: 8px;
  background: rgba(247, 243, 234, 0.55);
}

.mbti-map-svg {
  width: 100%;
  height: auto;
  display: block;
}

.mbti-map-orbit {
  fill: none;
  stroke: rgba(118, 104, 84, 0.28);
  stroke-width: 1;
}

.mbti-map-axis {
  stroke: rgba(116, 101, 80, 0.2);
  stroke-width: 1;
}

.mbti-map-edge {
  fill: none;
  stroke-width: 1.4;
  opacity: 0.22;
  transition: opacity 0.16s ease, stroke-width 0.16s ease;
}

.mbti-map-edge.is-value {
  stroke: rgba(150, 88, 64, 0.72);
}

.mbti-map-edge.is-tempo {
  stroke: rgba(63, 100, 136, 0.72);
}

.mbti-map-edge.is-active {
  opacity: 0.75;
  stroke-width: 2.1;
}

.mbti-map-node {
  cursor: pointer;
  transition: transform 0.12s ease;
}

.mbti-map-node circle {
  fill: rgba(249, 246, 237, 0.92);
  stroke: rgba(120, 105, 82, 0.6);
  stroke-width: 1.2;
  transition: fill 0.16s ease, stroke 0.16s ease, stroke-width 0.16s ease;
}

.mbti-map-node text {
  fill: #2e261d;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.mbti-map-node:hover circle,
.mbti-map-node:focus-visible circle,
.mbti-map-node.is-preview circle {
  fill: rgba(248, 235, 220, 0.92);
  stroke: rgba(139, 82, 60, 0.74);
}

.mbti-map-node.mbti-group-nt circle { fill: rgba(122, 102, 168, 0.2); }
.mbti-map-node.mbti-group-nf circle { fill: rgba(91, 140, 92, 0.2); }
.mbti-map-node.mbti-group-sj circle { fill: rgba(82, 122, 176, 0.2); }
.mbti-map-node.mbti-group-sp circle { fill: rgba(193, 160, 56, 0.24); }

.mbti-map-node.is-active circle {
  stroke-width: 2.1;
}

.mbti-map-node.is-active.mbti-group-nt circle {
  fill: rgba(122, 102, 168, 0.34);
  stroke: rgba(93, 74, 138, 0.92);
}

.mbti-map-node.is-active.mbti-group-nf circle {
  fill: rgba(91, 140, 92, 0.34);
  stroke: rgba(63, 110, 65, 0.92);
}

.mbti-map-node.is-active.mbti-group-sj circle {
  fill: rgba(82, 122, 176, 0.34);
  stroke: rgba(53, 92, 145, 0.92);
}

.mbti-map-node.is-active.mbti-group-sp circle {
  fill: rgba(193, 160, 56, 0.36);
  stroke: rgba(142, 112, 29, 0.92);
}

.mbti-map-node.is-contrast circle {
  stroke: rgba(126, 93, 42, 0.82);
  stroke-width: 2;
  filter: drop-shadow(0 0 3px rgba(126, 93, 42, 0.26));
}

.mbti-map-node.is-selected circle {
  stroke: rgba(86, 121, 54, 0.86);
  stroke-width: 2.4;
}

.mbti-map-node:focus-visible {
  outline: none;
}

.mbti-map-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid rgba(120, 105, 82, 0.32);
  background: rgba(255, 251, 243, 0.82);
  color: #4b3f31;
  font-size: 0.78rem;
  font-family: var(--font-ui);
  font-weight: 700;
}

.mbti-map-chip.is-match {
  border-color: rgba(86, 121, 54, 0.72);
  box-shadow: 0 0 0 1px rgba(86, 121, 54, 0.22);
}

.mbti-map-node-label {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  paint-order: stroke fill;
  stroke: rgba(248, 244, 236, 0.92);
  stroke-width: 2.2px;
  letter-spacing: 0.01em;
}

.mbti-map-node-label.is-value {
  fill: rgba(143, 63, 43, 0.95);
}

.mbti-map-node-label.is-tempo {
  fill: rgba(47, 91, 132, 0.95);
}

.mbti-contrast-card.has-static-contrast .mbti-map-hover-panel {
  display: none;
}

.mbti-map-unavailable {
  margin: 0;
  text-align: center;
  color: #5f574a;
}

.summary-line {
  margin: 0;
  font-size: 1.05rem;
  color: #1a1a1a;
  font-family: var(--font-body);
  line-height: 1.85;
  text-align: center;
}

.gua-name-display {
  font-family: var(--font-display);
}

.summary-card h2 {
  font-family: var(--font-body);
}

.transition-card {
  grid-column: 6 / span 2;
  grid-row: 2;
  justify-self: center;
  align-self: start;
  margin-top: 165px;
  width: min(100%, 170px);
  z-index: 3;
  padding: 10px 10px;
  border-color: rgba(118, 114, 105, 0.72);
  background:
    linear-gradient(180deg, rgba(244, 241, 233, 0.95), rgba(235, 231, 221, 0.95)),
    url("/background_texture.webp") center/760px 760px repeat;
  box-shadow: 0 12px 24px rgba(33, 30, 24, 0.2);
}

.transition-card h2 {
  font-family: var(--font-body);
  font-size: 1rem;
  margin: 0 0 6px;
  padding-bottom: 4px;
  letter-spacing: 0.04em;
}

.moving-transform {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.moving-compact {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  color: #3f3a33;
  letter-spacing: 0.04em;
}

.moving-empty {
  color: #666159;
}

.ritual {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 220px;
  text-align: center;
}

.ritual-caption {
  margin: 0;
  color: #4a4a4a;
  letter-spacing: 0.08em;
  font-family: var(--font-ui);
}

.taiji {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  position: relative;
  background: linear-gradient(90deg, #121212 50%, #f4f4f4 50%);
  animation: spinTaiji 1.8s linear infinite;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.taiji::before,
.taiji::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 45px;
  height: 45px;
  border-radius: 50%;
}

.taiji::before {
  top: 0;
  background: #121212;
  box-shadow: 0 0 0 12px #f4f4f4 inset;
}

.taiji::after {
  bottom: 0;
  background: #f4f4f4;
  box-shadow: 0 0 0 12px #121212 inset;
}

.yao-progress {
  width: 150px;
  display: grid;
  gap: 6px;
}

.yao-progress .step {
  height: 8px;
  border-radius: 8px;
  background: #d6d6d4;
  overflow: hidden;
}

.yao-progress .step::before {
  content: "";
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #111, #4b4b4b);
  animation: fillStep 0.6s ease forwards;
}

.yao-progress .step:nth-child(1)::before { animation-delay: 0.05s; }
.yao-progress .step:nth-child(2)::before { animation-delay: 0.15s; }
.yao-progress .step:nth-child(3)::before { animation-delay: 0.25s; }
.yao-progress .step:nth-child(4)::before { animation-delay: 0.35s; }
.yao-progress .step:nth-child(5)::before { animation-delay: 0.45s; }
.yao-progress .step:nth-child(6)::before { animation-delay: 0.55s; }

.yao-progress.is-extended .step::before {
  width: 100%;
  animation: holdPulse 0.9s ease-in-out infinite;
}

.yao-progress.is-extended .step:nth-child(1)::before { animation-delay: 0s; }
.yao-progress.is-extended .step:nth-child(2)::before { animation-delay: 0.08s; }
.yao-progress.is-extended .step:nth-child(3)::before { animation-delay: 0.16s; }
.yao-progress.is-extended .step:nth-child(4)::before { animation-delay: 0.24s; }
.yao-progress.is-extended .step:nth-child(5)::before { animation-delay: 0.32s; }
.yao-progress.is-extended .step:nth-child(6)::before { animation-delay: 0.4s; }

.gua-clock-altar {
  grid-column: span 12;
  display: grid;
  place-items: center;
  min-height: 52vh;
  text-align: center;
  gap: 14px;
}

.preflight {
  width: min(100%, 640px);
  border: 1px solid rgba(112, 97, 73, 0.5);
  border-radius: 12px;
  padding: 10px 12px;
  background:
    linear-gradient(180deg, rgba(247, 241, 229, 0.92), rgba(238, 229, 209, 0.88));
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 4px 12px rgba(34, 29, 22, 0.08);
}

.preflight-title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  color: #5f4f38;
}

.preflight-pillars {
  margin: 2px 0 8px;
  font-family: var(--font-display);
  letter-spacing: 0.26em;
  font-size: 1.2rem;
  font-weight: 700;
  color: #2f261a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.preflight-rules {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.preflight-rule {
  border: 1px solid rgba(112, 95, 66, 0.56);
  border-radius: 999px;
  background: rgba(250, 244, 231, 0.9);
  color: #3d3020;
  padding: 4px 10px;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  box-shadow: 0 1px 2px rgba(24, 19, 12, 0.08);
}

html[lang="en"] .preflight-rule {
  font-size: 0.74rem;
  letter-spacing: 0.01em;
  padding: 5px 10px;
}

.preflight-rule:hover {
  background: rgba(253, 247, 236, 0.98);
  border-color: rgba(118, 96, 61, 0.72);
}

.preflight-hint {
  margin: 8px 0 6px;
  min-height: 1.3em;
  font-size: 0.84rem;
  color: #5a4d38;
  background: rgba(255, 251, 242, 0.62);
  border: 1px solid rgba(121, 108, 84, 0.28);
  border-radius: 8px;
  padding: 4px 8px;
}

.preflight-confirm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #453928;
  background: rgba(255, 250, 240, 0.56);
  border: 1px solid rgba(118, 102, 74, 0.34);
  border-radius: 999px;
  padding: 4px 10px;
}

html[lang="en"] .preflight-confirm {
  display: flex;
  width: min(100%, 560px);
  justify-content: center;
  border-radius: 10px;
  line-height: 1.4;
  text-align: left;
}

.preflight-confirm input {
  width: 14px;
  height: 14px;
  accent-color: #7f5a2b;
}

.mbti-field {
  display: block;
  margin: 6px 0 4px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: #5d503b;
}

.mbti-preselect {
  width: min(100%, 640px);
  border: 1px solid rgba(126, 93, 48, 0.58);
  border-radius: 12px;
  padding: 10px 12px;
  background:
    linear-gradient(180deg, rgba(250, 245, 234, 0.96), rgba(239, 229, 209, 0.92));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 6px 14px rgba(34, 29, 22, 0.09),
    0 0 0 2px rgba(151, 111, 55, 0.08);
  text-align: center;
}

html[lang="en"] .preflight-pillars {
  letter-spacing: 0.08em;
  font-size: 1rem;
}

.mbti-preselect-title {
  margin: 0 0 4px;
  font-size: 0.84rem;
  letter-spacing: 0.15em;
  color: #4f3e28;
  font-weight: 700;
}

.mbti-preselect-hint {
  margin: 0 0 6px;
  font-size: 0.82rem;
  color: #4f402e;
}

.mbti-group-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 6px;
}

.mbti-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid rgba(120, 105, 82, 0.28);
  background: rgba(255, 251, 243, 0.82);
  color: #51412d;
}

.mbti-group-nt { background: rgba(122, 102, 168, 0.18); }
.mbti-group-nf { background: rgba(91, 140, 92, 0.18); }
.mbti-group-sj { background: rgba(82, 122, 176, 0.18); }
.mbti-group-sp { background: rgba(193, 160, 56, 0.2); }

.mbti-select {
  width: min(100%, 340px);
  border: 1px solid rgba(124, 94, 53, 0.62);
  border-radius: 8px;
  padding: 7px 10px;
  background: rgba(255, 252, 245, 0.96);
  color: #3a2d1f;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  text-align-last: left;
  margin-bottom: 8px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.38);
}

.mbti-select:focus-visible {
  outline: 2px solid rgba(145, 96, 32, 0.55);
  outline-offset: 1px;
}

.gua-clock-stage.is-hidden,
.preflight.is-hidden {
  display: none;
}

.gua-clock-button {
  --tg-qian: #e6d8a3;
  --tg-kun: #b58b4f;
  --tg-zhen: #4fa64f;
  --tg-xun: #5fa8a0;
  --tg-kan: #1f3a5f;
  --tg-li: #b8432e;
  --tg-gen: #7a7d7f;
  --tg-dui: #9db4c0;
  --upper-marker-radius: clamp(202px, 40vw, 224px);
  width: min(90vw, 500px);
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 1px solid rgba(94, 85, 68, 0.72);
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  background:
    linear-gradient(180deg, rgba(245, 238, 224, 0.54), rgba(236, 226, 205, 0.58)),
    radial-gradient(circle at 50% 46%, rgba(255, 255, 255, 0.08), rgba(34, 29, 22, 0.08)),
    url("/lot-cylinder-top.webp") center/contain no-repeat,
    radial-gradient(circle at 50% 46%, rgba(242, 236, 223, 0.94), rgba(227, 218, 201, 0.92) 64%, rgba(208, 195, 170, 0.9));
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.12),
    inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  animation: breathing 2.8s ease-in-out infinite;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}

.gua-clock-button:hover {
  transform: translateY(-1px);
  box-shadow:
    0 14px 42px rgba(0, 0, 0, 0.13),
    inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.gua-clock-button::before,
.gua-clock-button::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  pointer-events: none;
}

.gua-clock-button::before {
  border: 1px solid rgba(102, 90, 68, 0.42);
}

.gua-clock-button::after {
  inset: 28px;
  border: 1px solid rgba(108, 95, 71, 0.42);
}

.gua-clock-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.gua-ring-guide {
  fill: none;
  stroke: rgba(91, 79, 57, 0.26);
  stroke-width: 1;
}

.gua-sector {
  outline: none;
}

.sector-band {
  stroke: rgba(78, 69, 53, 0.18);
  stroke-width: 0.7;
  transition: opacity 0.15s ease, filter 0.15s ease, stroke 0.15s ease;
  filter: saturate(0.84);
}

.sector-upper {
  opacity: 0.8;
}

.sector-lower {
  opacity: 0.88;
}

.sector-hit {
  fill: transparent;
  stroke: none;
}

.gua-sector:is(:hover, :focus-visible) .sector-band {
  opacity: 1;
  filter: brightness(1.08) saturate(1.02);
  stroke: rgba(40, 33, 24, 0.4);
}

.sector-lower.tg-qian { fill: var(--tg-qian); }
.sector-lower.tg-kun { fill: color-mix(in srgb, var(--tg-kun) 80%, #6d604a 20%); }
.sector-lower.tg-zhen { fill: var(--tg-zhen); }
.sector-lower.tg-xun { fill: var(--tg-xun); }
.sector-lower.tg-kan { fill: var(--tg-kan); }
.sector-lower.tg-li { fill: var(--tg-li); }
.sector-lower.tg-gen { fill: color-mix(in srgb, var(--tg-gen) 84%, #6e665c 16%); }
.sector-lower.tg-dui { fill: var(--tg-dui); }

.sector-upper.tg-qian { fill: color-mix(in srgb, var(--tg-qian) 88%, #ffffff 12%); }
.sector-upper.tg-kun { fill: color-mix(in srgb, var(--tg-kun) 70%, #e8dfca 30%); }
.sector-upper.tg-zhen { fill: color-mix(in srgb, var(--tg-zhen) 88%, #ffffff 12%); }
.sector-upper.tg-xun { fill: color-mix(in srgb, var(--tg-xun) 88%, #ffffff 12%); }
.sector-upper.tg-kan { fill: color-mix(in srgb, var(--tg-kan) 88%, #ffffff 12%); }
.sector-upper.tg-li { fill: color-mix(in srgb, var(--tg-li) 88%, #ffffff 12%); }
.sector-upper.tg-gen { fill: color-mix(in srgb, var(--tg-gen) 72%, #ded8cc 28%); }
.sector-upper.tg-dui { fill: color-mix(in srgb, var(--tg-dui) 88%, #ffffff 12%); }

.gua-cardinal {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.gua-upper-markers {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.gua-upper-marker {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(var(--angle)) translateY(calc(var(--upper-marker-radius) * -1)) rotate(calc(var(--angle) * -1));
  color: rgba(23, 18, 12, 0.96);
  font-family: var(--font-display);
  font-size: 0.92rem;
  letter-spacing: 0.05em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.88);
  background: rgba(248, 240, 222, 0.92);
  border: 1px solid rgba(88, 75, 53, 0.56);
  border-radius: 999px;
  padding: 3px 10px;
  box-shadow: 0 2px 6px rgba(36, 30, 22, 0.16);
}

.cardinal {
  position: absolute;
  color: rgba(56, 47, 34, 0.46);
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

.cardinal.n { left: 50%; top: 14px; transform: translateX(-50%); }
.cardinal.s { left: 50%; bottom: 14px; transform: translateX(-50%); }
.cardinal.e { right: 14px; top: 50%; transform: translateY(-50%); }
.cardinal.w { left: 14px; top: 50%; transform: translateY(-50%); }

.gua-clock-core {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 38%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 1px solid rgba(70, 57, 38, 0.58);
  background: transparent;
  display: grid;
  place-content: center;
  gap: 2px;
  box-shadow:
    0 0 0 1px rgba(255, 246, 222, 0.42),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    0 4px 12px rgba(27, 23, 17, 0.18);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.08));
  transition: background 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  animation: coreBreath 5.8s ease-in-out infinite;
  z-index: 2;
}

.gua-clock-core::before {
  content: "";
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  border: 1px solid rgba(55, 45, 31, 0.24);
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.24),
    inset 0 -1px 2px rgba(0, 0, 0, 0.04);
  pointer-events: none;
}

.gua-clock-core::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  opacity: 0.015;
  background:
    radial-gradient(circle at 24% 32%, rgba(0, 0, 0, 0.5) 0.7px, transparent 0.8px),
    radial-gradient(circle at 68% 64%, rgba(0, 0, 0, 0.4) 0.7px, transparent 0.8px);
  background-size: 9px 9px, 11px 11px;
  pointer-events: none;
}

.gua-clock-button:hover .gua-clock-core,
.gua-clock-button:focus-visible .gua-clock-core {
  border-color: rgba(74, 61, 42, 0.78);
  box-shadow:
    0 0 0 2px rgba(255, 246, 220, 0.66),
    inset 0 0 0 1px rgba(255, 255, 255, 0.28),
    0 5px 14px rgba(27, 23, 17, 0.22);
  background: transparent;
}

.core-title {
  font-family: var(--font-display);
  letter-spacing: 0.1em;
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
  color: #f7f0df;
  transform: translateY(2px);
  text-shadow:
    0 1px 0 rgba(20, 16, 11, 0.48),
    0 0 1px rgba(20, 16, 11, 0.45);
  background: rgba(27, 22, 16, 0.46);
  border: 1px solid rgba(255, 244, 220, 0.4);
  border-radius: 999px;
  padding: 4px 12px 5px;
}

.core-sub {
  font-family: var(--font-ui);
  font-size: clamp(0.56rem, 1.2vw, 0.7rem);
  letter-spacing: 0.08em;
  color: #4f473d;
}

.altar-hint {
  margin: 0 0 2px;
  color: #2f2921;
  font-family: var(--font-display);
  letter-spacing: 0.1em;
}

.clock-hover-hint {
  margin: 0;
  min-height: 4.7em;
  font-size: 0.9rem;
  color: #433d33;
  letter-spacing: 0.03em;
  text-align: center;
}

.clock-hover-line {
  margin: 0;
}

.clock-hover-line.line1 {
  font-family: var(--font-display);
  color: #2f271e;
}

.clock-hover-line.line2,
.clock-hover-line.line3 {
  color: #524837;
  font-size: 0.86rem;
}

.redivine-wrap {
  margin-top: 12px;
  width: 100%;
  display: flex;
  justify-content: center;
}

.share-wrap {
  margin-top: 6px;
  width: 100%;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.result-actions {
  margin-top: 4px;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 14px;
  justify-content: center;
  justify-items: center;
}

.result-actions .btn-primary {
  width: 220px;
  min-height: 54px;
  min-width: 0;
}

.result-action-card .body {
  width: min(100%, 920px);
  margin: 0 auto;
}

.share-status {
  margin: 0;
  width: min(100%, 860px);
  text-align: center;
  color: #4a4034;
  font-size: 0.9rem;
  word-break: break-word;
}

.reveal-line {
  opacity: 0;
  transform: translateX(8px);
  animation: lineIn 0.34s ease forwards;
}

.hexagram-visual {
  margin: 12px auto;
  padding: 12px 14px;
  border: 1px solid #c5c5c3;
  border-radius: 10px;
  background:
    radial-gradient(95px 34px at 16% 14%, rgba(0, 0, 0, 0.1), transparent 75%),
    radial-gradient(124px 38px at 84% 82%, rgba(0, 0, 0, 0.08), transparent 75%),
    rgba(244, 244, 242, 0.84);
  width: fit-content;
  min-width: 192px;
  display: grid;
  place-items: center;
}

.hex-line-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 5px 0;
  width: 100%;
}

.hex-line {
  width: 128px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hex-line.yang .solid {
  display: block;
  width: 118px;
  height: 10px;
  border-radius: 6px;
  background: #151515;
}

.hex-line.yin {
  justify-content: space-between;
  gap: 10px;
}

.hex-line.yin .part {
  display: block;
  width: 54px;
  height: 10px;
  border-radius: 6px;
  background: #151515;
}

.hex-line-row.moving .hex-line.yang .solid,
.hex-line-row.moving .hex-line.yin .part {
  background: #8a2f22;
}

.hex-line-row.primary {
  filter: drop-shadow(0 0 4px rgba(138, 47, 34, 0.32));
}

.hex-line-row.is-hovering .hex-line.yang .solid,
.hex-line-row.is-hovering .hex-line.yin .part {
  transform: scaleY(1.08);
  filter: brightness(0.94);
}

.hex-line-row.is-hovering {
  filter: drop-shadow(0 0 6px rgba(120, 42, 30, 0.42));
}

.moving-info {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 6px;
}

.moving-chip {
  display: inline-block;
  border: 1px solid rgba(120, 102, 78, 0.46);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.78rem;
  color: #463c2e;
  background: rgba(248, 242, 230, 0.72);
  letter-spacing: 0.03em;
}

.hex-marker {
  display: none;
}

.hex-value {
  display: none;
}

.pill {
  display: inline-block;
  border-radius: 999px;
  border: 1px solid #b9b9b9;
  padding: 2px 8px;
  margin-left: 6px;
  font-size: 0.82rem;
  color: #242424;
  background: #ececec;
}

@media (max-width: 860px) {
  body::before { opacity: 0.09; }
  .hero::after { opacity: 0.16; }
  .card::after { opacity: 0.08; }
  .hex-flip {
    min-height: clamp(420px, 130vw, 780px);
  }
  .clock-hover-hint {
    font-size: 0.84rem;
    min-height: 4.4em;
  }
  .gua-upper-marker {
    font-size: 0.76rem;
    letter-spacing: 0.03em;
    padding: 2px 8px;
  }
  .preflight {
    padding: 10px;
  }
  .preflight-rules {
    gap: 6px;
  }
  .card.ben-card {
    grid-column: span 12;
    grid-row: auto;
  }
  .reading-flow-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .flow-step-card {
    min-height: 102px;
  }
  .relation-map {
    grid-template-columns: 1fr;
    grid-template-areas:
      "ben"
      "zhi"
      "hu"
      "cuo"
      "zong";
  }
  .mbti-map-canvas {
    padding: 4px;
  }
  .mbti-map-detail p {
    text-align: left;
  }
  .mbti-map-detail-row {
    justify-content: flex-start;
  }
  .relation-toggle-btn {
    width: 100%;
    min-width: 0;
  }
  .card.transition-card {
    grid-column: span 12;
    grid-row: auto;
    width: auto;
    margin-top: 0;
  }
  .half { grid-column: span 12; }
  .hero {
    padding: 22px 18px 20px;
    border-radius: 16px;
  }
  .lang-switch {
    right: 10px;
    top: 10px;
  }
  .hero h1 { font-size: 1.72rem; }
  .hero-subtitle {
    font-size: 0.97rem;
    line-height: 1.58;
  }
  .hero-actions {
    justify-content: center;
  }
  .result-actions {
    grid-template-columns: 1fr;
    width: min(100%, 320px);
    gap: 10px;
  }
  .btn-primary {
    min-width: 0;
    width: 100%;
    max-width: 320px;
  }
}

@media (max-width: 620px) {
  .reading-flow-map {
    grid-template-columns: 1fr;
  }
  .mbti-map-legend {
    justify-content: flex-start;
  }
  .mbti-map-legend .legend-item {
    font-size: 0.74rem;
  }
  .mbti-map-summary {
    font-size: 0.92rem;
  }
  .mbti-map-detail p {
    font-size: 0.82rem;
  }
  .mbti-map-node text {
    font-size: 10.2px;
  }
  .mbti-map-node-label {
    font-size: 10.8px;
  }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes revealUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spinTaiji {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes fillStep {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes holdPulse {
  0% { opacity: 0.55; filter: brightness(0.88); }
  50% { opacity: 1; filter: brightness(1.06); }
  100% { opacity: 0.55; filter: brightness(0.88); }
}

@keyframes bwToWarm {
  0% { filter: grayscale(1) contrast(1.15); }
  100% { filter: grayscale(0) contrast(1); }
}

@keyframes breathing {
  0% { transform: scale(1); }
  50% { transform: scale(1.025); }
  100% { transform: scale(1); }
}

@keyframes coreBreath {
  0% {
    box-shadow:
      inset 0 1px 2px rgba(255, 255, 255, 0.6),
      inset 0 -1px 2px rgba(0, 0, 0, 0.06),
      0 4px 12px rgba(27, 23, 17, 0.2);
  }
  50% {
    box-shadow:
      inset 0 1px 2px rgba(255, 255, 255, 0.62),
      inset 0 -1px 2px rgba(0, 0, 0, 0.07),
      0 5px 14px rgba(27, 23, 17, 0.24);
  }
  100% {
    box-shadow:
      inset 0 1px 2px rgba(255, 255, 255, 0.6),
      inset 0 -1px 2px rgba(0, 0, 0, 0.06),
      0 4px 12px rgba(27, 23, 17, 0.2);
  }
}

@keyframes lineIn {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scrollOpen {
  0% { opacity: 0; transform: translateY(14px) scaleY(0.1); filter: blur(2px); }
  60% { opacity: 1; transform: translateY(0) scaleY(1.02); filter: blur(0.4px); }
  100% { opacity: 1; transform: translateY(0) scaleY(1); filter: blur(0); }
}

@keyframes overlayFade {
  0% { opacity: 0; }
  10% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes mistA {
  0% { opacity: 0; transform: translateX(-26px) scale(0.94); }
  30% { opacity: 0.85; }
  100% { opacity: 0; transform: translateX(20px) scale(1.05); }
}

@keyframes mistB {
  0% { opacity: 0; transform: translateX(26px) scale(0.95); }
  36% { opacity: 0.76; }
  100% { opacity: 0; transform: translateX(-18px) scale(1.04); }
}

@keyframes chantIn {
  0% { opacity: 0; transform: translate(-50%, -48%) scale(0.98); }
  32% { opacity: 0.94; }
  100% { opacity: 0; transform: translate(-50%, -52%) scale(1.02); }
}

@keyframes heroRise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
