:root {
  color-scheme: dark;
  --bg: #11100f;
  --surface: #1a1716;
  --surface-high: #27211f;
  --surface-bright: #38302c;
  --text: #f0e9df;
  --muted: #bfa9a1;
  --faint: #77625c;
  --line: #5a4038;
  --red: #a51f26;
  --red-hot: #f6b2a6;
  --gold: #e3bd58;
  --gold-soft: rgba(233, 195, 73, 0.24);
  --green: #67d7a1;
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.36);
  font-family: "Noto Serif SC", "Microsoft YaHei", "PingFang SC", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 18px),
    linear-gradient(45deg, rgba(227, 189, 88, 0.03) 0 1px, transparent 1px 24px),
    linear-gradient(180deg, rgba(86, 24, 28, 0.18), transparent 380px),
    linear-gradient(90deg, rgba(227, 189, 88, 0.05), transparent 48%, rgba(103, 215, 161, 0.035)),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.22) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at center, black, transparent 78%);
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.ink {
  position: absolute;
  width: 360px;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.4;
  display: none;
}

.ink-a {
  left: -120px;
  top: 22%;
  background: rgba(178, 34, 34, 0.28);
}

.ink-b {
  right: -140px;
  bottom: 8%;
  background: rgba(89, 222, 155, 0.13);
}

.ring {
  position: absolute;
  width: 620px;
  aspect-ratio: 1;
  left: 50%;
  top: 180px;
  translate: -50% 0;
  border: 1px solid rgba(233, 195, 73, 0.1);
  border-radius: 50%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 40px;
  background: rgba(17, 16, 15, 0.84);
  border-bottom: 1px solid rgba(227, 189, 88, 0.16);
  backdrop-filter: blur(20px);
}

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

.seal {
  display: grid;
  place-items: center;
  width: 42px;
  aspect-ratio: 1;
  background: linear-gradient(145deg, #b92b2d, #721014);
  color: #fff;
  border: 1px solid rgba(255, 180, 172, 0.4);
  border-radius: 6px;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 10px 24px rgba(165, 31, 38, 0.26);
}

.brand strong,
footer strong {
  display: block;
  font-family: "EB Garamond", serif;
  color: var(--red-hot);
  font-size: 22px;
  letter-spacing: 0;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.navlinks {
  display: flex;
  gap: 28px;
}

.navlinks a {
  color: var(--muted);
  text-decoration: none;
  font-family: "EB Garamond", serif;
  font-size: 20px;
}

.navlinks a:hover,
.nav-icon {
  color: var(--red-hot);
}

.nav-icon {
  font-size: 30px;
  line-height: 1;
}

.layout {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 36px;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

.scroll-panel,
.form-panel,
.admin-panel {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), transparent 34%),
    linear-gradient(180deg, rgba(39, 33, 31, 0.98), rgba(24, 21, 20, 0.98));
  border: 1px solid rgba(227, 189, 88, 0.2);
  box-shadow: var(--shadow);
}

.scroll-panel::before,
.form-panel::before,
.admin-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: inherit;
}

.scroll-panel {
  position: sticky;
  top: 96px;
  padding: 24px;
  border-left-color: rgba(227, 189, 88, 0.1);
  border-right-color: rgba(227, 189, 88, 0.1);
}

.section-kicker {
  margin: 0 0 10px;
  color: var(--gold);
  font-family: "EB Garamond", serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(38px, 4.3vw, 58px);
  line-height: 1.12;
  font-weight: 900;
  text-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
}

h1 span {
  color: #fff4ee;
}

h2 {
  font-size: 25px;
  color: var(--red-hot);
}

.center-stage {
  min-width: 0;
}

.stage-copy {
  text-align: center;
  max-width: 650px;
  margin: 0 auto 28px;
}

.stage-copy p:last-child {
  margin: 14px auto 0;
  max-width: 560px;
  color: var(--muted);
  line-height: 1.8;
  font-size: 15px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 24px;
}

