:root {
  --bg: #fdf2f8;
  --surface: rgba(255, 255, 255, 0.86);
  --surface2: rgba(255, 255, 255, 0.72);
  --surface-contrast: rgba(59, 15, 33, 0.08);

  --text: #3b0f21;
  --text-strong: #2a0712;
  --muted: rgba(59, 15, 33, 0.74);
  --muted2: rgba(59, 15, 33, 0.58);

  --border: rgba(59, 15, 33, 0.14);
  --border2: rgba(59, 15, 33, 0.2);

  --primary: #ec4899;
  --secondary: #f9a8d4;
  --cta: #8b5cf6;
  --danger: #e11d48;
  --success: #10b981;

  --shadow-sm: 0 10px 24px rgba(59, 15, 33, 0.08);
  --shadow: 0 18px 46px rgba(59, 15, 33, 0.12);

  --radius: 18px;
  --radius-sm: 14px;

  --ring: 0 0 0 3px rgba(236, 72, 153, 0.18);

  --font: "Nunito Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  --font-display: "Varela Round", "Nunito Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(900px 650px at 10% 5%, rgba(236, 72, 153, 0.18), transparent 58%),
    radial-gradient(850px 620px at 95% 0%, rgba(139, 92, 246, 0.14), transparent 55%),
    radial-gradient(1000px 760px at 45% 110%, rgba(249, 168, 212, 0.2), transparent 60%),
    var(--bg);
}

a {
  color: var(--cta);
  text-decoration-thickness: from-font;
  text-underline-offset: 3px;
}

a:hover {
  color: #7c3aed;
}

