:root {
  --bg-1: #0f1729;
  --bg-2: #182642;
  --bg-3: #1e3558;
  --surface: rgba(246, 241, 228, 0.92);
  --surface-strong: #fbf7eb;
  --ink: #1a2230;
  --muted: #5f6878;
  --gold: #b88a46;
  --gold-soft: #dfc79a;
  --yang: #ae6134;
  --yin: #3b6e7d;
  --border-soft: rgba(34, 42, 58, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 15%, rgba(223, 199, 154, 0.18), transparent 35%),
    radial-gradient(circle at 84% 82%, rgba(244, 170, 121, 0.16), transparent 40%),
    linear-gradient(140deg, var(--bg-1), var(--bg-2) 46%, var(--bg-3));
  margin: 0;
  min-height: 100vh;
  padding: 2rem 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow-x: hidden;
}

.ambient {
  position: fixed;
  inset: -20% auto auto -15%;
  width: 540px;
  height: 540px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(223, 199, 154, 0.18), transparent 62%);
  pointer-events: none;
  filter: blur(2px);
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.14;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.6) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
}

.app {
  position: relative;
  width: min(860px, 100%);
  border-radius: 28px;
  padding: clamp(1.1rem, 3vw, 2.1rem);
  border: 1px solid rgba(223, 199, 154, 0.38);
  background: linear-gradient(150deg, rgba(243, 236, 220, 0.92), rgba(248, 243, 232, 0.85));
  box-shadow:
    0 20px 60px rgba(5, 9, 19, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(6px);
  animation: riseIn 0.85s cubic-bezier(0.17, 0.84, 0.44, 1);
}

.hero {
  text-align: center;
  max-width: 620px;
  margin: 0 auto 1.25rem auto;
}

.eyebrow {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--gold);
  margin: 0;
}

