/* ============================================================
 * 合参 · 样式
 * 暗墨底 + 暖金线 + 朱砂印。手机优先。
 * ============================================================ */

*,
*::before,
*::after { box-sizing: border-box; }

:root {
  --ink: #0d0a09;
  --ink-2: #15110d;
  --paper: #e8ddc9;
  --paper-2: #f4ead6;
  --gold: #c9a227;
  --gold-b: #e0bd63;
  --cinnabar: #a63a30;
  --muted: #9a8f81;
  --line: rgba(201, 162, 39, .2);
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--ink);
  color: var(--paper);
  font-family: 'Songti SC', 'STSong', 'Noto Serif SC', 'SimSun', serif;
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;             /* 尽量别让最后一行只剩一个字 */
  background-image:
    radial-gradient(90% 60% at 50% -10%, rgba(201, 162, 39, .08), transparent 70%),
    radial-gradient(70% 50% at 50% 112%, rgba(166, 58, 48, .055), transparent 70%);
  background-repeat: no-repeat;
}

/* 纸张噪点，压掉纯色底的塑料感 */
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

#app {
  position: relative;
  z-index: 2;
  max-width: 460px;
  margin: 0 auto;
  padding: 0 20px calc(48px + env(safe-area-inset-bottom));
}

/* ---------------------------- 屏 ---------------------------- */

.screen { display: none; padding-top: clamp(30px, 7vh, 66px); }
.screen.active { display: block; animation: rise .5s cubic-bezier(.2, .7, .3, 1) both; }

/* 内容短的屏（首页、应签入口）竖向居中，别吊在顶上 */
.screen[data-screen="home"].active,
.screen[data-screen="join"].active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100dvh;
  padding-top: 0;
  padding-bottom: 6vh;
}

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

/* --------------------------- 卦象 --------------------------- */

.hex {
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: 108px;
  margin: 0 auto;
}

.yao {
  display: block;
  height: 8px;
  border-radius: 1px;
}

.yao--yang {
  background: linear-gradient(90deg, #7d5f1b, #e0bd63 42%, #7d5f1b);
}

.yao--yin {
  display: flex;
  justify-content: space-between;
  background: none;
}
.yao--yin::before,
.yao--yin::after {
  content: '';
  width: calc(50% - 7px);
  border-radius: 1px;
  background: linear-gradient(90deg, #7d5f1b, #e0bd63 45%, #7d5f1b);
}

.yao--void {
  height: 8px;
  border-radius: 1px;
  background: repeating-linear-gradient(90deg,
    rgba(232, 221, 201, .15) 0 4px,
    transparent 4px 10px);
}

.hex--deco {
  width: 74px;
  margin-bottom: 24px;
  opacity: .34;
}

.hex--deco .yao { height: 7px; }

.hex-wrap { margin: 26px 0 0; }

.hex-caption {
  margin: 14px 0 0;
  text-align: center;
  font-size: 12.5px;
  letter-spacing: .1em;
  color: rgba(201, 162, 39, .78);
}
.hex-caption-dim { color: rgba(139, 129, 117, .8); }

.hex-name {
  margin-top: 16px;
  font-size: 13.5px;
  letter-spacing: .18em;
  text-indent: .18em;
  color: rgba(224, 189, 99, .95);
}

.hex-caption-sub {
  margin-top: 7px;
  font-size: 11.5px;
  letter-spacing: .05em;
  color: rgba(154, 143, 129, .92);
}

#resUpper { margin-left: 1.4em; }

/* ---------------------------- 品牌 ---------------------------- */

.brand { text-align: center; }

.brand-title {
  margin: 0;
  font-size: clamp(40px, 13vw, 52px);
  font-weight: 400;              /* 宋体一加粗就失去横细竖粗的味道 */
  letter-spacing: .32em;
  text-indent: .32em;
  color: var(--paper-2);
  text-shadow: 0 0 30px rgba(201, 162, 39, .18);
}

.brand-sub {
  margin: 14px 0 0;
  font-size: 13.5px;
  letter-spacing: .14em;
  color: var(--muted);
  line-height: 1.8;
}

.brand-date {
  margin: 18px 0 0;
  font-size: 11.5px;
  letter-spacing: .26em;
  text-indent: .26em;
  color: rgba(201, 162, 39, .66);
}

/* ---------------------------- 卡片 ---------------------------- */

.card {
  position: relative;
  margin-top: 30px;
  padding: 24px 20px;
  border: 1px solid rgba(201, 162, 39, .18);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .032), rgba(255, 255, 255, .006));
}

