:root {
  color-scheme: dark;
  --bg-base: #0a0e1a;
  --bg-card: #121a30;
  --bg-card-alt: #16203a;
  --border: rgba(212, 175, 55, 0.20);
  --border-soft: rgba(255, 255, 255, 0.08);
  --text-primary: #f3efe3;
  --text-secondary: #a8b2c9;
  --text-muted: #6f7896;
  --gold: #d4af37;
  --gold-strong: #e8c766;
  --gold-ink: #14100a;
  --gold-soft-bg: rgba(212, 175, 55, 0.14);
  --track-bg: rgba(255, 255, 255, 0.08);
  --critical: #e2544f;
  --critical-bg: rgba(226, 84, 79, 0.14);
  --success: #6fbf73;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 2.5rem 1.25rem 4rem;
  background-color: var(--bg-base);
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1px 1px at 78% 12%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1.5px 1.5px at 42% 8%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1px 1px at 92% 38%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 6% 55%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1.5px 1.5px at 60% 70%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1px 1px at 88% 82%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1px 1px at 25% 92%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(ellipse 60% 40% at 20% -5%, rgba(212, 175, 55, 0.10), transparent),
    radial-gradient(ellipse 55% 45% at 85% 0%, rgba(88, 74, 160, 0.16), transparent);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  position: relative;
}

.lang-switch {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 0.35rem;
  z-index: 1;
}

.lang-option {
  margin: 0;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
}

.lang-option.is-active {
  background: linear-gradient(180deg, var(--gold-strong), var(--gold));
  border-color: transparent;
  color: var(--gold-ink);
}

h1,
h2,
h3,
h4 {
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  color: var(--gold-strong);
  font-weight: 600;
}

h1 {
  font-size: 2rem;
  letter-spacing: 0.02em;
  margin: 0 0 1.75rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.brand-banner {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin-bottom: 1.5rem;
}

.brand-logo {
  display: block;
  max-width: 260px;
  width: 60%;
  height: auto;
  margin: 0 auto 2rem;
  border-radius: 10px;
}

@media print {
  .brand-banner,
  .brand-logo {
    display: none;
  }
}

h2 {
  font-size: 1.3rem;
  margin: 0 0 0.9rem;
}

h3 {
  font-size: 0.8rem;
  margin: 1.4rem 0 0.5rem;
  color: var(--text-secondary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

h4 {
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
}

p {
  margin: 0 0 0.75rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.4rem 1.6rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.25);
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}

input[type="password"],
input[type="text"],
textarea {
  width: 100%;
  max-width: 480px;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--bg-card-alt);
  color: var(--text-primary);
  font: inherit;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--gold);
}

textarea {
  max-width: 100%;
  resize: vertical;
}

button {
  margin-top: 0.6rem;
  padding: 0.6rem 1.2rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--gold-strong), var(--gold));
  color: var(--gold-ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.06);
}

button.secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--gold-strong);
  font-weight: 600;
}

.disclaimer {
  font-size: 0.85rem;
  color: var(--text-muted);
  border-left: 3px solid var(--border);
  padding-left: 0.75rem;
  margin: 0.75rem 0 0;
}

.status-text {
  color: var(--text-secondary);
  font-style: italic;
}

.conversational-progress {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
}

.status-text.is-loading {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.status-text.is-loading::before {
  content: "";
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--border-soft);
  border-top-color: var(--gold-strong);
  animation: cs-spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .status-text.is-loading::before {
    animation-duration: 2.4s;
  }
}

.quota-banner {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold-strong);
  background: var(--bg-card-alt);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  margin: 0 0 1.25rem;
}

.quota-banner[hidden] {
  display: none;
}

ul {
  padding-left: 1.25rem;
}

a {
  color: var(--gold-strong);
}

.site-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-soft);
  text-align: center;
}

.site-footer a {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--gold-strong);
  text-decoration: underline;
}

