/* Тест «Какой ты класс в D&D?». Бренд «Как кости лягут»: тёмно-зелёный, медь сверху и бирюза снизу
   (как свет в комиксах), заголовки Epos, текст Spectral, акцент — золото субтитров шоу #EBC34C. */

@font-face { font-family: Epos; src: url(assets/fonts/Epos-Medium.otf) format("opentype"); font-weight: 500; font-display: swap; }
@font-face { font-family: Spectral; src: url(assets/fonts/spectral-400-cyrillic.woff2) format("woff2"); font-weight: 400; unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; font-display: swap; }
@font-face { font-family: Spectral; src: url(assets/fonts/spectral-400-latin.woff2) format("woff2"); font-weight: 400; unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; font-display: swap; }
@font-face { font-family: Spectral; src: url(assets/fonts/spectral-500-cyrillic.woff2) format("woff2"); font-weight: 500; unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; font-display: swap; }
@font-face { font-family: Spectral; src: url(assets/fonts/spectral-500-latin.woff2) format("woff2"); font-weight: 500; unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; font-display: swap; }

:root {
  --bg: #07180f;
  --bg-2: #0b2117;
  --card: rgba(242, 232, 208, .045);
  --card-hi: rgba(242, 232, 208, .08);
  --line: rgba(242, 232, 208, .14);
  --cream: #f2e8d0;
  --muted: rgba(242, 232, 208, .68);
  --gold: #ebc34c;
  --gold-soft: #d8bd80;
  --copper: #ce9c60;
  --teal: #1d5550;
  --radius: 18px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --pad: 20px;
  --col: 560px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--cream);
  font: 400 18px/1.45 Spectral, Georgia, serif; overflow-x: hidden;
}
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

/* свет: медь сверху, бирюза снизу */
.glow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(70% 45% at 50% -8%, rgba(206, 156, 96, .28), transparent 70%),
    radial-gradient(80% 50% at 50% 110%, rgba(29, 85, 80, .55), transparent 70%);
}

main { position: relative; z-index: 1; max-width: var(--col); margin: 0 auto; padding: 18px var(--pad) 120px; }

/* верхняя полоса прогресса */
.bar { position: sticky; top: 0; z-index: 5; max-width: var(--col); margin: 0 auto; padding: 14px var(--pad) 10px;
  background: linear-gradient(var(--bg) 70%, transparent); }
.bar__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.bar__brand { font-family: Epos; font-size: 15px; letter-spacing: .06em; color: var(--gold-soft); text-transform: uppercase; }
.bar__count { font-size: 14px; color: var(--muted); }
.bar__track { height: 4px; margin-top: 10px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar__fill { height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--copper), var(--gold));
  transition: width .6s var(--ease); }

/* экраны */
.screen { animation: enter .55s var(--ease) both; }
.screen.leave { animation: leave .28s ease-in both; }
@keyframes enter { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes leave { to { opacity: 0; transform: translateY(-12px); } }

h1, h2, h3 { font-family: Epos, Georgia, serif; font-weight: 500; margin: 0; line-height: 1.04; letter-spacing: .005em; }
.kicker { font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--copper); margin: 0 0 10px; }
.muted { color: var(--muted); }

/* вступление */
.intro { position: relative; }
.lang { position: absolute; top: -6px; right: 0; z-index: 2; padding: 8px 12px; border-radius: 10px; font-size: 15px;
  color: var(--cream); text-decoration: none; background: rgba(7, 24, 15, .72); border: 1px solid var(--line); }
.lang:hover { background: var(--card-hi); }
.intro__mosaic { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0 26px;
  -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.intro__mosaic img { aspect-ratio: 3 / 4; object-fit: cover; border-radius: 10px; opacity: 0;
  animation: tile .7s var(--ease) both; }
@keyframes tile { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
.intro h1 { font-size: clamp(40px, 11vw, 58px); color: var(--gold); text-shadow: 0 2px 0 #000, 0 0 28px rgba(235, 195, 76, .25); }
.intro__sub { font-size: 19px; margin: 14px 0 6px; }
.intro__note { font-size: 15px; color: var(--muted); margin: 0 0 26px; }

/* вопрос */
.q__art { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 0 0 1px rgba(206, 156, 96, .35), 0 18px 40px rgba(0, 0, 0, .45); background: var(--bg-2); }
.q__art img { width: 100%; height: 100%; object-fit: cover; animation: drift 14s ease-out both; }
@keyframes drift { from { transform: scale(1.08); } to { transform: scale(1); } }
.q__art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 60%, rgba(7, 24, 15, .55)); }
.q__text { font-size: clamp(25px, 6.6vw, 31px); margin: 22px 0 16px; }
.answers { display: grid; gap: 10px; }
@media (min-width: 520px) { .answers { grid-template-columns: 1fr 1fr; } }
.answer {
  display: flex; align-items: flex-start; gap: 12px; text-align: left; width: 100%;
  padding: 15px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card);
  cursor: pointer; font-size: 17px; line-height: 1.35; opacity: 0;
  animation: tile .45s var(--ease) both;
  transition: border-color .2s, background .2s, transform .15s, box-shadow .2s;
}
.answer:hover { background: var(--card-hi); }
.answer:active { transform: scale(.985); }
.answer:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.answer__dot { flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; border: 1.5px solid var(--muted);
  display: grid; place-items: center; transition: border-color .2s; }
