/* Mini App «Коуч Аюна» — стили. Тёмная сцена, золотой заголовок, красная кнопка-пилюля. */

:root {
  --bg: #0d0d0d;
  --surface: #161616;
  --surface-2: #1f1f1f;
  --border: #2a2a2a;
  --gold: #d9a441;
  --gold-2: #f0c060;
  --text: #ececec;
  --muted: #a3a3a3;
  --red: #c8392b;
  --red-hover: #d94a3b;
  --green: #3fa66b;
  --radius: 18px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

/* ---------- База ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

img { max-width: 100%; }

a { color: var(--gold); }

/* Контейнер: мобильный по умолчанию (~390px), на десктопе — центр до 560px */
#app {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding-top: calc(24px + env(safe-area-inset-top, 0px));
  padding-right: calc(20px + env(safe-area-inset-right, 0px));
  padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  padding-left: calc(20px + env(safe-area-inset-left, 0px));
  min-height: 100vh;
  min-height: 100dvh;
}

@media (min-width: 600px) {
  #app {
    padding-top: calc(40px + env(safe-area-inset-top, 0px));
    padding-right: calc(24px + env(safe-area-inset-right, 0px));
    padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px));
    padding-left: calc(24px + env(safe-area-inset-left, 0px));
  }
}

/* Фокус с клавиатуры — золотая обводка */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ---------- Экраны и переходы ---------- */

.screen {
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 0.25s ease both;
}

.center-screen {
  min-height: 60vh;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.fade { animation: fadeIn 0.2s ease both; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

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

@media (prefers-reduced-motion: reduce) {
  .screen, .fade, .skeleton { animation: none; }
  .progress-bar { transition: none; }
}

/* ---------- Типографика ---------- */

.headline {
  margin: 0;
  color: var(--gold);
  font-weight: 700;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

@media (min-width: 400px) { .headline { font-size: 30px; } }
@media (min-width: 600px) { .headline { font-size: 32px; } }

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.body-text {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  line-height: 1.55;
}

/* Сохраняем переводы строк из текстов, введённых в админке */
.prewrap {
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.caption {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.section-title {
  margin: 8px 0 0;
  color: var(--gold);
  font-size: 20px;
  font-weight: 700;
}

.error-text {
  margin: 0;
  color: var(--red-hover);
  font-size: 15px;
}

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  padding: 14px 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

.btn:active { transform: scale(0.985); }

.btn[disabled], .btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: default;
  pointer-events: none;
}

.btn-primary {
  background: var(--red);
  color: #fff;
}
.btn-primary:hover { background: var(--red-hover); }

.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
  font-weight: 600;
}
.btn-secondary:hover { border-color: var(--muted); background: var(--surface); }

/* Текстовая кнопка-ссылка (не менее 44px по высоте) */
.btn-link {
  min-height: 44px;
  padding: 10px 12px;
  background: transparent;
  color: var(--gold);
  font-weight: 600;
  font-size: 16px;
}
.btn-link:hover { color: var(--gold-2); }

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  align-self: flex-start;
}
.back-link:hover { color: var(--text); }

.is-loading { position: relative; color: transparent !important; }
.is-loading::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ---------- Карточки ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-title {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.test-card .btn { margin-top: 4px; }

/* Фото Аюны: скруглённая карточка 4:5 */
.photo-card {
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
}

.photo-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-card--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(217, 164, 65, 0.22), transparent 55%),
    linear-gradient(160deg, #1d1810 0%, #0d0d0d 70%);
}

.initials {
  color: var(--gold);
  font-size: 96px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-shadow: 0 8px 40px rgba(217, 164, 65, 0.35);
}

/* Карточка попытки в «Мои результаты» — кликабельная */
.attempt-card {
  color: inherit;
  text-decoration: none;
  gap: 6px;
  transition: border-color 0.15s ease;
}
.attempt-card:hover { border-color: var(--gold); }

.attempt-scale {
  color: var(--gold);
  font-size: 17px;
  font-weight: 600;
}

/* ---------- Прохождение теста ---------- */

.quiz {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  transition: width 0.3s ease;
}

.question {
  margin: 4px 0 8px;
  color: var(--text);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

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

/* ---------- Результат ---------- */

.result {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.rows {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.row-label {
  color: var(--gold);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.row-text {
  color: var(--text);
  font-size: 17px;
  line-height: 1.5;
}

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

.btn-offer {
  flex-direction: column;
  gap: 2px;
  padding: 12px 20px;
}

.offer-label { display: block; }

.offer-price {
  display: block;
  font-size: 13px;
  font-weight: 500;
  opacity: 0.9;
}
.btn-secondary .offer-price { color: var(--gold); opacity: 1; }

.success-card {
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  border-color: var(--green);
}

.success-icon {
  flex: 0 0 auto;
  font-size: 24px;
  line-height: 1.2;
}

/* ---------- Загрузка ---------- */

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.skeleton {
  border-radius: 12px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.skeleton-photo { aspect-ratio: 4 / 5; border-radius: var(--radius); }
.skeleton-line { height: 18px; }
.skeleton-card { height: 180px; border-radius: var(--radius); }

.noscript {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}
