:root {
  --line: rgba(129, 173, 233, 0.32);
  --line-strong: rgba(193, 220, 255, 0.58);
  --ink: #e7f0ff;
  --muted: #96aecf;
  --surface: rgba(9, 21, 38, 0.84);
  --surface-soft: rgba(16, 33, 58, 0.72);
  --gold-1: #f8d27a;
  --gold-2: #c8923f;
  --stone-black: radial-gradient(circle at 30% 26%, #4a586d 0%, #232c3d 40%, #0c1220 100%);
  --stone-white: radial-gradient(circle at 30% 25%, #ffffff 0%, #f2f6ff 58%, #d9e5fb 100%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "Noto Sans SC", "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, rgba(4, 11, 21, 0.18), rgba(3, 10, 19, 0.6)),
    url("./wechat-reference.jpg") center top / cover no-repeat fixed;
}

button,
select,
a {
  color: var(--ink);
  font: inherit;
}

.divination-app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 30px;
}

.fortune-stage {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(163, 201, 255, 0.3);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(8, 18, 34, 0.45), rgba(10, 24, 45, 0.36)),
    url("./wechat-reference.jpg") center top / cover no-repeat;
  box-shadow: 0 24px 60px rgba(2, 10, 24, 0.62);
}

.stage-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(5, 12, 24, 0.56), rgba(7, 18, 34, 0.2) 50%, rgba(5, 12, 24, 0.5)),
    linear-gradient(180deg, rgba(7, 16, 31, 0.2), rgba(7, 16, 31, 0.5));
}

.review-content {
  position: relative;
  z-index: 1;
  padding: 14px;
}

.fortune-topbar,
.panel-head,
.board-toolbar,
.board-summary,
.insight-strip,
.hero-actions,
.fortune-hero-side,
.mode-switch {
  display: flex;
  align-items: center;
}

.fortune-topbar,
.panel-head,
.board-toolbar,
.board-summary,
.insight-strip {
  justify-content: space-between;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.topbar {
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(11, 26, 46, 0.82);
  padding: 14px;
  box-shadow: 0 8px 24px rgba(28, 68, 153, 0.09);
}

.kicker {
  margin: 0;
  color: #8cc2ff;
  font-size: 13px;
  letter-spacing: 0.16em;
  font-weight: 700;
}

.topbar h1 {
  margin: 12px 0 10px;
  font-size: 36px;
  line-height: 1.22;
  font-weight: 700;
  text-shadow: 0 8px 20px rgba(0, 0, 0, 0.48);
}

.lead {
  margin-bottom: 0;
  color: #c3d5ef;
  line-height: 1.62;
}

.fortune-hero-side {
  gap: 14px;
  align-self: stretch;
  flex-direction: column;
  justify-content: center;
}

.bean-box {
  min-width: 132px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(13, 30, 52, 0.68);
  padding: 10px;
}

.bean-box span {
  display: block;
  font-size: 12px;
  color: #cae1ff;
}

.bean-box strong {
  display: block;
  margin-top: 2px;
  font-size: 26px;
  color: #e5f1ff;
}

.bean-box small {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: #a8c6ec;
}

.hero-actions {
  gap: 8px;
  flex-wrap: wrap;
}

.fortune-layout {
  margin-top: 12px;
  grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.5fr);
  align-items: stretch;
  gap: 12px;
}

.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 14px;
  box-shadow: 0 8px 20px rgba(28, 68, 153, 0.06);
}

.fortune-card {
  min-height: 100%;
}

.mode-switch,
.board-toolbar,
.board-summary,
.insight-strip,
.result-grid {
  gap: 12px;
}

.mode-btn,
.board-toolbar button,
.btn-primary,
.btn-link,
.select-wrap select {
  border: 1px solid rgba(139, 182, 245, 0.34);
  border-radius: 999px;
  background: rgba(17, 41, 72, 0.78);
  color: #d9e8ff;
}

.mode-btn,
.board-toolbar button,
.btn-primary,
.btn-link {
  padding: 9px 16px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.14s ease, filter 0.18s ease;
}

.mode-btn:hover,
.board-toolbar button:hover,
.btn-primary:hover,
.btn-link:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.mode-switch {
  flex-wrap: wrap;
}

.mode-btn {
  padding: 9px 16px;
}

.mode-btn.is-active {
  border-color: rgba(248, 210, 122, 0.9);
  color: #291609;
  font-weight: 700;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
}

.btn-primary {
  border-color: rgba(241, 184, 100, 0.9);
  color: #291609;
  font-weight: 700;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  box-shadow: 0 8px 18px rgba(5, 16, 34, 0.34);
  animation: primaryPulse 2.8s ease-in-out infinite;
}