.module-card {
  min-height: 78px;
  padding: 12px;
  align-items: flex-start;
  justify-content: space-between;
  border: 1px solid rgba(233, 195, 73, 0.18);
  background: rgba(14, 14, 14, 0.54);
  color: var(--muted);
  text-align: left;
  border-radius: 6px;
}

.module-card span {
  display: grid;
  place-items: center;
  width: 34px;
  aspect-ratio: 1;
  border: 1px solid rgba(233, 195, 73, 0.28);
  color: var(--gold);
}

.module-card strong {
  display: block;
  margin-top: 10px;
  color: var(--text);
  font-size: 15px;
}

.module-card.active {
  border-color: rgba(255, 180, 172, 0.72);
  background: linear-gradient(180deg, rgba(178, 34, 34, 0.34), rgba(14, 14, 14, 0.72));
  box-shadow: 0 0 24px rgba(178, 34, 34, 0.18);
}

.ritual-disc {
  position: relative;
  width: min(390px, 78vw);
  aspect-ratio: 1;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
}

.disc-orbit {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(227, 189, 88, 0.23);
  border-radius: 50%;
  box-shadow: inset 0 0 34px rgba(227, 189, 88, 0.04);
}

.disc-orbit.small {
  inset: 58px;
  border-color: rgba(255, 180, 172, 0.18);
}

.coin {
  position: absolute;
  display: grid;
  place-items: center;
  width: 92px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid rgba(233, 195, 73, 0.45);
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 224, 136, 0.32), transparent 28%),
    radial-gradient(circle at center, #5a3629, #211b18 68%);
  color: var(--gold);
  font-size: 28px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.4);
}

.coin::after {
  content: "";
  width: 22px;
  aspect-ratio: 1;
  border: 1px solid rgba(233, 195, 73, 0.42);
  position: absolute;
}

.coin-one {
  translate: -88px -10px;
}

.coin-two {
  translate: 0 40px;
}

.coin-three {
  translate: 88px -14px;
}

.form-panel {
  padding: 30px;
}

.form-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.form-head p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.form-section {
  margin: 0 0 18px;
  padding: 18px;
  border: 1px solid rgba(227, 189, 88, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    rgba(14, 14, 14, 0.28);
}

.form-section h3 {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 16px;
  letter-spacing: 0;
}

.liuyao-panel {
  display: grid;
  gap: 14px;
  margin: 14px 0 18px;
  padding: 16px;
  border: 1px solid rgba(221, 177, 91, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(227, 189, 88, 0.08), transparent 40%),
    rgba(12, 10, 10, 0.48);
}

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

.liuyao-head div {
  display: grid;
  gap: 4px;
}

.liuyao-head strong {
  color: var(--paper);
}

.liuyao-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.liuyao-head button,
.mini-button {
  min-height: 38px;
  border: 1px solid rgba(221, 177, 91, 0.34);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(165, 31, 38, 0.72), rgba(102, 18, 22, 0.72));
  color: var(--paper);
  padding: 0 14px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.coin-tray {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  gap: 10px;
  justify-content: center;
  min-height: 42px;
}

.coin-tray span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(221, 177, 91, 0.55);
  background: radial-gradient(circle at 35% 30%, #f4d58e, #8d6830 70%);
  color: #20150b;
  font-weight: 800;
}

.coin-tray.shake span {
  animation: coinFlip 0.48s ease;
}

.liuyao-lines {
  display: grid;
  gap: 6px;
  font-family: "EB Garamond", "Noto Serif SC", serif;
}

.liuyao-lines span {
  display: flex;
  justify-content: space-between;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid rgba(170, 137, 134, 0.18);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.12);
  color: var(--muted);
}

.liuyao-lines span.moving {
  color: var(--gold);
  border-color: rgba(221, 177, 91, 0.4);
}

