:root {
  color-scheme: dark;
  --ink: #f6ead2;
  --muted: #bda98c;
  --line: rgba(231, 194, 110, 0.28);
  --line-strong: rgba(231, 194, 110, 0.56);
  --lacquer: #100d0b;
  --lacquer-soft: rgba(18, 15, 13, 0.72);
  --ivory: #fff6df;
  --gold: #d9a84f;
  --gold-light: #f4d58c;
  --cinnabar: #a33a2b;
  --cinnabar-dark: #702217;
  --green: #2f6758;
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.38);
  --panel: rgba(18, 15, 13, 0.74);
  --panel-strong: rgba(18, 15, 13, 0.86);
  --panel-soft: rgba(255, 246, 223, 0.065);
  --hairline: rgba(255, 246, 223, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden],
.gua-column[hidden],
.reading-card[hidden] {
  display: none !important;
}

.print-area {
  display: none;
}

html,
body {
  min-height: 100%;
}

body {
  position: relative;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", sans-serif;
  color: var(--ink);
  background: #100d0b;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("./assets/altar.png");
  background-position: center;
  background-size: cover;
  opacity: 0.26;
  transform: scale(1.02);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 56% 42%, rgba(217, 168, 79, 0.08), transparent 28%),
    linear-gradient(90deg, rgba(16, 13, 11, 0.95), rgba(16, 13, 11, 0.58) 48%, rgba(16, 13, 11, 0.9)),
    linear-gradient(180deg, rgba(16, 13, 11, 0.22), rgba(16, 13, 11, 0.92));
}

button,
textarea {
  font: inherit;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1620px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(12px, 1.5vw, 22px) 0;
}

.ritual-screen {
  display: none;
}

.ritual-screen.is-active {
  display: grid;
  gap: clamp(14px, 1.25vw, 20px);
  min-height: calc(100vh - clamp(24px, 3vw, 44px));
  animation: screenEnter 420ms ease both;
}

.cast-screen {
  grid-template-columns: minmax(280px, 340px) minmax(760px, 1fr);
}

.open-screen {
  grid-template-columns: minmax(340px, 420px) minmax(700px, 1fr);
  align-items: start;
}

.question-area,
.result-panel,
.opening-altar {
  align-self: stretch;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow:
    inset 0 1px 0 var(--hairline),
    var(--shadow);
  backdrop-filter: blur(16px);
}

.question-area {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(136px, 1fr) auto;
  gap: 16px;
  padding: clamp(18px, 1.6vw, 24px);
  overflow: hidden;
}

.question-area::before,
.result-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(244, 213, 140, 0.07), transparent 28%),
    linear-gradient(90deg, rgba(244, 213, 140, 0.06), transparent 34%);
}