.container {
  max-width: 960px;
  padding: 22px 18px;
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  background: rgba(253, 242, 248, 0.72);
  backdrop-filter: blur(12px) saturate(1.25);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.topbar .container {
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.2px;
  text-decoration: none;
  color: var(--text-strong);
}

.card {
  background: linear-gradient(180deg, var(--surface), var(--surface2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.card + .card {
  margin-top: 14px;
}

.card.contrast {
  background: linear-gradient(180deg, rgba(59, 15, 33, 0.1), rgba(59, 15, 33, 0.06));
  border-color: rgba(59, 15, 33, 0.16);
}

h1,
h2,
h3 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  color: var(--text-strong);
  line-height: 1.2;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 16px;
}

p {
  margin: 10px 0;
  color: var(--muted);
  line-height: 1.7;
}

/* ------------------------------
   Result Page (Report UI)
   ------------------------------ */

.result-page {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding-bottom: 4px;
}

.result-page .card + .card {
  margin-top: 0;
}

.result-page .card {
  box-shadow: var(--shadow-sm);
}

.result-hero__typecode {
  background-image: linear-gradient(90deg, var(--cta), var(--primary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  font-weight: 800;
  letter-spacing: 0.4px;
  filter: drop-shadow(0 10px 18px rgba(59, 15, 33, 0.14));
}

.result-hero__type {
  font-size: 32px;
  letter-spacing: 0.2px;
}

.result-hero__type-label {
  color: var(--text-strong);
  font-weight: 800;
  letter-spacing: 0.2px;
}

.card-title {
  margin-bottom: 12px;
}

.card-title__text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.3px;
  background-image: linear-gradient(90deg, var(--primary), var(--cta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  filter: drop-shadow(0 10px 18px rgba(59, 15, 33, 0.08));
}

.result-subcard h3 {
  margin-bottom: 10px;
  font-size: 17px;
  letter-spacing: 0.2px;
}

.result-hero__subtitle {
  margin-top: -2px;
}

.result-list {
  margin: 8px 0 0;
  padding-left: 18px;
  list-style: disc;
}

.result-list li {
  margin: 8px 0;
  color: var(--muted);
  line-height: 1.65;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 14px 0 4px;
}

@media (min-width: 860px) {
  .result-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.result-subcard {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  padding: 14px;
}

.result-subcard--note {
  grid-column: 1 / -1;
}

.result-full__meta {
  margin-top: -4px;
}

.is-hidden {
  display: none !important;
}

.ai-card {
  border-color: rgba(139, 92, 246, 0.22);
}

.ai-card__head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.ai-card__title {
  margin-bottom: 0;
}

.ai-card__title-gradient {
  background-image: linear-gradient(90deg, var(--cta), var(--primary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.ai-card__subtitle {
  margin-top: 0;
}

.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 0 10px;
  color: var(--muted2);
}

.ai-loading__spinner {
  color: var(--cta);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.ai-loading__text {
  font-size: 13px;
  letter-spacing: 0.2px;
}

.ai-content {
  color: var(--muted);
  line-height: 1.75;
}

.ai-content h1,
.ai-content h2,
.ai-content h3 {
  margin-top: 14px;
}

.ai-content ul,
.ai-content ol {
  padding-left: 18px;
}

ul {
  margin: 10px 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

ul li {
  margin: 6px 0;
}

label {
  color: var(--muted);
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.row > * {
  flex: 1 1 auto;
}

.row.compact > * {
  flex: 0 0 auto;
}

.row.compact .grow {
  flex: 1 1 auto;
  min-width: 220px;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.68);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.92);
  border-color: var(--border2);
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring), var(--shadow-sm);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn.primary {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.98), rgba(139, 92, 246, 0.98));
  border-color: transparent;
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn.primary:hover {
  background: linear-gradient(135deg, rgba(219, 39, 119, 0.98), rgba(124, 58, 237, 0.98));
}

.btn.danger {
  border-color: rgba(225, 29, 72, 0.22);
  background: rgba(225, 29, 72, 0.08);
  color: #9f1239;
}

.btn.danger:hover {
  background: rgba(225, 29, 72, 0.12);
  border-color: rgba(225, 29, 72, 0.3);
}

.field {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

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

.mode-card {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.68);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 6px 10px;
  align-items: start;
}

.mode-card:hover {
  border-color: var(--border2);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
}

.mode-title {
  font-family: var(--font-display);
  color: var(--text-strong);
  font-size: 16px;
  grid-column: 1;
  grid-row: 1;
}

.mode-meta {
  color: var(--muted2);
  font-size: 13px;
  line-height: 1.4;
  grid-column: 1 / -1;
  grid-row: 2;
}

.mode-card input {
  accent-color: var(--primary);
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
}

@supports selector(:has(*)) {
  .mode-card:has(input:checked) {
    border-color: rgba(236, 72, 153, 0.45);
    background: rgba(236, 72, 153, 0.08);
    box-shadow: var(--shadow-sm);
  }
}

.mode-card .mode-title,
.mode-card .mode-meta {
  pointer-events: none;
}

.mode-card input {
  pointer-events: none;
}

.input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  outline: none;
}

textarea {
  resize: vertical;
}

.input:focus,
select:focus,
textarea:focus {
  border-color: rgba(236, 72, 153, 0.5);
  box-shadow: var(--ring);
}

.muted {
  color: var(--muted2);
}

.progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted2);
  font-size: 12px;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(59, 15, 33, 0.08);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-top: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(236, 72, 153, 0.98), rgba(139, 92, 246, 0.98));
}

.scale {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.scale .option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.68);
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.scale .option:hover {
  border-color: var(--border2);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
}

.scale input[type="radio"] {
  accent-color: var(--primary);
  transform: scale(1.1);
}

@supports selector(:has(*)) {
  .scale .option:has(input:checked) {
    border-color: rgba(236, 72, 153, 0.45);
    background: rgba(236, 72, 153, 0.08);
    box-shadow: var(--shadow-sm);
  }
}

.bars {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.bar {
  display: grid;
  gap: 6px;
}

.bar-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(59, 15, 33, 0.08);
  border: 1px solid var(--border);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(236, 72, 153, 0.98), rgba(139, 92, 246, 0.98));
}

.alert {
  border: 1px solid rgba(59, 15, 33, 0.16);
  background: var(--surface-contrast);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  margin: 12px 0;
}

.alert strong {
  color: var(--text-strong);
}

.divider {
  height: 1px;
  background: rgba(59, 15, 33, 0.12);
  margin: 14px 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
}

.table th,
.table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(59, 15, 33, 0.12);
  vertical-align: top;
  font-size: 14px;
}

.table th {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.2px;
  color: rgba(59, 15, 33, 0.78);
  background: rgba(59, 15, 33, 0.06);
}

.table tr:hover td {
  background: rgba(236, 72, 153, 0.04);
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid rgba(59, 15, 33, 0.14);
  background: rgba(255, 255, 255, 0.72);
  color: rgba(59, 15, 33, 0.74);
  font-size: 12px;
}

.pill.danger {
  border-color: rgba(225, 29, 72, 0.26);
  background: rgba(225, 29, 72, 0.08);
  color: #9f1239;
}

@media (max-width: 520px) {
  .container {
    padding: 18px 14px;
  }

  h1 {
    font-size: 24px;
  }

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

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

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
