:root {
  --bg: #120f0d;
  --bg-soft: #201815;
  --panel: rgba(245, 236, 220, 0.08);
  --panel-strong: rgba(248, 241, 227, 0.92);
  --ink: #f4ead9;
  --muted: rgba(244, 234, 217, 0.68);
  --accent: #d5ab63;
  --accent-strong: #b94a2d;
  --line: #f3e4c5;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Noto Serif SC", "Source Han Serif SC", "Microsoft YaHei", serif;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}

.stage-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.ritual-stage {
  position: relative;
  width: min(920px, 100%);
  min-height: min(92vh, 860px);
  padding: 20px 17px 16px;
  border-radius: 0;
  overflow: hidden;
  background: transparent;
}

.mist {
  position: absolute;
  inset: auto;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.28;
  pointer-events: none;
}

.mist-a {
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(213, 171, 99, 0.18);
}

.mist-b {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(185, 74, 45, 0.12);
}

.stage-header,
.stage-actions {
  position: relative;
  z-index: 1;
  text-align: center;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  padding: 6px;
  border: 1px solid rgba(213, 171, 99, 0.22);
  border-radius: 999px;
  background: rgba(245, 236, 220, 0.05);
}

.language-button {
  min-width: 64px;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.language-button:hover {
  color: var(--ink);
}

.language-button.is-active {
  color: #fff3df;
  background: rgba(185, 74, 45, 0.88);
}

.eyebrow {
  margin: 0 0 14px;
  letter-spacing: 0.24em;
  font-size: 12px;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: clamp(40px, 8vw, 76px);
  font-weight: 600;
}

.stage-status {
  margin: 10px auto 0;
  max-width: 420px;
  color: var(--muted);
  line-height: 1.8;
}

.altar {
  position: relative;
  z-index: 1;
  width: min(100%, 760px);
  aspect-ratio: 1 / 1;
  margin: 14px auto 12px;
  display: grid;
  place-items: center;
}

.altar-core {
  position: relative;
  width: 78%;
  height: 78%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(213, 171, 99, 0.1), rgba(213, 171, 99, 0.02) 44%, transparent 72%);
}

.idle-scene,
.line-scene,
.result-scene {
  width: 100%;
  display: grid;
  place-items: center;
  transition: opacity 420ms ease, transform 420ms ease;
}

.hidden {
  opacity: 0;
  transform: scale(0.97);
  pointer-events: none;
  position: absolute;
}

.idle-mark {
  margin: 0;
  font-size: clamp(88px, 18vw, 150px);
  line-height: 1;
  color: rgba(213, 171, 99, 0.8);
  text-shadow: 0 0 30px rgba(213, 171, 99, 0.12);
}

.idle-text {
  margin: 18px 0 0;
  color: var(--muted);
  letter-spacing: 0.16em;
}

.line-list {
  width: min(100%, 320px);
  display: grid;
  gap: 14px;
}

.line-item {
  width: 100%;
  min-height: 48px;
  padding: 14px 0;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: transparent;
  border: 0;
}

.line-item.is-revealing {
  animation: line-rise 420ms ease both;
}

.line-placeholder {
  letter-spacing: 0.18em;
  color: rgba(244, 234, 217, 0.42);
  background:
    linear-gradient(90deg, rgba(213, 171, 99, 0.05), rgba(255, 248, 238, 0.05), rgba(213, 171, 99, 0.05));
  background-size: 200% 100%;
  animation: breathing 1.4s linear infinite;
}

.line-drawing {
  display: flex;
  align-items: center;
  justify-content: center;
}

.yang,
.yin-left,
.yin-right {
  height: 10px;
  background: var(--line);
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(243, 228, 197, 0.16);
}

.yang {
  width: 154px;
}

.yin {
  display: flex;
  align-items: center;
  gap: 18px;
}

.yin-left,
.yin-right {
  width: 68px;
}

.line-scene.is-fading {
  animation: scene-fade-out 900ms ease forwards;
}

.result-card {
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
}

.keyword-only {
  width: min(100%, 620px);
}

.keyword-only-label {
  margin-bottom: 14px;
  font-size: 13px;
  letter-spacing: 0.28em;
  color: rgba(244, 234, 217, 0.58);
}

.keyword-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  align-items: center;
}

.keyword-only-text {
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.38;
  color: var(--accent);
  text-shadow:
    0 0 24px rgba(213, 171, 99, 0.18),
    0 10px 34px rgba(0, 0, 0, 0.28);
  animation: result-fade 720ms ease both;
}

.keyword-grid > :nth-child(2) .keyword-only-text {
  animation-delay: 120ms;
}

.keyword-grid > :nth-child(3) .keyword-only-text {
  animation-delay: 240ms;
}

.stage-actions {
  display: flex;
  justify-content: center;
}

.primary-button {
  min-width: 184px;
  border: 1px solid rgba(213, 171, 99, 0.24);
  border-radius: 999px;
  padding: 15px 28px;
  font-size: 16px;
  font-weight: 600;
  color: #fff3df;
  background:
    linear-gradient(135deg, rgba(185, 74, 45, 0.92) 0%, rgba(144, 49, 30, 0.96) 100%);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(213, 171, 99, 0.08) inset;
}

.primary-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

@keyframes line-rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes breathing {
  from {
    background-position: 0% 50%;
  }

  to {
    background-position: 200% 50%;
  }
}

@keyframes result-fade {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes scene-fade-out {
  from {
    opacity: 1;
    transform: scale(1);
  }

  to {
    opacity: 0;
    transform: scale(0.94);
  }
}

@media (max-width: 720px) {
  .stage-shell {
    padding: 12px;
  }

  .ritual-stage {
    min-height: 100vh;
    padding: 14px 11px 12px;
    border-radius: 0;
  }


  .altar {
    width: 100%;
    aspect-ratio: 1 / 1.15;
  }

  .altar-core {
    width: 86%;
    height: 70%;
  }

  .yang {
    width: 128px;
  }

  .yin-left,
  .yin-right {
    width: 56px;
  }

  .keyword-only-text {
    font-size: clamp(22px, 7vw, 30px);
  }

  .keyword-grid {
    grid-template-columns: 1fr;
  }

  .language-switch {
    margin-bottom: 18px;
  }
}
