/* ==========================================================================
   Shared Surfaces, Assessment Flow, Review & Score Sheet, Report & Print
   ========================================================================== */

.alert-danger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background-color: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-ink);
  font-size: 13px;
  font-weight: 600;
}

/* Segmented Language Control for Report */
.segmented-control {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}

.seg-btn {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.seg-btn.active {
  background-color: var(--bg-surface);
  color: var(--ink-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Minimal Scale Box for Downloadable Questionnaire */
.scale-compact-box {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--bg-subtle);
  font-size: 11px;
  text-align: center;
}

.scale-compact-item strong {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  margin-right: 3px;
}

.scale-compact-item span {
  display: block;
  color: var(--ink-secondary);
  margin-top: 2px;
}

@media (max-width: 640px) {
  .scale-compact-box {
    grid-template-columns: 1fr;
    text-align: left;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 12px;
}

.btn-primary {
  background-color: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
}

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

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--ink-primary);
  border: 1px solid var(--border-strong);
}

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

.btn-signal {
  background-color: var(--signal);
  color: #FFFFFF;
  border: 1px solid var(--signal);
}

.btn-signal:hover:not(:disabled) {
  opacity: 0.92;
}

.btn-danger {
  background-color: var(--danger-ink);
  color: #FFFFFF;
  border: 1px solid var(--danger-ink);
}

.btn-danger-outline {
  background-color: var(--bg-surface);
  color: var(--danger-ink);
  border: 1px solid var(--danger-border);
}

.btn-danger-outline:hover:not(:disabled) {
  background-color: var(--danger-bg);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background-color: var(--bg-surface);
  color: var(--ink-primary);
}

.icon-btn:hover {
  background-color: var(--bg-subtle);
  border-color: var(--ink-primary);
}

/* Cards & Structural Rhythm (Flat hierarchy, avoid nested wrapper bloat) */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.subcard {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}

.stack-sm { display: flex; flex-direction: column; gap: 12px; }
.stack-md { display: flex; flex-direction: column; gap: 20px; }
.stack-lg { display: flex; flex-direction: column; gap: 28px; }

.page-title {
  font-size: clamp(24px, 3.2vw, 32px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 10px;
}

.page-lead {
  font-size: 15px;
  color: var(--ink-secondary);
  line-height: 1.65;
  max-width: 72ch;
}

.section-heading {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 6px;
}

.section-sub {
  font-size: 13px;
  color: var(--ink-secondary);
  margin-bottom: 16px;
}

/* Pills & Tags */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background-color: var(--bg-subtle);
  color: var(--ink-primary);
}

.pill-synergy {
  background-color: var(--synergy-bg);
  border-color: var(--synergy-border);
  color: var(--synergy-ink);
}

.pill-tension {
  background-color: var(--tension-bg);
  border-color: var(--tension-border);
  color: var(--tension-ink);
}

.pill-warn {
  background-color: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn-ink);
}

.pill-signal {
  background-color: var(--signal-soft);
  border-color: var(--signal-border);
  color: var(--signal);
}

/* Privacy Assurance Box */
.privacy-assurance {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
}

.privacy-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-primary);
}

.check-list {
  list-style: none;
  display: grid;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-secondary);
}

.check-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.check-list svg {
  flex-shrink: 0;
  margin-top: 3px;
  color: var(--signal);
}

.check-list strong {
  color: var(--ink-primary);
  font-weight: 600;
}

/* 5-Point Scale Strip */
.scale-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.scale-item {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
}

.scale-num {
  display: block;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.scale-en {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-primary);
  line-height: 1.3;
}

.scale-ne {
  display: block;
  font-size: 11px;
  color: var(--ink-secondary);
  margin-top: 3px;
  line-height: 1.35;
}

/* Home Action Paths Grid */
.paths-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.path-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.path-card h2 {
  font-size: 17px;
  margin-bottom: 6px;
}

.path-card p {
  font-size: 13px;
  color: var(--ink-secondary);
}

.trait-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
}

