/* =========================================================
   Кто ты из Всмешариков — стили из макета (холст Design)
   Кандидат на замену wwwroot/css/site.css.
   Классы совпадают с текущими Razor-страницами + новые (см. HANDOFF.md).
   Шрифты подключаются в _Layout:
   <link href="https://fonts.googleapis.com/css2?family=Unbounded:wght@500;700;900&family=Golos+Text:wght@400;500;600&display=swap" rel="stylesheet">
   ========================================================= */

:root {
  /* фон и поверхности */
  --bg: #2a2224;
  --bg-deep: #1a1517;      /* подложка под модалкой */
  --surface: #352c2f;      /* карточки, ответы */
  --surface-sunk: #1f191b; /* инпуты */
  --line: #4a3d40;
  --line-strong: #5a4b4e;  /* пунктир плейсхолдера арта */
  --track: #3d3235;        /* трек прогресса */

  /* текст */
  --text: #f4e9dc;
  --text-soft: #d9cabd;
  --text-muted: #b9a99c;
  --text-off: #8a7a70;

  /* акцент */
  --lime: #c8f04d;
  --lime-hover: #e2ff8a;
  --lime-ink: #1d1a12;     /* текст на лайме */
  --lime-sunk: #3a3d22;    /* выбранный ответ */

  /* тиры: фон плашки / текст на ней */
  --tier-trash-bg: #4a3d40;  --tier-trash-fg: #f4e9dc;
  --tier-item-bg: #c8f04d;   --tier-item-fg: #1d1a12;
  --tier-minor-bg: #8fc8ff;  --tier-minor-fg: #13212e;
  --tier-legend-bg: #ff7eb6; --tier-legend-fg: #2a1220;
  --tier-legend-surface: #3d2a35;

  /* типографика */
  --font-display: 'Unbounded', system-ui, sans-serif;
  --font-body: 'Golos Text', system-ui, sans-serif;

  /* радиусы */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 28px;
  --r-pill: 999px;

  --container: 1120px;
  --gutter: 24px;
}

/* ---------- база ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}
a { color: var(--lime); }
a:hover { color: var(--lime-hover); }
:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; }
p { margin: 0; }
img { max-width: 100%; display: block; }

/* ---------- каркас (_Layout) ---------- */
.site-header {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 24px var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-logo {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}
.site-logo:hover { color: var(--text); }
.site-logo-dot { color: var(--lime); }
.site-header-meta, .site-header-meta a { font-size: 14px; color: var(--text-muted); text-decoration: none; }

.site-main {
  flex: 1;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 32px var(--gutter) 80px;
}
.site-footer {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 24px var(--gutter) 40px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--line);
}

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 26px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { color: var(--text); border-color: var(--text-off); }
.btn-primary, .btn-start, .btn-share {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--lime-ink);
}
.btn-primary:hover, .btn-start:hover, .btn-share:hover {
  background: var(--lime-hover);
  border-color: var(--lime-hover);
  color: var(--lime-ink);
}
.btn-start { min-height: 60px; padding: 0 32px; font-size: 18px; }
.btn-icon { width: 20px; height: 20px; flex: none; }

/* ---------- плашка тира ---------- */
.tier-chip {
  align-self: flex-start;
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--chip-bg, var(--tier-trash-bg));
  color: var(--chip-fg, var(--tier-trash-fg));
}
/* tier-* вешается на контейнер (TierText.CssClass) и красит всё внутри */
.tier-trash  { --chip-bg: var(--tier-trash-bg);  --chip-fg: var(--tier-trash-fg);  --accent: var(--lime); }
.tier-item   { --chip-bg: var(--tier-item-bg);   --chip-fg: var(--tier-item-fg);   --accent: var(--lime); }
.tier-minor  { --chip-bg: var(--tier-minor-bg);  --chip-fg: var(--tier-minor-fg);  --accent: var(--lime); }
.tier-legend { --chip-bg: var(--tier-legend-bg); --chip-fg: var(--tier-legend-fg); --accent: var(--tier-legend-bg); }

