/* ==========================================================================
   Test Temperamentu v2.0 — Botanical Field Journal & Earth-Pigment UI
   Warm unbleached paper, mineral pigments, editorial serif + local Outfit,
   WCAG 2.1 AA (>= 4.5:1), mobile-first (>= 44px touch targets)
   ========================================================================== */

/* 1. Local Typography (@font-face — zero external network requests)
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../assets/fonts/outfit-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../assets/fonts/outfit-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* 2. Design Tokens — Unbleached Paper, Pine Ink & Natural Mineral Pigments
   -------------------------------------------------------------------------- */
:root {
  --bg-primary: #f2ede2;
  --bg-secondary: #e8e0cf;
  --surface-card: #faf7f0;
  --surface-card-hover: #f5efe3;
  --surface-elevated: #fffdf8;
  --surface-tinted: #efe9dc;
  --surface-input: #fffdf9;

  --border-subtle: #dcd3c1;
  --border-strong: #bdb19b;
  --border-control: #827968;    /*  3.8:1 on #faf7f0, 3.5:1 on #f5f0e5 (WCAG 1.4.11) */
  --border-ink: #2c4c37;

  --text-primary: #1f271e;      /* 14.3:1 on #faf7f0 */
  --text-secondary: #3e483c;    /*  9.0:1 on #faf7f0 */
  --text-muted: #5a6255;        /*  5.8:1 on #faf7f0 */
  --text-link: #2c4c37;         /*  9.3:1 on #faf7f0 */
  --text-on-accent: #faf7f0;

  /* Natural botanical brand palette */
  --brand-forest: #2c4c37;
  --brand-forest-hover: #213b2a;
  --brand-moss: #486b4d;
  --brand-sage: #7c937a;
  --brand-sage-wash: #e6eee3;
  --brand-sage-border: #b8c9b4;
  --brand-ochre: #965e10;
  --brand-clay: #a83e2b;

  /* 4 Semantic Temperament Mineral Pigments — WCAG 2.1 AA on #faf7f0 & tinted surfaces */
  --color-sangwinik: #8a530b;        /*  5.66:1 text & borders (deep honey ochre) */
  --color-sangwinik-fill: #9c610f;   /*  3.95:1 graphical fill on #ece5d6 track */
  --color-choleryk: #a83e2b;         /*  5.79:1 text & borders (burnt terracotta) */
  --color-choleryk-fill: #bc4b36;
  --color-melancholik: #3b566e;      /*  7.16:1 text & borders (mountain river slate) */
  --color-melancholik-fill: #4a6b86;
  --color-flegmatyk: #2f6649;        /*  6.30:1 text & borders (woodland moss) */
  --color-flegmatyk-fill: #3e7d5c;
  --color-balanced: #5b5a34;         /*  6.65:1 (wild olive umber) */
  --color-balanced-text: #5b5a34;

  --color-success: #2f6649;
  --color-error: #9e2f23;
  --color-info: #3b566e;

  --font-body: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Palatino, Georgia, Cambria, 'Times New Roman', serif;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --shadow-card: 0 1px 2px rgba(31, 39, 30, 0.04), 0 10px 26px -18px rgba(31, 39, 30, 0.16);
  --shadow-toast: 0 8px 24px -8px rgba(31, 39, 30, 0.18), 0 2px 6px rgba(31, 39, 30, 0.08);

  --focus-ring: 0 0 0 2px #faf7f0, 0 0 0 4.5px #2c4c37;
  --container-max: 980px;
}

/* 3. Base Reset & Accessibility Helpers
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  color-scheme: light;
  background-color: var(--bg-primary);
}

body.app-body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.012em;
  color: var(--text-primary);
}

p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

button,
input {
  font-family: inherit;
  font-size: inherit;
}

a {
  color: var(--text-link);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

#main-content:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

.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;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--brand-forest);
  color: var(--text-on-accent);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.skip-link:focus-visible {
  transform: translateY(0);
}

.icon {
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

/* 4. Natural Paper Canvas & Static Botanical Line Art Backdrop
   -------------------------------------------------------------------------- */