.answer__dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); transform: scale(0);
  transition: transform .25s var(--ease); }
.answer[aria-checked="true"] { border-color: var(--gold); background: rgba(235, 195, 76, .09);
  box-shadow: 0 0 0 1px var(--gold), 0 0 24px rgba(235, 195, 76, .18); }
.answer[aria-checked="true"] .answer__dot { border-color: var(--gold); }
.answer[aria-checked="true"] .answer__dot::after { transform: scale(1); }

/* нижняя панель */
.actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; gap: 10px; justify-content: center;
  padding: 14px var(--pad) calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 35%); }
.actions > * { max-width: var(--col); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px; padding: 0 22px;
  border-radius: 14px; border: 1px solid transparent; cursor: pointer; font: 500 18px/1 Spectral, Georgia, serif;
  text-decoration: none; transition: transform .15s, filter .2s, opacity .2s, background .2s; }
.btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.btn--primary { flex: 1; background: linear-gradient(180deg, #f1cf63, var(--gold) 55%, #c99d2e); color: #1d1405;
  box-shadow: 0 8px 22px rgba(235, 195, 76, .22), inset 0 1px 0 rgba(255, 255, 255, .45); }
.btn--primary:disabled { filter: saturate(.25) brightness(.55); cursor: default; box-shadow: none; }
.btn--ghost { background: var(--card); border-color: var(--line); color: var(--cream); }
.btn--icon { width: 54px; padding: 0; flex: none; }
.btn--block { width: 100%; }

/* промежуточный экран */
.mid__heroes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 22px; }
.mid__heroes figure { margin: 0; text-align: center; font-family: Epos; font-size: 16px; color: var(--gold-soft); opacity: 0;
  animation: tile .6s var(--ease) both; }
.mid__heroes img { aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; margin-bottom: 6px;
  box-shadow: 0 0 0 1px rgba(206, 156, 96, .35); }
.mid h2 { font-size: clamp(27px, 7vw, 34px); color: var(--gold); margin-bottom: 12px; }
.mid p { margin: 0 0 22px; }

/* бросок кубика */
.roll { min-height: 62vh; display: grid; place-content: center; text-align: center; gap: 10px; }
.roll__die { width: 150px; height: 150px; margin: 0 auto 18px; position: relative; }
.roll__die svg { width: 100%; height: 100%; filter: drop-shadow(0 0 22px rgba(235, 195, 76, .35));
  animation: spin 1.1s cubic-bezier(.45, .05, .35, 1) infinite; }
.roll__die svg path { fill: rgba(235, 195, 76, .12); stroke: var(--gold); stroke-width: 2.2; stroke-linejoin: round; }
.roll__num { position: absolute; inset: 0; display: grid; place-items: center; font-family: Epos; font-size: 40px; color: var(--gold);
  padding-top: 14px; }
@keyframes spin { 0% { transform: rotate(0) scale(1); } 50% { transform: rotate(200deg) scale(.86); } 100% { transform: rotate(360deg) scale(1); } }
.roll h2 { font-size: 34px; color: var(--gold); }

/* результат */
.res__top { display: grid; gap: 18px; }
.res__portrait { position: relative; width: min(78%, 330px); margin: 0 auto; aspect-ratio: 3 / 4; border-radius: 22px;
  overflow: hidden; box-shadow: 0 0 0 2px var(--gold), 0 0 50px rgba(235, 195, 76, .28), 0 24px 50px rgba(0, 0, 0, .55);
  animation: reveal .9s var(--ease) both; }