.hero h1 {
  margin: 0.35rem 0 0.4rem;
  font-size: clamp(2.3rem, 6vw, 3.6rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: 0.01em;
  font-family: "Cormorant Garamond", serif;
}

.hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

main {
  display: grid;
  gap: 1rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  padding: 1.1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.panel-action {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 0.7rem;
  background: linear-gradient(160deg, rgba(250, 246, 236, 0.9), rgba(240, 230, 210, 0.82));
}

.field-label {
  width: 100%;
  text-align: left;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #49556b;
}

textarea,
select {
  width: 100%;
  border: 1px solid rgba(33, 44, 65, 0.18);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.92rem;
  color: #1d2b40;
  background: rgba(255, 252, 246, 0.92);
  padding: 0.65rem 0.72rem;
}

textarea {
  resize: vertical;
  min-height: 76px;
}

textarea:focus,
select:focus {
  outline: 2px solid rgba(184, 138, 70, 0.35);
  border-color: rgba(184, 138, 70, 0.7);
}

button {
  border: none;
  background: linear-gradient(125deg, #8f622f, #b88a46 48%, #d2ad70);
  color: #fffaf2;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.92rem 1.65rem;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.22s ease, filter 0.22s ease, box-shadow 0.22s ease;
  box-shadow: 0 10px 24px rgba(128, 85, 33, 0.28);
}

button:hover {
  transform: translateY(-1px);
  filter: saturate(1.08);
  box-shadow: 0 14px 28px rgba(102, 69, 27, 0.36);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  box-shadow: none;
  transform: none;
  filter: grayscale(0.15);
}

.status {
  display: none;
}

.status.ok {
  color: #2c6c4f;
}

.status.error {
  color: #94483b;
}

.action-row {
  width: 100%;
  display: flex;
  justify-content: center;
}

.share-config {
  width: 100%;
  display: grid;
  gap: 0.45rem;
}

.share-config label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #52627a;
}

.switch-line {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.switch-line input {
  width: auto;
}

.btn-secondary,
.btn-ghost {
  background: rgba(34, 42, 58, 0.09);
  color: #273346;
  box-shadow: none;
}

.btn-secondary:hover,
.btn-ghost:hover {
  box-shadow: none;
  filter: none;
}

.btn-ghost {
  padding: 0.58rem 0.95rem;
  font-size: 0.82rem;
}

#resultado {
  display: grid;
  gap: 0.72rem;
}

.placeholder {
  margin: 0;
  color: var(--muted);
  text-align: center;
  padding: 1rem 0.3rem;
}

.ritual {
  background: linear-gradient(160deg, rgba(251, 246, 234, 0.92), rgba(241, 232, 212, 0.92));
  border: 1px solid rgba(34, 42, 58, 0.1);
  border-radius: 16px;
  padding: 1rem;
  display: grid;
  gap: 0.8rem;
  animation: revealUp 0.3s ease;
}

.ritual-title {
  margin: 0;
  text-align: center;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #61461f;
}

.ritual-coins {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.ritual-note {
  margin: 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.86rem;
}

.coins-line {
  display: flex;
  align-items: center;
  gap: 0.56rem;
  background: var(--surface-strong);
  border: 1px solid rgba(33, 44, 65, 0.08);
  border-radius: 12px;
  padding: 0.6rem 0.72rem;
  opacity: 0;
  animation: revealUp 0.4s ease forwards;
}

.line-index {
  min-width: 72px;
  font-size: 0.77rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.coin {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.85rem;
  opacity: 0;
  transform: translateY(-9px) scale(0.96);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.coin-yang {
  background: linear-gradient(140deg, #96532f, var(--yang));
}

.coin-yin {
  background: linear-gradient(140deg, #2f6170, var(--yin));
}

.coin-anim {
  animation: coinDrop 0.5s cubic-bezier(0.14, 0.87, 0.37, 1) forwards;
}

.line {
  margin-left: auto;
  font-weight: 700;
  color: #1e2a3a;
  text-align: right;
}

.interpretacion {
  margin-top: 0.6rem;
  background: linear-gradient(160deg, rgba(250, 244, 230, 1), rgba(245, 236, 220, 0.95));
  border: 1px solid rgba(34, 42, 58, 0.11);
  border-radius: 16px;
  padding: 1rem;
  animation: revealUp 0.6s ease;
}

.interpretacion h2 {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.interpretacion h3 {
  margin: 0.4rem 0 0.55rem;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.3rem, 3.8vw, 1.85rem);
  color: #1f2d42;
}

.interpretacion p {
  margin: 0;
  color: #334157;
  line-height: 1.65;
}

.meta {
  margin-top: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  background: rgba(34, 42, 58, 0.08);
  color: #253246;
  border-radius: 999px;
  padding: 0.35rem 0.62rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.panel-history {
  grid-column: 1 / -1;
}

.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.history-actions {
  display: flex;
  gap: 0.45rem;
}

.history-head h2 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.4rem;
  color: #213047;
}

.history-list {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.55rem;
}

.history-item {
  border: 1px solid rgba(34, 42, 58, 0.1);
  border-radius: 12px;
  background: rgba(251, 247, 238, 0.88);
  padding: 0.66rem 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.history-item:hover {
  border-color: rgba(184, 138, 70, 0.5);
}

.history-item.active {
  border-color: rgba(139, 101, 44, 0.7);
  background: rgba(243, 231, 208, 0.8);
}

.history-item strong {
  display: block;
  color: #22324a;
}

.history-item span {
  display: block;
  margin-top: 0.14rem;
  font-size: 0.85rem;
  color: #617086;
}

.history-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.history-check input {
  margin: 0;
}

.panel-insights {
  grid-column: 1 / -1;
}

.panel-insights h2 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.4rem;
  color: #213047;
}

.insights-grid {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.6rem;
}

.insight-card {
  border: 1px solid rgba(34, 42, 58, 0.1);
  border-radius: 12px;
  background: rgba(251, 247, 238, 0.9);
  padding: 0.66rem 0.75rem;
}

.insight-card small {
  display: block;
  color: #667287;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
}

.insight-card strong {
  display: block;
  margin-top: 0.28rem;
  color: #1f2f47;
  font-size: 1rem;
}

.comparison {
  margin-top: 0.6rem;
  border: 1px solid rgba(34, 42, 58, 0.12);
  border-radius: 12px;
  background: rgba(251, 247, 238, 0.88);
  padding: 0.75rem;
}

.comparison h4 {
  margin: 0;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #75551f;
}

.comparison p {
  margin: 0.4rem 0 0;
}

@keyframes coinDrop {
  0% {
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
  }
  72% {
    opacity: 1;
    transform: translateY(3px) scale(1);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

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

@media (min-width: 720px) {
  main {
    grid-template-columns: 230px 1fr;
    align-items: start;
  }

  .panel-action {
    position: sticky;
    top: 1.2rem;
  }
}

@media (max-width: 520px) {
  body {
    padding: 1rem 0.7rem;
  }

  .app {
    border-radius: 20px;
    padding: 0.9rem;
  }

  .coins-line {
    padding: 0.55rem;
    gap: 0.42rem;
  }

  .line-index {
    min-width: 66px;
    font-size: 0.72rem;
  }

  .coin {
    width: 1.8rem;
    height: 1.8rem;
    font-size: 0.8rem;
  }

  .line {
    font-size: 0.88rem;
  }

  .history-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