.bg-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse 85% 60% at 15% 0%, rgba(255, 252, 244, 0.85) 0%, transparent 62%),
    radial-gradient(ellipse 75% 55% at 88% 100%, rgba(220, 211, 192, 0.52) 0%, transparent 65%),
    linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.bg-paper-grain {
  position: absolute;
  inset: 0;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

.bg-botanical {
  position: absolute;
  color: #566a54;
  opacity: 0.11;
  transition: opacity 0.25s ease;
}

.bg-botanical--top-right {
  top: -12px;
  right: -28px;
  width: clamp(190px, 28vw, 340px);
  height: auto;
}

.bg-botanical--bottom-left {
  bottom: -18px;
  left: -34px;
  width: clamp(180px, 26vw, 310px);
  height: auto;
  opacity: 0.095;
}

/* 5. Page Shell, Editorial Masthead & Footer
   -------------------------------------------------------------------------- */
.page-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: 0 14px;
}

.site-header {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 18px 0 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.back-portfolio-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 12px 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.back-portfolio-link:hover {
  color: var(--brand-forest);
  background: rgba(250, 247, 240, 0.72);
  border-color: var(--border-subtle);
  transform: translateX(-2px);
}

.brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(250, 247, 240, 0.8);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand-chip__mark {
  color: var(--brand-forest);
  flex-shrink: 0;
}

.app-main {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 20px 0 42px;
}

.site-footer {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 22px 0 32px;
  border-top: 1px solid var(--border-subtle);
}

.site-footer__inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.privacy-notice {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.58;
}

.privacy-notice strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-link {
  color: var(--text-link);
  text-decoration: underline;
  text-decoration-color: rgba(44, 76, 55, 0.4);
  text-underline-offset: 3px;
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
}

.footer-link:hover {
  color: var(--brand-forest-hover);
  text-decoration-color: var(--brand-forest-hover);
}

/* 6. Archival Paper Surface & Tactile Buttons
   -------------------------------------------------------------------------- */
.glass-card {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--surface-card);
  box-shadow: var(--shadow-card);
}

