/* ===================== ПЕРЕМЕННЫЕ ===================== */
:root {
  --accent-primary: #6366f1;
  --accent-secondary: #818cf8;
  --accent-light: #c7d2fe;

  --text-primary: #e0e0f0;
  --text-secondary: #8888a0;
  --text-muted: #6a6a90;

  --card-bg: #fff;
  --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  --card-radius: 18px;

  --card-dark-bg: rgba(99, 102, 241, 0.08);
  --card-dark-border: rgba(99, 102, 241, 0.15);

  --v-kozha: #ff8c00;
  --v-anus: #8b4513;
  --v-uretra: #dc143c;
  --v-myshca: #2c2c2c;
  --v-zrenie: #2dd573;
  --v-zvuk: #4a90e2;
  --v-orall: #f4d03f;
  --v-obon: #9b59b6;
}

/* ===================== БАЗА ===================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(165deg, #0f0f1a 0%, #1a1a2e 40%, #16213e 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  min-height: 100vh;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

a {
  color: var(--accent-secondary);
  text-decoration: none;
}

a:hover {
  color: var(--accent-light);
}

/* ===================== ОБЩИЕ ЭЛЕМЕНТЫ ===================== */
.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 48px;
  flex: 1;
}

.micro-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--accent-secondary);
  text-transform: uppercase;
  margin-bottom: 18px;
}

.gradient-title {
  font-weight: 800;
  background: linear-gradient(135deg, #c7d2fe 0%, #818cf8 50%, #6366f1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.btn-primary {
  display: inline-block;
  background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  padding: 16px 32px;
  border-radius: 14px;
  transition: transform 200ms ease, box-shadow 200ms ease;
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  color: var(--text-secondary);
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: color 200ms ease;
}

.btn-ghost:hover {
  color: var(--accent-light);
}

/* ===================== СТАРТОВЫЙ ЭКРАН ===================== */
.start-screen {
  text-align: left;
  padding-top: 48px;
}

.home-link-row {
  margin-bottom: 24px;
}

.home-link {
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  padding: 6px 0;
  transition: color 200ms ease;
}

.home-link:hover {
  color: var(--accent-light);
}

.start-screen .gradient-title {
  font-size: 44px;
  margin-bottom: 28px;
}

.start-screen .subtitle {
  color: var(--text-primary);
  font-size: 18px;
  line-height: 1.55;
  margin-bottom: 20px;
}

.start-screen .hint {
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 28px;
  padding: 18px 20px;
  background: var(--card-dark-bg);
  border: 1px solid var(--card-dark-border);
  border-radius: 14px;
}

.start-screen .duration {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 28px;
}

.start-screen .btn-primary {
  margin-bottom: 32px;
}

.start-screen .footer-note {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.start-screen .footer-note p {
  margin-bottom: 4px;
}

/* ===================== ЭКРАН ВОПРОСА ===================== */
.progress-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(15, 15, 26, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(99, 102, 241, 0.12);
  padding: 14px 20px;
}

.progress-bar-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.progress-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: rgba(99, 102, 241, 0.15);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1 0%, #818cf8 100%);
  border-radius: 99px;
  transition: width 300ms ease;
}

.question-screen {
  animation: fadeSlide 250ms ease;
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.question-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: 32px 28px;
  color: #1a1a2e;
}

.question-text {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  color: #1a1a2e;
  margin-bottom: 24px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  background: #f6f7fb;
  border: 2px solid transparent;
  border-radius: 12px;
  text-align: left;
  font-size: 15px;
  line-height: 1.45;
  color: #2a2a3e;
  width: 100%;
  min-height: 60px;
  transition: background 180ms ease, border-color 180ms ease, transform 100ms ease;
}

.option:hover {
  background: #eef0fb;
  border-color: rgba(99, 102, 241, 0.25);
}

.option:active {
  transform: scale(0.99);
}

.option.selected {
  background: rgba(99, 102, 241, 0.08);
  border-color: var(--accent-primary);
}

.option-text {
  flex: 1;
}

.option-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-primary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.back-row {
  margin-top: 20px;
  padding: 0 4px;
}

.back-row .btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ===================== ЭКРАН РЕЗУЛЬТАТА ===================== */
.result-screen {
  padding-top: 24px;
}

.result-screen .micro-label {
  text-align: center;
  margin-bottom: 14px;
}

.result-screen .gradient-title {
  font-size: 38px;
  text-align: center;
  margin-bottom: 32px;
}

.result-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: 26px 24px;
  color: #1a1a2e;
  margin-bottom: 18px;
}