/* ---------- 1. Старт (Index) ---------- */
.intro {
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 860px;
  padding-top: 24px;
}
.intro-kicker {
  align-self: flex-start;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--lime);
  padding: 6px 12px;
  border-radius: var(--r-pill);
}
.intro-title {
  font-weight: 900;
  font-size: clamp(30px, 8.5vw, 96px); /* на 360px слово «Всмешариков?» иначе вылезает */
  line-height: 0.95;
  letter-spacing: -0.03em;
}
.intro-text { font-size: 20px; line-height: 1.5; color: var(--text-soft); max-width: 620px; }
.intro-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.intro-time { font-size: 15px; color: var(--text-muted); }

.tiers { margin-top: 56px; display: flex; flex-direction: column; gap: 20px; }
.tiers-title { font-weight: 700; font-size: 18px; color: var(--text-muted); }
.tiers-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.tier-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tier-card.tier-legend { background: var(--tier-legend-surface); border-color: var(--tier-legend-bg); }
.tier-card-rarity { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.tier-card.tier-item .tier-card-rarity { color: var(--lime); }
.tier-card.tier-minor .tier-card-rarity { color: var(--tier-minor-bg); }
.tier-card.tier-legend .tier-card-rarity { color: #ff9cc8; }
.tier-card-name { font-size: 20px; font-weight: 700; }
.tier-card-text { font-size: 15px; line-height: 1.45; color: var(--text-soft); }

/* ---------- 2. Вопрос (Quiz) ---------- */
@counter-style ru-letters { system: alphabetic; symbols: "А" "Б" "В" "Г" "Д" "Е"; }

.quiz {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 36px;
}
.quiz-progress { display: flex; flex-direction: column; gap: 12px; }
.quiz-progress-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.quiz-progress-text { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.quiz-progress-pct { font-size: 14px; color: var(--text-muted); }
/* <progress> из текущей разметки */
.quiz-progress-bar {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--track);
  overflow: hidden;
}
.quiz-progress-bar::-webkit-progress-bar { background: var(--track); border-radius: var(--r-pill); }
.quiz-progress-bar::-webkit-progress-value { background: var(--lime); border-radius: var(--r-pill); }
.quiz-progress-bar::-moz-progress-bar { background: var(--lime); border-radius: var(--r-pill); }

.quiz-question {
  font-weight: 700;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.quiz-answers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  counter-reset: answer;
}
.quiz-answer { counter-increment: answer; }
.quiz-answer-link {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 64px;
  padding: 14px 18px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 2px solid var(--line);
  color: var(--text);
  font-size: 18px;
  line-height: 1.35;
  text-decoration: none;
}
/* буква А/Б/В/Г/Д рисуется CSS-счётчиком — в разметке ничего добавлять не надо */
.quiz-answer-link::before {
  content: counter(answer, ru-letters);
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
}
.quiz-answer-link:hover { color: var(--text); border-color: var(--text-off); }
/* нажатие = переход дальше; на время загрузки подсвечиваем выбранный */
.quiz-answer-link:active,
.quiz-answer-link.is-picked { background: var(--lime-sunk); border-color: var(--lime); }
.quiz-answer-link:active::before,
.quiz-answer-link.is-picked::before { background: var(--lime); color: var(--lime-ink); }

.quiz-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  min-height: 52px;
  padding: 0 20px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  color: var(--text-soft);
  text-decoration: none;
  font-weight: 500;
}
.quiz-back:hover { color: var(--text); border-color: var(--text-off); }

/* ---------- 3. Результат (Result, свой) ---------- */
.result {
  display: flex;
  flex-wrap: wrap;
  gap: 48px;
  align-items: flex-start;
}
.result-art { margin: 0; flex: 1 1 380px; max-width: 520px; }
.result-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--r-2xl);
  background: var(--surface);
  color: transparent; /* пока арта нет, не показываем alt-текст поверх заглушки */
}
.result-info { flex: 999 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.result-lead { font-size: 16px; color: var(--text-muted); }
.result-lead + .tier-chip { margin-top: -12px; }
.result-name {
  font-weight: 900;
  font-size: clamp(36px, 5vw, 60px);
  line-height: 1;
  letter-spacing: -0.03em;
}
.result-description { font-size: 19px; line-height: 1.55; color: var(--text-soft); max-width: 560px; }
.result-rarity { font-size: 15px; color: var(--text-muted); }
.result-rarity-value { color: var(--text); font-weight: 600; }

.result-axes {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 24px;
}
.result-axes-title { font-weight: 700; font-size: 15px; color: var(--text-muted); }
.axis { display: grid; grid-template-columns: 150px minmax(0, 1fr) 40px; align-items: center; gap: 14px; }
.axis-name { font-size: 15px; }
.axis-track { height: 10px; background: var(--bg); border-radius: var(--r-pill); overflow: hidden; }
.axis-fill { height: 100%; border-radius: var(--r-pill); background: var(--accent, var(--lime)); }
.axis-value { font-size: 14px; color: var(--text-muted); text-align: right; }

.result-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.result-link { font-size: 14px; color: var(--text-muted); }

/* ---------- 4. Окно «Поделиться» (<dialog>) ---------- */
.share-dialog {
  width: calc(100% - 32px);
  max-width: 640px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  background: var(--bg);
  color: var(--text);
}
.share-dialog::backdrop { background: rgba(26, 21, 23, 0.85); }
.share-dialog-inner { display: flex; flex-direction: column; gap: 24px; }
.share-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.share-title { font-weight: 700; font-size: 24px; }
.share-close {
  width: 44px; height: 44px;
  border: 0; border-radius: 12px;
  background: transparent; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.share-close:hover { color: var(--text); }
.share-preview-label, .share-url-label { font-size: 14px; color: var(--text-muted); }
.share-preview { display: flex; flex-direction: column; gap: 10px; }
.share-preview-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.share-preview-card img { width: 100%; aspect-ratio: 1200 / 630; object-fit: cover; }
.share-preview-meta { padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; }
.share-preview-title { font-weight: 600; font-size: 15px; }
.share-preview-desc { font-size: 14px; color: var(--text-muted); }
.share-url { display: flex; flex-direction: column; gap: 8px; }
.share-url-row { display: flex; flex-wrap: wrap; gap: 10px; }
.share-url-input {
  flex: 1 1 260px; min-width: 0; min-height: 52px;
  padding: 0 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-sunk);
  color: var(--text);
  font: inherit;
}
.btn-copy { min-height: 52px; padding: 0 22px; border-radius: var(--r-md); font-size: 15px; background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }
.btn-copy:hover { background: var(--lime-hover); color: var(--lime-ink); }
.btn-copy.is-done { background: var(--lime-sunk); border-color: var(--lime-sunk); color: var(--lime); }
.share-targets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.share-target {
  min-height: 72px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: 14px;
}
.share-target:hover { color: var(--text); border-color: var(--text-off); }
.share-target svg { width: 22px; height: 22px; }
@media (max-width: 480px) {
  .share-dialog { padding: 20px; }
  .share-targets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- 5. Результат друга (/r/{id} без ?mine) ---------- */
.friend { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }
.friend-intro { text-align: center; font-size: 18px; color: var(--text-soft); }
.friend-card {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--r-2xl);
  padding: 20px 20px 28px;
  display: flex; flex-direction: column; gap: 16px;
}
.friend-card.tier-legend { border-color: var(--tier-legend-bg); }
.friend-card .result-image { border-radius: var(--r-xl); }
.friend-card .result-name { font-size: clamp(30px, 6vw, 44px); line-height: 1.02; }
.friend-card .result-description { font-size: 17px; }
.friend-cta { display: flex; flex-direction: column; gap: 14px; align-items: center; text-align: center; }
.friend-cta-title { font-weight: 700; font-size: 24px; }
.friend-cta .btn-start { align-self: stretch; min-height: 64px; border-radius: 18px; }
.friend-cta-note { font-size: 14px; color: var(--text-muted); }

/* ---------- бестиарий (dev) ---------- */
.bestiary-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.bestiary-table th, .bestiary-table td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.bestiary-table th { color: var(--text-muted); font-weight: 600; }
.bestiary-table img { border-radius: var(--r-sm); }
.bestiary-table tr.tier-legend td:nth-child(3) { color: var(--tier-legend-bg); font-weight: 600; }
