:root {
  --bg: #080807;
  --panel: rgba(23, 22, 19, 0.72);
  --text: #f0eadc;
  --muted: #a9a08f;
  --line: rgba(238, 225, 196, 0.2);
  --gold: #c7ad75;
  --green: #8b9b73;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Times New Roman", "Songti SC", "STSong", serif;
  overflow: hidden;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

#particleCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background:
    radial-gradient(circle at 50% 30%, rgba(88, 99, 69, 0.18), transparent 30%),
    radial-gradient(circle at 18% 78%, rgba(74, 53, 45, 0.24), transparent 24%),
    #080807;
}

.app {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
}

.screen {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 22px;
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 900ms ease, transform 1100ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.screen.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  max-width: 12em;
  margin: 0;
  text-align: center;
  font-weight: 400;
  line-height: 1.32;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(32px, 8vw, 60px);
}

h1 span {
  display: block;
  white-space: nowrap;
}

h2 {
  font-size: clamp(27px, 7.5vw, 46px);
}

.ritual-table {
  position: relative;
  width: 210px;
  height: 230px;
  display: grid;
  place-items: end center;
  margin-bottom: 8px;
}

.crystal-orb,
.loading-orb {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid rgba(232, 222, 195, 0.34);
  border-radius: 50%;
  background:
    radial-gradient(circle at 48% 36%, rgba(236, 232, 212, 0.38), transparent 12%),
    radial-gradient(circle at 50% 52%, rgba(128, 142, 102, 0.34), transparent 44%),
    rgba(255, 255, 255, 0.03);
  box-shadow: 0 0 70px rgba(156, 169, 119, 0.2), inset 0 0 42px rgba(255, 255, 255, 0.08);
}

.crystal-orb {
  width: 154px;
  height: 154px;
  animation: breathe 5s ease-in-out infinite;
}

.crystal-orb.is-awake {
  animation: orbAwaken 920ms ease both;
}

.orb-plant,
.loading-orb span {
  width: 54px;
  height: 78px;
  border-left: 1px solid rgba(222, 232, 198, 0.7);
  border-radius: 60% 0 0 0;
  transform: rotate(-12deg);
}

.orb-plant::before,
.orb-plant::after,
.loading-orb span::before,
.loading-orb span::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 12px;
  border: 1px solid rgba(222, 232, 198, 0.58);
  border-radius: 50%;
}

.orb-plant::before,
.loading-orb span::before {
  transform: translate(10px, 22px) rotate(24deg);
}

.orb-plant::after,
.loading-orb span::after {
  transform: translate(-17px, 42px) rotate(-22deg);
}

.specimen-line {
  position: absolute;
  bottom: 22px;
  width: 190px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(210, 191, 145, 0.62), transparent);
}

.primary-button,
.secondary-button {
  min-width: 154px;
  min-height: 48px;
  border: 1px solid rgba(227, 211, 174, 0.5);
  color: var(--text);
  background: rgba(35, 32, 26, 0.72);
  border-radius: 999px;
  transition: transform 240ms ease, border-color 240ms ease, background 240ms ease;
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-2px);
  border-color: rgba(238, 225, 196, 0.9);
  background: rgba(68, 60, 42, 0.86);
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
  width: min(100%, 460px);
}

.color-choice,
.choice-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(18, 17, 15, 0.58);
  backdrop-filter: blur(18px);
}

.color-choice {
  display: grid;
  justify-items: center;
  gap: 9px;
  min-height: 90px;
  padding: 14px 10px;
  border-radius: 8px;
}

.color-choice span {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--swatch);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 24px color-mix(in srgb, var(--swatch), transparent 58%);
}

.color-choice b {
  font-weight: 400;
}

.color-choice.is-selected {
  border-color: rgba(232, 222, 195, 0.9);
  background: rgba(62, 56, 42, 0.62);
}

.choice-list {
  display: grid;
  gap: 12px;
  width: min(100%, 520px);
  transition: opacity 360ms ease, transform 360ms ease;
}

.choice-list.is-leaving {
  opacity: 0;
  transform: translateY(8px);
}

.choice-button {
  min-height: 62px;
  padding: 16px 18px;
  border-radius: 8px;
  text-align: left;
  line-height: 1.45;
}