.trait-overview-item {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.trait-overview-item h3 {
  font-size: 14px;
  margin-bottom: 4px;
}

.trait-overview-item p {
  font-size: 12px;
  color: var(--ink-secondary);
  line-height: 1.45;
}

/* ==========================================================================
   Assessment View (Clean Single Card, Centered "Question X of 50")
   ========================================================================== */
.assessment-shell {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.question-card {
  position: relative;
  overflow: hidden;
  padding: 26px 28px;
}

.card-progress-bar {
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 4px;
  background-color: var(--bg-subtle);
}

.card-progress-fill {
  height: 100%;
  background-color: var(--accent);
  transform-origin: left center;
  transition: transform 240ms var(--ease);
}

.question-center-counter {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  margin-bottom: 18px;
}

.question-en {
  font-size: clamp(20px, 2.8vw, 24px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--ink-primary);
  margin-bottom: 8px;
}

.question-ne {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-secondary);
  margin-bottom: 22px;
}

.options-list {
  display: grid;
  gap: 9px;
  margin-bottom: 14px;
}

.option-btn {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  text-align: left;
}

.option-btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-strong);
}

.option-btn.selected {
  background-color: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.option-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.option-key {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background-color: var(--bg-subtle);
  color: var(--ink-primary);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.option-btn.selected .option-key {
  background-color: #2A2A27;
  border-color: #42423E;
  color: #FFFFFF;
}

.option-text-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.option-en {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.option-ne {
  font-size: 13px;
  color: var(--ink-secondary);
  line-height: 1.35;
}

.option-btn.selected .option-ne {
  color: #D4D4CE;
}

.option-check {
  width: 18px;
  height: 18px;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  flex-shrink: 0;
}

.option-btn.selected .option-check {
  opacity: 1;
  transform: scale(1);
}

.validation-msg {
  min-height: 22px;
  font-size: 13px;
  font-weight: 600;
  color: var(--danger-ink);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}

.validation-msg.visible {
  opacity: 1;
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-default);
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 13px;
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
  min-height: 36px;
}

.toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.kbd-hints {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--ink-muted);
}

.kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-default);
  color: var(--ink-primary);
}

.qmap-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.qmap-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--ink-muted);
}

.qmap-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-primary);
}

.qmap-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
}

.qmap-dot {
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background-color: var(--bg-page);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
  display: grid;
  place-items: center;
}

.qmap-dot.answered {
  background-color: var(--bg-surface);
  border-color: var(--border-strong);
  color: var(--ink-primary);
}

.qmap-dot.current {
  background-color: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.qmap-dot.locked {
  opacity: 0.4;
}

/* ==========================================================================
   Tables: Review Table & 5-Column Score Sheet
   ========================================================================== */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
}

.review-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.review-table th,
.review-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-default);
  text-align: left;
  vertical-align: middle;
}

.review-table thead th {
  background-color: var(--bg-subtle);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-secondary);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

.review-table tbody tr:last-child td {
  border-bottom: none;
}

.review-table tbody tr:hover {
  background-color: var(--bg-hover);
}

.review-qnum {
  font-family: var(--font-mono);
  font-weight: 700;
  white-space: nowrap;
}

.review-q-en {
  font-weight: 600;
  color: var(--ink-primary);
}

.review-q-ne {
  font-size: 12px;
  color: var(--ink-secondary);
  margin-top: 2px;
}

.review-answer-cell {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.score-badge {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  background-color: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.answer-opt-en {
  font-weight: 600;
  color: var(--ink-primary);
  line-height: 1.3;
}

.answer-opt-ne {
  font-size: 12px;
  color: var(--ink-secondary);
  line-height: 1.35;
}

/* 5-Column Score Sheet Table (Used on Review, Analyze, and Download) */
.scoring-table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  font-size: 13px;
  background-color: var(--bg-surface);
}

.scoring-table th,
.scoring-table td {
  border: 1px solid var(--border-default);
  padding: 8px 10px;
  text-align: center;
  vertical-align: middle;
}

.scoring-table thead th {
  background-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 12px;
  padding: 10px 8px;
}

.scoring-table thead th span {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  opacity: 0.8;
  margin-bottom: 2px;
}

.scoring-table .row-label {
  text-align: left;
  font-weight: 600;
  color: var(--ink-secondary);
  width: 92px;
  white-space: nowrap;
  font-size: 12px;
}

.scoring-table tr.sno-row td,
.scoring-table tr.sno-row th {
  background-color: var(--bg-subtle);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  padding: 5px 10px;
}

.scoring-table tr.score-row td,
.scoring-table tr.score-row th {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-primary);
  padding: 9px 8px;
}

.scoring-table tr.score-row th.row-label {
  font-family: var(--font-ui);
  font-weight: 500;
  color: var(--ink-muted);
}

