:root {
  --bg1: #fff1f6;
  --bg2: #ffe7d1;
  --accent: #ff5c8a;
  --text: #332531;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Comfortaa", system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% 10%, #ffe4ef, transparent 55%),
              radial-gradient(800px 600px at 90% 20%, #fff0dc, transparent 60%),
              linear-gradient(135deg, var(--bg1), var(--bg2));
}

.destiny-page {
  padding: 20px;
  display: grid;
  gap: 12px;
  max-width: 1200px;
  margin: 0 auto;
}

.destiny-hero {
  background: #fff;
  border-radius: 24px;
  padding: 18px 22px;
  box-shadow: 0 20px 40px rgba(255, 92, 138, 0.18);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.destiny-hero h1 {
  margin: 0;
  font-family: "Pacifico", cursive;
  color: var(--accent);
  font-size: 2.1rem;
}

.destiny-hero p {
  margin: 6px 0 0;
  color: #6c5064;
  max-width: 520px;
}

.hero-sub {
  font-size: 0.95rem;
  color: #8e6b82;
}

.hero-actions {
  display: flex;
  gap: 10px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-ok {
  background: var(--accent);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: #6c5064;
  border: 1px solid rgba(108, 80, 100, 0.3);
}

.destiny-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.destiny-story {
  background: #fff;
  border-radius: 20px;
  padding: 16px;
  border: 1px solid rgba(255, 92, 138, 0.2);
  box-shadow: 0 16px 30px rgba(255, 92, 138, 0.1);
  display: grid;
  gap: 8px;
}

.destiny-story h3 {
  margin: 0;
  color: #ff5c8a;
}

.destiny-story p {
  margin: 0;
  color: #6c5064;
  line-height: 1.5;
}

.person-card {
  background: #fff;
  border-radius: 20px;
  padding: 16px;
  border: 1px solid rgba(255, 92, 138, 0.2);
  box-shadow: 0 16px 30px rgba(255, 92, 138, 0.1);
  display: grid;
  gap: 12px;
}

.person-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.person-head h2 {
  margin: 0;
  color: #ff5c8a;
}

.tip {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  color: #ff5c8a;
  border: 1px solid rgba(255, 92, 138, 0.35);
  background: #fff7fb;
  position: relative;
  cursor: help;
}

.tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  min-width: 180px;
  max-width: 260px;
  background: #fff;
  border: 1px solid rgba(255, 92, 138, 0.25);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 0.8rem;
  color: #6c5064;
  box-shadow: 0 12px 24px rgba(255, 92, 138, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 5;
}

.tip:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

.person-note {
  font-size: 0.8rem;
  color: #9b8795;
  background: #fff7fb;
  border-radius: 999px;
  padding: 4px 10px;
}

.person-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.meta-label {
  font-size: 0.78rem;
  color: #8e6b82;
}

.meta-value {
  font-weight: 700;
  color: #5c3c50;
}

.meta-input {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 92, 138, 0.3);
  font-family: inherit;
  font-weight: 600;
  color: #5c3c50;
}

.signs-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.sign-pill {
  background: #fff7fb;
  border-radius: 16px;
  padding: 10px;
  border: 1px solid rgba(255, 92, 138, 0.18);
  display: grid;
  gap: 4px;
}

.sign-pill span {
  font-size: 0.85rem;
  color: #8e6b82;
}

.sign-pill strong {
  font-size: 1.05rem;
  color: #ff5c8a;
}

.planet-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px;
}

.planet-item {
  background: #fff;
  border: 1px dashed rgba(255, 92, 138, 0.2);
  border-radius: 14px;
  padding: 8px 10px;
  font-size: 0.86rem;
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.planet-item span {
  color: #6c5064;
}

.destiny-grid {
  column-width: 320px;
  column-gap: 12px;
}

.destiny-panel {
  background: #fff;
  border-radius: 20px;
  padding: 16px;
  border: 1px solid rgba(255, 92, 138, 0.2);
  box-shadow: 0 16px 30px rgba(255, 92, 138, 0.1);
  display: inline-grid;
  width: 100%;
  margin: 0 0 12px;
  gap: 12px;
  align-content: start;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
}

.destiny-panel h3 {
  margin: 0;
  color: #ff5c8a;
}

.panel-note {
  margin: 0;
  font-size: 0.9rem;
  color: #7a5d70;
  line-height: 1.4;
}

.destiny-panel.wide {
  column-span: all;
}

.compat-score {
  display: grid;
  gap: 8px;
}

.score-label {
  font-weight: 700;
  color: #6c5064;
}

.score-bar {
  height: 12px;
  border-radius: 999px;
  background: #ffe7f0;
  overflow: hidden;
}

.score-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ff6fb1, #ffb36b);
  transition: width 0.6s ease;
}

.score-value {
  font-weight: 700;
  color: #ff5c8a;
}

.compat-list,
.aspects-list,
.match-list {
  display: grid;
  gap: 8px;
  font-size: 0.92rem;
  color: #6c5064;
}

.moon-list,
.psycho-list,
.themes-list,
.roles-list,
.tips-list,
.forecast-list {
  display: grid;
  gap: 8px;
  font-size: 0.92rem;
  color: #6c5064;
}

.elements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.elements-card {
  background: #fff7fb;
  border-radius: 16px;
  padding: 12px;
  border: 1px dashed rgba(255, 92, 138, 0.2);
}

.elements-card h4 {
  margin: 0 0 8px;
  color: #ff5c8a;
}

.element-bar {
  display: grid;
  gap: 4px;
  margin-bottom: 6px;
}

.element-bar span {
  font-size: 0.82rem;
  color: #8e6b82;
}

.element-bar .bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 92, 138, 0.12);
  overflow: hidden;
}

