/* =========================================================
   Cryptorino Casino — шаблон сайта (cryptorino1.de)
   Палитра: светло-синий фон + чёрный/белый
   ========================================================= */

:root {
  --bg: #bfe0f5;          /* основной фон сайта */
  --bg-soft: #eaf5fc;     /* светлый фон блоков */
  --bg-hover: #d6ebf8;
  --black: #000000;
  --white: #ffffff;
  --text: #15191d;
  --muted: #56616c;
  --line: #d9e3ea;
  --radius: 18px;
  --radius-sm: 10px;
  --container: 1120px;
  --header-h: 72px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Базовые ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% 0%, rgba(255, 255, 255, .7) 0, transparent 38%),
    radial-gradient(circle at 100% 55%, rgba(255, 255, 255, .45) 0, transparent 32%);
}

img, svg, video { max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--black); outline-offset: 3px; }

/* ---------- Кнопки (хедер, попап, 404) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: .65em 1.35em;
  border: 2px solid var(--black);
  border-radius: 999px;
  font: inherit;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .15s ease, background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-2px); }

.btn--outline { background: var(--white); color: var(--black); }
.btn--outline:hover { background: var(--black); color: var(--white); }

.btn--primary {
  background: var(--black);
  color: var(--white);
  box-shadow: 4px 4px 0 var(--bg);
}
.btn--primary:hover { box-shadow: 6px 6px 0 var(--bg); }

/* =========================================================
   ХЕДЕР
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 2px solid var(--black);
}

.site-header__inner {
  max-width: var(--container);
  min-height: var(--header-h);
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.site-logo { display: inline-flex; flex-shrink: 0; }
.site-logo img { display: block; width: 160px; height: auto; }

.site-header__actions { display: flex; align-items: center; gap: 10px; }

/* =========================================================
   КОНТЕНТ — MAIN
   Все стили контента пишутся через main, обёртки не нужны
   ========================================================= */
main {
  flex: 1 0 auto;
  width: calc(100% - 40px);
  max-width: var(--container);
  margin: 40px auto 56px;
  padding: 56px clamp(20px, 6vw, 80px);
  background: var(--white);
  border: 2px solid var(--black);
  border-radius: var(--radius);
  box-shadow: 8px 8px 0 var(--black);
  overflow-wrap: break-word;
}
main > :first-child { margin-top: 0; }
main > :last-child { margin-bottom: 0; }

/* --- Заголовки --- */
main h1, main h2, main h3, main h4, main h5, main h6 {
  margin: 1.8em 0 .6em;
  color: var(--black);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.015em;
}
main h1 { font-size: clamp(1.9rem, 1.3rem + 2.6vw, 2.9rem); margin-top: 0; }
main h2 {
  font-size: clamp(1.5rem, 1.15rem + 1.4vw, 2.05rem);
  padding-bottom: .35em;
  border-bottom: 2px solid var(--black);
}
main h3 { font-size: clamp(1.25rem, 1.05rem + .8vw, 1.5rem); }
main h4 { font-size: 1.15rem; }
main h5 { font-size: 1rem; }
main h6 { font-size: .95rem; color: var(--muted); }

/* --- Текст --- */
main p { margin: 0 0 1.2em; }
main strong, main b { font-weight: 700; color: var(--black); }
main small { font-size: .85em; color: var(--muted); }
main mark { background: var(--bg); color: var(--black); padding: 0 .2em; border-radius: 4px; }
main sup, main sub { font-size: .75em; line-height: 0; }

main a {
  color: var(--black);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--bg);
  text-decoration-thickness: .18em;
  text-underline-offset: 3px;
  transition: background-color .15s ease, text-decoration-color .15s ease;
}
main a:hover { background: var(--bg-soft); text-decoration-color: var(--black); }

/* --- Списки --- */
main ul, main ol { margin: 0 0 1.4em; }
main li { margin-bottom: .45em; }
main li > ul, main li > ol { margin: .5em 0 0; }

main ul { list-style: none; padding-left: 0; }
main ul > li { position: relative; padding-left: 1.6em; }
main ul > li::before {
  content: "";
  position: absolute;
  left: .2em;
  top: .62em;
  width: .48em;
  height: .48em;
  background: var(--black);
  border-radius: 2px;
  transform: rotate(45deg);
}

main ol { padding-left: 1.6em; }
main ol > li { padding-left: .3em; }
main ol > li::marker { font-weight: 800; color: var(--black); }