/* 对角两枚角标，古书边框的意思 */
.card::before,
.card::after,
.poster::before,
.poster::after {
  content: '';
  position: absolute;
  width: 13px;
  height: 13px;
  border: 0 solid rgba(201, 162, 39, .5);
  pointer-events: none;
}
.card::before,
.poster::before {
  top: -1px;
  left: -1px;
  border-top-width: 1px;
  border-left-width: 1px;
}
.card::after,
.poster::after {
  right: -1px;
  bottom: -1px;
  border-right-width: 1px;
  border-bottom-width: 1px;
}

.field-label {
  display: block;
  margin: 0 0 9px;
  font-size: 12.5px;
  letter-spacing: .16em;
  color: var(--muted);
}
.field-label + .field { margin-bottom: 22px; }

.field {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid rgba(201, 162, 39, .22);
  border-radius: 2px;
  background: rgba(0, 0, 0, .36);
  color: var(--paper);
  font-family: inherit;
  font-size: 16px;          /* 小于 16 会让 iOS 自动放大 */
  letter-spacing: .06em;
  transition: border-color .2s, box-shadow .2s;
}
.field::placeholder { color: rgba(139, 129, 117, .7); letter-spacing: .04em; }
.field:focus {
  outline: none;
  border-color: rgba(224, 189, 99, .6);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, .07);
}
.field-mono {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0;
  color: rgba(232, 221, 201, .72);
}

/* -------------------------- 所问 -------------------------- */

.ask-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 4px;
}

.ask {
  padding: 11px 0;
  border: 1px solid rgba(201, 162, 39, .2);
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  letter-spacing: .12em;
  text-indent: .12em;
  cursor: pointer;
  transition: color .2s, border-color .2s, background .2s, box-shadow .2s;
}
.ask.is-on {
  border-color: rgba(224, 189, 99, .68);
  background: rgba(201, 162, 39, .1);
  color: var(--paper-2);
  box-shadow: inset 0 0 20px rgba(201, 162, 39, .12);
}

/* --------------------------- 按钮 --------------------------- */