.element-bar .fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ff6fb1, #ffd36b);
}

.energy-grid {
  display: grid;
  gap: 10px;
}

.energy-item {
  display: grid;
  gap: 4px;
}

.energy-item span {
  font-size: 0.85rem;
  color: #8e6b82;
}

.energy-item .bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 92, 138, 0.12);
  overflow: hidden;
}

.energy-item .fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #7a5cff, #ff9d5c);
}

.wheels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  align-items: center;
}

.wheel-card {
  background: #fff7fb;
  border-radius: 16px;
  padding: 12px;
  border: 1px dashed rgba(255, 92, 138, 0.2);
  text-align: center;
}

.wheel-card h4 {
  margin: 0 0 10px;
  color: #ff5c8a;
}

.wheel-card canvas {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1 / 1;
  height: auto;
  margin: 0 auto;
  display: block;
}

.houses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.house-card {
  background: #fff7fb;
  border-radius: 16px;
  padding: 12px;
  border: 1px dashed rgba(255, 92, 138, 0.2);
}

.house-card h4 {
  margin: 0 0 8px;
  color: #ff5c8a;
}

.house-list {
  display: grid;
  gap: 6px;
  font-size: 0.88rem;
  color: #6c5064;
}

.love-list {
  display: grid;
  gap: 8px;
  font-size: 0.92rem;
  color: #6c5064;
}

.matrix-grid,
.design-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.mode-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mode-chip {
  border: 1px solid rgba(255, 92, 138, 0.32);
  background: #fff;
  color: #7a5d70;
  border-radius: 999px;
  padding: 7px 12px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.mode-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 14px rgba(255, 92, 138, 0.14);
}