.result-intro {
  font-size: 16px;
  line-height: 1.6;
  color: #2a2a3e;
}

.result-intro p {
  margin-bottom: 12px;
}

.result-intro p:last-child {
  margin-bottom: 0;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-primary);
  margin-bottom: 16px;
}

/* Полоски векторов */
.bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 48px;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: #2a2a3e;
}

.bar-name {
  font-weight: 500;
}

.bar-track {
  height: 12px;
  background: #f0f1f7;
  border-radius: 99px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 600ms ease;
}

.bar-percent {
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bars-sum {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 14px;
  text-align: right;
}

/* Раскрывающиеся блоки */
.collapse {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  margin-bottom: 14px;
  overflow: hidden;
  color: #1a1a2e;
}

.collapse-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 20px 24px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-primary);
  text-align: left;
  transition: background 200ms ease;
}

.collapse-head:hover {
  background: #fafbff;
}

.collapse-icon {
  font-size: 18px;
  color: var(--accent-primary);
  transition: transform 200ms ease;
  font-weight: 600;
}

.collapse.open .collapse-icon {
  transform: rotate(45deg);
}

.collapse-body {
  display: none;
  padding: 0 24px 22px;
  font-size: 15px;
  line-height: 1.65;
  color: #2a2a3e;
}

.collapse.open .collapse-body {
  display: block;
}

.collapse-body p {
  margin-bottom: 12px;
}

.collapse-body p:last-child {
  margin-bottom: 0;
}

/* Кнопка скачивания */
.download-row {
  text-align: center;
  margin: 26px 0;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  background: var(--card-dark-bg);
  border: 1px solid var(--card-dark-border);
  border-radius: 12px;
  color: var(--accent-light);
  font-size: 15px;
  font-weight: 600;
  transition: background 200ms ease, transform 100ms ease;
}

.btn-download:hover {
  background: rgba(99, 102, 241, 0.16);
}

.btn-download:active {
  transform: scale(0.98);
}

/* Ссылки в финальном блоке */
.links-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: 24px;
  color: #1a1a2e;
  margin-bottom: 24px;
}

.links-card .section-title {
  margin-bottom: 16px;
}

.links-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.link-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #f6f7fb;
  border-radius: 12px;
  font-size: 15px;
  color: #1a1a2e;
  font-weight: 500;
  transition: background 180ms ease;
}

.link-item:hover {
  background: #eef0fb;
  color: #1a1a2e;
}

.link-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.link-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.link-text {
  font-weight: 500;
}

.link-sub {
  font-size: 13px;
  font-weight: 500;
  color: #6a6a90;
}

.restart-row {
  text-align: center;
  margin-top: 12px;
}

.restart-row .btn-ghost {
  font-size: 15px;
  color: var(--accent-secondary);
}

.restart-row .btn-ghost:hover {
  color: var(--accent-light);
}

/* ===================== ФОКУС ДЛЯ КЛАВИАТУРЫ ===================== */
button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent-secondary);
  outline-offset: 2px;
}

/* ===================== АДАПТИВ ===================== */
@media (max-width: 740px) {
  .container {
    padding: 20px 16px 40px;
  }

  .start-screen {
    padding-top: 24px;
  }

  .start-screen .gradient-title {
    font-size: 32px;
  }

  .start-screen .subtitle {
    font-size: 16px;
  }

  .result-screen .gradient-title {
    font-size: 28px;
  }

  .question-card {
    padding: 22px 18px;
  }

  .question-text {
    font-size: 17px;
  }

  .option {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 14px 16px;
    min-height: 64px;
  }

  .option-tag {
    font-size: 11px;
  }

  .bar-row {
    grid-template-columns: 96px 1fr 44px;
    font-size: 13px;
    gap: 10px;
  }

  .collapse-head {
    padding: 16px 18px;
    font-size: 13px;
  }

  .collapse-body {
    padding: 0 18px 18px;
    font-size: 14px;
  }

  .links-card {
    padding: 20px 18px;
  }

  .progress-bar {
    padding: 12px 16px;
  }

  .progress-text {
    font-size: 12px;
  }
}