.btn {
  display: block;
  width: 100%;
  margin-top: 22px;
  padding: 15px;
  border-radius: 2px;
  font-family: inherit;
  font-size: 16px;
  letter-spacing: .3em;
  text-indent: .3em;
  cursor: pointer;
  transition: transform .12s, filter .2s, border-color .2s, color .2s;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  border: 1px solid rgba(224, 189, 99, .8);
  background: linear-gradient(180deg, #dcc17c, #ac8b33);
  color: #181207;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 3px 16px rgba(201, 162, 39, .1);
}
.btn-primary:active { filter: brightness(.93); }

.btn-ghost {
  border: 1px solid rgba(201, 162, 39, .26);
  background: transparent;
  color: #b4a894;
  font-size: 14.5px;
  letter-spacing: .18em;
  text-indent: .18em;
  padding: 13px;
}
.btn-ghost:active { border-color: rgba(201, 162, 39, .5); }

.btn-link {
  display: inline-block;
  padding: 0;
  border: none;
  background: none;
  color: rgba(139, 129, 117, .95);
  font-family: inherit;
  font-size: 12.5px;
  letter-spacing: .06em;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(139, 129, 117, .34);
}

.hint {
  margin: 12px 0 0;
  font-size: 12.5px;
  line-height: 1.75;
  letter-spacing: .04em;
  color: rgba(196, 106, 94, .95);
}
#linkHint { color: rgba(196, 140, 94, .95); }

.foot {
  margin: 30px 0 0;
  text-align: center;
  font-size: 11.5px;
  letter-spacing: .1em;
  color: rgba(139, 129, 117, .7);
  line-height: 2;
}

/* --------------------------- 半签 --------------------------- */

.kicker {
  margin: 0;
  text-align: center;
  font-size: 12.5px;
  letter-spacing: .2em;
  color: rgba(201, 162, 39, .82);
}

.half-lead {
  margin: 30px 0 0;
  font-size: 14.5px;
  line-height: 1.9;
  color: #cfc3ae;
  letter-spacing: .04em;
}

.strong { color: var(--paper-2); font-weight: 500; }

.half-line {
  margin: 16px 0 0;
  padding: 4px 0 4px 16px;
  border-left: 2px solid rgba(201, 162, 39, .5);
  font-size: 19px;
  line-height: 1.95;
  color: var(--paper-2);
  letter-spacing: .04em;
}

.sealed {
  margin-top: 30px;
  padding: 26px 18px;
  border: 1px dashed rgba(201, 162, 39, .22);
  border-radius: 3px;
  text-align: center;
  font-size: 13.5px;
  line-height: 1.95;
  letter-spacing: .08em;
  color: rgba(139, 129, 117, .95);
}

.sealed-mark {
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(183, 68, 56, .9);
  border-radius: 2px;
  color: rgba(216, 96, 84, .96);
  font-size: 22px;
  letter-spacing: 0;
  text-indent: 0;
  transform: rotate(-4deg);
}

.ask-note {
  margin: 22px 0 0;
  text-align: center;
  font-size: 13px;
  letter-spacing: .1em;
  color: var(--muted);
}

.link-box {
  margin-top: 34px;
  padding-top: 24px;
  border-top: 1px solid rgba(201, 162, 39, .12);
}

/* 二维码 */

.qr-box {
  margin-top: 30px;
  text-align: center;
}
.qr-box[hidden] { display: none; }

.qr-canvas {
  display: inline-block;
  width: 140px;
  height: 140px;
  border-radius: 4px;
  box-shadow: 0 4px 22px rgba(0, 0, 0, .45);
}

.qr-hint {
  margin: 11px 0 0;
  font-size: 12px;
  letter-spacing: .12em;
  color: var(--muted);
}

.peek {
  margin-top: 26px;
  text-align: center;
}

.peek-panel {
  margin-top: 16px;
  padding: 18px 16px;
  border: 1px solid rgba(201, 162, 39, .16);
  border-radius: 3px;
  text-align: left;
}
.peek-panel[hidden] { display: none; }
.peek-panel .btn { margin-top: 16px; }

/* --------------------------- 结果 --------------------------- */

.poster {
  position: relative;
  padding: 26px 20px 24px;
  border: 1px solid rgba(201, 162, 39, .2);
  border-radius: 3px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(201, 162, 39, .06), transparent 62%),
    linear-gradient(180deg, rgba(28, 22, 17, .62), rgba(17, 13, 10, .68));
}

.res-head { text-align: center; }

.pair {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 21px;
  letter-spacing: .1em;
  color: var(--paper-2);
  word-break: break-word;
}
.pair-x {
  color: rgba(201, 162, 39, .5);
  font-size: 14px;
  letter-spacing: 0;
}

.pair-meta {
  margin: 10px 0 0;
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--muted);
}

.omen {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid rgba(201, 162, 39, .13);
}

.omen-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.omen-title {
  margin: 0;
  font-size: 27px;
  font-weight: 500;
  letter-spacing: .24em;
  text-indent: .24em;
  color: var(--paper-2);
}