.title-lockup {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.topic-picker {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.topic-picker-label {
  margin: 0;
  color: rgba(244, 213, 140, 0.86);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.topic-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.topic-button {
  min-height: 34px;
  border: 1px solid rgba(231, 194, 110, 0.22);
  border-radius: 999px;
  padding: 0 8px;
  color: rgba(246, 234, 210, 0.74);
  background:
    linear-gradient(180deg, rgba(255, 246, 223, 0.07), rgba(255, 246, 223, 0.025)),
    rgba(16, 13, 11, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 246, 223, 0.055);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.topic-button:hover:not(:disabled) {
  border-color: rgba(244, 213, 140, 0.48);
  color: var(--ivory);
  box-shadow:
    inset 0 1px 0 rgba(255, 246, 223, 0.08),
    0 8px 18px rgba(0, 0, 0, 0.18);
}

.topic-button.is-selected,
.topic-button[aria-pressed="true"] {
  border-color: rgba(244, 213, 140, 0.72);
  color: var(--ivory);
  background:
    linear-gradient(180deg, rgba(166, 63, 45, 0.82), rgba(93, 33, 24, 0.78)),
    rgba(217, 168, 79, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 246, 223, 0.18),
    0 8px 20px rgba(112, 34, 23, 0.24);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold-light);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

h1,
h2 {
  margin: 0;
  font-family: "Noto Serif TC", "Songti TC", serif;
  letter-spacing: 0;
  line-height: 1.08;
}

h1 {
  font-size: clamp(2.55rem, 3.1vw, 3.25rem);
}

h2 {
  font-size: clamp(2.1rem, 2.6vw, 3rem);
}

textarea {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 168px;
  resize: none;
  border: 1px solid rgba(231, 194, 110, 0.24);
  border-radius: 8px;
  padding: 15px;
  color: var(--ivory);
  background:
    linear-gradient(180deg, rgba(255, 246, 223, 0.035), transparent),
    var(--panel-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

textarea::placeholder {
  color: rgba(246, 234, 210, 0.48);
}

textarea:focus {
  outline: 2px solid rgba(217, 168, 79, 0.34);
  outline-offset: 2px;
}

.actions {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    opacity 160ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.primary-button {
  color: var(--ivory);
  background: linear-gradient(180deg, #bd4a36, var(--cinnabar-dark));
  box-shadow:
    inset 0 1px 0 rgba(255, 246, 223, 0.16),
    0 16px 30px rgba(112, 34, 23, 0.32);
}

.secondary-button {
  color: var(--ivory);
  background: linear-gradient(180deg, #3d7668, #244e43);
  box-shadow:
    inset 0 1px 0 rgba(255, 246, 223, 0.14),
    0 16px 30px rgba(21, 64, 54, 0.28);
}

.ghost-button {
  color: var(--ink);
  border: 1px solid rgba(231, 194, 110, 0.3);
  background: rgba(255, 246, 223, 0.075);
}

.ritual-table,
.opening-altar {
  position: relative;
  display: grid;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 246, 223, 0.075), rgba(255, 246, 223, 0.028)),
    rgba(18, 15, 13, 0.52);
  box-shadow:
    inset 0 1px 0 var(--hairline),
    var(--shadow);
  backdrop-filter: blur(8px);
}

.ritual-table {
  grid-template-columns: minmax(560px, 1fr) minmax(260px, 0.4fr);
  grid-template-rows: auto minmax(0, 1fr);
  column-gap: 14px;
}

.opening-altar {
  position: sticky;
  top: clamp(12px, 1.5vw, 22px);
  align-self: start;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  height: calc(100vh - clamp(24px, 3vw, 44px));
  background:
    linear-gradient(180deg, rgba(244, 213, 140, 0.09), rgba(255, 246, 223, 0.025)),
    rgba(18, 15, 13, 0.58);
}

.open-screen .stage-top {
  display: grid;
  gap: 12px;
}

.open-screen .opening-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  justify-content: stretch;
}

.open-screen .opening-actions button {
  min-width: 0;
  padding: 0 12px;
}

.opening-bottom-actions {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 clamp(16px, 1.5vw, 24px) clamp(15px, 1.4vw, 22px);
}

.opening-bottom-actions button {
  min-width: 0;
}

.opening-altar::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 54%;
  width: min(440px, 82%);
  aspect-ratio: 1;
  border: 1px solid rgba(244, 213, 140, 0.18);
  border-radius: 999px;
  transform: translate(-50%, -50%);
}

.result-panel {
  position: relative;
  overflow: hidden;
}

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

.opening-altar::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 54%;
  width: min(320px, 64%);
  aspect-ratio: 1;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle, rgba(244, 213, 140, 0.18), rgba(244, 213, 140, 0) 62%);
  transform: translate(-50%, -50%) scale(0.88);
  transition: opacity 240ms ease, transform 420ms ease;
}

body.is-opening .opening-altar::after,
body.has-reading .opening-altar::after {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

body.is-opening .opening-altar::after,
body.is-changing .opening-altar::after {
  animation: altarBreath 1600ms ease-in-out infinite;
}

.stage-top {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: clamp(15px, 1.4vw, 22px) clamp(16px, 1.5vw, 24px) 0;
}

.ritual-table .stage-top {
  grid-column: 1 / -1;
}

.stage-label {
  margin: 0;
  color: rgba(246, 234, 210, 0.72);
  font-size: 0.86rem;
  font-weight: 700;
}

.stage-heading {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.stage-cue {
  margin: 0;
  color: rgba(244, 213, 140, 0.74);
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.45;
}

.opening-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.opening-actions button {
  min-width: 96px;
}

.draw-status {
  min-width: 74px;
  padding: 8px 12px;
  border: 1px solid rgba(231, 194, 110, 0.34);
  border-radius: 999px;
  color: var(--gold-light);
  text-align: center;
  background: rgba(16, 13, 11, 0.42);
  font-variant-numeric: tabular-nums;
}

.hexagram-stage {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 10px 22px 20px 0;
  transform: translateX(clamp(-72px, -4vw, -38px));
}

.ritual-table .hexagram-stage {
  grid-column: 2;
  grid-row: 2;
}

.ritual-table::before {
  content: "";
  position: absolute;
  left: 38%;
  top: 52%;
  width: min(520px, 64%);
  aspect-ratio: 1;
  border: 1px solid rgba(244, 213, 140, 0.11);
  border-radius: 999px;
  transform: translate(-50%, -50%);
}

.opening-lines {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 8px 18px 12px;
}

.opening-line-board {
  display: grid;
  grid-template-columns: minmax(220px, 1fr);
  gap: 18px;
  width: min(360px, 100%);
  align-items: center;
  justify-items: center;
}

body.has-change .opening-line-board {
  grid-template-columns: repeat(2, minmax(126px, 1fr));
  width: min(360px, 100%);
}

.gua-column {
  display: grid;
  gap: 8px;
  min-width: 0;
  justify-items: center;
}

.gua-column-label,
.reading-card-label {
  margin: 0;
  color: rgba(244, 213, 140, 0.82);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.changed-gua {
  animation: changeEnter 420ms ease both;
}

.open-screen .line-slots {
  width: min(230px, 100%);
  gap: clamp(5px, 0.78vh, 8px);
}

.open-screen .yao-card {
  width: clamp(86px, 9.6vh, 116px);
}

body.has-change .open-screen .yao-card {
  width: clamp(72px, 7.8vh, 96px);
}

.line-slots {
  display: flex;
  flex-direction: column;
  gap: clamp(7px, 1vh, 11px);
  width: min(430px, 100%);
  margin: 0;
  padding: 0;
  list-style: none;
}

.line-slot {
  position: relative;
  display: grid;
  grid-template-columns: 48px auto;
  gap: 12px;
  align-items: center;
  justify-content: center;
  perspective: 900px;
}

.slot-label {
  color: rgba(246, 234, 210, 0.62);
  font-size: 0.9rem;
  text-align: right;
  transition: color 180ms ease;
}

.line-slot.is-current .slot-label,
.line-slot.is-revealed .slot-label {
  color: rgba(244, 213, 140, 0.9);
}

.line-slot.is-changing-line .slot-label {
  color: #ff7a63;
  text-shadow: 0 0 14px rgba(255, 58, 42, 0.5);
}

.yao-card {
  position: relative;
  width: clamp(150px, 18vh, 210px);
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border: 1px solid rgba(231, 194, 110, 0.24);
  border-radius: 8px;
  background: rgba(255, 246, 223, 0.06);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  contain: paint;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  will-change: transform, filter;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.line-slot.is-current .yao-card {
  border-color: rgba(244, 213, 140, 0.52);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.22),
    0 0 0 1px rgba(244, 213, 140, 0.1);
}

.line-slot.is-latest:not(.is-revealed) .yao-card {
  animation: lineLand 520ms cubic-bezier(0.18, 0.78, 0.22, 1) both;
}

.open-screen .line-slot.is-current .yao-card:not(.revealed)::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent, rgba(244, 213, 140, 0.18), transparent);
  transform: translateX(-120%);
  animation: waitingSweep 1200ms ease-in-out infinite;
}

.yao-card.empty::before {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  top: 50%;
  height: 2px;
  background: rgba(231, 194, 110, 0.22);
  transform: translateY(-50%);
}


.yao-card img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 66.666%;
  height: 150%;
  display: block;
  object-fit: cover;
  transform: translate(-50%, -50%) rotate(90deg);
  transform-origin: center;
}

.yao-card.revealed {
  border-color: rgba(244, 213, 140, 0.46);
  background: #cda75a;
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(244, 213, 140, 0.12);
}

.line-slot.is-changing-line .yao-card,
.line-slot.is-changing-line .yao-card.revealed {
  border-color: rgba(255, 63, 48, 0.98);
  outline: 3px solid rgba(255, 45, 32, 0.95);
  outline-offset: 4px;
  box-shadow:
    0 0 0 1px rgba(255, 244, 226, 0.32),
    0 0 28px rgba(255, 45, 32, 0.42),
    0 18px 38px rgba(0, 0, 0, 0.34);
}

.line-slot.is-new-reveal {
  z-index: 3;
}

.line-slot.is-new-reveal .yao-card.revealed {
  animation: cardReveal 520ms cubic-bezier(0.18, 0.78, 0.22, 1) both;
}

.line-slot.is-new-reveal .yao-card.revealed::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 66.666%;
  height: 150%;
  pointer-events: none;
  background-image: url("./assets/yao/back.png");
  background-position: center;
  background-size: cover;
  transform: translate(-50%, -50%) rotate(90deg);
  transform-origin: center;
  animation: cardBackVanish 520ms cubic-bezier(0.18, 0.78, 0.22, 1) both;
}

.yao-card.revealed img {
  display: block;
  opacity: 1;
  object-fit: cover;
}

.deck-zone {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 18px 10px 26px;
}

.ritual-table .deck-zone {
  grid-column: 1;
  grid-row: 2;
}

.ritual-table .deck-zone::before {
  content: "左手取爻";
  position: absolute;
  top: 30px;
  left: 24px;
  color: rgba(246, 234, 210, 0.5);
  font-size: 0.82rem;
  font-weight: 700;
}

.deck-fan {
  position: relative;
  width: min(580px, 100%);
  height: min(640px, 74vh);
  transform-style: preserve-3d;
}

.deck-fan::before {
  content: "";
  position: absolute;
  left: 8%;
  top: 50%;
  width: 512px;
  height: 604px;
  border-right: 1px solid rgba(244, 213, 140, 0.2);
  border-radius: 50%;
  box-shadow: 28px 0 48px rgba(244, 213, 140, 0.025);
  transform: translate(-50%, -50%);
}

.fan-card {
  position: absolute;
  left: 8%;
  top: 50%;
  width: clamp(104px, 8.8vw, 118px);
  aspect-ratio: 3 / 2;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(231, 194, 110, 0.35);
  border-radius: 8px;
  background: transparent;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.36);
  opacity: 0;
  transform: translate(-50%, -50%) translateY(34px) rotate(0deg) scale(0.96);
  transform-origin: 50% 50%;
  contain: paint;
  will-change: transform, opacity;
  backface-visibility: hidden;
  transition:
    transform 420ms cubic-bezier(0.2, 0.72, 0.18, 1),
    box-shadow 180ms ease,
    opacity 260ms ease;
  transition-delay: var(--delay);
  z-index: var(--z);
}

.deck-fan.is-ready .fan-card {
  opacity: 1;
  transform:
    translate(calc(-50% + (var(--x) * 1px)), calc(-50% + (var(--y) * 1px)))
    rotate(calc(var(--rot) * 1deg));
}

.deck-fan.is-ready .fan-card:hover:not(:disabled),
.deck-fan.is-ready .fan-card:focus-visible:not(:disabled) {
  box-shadow:
    0 26px 52px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(244, 213, 140, 0.32);
  transition-delay: 0ms;
  transform:
    translate(calc(-50% + (var(--hover-x) * 1px)), calc(-50% + (var(--hover-y) * 1px)))
    rotate(calc(var(--rot) * 1deg))
    scale(1.035);
  z-index: 1000;
}

.deck-fan.is-ready .fan-card.is-picked,
.deck-fan.is-ready .fan-card.is-spent {
  opacity: 0;
  pointer-events: none;
  transition-delay: 0ms;
  transform:
    translate(calc(-50% + (var(--pick-x) * 1px)), calc(-50% + (var(--pick-y) * 1px)))
    rotate(calc(var(--rot) * 1deg))
    scale(0.96);
  z-index: 1100;
}

.deck-fan.is-busy .fan-card {
  pointer-events: none;
}

.fan-card:focus-visible {
  outline: 2px solid rgba(244, 213, 140, 0.7);
  outline-offset: 4px;
}

.deck-fan.is-closed .fan-card {
  pointer-events: none;
  opacity: 0.35;
}

.fan-card img,
.hexagram-card {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.fan-card img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 66.666%;
  height: 150%;
  max-width: none;
  pointer-events: none;
  user-select: none;
  backface-visibility: hidden;
  transform: translate(-50%, -50%) rotate(90deg);
  transform-origin: center;
}

.hexagram-card {
  object-fit: contain;
  object-position: center;
  background: rgba(16, 13, 11, 0.36);
  opacity: 1;
  visibility: visible;
  transition:
    opacity 180ms ease,
    filter 180ms ease;
}

body.has-reading .hexagram-card {
  opacity: 1;
  filter: none;
}

.hexagram-card.is-loading {
  opacity: 0.68;
  filter: saturate(0.78) brightness(0.9);
}

.hexagram-card.is-error {
  opacity: 1;
  filter: grayscale(1);
  background:
    linear-gradient(135deg, rgba(244, 213, 140, 0.14), transparent),
    rgba(16, 13, 11, 0.64);
}

.result-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: clamp(22px, 2vw, 34px);
  background:
    linear-gradient(180deg, rgba(255, 246, 223, 0.06), rgba(255, 246, 223, 0.022)),
    var(--panel-strong);
}

