:root {
  --bg: #070b1a;
  --bg-2: #0d1530;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --surface-soft: rgba(255, 255, 255, 0.72);
  --text: #111827;
  --text-on-dark: #f8fafc;
  --muted: #667085;
  --muted-on-dark: #b9c3d6;
  --primary: #6d5dfc;
  --primary-dark: #5145cd;
  --accent: #16c6a1;
  --accent-2: #f4b740;
  --danger: #d14334;
  --success: #087f5b;
  --border: rgba(148, 163, 184, 0.28);
  --shadow: 0 28px 90px rgba(2, 6, 23, 0.28);
  --glass: rgba(255, 255, 255, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 5%, rgba(109, 93, 252, 0.38), transparent 32rem),
    radial-gradient(circle at 92% 8%, rgba(22, 198, 161, 0.24), transparent 28rem),
    radial-gradient(circle at 60% 110%, rgba(244, 183, 64, 0.18), transparent 34rem),
    linear-gradient(135deg, var(--bg), var(--bg-2) 52%, #111a3a);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), transparent 74%);
}

a {
  color: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 54px;
  position: relative;
  z-index: 1;
}

.nav {
  align-items: center;
  backdrop-filter: blur(18px);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.18);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 28px;
  padding: 14px;
}

.brand {
  color: var(--text-on-dark);
  display: grid;
  gap: 2px 12px;
  grid-template-columns: 46px 1fr;
  align-items: center;
}

.brand::before {
  align-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(109, 93, 252, 0.36);
  color: #fff;
  content: "D";
  display: flex;
  font-size: 1.35rem;
  font-weight: 900;
  grid-row: span 2;
  height: 46px;
  justify-content: center;
  width: 46px;
}

.brand strong {
  font-size: 1.08rem;
  letter-spacing: 0.01em;
}

.brand span {
  color: var(--muted-on-dark);
  font-size: 0.92rem;
}

.muted {
  color: var(--muted);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 30px;
  box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 34px);
  position: relative;
}

.card::after {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.65), transparent 42%);
  border-radius: inherit;
  content: "";
  inset: 1px;
  pointer-events: none;
  position: absolute;
}

.card > * {
  position: relative;
  z-index: 1;
}

.hero {
  align-items: stretch;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
}

.hero .card:first-child {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(238, 242, 255, 0.88)),
    var(--surface);
  min-height: 440px;
  overflow: hidden;
}

.hero .card:first-child::before {
  background:
    radial-gradient(circle, rgba(109, 93, 252, 0.28), transparent 58%),
    radial-gradient(circle, rgba(22, 198, 161, 0.2), transparent 55%);
  border-radius: 999px;
  content: "";
  height: 340px;
  position: absolute;
  right: -120px;
  top: -90px;
  width: 340px;
}

.hero h1,
.page-title {
  color: #0f172a;
  font-size: clamp(2.7rem, 7vw, 5.4rem);
  letter-spacing: -0.075em;
  line-height: 0.94;
  margin: 22px 0 18px;
}

.hero p {
  color: #475467;
  font-size: clamp(1.02rem, 2vw, 1.18rem);
  line-height: 1.72;
  margin: 0;
  max-width: 58ch;
}

