:root {
  color-scheme: dark;
  --bg: #02080d;
  --panel: rgba(6, 25, 36, 0.78);
  --line: rgba(116, 255, 226, 0.22);
  --text: #f2fbff;
  --muted: #8db8c2;
  --cyan: #27f1d0;
  --blue: #35a7ff;
  --gold: #ffd36b;
  --red: #ff5f7e;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

button {
  font: inherit;
}

.app-shell {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  padding: 28px clamp(18px, 4vw, 56px) 44px;
  background:
    linear-gradient(120deg, rgba(15, 74, 91, 0.18), transparent 45%),
    radial-gradient(circle at 80% 18%, rgba(39, 241, 208, 0.18), transparent 32%),
    radial-gradient(circle at 55% 85%, rgba(53, 167, 255, 0.14), transparent 35%),
    #02080d;
}

.app-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(116, 255, 226, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(116, 255, 226, 0.1) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(circle at center, black, transparent 76%);
}

.particle-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.topbar,
.workspace,
.result-panel {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 52px;
}

.brand-logo {
  width: 220px;
  height: 48px;
  object-fit: contain;
}

.system-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.system-status i {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--cyan);
  box-shadow: 0 0 18px var(--cyan);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.86fr) minmax(420px, 1.14fr);
  align-items: center;
  gap: clamp(26px, 5vw, 80px);
  min-height: calc(100svh - 124px);
}

.briefing {
  max-width: 620px;
}

.eyebrow,
.section-label {
  margin: 0 0 12px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(58px, 9vw, 124px);
  line-height: 0.92;
  font-weight: 900;
}

.subtitle {
  margin: 16px 0 0;
  color: var(--gold);
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 800;
}

.lead {
  margin: 22px 0 28px;
  max-width: 560px;
  color: #b9d3da;
  font-size: 16px;
  line-height: 1.8;
}

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

.custom-query {
  display: block;
  margin-top: 16px;
}

.custom-query span {
  display: block;
  margin-bottom: 8px;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 800;
}

.custom-query textarea {
  width: 100%;
  resize: vertical;
  min-height: 82px;
  border: 1px solid rgba(116, 255, 226, 0.24);
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--text);
  background: rgba(3, 15, 22, 0.72);
  outline: none;
  line-height: 1.6;
  box-shadow: inset 0 0 26px rgba(39, 241, 208, 0.06);
}

.custom-query textarea:focus {
  border-color: rgba(39, 241, 208, 0.78);
  box-shadow: 0 0 0 3px rgba(39, 241, 208, 0.12), inset 0 0 26px rgba(39, 241, 208, 0.08);
}

.ai-config {
  margin-top: 14px;
  border: 1px solid rgba(116, 255, 226, 0.2);
  border-radius: 8px;
  background: rgba(3, 15, 22, 0.56);
}

.ai-config summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 14px;
  cursor: pointer;
  list-style: none;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 800;
}

.ai-config summary::-webkit-details-marker {
  display: none;
}

.ai-config summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.ai-config.is-ready summary small {
  color: var(--gold);
}

.ai-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 14px 12px;
}

.ai-config label {
  display: grid;
  gap: 6px;
}

.ai-config label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.ai-config input,
.ai-config select {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(116, 255, 226, 0.24);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  background: rgba(2, 10, 16, 0.88);
  outline: none;
}

.ai-config input:focus,
.ai-config select:focus {
  border-color: rgba(39, 241, 208, 0.78);
  box-shadow: 0 0 0 3px rgba(39, 241, 208, 0.12);
}

.ai-key-field {
  grid-column: 1 / -1;
}

.ai-config-actions {
  display: flex;
  gap: 10px;
  padding: 0 14px 12px;
}