.btn-primary.is-casting {
  animation:
    primaryPulse 2.8s ease-in-out infinite,
    castBurst 720ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.btn-primary:focus-visible,
.mode-btn:focus-visible,
.board-toolbar button:focus-visible,
.btn-link:focus-visible,
.select-wrap select:focus-visible,
.board-cell:focus-visible {
  outline: 2px solid rgba(255, 206, 139, 0.85);
  outline-offset: 2px;
}

.select-wrap {
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.select-wrap span {
  font-size: 13px;
}

.select-wrap select {
  padding: 9px 14px;
  background: rgba(14, 34, 63, 0.86);
}

.board-card {
  margin: 12px 0 0;
}

.board-shell {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(214, 165, 92, 0.22);
  background:
    radial-gradient(circle at 50% 15%, rgba(201, 138, 71, 0.23), transparent 60%),
    linear-gradient(180deg, rgba(114, 64, 40, 0.14), rgba(14, 9, 8, 0.24)),
    rgba(31, 19, 14, 0.85);
  box-shadow: inset 0 6px 14px rgba(251, 196, 119, 0.08);
  position: relative;
  overflow: hidden;
}

.board-shell::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 14px;
  border: 1px solid rgba(233, 162, 98, 0.45);
  pointer-events: none;
}

.board-shell::after {
  content: "";
  position: absolute;
  inset: -20% -25%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(236, 150, 78, 0.1), rgba(236, 150, 78, 0));
}

.fortune-board {
  display: grid;
  width: min(100%, 640px);
  aspect-ratio: 1;
  margin: 0 auto;
  padding: 18px;
  border: 0.15em solid #ca933a;
  background:
    linear-gradient(to bottom, rgba(234, 220, 192, 0.1), transparent),
    linear-gradient(to bottom, transparent, rgba(23, 10, 2, 0.05)),
    url("./vendor/shudan/css/board.png") #f1b458;
  box-shadow: 0 10px 16px rgba(0, 0, 0, 0.35);
}

.board-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 0;
  padding: 0;
  background: transparent;
}

.board-cell::before,
.board-cell::after {
  content: "";
  position: absolute;
  background: #5e2e0c;
}

.board-cell::before {
  width: 1px;
  height: calc(100% + 2px);
}

.board-cell::after {
  width: calc(100% + 2px);
  height: 1px;
}

.board-cell.edge-top::before,
.board-cell.edge-bottom::before,
.board-cell.edge-left::after,
.board-cell.edge-right::after {
  opacity: 0.58;
}

.star-point {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #5e2e0c;
}

.stone {
  position: relative;
  z-index: 1;
  width: 72%;
  height: 72%;
  border-radius: 999px;
  box-shadow: 0 8px 14px rgba(30, 15, 7, 0.24);
}

.stone.black {
  background: var(--stone-black);
}

.stone.white {
  background: var(--stone-white);
  border: 1px solid rgba(83, 58, 31, 0.12);
}

.board-summary,
.insight-strip {
  flex-wrap: wrap;
  margin-top: 12px;
}

.board-summary div,
.insight-strip div {
  min-width: 110px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(129, 173, 233, 0.18);
  background: linear-gradient(180deg, rgba(16, 35, 60, 0.56), rgba(10, 20, 36, 0.5));
}

.board-summary span,
.insight-strip span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.board-summary strong,
.insight-strip strong,
.gua-badge {
  font-size: 18px;
  color: #f1f6ff;
}

.board-hint {
  margin-top: 16px;
  margin-bottom: 0;
  color: #b7cceb;
  line-height: 1.62;
}

.result-card {
  background: var(--surface-soft);
}

.result-card.is-revealing {
  animation: revealOracle 760ms ease-out;
}

.gua-badge {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(248, 210, 122, 0.3);
  background: rgba(24, 47, 80, 0.74);
  color: #f5dba1;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.result-block {
  min-height: 160px;
  padding: 18px;
  border-radius: 14px;
  background: rgba(12, 28, 49, 0.72);
  border: 1px solid rgba(126, 173, 236, 0.22);
}

.result-highlight {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(201, 146, 63, 0.12), rgba(12, 28, 49, 0.82));
}

.result-block h3 {
  margin-bottom: 10px;
  font-size: 18px;
  color: #e7f0ff;
}

.result-block p {
  margin-bottom: 0;
  color: #c3d5ef;
  line-height: 1.7;
}

.insight-strip {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(129, 173, 233, 0.18);
}

@keyframes primaryPulse {
  0%,
  100% {
    box-shadow: 0 8px 18px rgba(5, 16, 34, 0.34);
  }
  50% {
    box-shadow: 0 11px 24px rgba(194, 144, 61, 0.3);
  }
}

@keyframes castBurst {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: 0 8px 18px rgba(5, 16, 34, 0.34), 0 0 0 rgba(248, 210, 122, 0);
  }
  40% {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 14px 26px rgba(194, 144, 61, 0.34), 0 0 28px rgba(248, 210, 122, 0.42);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 8px 18px rgba(5, 16, 34, 0.34), 0 0 0 rgba(248, 210, 122, 0);
  }
}

@keyframes revealOracle {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: 0 8px 20px rgba(28, 68, 153, 0.06);
  }
  35% {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 18px 34px rgba(194, 144, 61, 0.18);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 8px 20px rgba(28, 68, 153, 0.06);
  }
}

@media (max-width: 1040px) {
  .fortune-layout {
    grid-template-columns: 1fr;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .result-highlight {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  .divination-app {
    padding: 14px;
  }

  .topbar,
  .panel-head,
  .board-toolbar,
  .fortune-hero-side {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-actions,
  .mode-switch,
  .board-toolbar {
    width: 100%;
  }

  .btn-primary,
  .btn-link,
  .board-toolbar button,
  .mode-btn,
  .select-wrap {
    width: 100%;
    justify-content: center;
  }

  .select-wrap {
    align-items: stretch;
    flex-direction: column;
  }

  .select-wrap select {
    width: 100%;
  }
}