.scoring-table td.rev-cell {
  background-color: #FAF8F5;
}

.scoring-table tfoot td,
.scoring-table tfoot th {
  background-color: var(--bg-subtle);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink-primary);
  padding: 12px 10px;
  border-top: 2px solid var(--ink-primary);
}

.scoring-table tfoot th.row-label {
  font-family: var(--font-ui);
  font-size: 13px;
}

/* Interactive Paper Entry Score Sheet Cells */
.entry-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.entry-prefix {
  font-weight: 700;
  color: var(--tension-ink);
  white-space: nowrap;
}

.sheet-input {
  width: 42px;
  height: 38px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  color: var(--ink-primary);
}

.sheet-input:focus {
  border-color: var(--signal);
  background-color: var(--signal-soft);
}

.sheet-input.is-invalid {
  border-color: var(--danger-ink);
  background-color: var(--danger-bg);
}

.sheet-input.is-filled {
  border-color: var(--ink-primary);
}

.entry-result {
  min-width: 28px;
  font-weight: 700;
  color: var(--signal);
  text-align: left;
  white-space: nowrap;
}

.active-inspector {
  position: sticky;
  inset-block-start: 12px;
  z-index: 20;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.inspector-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--signal);
  margin-bottom: 3px;
}

.inspector-q-en {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-primary);
}

.inspector-q-ne {
  font-size: 13px;
  color: var(--ink-secondary);
}

/* ==========================================================================
   Async Calculation Progress Panel
   ========================================================================== */
.calc-panel {
  max-width: 620px;
  margin: 28px auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.calc-progress-track {
  width: 100%;
  height: 8px;
  background-color: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border-default);
}

.calc-progress-fill {
  height: 100%;
  width: 0%;
  background-color: var(--signal);
  transition: width 160ms linear;
}

/* ==========================================================================
   Comprehensive Analysis Report
   ========================================================================== */
.results-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.synthesis-grid {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 24px;
  align-items: start;
}

.radar-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.radar-svg {
  width: 100%;
  max-width: 280px;
  height: auto;
  display: block;
}

.composite-metrics {
  width: 100%;
  display: grid;
  gap: 8px;
}

.metric-box {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.metric-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-primary);
}

.archetype-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.prose-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 14px;
  color: var(--ink-secondary);
  line-height: 1.65;
}

.prose-stack strong {
  color: var(--ink-primary);
  font-weight: 600;
}

/* Quality & Response Diagnostics Grid */
.diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.diag-card {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.diag-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.diag-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-primary);
  margin-bottom: 4px;
}

.diag-desc {
  font-size: 12px;
  color: var(--ink-secondary);
  line-height: 1.45;
}

/* Below-the-fold heavy rendering optimization (paired with contain-intrinsic-size) */
.trait-deep-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 24px;
  content-visibility: auto;
  contain-intrinsic-size: auto 420px;
}

.rel-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  content-visibility: auto;
  contain-intrinsic-size: auto 150px;
}

.review-table tbody tr:nth-child(n+16) {
  content-visibility: auto;
  contain-intrinsic-size: auto 72px;
}

.paper-q-row:nth-child(n+16) {
  content-visibility: auto;
  contain-intrinsic-size: auto 68px;
}

/* Trait Deep Dive Cards */
.trait-deep-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.trait-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.trait-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.trait-name {
  font-size: 19px;
  font-weight: 700;
}

.trait-band-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.trait-score-box {
  text-align: right;
}

.trait-score-main {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 700;
}

.trait-score-sub {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
}

/* Normative CI Bar */
.norm-bar-wrap {
  position: relative;
  height: 10px;
  background-color: var(--bg-subtle);
  border-radius: 999px;
  margin-bottom: 6px;
  overflow: hidden;
}

.norm-bar-fill {
  height: 100%;
  background-color: var(--accent);
  border-radius: 999px;
}

.norm-bar-ci {
  position: absolute;
  inset-block: 1px;
  background-color: rgba(15, 76, 92, 0.28);
  border-inline: 2px solid var(--signal);
}

.norm-caption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  margin-bottom: 16px;
}

/* Dual-Facet Aspect Breakdown */
.facets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.facet-card {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 14px;
}

.facet-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.facet-bar {
  height: 6px;
  background-color: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.facet-fill {
  height: 100%;
  background-color: var(--signal);
  border-radius: 999px;
}

.facet-desc {
  font-size: 12px;
  color: var(--ink-secondary);
  line-height: 1.45;
}

.strengths-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.mini-box {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--ink-secondary);
}

