/* 帝师灵签 — 64-lot sign oracle */
/* Warm cinnabar + roasted-ink palette: softer than pure black, still ritual. */
.ds-stage {
  --ds-night: #3a2b22;
  --ds-red: #b4513a;
  --ds-red-deep: #8e3a2b;
  --ds-cream: #f0e4cf;
  background:
    radial-gradient(45% 55% at 82% 0%, rgba(180, 81, 58, .16), transparent 62%),
    radial-gradient(42% 50% at 8% 100%, rgba(198, 163, 107, .1), transparent 66%),
    linear-gradient(180deg, #3a2b22 0%, #2d2119 100%);
  color: var(--ds-cream);
  position: relative;
  overflow: hidden;
  border-top: 1px solid rgba(180, 81, 58, .38);
}
.ds-stage::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(55% 55% at 82% 0%, rgba(180, 81, 58, .14), transparent 60%),
    radial-gradient(45% 45% at 10% 100%, rgba(198, 163, 107, .08), transparent 65%);
  pointer-events: none;
}
.ds-stage .wrap { position: relative; }
.ds-cast-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 40px; padding-bottom: 28px; border-bottom: 1px solid rgba(240, 228, 207, .18); }
.ds-cast-side { display: flex; align-items: flex-end; gap: 22px; }
.ds-cast-mark {
  width: 86px;
  height: 98px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: 1px solid rgba(180, 81, 58, .7);
  background: rgba(180, 81, 58, .08);
  color: #d78a6d;
  font-family: var(--serif-zh);
  box-shadow: inset 0 0 0 4px rgba(180, 81, 58, .06);
}
.ds-cast-mark span { font-size: 18px; line-height: 1.18; letter-spacing: .08em; }
.ds-cast-mark small { margin-top: 7px; color: rgba(240, 228, 207, .48); font-family: var(--sans); font-size: 6.5px; letter-spacing: .14em; white-space: nowrap; }
.ds-cast-note { max-width: 380px; font-size: 13px; line-height: 1.75; color: rgba(240, 228, 207, .62); }