.mode-chip.active {
  background: linear-gradient(135deg, #ff7aa8, #ffb36b);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 18px rgba(255, 92, 138, 0.22);
}

.matrix-card,
.design-card {
  background: #fff7fb;
  border-radius: 16px;
  padding: 12px;
  border: 1px dashed rgba(255, 92, 138, 0.2);
  display: grid;
  gap: 8px;
}

.matrix-card h4,
.design-card h4 {
  margin: 0;
  color: #ff5c8a;
}

.matrix-meta,
.design-meta {
  font-size: 0.84rem;
  color: #7a5d70;
}

.matrix-cells {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.matrix-cell {
  background: #fff;
  border: 1px solid rgba(255, 92, 138, 0.18);
  border-radius: 10px;
  padding: 6px;
  display: grid;
  gap: 2px;
}

.matrix-cell strong {
  color: #ff5c8a;
  font-size: 0.86rem;
}

.matrix-cell span {
  font-size: 0.86rem;
  font-weight: 700;
  color: #5c3c50;
  min-height: 1.05em;
}

.matrix-cell small {
  font-size: 0.68rem;
  color: #8e6b82;
}

.matrix-cell.empty {
  opacity: 0.6;
}

.matrix-pair,
.design-pair {
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(255, 92, 138, 0.18);
  padding: 10px 12px;
  color: #6c5064;
  font-size: 0.9rem;
  display: grid;
  gap: 6px;
}

.matrix-pair p,
.design-pair p {
  margin: 0;
}

.design-line {
  font-size: 0.86rem;
  color: #6c5064;
}

.design-centers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.design-center {
  border-radius: 999px;
  border: 1px solid rgba(122, 93, 112, 0.3);
  color: #7a5d70;
  background: #fff;
  padding: 4px 8px;
  font-size: 0.73rem;
}

.design-center.active {
  border-color: rgba(255, 92, 138, 0.35);
  background: #ffe9f2;
  color: #c84776;
}

.destiny-footer {
  text-align: center;
  color: #7a5d70;
  font-size: 0.9rem;
}

.destiny-summary {
  margin: 0 auto 10px;
  max-width: 720px;
  background: #fff7fb;
  border-radius: 18px;
  border: 1px dashed rgba(255, 92, 138, 0.25);
  padding: 12px 16px;
  font-size: 1rem;
  color: #6c5064;
  box-shadow: 0 12px 24px rgba(255, 92, 138, 0.12);
  text-align: left;
  line-height: 1.5;
}

.destiny-summary p {
  margin: 0 0 10px;
}

.destiny-summary ul {
  margin: 0 0 10px 18px;
  padding: 0;
  display: grid;
  gap: 6px;
}

.destiny-summary li {
  color: #6c5064;
}

@media (max-width: 980px) {
  .destiny-page {
    padding: 12px;
    gap: 10px;
  }

  .destiny-hero {
    padding: 14px 16px;
    border-radius: 18px;
  }

  .destiny-hero h1 {
    font-size: 1.9rem;
  }

  .destiny-grid {
    column-width: 280px;
    column-gap: 10px;
  }
}

@media (max-width: 760px) {
  .destiny-page {
    padding: 10px;
    gap: 10px;
  }

  .destiny-hero h1 {
    font-size: 1.65rem;
  }

  .hero-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .hero-actions .btn {
    flex: 1 1 180px;
    text-align: center;
  }

  .destiny-controls {
    grid-template-columns: 1fr;
  }

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

  .signs-row,
  .planet-list,
  .elements-grid,
  .houses-grid,
  .matrix-grid,
  .design-grid {
    grid-template-columns: 1fr;
  }

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

  .wheel-card canvas {
    max-width: 300px;
  }

  .destiny-panel {
    padding: 12px;
    border-radius: 16px;
  }

  .tip::after {
    left: auto;
    right: 0;
    transform: none;
    min-width: 160px;
    max-width: 220px;
  }

  .tip:hover::after {
    transform: translateY(-4px);
  }

  .destiny-grid {
    column-count: 1;
    column-width: auto;
  }
}

@media (max-width: 520px) {
  .btn {
    padding: 10px 16px;
    font-size: 0.92rem;
  }

  .person-meta {
    grid-template-columns: 1fr;
  }

  .matrix-cells {
    gap: 5px;
  }

  .destiny-summary {
    font-size: 0.94rem;
    padding: 10px 12px;
  }
}
