* {
  box-sizing: border-box;
}

:root {
  --page-bg: #f5f3f7;
  --card-bg: #ffffff;
  --ink: #28232c;
  --line: #40383d;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: var(--ink);
  background: var(--page-bg);
}

.page {
  width: min(900px, 96%);
  margin: 0 auto;
  padding: 22px 0 30px;
}

.page-header {
  margin-bottom: 18px;
}

.back-link {
  color: #6d3d80;
  text-decoration: none;
  font-size: 14px;
}

h1 {
  margin: 14px 0 0;
  font-size: clamp(26px, 4vw, 36px);
}

.star-card {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid #e7e0eb;
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 8px 24px rgb(39 24 48 / 6%);
}

.star {
  display: block;
  width: min(100%, 720px);
  height: auto;
  margin: 0 auto;
}

.star-outline {
  fill: none;
  stroke: var(--line);
  stroke-width: 6;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.inner-lines {
  fill: none;
  stroke: #8a838b;
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
}

.node {
  stroke: #fff;
  stroke-width: 4;
}

.node-top,
.node-bottom-left,
.node-bottom-right {
  fill: #8d1729;
}

.node-left {
  fill: #b40bc5;
}

.node-right {
  fill: #d91f3f;
}

.main-number {
  fill: #fff;
  font-size: 23px;
  font-weight: 700;
  text-anchor: middle;
}

.inner-node circle {
  stroke: #fff;
  stroke-width: 3;
}

.inner-node text {
  fill: #fff;
  font-size: 19px;
  font-weight: 700;
  text-anchor: middle;
}

.inner-blue { fill: #2563eb; }
.inner-cyan { fill: #06a5c9; }
.inner-green { fill: #16a34a; }
.inner-yellow { fill: #eab308; }
.inner-orange { fill: #f97316; }

@media (max-width: 600px) {
  .page {
    width: calc(100% - 12px);
    padding-top: 14px;
  }

  .star-card {
    padding: 3px;
    border-radius: 12px;
  }
}

/* Visi iekšējie cipari, ieskaitot apakšējo pozīciju, ir vienādā izmērā */
.small-nodes circle {
  fill: #f0edef;
  stroke: #ffffff;
  stroke-width: 2.5;
}

.small-nodes text {
  fill: #4d454e;
  font-size: 17px;
  font-weight: 600;
  text-anchor: middle;
}

.theme-value-list {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.theme-value-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 4px 9px;
  border-radius: 20px;
  background: #eee7f7;
  color: #65409a;
  font-weight: 600;
  font-size: 13px;
}
.theme-value-pill {
  cursor: pointer;
}
.theme-path {
  margin: 10px 0;
}

.theme-path .theme-value-list {
  display: flex;
}

/* Galvenā ceļa enerģijas */
.theme-value-pill.theme-main-path {
  background: #dceafe;
  color: #2857a4;
  border: 1px solid #b9d0f5;
}

/* Pārējās enerģijas paliek lillā */
.theme-value-pill {
  background: #eee7f7;
  color: #65409a;
}

/* Visu tēmu enerģijas */
.theme-value-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 4px 9px;
  margin: 2px;
  border-radius: 20px;
  background: #eee7f7;
  color: #65409a;
  font-size: 13px;
  font-weight: 600;
}

/* Galvenā ceļa enerģijas kopējā sarakstā */
.theme-value-pill.theme-main-path {
  background: #dceafe;
  color: #2857a4;
  border: 1px solid #b9d0f5;
}

/* Aprēķināšanas poga */
#calculateBtn,
#calculate,
button[type="submit"] {
  background: #65409a;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

/* Uzvedot kursoru */
#calculateBtn:hover,
#calculate:hover,
button[type="submit"]:hover {
  background: #503078;
  transform: translateY(-1px);
}

/* Nospiežot pogu */
#calculateBtn:active,
#calculate:active,
button[type="submit"]:active {
  transform: translateY(0);
}

/* Tastatūras pieejamība */
#calculateBtn:focus-visible,
#calculate:focus-visible,
button[type="submit"]:focus-visible {
  outline: 2px solid #a78bca;
  outline-offset: 3px;
}

/* Piecstaru zvaigznes kalkulatora poga */
#calculateBtn {
    min-width: 130px;
    min-height: 44px;
    padding: 10px 22px;
    border: none;
    border-radius: 12px;
    background: #a89652;
    color: #fff;
    font-family: Arial, sans-serif;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: .3s;
}

#calculateBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
}

#calculateBtn:active {
    transform: translateY(0);
}

/* Dzimšanas datuma ievades lauks */
#birthDate {
    width: 280px;
    height: 48px;
    padding: 0 16px;
    border: 1px solid #d8d1c7;
    border-radius: 12px;
    background: #fff;
    color: #333;
    font-family: Arial, sans-serif;
    font-size: 16px;
    outline: none;
    transition: border-color .25s, box-shadow .25s;
}

/* Kad ievades lauks ir aktīvs */
#birthDate:focus {
    border-color: #a89652;
    box-shadow: 0 0 8px rgba(168, 150, 82, .25);
}

/* Datuma izvēles ikona */
#birthDate::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: .75;
}