.legal-page h3 {
  font-size: 1.05rem;
  margin: 1.5rem 0 0.5rem;
}

.legal-page h3:first-of-type {
  margin-top: 0;
}

/* Score radar chart */
.score-chart-wrap {
  display: flex;
  justify-content: center;
  margin: 0 0 1.5rem;
}

.score-radar {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  overflow: visible;
}

.score-radar-ring {
  fill: none;
  stroke: var(--border-soft);
  stroke-width: 1;
}

.score-radar-axis {
  stroke: var(--border-soft);
  stroke-width: 1;
}

.score-radar-shape {
  fill: var(--gold);
  fill-opacity: 0.18;
  stroke: var(--gold-strong);
  stroke-width: 2;
  stroke-linejoin: round;
}

.score-radar-point {
  fill: var(--text-muted);
  stroke: var(--bg-card);
  stroke-width: 1.5;
}

.score-radar-point.is-activated {
  fill: var(--gold-strong);
}

.score-radar-label {
  fill: var(--text-secondary);
  font-size: 13px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.score-radar-label.is-activated {
  fill: var(--gold-strong);
  font-weight: 700;
}

/* Score meters */
.score-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.score-row {
  margin-bottom: 1rem;
}

.score-row:last-child {
  margin-bottom: 0;
}

.score-row-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.3rem 0.6rem;
  margin-bottom: 0.35rem;
}

.score-name {
  font-weight: 700;
  color: var(--text-primary);
}

.score-function {
  font-weight: 400;
  color: var(--text-secondary);
}

.score-value {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  white-space: nowrap;
}

.score-track {
  height: 10px;
  border-radius: 999px;
  background: var(--track-bg);
  overflow: hidden;
}

.score-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--gold-strong));
}

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}

.badge-good {
  background: var(--gold-soft-bg);
  color: var(--gold-strong);
}

.badge-critical {
  background: var(--critical-bg);
  color: var(--critical);
}

.score-justification {
  margin: 0.3rem 0 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

/* Architecture detail cards */
.architecture-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
}

.architecture-card-header h4 {
  margin: 0;
}

.architecture-toggle {
  margin-top: 0;
  white-space: nowrap;
}

.architecture-card-body {
  margin-top: 0.75rem;
}

.architecture-card .field-label {
  font-weight: 700;
  color: var(--gold-strong);
  margin: 0.85rem 0 0.25rem;
}

.architecture-card .field-label:first-of-type {
  margin-top: 0;
}

.architecture-card ul {
  margin: 0.25rem 0;
}

.architecture-answer {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 0 0.5rem;
  resize: vertical;
}

.architecture-answer:disabled {
  opacity: 0.6;
  resize: none;
}

.answer-noted {
  color: var(--success);
  font-size: 0.8rem;
  font-weight: 600;
  margin: -0.3rem 0 0.5rem;
}

.refined-badge {
  color: var(--gold-strong);
  font-style: italic;
  font-size: 0.9rem;
}

.evidence-tag {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--text-muted);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  margin-left: 0.5rem;
}

/* Consolidated action plan */
.plan-action-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.plan-action-item {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-soft);
}

.plan-action-item:last-child {
  border-bottom: none;
}

.plan-action-source {
  display: block;
  font-size: 0.75rem;
  color: var(--gold-strong);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.15rem;
}

.safety-card {
  border-left: 3px solid var(--critical);
}

.export-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.export-bar button {
  margin-top: 0;
}

@media print {
  body {
    background: #ffffff;
    background-image: none;
    color: #000000;
    padding: 0;
  }

  h1,
  h2,
  h3,
  h4 {
    color: #000000;
  }

  .no-print {
    display: none !important;
  }

  .card {
    border: none;
    box-shadow: none;
    padding: 0;
    margin-bottom: 1.5rem;
    break-inside: avoid;
  }

  .architecture-card-body {
    display: block !important;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}