/* --- Цитаты, разделитель, код --- */
main blockquote {
  margin: 1.8em 0;
  padding: 1.2em 1.4em;
  background: var(--bg-soft);
  border-left: 6px solid var(--black);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 1.05rem;
}
main blockquote p:last-child { margin-bottom: 0; }
main blockquote cite { display: block; margin-top: .6em; font-size: .9rem; font-style: normal; font-weight: 700; }

main hr { margin: 2.5em 0; border: 0; border-top: 2px dashed var(--black); }

main code, main kbd {
  padding: .12em .4em;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .88em;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
}
main pre {
  margin: 1.6em 0;
  padding: 1.1em 1.3em;
  overflow-x: auto;
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius-sm);
}
main pre code { padding: 0; background: none; border: 0; color: inherit; }

/* --- Изображения --- */
main img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2em auto;
  border: 2px solid var(--black);
  border-radius: var(--radius);
}
main figure { margin: 2em 0; }
main figure img { margin: 0 auto; }
main figcaption { margin-top: .6em; font-size: .9rem; color: var(--muted); text-align: center; }

main iframe, main video {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 2em 0;
  border: 0;
  border-radius: var(--radius);
}
main iframe { height: auto; aspect-ratio: 16 / 9; }

/* --- Таблицы ---
   JS автоматически оборачивает каждую таблицу в .table-scroll,
   поэтому на телефоне таблица скроллится, а не растягивает экран */
main .table-scroll {
  width: 100%;
  max-width: 100%;
  margin: 2em 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 2px solid var(--black);
  border-radius: var(--radius-sm);
}
main table {
  width: 100%;
  margin: 2em 0;
  border-collapse: collapse;
  border: 2px solid var(--black);
  font-size: .95rem;
  line-height: 1.5;
}
main .table-scroll > table { margin: 0; border: 0; }

main caption {
  padding: .8em 1em;
  font-weight: 700;
  text-align: left;
  color: var(--black);
  background: var(--bg-soft);
  border-bottom: 2px solid var(--black);
}
main th, main td {
  padding: .85em 1em;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
main th + th, main td + td { border-left: 1px solid var(--line); }
main thead th {
  background: var(--black);
  color: var(--white);
  font-weight: 700;
  white-space: nowrap;
  border-bottom: 0;
}
main thead th + th { border-left-color: rgba(255, 255, 255, .2); }
main tbody tr:nth-child(even) { background: var(--bg-soft); }
main tbody tr:hover { background: var(--bg-hover); }
main tbody tr:last-child td { border-bottom: 0; }
main tfoot td { font-weight: 700; border-top: 2px solid var(--black); }

/* --- Главная кнопка в контенте (по центру) --- */
main .btn-main {
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  margin: 2.2em auto;
  padding: 1em 2.8em;
  background: var(--black);
  color: var(--white);
  border: 2px solid var(--black);
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-align: center;
  text-decoration: none;
  box-shadow: 6px 6px 0 var(--bg);
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, color .15s ease;
}
main .btn-main:hover {
  background: var(--white);
  color: var(--black);
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--bg);
}

/* --- Блок автора --- */
main .author {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: start;
  gap: 22px;
  margin: 3em 0 0;
  padding: 26px;
  background: var(--bg-soft);
  border: 2px solid var(--black);
  border-radius: var(--radius);
}
main .author__avatar {
  width: 96px;
  height: 96px;
  margin: 0;
  object-fit: cover;
  background: var(--white);
  border: 2px solid var(--black);
  border-radius: 50%;
}
main .author__label { margin: 0 0 .15em; font-size: .85rem; color: var(--muted); }
main .author__name { margin: 0 0 .5em; font-size: 1.2rem; font-weight: 800; line-height: 1.3; color: var(--black); }
main .author__text { margin: 0; }

/* --- Страница 404 --- */
main.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
main .error-page__code {
  margin: 0 0 .1em;
  font-size: clamp(6rem, 3.5rem + 11vw, 11rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.04em;
  color: var(--white);
  -webkit-text-stroke: 3px var(--black);
  text-shadow: 8px 8px 0 var(--bg);
}
main.error-page p { max-width: 46ch; }

/* =========================================================
   ФУТЕР
   ========================================================= */
.site-footer { margin-top: auto; background: var(--black); color: var(--white); }
.site-footer :focus-visible { outline-color: var(--white); }

.site-footer__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 48px 20px 40px;
  display: grid;
  gap: 30px;
}

