/* =============================================================================
   TOS-MODAL — пользовательское соглашение, показывается перед первым
   добавлением игры. Опирается на .modal-back / .modal из styles/misc.css,
   но даёт TOS-specific подкрутки: компактная высота по умолчанию,
   collapsible полный текст (.tos-full hidden до клика по .tos-toggle).
   ========================================================================= */

.tos-modal {
  max-width: 480px;
  padding: 18px 20px;
}

.tos-modal h2 {
  font-size: 16px;
  margin: 0 0 8px;
}

.tos-modal .tos-lead {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 12px;
  line-height: 1.45;
}

/* Toggle row: discrete link-style button, expands .tos-full. */
.tos-modal .tos-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 0;
  padding: 4px 0;
  margin: 0 0 12px;
  color: var(--warn, #d9a062);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.tos-modal .tos-toggle:hover { color: var(--text); }

.tos-modal .tos-toggle-caret {
  display: inline-block;
  transition: transform 0.18s ease;
  font-size: 11px;
  line-height: 1;
}

.tos-modal .tos-toggle.open .tos-toggle-caret {
  transform: rotate(-180deg);
}

/* Full text block — hidden until expanded. Max-height + overflow keeps the
   modal sane on small viewports. */
.tos-modal .tos-full {
  max-height: 320px;
  overflow-y: auto;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: var(--r-md, 8px);
  background: rgba(0,0,0,0.18);
}

.tos-modal .tos-list {
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tos-modal .tos-list li {
  position: relative;
  padding: 0 0 0 16px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
}

.tos-modal .tos-list li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--warn, #d9a062);
  opacity: 0.85;
}

.tos-modal .tos-note {
  font-size: 11.5px;
  color: var(--dim);
  margin: 0;
  line-height: 1.45;
}

.tos-modal .tos-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .tos-modal {
    width: min(480px, calc(100vw - 16px));
    padding: 14px 14px;
  }

  /* Полный текст: чуть ниже ограничение высоты, чтобы не съедало кнопки */
  .tos-modal .tos-full {
    max-height: 38vh;
    max-height: 38dvh;
  }

  /* Кнопки согласия: тап-таргет 44px, прижаты к низу (зона большого пальца) */
  .tos-modal .tos-actions {
    gap: 8px;
    flex-wrap: wrap;
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }
  .tos-modal .tos-actions .btn {
    min-height: 44px;
    flex: 1 1 auto;
  }

  /* Кнопка раскрытия текста */
  .tos-modal .tos-toggle {
    min-height: 44px;
  }
}