/* Mazākiem ekrāniem */
@media (max-width: 768px) {
    #birthDate {
        width: 100%;
        max-width: 320px;
        height: 48px;
        font-size: 16px;
    }
}
.energy-overview {
    margin: 30px 0;
    padding: 24px;
    background: #fff;
    border: 1px solid #d8d1c7;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(70, 55, 35, 0.06);
}

.energy-overview h2 {
    margin-top: 0;
    margin-bottom: 8px;
    color: #6e573e;
    font-size: 1.35rem;
}

.energy-overview-hint {
    margin-bottom: 20px;
    color: #766d62;
    font-size: 0.9rem;
}

.energy-overview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.overview-energy-group {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 10px;
    background: #f7f3ee;
    border: 1px solid #e5ddd2;
    border-radius: 12px;
}

.overview-energy-items {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.overview-energy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 34px;
    padding: 5px 8px;
    background: #eee5f5;
    color: #4f3b62;
    border: 1px solid #d8c8e6;
    border-radius: 50%;
    font-weight: 700;
    cursor: help;
    transition: transform 0.15s ease;
}

.overview-energy:hover {
    transform: scale(1.12);
    background: #e2d3ef;
}

.overview-energy-count {
    color: #6e573e;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .energy-overview {
        padding: 16px;
    }

    .energy-overview-list {
        gap: 8px;
    }
}

.energy-modal[hidden] {
  display: none !important;
}

.energy-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(35, 29, 23, 0.65);
}

.energy-modal-content {
  position: relative;
  width: 100%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 30px;
  background: #f4f0eb;
  color: #333;
  border: 1px solid #d8d1c7;
  border-radius: 16px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.2);
}

.energy-modal-content h2 {
  margin: 0 35px 24px 0;
  color: #6e573e;
}

.energy-modal-content h3 {
  margin-bottom: 8px;
  color: #6e573e;
  font-size: 1.05rem;
}

.energy-text-section {
  margin-top: 20px;
  padding: 16px;
  background: #fff;
  border-radius: 12px;
  line-height: 1.6;
}

.energy-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: #a89652;
  color: #fff;
  font-size: 26px;
  cursor: pointer;
}

.energy-value-clickable {
  cursor: pointer;
}

.energy-value-clickable:hover {
  filter: brightness(0.94);
}

@media (max-width: 600px) {
  .energy-modal-content {
    padding: 20px 16px;
  }
}


/* Kompakti divu trijstūru izkārtojums pirmajā tēmas kartītē.
   Izmanto esošo kartītes platumu, to nepalielinot. */
.theme-card-triangles {
  min-width: 0;
  padding: 1rem;
}

.theme-triangle-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  width: 100%;
  min-width: 0;
}

.theme-triangle {
  min-width: 0;
  text-align: center;
}