.res__portrait img { width: 100%; height: 100%; object-fit: cover; }
@keyframes reveal { from { opacity: 0; transform: scale(.86) rotate(-2deg); filter: brightness(2); } to { opacity: 1; transform: none; filter: none; } }
.res__head { text-align: center; }
.res__name { font-size: clamp(48px, 14vw, 68px); color: var(--gold); text-shadow: 0 2px 0 #000, 0 0 30px rgba(235, 195, 76, .28); }
.meter { margin: 14px auto 0; max-width: 330px; }
.meter__label { display: flex; justify-content: space-between; font-size: 15px; color: var(--muted); margin-bottom: 6px; }
.meter__track { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; }
.meter__fill { height: 100%; width: 0; border-radius: 8px; background: linear-gradient(90deg, var(--copper), var(--gold));
  transition: width 1.2s var(--ease) .4s; }
.res__hero { text-align: center; margin-top: 16px; }
.res__hero b { display: block; font-family: Epos; font-weight: 500; font-size: 26px; color: var(--cream); }
.res__hero span { color: var(--muted); }
.res__body { margin-top: 24px; padding: 20px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.res__body p { margin: 0 0 12px; }
.res__body p:last-child { margin: 0; }
.res__fantasy { font-size: 20px; }
.res__line b { font-weight: 500; color: var(--gold-soft); }
.res__joke { margin-top: 16px; padding: 16px 18px; border-radius: 14px; font-style: italic; color: var(--gold-soft);
  background: linear-gradient(135deg, rgba(206, 156, 96, .14), rgba(29, 85, 80, .14)); border: 1px solid rgba(206, 156, 96, .3); }
.res__more h3 { font-size: 22px; color: var(--gold-soft); margin: 28px 0 12px; }
.alt { display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: center; padding: 10px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); }
.alt + .alt { margin-top: 8px; }
.alt img { width: 56px; height: 74px; object-fit: cover; border-radius: 9px; }
.alt__name { font-family: Epos; font-size: 21px; }
.alt .meter { margin: 6px 0 0; max-width: none; }

/* призывы */
.cta { margin-top: 34px; text-align: center; }
.cta h2 { font-size: clamp(26px, 7vw, 32px); color: var(--gold); margin-bottom: 16px; }
.socials { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.social { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); color: var(--cream); text-decoration: none; font-size: 15px;
  transition: background .2s, transform .15s; }
.social:hover { background: var(--card-hi); }
.social:active { transform: scale(.97); }
.social svg { width: 26px; height: 26px; fill: currentColor; }
.social[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.banner { margin-top: 18px; padding: 20px; border-radius: var(--radius); text-align: left;
  background: radial-gradient(120% 120% at 100% 0, rgba(206, 156, 96, .22), transparent 60%), var(--bg-2);
  border: 1px solid rgba(206, 156, 96, .35); }
.banner h3 { font-size: 26px; color: var(--gold); }
.banner p { margin: 6px 0 14px; color: var(--muted); }
.dwd { margin-top: 12px; padding: 18px 20px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); text-align: left; }
.dwd p { margin: 0 0 12px; }
.again { margin-top: 18px; background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 4px;
  cursor: pointer; font-size: 16px; padding: 10px; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); opacity: 0; z-index: 9;
  padding: 12px 18px; border-radius: 12px; background: #13261c; border: 1px solid var(--line); color: var(--cream); font-size: 16px;
  transition: opacity .25s, transform .25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.noscript { padding: 40px 0; text-align: center; }

/* компьютер: вопрос в две колонки, чтобы картинка и ответы помещались на экран без прокрутки */
@media (min-width: 900px) {
  :root { --col: 1000px; }
  .intro, .res, .roll { max-width: 560px; margin: 0 auto; }
  .q { display: grid; grid-template-columns: 1.05fr 1fr; grid-template-rows: 1fr auto 1fr; column-gap: 36px;
    min-height: calc(100dvh - 190px); }
  .q__art { grid-column: 1; grid-row: 1 / span 3; align-self: center; }
  .q__text { grid-column: 2; grid-row: 1; align-self: end; margin: 0 0 16px; }
  .answers { grid-column: 2; grid-row: 2; grid-template-columns: 1fr; }
  .mid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr auto auto auto 1fr; column-gap: 36px;
    min-height: calc(100dvh - 190px); }
  .mid__heroes { grid-column: 1; grid-row: 1 / span 5; align-self: center; margin: 0; }
  .mid > h2 { grid-column: 2; grid-row: 2; }
  .mid > p { grid-column: 2; grid-row: 3; }
  .mid > a { grid-column: 2; grid-row: 4; }
  .actions .btn--primary { flex: 0 1 420px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