.site-footer__nav { display: flex; flex-wrap: wrap; gap: 12px 28px; }
.site-footer__nav a {
  color: var(--white);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color .15s ease;
}
.site-footer__nav a:hover { border-color: var(--bg); }

.site-footer__title { margin: 0 0 14px; font-size: .95rem; font-weight: 700; color: rgba(255, 255, 255, .65); }

.site-footer__orgs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.site-footer__orgs a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: .5em 1.1em;
  color: var(--white);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid rgba(255, 255, 255, .35);
  border-radius: 999px;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.site-footer__orgs a:hover { background: var(--white); color: var(--black); border-color: var(--white); }

.site-footer__text {
  display: flex;
  gap: 16px;
  margin: 0;
  padding-top: 26px;
  border-top: 1px solid rgba(255, 255, 255, .15);
  font-size: .85rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, .72);
}
.badge-18 {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 2px solid var(--white);
  border-radius: 50%;
  font-size: .8rem;
  font-weight: 800;
  color: var(--white);
}

/* =========================================================
   КНОПКА «НАВЕРХ»
   ========================================================= */
.to-top {
  position: fixed;
  right: 20px;
  bottom: calc(20px + var(--popup-offset, 0px));
  z-index: 90;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  padding: 0;
  background: var(--black);
  color: var(--white);
  border: 2px solid var(--white);
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .25);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  transition: opacity .25s ease, visibility .25s ease, transform .25s ease, bottom .3s ease, background-color .15s ease, color .15s ease;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--white); color: var(--black); border-color: var(--black); }
.to-top svg { width: 22px; height: 22px; }

/* =========================================================
   ПОПАП (снизу, через 2 сек.)
   ========================================================= */
.promo-popup {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 95;
  width: min(640px, calc(100% - 24px));
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 52px 14px 16px;
  background: var(--white);
  border: 2px solid var(--black);
  border-radius: var(--radius);
  box-shadow: 6px 6px 0 var(--black);
  opacity: 0;
  transform: translate(-50%, calc(100% + 40px));
  transition: transform .45s cubic-bezier(.2, .9, .3, 1.15), opacity .3s ease;
}
.promo-popup[hidden] { display: none; }
.promo-popup.is-visible { opacity: 1; transform: translate(-50%, 0); }

.promo-popup__logo { flex-shrink: 0; display: block; width: 112px; height: auto; }
.promo-popup__text { flex: 1; margin: 0; font-size: .95rem; font-weight: 600; line-height: 1.45; }
.promo-popup__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--black);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.promo-popup__close:hover { background: var(--bg-soft); }
.promo-popup__close svg { width: 18px; height: 18px; }

/* =========================================================
   АДАПТИВ
   ========================================================= */
@media (max-width: 640px) {
  :root { --header-h: 60px; }
  body { font-size: 16px; }

  .site-header__inner { padding: 8px 12px; gap: 8px; }
  .site-logo img { width: 112px; }
  .site-header__actions { gap: 6px; }
  .site-header__actions .btn { min-height: 38px; padding: .5em .9em; font-size: .78rem; }

  main {
    width: calc(100% - 24px);
    margin: 20px auto 32px;
    padding: 28px 18px;
    border-radius: 14px;
    box-shadow: 4px 4px 0 var(--black);
  }
  main img { margin: 1.5em auto; border-radius: 12px; }
  main .btn-main { width: 100%; padding: 1em 1.4em; }
  main table { font-size: .9rem; }
  main th, main td { min-width: 140px; padding: .7em .8em; }

  main .author { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 22px 18px; }

  .site-footer__inner { padding: 36px 16px 30px; gap: 24px; }
  .site-footer__text { flex-direction: column; gap: 12px; }

  .to-top { right: 14px; width: 46px; height: 46px; }

  .promo-popup { flex-wrap: wrap; gap: 10px 12px; padding: 14px 46px 14px 14px; }
  .promo-popup__logo { width: 96px; }
  .promo-popup__text { flex-basis: 100%; }
  .promo-popup__btn { width: 100%; }
}

@media (max-width: 380px) {
  .site-logo img { width: 92px; }
  .site-header__actions .btn { padding: .5em .7em; font-size: .72rem; }
}

@media (max-width: 330px) {
  .site-header__inner { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}