/* Editorial italic forest emphasis (replaces generic AI gradient text) */
.gradient-text {
  color: var(--brand-forest);
  font-style: italic;
  font-weight: 500;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 0.96rem;
  line-height: 1.25;
  letter-spacing: 0.005em;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: transform 0.16s ease, background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.btn--lg {
  min-height: 52px;
  padding: 13px 28px;
  font-size: 1.02rem;
}

.btn--sm {
  min-height: 44px;
  padding: 9px 16px;
  font-size: 0.9rem;
}

.btn--primary {
  color: var(--text-on-accent);
  background-color: var(--brand-forest);
  border-color: var(--brand-forest);
  box-shadow: 0 2px 6px rgba(44, 76, 55, 0.18);
}

.btn--primary:hover:not(:disabled) {
  background-color: var(--brand-forest-hover);
  border-color: var(--brand-forest-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(33, 59, 42, 0.22);
}

.btn--secondary {
  color: var(--text-primary);
  background-color: var(--surface-elevated);
  border-color: var(--border-control);
}

.btn--secondary:hover:not(:disabled) {
  background-color: var(--surface-tinted);
  border-color: var(--brand-forest);
  color: var(--brand-forest);
  transform: translateY(-1px);
}

.btn--ghost {
  color: var(--text-secondary);
  background-color: transparent;
  border-color: var(--border-control);
}

.btn--ghost:hover:not(:disabled) {
  color: var(--text-primary);
  background-color: var(--surface-tinted);
  border-color: var(--brand-forest);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

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

.btn--primary[aria-disabled="true"] {
  opacity: 1;
  color: #3a4439;
  background-color: #e9e3d5;
  border-color: var(--border-control);
  box-shadow: none;
  cursor: pointer;
}

.btn--primary[aria-disabled="true"]:hover {
  color: var(--text-primary);
  background-color: #e1d9c7;
  border-color: var(--brand-forest);
  transform: none;
  box-shadow: none;
}

/* Social share channel buttons — restrained mineral paper styling */
.btn--social {
  color: var(--text-primary);
  background: var(--surface-elevated);
  border-color: var(--border-control);
  min-height: 44px;
  padding: 10px 18px;
  font-size: 0.9rem;
}

.btn--social-fb {
  border-color: #46627a;
  background: rgba(59, 86, 110, 0.08);
  color: #294156;
}

.btn--social-fb:hover {
  background: rgba(59, 86, 110, 0.16);
  border-color: #3b566e;
}

.btn--social-x {
  border-color: #6f6758;
  background: var(--surface-tinted);
  color: var(--text-primary);
}

.btn--social-x:hover {
  background: #e5decb;
  border-color: var(--text-primary);
}

.btn--social-wa {
  border-color: #356e50;
  background: rgba(47, 102, 73, 0.08);
  color: #214e36;
}

.btn--social-wa:hover {
  background: rgba(47, 102, 73, 0.16);
  border-color: #2f6649;
}

.btn--social-native {
  border-color: #8a530b;
  background: rgba(138, 83, 11, 0.08);
  color: #744608;
}

.btn--social-native:hover {
  background: rgba(138, 83, 11, 0.16);
  border-color: #744608;
}

.noscript-banner {
  padding: 16px 20px;
  margin-bottom: 18px;
  border-color: rgba(168, 62, 43, 0.4);
  background: #fbf0ed;
  color: var(--text-primary);
}

.inline-alert {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(158, 47, 35, 0.35);
  border-left: 3px solid var(--color-error);
  background: #fbf0ed;
}

.inline-alert__text {
  color: #7a2016;
  font-size: 0.92rem;
}

/* 7. Screen 1: Intro Editorial Hero & 4 Temperaments Field Guide
   -------------------------------------------------------------------------- */
.screen {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.hero-card {
  padding: 28px 20px;
  overflow: hidden;
  border-top: 3px solid var(--brand-forest);
}

.hero-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: center;
}

.hero-content {
  text-align: left;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--brand-forest);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.hero-badge__rule {
  display: inline-block;
  width: 24px;
  height: 1.5px;
  background: var(--brand-sage);
}

.hero-title {
  font-size: clamp(2rem, 6.2vw, 3.15rem);
  line-height: 1.12;
  margin-bottom: 16px;
}

.hero-subtitle {
  max-width: 56ch;
  margin: 0 0 24px;
  color: var(--text-secondary);
  font-size: clamp(0.98rem, 2.2vw, 1.07rem);
  line-height: 1.7;
}

/* Editorial ledger metrics strip (replaces boxed AI stat cards) */
.hero-metrics {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  max-width: 520px;
  margin: 0 0 26px;
  padding: 13px 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.metric-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  padding: 0 12px 0 0;
}

.metric-pill + .metric-pill {
  padding-left: 14px;
  border-left: 1px solid var(--border-subtle);
}

.metric-pill__value {
  font-family: var(--font-display);
  font-size: 1.06rem;
  font-weight: 600;
  color: var(--text-primary);
}

.metric-pill__label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
}

/* Botanical Compass Plate illustration in Hero */
.hero-plate {
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 268px;
  width: 100%;
  padding: 14px 12px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: #f5f0e5;
}

.hero-plate__svg {
  width: 100%;
  height: auto;
  display: block;
}

.plate-ring-outer {
  stroke: #cfc5b2;
  stroke-width: 1.2;
}

.plate-ring-fine {
  stroke: #dfd7c6;
  stroke-width: 1;
}

.plate-ring-dashed {
  stroke: #cfc5b2;
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.plate-axis {
  stroke: #b9ae99;
  stroke-width: 1;
}

.plate-diag {
  stroke: #dfd7c6;
  stroke-width: 0.85;
  stroke-dasharray: 2 4;
}

.plate-q--flegmatyk { color: var(--color-flegmatyk); }
.plate-q--sangwinik { color: var(--color-sangwinik); }
.plate-q--melancholik { color: var(--color-melancholik); }
.plate-q--choleryk { color: var(--color-choleryk); }

.plate-center-star {
  fill: #faf7f0;
  stroke: var(--brand-forest);
  stroke-width: 1.2;
}

.plate-center-dot {
  fill: var(--brand-forest);
}

.plate-label {
  font-family: var(--font-body);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  fill: var(--text-muted);
}

.hero-plate__caption {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* Saved Progress Resume Banner */
.resume-banner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  margin-top: 24px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--brand-sage-border);
  border-left: 3px solid var(--brand-forest);
  background: var(--brand-sage-wash);
  text-align: left;
}

.resume-banner__title {
  color: var(--brand-forest);
  font-weight: 600;
  font-size: 0.96rem;
  margin-bottom: 2px;
}

.resume-banner__meta {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.resume-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Intro SEO Overview Section — Botanical Specimen Cards */
.intro-overview {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-heading {
  font-size: clamp(1.4rem, 3.6vw, 1.85rem);
}

.section-lead {
  color: var(--text-secondary);
  font-size: 0.97rem;
  max-width: 74ch;
  line-height: 1.68;
}

.temperament-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.temperament-card {
  padding: 20px 20px 22px 22px;
  border-left: 3.5px solid var(--card-accent, var(--brand-forest));
  transition: transform 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.temperament-card:hover {
  transform: translateY(-1px);
  background: var(--surface-card-hover);
}

.temperament-card--sangwinik {
  --card-accent: var(--color-sangwinik);
}

.temperament-card--choleryk {
  --card-accent: var(--color-choleryk);
}

.temperament-card--melancholik {
  --card-accent: var(--color-melancholik);
}

.temperament-card--flegmatyk {
  --card-accent: var(--color-flegmatyk);
}

.temperament-card__top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.temperament-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.temperament-dot--sangwinik { background-color: var(--color-sangwinik-fill); }
.temperament-dot--choleryk { background-color: var(--color-choleryk-fill); }
.temperament-dot--melancholik { background-color: var(--color-melancholik-fill); }
.temperament-dot--flegmatyk { background-color: var(--color-flegmatyk-fill); }
.temperament-dot--balanced { background-color: var(--color-balanced); }

.temperament-card__quadrant {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.temperament-card__numeral {
  margin-left: auto;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--border-strong);
}

.temperament-card__name {
  font-size: 1.32rem;
  margin-bottom: 4px;
}

.temperament-card__archetype {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--card-accent);
  margin-bottom: 9px;
}

.temperament-card__desc {
  font-size: 0.93rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.methodology-card {
  padding: 20px 22px;
  background: var(--surface-tinted);
  border-color: var(--border-subtle);
  border-left: 3px solid var(--brand-sage);
  box-shadow: none;
}

.methodology-card__title {
  font-size: 1.08rem;
  margin-bottom: 6px;
}

.methodology-card__text {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.methodology-card__text strong {
  color: var(--text-primary);
}

/* 8. Screen 2: Quiz View (Archival Paper Questionnaire, 0–3 >= 44x44px)
   -------------------------------------------------------------------------- */
.quiz-card {
  padding: 18px 16px 22px;
  border-top: 3px solid var(--brand-forest);
}

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

.progress-text {
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

.progress-track {
  width: 100%;
  height: 7px;
  border-radius: var(--radius-pill);
  background: #e3dbca;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-fill {
  height: 100%;
  width: 6.25%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--brand-forest), var(--brand-moss));
  transition: width 0.28s ease;
}

.quiz-question-header {
  margin-bottom: 18px;
}

.quiz-instruction {
  font-size: 0.87rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.question-heading {
  font-size: clamp(1.32rem, 4.4vw, 1.8rem);
  line-height: 1.25;
  color: var(--text-primary);
}

.answers-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

/* Individual statement card rendered by quizView.js */
.statement-card {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: #f5f0e5;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.statement-card--answered {
  border-color: #557b58;
  background: #ecf2e9;
}

.statement-card--missing {
  border-color: #b24937;
  background: #f9ede9;
}

.statement-text {
  font-size: 0.96rem;
  line-height: 1.5;
  color: var(--text-primary);
  margin-bottom: 11px;
  font-weight: 500;
}

/* 4-option 0–3 radiogroup: on 360px viewport -> ~66px x 52px per button (>= 44x44px) */
.scale-group {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.scale-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 44px;
  min-height: 52px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-control);
  background: var(--surface-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.scale-option:hover {
  background: #ede6d6;
  border-color: var(--brand-forest);
  color: var(--text-primary);
}

.scale-option[aria-checked="true"] {
  background: var(--brand-forest);
  border-color: var(--brand-forest);
  color: var(--text-on-accent);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.14);
}

.scale-option__num {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.1;
}

.scale-option__label {
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.15;
  color: inherit;
}

.quiz-footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.quiz-hint {
  font-size: 0.88rem;
  color: var(--text-muted);
  min-height: 1.3em;
}

.quiz-hint--ready {
  color: var(--color-flegmatyk);
  font-weight: 500;
}

/* 9. Screen 3: Result View (Natural Field Report: Bars, 2D Map, Advice)
   -------------------------------------------------------------------------- */
.print-meta {
  display: none;
}

.shared-banner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 20px;
  border-color: var(--brand-sage-border);
  border-left: 3.5px solid var(--brand-forest);
  background: var(--brand-sage-wash);
}

.shared-banner__badge {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-forest);
  margin-bottom: 4px;
}

.shared-banner__text {
  font-size: 0.93rem;
  color: var(--text-secondary);
}

.result-archetype {
  padding: 26px 20px;
  overflow: hidden;
}

.result-archetype::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--brand-forest);
}

.result-archetype--sangwinik::before { background: var(--color-sangwinik-fill); }
.result-archetype--choleryk::before { background: var(--color-choleryk-fill); }
.result-archetype--melancholik::before { background: var(--color-melancholik-fill); }
.result-archetype--flegmatyk::before { background: var(--color-flegmatyk-fill); }
.result-archetype--mixed::before {
  background: linear-gradient(90deg, var(--brand-forest), var(--brand-ochre));
}
.result-archetype--balanced::before {
  background: linear-gradient(
    90deg,
    var(--color-flegmatyk-fill) 0% 25%,
    var(--color-sangwinik-fill) 25% 50%,
    var(--color-melancholik-fill) 50% 75%,
    var(--color-choleryk-fill) 75% 100%
  );
}

.archetype-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  margin-bottom: 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background: var(--surface-tinted);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.result-heading {
  font-size: clamp(1.7rem, 5vw, 2.55rem);
  margin-bottom: 6px;
}

.archetype-subtitle {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.12rem;
  font-weight: 500;
  color: var(--brand-forest);
  margin-bottom: 14px;
}

.archetype-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.type-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-strong);
  background: var(--surface-tinted);
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--text-primary);
}