.mini-button {
  justify-self: end;
  background: transparent;
  box-shadow: none;
}

.form-head .local-icon {
  display: grid;
  place-items: center;
  width: 28px;
  aspect-ratio: 1;
  border: 1px solid rgba(233, 195, 73, 0.38);
  color: var(--gold);
}

.field-grid,
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
}

.consent-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(227, 189, 88, 0.16);
  border-radius: 6px;
  background: rgba(14, 14, 14, 0.34);
  line-height: 1.7;
}

.consent-line input {
  width: 18px;
  min-height: 18px;
  margin-top: 4px;
  accent-color: var(--red);
}

.consent-line a,
footer a {
  color: var(--gold);
  text-decoration: none;
}

.policy-shell {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 56px;
}

.policy-panel {
  line-height: 1.9;
}

.policy-panel h3 {
  margin: 24px 0 8px;
  color: var(--gold);
}

.policy-panel p {
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(170, 137, 134, 0.28);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(14, 14, 14, 0.72);
  font: inherit;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(227, 189, 88, 0.68);
  background: rgba(12, 11, 10, 0.78);
  box-shadow: 0 0 0 3px rgba(227, 189, 88, 0.08);
}

button,
.report-actions a {
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.chop-button {
  background: linear-gradient(180deg, #b92b2d, #781418);
  color: #fff;
  box-shadow: 0 16px 36px rgba(165, 31, 38, 0.22);
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.chop-button:hover {
  transform: translateY(-1px);
  background: #92030f;
  box-shadow: 0 0 24px rgba(178, 34, 34, 0.35);
}

.outline-button {
  border: 1px solid rgba(233, 195, 73, 0.35);
  color: var(--gold);
  background:
    linear-gradient(180deg, rgba(227, 189, 88, 0.12), rgba(227, 189, 88, 0.04)),
    rgba(14, 14, 14, 0.42);
}

.outline-button:hover {
  background: rgba(233, 195, 73, 0.13);
}

.hexagram-stack {
  position: relative;
  display: flex;
  flex-direction: column-reverse;
  justify-content: center;
  align-items: center;
  gap: 14px;
  min-height: 280px;
  margin: 24px 0;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  color: var(--faint);
  text-align: center;
}

.record-mark {
  display: grid;
  place-items: center;
  width: 52px;
  aspect-ratio: 1;
  margin: 0 auto 10px;
  border: 1px solid rgba(233, 195, 73, 0.22);
  color: var(--gold);
  font-size: 30px;
}

.yao {
  width: min(154px, 100%);
  height: 10px;
  background: var(--gold);
  box-shadow: 0 0 16px rgba(233, 195, 73, 0.16);
  animation: rise 0.42s ease both;
}

.yao.broken {
  background: transparent;
  display: flex;
  justify-content: space-between;
}

.yao.broken::before,
.yao.broken::after {
  content: "";
  width: 44%;
  height: 100%;
  background: var(--gold);
}

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

.line-labels {
  display: grid;
  gap: 8px;
  padding-top: 18px;
  border-top: 1px solid rgba(81, 58, 54, 0.7);
  color: var(--faint);
  font-family: "EB Garamond", serif;
}

.line-labels span {
  display: flex;
  justify-content: space-between;
}

.line-labels b {
  color: var(--gold);
}

.method-oracle {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(233, 195, 73, 0.16);
  background: rgba(14, 14, 14, 0.38);
}

.method-oracle span {
  display: grid;
  place-items: center;
  width: 54px;
  aspect-ratio: 1;
  margin-bottom: 14px;
  border: 1px solid rgba(233, 195, 73, 0.34);
  color: var(--gold);
  font-size: 22px;
  font-weight: 900;
}

.method-oracle strong {
  display: block;
  color: var(--text);
  font-size: 20px;
}

.method-oracle p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
}

.contact-card {
  padding: 18px;
  margin: 20px 0;
  border: 1px solid rgba(233, 195, 73, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(227, 189, 88, 0.08), transparent 50%),
    rgba(14, 14, 14, 0.42);
}

.bundle-list {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}

.bundle-list div {
  padding: 14px;
  border-radius: 6px;
  border-left: 2px solid var(--red);
  background: rgba(14, 14, 14, 0.46);
}

.bundle-list strong {
  display: block;
  color: var(--gold);
}

.bundle-list span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.contact-card span {
  display: block;
  color: var(--faint);
  font-size: 13px;
}

.contact-card strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 20px;
}

.qr-box {
  display: grid;
  place-items: center;
  width: 124px;
  aspect-ratio: 1;
  margin-top: 16px;
  border: 1px solid rgba(233, 195, 73, 0.25);
  border-radius: 6px;
  background: #ebe5df;
  color: #513a36;
  overflow: hidden;
}

.qr-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result {
  min-height: 240px;
  max-height: 520px;
  overflow: auto;
  margin-top: 18px;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    rgba(10, 10, 10, 0.58);
  border: 1px solid rgba(227, 189, 88, 0.18);
  border-radius: 8px;
  white-space: pre-wrap;
  line-height: 1.86;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.result.empty {
  display: grid;
  place-items: center;
  color: var(--faint);
}

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

.progress-card strong {
  color: var(--paper);
  font-size: 18px;
}

.progress-card span {
  color: var(--gold);
}

.progress-card small {
  max-width: 320px;
  color: var(--muted);
  line-height: 1.7;
}

.spinner {
  width: 42px;
  aspect-ratio: 1;
  border: 2px solid rgba(221, 177, 91, 0.22);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.report-content {
  white-space: pre-wrap;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

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

@keyframes coinFlip {
  0% {
    transform: translateY(0) rotateY(0deg);
  }
  50% {
    transform: translateY(-12px) rotateY(180deg);
  }
  100% {
    transform: translateY(0) rotateY(360deg);
  }
}

.report-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.report-actions a,
.report-actions button {
  display: inline-grid;
  place-items: center;
  flex: 1;
  min-height: 42px;
  text-decoration: none;
  background: var(--red);
  color: #fff;
}

.admin-panel {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto 36px;
  padding: 26px;
}

.admin-grid {
  grid-template-columns: 2fr 1fr 1fr 160px;
  align-items: end;
}

pre {
  max-height: 240px;
  overflow: auto;
  margin: 18px 0 0;
  padding: 16px;
  border: 1px solid rgba(89, 222, 155, 0.22);
  background: #0c1210;
  color: var(--green);
}

footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 36px 16px;
  color: var(--muted);
  border-top: 1px solid rgba(81, 58, 54, 0.55);
  background: #0e0e0e;
}

@media print {
  .topbar,
  .layout > :not(.redeem-panel),
  .admin-panel,
  footer,
  .contact-card,
  .redeem-panel > label,
  .redeem-panel > button {
    display: none !important;
  }

  body {
    background: #fff;
    color: #111;
  }

  .layout,
  .redeem-panel,
  .result {
    display: block;
    width: 100%;
    max-height: none;
    border: 0;
    box-shadow: none;
    background: #fff;
    color: #111;
  }
}

@media (max-width: 1060px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .scroll-panel {
    position: static;
  }

  .line-record {
    order: 2;
  }

  .center-stage {
    order: 1;
  }

  .redeem-panel {
    order: 3;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 14px 16px;
  }

  .navlinks {
    display: none;
  }

  .layout,
  .admin-panel {
    width: min(100% - 20px, 640px);
  }

  .layout {
    padding-top: 28px;
  }

  .field-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

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

  .ritual-disc {
    width: min(320px, 88vw);
  }

  .coin {
    width: 74px;
  }

  .coin-one {
    translate: -68px -6px;
  }

  .coin-two {
    translate: 0 34px;
  }

  .coin-three {
    translate: 68px -10px;
  }
}
