/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --ink:     #111110;
  --paper:   #fafaf8;
  --warm:    #f0ede6;
  --rule:    #e0dcd4;
  --muted:   #999690;
  --accent:  #111110;
  --serif:   'Instrument Serif', Georgia, serif;
  --mono:    'DM Mono', 'Courier New', monospace;
  --max:     1080px;
  --pad:     clamp(1.5rem, 5vw, 3.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:     #f5f5f5;
    --paper:   #111110;
    --warm:    #1a1a19;
    --rule:    #333333;
    --muted:   #888888;
    --accent:  #f5f5f5;
  }
}

/* High Contrast Mode */
body.high-contrast {
  --ink:     #ffffff;
  --paper:   #000000;
  --warm:    #111111;
  --rule:    #ffffff;
  --muted:   #ffff00;
  --accent:  #ffff00;
}

html {
  font-size: 145%; /* ~23px base */
  scroll-behavior: smooth;
  scroll-padding-top: 70px;
}

body {
  font-family: var(--mono);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.75rem; /* ~17px */
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Accessibility */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 1rem;
  z-index: 1000;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-decoration: none;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

.a11y-btn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  background: var(--warm);
  color: var(--ink);
  border: 1px solid var(--rule);
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: opacity 0.2s;
}

.a11y-btn:hover {
  opacity: 0.8;
}

/* ── Layout & Containers ── */
.section-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(3rem, 8vh, 6rem) var(--pad);
}

.section-narrow {
  max-width: 600px;
}

.rule {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2rem 0;
}

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Animation: Reveal ── */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s cubic-bezier(0.215, 0.61, 0.355, 1), transform 0.6s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ── Header & Navigation ── */
nav {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 90;
}

.nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.8rem var(--pad);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  font-family: var(--serif);
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--ink);
}

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  font-size: 0.55rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-links .nav-cta {
  background: var(--ink);
  color: var(--paper);
  padding: 0.4rem 0.9rem;
  transition: opacity 0.2s;
}

.nav-links .nav-cta:hover {
  opacity: 0.8;
}

/* ── Typography & Headings ── */
.section-header {
  margin-bottom: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.section-num {
  font-size: 0.55rem;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.section-title {
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 400;
  line-height: 1.2;
}

/* ── Buttons ── */
.btn-primary {
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  padding: 0.75rem 1.6rem;
  cursor: pointer;
  transition: opacity 0.2s;
  display: inline-block;
  text-align: center;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.8;
}

.btn-primary:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.btn-secondary {
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: 0.75rem 1.6rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  display: inline-block;
  text-align: center;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--ink);
  color: var(--paper);
}

.btn-secondary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-large {
  padding: 1rem 2.2rem;
  font-size: 0.6rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  text-decoration: underline;
  padding: 0.5rem 0;
  transition: color 0.2s;
}

.btn-link:hover {
  color: var(--ink);
}

/* ── View Control ── */
.view {
  display: none;
}

.view.active {
  display: block;
}

/* ── VIEW: LANDING ── */
#hero {
  border-bottom: 1px solid var(--rule);
}

.hero-inner {
  padding: clamp(3rem, 10vh, 6rem) var(--pad);
  max-width: var(--max);
  margin: 0 auto;
}

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 2rem;
}

.hero-eyebrow::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--muted);
}

.hero-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.4rem, 6.5vw, 5rem);
  line-height: 1.1;
  margin-bottom: 2rem;
  letter-spacing: -0.01em;
}

.hero-title em {
  font-style: italic;
  color: var(--muted);
}

.hero-sub {
  font-size: 0.75rem;
  line-height: 1.8;
  color: var(--muted);
  max-width: 48ch;
  margin-bottom: 2.5rem;
}

.hero-note {
  font-size: 0.5rem;
  color: var(--muted);
  margin-top: 0.8rem;
  letter-spacing: 0.05em;
}

/* Instructions */
#instructions {
  background: var(--warm);
}

.steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.step-card {
  padding: 1.5rem;
  border: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.step-num {
  font-size: 0.55rem;
  color: var(--muted);
}

.step-title {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 400;
}

.step-desc {
  font-size: 0.65rem;
  color: var(--muted);
  line-height: 1.6;
}

.instructions-note {
  font-size: 0.65rem;
  color: var(--muted);
  border-left: 2px solid var(--rule);
  padding-left: 1rem;
}

/* Scale Guide */
.scale-guide {
  margin-top: 3.5rem;
  margin-bottom: 3.5rem;
  border-top: 1px solid var(--rule);
  padding-top: 2rem;
}

.guide-title {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 1.5rem;
}

.guide-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.guide-item {
  padding: 1.25rem;
  background: var(--warm);
  border: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.guide-geom {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  align-self: flex-start;
  font-family: var(--mono);
  letter-spacing: 0.05em;
  background: var(--warm);
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--rule);
}

.geom-svg {
  width: 14px;
  height: 14px;
  fill: transparent;
  stroke: var(--ink);
  stroke-width: 1.25;
  stroke-linejoin: round;
  stroke-linecap: round;
  display: inline-block;
}

.geom-text {
  font-size: 0.55rem;
  font-weight: bold;
  text-transform: uppercase;
  color: var(--ink);
}

.guide-content {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.guide-term {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: bold;
  color: var(--ink);
}

.guide-text {
  font-size: 0.6rem;
  color: var(--muted);
  line-height: 1.6;
}

body.high-contrast .guide-geom {
  background: var(--paper) !important;
  color: var(--ink) !important;
  border: 1.5px solid var(--ink);
}

/* ── VIEW: DASHBOARD ── */
.dashboard-header {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.progress-bar-wrap {
  width: 100%;
  background: var(--warm);
  height: 6px;
  position: relative;
}

.progress-bar {
  background: var(--ink);
  width: 0%;
  height: 100%;
  transition: width 0.3s ease;
}

.progress-label {
  font-size: 0.55rem;
  color: var(--muted);
  display: block;
  margin-top: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.dim-card {
  border: 1px solid var(--rule);
  padding: 1.5rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  transition: border-color 0.2s, background-color 0.2s;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  font-family: inherit;
}

.dim-card:hover {
  background: var(--warm);
  border-color: var(--muted);
}

.dim-card.active {
  border-color: var(--ink);
  outline: 2px solid var(--ink);
}

.dim-card.completed {
  border-left: 4px solid var(--ink);
}

.dim-num {
  font-size: 0.5rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.dim-title {
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 400;
  line-height: 1.2;
  color: var(--ink);
}

.dim-status {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dim-card.completed .dim-status {
  color: var(--ink);
  font-weight: bold;
}

.dashboard-footer {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  align-items: flex-start;
  border-top: 1px solid var(--rule);
  padding-top: 2rem;
}

.hint-text {
  font-size: 0.55rem;
  color: var(--muted);
}

/* ── VIEW: MODAL / OVERLAY ── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(17, 17, 16, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.modal-panel {
  background: var(--paper);
  border: 1px solid var(--rule);
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  max-height: 100vh;
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.modal-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 400;
  margin-top: 0.3rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--ink);
  padding: 0.2rem;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.modal-info-banner {
  background: var(--warm);
  border: 1px solid var(--rule);
  padding: 1rem;
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.info-icon {
  font-size: 0.9rem;
  line-height: 1;
}

.info-text {
  font-family: var(--mono);
  font-size: 0.55rem;
  line-height: 1.6;
  color: var(--muted);
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--rule);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* Questions in Modal */
.question-item {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

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

.question-text {
  font-size: 0.65rem;
  line-height: 1.6;
}

.question-control {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.range-slider-wrap {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.range-slider-container {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25rem;
}

.label-min,
.label-max {
  font-family: var(--mono);
  font-size: 0.48rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
}

/* Range input styling */
input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  background: transparent;
}

input[type=range]:focus {
  outline: none;
}

/* Webkit Track & Thumb */
input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 2px;
  cursor: pointer;
  background: var(--rule);
}

input[type=range]::-webkit-slider-thumb {
  height: 18px;
  width: 18px;
  border: 1px solid var(--ink);
  background: var(--paper);
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -8px;
  transition: background 0.15s;
}

input[type=range]::-webkit-slider-thumb:hover {
  background: var(--ink);
}

/* Firefox Track & Thumb */
input[type=range]::-moz-range-track {
  width: 100%;
  height: 2px;
  cursor: pointer;
  background: var(--rule);
}

input[type=range]::-moz-range-thumb {
  height: 16px;
  width: 16px;
  border: 1px solid var(--ink);
  background: var(--paper);
  cursor: pointer;
  border-radius: 0;
  transition: background 0.15s;
}

input[type=range]::-moz-range-thumb:hover {
  background: var(--ink);
}

/* Untouched range input slider thumb styling */
input[type=range].slider-untouched::-webkit-slider-thumb {
  border: 1px dashed var(--muted);
  background: transparent;
}
input[type=range].slider-untouched::-webkit-slider-thumb:hover {
  background: transparent;
}
input[type=range].slider-untouched::-moz-range-thumb {
  border: 1px dashed var(--muted);
  background: transparent;
}
input[type=range].slider-untouched::-moz-range-thumb:hover {
  background: transparent;
}


/* ── BTA 3.0-sensemaker: Geometric & Dyad components ── */
.geometric-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
}

.geometry-viewport {
  width: 100%;
  max-width: 320px; /* Responsive mobile portrait max-width */
  aspect-ratio: 1.15 / 1;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none; /* Prevents default touch gestures while dragging */
}

@media (min-width: 500px) {
  .geometric-container {
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
  }
}

@media (min-width: 768px) {
  .geometric-container {
    flex-direction: row;
    justify-content: space-between;
    align-items: stretch;
    gap: 2.5rem;
  }
  .geometry-viewport {
    flex: 0 0 380px;
    max-width: 380px;
  }
  .weights-breakdown {
    flex: 1;
    width: auto;
  }
}

/* SVG Elements Styling */
.svg-polygon {
  fill: var(--warm);
  stroke: var(--rule);
  stroke-width: 1.5;
  transition: stroke 0.2s;
}

#interactive-svg:hover .svg-polygon {
  stroke: var(--muted);
}

.svg-vertex-text {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 200;
  fill: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.00em;
  user-select: none;
}

.svg-handle {
  fill: var(--ink);
  stroke: var(--paper);
  stroke-width: 2px;
  cursor: grab;
  transition: r 0.15s, fill 0.15s, stroke-width 0.15s;
}

.svg-handle:active {
  cursor: grabbing;
  r: 11px;
}

.svg-handle.handle-untouched {
  fill: transparent;
  stroke: var(--muted);
  stroke-width: 2px;
  stroke-dasharray: 3,3;
}

/* Breakdown List */
.weights-breakdown {
  width: 100%;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--warm);
  padding: 1rem;
  border: 1px solid var(--rule);
}

.breakdown-title {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.3rem;
  margin-bottom: 0.3rem;
}

.breakdown-row-group {
  border-bottom: 1px dashed var(--rule);
  padding: 0.3rem 0;
}

.breakdown-row-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  font-size: 0.65rem;
}

.breakdown-label {
  color: var(--ink);
  font-weight: bold;
}

.breakdown-value {
  font-family: var(--mono);
  font-weight: bold;
  color: var(--ink);
  font-size: 0.65rem;
}

.breakdown-desc {
  font-family: var(--mono);
  font-size: 0.58rem;
  color: var(--ink);
  opacity: 0.8;
  line-height: 1.5;
  margin-top: 0.25rem;
}

.accordion-arrow {
  display: none;
}

@media (max-width: 500px) {
  .accordion-arrow {
    display: inline-block;
    transition: transform 0.2s;
    font-size: 0.5rem;
    color: var(--muted);
    margin-left: 0.3rem;
  }

  .breakdown-row-group.has-desc .breakdown-row {
    cursor: pointer;
  }

  .breakdown-row-group.has-desc .breakdown-desc {
    max-height: 0;
    overflow: hidden;
    margin-top: 0;
    transition: max-height 0.2s ease-out, margin-top 0.2s ease-out;
  }

  .breakdown-row-group.has-desc.expanded .breakdown-desc {
    max-height: 120px;
    margin-top: 0.15rem;
  }

  .breakdown-row-group.expanded .accordion-arrow {
    transform: rotate(90deg);
  }
}

/* Dyad styling */
.dyad-container {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 0.5rem 0;
}

.dyad-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.dyad-control-wrap {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.dyad-slider-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.dyad-slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25rem;
}

.dyad-slider-labels span {
  font-family: var(--mono);
  font-size: 0.45rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dyad-badge {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 0.25rem 0.5rem;
  min-width: 2.5rem;
  text-align: center;
  color: var(--ink);
}

/* Prompt and Helper inside Modal */
.modal-prompt-wrap {
  border-left: 2px solid var(--ink);
  padding-left: 1rem;
  margin-bottom: 0.5rem;
}

.modal-prompt {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-style: italic;
  line-height: 1.3;
  color: var(--ink);
}

.modal-help-inline {
  font-family: var(--mono);
  font-size: 0.45rem;
  color: var(--muted);
  margin-top: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}


/* ── VIEW: SUBMIT FORM ── */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 2rem;
}

.form-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-field label {
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.form-field input[type=text],
.form-field input[type=email],
.form-field input[type=number],
.form-field select {
  font-family: var(--mono);
  font-size: 0.65rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 0.6rem;
  transition: border-color 0.2s;
}

.form-field input[type=text]:focus,
.form-field input[type=email]:focus,
.form-field input[type=number]:focus,
.form-field select:focus {
  border-color: var(--ink);
  outline: none;
}

.captcha-field {
  border-top: 1px dashed var(--rule);
  padding-top: 1.5rem;
  margin-top: 1.5rem;
}

.captcha-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.5rem 0;
}

.captcha-question {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 200;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.captcha-wrap input {
  width: 80px !important;
}

.error-message {
  color: #c92a2a;
  font-size: 0.6rem;
  border-left: 2px solid #c92a2a;
  padding-left: 0.8rem;
  margin: 0.5rem 0;
}

/* ── VIEW: RESULTS ── */
.results-header {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2rem;
  margin-bottom: 3rem;
}

.score-block {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.score-value {
  font-family: var(--serif);
  font-size: clamp(3.5rem, 10vw, 6.5rem);
  line-height: 1;
  color: var(--ink);
}

.score-meta {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.score-label {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.bta-level-badge {
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--warm);
  color: var(--ink);
  padding: 0.3rem 0.6rem;
  font-weight: bold;
  border: 1px solid var(--rule);
  width: fit-content;
}

.bta-level-desc {
  font-size: 0.7rem;
  line-height: 1.8;
  color: var(--muted);
  max-width: 60ch;
}

/* Graph section */
.graph-section {
  margin-bottom: 4rem;
  text-align: center;
}

.graph-title {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 0.8rem;
}

.graph-legend {
  font-size: 0.5rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 4px;
}

.legend-dot.green { background: #2b8a3e; }
.legend-dot.yellow { background: #e67700; }
.legend-dot.red { background: #c92a2a; }
.legend-dot.gray { background: #868e96; }

.graph-container {
  max-width: 420px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 1rem;
}

/* Dimension Averages Table */
.dim-averages {
  margin-bottom: 4rem;
}

.dim-averages-title {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
}

.dim-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.65rem;
}

.dim-table th,
.dim-table td {
  padding: 0.8rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--rule);
}

.dim-table th {
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--warm);
}

/* Share box */
.share-section {
  background: var(--warm);
  padding: 2rem;
  border: 1px solid var(--rule);
  margin-bottom: 4rem;
}

.share-title {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.share-desc {
  font-size: 0.6rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.share-box {
  display: flex;
  gap: 0.5rem;
}

.share-input {
  flex: 1;
  font-family: var(--mono);
  font-size: 0.6rem;
  padding: 0.6rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--ink);
}

.share-input:focus {
  outline: none;
  border-color: var(--ink);
}

.copy-feedback {
  font-size: 0.55rem;
  color: var(--ink);
  margin-top: 0.5rem;
  font-weight: bold;
}

/* CTA Section */
.cta-section {
  margin-bottom: 4rem;
}

.cta-text {
  margin-bottom: 1.5rem;
}

.cta-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.cta-sub {
  font-size: 0.65rem;
  color: var(--muted);
  line-height: 1.7;
}

.form-alt {
  font-size: 0.55rem;
  color: var(--muted);
  margin-top: 1rem;
}

.form-alt a {
  color: var(--ink);
  text-decoration: underline;
}

.restart-section {
  text-align: center;
  margin-top: 2rem;
}

/* ── Loading Spinner ── */
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--rule);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spinner 0.8s linear infinite;
  margin: 2rem auto;
}

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

/* ── Footer ── */
footer {
  border-top: 1px solid var(--rule);
  background: var(--paper);
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem var(--pad);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-copy {
  font-size: 0.5rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-copy a {
  color: var(--muted);
  text-decoration: none;
}

.footer-copy a:hover {
  color: var(--ink);
}

/* ── Responsive breakpoints ── */
@media (min-width: 768px) {
  /* Use 2 columns for responsive parts on larger viewports */
  .steps-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .guide-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Modal layout on tablet/desktop */
  .modal-panel {
    max-width: 860px;
    height: auto;
    max-height: 85vh;
    border-radius: 0;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  }
  
  .form-group {
    grid-template-columns: repeat(2, 1fr);
  }

  .cta-section {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 3rem;
    align-items: start;
  }
  
  .cta-section .rule {
    grid-column: 1 / span 2;
    margin-top: 0;
  }

  .cta-text {
    margin-bottom: 0;
  }
}

/* Checkbox field styling */
.checkbox-field {
  margin: 1.5rem 0;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.6rem;
  color: var(--muted);
  cursor: pointer;
  line-height: 1.4;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin-top: 0.1rem;
  cursor: pointer;
  accent-color: var(--ink);
}

.privacy-link {
  color: var(--ink);
  text-decoration: underline;
  font-weight: bold;
}

.privacy-link:hover {
  color: var(--muted);
}

/* ── Mobile Portrait Results View Rediagramming ── */
@media (max-width: 500px) {
  #view-results .section-inner {
    padding: 2rem 1rem;
  }
  
  #view-results .results-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
  }
  
  #view-results .score-block {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
  }
  
  #view-results .score-meta {
    align-items: center;
  }
  
  #view-results .graph-container {
    max-width: 100%;
    width: 100%;
    padding: 0.5rem;
  }
  
  #view-results .dim-table,
  #view-results .dim-table thead,
  #view-results .dim-table tbody,
  #view-results .dim-table tr,
  #view-results .dim-table th,
  #view-results .dim-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }
  
  #view-results .dim-table thead {
    display: none;
  }
  
  #view-results .dim-table tr {
    border-bottom: 1px dashed var(--rule);
    padding: 1.2rem 0.5rem;
  }
  
  #view-results .dim-table tr:first-child {
    padding-top: 0.5rem;
  }
  
  #view-results .dim-table tr:last-child {
    border-bottom: none;
  }
  
  #view-results .dim-table td {
    padding: 0.3rem 0;
    border-bottom: none;
  }
  
  #view-results .dim-table td:nth-child(1) {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--ink);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  
  #view-results .dim-table td:nth-child(2) {
    font-size: 0.7rem;
    line-height: 1.5;
    color: var(--ink);
    margin: 0.2rem 0;
  }
  
  #view-results .dim-table td:nth-child(3) {
    font-size: 0.7rem;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }
  
  #view-results .dim-table td:nth-child(3)::before {
    content: "Sentimento (Dyad):";
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: normal;
  }
}