.type-pill--sangwinik { border-color: rgba(138, 83, 11, 0.55); color: var(--color-sangwinik); background: rgba(156, 97, 15, 0.09); }
.type-pill--choleryk { border-color: rgba(168, 62, 43, 0.45); color: var(--color-choleryk); background: rgba(188, 75, 54, 0.1); }
.type-pill--melancholik { border-color: rgba(59, 86, 110, 0.45); color: var(--color-melancholik); background: rgba(74, 107, 134, 0.11); }
.type-pill--flegmatyk { border-color: rgba(47, 102, 73, 0.45); color: var(--color-flegmatyk); background: rgba(62, 125, 92, 0.11); }
.type-pill--balanced { border-color: rgba(91, 90, 52, 0.45); color: var(--color-balanced-text); background: rgba(91, 90, 52, 0.1); }

.archetype-desc {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.7;
  max-width: 72ch;
}

.archetype-combo-advice,
.archetype-secondary-note {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--brand-forest);
  background: var(--surface-tinted);
  color: var(--text-secondary);
  font-size: 0.94rem;
  line-height: 1.6;
}

.archetype-combo-advice strong,
.archetype-secondary-note strong {
  color: var(--text-primary);
}

.empty-result-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.empty-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

/* Visual Analytics Grid (4 Bars + 2D Eysenck SVG Map) */
.result-visuals-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.result-panel {
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-panel__header {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.result-panel__title {
  font-size: 1.18rem;
}

.result-panel__subtitle {
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* 4 Temperament Percentage Bars */
.result-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-item {
  --bar-color: var(--brand-forest);
  --bar-fill-color: var(--brand-forest);
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: #f6f1e6;
}

.bar-item--dominant {
  border-color: var(--border-strong);
  background: var(--surface-elevated);
}

.bar-item--sangwinik { --bar-color: var(--color-sangwinik); --bar-fill-color: var(--color-sangwinik-fill); }
.bar-item--choleryk { --bar-color: var(--color-choleryk); --bar-fill-color: var(--color-choleryk-fill); }
.bar-item--melancholik { --bar-color: var(--color-melancholik); --bar-fill-color: var(--color-melancholik-fill); }
.bar-item--flegmatyk { --bar-color: var(--color-flegmatyk); --bar-fill-color: var(--color-flegmatyk-fill); }

.bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bar-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bar-name {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--text-primary);
}

.bar-role-badge {
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--bar-color);
  border: 1px solid currentColor;
  background: var(--surface-elevated);
}

.bar-pct {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--bar-color);
  white-space: nowrap;
}

