/* ============================================================
   Moralkompass — Modern-Minimal UI
   Off-White Hintergrund, dunkles Grafit, Tiefblau-Akzent
   Mobile-first, responsiv bis Desktop
   ============================================================ */

/* === Design-Tokens === */
:root {
  --bg:           #FAFAF7;
  --bg-card:     #FFFFFF;
  --bg-subtle:   #F2F0E9;
  --text:        #1C1C1C;
  --text-muted:  #5A5A57;
  --text-faint:  #8A8A85;
  --border:      #E2DFD6;
  --border-strong: #C9C5B7;
  --accent:      #1E3A5F;
  --accent-hover: #15294A;
  --accent-soft: #E8EEF5;
  --success:     #2D6A4F;
  --warning:     #B5651D;
  --danger:      #8B2A2A;

  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(28, 28, 28, 0.04);
  --shadow:    0 2px 8px rgba(28, 28, 28, 0.06);
  --shadow-lg: 0 12px 32px rgba(28, 28, 28, 0.10);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Apple Garamond", "Baskerville", "Times New Roman", serif;

  --max-w: 720px;
  --max-w-wide: 1080px;
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === Header === */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header-inner {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
}
.site-title a { color: inherit; text-decoration: none; }
.site-tag {
  font-size: 13px;
  color: var(--text-muted);
}
@media (max-width: 480px) {
  .site-tag { display: none; }
}

/* === Layout === */
main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px 20px 96px;
}
main.wide { max-width: var(--max-w-wide); }

/* === Typografie === */
h1 {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}
h2 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  margin: 36px 0 14px;
  letter-spacing: -0.005em;
}
h3 {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 600;
  margin: 24px 0 10px;
  color: var(--text);
}
p { margin: 0 0 16px; }
.lead {
  font-size: 18px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
}
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); font-size: 14px; }