h2 {
  color: #111827;
  letter-spacing: -0.035em;
  margin: 0 0 18px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  color: #475467;
  display: block;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

input,
select,
textarea {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  color: var(--text);
  font: inherit;
  outline: none;
  padding: 15px 16px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  width: 100%;
}

textarea {
  min-height: 122px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(109, 93, 252, 0.8);
  box-shadow: 0 0 0 5px rgba(109, 93, 252, 0.14);
  transform: translateY(-1px);
}

.button,
button {
  align-items: center;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border: 0;
  border-radius: 16px;
  box-shadow: 0 14px 28px rgba(109, 93, 252, 0.26);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 900;
  justify-content: center;
  min-height: 46px;
  padding: 13px 19px;
  text-decoration: none;
  transition: box-shadow 0.2s, filter 0.2s, transform 0.2s;
}

.button:hover,
button:hover {
  box-shadow: 0 18px 34px rgba(109, 93, 252, 0.34);
  filter: saturate(1.06);
  transform: translateY(-2px);
}

.button.secondary,
button.secondary {
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  color: #332ca4;
}

.button.danger,
button.danger {
  background: linear-gradient(135deg, #ffe5e0, #ffd2ca);
  box-shadow: none;
  color: var(--danger);
}

.button.success,
button.success {
  background: linear-gradient(135deg, #16c6a1, #0e9f7d);
  box-shadow: 0 14px 28px rgba(22, 198, 161, 0.24);
  color: #fff;
}

.button.mini,
button.mini {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.36);
  border-radius: 999px;
  box-shadow: none;
  color: #475467;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  min-height: 0;
  padding: 7px 10px;
}

.button.mini:hover,
button.mini:hover {
  background: rgba(109, 93, 252, 0.08);
  border-color: rgba(109, 93, 252, 0.26);
  box-shadow: none;
  color: var(--primary-dark);
  transform: none;
}

.button.mini.danger,
button.mini.danger {
  background: transparent;
  border-color: rgba(209, 67, 52, 0.22);
  color: var(--danger);
}

.button.mini.danger:hover,
button.mini.danger:hover {
  background: rgba(209, 67, 52, 0.08);
  border-color: rgba(209, 67, 52, 0.32);
  color: var(--danger);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.status {
  border-radius: 18px;
  font-weight: 800;
  margin-top: 16px;
  padding: 13px 15px;
}

.status:empty {
  display: none;
}

.status.error {
  background: #fff1f0;
  color: var(--danger);
}

.status.success {
  background: #e8fff7;
  color: var(--success);
}

.progress-wrap {
  background: rgba(109, 93, 252, 0.12);
  border-radius: 999px;
  height: 14px;
  overflow: hidden;
  padding: 3px;
}

.progress-bar {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: inherit;
  box-shadow: 0 0 22px rgba(22, 198, 161, 0.42);
  height: 100%;
  width: 0;
}

.question-meta {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 20px;
}

.question-title {
  color: #0f172a;
  font-size: clamp(1.45rem, 3.4vw, 2.35rem);
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.22;
  margin: 26px 0;
  min-height: calc(1.22em * 3);
}

.answer-list {
  display: grid;
  gap: 12px;
  min-height: calc((58px * 6) + (12px * 5));
}

.answer-option {
  align-items: center;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  gap: 12px;
  padding: 16px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.answer-option:hover {
  border-color: rgba(109, 93, 252, 0.55);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.answer-option input {
  accent-color: var(--primary);
  width: auto;
}

.answer-option.selected {
  background: linear-gradient(135deg, rgba(109, 93, 252, 0.14), rgba(22, 198, 161, 0.12));
  border-color: rgba(109, 93, 252, 0.75);
  box-shadow: 0 18px 38px rgba(109, 93, 252, 0.14);
}

.tabs {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  display: flex;
  gap: 8px;
  margin: 18px 0;
  overflow-x: auto;
  padding: 8px;
}

.tab {
  background: transparent;
  box-shadow: none;
  color: var(--muted-on-dark);
  white-space: nowrap;
}

.tab.active {
  background: #fff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  color: var(--primary-dark);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.admin-form-template {
  display: none;
}

#modal-body .admin-form-template {
  display: grid;
}

.admin-search {
  flex: 1 1 280px;
}

.admin-search input {
  min-height: 44px;
}

.sr-only {
  height: 1px;
  margin: -1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.table-wrap {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 22px;
  margin-bottom: 18px;
  overflow: auto;
  padding-bottom: 86px;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  padding: 14px;
  text-align: left;
  vertical-align: top;
}

tbody tr {
  transition: background 0.2s;
}

tbody tr:hover {
  background: rgba(109, 93, 252, 0.055);
}

tbody tr:last-child td {
  border-bottom: 0;
}

th {
  background: rgba(248, 250, 252, 0.82);
  color: #64748b;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pill {
  align-items: center;
  background: linear-gradient(135deg, rgba(109, 93, 252, 0.14), rgba(22, 198, 161, 0.14));
  border: 1px solid rgba(109, 93, 252, 0.16);
  border-radius: 999px;
  color: #332ca4;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 900;
  padding: 7px 12px;
}

.gift-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 180px;
}

.gift-badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 850;
  padding: 5px 8px;
  white-space: nowrap;
}

.action-menu {
  display: inline-flex;
  justify-content: flex-end;
  position: relative;
}

.icon-button {
  align-items: center;
  background: rgba(15, 23, 42, 0.06);
  border-radius: 999px;
  box-shadow: none;
  color: #334155;
  display: inline-flex;
  font-size: 1.1rem;
  height: 34px;
  justify-content: center;
  letter-spacing: 0.12em;
  padding: 0 0 3px 2px;
  width: 34px;
}

.icon-button:hover {
  box-shadow: none;
  transform: none;
}

.action-menu-list {
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16);
  display: none;
  min-width: 150px;
  padding: 8px;
  position: absolute;
  right: 0;
  top: 40px;
  z-index: 10;
}

.action-menu:hover .action-menu-list,
.action-menu:focus-within .action-menu-list {
  display: grid;
}

.action-menu-list a,
.action-menu-list button {
  background: transparent;
  border-radius: 10px;
  box-shadow: none;
  color: #334155;
  font-size: 0.88rem;
  font-weight: 750;
  padding: 9px 10px;
  text-align: left;
  text-decoration: none;
}

.action-menu-list a:hover,
.action-menu-list button:hover {
  background: rgba(109, 93, 252, 0.09);
  box-shadow: none;
  transform: none;
}

.action-menu-list .danger-text {
  color: #b91c1c;
}

.result-list {
  display: grid;
  gap: 12px;
}

.result-item {
  align-items: center;
  background: linear-gradient(135deg, rgba(109, 93, 252, 0.12), rgba(22, 198, 161, 0.1));
  border: 1px solid rgba(109, 93, 252, 0.12);
  border-radius: 22px;
  display: flex;
  justify-content: space-between;
  padding: 17px;
}

.spiritual-card {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-bottom: 16px;
}

.spiritual-card-head h2 {
  font-size: clamp(1.9rem, 4vw, 3rem);
  margin: 16px 0 10px;
}

.spiritual-card-lede {
  line-height: 1.55;
  margin: 0 0 4px;
  max-width: 52rem;
}

.spiritual-charts-row {
  align-items: start;
  display: grid;
  gap: clamp(18px, 4vw, 36px);
  grid-template-columns: 1fr 1fr;
}

.spiritual-chart-combined {
  display: flex;
  justify-content: center;
  width: 100%;
}

.spiritual-chart-combined .spiritual-chart-panel {
  max-width: min(460px, 100%);
  width: 100%;
}

.spiritual-chart-panel {
  background: rgba(248, 250, 252, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 20px;
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 18px 14px 20px;
}

.spiritual-chart-panel-title {
  color: #0f172a;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin: 0;
  text-transform: uppercase;
}

.spiritual-chart-summary {
  margin: 0;
  min-height: 1.35em;
  text-align: center;
}

.spiritual-chart {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.spiritual-chart svg {
  max-width: 420px;
  width: 100%;
}

.chart-shell {
  fill: rgba(255, 255, 255, 0.9);
  stroke: rgba(15, 23, 42, 0.1);
  stroke-width: 1.5;
}

.chart-blue {
  fill: rgba(239, 68, 68, 0.72);
}

.chart-green {
  fill: rgba(59, 130, 246, 0.72);
}

.chart-red {
  fill: rgba(34, 197, 94, 0.72);
}

.chart-glow {
  filter: blur(2px);
}

.chart-center {
  fill: rgba(255, 255, 255, 0.34);
  stroke: rgba(15, 23, 42, 0.18);
  stroke-width: 0.8;
}

.chart-marker {
  fill: none;
  stroke: #fff7ad;
  stroke-width: 2;
}

.chart-label {
  fill: #0f172a;
  font-size: 4px;
  font-weight: 800;
}

.gift-direction {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 850;
  margin-top: 8px;
  padding: 5px 9px;
}

.gift-blue {
  background: rgba(239, 68, 68, 0.13);
  color: #b91c1c;
}

.gift-green {
  background: rgba(59, 130, 246, 0.13);
  color: #1d4ed8;
}

.gift-red {
  background: rgba(34, 197, 94, 0.14);
  color: #15803d;
}

.gift-neutral {
  background: rgba(100, 116, 139, 0.12);
  color: #475569;
}

pre {
  background: #0b1020;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #dbeafe;
  max-height: 420px;
  overflow: auto;
  padding: 20px;
}

.modal-backdrop {
  align-items: center;
  backdrop-filter: blur(10px);
  background: rgba(2, 6, 23, 0.68);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 30;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 30px;
  box-shadow: 0 38px 110px rgba(0, 0, 0, 0.42);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 26px;
  width: min(760px, 100%);
}

.modal-card-wide {
  width: min(1120px, 100%);
}

.modal-header {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 1.7rem;
  margin: 0;
}

.details-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.details-question {
  background: rgba(248, 250, 252, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 18px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.details-question-title {
  color: #0f172a;
  font-weight: 850;
  line-height: 1.35;
}

.details-question select {
  background: #fff;
}

@media (max-width: 780px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 12px;
  }

  .hero,
  .spiritual-charts-row,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .hero .card:first-child {
    min-height: auto;
  }

  .nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .quiz-nav {
    align-items: center;
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .quiz-nav .brand {
    min-width: 0;
  }

  .quiz-nav .brand strong,
  .quiz-nav .brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .quiz-nav .nav-links {
    width: auto;
  }

  .quiz-nav .button {
    min-height: 36px;
    padding: 8px 12px;
    width: auto;
  }

  .question-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  #category-label {
    display: none;
  }

  .button,
  button {
    width: 100%;
  }

  .quiz-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .quiz-actions button {
    width: 100%;
  }

  #next-button {
    order: 1;
  }

  #prev-button {
    order: 2;
  }

  #finish-button {
    grid-column: 1 / -1;
    order: 1;
  }

  .nav-links,
  .actions {
    width: 100%;
  }
}