.bar-track {
  width: 100%;
  height: 9px;
  border-radius: var(--radius-xs);
  background: #ece5d6;
  box-shadow: inset 0 0 0 1px #d2c8b4;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-xs);
  background-color: var(--bar-fill-color);
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.bar-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* 2D Eysenck SVG Map Container — Cartographic Parchment Diagram */
.result-map-svg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

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

.eysenck-svg .svg-bg {
  fill: #f5f0e4;
  stroke: var(--border-control);
  stroke-width: 1.5;
}

.eysenck-svg .svg-quadrant {
  stroke: none;
}

.eysenck-svg .svg-q-sangwinik { fill: rgba(156, 97, 15, 0.09); }
.eysenck-svg .svg-q-choleryk { fill: rgba(188, 75, 54, 0.1); }
.eysenck-svg .svg-q-melancholik { fill: rgba(74, 107, 134, 0.11); }
.eysenck-svg .svg-q-flegmatyk { fill: rgba(62, 125, 92, 0.11); }

.eysenck-svg .svg-ring {
  fill: none;
  stroke: rgba(90, 98, 85, 0.24);
  stroke-width: 1;
  stroke-dasharray: 2.5 4;
}

.eysenck-svg .svg-axis {
  stroke: #7f7868;
  stroke-width: 1.4;
}

.eysenck-svg .svg-q-label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.eysenck-svg .svg-q-label-sangwinik { fill: var(--color-sangwinik); }
.eysenck-svg .svg-q-label-choleryk { fill: var(--color-choleryk); }
.eysenck-svg .svg-q-label-melancholik { fill: var(--color-melancholik); }
.eysenck-svg .svg-q-label-flegmatyk { fill: var(--color-flegmatyk); }

.eysenck-svg .svg-axis-label {
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 500;
  fill: var(--text-muted);
}

.eysenck-svg .svg-point--sangwinik { --point-color: var(--color-sangwinik); }
.eysenck-svg .svg-point--choleryk { --point-color: var(--color-choleryk); }
.eysenck-svg .svg-point--melancholik { --point-color: var(--color-melancholik); }
.eysenck-svg .svg-point--flegmatyk { --point-color: var(--color-flegmatyk); }
.eysenck-svg .svg-point--balanced { --point-color: var(--color-balanced); }

.eysenck-svg .svg-vector {
  stroke: var(--point-color, var(--brand-forest));
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  opacity: 0.72;
}

.eysenck-svg .svg-point-pulse {
  fill: var(--point-color, var(--brand-forest));
  opacity: 0.18;
  transform-box: fill-box;
  transform-origin: center;
  animation: eysenckBreath 3.6s ease-in-out infinite;
}

.eysenck-svg .svg-point-core {
  fill: var(--point-color, var(--brand-forest));
  stroke: #fffdf8;
  stroke-width: 2.5;
}

@keyframes eysenckBreath {
  0%, 100% {
    transform: scale(1);
    opacity: 0.16;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.3;
  }
}

.eysenck-coords-caption {
  font-size: 0.84rem;
  color: var(--text-muted);
  text-align: center;
}

/* Strengths & Watch-outs Details Grid */
.result-details {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.detail-card {
  padding: 22px 20px;
}

.detail-card__title {
  font-size: 1.18rem;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-list li {
  position: relative;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 0.94rem;
  line-height: 1.55;
}

.detail-list li::before {
  content: '';
  position: absolute;
  left: 1px;
  top: 0.56em;
  width: 6px;
  height: 6px;
  border-radius: 1px;
  transform: rotate(45deg);
  background: var(--brand-forest);
}

.detail-list--strengths li::before {
  background: var(--color-flegmatyk-fill);
}

.detail-list--weaknesses li::before {
  background: var(--color-sangwinik-fill);
}

/* Practical Advice Section */
.result-advice {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.advice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.advice-card {
  padding: 20px;
  border-top: 2.5px solid var(--brand-sage-border);
}

.advice-card__title {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.advice-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.advice-list li {
  position: relative;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.58;
}

.advice-list li::before {
  content: '—';
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 500;
  color: var(--brand-forest);
}

/* Result Action Bar & Share Panel */
.result-actions-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
}

.share-panel {
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-color: var(--brand-sage-border);
  background: #f5f3ec;
}

.share-panel__title {
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.share-panel__subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.share-link-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.share-link-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-control);
  background: var(--surface-input);
  color: var(--text-primary);
  font-size: 0.92rem;
}

.share-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Cross-link Card (/test-predyspozycji/) — Soft Sage Botanical Note */
.crosslink-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 20px;
  border-color: var(--brand-sage-border);
  background: var(--brand-sage-wash);
}

.crosslink-card__eyebrow {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--brand-forest);
  margin-bottom: 6px;
}

.crosslink-card__title {
  font-size: 1.24rem;
  margin-bottom: 6px;
}

.crosslink-card__text {
  font-size: 0.93rem;
  color: var(--text-secondary);
  max-width: 58ch;
  line-height: 1.6;
}

/* 10. Toast Notification Region (replaces alert())
   -------------------------------------------------------------------------- */
.toast-region {
  position: fixed;
  right: 14px;
  bottom: 14px;
  left: 14px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  max-width: 400px;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface-elevated);
  box-shadow: var(--shadow-toast);
  color: var(--text-primary);
  font-size: 0.92rem;
  line-height: 1.45;
}