/* The hero's primary action carries the warmer accent. */
.page-hero .hero-actions .btn { background: #b4513a; border-color: #b4513a; color: #fff7ea; }
.page-hero .hero-actions .btn:hover { background: #963f2e; border-color: #963f2e; color: #fffaf0; }

.ds-cast { display: grid; grid-template-columns: 300px 1fr; gap: 0; margin-top: 32px; border: 1px solid rgba(240, 228, 207, .18); background: rgba(240, 228, 207, .025); }

.ds-tube { position: relative; min-height: 360px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 28px 24px; border-right: 1px solid rgba(238,230,212,.14); overflow: hidden; }
.ds-tube::before { content: ""; position: absolute; inset: 18px; border: 1px solid rgba(201,164,104,.12); pointer-events: none; }
.ds-tube-sticks { width: 190px; height: 245px; display: flex; align-items: flex-end; justify-content: center; gap: 4px; position: relative; }
.ds-tube-sticks i { display: block; width: 9px; height: var(--h, 220px); background: linear-gradient(180deg, #d8c49a, #8d764f 72%, #5f4d31); border: 1px solid rgba(43,36,26,.45); border-radius: 4px 4px 1px 1px; transform: rotate(var(--r, 0deg)); transform-origin: bottom center; box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.ds-tube-sticks i:nth-child(1) { --h: 210px; --r: -5deg; }
.ds-tube-sticks i:nth-child(2) { --h: 228px; --r: 3deg; }
.ds-tube-sticks i:nth-child(3) { --h: 198px; --r: -2deg; }
.ds-tube-sticks i:nth-child(4) { --h: 236px; --r: 5deg; }
.ds-tube-sticks i:nth-child(5) { --h: 214px; --r: -3deg; }
.ds-tube-sticks i:nth-child(6) { --h: 242px; --r: 1deg; }
.ds-tube-sticks i:nth-child(7) { --h: 202px; --r: 4deg; }
.ds-tube-sticks i:nth-child(8) { --h: 232px; --r: -4deg; }
.ds-tube-sticks i:nth-child(9) { --h: 220px; --r: 2deg; }
.ds-tube-sticks i:nth-child(10) { --h: 238px; --r: -1deg; }
.ds-tube-sticks i:nth-child(11) { --h: 208px; --r: 3deg; }
.ds-tube-sticks i:nth-child(12) { --h: 226px; --r: -3deg; }
.ds-tube.shaking .ds-tube-sticks { animation: dsShake .55s ease-in-out; }
@keyframes dsShake { 20% { transform: translateX(-5px) rotate(-1.5deg); } 40% { transform: translateX(6px) rotate(1.5deg); } 60% { transform: translateX(-4px) rotate(-1deg); } 80% { transform: translateX(3px) rotate(.8deg); } }
.ds-tube-label { position: relative; margin-top: 10px; font-family: var(--serif-zh); font-size: 24px; letter-spacing: .22em; color: var(--gold-2); writing-mode: vertical-rl; padding: 10px 4px; border: 1px solid rgba(198,163,107,.38); background: rgba(42,33,27,.78); }
.ds-tube-sub { margin-top: 12px; font-family: var(--sans); font-size: 8.5px; letter-spacing: .22em; color: rgba(240,228,207,.42); text-transform: uppercase; }

.ds-cast-body { padding: clamp(24px, 4vw, 44px); display: flex; flex-direction: column; justify-content: center; }
.ds-input { width: 100%; background: transparent; border: 0; border-bottom: 1px solid rgba(240,228,207,.26); color: var(--ds-cream); font-family: var(--serif); font-size: clamp(20px, 2.4vw, 28px); padding: 6px 0 12px; outline: none; }
.ds-input::placeholder { color: rgba(240,228,207,.28); }
.ds-input:focus { border-bottom-color: #c98b6e; }
.ds-controls { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.ds-cast .btn-light { background: #b4513a; color: #fff7ea; border-color: #b4513a; }
.ds-cast .btn-light:hover { background: #963f2e; border-color: #963f2e; color: #fffaf0; }
.ds-ghost { color: rgba(240,228,207,.76); border-color: rgba(240,228,207,.32); }
.ds-ghost:hover { background: rgba(240,228,207,.1); color: var(--ds-cream); }
.ds-hint { margin-top: 22px; font-size: 11.5px; line-height: 1.75; color: rgba(238,230,212,.4); max-width: 520px; }

.ds-result { margin-top: 30px; background: #f3eddf; color: var(--ink); border: 1px solid rgba(201,164,104,.55); padding: clamp(24px, 4vw, 48px); position: relative; animation: dsIn .65s var(--ease); }
@keyframes dsIn { from { opacity: 0; transform: translateY(12px); } }
.ds-result::after { content: "帝师灵签"; position: absolute; right: 26px; top: 22px; font-family: var(--serif-zh); font-size: 11px; letter-spacing: .3em; color: rgba(163,55,42,.55); writing-mode: vertical-rl; }
.ds-result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; border-bottom: 1px solid rgba(23,23,15,.14); padding-bottom: 22px; }
.ds-result-no { font-family: var(--mono); font-size: 10px; letter-spacing: .16em; color: var(--cinnabar); }
.ds-result-title { font-family: var(--serif-zh); font-size: clamp(30px, 4.2vw, 48px); letter-spacing: .1em; line-height: 1.2; margin-top: 8px; }
.ds-rank { display: inline-block; margin-left: 12px; font-family: var(--serif-zh); font-size: 15px; letter-spacing: .12em; color: var(--cinnabar); border: 1px solid rgba(163,55,42,.35); padding: 3px 9px; vertical-align: middle; }
.ds-rank[data-rank="下吉"], .ds-rank[data-rank="下下"] { color: var(--muted); border-color: var(--line); }
.ds-result-body { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(28px, 5vw, 60px); padding: 28px 0 0; }
.ds-poem { font-family: var(--serif-zh); font-size: clamp(24px, 2.8vw, 34px); line-height: 1.85; letter-spacing: .06em; }
.ds-poem span { display: block; }
.ds-intent { margin-top: 24px; font-family: var(--serif-zh); font-size: 15px; line-height: 1.8; color: var(--ink-soft); padding-left: 14px; border-left: 2px solid var(--gold); }
.ds-intent b { display: block; font-family: var(--sans); font-size: 9px; letter-spacing: .2em; color: var(--muted); font-weight: 400; margin-bottom: 5px; }
.ds-aspects { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1px solid rgba(23,23,15,.12); border-left: 1px solid rgba(23,23,15,.12); }
.ds-aspect { padding: 14px 16px; border-right: 1px solid rgba(23,23,15,.12); border-bottom: 1px solid rgba(23,23,15,.12); }
.ds-aspect b { display: block; font-family: var(--serif-zh); font-size: 12px; letter-spacing: .12em; color: var(--cinnabar); margin-bottom: 5px; font-weight: 400; }
.ds-aspect span { display: block; font-family: var(--serif-zh); font-size: 13px; line-height: 1.65; color: var(--ink-soft); }
.ds-story { margin-top: 26px; padding-top: 18px; border-top: 1px solid rgba(23,23,15,.14); font-family: var(--serif-zh); font-size: 14px; line-height: 1.85; color: var(--muted); }
.ds-story b { font-family: var(--sans); font-size: 9px; letter-spacing: .18em; color: var(--muted-2); font-weight: 400; display: block; margin-bottom: 5px; text-transform: uppercase; }
.ds-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; padding-top: 22px; border-top: 1px solid rgba(23,23,15,.14); }

.ds-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 26px; }
.ds-filters button { border: 1px solid var(--line); padding: 8px 16px; font-family: var(--serif-zh); font-size: 13px; color: var(--muted); letter-spacing: .08em; transition: all .25s; }
.ds-filters button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.ds-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.ds-card { text-align: left; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 18px 18px 16px; background: transparent; transition: background .25s, color .25s; }
.ds-card:hover { background: var(--ink); color: var(--paper); }
.ds-card .n { font-family: var(--mono); font-size: 9px; color: var(--cinnabar); letter-spacing: .1em; }
.ds-card:hover .n { color: var(--gold-2); }
.ds-card .t { display: block; font-family: var(--serif-zh); font-size: 19px; letter-spacing: .08em; margin: 8px 0 6px; }
.ds-card .r { font-family: var(--serif-zh); font-size: 11px; color: var(--muted); letter-spacing: .1em; }
.ds-card:hover .r { color: rgba(244,239,227,.55); }
.ds-card .p { display: block; font-family: var(--serif-zh); font-size: 11px; line-height: 1.6; color: var(--muted-2); margin-top: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ds-note { border-top: 1px solid var(--line); background: var(--paper-2); }

@media (max-width: 1080px) {
  .ds-cast { grid-template-columns: 230px 1fr; }
  .ds-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ds-result-body { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .ds-cast-head { flex-direction: column; align-items: flex-start; gap: 16px; }
  .ds-grid { grid-template-columns: 1fr 1fr; }
  .ds-result::after { display: none; }
}
@media (max-width: 520px) {
  .ds-input { font-size: 18px; }
  .ds-result { padding: 20px; }
  .ds-result-title { font-size: 30px; }
  .ds-rank { display: block; margin: 8px 0 0; width: fit-content; }
  .ds-poem { font-size: 22px; }
  .ds-aspects { grid-template-columns: 1fr; }
  .ds-grid { grid-template-columns: 1fr; }
}

.ds-result { scroll-margin-top: 90px; }
.ds-poem-zh { margin-top: 12px; font-family: var(--serif-zh); font-size: 13px; line-height: 1.8; color: var(--muted); }
.ds-controls .btn:disabled { opacity: .45; cursor: wait; }
.ds-card { font: inherit; color: inherit; background: transparent; }

@media (max-width: 520px) {
  .ds-poem { font-size: 18px; line-height: 1.8; letter-spacing: .01em; }
  .ds-grid { grid-template-columns: 1fr 1fr; }
  .ds-card { padding: 14px 12px 12px; }
  .ds-card .t { font-size: 17px; }
}

.ds-card { min-width: 0; overflow: hidden; }
.ds-card .p { max-width: 100%; }

html[data-lang="en"] .ds-result-title,
html[data-lang="en"] .ds-poem,
html[data-lang="en"] .ds-intent,
html[data-lang="en"] .ds-aspect span,
html[data-lang="en"] .ds-story { font-family: var(--serif); }
.ds-card .t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

@media (max-width: 520px) {
  html[data-lang="en"] .ds-grid { grid-template-columns: 1fr; }
}


/* square/tablet: keep the tube beside the question until true phone width */
@media (max-width: 640px) {
  .ds-cast { grid-template-columns: 1fr; }
  .ds-tube { min-height: 210px; border-right: 0; border-bottom: 1px solid rgba(238,230,212,.14); padding: 20px; }
  .ds-tube-sticks { height: 150px; width: 160px; }
  .ds-tube-sticks i { transform: scaleY(.62) rotate(var(--r,0deg)); transform-origin: bottom center; }
  .ds-tube-label { font-size: 20px; }
}

@media (max-width: 640px) {
  .ds-tube { min-height: 0; padding: 14px; }
  .ds-tube-sticks { height: 120px; width: 150px; }
  .ds-tube-sticks i { transform: scaleY(.5) rotate(var(--r, 0deg)); }
  .ds-tube-label { font-size: 18px; margin-top: 6px; padding: 7px 3px; }
  .ds-tube-sub { margin-top: 8px; }
}

@media (max-width: 820px) {
  .ds-cast-side { width: 100%; justify-content: space-between; }
  .ds-cast-mark { width: 72px; height: 82px; }
}
@media (max-width: 520px) {
  .ds-cast-mark { display: none; }
  .ds-cast-side { display: block; }
}

/* Paper form inside the tea-brown stage: half sign-tube, half desk. */
.ds-cast { background: #f2e8d6; border-color: rgba(180, 81, 58, .28); box-shadow: 0 26px 60px -46px rgba(0, 0, 0, .55); }
.ds-tube { background: #3a2b22; border-right-color: rgba(240, 228, 207, .16); }
.ds-cast-body { background: #f2e8d6; color: var(--ink); }
.ds-cast-body .label { color: var(--muted); }
.ds-cast-body .ds-input { color: var(--ink); border-bottom-color: rgba(23, 23, 19, .28); }
.ds-cast-body .ds-input::placeholder { color: rgba(23, 23, 19, .34); }
.ds-cast-body .ds-input:focus { border-bottom-color: #b4513a; }
.ds-cast-body .ds-ghost { color: var(--ink-2); border-color: rgba(23, 23, 19, .26); }
.ds-cast-body .ds-ghost:hover { background: rgba(23, 23, 19, .06); color: var(--ink); }
.ds-cast-body .ds-hint { color: rgba(23, 23, 19, .54); }
.ds-cast-body .btn:disabled { opacity: .5; }