/* === Cards === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}
@media (max-width: 480px) {
  .card { padding: 20px 18px; }
}
.card-subtle {
  background: var(--bg-subtle);
  border-color: transparent;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}
.card-header h2, .card-header h3 { margin: 0; }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 16px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-primary:disabled {
  background: var(--border-strong);
  cursor: not-allowed;
}
.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-subtle); text-decoration: none; }
.btn-block { display: flex; width: 100%; }
.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.btn-row .btn { flex: 1 1 200px; }

/* === Forms === */
label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
input[type="text"], input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  font: inherit;
  font-size: 17px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  letter-spacing: 0.05em;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:focus, input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input-code {
  text-align: center;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 22px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.form-group { margin-bottom: 18px; }
.form-help {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* === Code-Display === */
.code-display {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.2em;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 16px 20px;
  border-radius: var(--radius);
  text-align: center;
  border: 1px dashed var(--accent);
  margin: 16px 0;
  word-break: break-all;
}

/* ============================================================
   SURVEY-SPEZIFISCH
   ============================================================ */

/* Progress-Bar */
.progress-wrap {
  position: sticky;
  top: 65px;
  z-index: 5;
  background: var(--bg);
  padding: 12px 0 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

/* Frage-Container */
.question-block {
  padding: 8px 0;
}
.section-tag {
  display: inline-block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 12px;
}
.question-text {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  margin: 0 0 28px;
}
@media (max-width: 480px) {
  .question-text { font-size: 19px; }
}

/* Likert-Skala */
.likert-scale {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.likert-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.likert-option:hover {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}
.likert-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}
.likert-option input[type="radio"] {
  position: absolute;
  opacity: 0;
}
.likert-marker {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  transition: border-color 0.15s, background 0.15s;
}
.likert-option.selected .likert-marker {
  border-color: var(--accent);
  background: var(--accent);
}
.likert-option.selected .likert-marker::after {
  content: "";
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
}
.likert-label { font-size: 16px; }
.likert-num {
  font-size: 13px;
  color: var(--text-faint);
  margin-left: auto;
  font-family: ui-monospace, monospace;
}

/* MC4 */
.mc4-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mc4-option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  text-align: left;
}
.mc4-option:hover {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}
.mc4-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}
.mc4-option input[type="radio"] {
  position: absolute;
  opacity: 0;
}
.mc4-letter {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
}
.mc4-option.selected .mc4-letter {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.mc4-text {
  flex: 1;
  font-size: 16px;
  line-height: 1.45;
}

/* Survey-Footer mit Buttons */
.survey-actions {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.survey-actions .btn { flex: 0 1 auto; }
.survey-actions .btn-back { flex: 0 1 auto; }
.survey-actions .btn-next { flex: 1; }
@media (min-width: 600px) {
  .survey-actions .btn-next { flex: 0 1 240px; }
}

/* Resume-Hinweis */
.resume-hint {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 24px;
}

/* ============================================================
   RESULT-SEITE
   ============================================================ */

.result-hero {
  text-align: center;
  padding: 32px 0 12px;
}
.result-profile-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  color: var(--accent);
}
.result-profile-name {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 600;
  margin: 0 0 8px;
}
.result-profile-quality {
  font-size: 14px;
  color: var(--text-muted);
}

/* Score-Bars (Achsen-Visualisierung) */
.score-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 720px) {
  .score-grid { grid-template-columns: 1fr 1fr; gap: 20px; }
}
.score-item {
  padding: 14px 0;
}
.score-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.score-label {
  font-size: 14px;
  font-weight: 500;
}
.score-value {
  font-size: 14px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.score-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.score-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.6s ease;
}
.score-fill.dim-MFT  { background: #1E3A5F; }
.score-fill.dim-REL  { background: #2D5F4E; }
.score-fill.dim-SEX  { background: #8B2A4F; }
.score-fill.dim-LIFE { background: #5F4A2D; }
.score-fill.dim-SVS  { background: #3F3A5F; }

/* Kategorien-Sektionen */
.category-section {
  margin-bottom: 36px;
}
.category-title {
  font-family: var(--font-sans);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

/* Kodex-Aussagen */
.codex-list { list-style: none; padding: 0; margin: 0; }
.codex-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.codex-item:last-child { border-bottom: 0; }
.codex-statement {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.5;
  color: var(--text);
  margin: 0 0 6px;
}
.codex-meta {
  font-size: 12px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.codex-strength-high { border-left: 3px solid var(--accent); padding-left: 16px; }
.codex-strength-low  { border-left: 3px solid var(--text-faint); padding-left: 16px; }

/* Validity-Box */
.validity-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  background: var(--bg-card);
}
.validity-overall {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}
.validity-score {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.validity-label {
  font-size: 14px;
  color: var(--text-muted);
}
.validity-warning {
  background: #FFF6E6;
  border-left: 3px solid var(--warning);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: #5A3A0A;
  margin-top: 12px;
}
.validity-good {
  background: #EAF5EF;
  border-left: 3px solid var(--success);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: #1A4A36;
  margin-top: 12px;
}
.validity-detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 16px;
  font-size: 14px;
}
@media (min-width: 600px) {
  .validity-detail-grid { grid-template-columns: 1fr 1fr; }
}
.validity-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.validity-detail-row:last-child { border-bottom: 0; }

/* Toggle (Validity-Details ein/aus) */
.toggle-details {
  background: none;
  border: 0;
  color: var(--accent);
  font-size: 14px;
  padding: 8px 0;
  text-decoration: underline;
  cursor: pointer;
}
.toggle-details:hover { color: var(--accent-hover); }
.collapsible[hidden] { display: none; }

/* Share/Compare-Box */
.share-box {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  text-align: center;
  margin: 28px 0;
}
.share-box h3 {
  color: #fff;
  margin: 0 0 8px;
  font-size: 18px;
}
.share-box .code-display {
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.30);
  margin: 14px 0 18px;
}
.share-box p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  margin: 0 0 12px;
}
.share-box .btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.40);
}
.share-box .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ============================================================
   COMPARE-SEITE
   ============================================================ */

.compat-hero {
  text-align: center;
  padding: 16px 0 8px;
}
.compat-score {
  font-family: var(--font-serif);
  font-size: 64px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
  margin: 8px 0 6px;
  font-variant-numeric: tabular-nums;
}
.compat-label {
  font-size: 18px;
  color: var(--text-muted);
}
.compat-codes {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-family: ui-monospace, monospace;
  font-size: 14px;
  color: var(--text-faint);
  margin-top: 4px;
}
.compat-codes .code {
  background: var(--bg-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.1em;
}

/* Vergleichs-Achse */
.compare-axis {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.compare-axis:last-child { border-bottom: 0; }
.compare-axis-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.compare-axis-label { font-size: 14px; font-weight: 500; }
.compare-diff {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.compare-diff.high { color: var(--warning); font-weight: 500; }
.compare-diff.critical { color: var(--danger); font-weight: 600; }
.compare-track {
  position: relative;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  margin-top: 4px;
}
.compare-marker {
  position: absolute;
  top: -3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  transform: translateX(-50%);
  z-index: 2;
}
.compare-marker.a { background: #1E3A5F; }
.compare-marker.b { background: #B5651D; }
.compare-track-bridge {
  position: absolute;
  top: 3px;
  height: 2px;
  background: var(--text-faint);
  opacity: 0.4;
  z-index: 1;
}
.compare-legend {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.compare-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.compare-legend-dot.a { background: #1E3A5F; }
.compare-legend-dot.b { background: #B5651D; }

/* Critical Mismatches */
.mismatch-card {
  border-left: 3px solid var(--danger);
  padding: 14px 18px;
  background: #FBEFEF;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}
.mismatch-card h4 {
  margin: 0 0 6px;
  font-size: 15px;
  color: #5A1A1A;
}
.mismatch-card p {
  margin: 0;
  font-size: 14px;
  color: #5A1A1A;
  line-height: 1.5;
}

/* Discussion Topics */
.discussion-list { list-style: none; padding: 0; margin: 0; }
.discussion-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.discussion-item:last-child { border-bottom: 0; }
.discussion-topic {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.discussion-prompt {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.45;
  margin: 0;
}

/* === Footer === */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  padding: 24px 20px;
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
  margin-top: 64px;
}
.site-footer a { color: var(--text-muted); }

/* === Utility === */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 16px; }
.mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 16px; }

/* === Spinner === */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Print === */
@media print {
  .site-header, .site-footer, .btn, .toggle-details, .share-box { display: none; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}
