/* ====== БАЗА / ТЕМА ====== */
:root{
  --bg: #002343;
  --text: #e6f0ff;
  --accent: #048384;
  --accent2: #044a64; /* второй цвет градиента */
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 Georgia, serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a{ color: inherit; text-decoration: none; }
img{ max-width: 100%; height: auto; display: block; }
h1,h2,h3,h4{ margin: 0 0 .6em; }
p{ margin: 0 0 1em; }
.muted{ opacity: .85; }
.small{ font-size: .9rem; }

/* Неоновая «гладкая» рамка */
.gframe{
  border: 1.5px solid transparent;
  border-radius: 16px;
  background:
    linear-gradient(var(--bg), var(--bg)) padding-box,
    linear-gradient(135deg, var(--accent), var(--accent2)) border-box;
  box-shadow: 0 8px 24px rgba(4,131,132,.18);
}
.narrow{ max-width: 1060px; margin: 0 auto; }

/* Внутренние отступы стандартного блока */
.pad{ padding: 16px; }

/* ====== ШАПКА / КАТАЛОГ ====== */
.site-header{ max-width: 1060px; margin: 18px auto 10px; padding: 16px; }
.site-title{ font-size: 2rem; font-weight: 800; }

.grid{
  max-width: 1060px;
  margin: 0 auto 40px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px,1fr));
  gap: 16px;
}

.card{
  display: grid;
  grid-template-rows: auto 1fr;
  border-radius: 16px;
  overflow: hidden;
  background: #043049;
  border: 1.5px solid transparent;
  background:
    linear-gradient(#043049,#043049) padding-box,
    linear-gradient(135deg, var(--accent), var(--accent2)) border-box;
  transition: transform .12s ease, box-shadow .12s ease;
}
.card:hover{
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(4,131,132,.22);
}
.thumb{ width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.body{ padding: 12px 14px; display: grid; gap: 6px; }
.title{ font-size: 1.1rem; font-weight: 700; }
.tag{
  display: inline-block; padding: 4px 8px; border-radius: 10px;
  background: rgba(4,131,132,.18);
}

/* ====== КНОПКИ ====== */
/* Общее: ссылки-кнопки и кнопки с классом .btn выглядят одинаково */
a.btn, button.btn{
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 14px; border-radius: 12px;
  border: 1.5px solid transparent;
  background: linear-gradient(#0000,#0000) padding-box,
              linear-gradient(135deg, var(--accent), var(--accent2)) border-box;
  color: #fff; font-weight: 700;
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
a.btn:hover, button.btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(4,131,132,.25);
}
a.btn.secondary, button.btn.secondary{
  background: #0a2e3e; color: var(--text);
  border-color: rgba(4,131,132,.35);
}
.actions{
  margin-top: 12px; display: flex; flex-wrap: wrap; gap: 10px;
}
.actions-left{ justify-content: flex-start; }

/* ====== ЭКРАН СТАРТОВОЙ ОБЛОЖКИ ====== */
.cover{ max-width: 1060px; margin: 18px auto; overflow: hidden; }
.cover .img{
  width: 100%; aspect-ratio: 16/9; object-fit: cover;
  border-radius: 16px;
}
.cover .pad{ padding: 16px 4px; }

/* ====== ВОПРОС ====== */
.q-block{ max-width: 1060px; margin: 18px auto; }
.qimg{
  width: 100%; aspect-ratio: 16/9; object-fit: cover;
  border-radius: 16px; margin-bottom: 12px;
}
.answers{
  display: grid; gap: 10px; margin-top: 8px;
  grid-template-columns: 1fr;
}
@media (min-width: 700px){
  .answers{ grid-template-columns: 1fr 1fr; }
}

/* Кнопки вариантов ответа — точечный reset для VK WebView */
button.answer{
  -webkit-appearance: none;
  appearance: none;
}
.answer{
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;

  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;

  color: var(--text);
  border: 1.5px solid transparent;
  background:
    linear-gradient(#0a2e3e, #0a2e3e) padding-box,
    linear-gradient(135deg, var(--accent), var(--accent2)) border-box;

  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease, opacity .12s ease;
  text-align: left;
}
.answer:hover{
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(4,131,132,.20);
  background:
    linear-gradient(#0d3a4d, #0d3a4d) padding-box,
    linear-gradient(135deg, var(--accent), var(--accent2)) border-box;
}
.answer:active{
  transform: translateY(0);
  opacity: .95;
}
.answer:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* На очень узких экранах чуть уменьшим паддинги */
@media (max-width: 420px){
  .answer{ padding: 10px 12px; border-radius: 10px; }
}

/* ====== РЕЗУЛЬТАТ ====== */
.result{
  max-width: 1060px; margin: 18px auto; display: grid; gap: 16px;
  grid-template-columns: 1fr 1fr;
  align-items: start;           /* не растягивать по высоте */
  overflow: visible;
  border-radius: 16px; padding: 12px;
  border: 1.5px solid transparent;
  background:
    linear-gradient(#043049,#043049) padding-box,
    linear-gradient(135deg, var(--accent), var(--accent2)) border-box;
}
@media (max-width: 860px){
  .result{ grid-template-columns: 1fr; }
}
.result .pad{ padding: 6px 6px 6px 0; }
@media (max-width: 860px){
  .result .pad{ padding: 0; }
}

/* Картинка результата — без обрезки */
.result .rimg{
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  object-fit: contain;                 /* ВПИСЫВАЕМ, НЕ РЕЖЕМ */
  max-height: min(78vh, 820px);        /* помещаемся в экран WebView */
  background: #061f2c;                 /* «поля» вокруг портрета */
  border-radius: 12px;
}

/* Длинный текст результата */
.long p{ margin: 0 0 12px; }

/* ====== МАГАЗИНЫ ====== */
.stores{ margin-top: 14px; }
.store-grid{
  margin-top: 8px;
  display: flex; flex-wrap: wrap; gap: 10px;
}
.store-link{
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 12px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: 1.5px solid transparent;
  transition: transform .12s ease, box-shadow .12s ease;
}
.store-link:hover{
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(4,131,132,.25);
}
.icon{ width: 18px; height: 18px; }

/* ====== БЛОК «ПОДЕЛИТЬСЯ» (ОТДЕЛЬНЫЙ, ПОД РЕЗУЛЬТАТОМ) ====== */
.share{
  max-width: 1060px; margin: 18px auto 28px;
  padding: 16px; border-radius: 16px;
}
.share h4{ margin: 4px 0 10px; font-weight: 700; }
.share-grid{
  display: flex; flex-wrap: wrap; gap: 10px;
}
.share-link{
  padding: 8px 12px; border-radius: 10px; color: #fff; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  transition: transform .12s ease, box-shadow .12s ease;
}
.share-link:hover{
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(4,131,132,.25);
}

/* ====== ПРОЧЕЕ ====== */
.gap{ height: 16px; }
hr{ border: 0; border-top: 1px solid rgba(255,255,255,.12); margin: 16px 0; }

/* Мелкие правки на совсем узких экранах */
@media (max-width: 420px){
  a.btn, button.btn{ padding: 9px 12px; border-radius: 10px; }
  .title{ font-size: 1.05rem; }
}

/* ====== ХОТФИКСЫ В САМОМ КОНЦЕ ====== */
/* Антикроп результата — приоритетные значения */
.result { align-items: start; overflow: visible; }
.result .rimg{
  height: auto !important;
  aspect-ratio: auto !important;
  object-fit: contain !important;
}