.seal {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 3px;
  background: linear-gradient(160deg, #b0433a, #8d2f28);
  color: #f4dcd6;
  font-size: 21px;
  letter-spacing: 0;
  text-indent: 0;
  transform: rotate(-5deg);
  box-shadow: 0 2px 12px rgba(140, 40, 32, .3);
}

.omen-verse {
  margin: 16px 0 0;
  font-size: 16.5px;
  line-height: 2.05;
  letter-spacing: .05em;
  color: #ddd2ba;
}

.omen-reading {
  margin: 14px 0 0;
  padding-left: 14px;
  border-left: 2px solid rgba(201, 162, 39, .28);
  font-size: 14.5px;
  line-height: 1.95;
  letter-spacing: .04em;
  color: rgba(196, 186, 166, .95);
}

/* 契合度 */

.degree {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 28px;
}

.ring {
  --p: 0%;
  position: relative;
  flex: 0 0 auto;
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--gold-b) var(--p), rgba(232, 221, 201, .09) 0);
  font-size: 19px;
  color: var(--paper-2);
  letter-spacing: 0;
}
.ring::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #14100c;
}
.ring span { position: relative; z-index: 1; }

.degree-text { min-width: 0; }

.degree-label {
  font-size: 18px;
  letter-spacing: .2em;
  color: var(--gold-b);
}

.degree-desc {
  margin: 7px 0 0;
  font-size: 13px;
  line-height: 1.85;
  letter-spacing: .03em;
  color: var(--muted);
}

/* 两侧的话 */

.sides {
  margin-top: 26px;
  display: grid;
  gap: 12px;
}

.side {
  padding: 15px 16px;
  border-left: 2px solid rgba(201, 162, 39, .45);
  border-radius: 0 2px 2px 0;
  background: rgba(255, 255, 255, .03);
}

.side-title {
  margin: 0 0 9px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .2em;
  color: rgba(224, 189, 99, .95);
}

.side-text {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.9;
  letter-spacing: .03em;
  color: #d9ceba;
}

/* 宜忌 */

.advice {
  margin-top: 24px;
  display: grid;
  gap: 11px;
}

.advice-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 15px;
  line-height: 1.75;
  letter-spacing: .03em;
  color: #ded3bf;
}
.advice-row p { margin: 0; }

.tag {
  flex: 0 0 auto;
  width: 23px;
  height: 23px;
  margin-top: 2px;
  display: grid;
  place-items: center;
  border-radius: 2px;
  font-size: 13px;
  letter-spacing: 0;
  text-indent: 0;
}
.tag-good { border: 1px solid rgba(201, 162, 39, .45); color: #dccb9c; }
.tag-bad  { border: 1px solid rgba(166, 58, 48, .52); color: #d99c93; }

.tail {
  margin: 26px 0 0;
  padding-top: 20px;
  border-top: 1px solid rgba(201, 162, 39, .13);
  text-align: center;
  font-size: 12.5px;
  line-height: 2;
  letter-spacing: .06em;
  color: rgba(139, 129, 117, .95);
  white-space: pre-line;
  text-wrap: balance;
}

/* ----------------------- 结果长图弹层 ----------------------- */

.poster-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
  background: rgba(6, 5, 4, .95);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.poster-modal[hidden] { display: none; }

.poster-sheet {
  width: min(100%, 420px);
  margin: auto;
  text-align: center;
}

.poster-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
  box-shadow: 0 12px 44px rgba(0, 0, 0, .68);
  -webkit-touch-callout: default;
}

.poster-tip {
  margin: 16px 0 0;
  font-size: 13px;
  letter-spacing: .14em;
  color: var(--muted);
}

.poster-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}
.poster-actions .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  text-decoration: none;
  letter-spacing: .14em;
  text-indent: .14em;
}

/* --------------------------- 提示条 --------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(32px + env(safe-area-inset-bottom));
  z-index: 60;
  padding: 11px 20px;
  border: 1px solid rgba(201, 162, 39, .3);
  border-radius: 2px;
  background: rgba(26, 21, 16, .97);
  color: var(--paper-2);
  font-size: 13.5px;
  letter-spacing: .08em;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: opacity .28s, transform .28s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* --------------------------- 大屏 --------------------------- */

@media (min-width: 700px) {
  .screen { padding-top: 8vh; }
  .card { padding: 28px 26px; }
  .poster { padding: 32px 28px 26px; }
  .btn:hover, .ask:hover { filter: brightness(1.08); }
}