.mini-box-title {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-primary);
  margin-bottom: 4px;
}

.consistency-panel {
  background-color: var(--bg-page);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.consistency-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.contradiction-list {
  list-style: none;
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-secondary);
}

.contradiction-list li {
  padding: 9px 12px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  line-height: 1.5;
}

.contradiction-list li.flagged {
  background-color: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--ink-primary);
}

details.item-details {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
}

details.item-details summary {
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

details.item-details summary::-webkit-details-marker {
  display: none;
}

.item-table {
  width: 100%;
  min-width: 580px;
  border-collapse: collapse;
  font-size: 12px;
}

.item-table th,
.item-table td {
  padding: 8px 10px;
  border-top: 1px solid var(--border-default);
  text-align: left;
  vertical-align: middle;
}

.item-table th {
  background-color: var(--bg-subtle);
  font-weight: 600;
  color: var(--ink-secondary);
}

/* Cross-Trait Matrix & Action Protocols */
.rel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.rel-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rel-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rel-pair {
  font-size: 14px;
  font-weight: 700;
}

.rel-scores {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
}

.rel-body {
  font-size: 13px;
  color: var(--ink-secondary);
  line-height: 1.55;
}

.protocols-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

/* Printable / Download Center Previews */
.paper-sheet-preview {
  background-color: #FFFFFF;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 24px;
}

.paper-q-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-default);
}

.paper-q-row:last-child {
  border-bottom: none;
}

.paper-bubbles {
  display: inline-flex;
  gap: 6px;
}

.paper-bubble {
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--ink-primary);
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.paper-q-en {
  font-weight: 600;
  font-size: 14px;
}

.paper-q-ne {
  font-size: 13px;
  color: var(--ink-secondary);
}

.blank-slot {
  display: inline-block;
  min-width: 34px;
  height: 24px;
  border-bottom: 1.5px solid var(--ink-primary);
  vertical-align: middle;
}

.blank-slot.rev-slot {
  min-width: 26px;
}

.blank-slot.total-slot {
  min-width: 44px;
}

/* ==========================================================================
   Responsive Breakpoints (Verified down to 360px)
   ========================================================================== */
@media (max-width: 860px) {
  .paths-grid,
  .synthesis-grid,
  .rel-grid,
  .protocols-grid,
  .facets-grid,
  .strengths-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main-container {
    padding: 16px 12px 48px;
  }

  .card,
  .question-card,
  .trait-deep-card {
    padding: 18px 14px;
  }

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

  .scale-item {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    padding: 9px 12px;
  }

  .scale-num {
    margin-bottom: 0;
    width: 22px;
  }

  .qmap-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .kbd-hints {
    display: none;
  }

  .paper-q-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .review-table,
  .review-table tbody,
  .review-table tr,
  .review-table td {
    display: block;
    width: 100%;
  }

  .review-table thead {
    display: none;
  }

  .review-table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border-strong);
    align-items: center;
  }

  .review-table tbody tr:last-child {
    border-bottom: none;
  }

  .review-table td {
    border: none;
    padding: 0;
  }

  .review-table td:nth-child(1),
  .review-table td:nth-child(2) {
    grid-column: 1 / -1;
  }

  .review-table td:nth-child(4) {
    justify-self: end;
  }
}