.hexagram-cards {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 10px 18px;
  width: min(210px, calc(100% - 28px));
  justify-self: center;
  align-self: end;
  justify-items: center;
  padding: 0 14px 14px;
  opacity: 1;
  visibility: visible;
  transition:
    opacity 220ms ease,
    visibility 220ms ease;
}

body.has-change:not(.is-changing) .hexagram-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(390px, calc(100% - 24px));
  align-items: end;
}

.result-panel .eyebrow,
.result-panel h2,
.result-panel .line-pattern,
.result-panel .reading-body {
  grid-column: 1;
}

.reading-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  justify-items: center;
}

.reading-card.is-card-loading {
  visibility: hidden;
  pointer-events: none;
}

.reading-card.is-card-ready {
  animation: resultCardReveal 560ms cubic-bezier(0.18, 0.78, 0.22, 1) both;
}

.hexagram-card[hidden] {
  display: none !important;
}

.hexagram-card-wrap {
  width: min(156px, 100%);
  aspect-ratio: 2 / 3;
  justify-self: center;
  overflow: hidden;
  border: 1px solid rgba(231, 194, 110, 0.26);
  border-radius: 8px;
  background: rgba(255, 246, 223, 0.06);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.34);
}

body.has-change:not(.is-changing) .hexagram-card-wrap {
  width: min(142px, 100%);
}