.toast--info { border-left: 4px solid var(--color-info); }
.toast--success { border-left: 4px solid var(--color-success); }
.toast--error { border-left: 4px solid var(--color-error); }

.toast__message {
  flex: 1 1 auto;
}

.toast__close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
}

.toast__close:hover {
  color: var(--text-primary);
  background: var(--surface-tinted);
}

/* 11. Responsive Breakpoints (Mobile-first)
   -------------------------------------------------------------------------- */
@media (min-width: 640px) {
  .page-shell {
    padding: 0 24px;
  }

  .hero-card {
    padding: 36px 32px;
  }

  .quiz-card {
    padding: 28px 30px 30px;
  }

  .statement-card {
    padding: 16px 18px;
  }

  .scale-group {
    gap: 10px;
  }

  .scale-option {
    min-height: 56px;
    padding: 8px 10px;
  }

  .scale-option__label {
    font-size: 0.8rem;
  }

  .temperament-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .resume-banner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .shared-banner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .quiz-footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .result-actions-bar {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .share-link-row {
    flex-direction: row;
    align-items: center;
  }

  .share-link-input {
    flex: 1 1 auto;
  }

  .result-details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toast-region {
    left: auto;
    right: 20px;
    bottom: 20px;
  }
}

@media (min-width: 780px) {
  .hero-layout {
    grid-template-columns: minmax(0, 1.38fr) minmax(240px, 0.85fr);
    gap: 36px;
  }

  .hero-plate {
    max-width: 290px;
    margin: 0 0 0 auto;
  }
}

@media (min-width: 860px) {
  .result-visuals-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    align-items: stretch;
  }

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

  .crosslink-card {
    flex-direction: row;
    align-items: center;
    padding: 24px 28px;
  }

  .result-archetype {
    padding: 32px 30px;
  }
}

/* 12. Reduced Motion Preference (WCAG 2.1 AA)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .eysenck-svg .svg-point-pulse {
    animation: none !important;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