/* ── Language Switcher ── */
.lang-switch {
  display: flex;
  gap: 0.6rem;
  font-size: 0.55rem;
  font-family: var(--mono);
  letter-spacing: 0.1em;
}
.lang-switch a.lang-btn {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.lang-switch a.lang-btn:hover {
  color: var(--ink);
}
.lang-switch a.lang-btn.active {
  color: var(--ink);
  font-weight: 500;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
}

@media (max-width: 600px) {
  .nav-inner {
    padding: 0.6rem 1rem;
  }
  .nav-logo {
    font-size: 0.9rem;
  }
  .nav-links {
    gap: 0.8rem;
  }
  .nav-links li:not(:nth-child(3)) {
    display: none;
  }
}


/* ── Mobile Menu Drawer (Desktop Hidden) ── */
.nav-drawer {
  position: fixed;
  top: 0; right: -280px;
  width: 280px;
  height: 100vh;
  background: var(--paper);
  z-index: 105;
  box-shadow: -5px 0 25px rgba(0,0,0,0.03);
  padding: 60px 2rem 2rem 2rem;
  display: none;
  flex-direction: column;
  gap: 1.2rem;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border-left: 1px solid var(--rule);
}
.nav-drawer.active { right: 0; }
.drawer-backdrop {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.05);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 104;
  display: none;
}
.drawer-backdrop.active { opacity: 1; pointer-events: auto; }
.drawer-links { list-style: none; display: flex; flex-direction: column; gap: 1rem; }
.drawer-links a { font-family: var(--serif); font-size: 1.2rem; color: var(--ink); text-decoration: none; transition: opacity 0.2s; display: block; }
.drawer-links a:hover { opacity: 0.7; }
.drawer-divider { height: 1px; background: var(--rule); margin: 1rem 0; }
.drawer-cta { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--paper); background: var(--ink); padding: 0.8rem; text-decoration: none; transition: opacity 0.2s; text-align: center; margin-top: auto; }
.drawer-cta:hover { opacity: 0.8; }
@media (max-width: 768px) {
  .nav-drawer { display: flex; }
  .drawer-backdrop { display: block; }
}