body:not(.has-reading) .hexagram-card {
  opacity: 0.2;
  filter: grayscale(1);
}

body:not(.has-reading) .hexagram-cards {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.is-opening .result-panel,
body.is-changing .result-panel {
  border-color: rgba(244, 213, 140, 0.42);
}

.line-pattern {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.reading-body {
  color: rgba(246, 234, 210, 0.78);
  font-size: clamp(1rem, 0.42vw + 0.9rem, 1.12rem);
  line-height: 1.78;
}

.reading-body p {
  margin: 0;
}

.reading-body strong {
  color: var(--gold-light);
}

.question-summary {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border-left: 2px solid rgba(244, 213, 140, 0.48);
  color: rgba(255, 246, 223, 0.88);
  background:
    linear-gradient(90deg, rgba(244, 213, 140, 0.09), transparent 78%),
    rgba(16, 13, 11, 0.18);
}

.question-summary strong {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
}

.situation-reading {
  display: grid;
  gap: 14px;
  margin-bottom: clamp(18px, 1.7vw, 26px);
  padding: clamp(16px, 1.5vw, 22px);
  border: 1px solid rgba(244, 213, 140, 0.28);
  border-radius: 8px;
  background:
    radial-gradient(circle at 10% 0%, rgba(244, 213, 140, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(255, 246, 223, 0.08), rgba(255, 246, 223, 0.032)),
    rgba(16, 13, 11, 0.26);
}

.situation-heading {
  display: grid;
  gap: 5px;
}

.situation-heading > span {
  color: rgba(244, 213, 140, 0.78);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.situation-heading h3 {
  margin: 0;
  color: var(--ivory);
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-size: clamp(1.28rem, 0.7vw + 1.08rem, 1.72rem);
  line-height: 1.35;
}

.situation-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.situation-tags span {
  padding: 5px 9px;
  border: 1px solid rgba(244, 213, 140, 0.22);
  border-radius: 999px;
  color: rgba(244, 213, 140, 0.9);
  font-size: 0.82rem;
  font-weight: 800;
  background: rgba(244, 213, 140, 0.06);
}

.situation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 12px;
}

.situation-grid article {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid rgba(231, 194, 110, 0.16);
  border-radius: 8px;
  background: rgba(255, 246, 223, 0.04);
}

.situation-grid article strong {
  color: var(--gold-light);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
}

.situation-grid article p {
  color: rgba(246, 234, 210, 0.78);
}

.reading-columns {
  display: grid;
  gap: clamp(16px, 1.5vw, 24px);
}

body.has-change:not(.is-changing) .reading-columns {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
}

.reading-section {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding-left: 16px;
  border-left: 1px solid rgba(231, 194, 110, 0.22);
}

.reading-section-heading {
  display: grid;
  gap: 4px;
}

.reading-section-heading > span {
  color: rgba(244, 213, 140, 0.74);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.reading-section h3 {
  margin: 0;
  color: var(--gold-light);
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-size: clamp(1.16rem, 0.5vw + 1.02rem, 1.42rem);
  line-height: 1.45;
}

.reading-lines {
  padding: 8px 0;
  border-top: 1px solid rgba(231, 194, 110, 0.12);
  border-bottom: 1px solid rgba(231, 194, 110, 0.12);
  color: rgba(246, 234, 210, 0.54);
  font-size: 0.95rem;
}

.oracle-poem {
  position: relative;
  margin: 0;
  padding: 16px 18px 16px 20px;
  border: 1px solid rgba(231, 194, 110, 0.3);
  border-left-color: rgba(244, 213, 140, 0.68);
  border-left-width: 2px;
  border-radius: 8px;
  color: rgba(255, 246, 223, 0.9);
  background:
    radial-gradient(circle at 12% 0%, rgba(244, 213, 140, 0.14), transparent 38%),
    linear-gradient(180deg, rgba(244, 213, 140, 0.09), rgba(244, 213, 140, 0.032)),
    rgba(16, 13, 11, 0.24);
}

.oracle-label {
  display: block;
  margin-bottom: 10px;
  color: var(--gold-light);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.oracle-lines {
  display: grid;
  gap: 5px;
  margin: 0;
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-size: clamp(1.12rem, 0.52vw + 0.98rem, 1.36rem);
  line-height: 1.68;
}

.oracle-lines span {
  display: block;
  text-wrap: balance;
}

.reading-detail,
.guide-line {
  display: grid;
  gap: 6px;
}

.reading-detail strong,
.guide-line strong {
  font-size: 0.84rem;
  letter-spacing: 0.08em;
}

.guide-line {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.guide-line strong {
  min-width: 4.4em;
  padding: 3px 8px;
  border: 1px solid rgba(244, 213, 140, 0.32);
  border-radius: 999px;
  text-align: center;
  background: rgba(244, 213, 140, 0.08);
}

.chill-quote {
  padding: 10px 12px;
  border-left: 2px solid rgba(255, 178, 159, 0.5);
  color: rgba(255, 201, 188, 0.95);
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-weight: 700;
  background: rgba(255, 99, 72, 0.055);
}

.business-action {
  display: grid;
  gap: 6px;
  padding: 12px 13px;
  border: 1px solid rgba(231, 194, 110, 0.18);
  border-radius: 8px;
  background: rgba(255, 246, 223, 0.045);
}

.business-title {
  color: var(--gold-light);
  font-size: 0.86rem;
  font-weight: 800;
}

.business-action p {
  display: grid;
  grid-template-columns: 4.6em minmax(0, 1fr);
  gap: 8px;
}

.business-action p strong {
  color: rgba(244, 213, 140, 0.82);
}

.entry-note {
  display: grid;
  gap: 5px;
  color: rgba(246, 234, 210, 0.68);
}

.entry-note strong {
  color: var(--gold-light);
  font-size: 0.84rem;
  letter-spacing: 0.08em;
}

.moving-lines-reading {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(231, 194, 110, 0.22);
}

.moving-lines-reading h3 {
  margin: 0 0 10px;
  color: #ffb29f;
  font-size: 0.98rem;
}

.moving-lines-reading ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.moving-lines-reading li {
  padding: 11px 13px;
  border: 1px solid rgba(255, 63, 48, 0.26);
  border-radius: 8px;
  background: rgba(255, 63, 48, 0.055);
}

.moving-lines-reading li strong {
  display: block;
  color: #ffb29f;
  font-size: 0.94rem;
}

.moving-lines-reading li span {
  display: block;
  margin: 3px 0 6px;
  color: rgba(244, 213, 140, 0.82);
  font-size: 0.86rem;
  font-weight: 700;
}

.moving-lines-reading li p {
  margin: 0 0 6px;
}

.moving-lines-reading li p:last-child {
  margin-bottom: 0;
}

@keyframes cardReveal {
  0% {
    opacity: 1;
    transform: perspective(780px) rotateY(0) scale(1);
    filter: brightness(0.94) saturate(0.96);
  }
  42% {
    opacity: 1;
    transform: perspective(780px) rotateY(88deg) scale(0.98);
    filter: brightness(0.76) saturate(0.9);
  }
  44% {
    transform: perspective(780px) rotateY(-88deg) scale(0.98);
    filter: brightness(0.82) saturate(0.92);
  }
  72% {
    transform: perspective(780px) rotateY(8deg) scale(1.025);
    filter: brightness(1.35) saturate(1.08);
  }
  88% {
    transform: perspective(780px) rotateY(-3deg) scale(1.01);
    filter: brightness(1.14) saturate(1.02);
  }
  100% {
    opacity: 1;
    transform: perspective(780px) rotateY(0) scale(1);
    filter: brightness(1);
  }
}

@keyframes resultCardReveal {
  0% {
    opacity: 0;
    transform: perspective(780px) rotateY(-72deg) translateY(8px) scale(0.96);
    filter: brightness(0.86) saturate(0.9);
  }
  55% {
    opacity: 1;
    transform: perspective(780px) rotateY(8deg) translateY(0) scale(1.02);
    filter: brightness(1.18);
  }
  100% {
    opacity: 1;
    transform: perspective(780px) rotateY(0) translateY(0) scale(1);
    filter: brightness(1);
  }
}

@keyframes cardBackVanish {
  0%,
  43% {
    opacity: 1;
    filter: brightness(0.96) saturate(0.96);
  }
  44%,
  100% {
    opacity: 0;
    filter: brightness(1.28) saturate(1.08);
  }
}

@keyframes lineLand {
  0% {
    opacity: 0.35;
    transform: translateX(-18px) scale(0.94);
    filter: brightness(1.18);
  }
  64% {
    opacity: 1;
    transform: translateX(2px) scale(1.015);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
    filter: brightness(1);
  }
}

@keyframes waitingSweep {
  0% {
    transform: translateX(-120%);
  }
  48%,
  100% {
    transform: translateX(120%);
  }
}

@keyframes altarBreath {
  0%,
  100% {
    opacity: 0.72;
  }
  50% {
    opacity: 1;
  }
}

@keyframes changeEnter {
  0% {
    opacity: 0;
    transform: translateX(-18px) scale(0.98);
    filter: brightness(1.2);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
    filter: brightness(1);
  }
}

@keyframes screenEnter {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1120px) {
  .cast-screen {
    grid-template-columns: minmax(250px, 310px) minmax(420px, 1fr);
  }

  .open-screen {
    grid-template-columns: 1fr;
    align-content: start;
  }

  .open-screen.ritual-screen.is-active {
    min-height: auto;
  }

  .open-screen .opening-altar,
  .open-screen .result-panel {
    align-self: start;
  }

  .open-screen .opening-altar {
    position: relative;
    top: auto;
    grid-template-rows: auto auto auto auto;
    height: auto;
  }

  .open-screen .stage-top {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.56fr);
    align-items: start;
    padding-bottom: 0;
  }

  .open-screen .opening-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ritual-table {
    grid-template-columns: minmax(360px, 0.95fr) minmax(250px, 0.78fr);
    column-gap: 10px;
  }

  .deck-fan {
    width: min(460px, 100%);
    height: min(540px, 74vh);
  }

  .deck-fan::before {
    left: 7%;
    width: 444px;
    height: 560px;
  }

  .fan-card {
    left: 7%;
    width: clamp(92px, 10vw, 104px);
  }

  .yao-card {
    width: clamp(132px, 16vh, 180px);
  }

  .open-screen .yao-card {
    width: clamp(82px, 9vh, 108px);
  }

  body.has-change .open-screen .yao-card {
    width: clamp(68px, 7.2vh, 88px);
  }

  .opening-lines {
    padding-top: 4px;
  }

  body.has-change .opening-line-board {
    width: min(480px, 100%);
  }

  .result-panel {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    align-items: start;
  }

  body.has-change:not(.is-changing) .result-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .result-panel .eyebrow,
  .result-panel h2,
  .result-panel .line-pattern,
  .result-panel .reading-body {
    grid-column: 1;
  }

  .hexagram-cards {
    width: min(240px, calc(100% - 32px));
  }

  body.has-change:not(.is-changing) .hexagram-cards {
    width: min(480px, calc(100% - 32px));
  }
}

@media (max-width: 920px) {
  .result-panel,
  body.has-change:not(.is-changing) .result-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .result-panel .eyebrow,
  .result-panel h2,
  .result-panel .line-pattern,
  .result-panel .reading-body,
  .hexagram-cards,
  .hexagram-card-wrap {
    grid-column: auto;
    grid-row: auto;
  }

  .hexagram-cards {
    width: min(360px, 100%);
    justify-self: center;
    grid-template-columns: 1fr;
  }

  body.has-change:not(.is-changing) .hexagram-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(380px, 100%);
  }

  .hexagram-card-wrap {
    width: min(172px, 42vw);
  }

  body.has-change:not(.is-changing) .hexagram-card-wrap {
    width: min(150px, 36vw);
  }

  body.has-change:not(.is-changing) .reading-columns {
    grid-template-columns: 1fr;
  }

  .situation-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 12px, 1320px);
    min-height: 100svh;
    padding: 7px 0 max(18px, env(safe-area-inset-bottom));
  }

  .cast-screen,
  .open-screen,
  .result-panel {
    grid-template-columns: 1fr;
  }

  .open-screen.ritual-screen.is-active {
    gap: 8px;
    min-height: auto;
  }

  .ritual-screen.is-active {
    gap: 9px;
    min-height: calc(100svh - 14px);
  }

  .open-screen.ritual-screen.is-active {
    min-height: auto;
  }

  .question-area {
    grid-template-rows: auto auto auto auto;
    gap: 10px;
    padding: 13px 14px;
    border-radius: 8px;
  }

  .topic-picker {
    gap: 6px;
  }

  .topic-picker-label {
    font-size: 0.72rem;
  }

  .topic-buttons {
    gap: 6px;
  }

  .topic-button {
    min-height: 31px;
    padding: 0 5px;
    font-size: 0.72rem;
  }

  .eyebrow {
    margin-bottom: 5px;
    font-size: 0.72rem;
  }

  h1 {
    font-size: clamp(1.82rem, 8.4vw, 2.18rem);
  }

  h2 {
    font-size: clamp(1.82rem, 8vw, 2.2rem);
  }

  textarea {
    min-height: clamp(70px, 10svh, 104px);
    padding: 12px;
  }

  .actions {
    grid-template-columns: 1fr 1fr 0.72fr;
    gap: 8px;
  }

  .actions button {
    min-height: 42px;
    padding: 0 9px;
    font-size: 0.92rem;
  }

  .ritual-table {
    grid-template-columns: minmax(0, 1fr) clamp(126px, 38vw, 158px);
    grid-template-rows: auto minmax(470px, calc(100svh - 238px));
    column-gap: 5px;
    row-gap: 0;
    min-height: clamp(580px, calc(100svh - 186px), 720px);
    border-radius: 8px;
  }

  .stage-top {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: flex-start;
    padding: 14px 14px 0;
    gap: 10px;
  }

  .stage-heading {
    gap: 5px;
  }

  .stage-label {
    font-size: 0.78rem;
  }

  .stage-cue {
    font-size: 0.86rem;
  }

  .draw-status {
    min-width: 58px;
    padding: 7px 9px;
    font-size: 0.9rem;
  }

  .ritual-table::before {
    left: 41%;
    top: 55%;
    width: min(360px, 84%);
  }

  .open-screen .opening-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 8px;
  }

  .open-screen .opening-actions button {
    min-height: 40px;
    min-width: 0;
    padding: 0 8px;
    font-size: 0.86rem;
  }

  .open-screen .opening-actions #changeButton {
    grid-column: 1 / -1;
  }

  .opening-bottom-actions {
    padding: 0 14px 14px;
  }

  .opening-altar {
    align-self: start;
    grid-template-rows: auto auto auto auto;
    min-height: auto;
    border-radius: 8px;
  }

  .open-screen .stage-top {
    grid-template-columns: 1fr;
    padding: 13px 14px 0;
  }

  .hexagram-stage {
    grid-column: 2;
    grid-row: 2;
    align-self: stretch;
    padding: 12px 8px 16px 0;
    transform: none;
  }

  .deck-zone {
    grid-column: 1;
    grid-row: 2;
    justify-items: center;
    align-items: center;
    padding: 4px 4px 16px 6px;
    overflow: hidden;
  }

  .ritual-table .deck-zone::before {
    content: "掌中取爻";
    left: 12px;
    top: 12px;
    font-size: 0.76rem;
  }

  .line-slots {
    width: 100%;
    gap: clamp(6px, 1.05svh, 10px);
  }

  .line-slot {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 7px;
    justify-content: stretch;
  }

  .slot-label {
    font-size: 0.76rem;
  }

  .yao-card {
    width: min(116px, 100%);
  }

  .open-screen .yao-card {
    width: min(100px, 30vw);
  }

  .opening-lines {
    padding: 8px 14px 14px;
  }

  .open-screen .line-slots {
    width: min(198px, 100%);
    gap: clamp(5px, 0.9svh, 8px);
  }

  .open-screen .line-slot {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  body.has-change .opening-line-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
  }

  body.has-change .open-screen .line-slots {
    width: 100%;
    gap: 7px;
  }

  body.has-change .open-screen .line-slot {
    grid-template-columns: 30px minmax(0, 108px);
    gap: 7px;
    justify-content: center;
  }

  body.has-change .open-screen .yao-card {
    width: min(108px, 100%);
    height: auto;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    contain: paint;
    border: 1px solid rgba(231, 194, 110, 0.28);
    border-radius: 7px;
    background: rgba(255, 246, 223, 0.06);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.2);
  }

  body.has-change .gua-column-label {
    font-size: 0.78rem;
  }

  body.has-change .open-screen .yao-card.revealed img {
    display: block;
  }

  body.has-change .open-screen .yao-card.yang-line::before,
  body.has-change .open-screen .yao-card.yin-line::before,
  body.has-change .open-screen .yao-card.yin-line::after {
    content: none;
  }

  body.has-change .open-screen .line-slot.is-changing-line {
    padding: 0;
    border: 0;
    background: transparent;
  }

  body.has-change .open-screen .line-slot.is-changing-line .yao-card,
  body.has-change .open-screen .line-slot.is-changing-line .yao-card.revealed {
    border-color: rgba(255, 63, 48, 0.92);
    outline: 2px solid rgba(255, 45, 32, 0.86);
    outline-offset: 2px;
    box-shadow:
      0 0 0 1px rgba(255, 244, 226, 0.2),
      0 0 18px rgba(255, 45, 32, 0.28),
      0 12px 24px rgba(0, 0, 0, 0.24);
  }

  .deck-fan {
    --drag-x: 0px;
    --drag-y: 0px;
    --drag-rot: 0deg;
    --drag-scale: 1;
    width: min(258px, 63vw);
    height: clamp(390px, calc(100svh - 304px), 530px);
    min-height: 360px;
    touch-action: pan-y;
  }

  .deck-fan::before {
    left: 50%;
    top: 53%;
    width: min(254px, 62vw);
    height: min(430px, 66svh);
    border: 1px solid rgba(244, 213, 140, 0.18);
    border-radius: 999px;
    box-shadow:
      0 0 54px rgba(244, 213, 140, 0.04),
      inset 0 0 36px rgba(244, 213, 140, 0.025);
    transform: translate(-50%, -50%) rotate(-8deg);
  }

  .fan-card {
    left: 50%;
    top: 53%;
    width: clamp(166px, 49vw, 220px);
    border-radius: 10px;
    box-shadow:
      0 20px 42px rgba(0, 0, 0, 0.44),
      0 0 0 1px rgba(244, 213, 140, 0.04);
    touch-action: pan-y;
    z-index: var(--mobile-z);
  }

  .deck-fan.is-ready .fan-card {
    opacity: 1;
    transition:
      transform 260ms cubic-bezier(0.18, 0.78, 0.2, 1),
      box-shadow 180ms ease,
      opacity 220ms ease;
    transition-delay: calc(var(--i) * 2ms);
    transform:
      translate(calc(-50% + var(--stack-x) + var(--drag-x)), calc(-50% + var(--stack-y) + var(--drag-y)))
      rotate(calc(var(--stack-rot) + var(--drag-rot)))
      scale(var(--drag-scale));
  }

  .deck-fan.is-dragging .fan-card:not(.is-spent) {
    transition-duration: 0ms;
    transition-delay: 0ms;
  }

  .deck-fan.is-ready .fan-card:hover:not(:disabled),
  .deck-fan.is-ready .fan-card:focus-visible:not(:disabled) {
    transform:
      translate(calc(-50% + var(--stack-x) + var(--drag-x)), calc(-50% + var(--stack-y) + var(--drag-y)))
      rotate(calc(var(--stack-rot) + var(--drag-rot)))
      scale(var(--drag-scale));
    z-index: 1200;
  }

  .deck-fan.is-pull-ready .fan-card:not(.is-spent) {
    box-shadow:
      0 24px 52px rgba(0, 0, 0, 0.5),
      0 0 0 1px rgba(244, 213, 140, 0.32),
      0 0 30px rgba(244, 213, 140, 0.1);
  }

  .deck-fan.is-ready .fan-card.is-picked,
  .deck-fan.is-ready .fan-card.is-spent {
    opacity: 0;
    transform:
      translate(calc(-50% + 50vw), calc(-50% - 15svh))
      rotate(22deg)
      scale(0.92);
    z-index: 1200;
  }

  .deck-fan.is-closed .fan-card {
    pointer-events: none;
    opacity: 0.25;
  }

  .result-panel {
    gap: 12px;
    padding: 17px;
    border-radius: 8px;
  }

  body.has-change:not(.is-changing) .result-panel {
    grid-template-columns: 1fr;
  }

  .hexagram-card-wrap {
    width: min(176px, 48vw);
  }

  body.has-change:not(.is-changing) .hexagram-cards {
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.has-change:not(.is-changing) .hexagram-card-wrap {
    width: min(136px, 38vw);
  }

  body.has-change:not(.is-changing) .reading-columns {
    grid-template-columns: 1fr;
  }

  .reading-body {
    font-size: 0.98rem;
    line-height: 1.78;
  }

  .reading-section {
    padding-left: 11px;
  }

  .question-summary {
    margin-bottom: 14px;
    padding: 11px 12px;
  }

  .situation-reading {
    padding: 14px;
  }

  .situation-tags {
    gap: 6px;
  }

  .situation-tags span {
    font-size: 0.76rem;
  }

  .situation-grid {
    gap: 9px;
  }

  .situation-grid article {
    padding: 11px 12px;
  }

  .oracle-poem {
    padding: 12px 13px;
  }

  .oracle-lines {
    gap: 4px;
    font-size: 1.03rem;
  }

  .guide-line,
  .business-action p {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .guide-line strong {
    width: fit-content;
    min-width: 0;
  }

  .result-panel .eyebrow,
  .result-panel h2,
  .result-panel .line-pattern,
  .result-panel .reading-body,
  .hexagram-cards,
  .hexagram-card-wrap {
    grid-column: auto;
    grid-row: auto;
  }
}

@media print {
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body::before,
  body::after,
  .app-shell {
    display: none !important;
  }

  body {
    background: white;
    color: #1a1a1a;
  }

  .print-area {
    display: block;
    max-width: 680px;
    margin: 0 auto;
    padding: 28px 36px;
    font-family: "Noto Serif TC", "Songti TC", serif;
    color: #1a1a1a;
  }

  .pa-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 10px;
    border-bottom: 2px solid #1a1a1a;
    margin-bottom: 22px;
  }

  .pa-brand {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.12em;
  }

  .pa-date {
    font-size: 0.84rem;
    color: #555;
  }

  .pa-cards {
    display: flex;
    gap: 28px;
    justify-content: center;
    margin-bottom: 22px;
  }

  .pa-card-figure {
    margin: 0;
    text-align: center;
  }

  .pa-card-figure img {
    width: 130px;
    height: auto;
    border: 1px solid #bbb;
    border-radius: 6px;
    display: block;
  }

  .pa-card-figure figcaption {
    margin-top: 5px;
    font-size: 0.78rem;
    font-weight: 800;
    color: #555;
    letter-spacing: 0.1em;
  }

  .pa-title {
    font-size: 1.72rem;
    font-weight: 700;
    margin: 0 0 6px;
    font-family: "Noto Serif TC", "Songti TC", serif;
    color: #1a1a1a;
  }

  .pa-pattern {
    font-size: 0.88rem;
    color: #555;
    margin: 0 0 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid #ccc;
  }

  .pa-body .question-summary {
    display: grid;
    gap: 4px;
    margin-bottom: 14px;
    padding: 9px 12px;
    border-left: 3px solid #666;
    background: #f4f4f4;
    color: #1a1a1a;
  }

  .pa-body .question-summary strong {
    font-size: 0.74rem;
    letter-spacing: 0.1em;
    color: #444;
  }

  .pa-body .situation-reading {
    margin-bottom: 18px;
    padding: 13px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fafafa;
    break-inside: avoid;
  }

  .pa-body .situation-heading > span {
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: #555;
  }

  .pa-body .situation-heading h3 {
    font-size: 1.06rem;
    color: #1a1a1a;
    font-family: "Noto Serif TC", "Songti TC", serif;
    margin: 2px 0 8px;
    line-height: 1.35;
  }

  .pa-body .situation-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
  }

  .pa-body .situation-tags span {
    padding: 2px 7px;
    border: 1px solid #999;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 800;
    color: #333;
  }

  .pa-body .situation-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 7px;
  }

  .pa-body .situation-grid article {
    padding: 9px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
    break-inside: avoid;
  }

  .pa-body .situation-grid article strong {
    display: block;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    margin-bottom: 3px;
    color: #444;
  }

  .pa-body .situation-grid article p {
    margin: 0;
    font-size: 0.86rem;
    color: #1a1a1a;
    line-height: 1.65;
  }

  .pa-body .reading-columns {
    display: grid;
    gap: 20px;
  }

  .pa-body .reading-section {
    padding-left: 13px;
    border-left: 2px solid #888;
    break-inside: avoid;
  }

  .pa-body .reading-section-heading > span {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: #555;
  }

  .pa-body .reading-section h3 {
    font-size: 1.06rem;
    color: #1a1a1a;
    font-family: "Noto Serif TC", "Songti TC", serif;
    margin: 2px 0 10px;
    line-height: 1.4;
  }

  .pa-body .oracle-poem {
    margin: 0 0 10px;
    padding: 11px 13px;
    border: 1px solid #ccc;
    border-left: 3px solid #777;
    border-radius: 5px;
    background: #fafafa;
    break-inside: avoid;
  }

  .pa-body .oracle-label {
    display: block;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: #555;
    margin-bottom: 7px;
  }

  .pa-body .oracle-lines {
    display: grid;
    gap: 2px;
    font-family: "Noto Serif TC", "Songti TC", serif;
    font-size: 0.98rem;
    color: #1a1a1a;
    line-height: 1.7;
  }

  .pa-body .oracle-lines span {
    display: block;
  }

  .pa-body .reading-lines {
    font-size: 0.86rem;
    color: #555;
    padding: 5px 0;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    margin: 8px 0;
  }

  .pa-body .reading-detail {
    display: grid;
    gap: 3px;
    margin: 8px 0;
  }

  .pa-body .reading-detail strong {
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    color: #444;
  }

  .pa-body .guide-line {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    align-items: start;
    margin: 8px 0;
  }

  .pa-body .guide-line strong {
    padding: 2px 7px;
    border: 1px solid #888;
    border-radius: 999px;
    font-size: 0.78rem;
    text-align: center;
    white-space: nowrap;
    color: #333;
  }

  .pa-body .guide-line span {
    font-size: 0.88rem;
    color: #1a1a1a;
    line-height: 1.6;
  }

  .pa-body .chill-quote {
    padding: 7px 10px;
    border-left: 2px solid #aaa;
    color: #444;
    font-family: "Noto Serif TC", "Songti TC", serif;
    margin: 8px 0;
    background: #f6f6f6;
    font-size: 0.88rem;
  }

  .pa-body .business-action {
    padding: 9px 11px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fafafa;
    margin: 8px 0;
    break-inside: avoid;
  }

  .pa-body .business-title {
    display: block;
    font-size: 0.82rem;
    font-weight: 800;
    margin-bottom: 5px;
    color: #333;
  }

  .pa-body .business-action p {
    display: grid;
    grid-template-columns: 5em 1fr;
    gap: 5px;
    margin: 3px 0;
    font-size: 0.86rem;
    color: #1a1a1a;
  }

  .pa-body .business-action p strong {
    color: #555;
  }

  .pa-body .entry-note {
    display: grid;
    gap: 3px;
    margin-top: 8px;
    color: #555;
  }

  .pa-body .entry-note strong {
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    color: #444;
  }

  .pa-body .entry-note p {
    font-size: 0.86rem;
    margin: 0;
    color: #666;
  }

  .pa-body .moving-lines-reading {
    margin-top: 18px;
    padding-top: 13px;
    border-top: 1px solid #ccc;
  }

  .pa-body .moving-lines-reading h3 {
    font-size: 0.94rem;
    color: #333;
    margin: 0 0 9px;
    font-family: "Noto Serif TC", "Songti TC", serif;
  }

  .pa-body .moving-lines-reading ol {
    display: grid;
    gap: 7px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .pa-body .moving-lines-reading li {
    padding: 9px 11px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fafafa;
    break-inside: avoid;
  }

  .pa-body .moving-lines-reading li strong {
    display: block;
    font-size: 0.88rem;
    color: #333;
    margin-bottom: 2px;
  }

  .pa-body .moving-lines-reading li span {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: #666;
    margin: 2px 0 4px;
  }

  .pa-body .moving-lines-reading li p {
    margin: 3px 0 0;
    font-size: 0.86rem;
    color: #1a1a1a;
    line-height: 1.62;
  }
}