.ai-config-note {
  margin: 0;
  padding: 0 14px 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.topic,
.primary-action,
.secondary-action,
.ghost-action {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(5, 20, 30, 0.72);
  border-radius: 8px;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.topic {
  min-height: 76px;
  padding: 14px;
  text-align: left;
}

.topic span {
  display: block;
  font-weight: 800;
}

.topic small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.topic:hover,
.topic.is-active {
  transform: translateY(-2px);
  border-color: rgba(39, 241, 208, 0.74);
  background: rgba(13, 63, 75, 0.86);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.primary-action,
.secondary-action,
.ghost-action {
  min-height: 48px;
  padding: 0 20px;
  font-weight: 800;
}

.primary-action {
  background: linear-gradient(135deg, #16d4bd, #2b8fff);
  color: #031019;
  border-color: transparent;
}

.secondary-action {
  background: rgba(39, 241, 208, 0.12);
}

.ghost-action {
  background: transparent;
  color: var(--muted);
}

.small {
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
}

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

.primary-action:disabled,
.secondary-action:disabled,
.ghost-action:disabled {
  cursor: wait;
  opacity: 0.58;
  transform: none;
}

.compass-panel {
  display: grid;
  justify-items: center;
  gap: 20px;
}

.compass {
  position: relative;
  width: min(78vw, 620px);
  aspect-ratio: 1;
  --orbit-a: -255px;
  --orbit-b: -198px;
  --orbit-c: -138px;
  --branch-radius: -292px;
  --mountain-radius: -226px;
  --hex-name-radius: -164px;
  --bagua-radius: -116px;
  --tick-radius: -154px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(7, 28, 40, 0.98), rgba(1, 8, 14, 0.94) 72%, rgba(1, 8, 14, 0.42) 73%);
  box-shadow:
    0 0 130px rgba(39, 178, 255, 0.28),
    0 0 44px rgba(39, 241, 208, 0.18),
    inset 0 0 90px rgba(53, 167, 255, 0.18);
  contain: layout paint style;
  isolation: isolate;
  overflow: hidden;
}

.luopan-photo,
.luopan-energy,
.luopan-sheen,
.luopan-shell,
.luopan-ring,
.compass-ring,
.compass-map,
.compass-grid-bg,
.scan-sector,
.orbit,
.taiji-orb,
.line-stack,
.yao {
  will-change: transform, opacity;
  backface-visibility: hidden;
  transform-style: preserve-3d;
}

.luopan-photo,
.luopan-energy,
.luopan-sheen {
  position: absolute;
  inset: -3%;
  border-radius: 50%;
  pointer-events: none;
}

.luopan-photo {
  z-index: 0;
  background:
    radial-gradient(circle, transparent 0 61%, rgba(6, 18, 26, 0.08) 69%, rgba(1, 8, 14, 0.76) 100%),
    url("assets/luopan-reference.jpg") center / cover no-repeat;
  opacity: 0.88;
  transform: translateZ(0) scale(1.02);
  animation: none;
}

.luopan-energy {
  inset: 1%;
  z-index: 1;
  border: 2px solid rgba(62, 211, 255, 0.82);
  background:
    radial-gradient(circle, transparent 64%, rgba(39, 178, 255, 0.2) 65%, transparent 68%),
    conic-gradient(from 0deg, transparent 0 18deg, rgba(39, 241, 208, 0.24) 20deg 24deg, transparent 27deg 70deg, rgba(53, 167, 255, 0.2) 73deg 76deg, transparent 80deg);
  box-shadow:
    0 0 24px rgba(39, 178, 255, 0.82),
    inset 0 0 30px rgba(39, 241, 208, 0.2);
  opacity: 0.72;
  animation: rotateSlow 42s linear infinite;
}

.luopan-sheen {
  inset: 0;
  z-index: 2;
  background:
    conic-gradient(from 20deg, transparent 0 42deg, rgba(116, 255, 226, 0.18) 49deg, transparent 58deg 150deg, rgba(255, 255, 255, 0.08) 160deg, transparent 172deg),
    radial-gradient(circle at 50% 50%, rgba(255, 95, 126, 0.18) 0 14%, transparent 32%),
    radial-gradient(circle, transparent 0 72%, rgba(39, 178, 255, 0.22) 73%, transparent 77%);
  mix-blend-mode: screen;
  opacity: 0.58;
  animation: rotateReverse 30s linear infinite;
}

.compass::before,
.compass::after,
.compass-ring {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.compass::before {
  z-index: 3;
  border: 1px solid rgba(116, 255, 226, 0.34);
  transform: scale(0.84);
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(116, 255, 226, 0.24) 50%, transparent 50.2%),
    linear-gradient(0deg, transparent 49.8%, rgba(116, 255, 226, 0.24) 50%, transparent 50.2%);
}

.compass::after {
  z-index: 3;
  border: 1px dashed rgba(255, 211, 107, 0.36);
  transform: scale(0.64);
}

.luopan-shell {
  position: absolute;
  inset: -2.5%;
  border-radius: 50%;
  z-index: 3;
  border: 1px solid rgba(255, 211, 107, 0.28);
  background:
    repeating-conic-gradient(from 0deg, rgba(255, 211, 107, 0.18) 0deg 1.4deg, rgba(255, 211, 107, 0.04) 1.4deg 7.5deg, transparent 7.5deg 15deg),
    radial-gradient(circle, transparent 71%, rgba(255, 211, 107, 0.14) 72%, transparent 73%);
  box-shadow: inset 0 0 36px rgba(255, 211, 107, 0.08);
  opacity: 0.42;
  animation: rotateSlow 96s linear infinite;
}

.luopan-cardinal {
  position: absolute;
  inset: -9%;
  z-index: 31;
  border-radius: 50%;
  pointer-events: none;
}

.luopan-cardinal b {
  position: absolute;
  padding: 7px 12px;
  border: 1px solid rgba(116, 255, 226, 0.32);
  border-radius: 999px;
  color: #dffbf7;
  background: rgba(2, 12, 18, 0.68);
  font-size: 12px;
  letter-spacing: 0.08em;
  box-shadow: 0 0 20px rgba(39, 241, 208, 0.12);
}

.luopan-cardinal b:nth-child(1) {
  left: 50%;
  top: 0;
  transform: translateX(-50%);
}

.luopan-cardinal b:nth-child(2) {
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.luopan-cardinal b:nth-child(3) {
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
}

.luopan-cardinal b:nth-child(4) {
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

.luopan-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

.ring-branch {
  inset: 0;
  z-index: 4;
  border: 1px solid rgba(255, 211, 107, 0.38);
  background:
    radial-gradient(circle, transparent 88%, rgba(255, 211, 107, 0.15) 89%, transparent 91%),
    radial-gradient(circle, transparent 78%, rgba(255, 211, 107, 0.08) 79%, transparent 80%);
  opacity: 0.56;
  animation: rotateSlow 140s linear infinite;
}

.ring-mountain {
  inset: 0;
  z-index: 5;
  border: 1px solid rgba(116, 255, 226, 0.34);
  background: radial-gradient(circle, transparent 71%, rgba(116, 255, 226, 0.1) 72%, transparent 74%);
  opacity: 0.52;
  animation: rotateReverse 88s linear infinite;
}

.ring-hex-name {
  inset: 0;
  z-index: 6;
  border: 1px solid rgba(53, 167, 255, 0.36);
  background: radial-gradient(circle, transparent 54%, rgba(53, 167, 255, 0.1) 55%, transparent 57%);
  opacity: 0.44;
  animation: rotateSlow 82s linear infinite;
}

.branch-mark,
.mountain-mark,
.hex-name-mark {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: 0 0;
  display: grid;
  place-items: center;
  color: rgba(241, 255, 252, 0.76);
  text-shadow: 0 0 10px rgba(39, 241, 208, 0.58);
}

.branch-mark {
  width: 36px;
  height: 36px;
  margin: -18px;
  color: var(--gold);
  font-size: 18px;
  font-weight: 900;
  background: rgba(2, 12, 18, 0.46);
  border: 1px solid rgba(255, 211, 107, 0.24);
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(255, 211, 107, 0.12);
}

.mountain-mark {
  width: 34px;
  height: 34px;
  margin: -17px;
  border: 1px solid rgba(116, 255, 226, 0.2);
  border-radius: 50%;
  background: rgba(3, 20, 27, 0.42);
  font-size: 15px;
  font-weight: 800;
  color: rgba(116, 255, 226, 0.96);
  box-shadow: 0 0 10px rgba(39, 241, 208, 0.08);
}

.hex-name-mark {
  width: 44px;
  height: 24px;
  margin: -12px -22px;
  border-radius: 6px;
  background: rgba(4, 26, 36, 0.38);
  font-size: 12px;
  font-weight: 800;
  color: rgba(199, 229, 237, 0.9);
}

.hex-name-mark.is-current {
  color: var(--red);
  font-weight: 900;
  text-shadow: 0 0 14px rgba(255, 95, 126, 0.96);
}

.compass-map,
.compass-grid-bg {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

.compass-map {
  inset: 10%;
  z-index: 7;
  border: 1px solid rgba(255, 211, 107, 0.24);
  background:
    repeating-conic-gradient(from 22.5deg, transparent 0deg 43deg, rgba(255, 211, 107, 0.18) 44deg 45deg),
    radial-gradient(circle, transparent 57%, rgba(255, 211, 107, 0.08) 58%, transparent 60%);
  opacity: 0.34;
  animation: rotateReverse 72s linear infinite;
  box-shadow: inset 0 0 36px rgba(255, 211, 107, 0.08);
}

.compass-grid-bg {
  inset: 30%;
  opacity: 0.24;
  background:
    repeating-conic-gradient(from 0deg, transparent 0deg 14deg, rgba(53, 167, 255, 0.22) 14deg 15deg),
    repeating-radial-gradient(circle, transparent 0 20px, rgba(116, 255, 226, 0.08) 21px 22px),
    radial-gradient(circle, transparent 34%, rgba(116, 255, 226, 0.12) 35%, transparent 36%, transparent 57%, rgba(116, 255, 226, 0.12) 58%, transparent 59%);
  animation: rotateSlow 54s linear infinite;
}

.map-label {
  position: absolute;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 211, 107, 0.36);
  border-radius: 50%;
  color: var(--gold);
  background: rgba(3, 15, 22, 0.74);
  font-size: 28px;
  font-weight: 900;
  text-shadow: 0 0 18px rgba(255, 211, 107, 0.74);
}

.map-label.north {
  left: 50%;
  top: 4%;
  transform: translateX(-50%);
}

.map-label.east {
  right: 4%;
  top: 50%;
  transform: translateY(-50%);
}

.map-label.south {
  left: 50%;
  bottom: 4%;
  transform: translateX(-50%);
}

.map-label.west {
  left: 4%;
  top: 50%;
  transform: translateY(-50%);
}

.ring-outer {
  inset: 0;
  z-index: 12;
  border: 1px solid rgba(116, 255, 226, 0.42);
  background:
    radial-gradient(circle, transparent 72%, rgba(39, 241, 208, 0.12) 73%, transparent 75%),
    repeating-conic-gradient(from 0deg, transparent 0deg 42deg, rgba(39, 241, 208, 0.28) 42deg 45deg);
  opacity: 0.42;
  animation: rotateSlow 48s linear infinite;
  box-shadow: inset 0 0 28px rgba(39, 241, 208, 0.08);
}

.ring-middle {
  inset: 0;
  z-index: 11;
  border: 1px solid rgba(53, 167, 255, 0.38);
  background: repeating-conic-gradient(from 0deg, rgba(53, 167, 255, 0.08) 0deg 1deg, transparent 1deg 11.25deg);
  opacity: 0.5;
  animation: rotateReverse 26s linear infinite;
}

.bagua-mark,
.tick-mark {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: 0 0;
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(39, 241, 208, 0.9);
}

.bagua-mark {
  display: grid;
  place-items: center;
  width: clamp(54px, 6vw, 74px);
  height: clamp(54px, 6vw, 74px);
  margin: calc(clamp(54px, 6vw, 74px) / -2);
  border: 1px solid rgba(116, 255, 226, 0.52);
  border-radius: 999px;
  background: rgba(2, 12, 18, 0.62);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 900;
  box-shadow: 0 0 18px rgba(39, 241, 208, 0.18);
}

.tick-mark {
  width: 2px;
  height: 14px;
  background: rgba(255, 211, 107, 0.55);
  box-shadow: 0 0 10px rgba(255, 211, 107, 0.5);
}

.tick-mark.is-current {
  height: 28px;
  background: var(--red);
}

.scan-sector {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background:
    conic-gradient(from 40deg, rgba(39, 241, 208, 0.42), rgba(53, 167, 255, 0.16) 10%, transparent 28%, transparent),
    radial-gradient(circle, transparent 42%, rgba(39, 241, 208, 0.12) 43%, transparent 44%);
  z-index: 10;
  opacity: 0.38;
  animation: rotateSlow 6s linear infinite;
}

.orbit-field {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 11;
}

.orbit {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 22px rgba(39, 241, 208, 0.95);
  transform-origin: 0 0;
}

.orbit-a {
  animation: orbitA 7s linear infinite;
}

.orbit-b {
  background: var(--gold);
  box-shadow: 0 0 22px rgba(255, 211, 107, 0.92);
  animation: orbitB 10s linear infinite;
}

.orbit-c {
  background: var(--red);
  box-shadow: 0 0 22px rgba(255, 95, 126, 0.92);
  animation: orbitC 13s linear infinite;
}

.compass-core {
  position: absolute;
  inset: 32%;
  z-index: 24;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  border: 1px solid rgba(116, 255, 226, 0.24);
  background:
    radial-gradient(circle at 50% 50%, rgba(2, 12, 18, 0.18) 0 30%, rgba(2, 12, 18, 0.72) 63%, rgba(2, 12, 18, 0.82) 100%);
  box-shadow: inset 0 0 34px rgba(39, 241, 208, 0.1), 0 0 30px rgba(39, 241, 208, 0.08);
  text-align: center;
  overflow: visible;
  pointer-events: none;
}

.taiji-orb {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(42%, 108px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: 0;
  opacity: 0;
  background: linear-gradient(90deg, rgba(242, 246, 246, 0.94) 0 50%, rgba(4, 13, 16, 0.96) 50% 100%);
  box-shadow:
    0 0 0 1px rgba(242, 246, 246, 0.22),
    0 0 16px rgba(39, 241, 208, 0.06);
  animation: none;
}

.taiji-orb::before,
.taiji-orb::after {
  content: "";
  position: absolute;
  left: 25%;
  width: 50%;
  height: 50%;
  border-radius: 50%;
}

.taiji-orb::before {
  top: 0;
  background: rgba(4, 13, 16, 0.96);
  box-shadow:
    inset 0 0 0 8px rgba(242, 246, 246, 0.94);
}

.taiji-orb::after {
  bottom: 0;
  background: rgba(242, 246, 246, 0.94);
  box-shadow:
    inset 0 0 0 8px rgba(4, 13, 16, 0.96);
}

.line-stack {
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  width: 60%;
  min-height: 118px;
  justify-content: center;
  margin-bottom: 12px;
  position: relative;
  z-index: 8;
}

.yao {
  height: 10px;
  border-radius: 99px;
  background: var(--gold);
  box-shadow: 0 0 12px rgba(255, 211, 107, 0.42);
  position: relative;
  transform-origin: center;
  opacity: 1;
}

.yao::before,
.yao::after {
  content: "";
  position: absolute;
  inset: -8px -12px;
  border-radius: 999px;
  pointer-events: none;
}

.yao::before {
  background: linear-gradient(90deg, transparent, rgba(255, 211, 107, 0.32), transparent);
}

.yao::after {
  border: 1px solid rgba(255, 211, 107, 0.2);
  opacity: 0;
}

.yao.yin {
  background: linear-gradient(90deg, var(--gold) 0 42%, transparent 42% 58%, var(--gold) 58%);
}

.yao.moving {
  box-shadow: 0 0 14px rgba(255, 95, 126, 0.72);
}

.yao.pending {
  opacity: 0;
  transform: translate3d(0, -24px, 0) scaleX(0.22);
}

.yao.pending::before,
.yao.pending::after {
  opacity: 0;
}

.yao.is-entering {
  animation: lineDrop 1050ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.yao.is-entering::before {
  animation: lineSweep 1050ms ease both;
}

.yao.is-entering::after {
  animation: lineRipple 1050ms ease both;
}

.compass-core strong {
  position: relative;
  z-index: 7;
  font-size: clamp(20px, 3vw, 34px);
}

.compass-core span {
  position: relative;
  z-index: 7;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.hex-name-strip {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: -4px;
}

.hex-name-strip span {
  padding: 9px 14px;
  border: 1px solid rgba(255, 211, 107, 0.36);
  border-radius: 999px;
  color: var(--gold);
  background: rgba(3, 15, 22, 0.82);
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 0 18px rgba(255, 211, 107, 0.12);
}

.compass.casting {
  animation: none;
}

.compass.casting .scan-sector {
  opacity: 0.88;
  animation-duration: 2.4s;
}

.compass.casting .taiji-orb {
  opacity: 0;
  animation-duration: 12s;
}

.compass.casting .luopan-photo {
  opacity: 0.9;
}

.compass.casting .luopan-energy {
  opacity: 0.9;
  animation-duration: 18s;
}

.compass.casting .luopan-sheen {
  opacity: 0.72;
  animation-duration: 14s;
}

.compass.casting .luopan-shell,
.compass.casting .ring-branch,
.compass.casting .ring-mountain,
.compass.casting .ring-hex-name,
.compass.casting .ring-outer,
.compass.casting .ring-middle,
.compass.casting .compass-map,
.compass.casting .compass-grid-bg {
  opacity: 0.5;
}

.compass.converging {
  animation: convergeCompass 1200ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.compass.converging .line-stack {
  animation: convergeLines 1200ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.compass.converging .scan-sector {
  opacity: 0.95;
  animation-duration: 1.2s;
}

.compass.converging .ring-branch,
.compass.converging .ring-mountain,
.compass.converging .ring-hex-name,
.compass.converging .ring-outer,
.compass.converging .ring-middle {
  opacity: 0.96;
}

.compass.ai-loading .ring-outer {
  animation-duration: 8s;
}

.compass.ai-loading .ring-middle {
  animation-duration: 5s;
}

.compass.ai-loading .scan-sector {
  opacity: 0.85;
  animation-duration: 1.7s;
}

.compass.ai-loading .luopan-shell {
  animation-duration: 18s;
}

.compass.ai-loading .ring-branch {
  animation-duration: 24s;
}

.compass.ai-loading .ring-mountain {
  animation-duration: 16s;
}

.compass.ai-loading .ring-hex-name {
  animation-duration: 12s;
}

.compass.revealed {
  animation: revealGlow 1100ms ease both;
}

.telemetry {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.telemetry span {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(6, 25, 36, 0.64);
  font-size: 12px;
}

.result-panel {
  margin-top: 8px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(3, 13, 20, 0.76);
  backdrop-filter: blur(18px);
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.result-head h2 {
  margin: 0;
  font-size: clamp(24px, 4vw, 44px);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.hex-summary,
.reading {
  min-height: 148px;
  padding: 18px;
  border: 1px solid rgba(116, 255, 226, 0.16);
  border-radius: 8px;
  background: rgba(7, 28, 40, 0.54);
}

.hex-names {
  color: var(--gold);
  font-size: 28px;
  font-weight: 900;
}

.moving-lines {
  color: var(--cyan);
  font-size: 22px;
  font-weight: 800;
}

.hex-summary p,
.reading p {
  color: #c2dce2;
  line-height: 1.75;
}

.reading.ai {
  border-color: rgba(255, 211, 107, 0.28);
  background:
    linear-gradient(180deg, rgba(8, 34, 45, 0.72), rgba(4, 17, 25, 0.68)),
    radial-gradient(circle at 85% 0%, rgba(255, 211, 107, 0.1), transparent 34%);
}

.reading.ai h3 {
  margin: 24px 0 10px;
  padding: 0 0 8px;
  border-bottom: 1px solid rgba(255, 211, 107, 0.18);
  color: var(--gold);
  font-size: 19px;
  line-height: 1.45;
}

.reading.ai h3:first-child {
  margin-top: 0;
}

.reading.ai p {
  max-width: 82ch;
  margin: 0 0 18px;
  color: #d3e8ed;
  font-size: 15px;
  line-height: 1.9;
}

.reading.ai ul {
  margin: 0 0 16px;
  padding-left: 1.2em;
  color: #c2dce2;
  line-height: 1.75;
  list-style: disc;
}

.reading.ai li {
  margin: 8px 0;
  padding-left: 2px;
}

.reading.ai strong {
  color: #f5fbff;
  font-weight: 900;
}

.reading.ai em {
  display: block;
  margin: 10px 0;
  padding-left: 12px;
  border-left: 2px solid rgba(255, 211, 107, 0.52);
  color: #dceef2;
  font-style: normal;
}

.reading.ai code {
  padding: 2px 6px;
  border-radius: 5px;
  color: var(--cyan);
  background: rgba(39, 241, 208, 0.1);
}

@keyframes rotateSlow {
  to { transform: rotate(360deg); }
}

@keyframes rotateReverse {
  to { transform: rotate(-360deg); }
}

@keyframes photoBreath {
  0%, 100% { transform: translateZ(0) scale(1.02) rotate(0deg); opacity: 0.86; }
  50% { transform: translateZ(0) scale(1.045) rotate(1.2deg); opacity: 0.94; }
}

@keyframes taijiDrift {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes pulseCompass {
  50% { transform: scale(1.018); }
}

@keyframes convergeCompass {
  0% { transform: scale(1); }
  45% { transform: scale(1.035); }
  100% { transform: scale(1); }
}

@keyframes convergeLines {
  0% { transform: scale(1); }
  45% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes revealGlow {
  0% { opacity: 0.86; transform: scale(1.012); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes lineDrop {
  0% { opacity: 0; transform: translate3d(0, -30px, 0) scaleX(0.2); }
  34% { opacity: 1; transform: translate3d(0, -10px, 0) scaleX(0.72); }
  68% { transform: translate3d(0, 3px, 0) scaleX(1.06); }
  100% { opacity: 1; transform: translate3d(0, 0, 0) scaleX(1); }
}

@keyframes lineSweep {
  0% { opacity: 0; transform: translate3d(-28px, 0, 0) scaleX(0.2); }
  38% { opacity: 0.72; transform: translate3d(0, 0, 0) scaleX(1.05); }
  100% { opacity: 0; transform: translate3d(28px, 0, 0) scaleX(0.8); }
}

@keyframes lineRipple {
  0% { opacity: 0; transform: scale(0.88); }
  46% { opacity: 0.78; transform: scale(1.08); }
  100% { opacity: 0; transform: scale(1.34); }
}

@keyframes orbitA {
  to { transform: rotate(360deg) translate(0, var(--orbit-a)); }
}

@keyframes orbitB {
  to { transform: rotate(-360deg) translate(0, var(--orbit-b)); }
}

@keyframes orbitC {
  to { transform: rotate(360deg) translate(0, var(--orbit-c)); }
}

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

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

  .brand-logo {
    width: 168px;
  }

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

  .workspace {
    min-height: auto;
    padding-top: 30px;
  }

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

  .ai-config-grid {
    grid-template-columns: 1fr;
  }

  .compass {
    width: min(94vw, 520px);
    --orbit-a: -166px;
    --orbit-b: -126px;
    --orbit-c: -88px;
    --branch-radius: -168px;
    --mountain-radius: -132px;
    --hex-name-radius: -100px;
    --bagua-radius: -68px;
    --tick-radius: -92px;
  }

  .branch-mark {
    width: 28px;
    height: 28px;
    margin: -14px;
    font-size: 14px;
  }

  .mountain-mark {
    width: 28px;
    height: 28px;
    margin: -14px;
    font-size: 13px;
  }

  .hex-name-mark {
    width: 34px;
    height: 22px;
    margin: -11px -17px;
    font-size: 10px;
  }

  .luopan-cardinal {
    inset: -7%;
  }

  .luopan-cardinal b {
    font-size: 10px;
    padding: 5px 8px;
  }
}

@media (max-width: 520px) {
  .topic-grid,
  .actions {
    grid-template-columns: 1fr;
  }

  .ai-config-actions {
    display: grid;
  }

  .actions button {
    width: 100%;
  }

  .result-head {
    display: block;
  }

  .result-head button {
    margin-top: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