/* ==========================================================================
   Print Stylesheets (Supports Full Report & Selective Download Sheet Printing)
   ========================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 11mm;
  }

  body {
    background-color: #FFFFFF;
    color: #000000;
  }

  .site-header,
  .site-footer,
  .no-print,
  .results-actions {
    display: none !important;
  }

  .main-container {
    max-width: 100%;
    padding: 0;
  }

  .card,
  .paper-sheet-preview {
    border: 1px solid #C9C9C2;
    padding: 12px;
  }

  .trait-deep-card,
  .rel-card,
  .diag-card,
  .facet-card,
  .subcard {
    border: 1px solid #C9C9C2;
    padding: 12px;
    break-inside: avoid;
    content-visibility: visible !important;
  }

  .review-table tbody tr,
  .paper-q-row {
    content-visibility: visible !important;
  }

  .table-wrap {
    overflow: visible;
    border: 1px solid #141413;
  }

  .scoring-table {
    min-width: 0;
    font-size: 11px;
  }

  .scoring-table thead th {
    background-color: #F1F1EE !important;
    color: #141413 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Selective printing on download.html */
  body.print-only-questionnaire .print-sheet-scoresheet,
  body.print-only-questionnaire .download-intro {
    display: none !important;
  }

  body.print-only-scoresheet .print-sheet-questionnaire,
  body.print-only-scoresheet .download-intro {
    display: none !important;
  }

  .paper-q-row {
    break-inside: avoid;
    page-break-inside: avoid;
    padding: 5px 0;
  }

  .print-scoresheet-break {
    break-before: page;
    page-break-before: always;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Download PDF exact 3+1 layout: 3 pages Questionnaire + 1 single page Score Sheet */
  body[data-page="download"] .main-container {
    gap: 0;
    padding: 0;
  }

  body[data-page="download"] .card,
  body[data-page="download"] .paper-sheet-preview {
    border: none;
    padding: 0;
    border-radius: 0;
  }

  body[data-page="download"] .stack-md {
    gap: 6px;
  }

  body[data-page="download"] .page-title {
    font-size: 17px;
    line-height: 1.2;
  }

  body[data-page="download"] .scale-compact-box {
    grid-template-columns: repeat(5, 1fr);
    text-align: center;
    padding: 4px 6px;
    gap: 4px;
    font-size: 9.5px;
    line-height: 1.25;
  }

  body[data-page="download"] .scale-compact-item strong {
    font-size: 10.5px;
  }

  body[data-page="download"] .paper-q-row {
    grid-template-columns: 32px 1fr auto;
    gap: 8px;
    padding: 5.5px 0;
    min-height: 10.5mm;
  }

  #questionnairePreview .paper-q-row:nth-child(18),
  #questionnairePreview .paper-q-row:nth-child(35) {
    break-before: page;
    page-break-before: always;
    border-top: none;
  }

  body[data-page="download"] .paper-q-en {
    font-size: 11px;
    line-height: 1.25;
  }

  body[data-page="download"] .paper-q-ne {
    font-size: 10.5px;
    line-height: 1.25;
  }

  body[data-page="download"] .paper-bubbles {
    gap: 4px;
  }

  body[data-page="download"] .paper-bubble {
    width: 22px;
    height: 22px;
    font-size: 10.5px;
  }

  body[data-page="download"] .print-scoresheet-break .section-heading {
    font-size: 15px;
    margin-bottom: 2px !important;
  }

  body[data-page="download"] .print-scoresheet-break .section-sub {
    font-size: 10px;
    line-height: 1.3;
  }

  #scoreSheetPreview.scoring-table {
    width: 100%;
    table-layout: fixed;
    font-size: 10px;
  }

  #scoreSheetPreview.scoring-table .row-label {
    width: 52px;
    font-size: 9.5px;
    padding: 2px 4px;
  }

  #scoreSheetPreview.scoring-table thead th {
    padding: 5px 4px;
    font-size: 10.5px;
    line-height: 1.2;
  }

  #scoreSheetPreview.scoring-table thead th span {
    font-size: 8.5px;
    margin-bottom: 1px;
  }

  #scoreSheetPreview.scoring-table tr.sno-row td,
  #scoreSheetPreview.scoring-table tr.sno-row th {
    padding: 3px 4px;
    font-size: 9.5px;
    line-height: 1.2;
  }

  #scoreSheetPreview.scoring-table tr.score-row td,
  #scoreSheetPreview.scoring-table tr.score-row th {
    padding: 5px 4px;
    font-size: 10px;
    line-height: 1.2;
  }

  #scoreSheetPreview.scoring-table td.rev-cell {
    white-space: nowrap;
  }

  #scoreSheetPreview.scoring-table .hero-intro-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  align-items: center;
}

.hero-media {
  margin: 0;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--bg-subtle);
}

.hero-media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
}

.article-figure {
  margin: 0;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--bg-subtle);
}

.article-figure img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
}

.blank-slot {
    min-width: 28px;
    height: 16px;
    border-bottom-width: 1.2px;
  }

  #scoreSheetPreview.scoring-table .blank-slot.rev-slot {
    min-width: 18px;
  }

  #scoreSheetPreview.scoring-table .blank-slot.total-slot {
    min-width: 30px;
  }

  #scoreSheetPreview.scoring-table tfoot td,
  #scoreSheetPreview.scoring-table tfoot th {
    padding: 6px 4px;
    font-size: 10.5px;
  }
}