@page {
  size: A4;
  margin: 12mm;
}

@media print {
  html,
  body {
    width: auto;
    min-height: auto;
    overflow: visible !important;
  }

  body {
    margin: 0;
  }

  .print-area {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  .print-area,
  .print-area * {
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
    box-shadow: none !important;
  }

  .pa-header,
  .pa-cards,
  .pa-title,
  .pa-pattern {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .pa-cards {
    gap: 16px;
    align-items: flex-start;
    flex-wrap: nowrap;
  }

  .pa-card-figure {
    flex: 0 1 42%;
    min-width: 0;
  }

  .pa-card-figure img {
    width: min(118px, 100%);
    margin: 0 auto;
  }

  .pa-body .situation-grid,
  .pa-body .reading-columns {
    grid-template-columns: 1fr !important;
  }

  .pa-body .situation-reading,
  .pa-body .reading-section,
  .pa-body .oracle-poem,
  .pa-body .business-action {
    break-inside: auto;
    page-break-inside: auto;
  }

  .pa-body .situation-grid article,
  .pa-body .moving-lines-reading li {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .pa-body .guide-line,
  .pa-body .business-action p {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .pa-body .guide-line strong {
    width: fit-content;
  }

  .pa-body p,
  .pa-body li,
  .pa-body article {
    orphans: 2;
    widows: 2;
  }
}