@media (max-width: 400px) {
  .start-screen .gradient-title {
    font-size: 28px;
  }

  .question-text {
    font-size: 16px;
  }

  .bar-row {
    grid-template-columns: 86px 1fr 40px;
    font-size: 12px;
  }
}

/* ===================== МОДАЛ С КАРТИНКОЙ (МОБИЛЬНЫЙ) ===================== */
.image-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 26, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 16px;
  overflow-y: auto;
  animation: fadeIn 200ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.image-modal-inner {
  width: 100%;
  max-width: 540px;
  position: relative;
  padding-top: 48px;
}

.image-modal-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 200ms ease;
}

.image-modal-close:hover,
.image-modal-close:active {
  background: rgba(255, 255, 255, 0.18);
}

.image-modal-hint {
  color: #c7d2fe;
  font-size: 14px;
  text-align: center;
  margin-bottom: 12px;
  padding: 0 12px;
  line-height: 1.5;
}

.image-modal-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* ===================== КАТАЛОГ ПСИХОТИПОВ ===================== */
.catalog-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: 26px 24px;
  color: #1a1a2e;
  margin-bottom: 18px;
}

.catalog-card .section-title {
  margin-bottom: 18px;
}

.catalog-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 18px 0 10px;
}

.catalog-subtitle:first-child {
  margin-top: 0;
}

.catalog-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.catalog-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #f6f7fb;
  border-radius: 10px;
  font-size: 15px;
  color: #1a1a2e;
  cursor: pointer;
  transition: background 180ms ease, transform 100ms ease;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-weight: 500;
}

.catalog-item:hover {
  background: #eef0fb;
}

.catalog-item:active {
  transform: scale(0.99);
}

.catalog-dots {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.catalog-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.catalog-dot + .catalog-dot {
  margin-left: -4px;
  border: 2px solid #f6f7fb;
  width: 16px;
  height: 16px;
}

.catalog-item:hover .catalog-dot + .catalog-dot {
  border-color: #eef0fb;
}

.catalog-name {
  flex: 1;
}

.catalog-arrow {
  color: var(--accent-primary);
  font-size: 18px;
  font-weight: 600;
  opacity: 0.5;
  transition: opacity 180ms ease, transform 180ms ease;
}

.catalog-item:hover .catalog-arrow {
  opacity: 1;
  transform: translateX(2px);
}

/* ===================== МОДАЛ С ОПИСАНИЕМ ===================== */
.desc-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 26, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  overflow-y: auto;
  animation: fadeIn 200ms ease;
  display: flex;
  flex-direction: column;
}

.desc-modal-bar {
  position: sticky;
  top: 0;
  z-index: 101;
  background: rgba(15, 15, 26, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.desc-modal-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-light);
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.18);
  cursor: pointer;
  transition: background 200ms ease;
}

.desc-modal-back:hover,
.desc-modal-back:active {
  background: rgba(99, 102, 241, 0.32);
}

.desc-modal-bar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.desc-modal-inner {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 16px 32px;
  flex: 1;
}

.desc-modal-title {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, #c7d2fe 0%, #818cf8 50%, #6366f1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  margin-bottom: 24px;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.desc-modal .result-card,
.desc-modal .collapse {
  margin-bottom: 14px;
}

.desc-modal-footer {
  margin-top: 24px;
  text-align: center;
}

.desc-modal-close-bottom {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.18);
  color: var(--accent-light);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 200ms ease;
}

.desc-modal-close-bottom:hover,
.desc-modal-close-bottom:active {
  background: rgba(99, 102, 241, 0.32);
}

@media (max-width: 740px) {
  .desc-modal-title {
    font-size: 24px;
  }
  .desc-modal-inner {
    padding: 20px 12px 28px;
  }
  .desc-modal-back {
    font-size: 14px;
    padding: 8px 10px;
  }
}
