:root {
  color-scheme: light;
  --paper: #f7f2e8;
  --panel: #fffdf8;
  --ink: #25312b;
  --muted: #6f746d;
  --line: #ddd2bf;
  --gold: #a37a2a;
  --red: #a94d3b;
  --green: #2f6658;
  --blue: #315f7d;
  --shadow: 0 18px 50px rgba(39, 46, 40, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(47, 102, 88, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(163, 122, 42, 0.06) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  color: var(--ink);
  font-family:
    "Source Han Serif SC", "Songti SC", "Microsoft YaHei", "PingFang SC", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px;
}

.app-tabs {
  width: fit-content;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(39, 46, 40, 0.08);
}

.app-tab {
  min-width: 120px;
  min-height: 42px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}

.app-tab:last-child {
  border-right: 0;
}

.app-tab.is-active {
  background: var(--green);
  color: #fff;
  font-weight: 700;
}

.app-view {
  display: none;
}

.app-view.is-active {
  display: grid;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(310px, 380px) minmax(0, 1fr);
  gap: 18px;
  min-height: calc(100vh - 48px);
  min-width: 0;
}

.app-view:not(.is-active) {
  display: none;
}

.app-view.is-active {
  display: grid;
}

.control-panel,
.result-panel,
.plate,
.hex-card,
.notes > div {
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
}

.control-panel {
  border-radius: 8px;
  padding: 22px;
  align-self: start;
  position: sticky;
  top: 24px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.brand-mark {
  width: 58px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(163, 122, 42, 0.46);
  background: #f2ead9;
  color: var(--gold);
  font-family: "Songti SC", "SimSun", serif;
  font-size: 30px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

.brand p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.form-stack {
  display: grid;
  gap: 16px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field,
.method-group {
  display: grid;
  gap: 8px;
}

.field span,
.section-title,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffaf1;
  color: var(--ink);
  padding: 8px 10px;
  outline: none;
}

.field input:focus,
.field select:focus,
.segment:focus-visible,
.primary-action:focus-visible,
.icon-action:focus-visible {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 102, 88, 0.16);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: #fffaf1;
}

.segment {
  min-height: 40px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}

.segment:last-child {
  border-right: 0;
}

.segment.is-active {
  background: var(--green);
  color: #fff;
}

.method-panel {
  display: none;
}

.method-panel.is-active {
  display: block;
}

.time-seal {
  border: 1px solid rgba(49, 95, 125, 0.24);
  background: rgba(49, 95, 125, 0.08);
  color: var(--blue);
  border-radius: 6px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.check-field {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
}

.check-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.coin-grid,
.manual-lines {
  display: grid;
  gap: 8px;
}

.coin-row,
.manual-row {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.coin-value {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffaf1;
  padding: 8px 10px;
}

.action-bar {
  display: grid;
  grid-template-columns: 1fr 44px 44px;
  gap: 10px;
  align-items: center;
}

.ziwei-workspace .action-bar {
  grid-template-columns: 1fr 44px;
}

.primary-action,
.icon-action {
  min-height: 44px;
  border-radius: 6px;
  border: 1px solid transparent;
}

.primary-action {
  background: var(--red);
  color: #fff;
  font-weight: 700;
}

.icon-action {
  background: #fffaf1;
  border-color: var(--line);
  color: var(--ink);
  font-size: 20px;
}

.result-panel {
  border-radius: 8px;
  padding: 18px;
  display: grid;
  gap: 16px;
  min-width: 0;
}

.summary-band {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) minmax(0, 0.7fr);
  gap: 12px;
  align-items: stretch;
}

.summary-band > div,
.hex-card,
.notes > div {
  border-radius: 8px;
  padding: 16px;
}

.summary-band > div {
  border: 1px solid rgba(47, 102, 88, 0.24);
  background: rgba(47, 102, 88, 0.08);
  min-width: 0;
}

.summary-band strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.hexagram-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.hex-card {
  box-shadow: none;
}

.hex-card h2 {
  margin-top: 8px;
  color: var(--red);
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.1;
  letter-spacing: 0;
}

.hex-card p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.65;
}

.plate {
  border-radius: 8px;
  padding: 18px;
  box-shadow: none;
}

.plate-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.plate-head h2 {
  margin-top: 4px;
  font-size: 20px;
}

.method-badge {
  flex: 0 0 auto;
  border: 1px solid rgba(163, 122, 42, 0.36);
  color: var(--gold);
  background: rgba(163, 122, 42, 0.08);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
}

.plain-panel {
  background: #fffdf8;
}

.plain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.plain-item {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffaf1;
  padding: 12px;
}

.plain-term {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.plain-term strong {
  color: var(--ink);
  font-size: 14px;
}

.plain-value {
  overflow-wrap: anywhere;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.plain-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.yao-chart {
  display: grid;
  gap: 8px;
}

.yao-row {
  display: grid;
  grid-template-columns: 54px minmax(92px, 124px) minmax(118px, 150px) minmax(110px, 150px) 34px 42px minmax(120px, 1fr) minmax(150px, 1.2fr);
  align-items: center;
  gap: 10px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffaf1;
  padding: 8px 10px;
}

.yao-row-head {
  min-height: 34px;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-size: 12px;
  padding-block: 0;
}

.god {
  color: var(--green);
  font-weight: 700;
}

.hidden-spirit,
.line-name,
.change-text,
.status-tags {
  color: var(--muted);
  font-size: 13px;
}

.hidden-spirit {
  line-height: 1.45;
}

.line-name {
  display: grid;
  gap: 3px;
  color: var(--ink);
}

.line-name strong {
  font-size: 14px;
}

.line-name span,
.change-text {
  color: var(--muted);
}

.yao-shape {
  width: min(100%, 170px);
  height: 20px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.yao-shape .bar {
  height: 8px;
  background: var(--ink);
  border-radius: 2px;
}

.yao-shape.yang .bar {
  width: 100%;
}

.yao-shape.yin .bar {
  width: calc(50% - 5px);
}

.moving-mark {
  color: var(--red);
  font-weight: 800;
  text-align: center;
  font-size: 18px;
}

.shi-ying {
  min-height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
}

.shi-ying.shi {
  background: var(--red);
}

.shi-ying.ying {
  background: var(--blue);
}

.status-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.status-tags span {
  border: 1px solid rgba(47, 102, 88, 0.18);
  border-radius: 999px;
  background: rgba(47, 102, 88, 0.08);
  color: var(--green);
  padding: 2px 6px;
  line-height: 1.4;
}

.notes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.notes > div {
  box-shadow: none;
}

.notes p {
  margin-top: 8px;
  color: var(--ink);
  line-height: 1.7;
}

.ziwei-summary {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr) minmax(0, 1fr) minmax(0, 0.8fr);
}

.tarot-summary {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.9fr) minmax(0, 1.1fr) minmax(0, 0.9fr);
}

.bazi-summary {
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.25fr) minmax(0, 1.25fr) minmax(0, 0.8fr);
}

.ziwei-chart {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-areas:
    "si wu wei shen"
    "chen center center you"
    "mao center center xu"
    "yin chou zi hai";
  gap: 8px;
}

.ziwei-center {
  grid-area: center;
  min-height: 220px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(163, 122, 42, 0.34);
  border-radius: 8px;
  background: rgba(163, 122, 42, 0.08);
  text-align: center;
  padding: 20px;
}

.ziwei-center strong {
  display: block;
  color: var(--red);
  font-size: 28px;
  margin-bottom: 8px;
}

.ziwei-center span {
  display: block;
  color: var(--muted);
  line-height: 1.7;
}

.ziwei-palace {
  min-height: 172px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf1;
  padding: 10px;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 8px;
}

.ziwei-palace.is-ming {
  border-color: rgba(169, 77, 59, 0.58);
  box-shadow: inset 0 0 0 1px rgba(169, 77, 59, 0.22);
}

.ziwei-palace.is-focus {
  border-color: rgba(169, 77, 59, 0.78);
  background: #fff6ef;
}

.ziwei-palace.is-trine {
  border-color: rgba(47, 102, 88, 0.58);
}

.ziwei-palace.is-opposite {
  border-color: rgba(49, 95, 125, 0.58);
}

.ziwei-palace-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.ziwei-branch {
  color: var(--muted);
  font-size: 12px;
}

.ziwei-palace-name {
  color: var(--ink);
  font-weight: 800;
}

.ziwei-tags,
.star-list,
.ziwei-markers {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.star-list {
  align-content: start;
  gap: 5px;
}

.ziwei-tags span,
.star-tag,
.transform-tag,
.ziwei-markers span,
.limit-tag {
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 12px;
  line-height: 1.4;
}

.ziwei-tags span {
  background: rgba(49, 95, 125, 0.1);
  color: var(--blue);
}

.star-tag {
  background: rgba(47, 102, 88, 0.1);
  color: var(--green);
  border: 1px solid rgba(47, 102, 88, 0.18);
}

.star-tag.main-star {
  background: rgba(169, 77, 59, 0.1);
  color: var(--red);
  border-color: rgba(169, 77, 59, 0.22);
  font-weight: 700;
}

.star-brightness {
  color: var(--muted);
  font-weight: 400;
  margin-left: 2px;
}

.transform-tag {
  background: rgba(163, 122, 42, 0.1);
  color: var(--gold);
  border: 1px solid rgba(163, 122, 42, 0.24);
}

.ziwei-markers span {
  background: rgba(37, 49, 43, 0.07);
  color: var(--muted);
  border: 1px solid rgba(37, 49, 43, 0.1);
}

.limit-tag {
  width: fit-content;
  background: rgba(37, 49, 43, 0.08);
  color: var(--muted);
}

.tarot-spread-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.tarot-layout-single {
  grid-template-columns: minmax(220px, 340px);
  justify-content: center;
}

.tarot-layout-three,
.tarot-layout-relationship,
.tarot-layout-career {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.tarot-layout-cross,
.tarot-layout-decision,
.tarot-layout-celtic,
.tarot-layout-year {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.tarot-card {
  min-height: 330px;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf1;
  padding: 12px;
  overflow: hidden;
}

.tarot-position {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tarot-card-face {
  min-height: 172px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  border: 1px solid rgba(37, 49, 43, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.2)),
    rgba(47, 102, 88, 0.08);
  padding: 12px;
  text-align: center;
}

.tarot-card-top {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.tarot-card-face strong {
  color: var(--ink);
  font-family: "Songti SC", "SimSun", serif;
  font-size: 25px;
  line-height: 1.15;
}

.tarot-card-face span {
  color: var(--muted);
  font-size: 13px;
}

.tarot-card-face small {
  color: var(--gold);
  font-size: 12px;
}

.tarot-card.is-reversed .tarot-card-face {
  border-style: dashed;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.14)),
    rgba(169, 77, 59, 0.08);
}

.tarot-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tarot-keywords span {
  border: 1px solid rgba(47, 102, 88, 0.18);
  border-radius: 999px;
  background: rgba(47, 102, 88, 0.08);
  color: var(--green);
  padding: 2px 7px;
  font-size: 12px;
  line-height: 1.45;
}

.tarot-card p {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.65;
}

.suit-major .tarot-card-face,
.tarot-library-card.suit-major {
  border-color: rgba(163, 122, 42, 0.34);
  background-color: rgba(163, 122, 42, 0.08);
}

.suit-wands .tarot-card-face,
.tarot-library-card.suit-wands {
  border-color: rgba(169, 77, 59, 0.34);
  background-color: rgba(169, 77, 59, 0.08);
}

.suit-cups .tarot-card-face,
.tarot-library-card.suit-cups {
  border-color: rgba(49, 95, 125, 0.34);
  background-color: rgba(49, 95, 125, 0.08);
}

.suit-swords .tarot-card-face,
.tarot-library-card.suit-swords {
  border-color: rgba(89, 96, 113, 0.34);
  background-color: rgba(89, 96, 113, 0.08);
}

.suit-pentacles .tarot-card-face,
.tarot-library-card.suit-pentacles {
  border-color: rgba(47, 102, 88, 0.34);
  background-color: rgba(47, 102, 88, 0.08);
}

.tarot-library-panel {
  box-shadow: none;
}

.tarot-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  max-height: 430px;
  overflow: auto;
  padding-right: 4px;
}

.tarot-library-card {
  min-height: 96px;
  display: grid;
  gap: 5px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf1;
  padding: 10px;
}

.tarot-library-card strong {
  color: var(--ink);
  font-size: 14px;
}

.tarot-library-card span,
.tarot-library-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.bazi-workspace .action-bar,
.bazi-actions {
  grid-template-columns: 1fr 44px;
}

.bazi-pillars {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.bazi-pillar-card {
  min-height: 250px;
  display: grid;
  align-content: start;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf1;
  padding: 14px;
  text-align: center;
}

.bazi-god {
  width: fit-content;
  justify-self: center;
  border: 1px solid rgba(47, 102, 88, 0.2);
  border-radius: 999px;
  background: rgba(47, 102, 88, 0.08);
  color: var(--green);
  padding: 3px 8px;
  font-size: 12px;
}

.bazi-stem,
.bazi-branch {
  display: block;
  color: var(--red);
  font-family: "Songti SC", "SimSun", serif;
  font-size: 42px;
  line-height: 1;
}

.bazi-branch {
  color: var(--ink);
}

.bazi-hidden,
.bazi-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.bazi-luck-table {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.bazi-luck-item {
  min-height: 96px;
  display: grid;
  gap: 6px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf1;
  padding: 10px;
}

.bazi-luck-item strong {
  color: var(--red);
  font-family: "Songti SC", "SimSun", serif;
  font-size: 24px;
}

.bazi-luck-item span,
.bazi-luck-item small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 980px) {
  .app-shell {
    padding: 14px;
  }

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

  .control-panel {
    position: static;
  }

  .yao-row {
    grid-template-columns: 54px minmax(0, 1fr) 34px 34px;
    align-items: start;
  }

  .yao-row-head {
    display: none;
  }

  .god {
    grid-column: 1;
    grid-row: 1;
  }

  .line-name {
    grid-column: 2;
    grid-row: 1;
  }

  .moving-mark {
    grid-column: 3;
    grid-row: 1;
  }

  .shi-ying {
    grid-column: 4;
    grid-row: 1;
  }

  .yao-shape {
    grid-column: 2 / 5;
    grid-row: 2;
    margin-top: 6px;
  }

  .hidden-spirit {
    grid-column: 2 / 5;
    grid-row: 3;
  }

  .change-text {
    grid-column: 2 / 5;
    grid-row: 4;
  }

  .status-tags {
    grid-column: 2 / 5;
    grid-row: 5;
  }
}

@media (max-width: 720px) {
  .summary-band,
  .ziwei-summary,
  .tarot-summary,
  .bazi-summary,
  .hexagram-pair,
  .notes,
  .field-grid,
  .field-grid.three {
    grid-template-columns: 1fr;
  }

  .segmented {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-tabs {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .app-tab {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .app-tab:last-child {
    border-bottom: 0;
  }

  .segment:nth-child(2) {
    border-right: 0;
  }

  .segment:nth-child(1),
  .segment:nth-child(2) {
    border-bottom: 1px solid var(--line);
  }

  .yao-row {
    grid-template-columns: 48px minmax(0, 1fr) 32px 32px;
  }

  .ziwei-chart {
    grid-template-columns: 1fr;
    grid-template-areas: none;
  }

  .tarot-spread-board,
  .tarot-layout-single,
  .tarot-layout-three,
  .tarot-layout-cross,
  .tarot-layout-relationship,
  .tarot-layout-career,
  .tarot-layout-decision,
  .tarot-layout-celtic,
  .tarot-layout-year {
    grid-template-columns: 1fr;
  }

  .bazi-pillars,
  .bazi-luck-table {
    grid-template-columns: 1fr;
  }

  .ziwei-palace,
  .ziwei-center {
    grid-area: auto !important;
  }

  .ziwei-center {
    min-height: 150px;
  }
}

@media (max-width: 420px) {
  .control-panel,
  .result-panel,
  .plate {
    padding: 14px;
  }

  .action-bar {
    grid-template-columns: minmax(0, 1fr) 42px 42px;
    gap: 6px;
  }

  .primary-action,
  .icon-action {
    min-width: 0;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-mark {
    width: 48px;
    font-size: 25px;
  }

  h1 {
    font-size: 19px;
  }
}

/* 2026 cosmic entertainment refresh */
:root {
  --void: #080b14;
  --void-2: #101827;
  --stellar: #d8b77a;
  --stellar-soft: rgba(216, 183, 122, 0.2);
  --moon: #f6edda;
  --mist: #9ed6d0;
  --rose-mist: #b36f86;
  --glass: rgba(255, 248, 231, 0.08);
  --glass-strong: rgba(255, 248, 231, 0.14);
  --deep-line: rgba(246, 226, 180, 0.22);
  --premium-ease: cubic-bezier(0.32, 0.72, 0, 1);
}

html {
  background: var(--void);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 10%, rgba(116, 75, 146, 0.42), transparent 34rem),
    radial-gradient(circle at 82% 4%, rgba(70, 145, 139, 0.36), transparent 30rem),
    linear-gradient(145deg, #070913 0%, #111827 48%, #151024 100%);
  color: var(--moon);
  font-family: "Source Han Serif SC", "Songti SC", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(rgba(246, 226, 180, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(158, 214, 208, 0.035) 1px, transparent 1px),
    url("./assets/nebula-card.jpg") center / cover no-repeat;
  background-size: 72px 72px, 72px 72px, cover;
  opacity: 0.34;
  mix-blend-mode: screen;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 20%, transparent 0, rgba(5, 7, 14, 0.22) 45%, rgba(5, 7, 14, 0.72) 100%),
    linear-gradient(180deg, rgba(8, 11, 20, 0.18), rgba(8, 11, 20, 0.78));
}

.app-shell {
  width: min(1680px, 100%);
  padding: 28px clamp(18px, 3.8vw, 56px) 64px;
}

.oracle-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: clamp(42px, 7vw, 82px);
  color: rgba(246, 237, 218, 0.72);
  font-size: 14px;
}

.back-home {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--deep-line);
  border-radius: 999px;
  background: rgba(255, 248, 231, 0.08);
  color: var(--moon);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 620ms var(--premium-ease), background 620ms var(--premium-ease);
}

.back-home:hover {
  transform: translateY(-2px);
  background: rgba(255, 248, 231, 0.14);
}

.oracle-hero {
  position: relative;
  overflow: hidden;
  min-height: min(860px, calc(100vh - 56px));
  padding: clamp(22px, 3.5vw, 44px);
  border: 1px solid rgba(246, 226, 180, 0.18);
  border-radius: 34px;
  background:
    linear-gradient(112deg, rgba(8, 12, 22, 0.92), rgba(20, 22, 43, 0.72)),
    url("./assets/cosmic-hero.jpg") center / cover no-repeat;
  box-shadow: 0 34px 96px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.oracle-hero::after {
  content: "";
  position: absolute;
  inset: auto -8% -26% 28%;
  height: 440px;
  background: radial-gradient(circle, rgba(216, 183, 122, 0.22), transparent 58%);
  filter: blur(18px);
  pointer-events: none;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(420px, 1.1fr);
  align-items: end;
  gap: clamp(34px, 6vw, 96px);
}

.hero-copy {
  max-width: 720px;
  padding-bottom: clamp(18px, 5vw, 68px);
}

.hero-kicker,
.tool-heading p,
.gallery-card span,
.floating-card span,
.hero-disclaimer,
.oracle-footer strong {
  color: rgba(246, 226, 180, 0.82);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.hero-kicker {
  margin-bottom: 22px;
}

.hero-copy h1 {
  max-width: 10em;
  margin: 0;
  color: #fff8e8;
  font-size: clamp(48px, 7.6vw, 106px);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-lead {
  max-width: 660px;
  margin: 28px 0 0;
  color: rgba(246, 237, 218, 0.82);
  font-size: clamp(16px, 1.35vw, 21px);
  line-height: 1.9;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 34px;
}

.primary-link,
.ghost-link {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border-radius: 999px;
  padding: 0 22px;
  transition: transform 620ms var(--premium-ease), background 620ms var(--premium-ease), border-color 620ms var(--premium-ease);
}

.primary-link {
  background: var(--moon);
  color: #15131c;
  font-weight: 800;
}

.primary-link span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(21, 19, 28, 0.1);
}

.ghost-link {
  border: 1px solid var(--deep-line);
  background: rgba(255, 248, 231, 0.08);
  color: var(--moon);
  font-weight: 700;
}

.primary-link:hover,
.ghost-link:hover {
  transform: translateY(-2px);
}

.hero-disclaimer {
  max-width: 560px;
  margin-top: 24px;
  color: rgba(246, 237, 218, 0.6);
  letter-spacing: 0;
  line-height: 1.7;
}

.hero-visual {
  position: relative;
  min-height: 560px;
  border-radius: 30px;
}

.hero-image {
  width: 100%;
  height: min(58vw, 660px);
  min-height: 460px;
  object-fit: cover;
  border: 1px solid rgba(246, 226, 180, 0.18);
  border-radius: 30px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.36);
  animation: starDrift 18s var(--premium-ease) infinite alternate;
}

.floating-card {
  position: absolute;
  display: grid;
  gap: 6px;
  min-width: 190px;
  padding: 16px 18px;
  border: 1px solid rgba(246, 226, 180, 0.24);
  border-radius: 22px;
  background: rgba(8, 11, 20, 0.72);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.floating-card strong {
  color: #fff8e8;
  font-size: 17px;
}

.card-one {
  left: -28px;
  bottom: 18%;
}

.card-two {
  right: -18px;
  top: 14%;
}

.oracle-gallery {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 18px;
  margin: 22px 0 34px;
}

.gallery-card {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  border: 1px solid rgba(246, 226, 180, 0.16);
  border-radius: 28px;
  background: rgba(255, 248, 231, 0.06);
  box-shadow: 0 22px 64px rgba(0, 0, 0, 0.24);
}

.gallery-card.large {
  grid-row: span 2;
  min-height: 538px;
}

.gallery-card img {
  width: 100%;
  height: 100%;
  min-height: inherit;
  object-fit: cover;
  opacity: 0.92;
  transform: scale(1.01);
  transition: transform 900ms var(--premium-ease), opacity 900ms var(--premium-ease);
}

.gallery-card:hover img {
  transform: scale(1.055);
  opacity: 1;
}

.tool-stage {
  position: relative;
  padding: clamp(18px, 3vw, 34px);
  border: 1px solid rgba(246, 226, 180, 0.18);
  border-radius: 34px;
  background:
    linear-gradient(145deg, rgba(255, 248, 231, 0.11), rgba(255, 248, 231, 0.055)),
    rgba(8, 11, 20, 0.72);
  box-shadow: 0 36px 100px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.tool-stage::before {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: -1;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(158, 214, 208, 0.08), rgba(216, 183, 122, 0.08));
  filter: blur(16px);
}

.tool-heading {
  display: grid;
  gap: 8px;
  max-width: 760px;
  margin-bottom: 22px;
}

.tool-heading h2 {
  margin: 0;
  color: #fff8e8;
  font-size: clamp(32px, 4.2vw, 58px);
  line-height: 1.05;
}

.tool-heading span {
  color: rgba(246, 237, 218, 0.66);
}

.app-tabs {
  position: sticky;
  top: 18px;
  z-index: 20;
  width: min(720px, 100%);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 20px;
  padding: 7px;
  border: 1px solid rgba(246, 226, 180, 0.2);
  border-radius: 999px;
  background: rgba(7, 10, 18, 0.74);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
}

.app-tab {
  min-width: 0;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  color: rgba(246, 237, 218, 0.66);
  font-weight: 700;
  transition: color 520ms var(--premium-ease), background 520ms var(--premium-ease), transform 520ms var(--premium-ease);
}

.app-tab.is-active {
  background: linear-gradient(135deg, #f4e8cf, #d8b77a);
  color: #171420;
  box-shadow: 0 12px 28px rgba(216, 183, 122, 0.18);
}

.app-tab:hover {
  color: #fff8e8;
}

.workspace {
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 22px;
  min-height: auto;
}

.control-panel,
.result-panel,
.plate,
.hex-card,
.notes > div {
  border: 1px solid rgba(128, 98, 56, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.97), rgba(246, 237, 218, 0.95));
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.control-panel {
  top: 92px;
  border-radius: 26px;
  padding: 24px;
}

.result-panel {
  border-radius: 28px;
  padding: 24px;
}

.plate,
.hex-card,
.notes > div {
  border-radius: 22px;
}

.brand-mark {
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 35%, rgba(216, 183, 122, 0.34), transparent 42%),
    #141827;
  color: #f5ddaa;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 14px 28px rgba(0, 0, 0, 0.18);
}

.brand h1,
.plate-head h2,
.hex-card h2 {
  color: #192020;
}

.field input,
.field select,
.segmented {
  border-radius: 15px;
  border-color: rgba(128, 98, 56, 0.24);
  background: rgba(255, 250, 241, 0.92);
}

.segment {
  min-height: 42px;
  transition: color 420ms var(--premium-ease), background 420ms var(--premium-ease);
}

.segment.is-active,
.primary-action {
  background: linear-gradient(135deg, #182433, #2f6658);
  color: #fff8e8;
}

.primary-action,
.icon-action {
  border-radius: 16px;
  transition: transform 520ms var(--premium-ease), box-shadow 520ms var(--premium-ease);
}

.primary-action:hover,
.icon-action:hover {
  transform: translateY(-1px);
}

.summary-band,
.tarot-summary,
.bazi-summary {
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(47, 102, 88, 0.1), rgba(163, 122, 42, 0.08)),
    rgba(255, 250, 241, 0.78);
}

#liuyao-view,
.ziwei-workspace,
.tarot-workspace,
.bazi-workspace {
  position: relative;
}

#liuyao-view::before,
.ziwei-workspace::before,
.tarot-workspace::before,
.bazi-workspace::before {
  content: "";
  position: absolute;
  right: 24px;
  top: 20px;
  z-index: -1;
  width: min(34vw, 420px);
  aspect-ratio: 1.45;
  border-radius: 28px;
  opacity: 0.16;
  background: center / cover no-repeat;
  filter: saturate(1.1);
}

#liuyao-view::before {
  background-image: url("./assets/liuyao-coins.jpg");
}

.ziwei-workspace::before {
  background-image: url("./assets/ziwei-palace.jpg");
}

.tarot-workspace::before {
  background-image: url("./assets/tarot-table.jpg");
}

.bazi-workspace::before {
  background-image: url("./assets/bazi-scroll.jpg");
}

.oracle-footer {
  display: grid;
  gap: 8px;
  max-width: 860px;
  margin: 34px auto 0;
  padding: 24px 28px;
  border: 1px solid rgba(246, 226, 180, 0.18);
  border-radius: 26px;
  background: rgba(255, 248, 231, 0.08);
  color: rgba(246, 237, 218, 0.72);
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.oracle-footer p {
  margin: 0;
}

.oracle-footer a {
  color: rgba(255, 242, 202, 0.78);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 242, 202, 0.28);
}

.oracle-footer a:hover {
  color: #fff6d8;
  border-color: rgba(255, 246, 216, 0.68);
}

@keyframes starDrift {
  from {
    transform: translate3d(0, 0, 0) scale(1.01);
  }
  to {
    transform: translate3d(-12px, 10px, 0) scale(1.045);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-image,
  .gallery-card img,
  .primary-link,
  .ghost-link,
  .app-tab {
    animation: none;
    transition: none;
  }
}

@media (max-width: 1180px) {
  .hero-grid,
  .workspace {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    min-height: 420px;
  }

  .hero-image {
    height: 520px;
  }

  .control-panel {
    position: relative;
    top: auto;
  }

  .oracle-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery-card.large {
    grid-row: auto;
    grid-column: span 2;
    min-height: 420px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 14px 12px 42px;
  }

  .oracle-hero,
  .tool-stage {
    border-radius: 24px;
    padding: 18px;
  }

  .oracle-topbar {
    margin-bottom: 54px;
  }

  .hero-copy h1 {
    max-width: 8em;
    font-size: clamp(42px, 14vw, 68px);
  }

  .hero-actions,
  .app-tabs {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary-link,
  .ghost-link {
    justify-content: center;
    width: 100%;
  }

  .hero-visual {
    min-height: 300px;
  }

  .hero-image {
    height: 340px;
    min-height: 320px;
    border-radius: 22px;
  }

  .floating-card {
    position: static;
    margin-top: 12px;
  }

  .oracle-gallery {
    grid-template-columns: 1fr;
  }

  .gallery-card,
  .gallery-card.large {
    grid-column: auto;
    min-height: 300px;
  }

  .app-tabs {
    position: relative;
    top: auto;
    border-radius: 24px;
  }

  .app-tab {
    min-height: 46px;
  }
}

/* Paper compass concept: selected direction B */
body.paper-oracle {
  --paper-ink: #211d17;
  --paper-muted: rgba(33, 29, 23, 0.66);
  --paper-line: rgba(92, 69, 39, 0.18);
  --paper-red: #9b2f1f;
  --paper-green: #1e2c28;
  --paper-gold: #d7b875;
  --paper-surface: rgba(255, 253, 247, 0.9);
  --paper-surface-strong: rgba(255, 253, 247, 0.96);
  background:
    radial-gradient(circle at 8% 20%, rgba(155, 47, 31, 0.1), transparent 18rem),
    radial-gradient(circle at 90% 12%, rgba(84, 128, 111, 0.12), transparent 24rem),
    linear-gradient(180deg, #f7f0e2, #e9dcc4);
  color: var(--paper-ink);
}

body.paper-oracle::before {
  background:
    linear-gradient(rgba(92, 69, 39, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 69, 39, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.72;
  mix-blend-mode: normal;
  mask-image: linear-gradient(180deg, #000, transparent 82%);
}

body.paper-oracle::after {
  background:
    radial-gradient(circle at 68% 38%, rgba(255, 253, 247, 0.5), transparent 28rem),
    linear-gradient(180deg, rgba(255, 251, 242, 0.2), rgba(208, 190, 155, 0.2));
}

.paper-oracle .app-shell {
  width: min(1540px, 100%);
}

.paper-oracle .oracle-hero {
  min-height: min(820px, calc(100vh - 56px));
  border-color: var(--paper-line);
  background:
    radial-gradient(circle at 66% 44%, rgba(255, 255, 255, 0.5), transparent 24rem),
    linear-gradient(135deg, rgba(255, 253, 247, 0.86), rgba(231, 216, 188, 0.42));
  color: var(--paper-ink);
  box-shadow: 0 34px 96px rgba(92, 69, 39, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.paper-oracle .oracle-hero::after {
  inset: auto -12% -24% 42%;
  height: 440px;
  background: radial-gradient(circle, rgba(155, 47, 31, 0.08), transparent 58%);
}

.paper-oracle .oracle-topbar,
.paper-oracle .hero-lead,
.paper-oracle .hero-disclaimer,
.paper-oracle .tool-heading span,
.paper-oracle .oracle-footer {
  color: var(--paper-muted);
}

.paper-oracle .back-home {
  border-color: var(--paper-line);
  background: rgba(255, 255, 255, 0.46);
  color: var(--paper-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 12px 28px rgba(92, 69, 39, 0.08);
}

.paper-oracle .hero-kicker,
.paper-oracle .tool-heading p,
.paper-oracle .gallery-card span,
.paper-oracle .oracle-footer strong {
  color: var(--paper-red);
}

.paper-oracle .hero-copy h1 {
  max-width: 5em;
  color: var(--paper-ink);
  font-size: clamp(72px, 9.4vw, 126px);
  line-height: 0.94;
  text-shadow: none;
}

.paper-oracle .hero-lead {
  max-width: 620px;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: clamp(16px, 1.22vw, 19px);
}

.paper-oracle .primary-link {
  background: var(--paper-green);
  color: #fff4df;
  box-shadow: 0 18px 38px rgba(30, 44, 40, 0.22);
}

.paper-oracle .primary-link span {
  background: rgba(255, 255, 255, 0.16);
}

.paper-oracle .ghost-link {
  border-color: var(--paper-line);
  background: rgba(255, 255, 255, 0.5);
  color: var(--paper-ink);
}

.paper-visual {
  display: grid;
  place-items: center;
  min-height: 620px;
}

.paper-compass {
  position: relative;
  width: min(48vw, 660px);
  min-width: 520px;
  aspect-ratio: 1;
  border: 1px solid rgba(92, 69, 39, 0.18);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.58), transparent 28%),
    conic-gradient(from -20deg, rgba(150, 108, 54, 0.12), rgba(255, 255, 255, 0.22), rgba(30, 44, 40, 0.1), rgba(155, 47, 31, 0.08), rgba(150, 108, 54, 0.12));
  box-shadow: 0 40px 120px rgba(92, 69, 39, 0.16);
}

.compass-ring {
  position: absolute;
  border: 1px solid rgba(130, 91, 43, 0.25);
  border-radius: 50%;
}

.ring-one { inset: 42px; }
.ring-two { inset: 106px; }
.ring-three { inset: 172px; }
.ring-four { inset: 248px; }

.paper-compass .trigram {
  position: absolute;
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(92, 69, 39, 0.15);
  border-radius: 50%;
  background: rgba(255, 251, 241, 0.9);
  color: #132420;
  font-size: 34px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 18px 38px rgba(92, 69, 39, 0.1);
}

.t-qian { left: calc(50% - 43px); top: 28px; }
.t-dui { right: 92px; top: 96px; }
.t-li { right: 28px; top: calc(50% - 43px); }
.t-zhen { right: 92px; bottom: 96px; }
.t-xun { left: calc(50% - 43px); bottom: 28px; }
.t-kan { left: 92px; bottom: 96px; }
.t-gen { left: 28px; top: calc(50% - 43px); }
.t-kun { left: 92px; top: 96px; }

.taiji {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 180px;
  height: 180px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--paper-green);
  color: #f7dfab;
  font-size: 72px;
  box-shadow: 0 28px 72px rgba(30, 44, 40, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.paper-seal {
  position: absolute;
  left: 2%;
  bottom: 12%;
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  background: var(--paper-red);
  color: #f8ead0;
  font-size: 42px;
  font-weight: 800;
  box-shadow: 0 18px 34px rgba(155, 47, 31, 0.24);
}

.paper-oracle .oracle-gallery {
  grid-template-columns: 1.25fr repeat(2, 1fr);
}

.paper-oracle .gallery-card {
  border-color: var(--paper-line);
  background: rgba(255, 253, 247, 0.66);
  box-shadow: 0 24px 70px rgba(92, 69, 39, 0.13);
}

.paper-oracle .gallery-card img {
  filter: saturate(0.96) contrast(1.02);
  opacity: 0.96;
}

.paper-oracle .tool-stage {
  border-color: var(--paper-line);
  background:
    linear-gradient(145deg, rgba(255, 253, 247, 0.78), rgba(231, 216, 188, 0.46));
  box-shadow: 0 36px 100px rgba(92, 69, 39, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.paper-oracle .tool-stage::before {
  background: linear-gradient(135deg, rgba(155, 47, 31, 0.06), rgba(30, 44, 40, 0.08));
}

.paper-oracle .tool-heading h2 {
  color: var(--paper-ink);
}

.paper-oracle .app-tabs {
  border-color: var(--paper-line);
  background: rgba(255, 253, 247, 0.72);
  box-shadow: 0 18px 48px rgba(92, 69, 39, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.paper-oracle .app-tab {
  color: rgba(33, 29, 23, 0.58);
}

.paper-oracle .app-tab.is-active {
  background: var(--paper-green);
  color: #fff4df;
  box-shadow: 0 12px 28px rgba(30, 44, 40, 0.16);
}

.paper-oracle .app-tab:hover {
  color: var(--paper-ink);
}

.paper-oracle .control-panel,
.paper-oracle .result-panel,
.paper-oracle .plate,
.paper-oracle .hex-card,
.paper-oracle .notes > div {
  border-color: rgba(92, 69, 39, 0.17);
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.96), rgba(246, 237, 218, 0.92));
  box-shadow: 0 22px 58px rgba(92, 69, 39, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.paper-oracle .brand-mark,
.paper-oracle .segment.is-active,
.paper-oracle .primary-action {
  background: var(--paper-green);
  color: #fff4df;
}

.paper-oracle .brand-mark {
  border-radius: 50%;
}

.paper-oracle .oracle-footer {
  border-color: var(--paper-line);
  background: rgba(255, 253, 247, 0.58);
}

@media (max-width: 1180px) {
  .paper-visual {
    min-height: 580px;
  }

  .paper-compass {
    width: min(78vw, 620px);
    min-width: 0;
  }
}

@media (max-width: 760px) {
  .paper-oracle .hero-copy h1 {
    max-width: 5.4em;
    font-size: clamp(58px, 18vw, 82px);
  }

  .paper-visual {
    min-height: 520px;
  }

  .paper-compass {
    width: min(92vw, 390px);
  }

  .paper-compass .trigram {
    width: 54px;
    height: 54px;
    font-size: 22px;
  }

  .ring-one { inset: 24px; }
  .ring-two { inset: 64px; }
  .ring-three { inset: 104px; }
  .ring-four { inset: 146px; }
  .t-qian { left: calc(50% - 27px); top: 10px; }
  .t-dui { right: 48px; top: 50px; }
  .t-li { right: 10px; top: calc(50% - 27px); }
  .t-zhen { right: 48px; bottom: 50px; }
  .t-xun { left: calc(50% - 27px); bottom: 10px; }
  .t-kan { left: 48px; bottom: 50px; }
  .t-gen { left: 10px; top: calc(50% - 27px); }
  .t-kun { left: 48px; top: 50px; }

  .taiji {
    width: 112px;
    height: 112px;
    font-size: 48px;
  }

  .paper-seal {
    left: 0;
    bottom: 170px;
    width: 74px;
    height: 74px;
    font-size: 30px;
  }

}

/* Cosmic bagua background for the paipan tool */
body.paper-oracle {
  background:
    radial-gradient(circle at 62% 26%, rgba(140, 96, 255, 0.26), transparent 34rem),
    radial-gradient(circle at 24% 62%, rgba(49, 191, 221, 0.16), transparent 30rem),
    linear-gradient(135deg, #030711 0%, #071326 48%, #160a25 100%);
}

body.paper-oracle::before {
  background:
    radial-gradient(circle, rgba(255, 240, 196, 0.7) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(142, 231, 255, 0.3) 0 1px, transparent 1.5px);
  background-position: 0 0, 54px 78px;
  background-size: 124px 124px, 196px 196px;
  opacity: 0.58;
  mix-blend-mode: screen;
  mask-image: linear-gradient(180deg, #000, rgba(0, 0, 0, 0.74) 56%, transparent);
  animation: toolStarFieldDrift 36s linear infinite;
}

body.paper-oracle::after {
  background:
    radial-gradient(circle at 68% 36%, rgba(255, 221, 156, 0.14), transparent 22rem),
    radial-gradient(circle at 48% 42%, rgba(134, 88, 226, 0.16), transparent 34rem),
    linear-gradient(180deg, rgba(4, 7, 16, 0.12), rgba(4, 7, 16, 0.72));
}

.paper-oracle .app-shell {
  position: relative;
  isolation: isolate;
}

.tool-cosmic-bagua {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.tool-cosmic-bagua::before {
  content: "";
  position: absolute;
  right: -24vw;
  top: 38%;
  width: min(92vw, 1160px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 226, 158, 0.15), transparent 18%),
    radial-gradient(circle, rgba(91, 210, 232, 0.11), transparent 46%),
    radial-gradient(circle, rgba(142, 94, 255, 0.18), transparent 68%);
  filter: blur(30px);
  opacity: 0.86;
}

.tool-bagua-disc {
  position: absolute;
  right: clamp(-500px, -24vw, -260px);
  top: 40%;
  width: min(92vw, 1060px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 230, 172, 0.18);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 236, 182, 0.13) 0 10%, transparent 11%),
    conic-gradient(from 12deg, rgba(255, 236, 182, 0.1), rgba(97, 214, 229, 0.12), rgba(142, 100, 255, 0.14), rgba(255, 169, 111, 0.1), rgba(255, 236, 182, 0.1));
  box-shadow:
    0 0 74px rgba(132, 103, 255, 0.2),
    inset 0 0 60px rgba(255, 238, 192, 0.08);
  opacity: 0.66;
  animation: toolBaguaSpin 118s linear infinite;
}

.tool-bagua-disc::before,
.tool-bagua-disc::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.tool-bagua-disc::before {
  background:
    repeating-conic-gradient(from 0deg, rgba(255, 235, 184, 0.16) 0 1deg, transparent 1deg 22.5deg),
    repeating-conic-gradient(from 11.25deg, transparent 0 20deg, rgba(147, 230, 255, 0.08) 20deg 22.5deg);
  mask-image: radial-gradient(circle, transparent 0 22%, #000 23% 78%, transparent 79%);
}

.tool-bagua-disc::after {
  inset: 10%;
  border: 1px solid rgba(255, 229, 171, 0.18);
  box-shadow:
    inset 0 0 0 8vw rgba(255, 255, 255, 0.012),
    inset 0 0 0 13vw rgba(97, 214, 229, 0.022),
    inset 0 0 0 18vw rgba(255, 229, 171, 0.026);
}

.tool-bagua-ring {
  position: absolute;
  border: 1px solid rgba(255, 231, 172, 0.2);
  border-radius: 50%;
}

.tool-bagua-ring-one { inset: 9%; }
.tool-bagua-ring-two { inset: 22%; }
.tool-bagua-ring-three { inset: 35%; }

.tool-bagua-trigram {
  position: absolute;
  width: clamp(52px, 6vw, 88px);
  height: clamp(52px, 6vw, 88px);
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 229, 171, 0.2);
  border-radius: 50%;
  color: rgba(255, 241, 202, 0.9);
  background: rgba(7, 13, 27, 0.44);
  font-size: clamp(27px, 3.5vw, 50px);
  font-weight: 800;
  box-shadow: 0 0 24px rgba(255, 226, 158, 0.1);
}

.tool-bagua-qian { left: calc(50% - clamp(26px, 3vw, 44px)); top: 5.6%; }
.tool-bagua-dui { right: 17%; top: 17%; }
.tool-bagua-li { right: 5.6%; top: calc(50% - clamp(26px, 3vw, 44px)); }
.tool-bagua-zhen { right: 17%; bottom: 17%; }
.tool-bagua-xun { left: calc(50% - clamp(26px, 3vw, 44px)); bottom: 5.6%; }
.tool-bagua-kan { left: 17%; bottom: 17%; }
.tool-bagua-gen { left: 5.6%; top: calc(50% - clamp(26px, 3vw, 44px)); }
.tool-bagua-kun { left: 17%; top: 17%; }

.tool-bagua-yinyang {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(112px, 14vw, 188px);
  height: clamp(112px, 14vw, 188px);
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 226, 160, 0.22);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  color: #ffe7ad;
  background: rgba(5, 10, 22, 0.76);
  font-size: clamp(52px, 7vw, 92px);
  box-shadow: 0 0 68px rgba(255, 215, 139, 0.18);
}

.paper-oracle .oracle-hero,
.paper-oracle .oracle-gallery,
.paper-oracle .tool-stage,
.paper-oracle .oracle-footer {
  position: relative;
  z-index: 1;
}

.paper-oracle .oracle-hero {
  border-color: rgba(255, 229, 171, 0.18);
  background:
    radial-gradient(circle at 68% 44%, rgba(255, 226, 158, 0.12), transparent 24rem),
    linear-gradient(135deg, rgba(8, 16, 32, 0.76), rgba(14, 12, 28, 0.62));
  color: #fff4dc;
  box-shadow: 0 34px 96px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
}

.paper-oracle .oracle-topbar,
.paper-oracle .hero-lead,
.paper-oracle .hero-disclaimer,
.paper-oracle .tool-heading span,
.paper-oracle .oracle-footer {
  color: rgba(255, 246, 225, 0.76);
}

.paper-oracle .back-home,
.paper-oracle .ghost-link {
  border-color: rgba(255, 229, 171, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff4dc;
}

.paper-oracle .hero-kicker,
.paper-oracle .tool-heading p,
.paper-oracle .gallery-card span,
.paper-oracle .oracle-footer strong {
  color: #ffe0a0;
}

.paper-oracle .hero-copy h1 {
  color: #fff4dc;
  text-shadow: 0 0 28px rgba(255, 215, 139, 0.2), 0 22px 58px rgba(0, 0, 0, 0.42);
}

.paper-oracle .hero-copy,
.paper-oracle .hero-lead,
.paper-oracle .hero-disclaimer {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.paper-oracle .primary-link {
  background: linear-gradient(135deg, #ffe0a0, #72d4e6);
  color: #06101a;
}

.paper-oracle .paper-compass {
  border-color: rgba(255, 229, 171, 0.18);
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 229, 171, 0.14), transparent 26%),
    conic-gradient(from -20deg, rgba(255, 229, 171, 0.14), rgba(98, 214, 235, 0.13), rgba(151, 103, 255, 0.12), rgba(255, 229, 171, 0.14));
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.24);
}

.paper-oracle .compass-ring {
  border-color: rgba(255, 229, 171, 0.22);
}

.paper-oracle .paper-compass .trigram {
  border-color: rgba(255, 229, 171, 0.18);
  color: #ffe5ab;
  background: rgba(5, 10, 22, 0.62);
}

.paper-oracle .taiji {
  color: #ffe5ab;
  background: rgba(5, 10, 22, 0.86);
  box-shadow: 0 0 52px rgba(255, 215, 139, 0.2);
}

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

@keyframes toolStarFieldDrift {
  from {
    background-position: 0 0, 54px 78px;
  }
  to {
    background-position: 124px 124px, 250px 274px;
  }
}

@media (max-width: 900px) {
  .tool-bagua-disc {
    right: -64vw;
    width: 150vw;
    opacity: 0.42;
  }
}

@media (max-width: 760px) {
  .paper-oracle .hero-grid,
  .paper-oracle .hero-copy {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .paper-oracle .hero-lead {
    width: min(100%, calc(100vw - 72px));
    max-width: calc(100vw - 72px);
    font-size: 16px;
    line-height: 1.82;
  }

  .paper-oracle .hero-actions {
    width: min(100%, calc(100vw - 72px));
    max-width: calc(100vw - 72px);
  }

  .paper-oracle .hero-disclaimer {
    max-width: calc(100vw - 72px);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.paper-oracle::before,
  .tool-bagua-disc {
    animation: none;
  }
}