.theme-triangle h3 {
  min-height: 2.5em;
  margin: 0 0 8px;
  font-size: clamp(0.72rem, 2.5vw, 0.9rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.triangle-values {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.triangle-top,
.triangle-bottom {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-width: 0;
}

.theme-triangle .theme-value-pill {
  box-sizing: border-box;
  min-width: 28px;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  flex: 0 1 32px;
  font-size: 0.78rem;
  border-radius: 50%;
}


/* Talantu izcelsmes norādes zem attiecīgajiem violetajiem skaitļiem. */
.triangle-item {
  display: flex;
  flex: 0 1 50%;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  line-height: 1.15;
  color: #65409a;
}

.triangle-item .triangle-caption {
  display: block;
  max-width: 82px;
  margin-top: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.65rem;
  font-weight: 400;
  line-height: 1.15;
}

.triangle-item .theme-value-pill {
  flex: 0 0 32px;
}

.theme-triangle .theme-purple-value {
  background: #eee7f7;
  color: #65409a;
  border: 1px solid #dfd0ef;
}

.theme-triangle .theme-blue-value {
  background: #dceafe;
  color: #2857a4;
  border: 1px solid #b9d0f5;
}

.theme-triangle-description {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  line-height: 1.4;
}

@media (max-width: 360px) {
  .theme-card-triangles {
    padding: 0.7rem;
  }

  .theme-triangle-pair {
    gap: 4px;
  }

  .theme-triangle .theme-value-pill {
    width: 27px;
    height: 27px;
    min-width: 27px;
    flex-basis: 27px;
    font-size: 0.7rem;
  }

  .triangle-item { font-size: 0.58rem; }
  .triangle-item .triangle-caption { font-size: 0.58rem; }
  .triangle-item .theme-value-pill { flex-basis: 27px; }
}


/* Pagātnes kļūdu uzraksts tikai zem zilā trijstūra. */
.triangle-caption {
  margin-top: 5px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.2;
  text-align: center;
}


/* Nodrošina, ka teksts "Pagātnes kļūdas" ir redzams zem zilajiem trijstūriem. */
.theme-triangle-blue .triangle-caption-past-errors {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  width: 100%;
  margin: 5px 0 0 !important;
  color: var(--ink) !important;
  font-size: 0.78rem !important;
  font-weight: 400 !important;
  line-height: 1.2 !important;
  text-align: center !important;
}


/* Dzimtas dāvanu sadaļas virsraksti — tāds pats hierarhijas stils kā pārējā logā. */
.energy-modal-content .lineage-gift-section > h4:first-child {
  margin: 0 0 18px;
  color: #6e573e;
  font-family: inherit;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.4;
  text-transform: lowercase !important;
}

/* Pirmajam burtam jābūt lielajam: “Dāvanas pa tēva/mātes līniju”. */
.energy-modal-content .lineage-gift-section > h4:first-child::first-letter {
  text-transform: uppercase;
}

/* Apakšvirsraksti tādā pašā stilā kā “Praktiskie attīstības uzdevumi”. */
.energy-modal-content .lineage-gift-section > h4:not(:first-child) {
  margin: 18px 0 8px;
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  text-transform: none !important;
}

.energy-modal-content .lineage-gift-section > p {
  margin: 0 0 12px;
  line-height: 1.6;
}

/* =========================================
   PIESTARU ZVAIGZNES TĒMU KARTĪTES
   Saskaņots ar SofiMagic silto krāsu paleti.
   ========================================= */
.themes-section {
  margin-top: 2rem;
  padding: clamp(1rem, 2.5vw, 1.6rem);
  background: #fffdfa;
  border: 1px solid #e5d9c8;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgb(70 55 35 / 6%);
}

.themes-section > h2 {
  margin: 0 0 0.55rem;
  color: #8a633c;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.65rem, 3vw, 2rem);
  line-height: 1.2;
}

.themes-section .themes-intro {
  margin: 0 0 1.25rem;
  color: #655b50;
  font-size: 0.96rem;
  line-height: 1.65;
  max-width: 75ch;
}

.themes-section .themes-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 1rem;
}

.themes-section .theme-card {
  min-width: 0;
  padding: 1.1rem;
  background: #fff;
  border: 1px solid #e8dfd3;
  border-radius: 15px;
  box-shadow: 0 3px 12px rgb(70 55 35 / 4%);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.themes-section .theme-card:hover {
  border-color: #d4c19f;
  box-shadow: 0 7px 18px rgb(70 55 35 / 8%);
  transform: translateY(-2px);
}

.themes-section .theme-card > h3 {
  margin: 0 0 0.6rem;
  color: #755638;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.themes-section .theme-card > p {
  margin: 0.35rem 0 0.75rem;
  color: #5e574f;
  font-size: 0.9rem;
  line-height: 1.55;
}

.themes-section .theme-points {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.themes-section .theme-value-pill {
  min-width: 32px;
  min-height: 32px;
  margin: 0;
  padding: 0.3rem 0.55rem;
  border: 1px solid #dfd1e9;
  border-radius: 999px;
  background: #f0e8f6;
  color: #65457c;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.1;
  cursor: pointer;
  transition: transform 150ms ease, filter 150ms ease, box-shadow 150ms ease;
}

.themes-section .theme-value-pill:hover,
.themes-section .theme-value-pill:focus-visible {
  filter: brightness(0.97);
  box-shadow: 0 0 0 3px rgb(168 150 82 / 18%);
  transform: translateY(-1px);
  outline: none;
}

.themes-section .theme-value-pill.theme-main-path {
  background: #e4edf9;
  color: #315b91;
  border-color: #c5d7ee;
}

.themes-section .theme-card .theme-triangle-description {
  margin-bottom: 0.9rem;
}

.themes-section .theme-card-triangles {
  padding: 1.1rem;
}

.themes-section .theme-triangle-pair {
  gap: 0.75rem;
}

.themes-section .theme-triangle {
  padding: 0.65rem 0.4rem;
  border: 1px solid #eee7df;
  border-radius: 12px;
  background: #fdfbf8;
}

.themes-section .theme-triangle-purple {
  border-color: #e7d9ef;
  background: #fcf8ff;
}

.themes-section .theme-triangle-blue {
  border-color: #d9e4f4;
  background: #f7faff;
}

.themes-section .theme-triangle .theme-value-pill {
  min-width: 32px;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 50%;
}

.themes-section .triangle-item .triangle-caption,
.themes-section .triangle-caption {
  color: #655b50;
  font-size: 0.68rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.themes-section .theme-card-dzimtas-kludas {
  grid-column: 1 / -1;
  width: 100%;
}

.themes-section .dzimtas-kludas-row {
  padding: 0.55rem 0;
  border-top: 1px solid #f0e8dd;
}

.themes-section .dzimtas-kludas-row strong {
  color: #755638;
  font-size: 0.9rem;
}

.themes-section .themes-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 1rem;
  border: 1px dashed #d8c8b3;
  border-radius: 12px;
  background: #fbf7f1;
  color: #766d62;
  line-height: 1.55;
}

@media (max-width: 700px) {
  .themes-section .themes-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.8rem;
  }

  .themes-section .theme-card,
  .themes-section .theme-card-triangles {
    padding: 0.9rem;
  }

  .themes-section .theme-card > h3 {
    font-size: 1.28rem;
  }

  .themes-section .theme-triangle-pair {
    gap: 0.5rem;
  }

  .themes-section .theme-triangle {
    padding: 0.55rem 0.25rem;
  }
}

@media (max-width: 360px) {
  .themes-section {
    padding: 0.75rem;
  }

  .themes-section .theme-triangle-pair {
    gap: 0.35rem;
  }

  .themes-section .theme-triangle .theme-value-pill {
    width: 27px;
    height: 27px;
    min-width: 27px;
    min-height: 27px;
    flex-basis: 27px;
    font-size: 0.72rem;
  }
}

/* Tēmu kartīšu virsraksti — lielāki un vizuāli izcelti */
.themes-section .theme-card > h3 {
  margin: 0 0 0.7rem;
  padding-bottom: 0.45rem;
  color: #6f4c2c;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.45rem, 2vw, 1.7rem);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  border-bottom: 1px solid #e9dccb;
  text-wrap: balance;
}

.themes-section .theme-triangle h3 {
  font-size: 1rem;
  font-weight: 700;
}

@media (max-width: 700px) {
  .themes-section .theme-card > h3 {
    font-size: 1.45rem;
    padding-bottom: 0.4rem;
  }
}


.energy-order-description[hidden] {
  display: none !important;
}

.energy-order-description {
  margin: 1rem 0;
  padding: 1.1rem;
  border: 1px solid #e5d8c5;
  border-radius: 12px;
  background: #fffaf3;
  line-height: 1.6;
}

.energy-order-description h3 {
  margin-top: 0;
}

@media (max-width: 600px) {
  .theme-order-note {
    padding: 0.7rem;
  }

  .theme-order-link {
    width: 100%;
  }
}