.quiet-note {
  margin: -12px 0 0;
  color: var(--muted);
}

textarea {
  width: min(100%, 520px);
  min-height: 136px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--text);
  background: rgba(18, 17, 15, 0.72);
  outline: none;
}

textarea::placeholder {
  color: rgba(240, 234, 220, 0.42);
}

.screen-loading {
  gap: 28px;
}

.loading-orb {
  width: 172px;
  height: 172px;
  animation: pulse 3s ease-in-out infinite;
}

.loading-text {
  color: var(--muted);
  letter-spacing: 0.08em;
}

.screen-result {
  align-content: center;
  gap: 16px;
  overflow-y: auto;
  padding-block: 18px;
}

.share-card {
  width: min(100%, 420px);
  min-height: 650px;
  padding: 16px 18px 22px;
  border: 1px solid rgba(221, 207, 169, 0.42);
  border-radius: 8px;
  color: #29251e;
  background:
    linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.72)),
    #f7f3e9;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
}

.card-topline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #766d5b;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.plant-frame {
  display: grid;
  place-items: center;
  height: 330px;
  margin: 14px 0 12px;
  border: 1px solid rgba(60, 49, 32, 0.14);
  background: #fff;
}

.plant-frame img {
  display: block;
  width: auto;
  height: auto;
  max-width: 90%;
  max-height: 270px;
  object-fit: contain;
}

.share-card h2 {
  max-width: none;
  margin-top: 18px;
  color: #242019;
  font-size: 38px;
}

.result-title {
  margin: 8px 0 14px;
  color: #5d5142;
  text-align: center;
  line-height: 1.55;
}

.keyword-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.keyword-row span {
  padding: 5px 10px;
  border: 1px solid rgba(67, 55, 36, 0.22);
  border-radius: 999px;
  color: #4e4437;
  font-size: 13px;
}

.description {
  margin: 16px auto 0;
  max-width: 23em;
  color: #3c352b;
  line-height: 1.7;
  text-align: center;
}

.poem {
  margin: 16px 0 0;
  color: #776952;
  text-align: center;
}

.result-actions {
  width: min(100%, 420px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

@keyframes breathe {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 60px rgba(156, 169, 119, 0.18), inset 0 0 42px rgba(255, 255, 255, 0.08);
  }
  50% {
    box-shadow: 0 0 110px rgba(203, 195, 143, 0.34), inset 0 0 62px rgba(255, 255, 255, 0.12);
  }
}

@keyframes orbAwaken {
  0% {
    transform: translateY(0) scale(1);
    border-color: rgba(232, 222, 195, 0.34);
    box-shadow: 0 0 70px rgba(156, 169, 119, 0.2), inset 0 0 42px rgba(255, 255, 255, 0.08);
  }
  42% {
    transform: translateY(-4px) scale(1.06);
    border-color: rgba(245, 232, 183, 0.88);
    box-shadow: 0 0 48px rgba(245, 232, 183, 0.64), 0 0 130px rgba(154, 177, 112, 0.42),
      inset 0 0 68px rgba(255, 255, 255, 0.22);
  }
  100% {
    transform: translateY(-2px) scale(1.02);
    border-color: rgba(232, 222, 195, 0.48);
    box-shadow: 0 0 34px rgba(245, 232, 183, 0.34), 0 0 92px rgba(154, 177, 112, 0.28),
      inset 0 0 52px rgba(255, 255, 255, 0.14);
  }
}

@media (max-width: 520px) {
  .screen {
    padding: 22px;
  }

  h1 {
    font-size: 31px;
    line-height: 1.36;
  }

  .screen-home {
    gap: 18px;
  }

  .ritual-table {
    width: 184px;
    height: 198px;
    margin-bottom: 2px;
  }

  .crystal-orb {
    width: 136px;
    height: 136px;
  }

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

  .color-choice {
    min-height: 76px;
  }

  .share-card {
    min-height: auto;
  }

  .plant-frame {
    height: 260px;
  }

  .share-card h2 {
    font-size: 34px;
  }

  .plant-frame img {
    max-height: 210px;
  }

  .result-actions {
    gap: 8px;
  }

  .result-actions .secondary-button {
    min-width: 128px;
  }
}
